Scripts/Icecrown Citadel: Some fixes for Valithria Dreamwalker's encounter

Closes #22754 #21887 #17882
Ty sirikfoll for all help
Bonus fixes: Abomination letting worms when fight end, visual missing, archmages stop respawn if corpse despawn

(cherry picked from commit dd81978f43)
This commit is contained in:
Keader
2019-01-05 01:14:57 -03:00
committed by Shauren
parent 3b1ed434ae
commit dd067390dc
2 changed files with 69 additions and 39 deletions

View File

@@ -0,0 +1,20 @@
-- Valithria Dreamwalker fixes
DELETE FROM `creature` WHERE `id`=37868;
DELETE FROM `creature_summon_groups` WHERE `summonerId`=38752;
INSERT INTO `creature_summon_groups` (`summonerId`,`summonerType`,`groupId`,`entry`,`position_x`,`position_y`,`position_z`,`orientation`,`summonType`,`summonTime`) VALUES
-- Group All Difficulty
(38752,0,1,37868,4222.86,2504.58,364.96,3.90954,8,0), -- Risen Archmage
(38752,0,1,37868,4223.4 ,2465.11,364.952,2.3911,8,0), -- Risen Archmage
-- Group 10 Man
(38752,0,2,37868,4230.44,2478.56,364.953,2.93215,8,0), -- Risen Archmage
(38752,0,2,37868,4230.53,2490.22,364.957,3.36849,8,0), -- Risen Archmage
-- Group 25 man
(38752,0,3,37868,4185.29,2464.01,364.87,0.798137,8,0), -- Risen Archmage
(38752,0,3,37868,4183.7 ,2503.93,364.879,5.50843,8,0); -- Risen Archmage
UPDATE `creature` SET `phaseGroup`=650 WHERE `id` IN (36789) AND `map`=631; -- old phasemask 1 | 32, phase ids 169, 174
UPDATE `creature` SET `phaseId`=173 WHERE `id` IN (37985) AND `map`=631; -- old phasemask 16, phase ids 173
UPDATE `creature` SET `phaseGroup`=391 WHERE `id` IN (16980,38752) AND `map`=631; -- old phasemask 1 | 16, phase ids 169, 173
UPDATE `creature` SET `phaseGroup`=413 WHERE `id` IN (38421,37950) AND `map`=631; -- old phasemask 16 | 32, phase ids 173, 174
UPDATE `creature_template` SET `flags_extra`=2 WHERE `entry`=37950;
UPDATE `conditions` SET `ConditionValue2`=37950 WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN(72031,72032,72033,71946);

View File

@@ -147,22 +147,16 @@ enum Misc
ACTION_ENTER_COMBAT = 1,
MISSED_PORTALS = 2,
ACTION_DEATH = 3,
DATA_SUPPRESSERS_COUNT = 4
ACTION_SETUP_ARCHMAGES = 4,
DATA_SUPPRESSERS_COUNT = 4,
POINT_VALITHRIA = 42,
SUMMON_GROUP_ALL = 1,
SUMMON_GROUP_10 = 2,
SUMMON_GROUP_25 = 3
};
Position const ValithriaSpawnPos = {4210.813f, 2484.443f, 364.9558f, 0.01745329f};
class RisenArchmageCheck
{
public:
// look for all permanently spawned Risen Archmages that are not yet in combat
bool operator()(Creature* creature)
{
return creature->IsAlive() && creature->GetEntry() == NPC_RISEN_ARCHMAGE &&
creature->GetSpawnId() && !creature->IsInCombat();
}
};
struct ManaVoidSelector : public std::unary_function<Unit*, bool>
{
explicit ManaVoidSelector(WorldObject const* source) : _source(source) { }
@@ -246,6 +240,7 @@ class ValithriaDespawner : public BasicEvent
case NPC_COLUMN_OF_FROST:
case NPC_ROT_WORM:
case NPC_RISEN_ARCHMAGE:
case NPC_GREEN_DRAGON_COMBAT_TRIGGER:
break;
default:
return;
@@ -293,6 +288,7 @@ class boss_valithria_dreamwalker : public CreatureScript
void Reset() override
{
_events.Reset();
me->SetHealth(_spawnHealth);
me->SetReactState(REACT_PASSIVE);
me->LoadCreaturesAddon();
@@ -387,11 +383,11 @@ class boss_valithria_dreamwalker : public CreatureScript
me->SetDisplayId(11686);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->DespawnOrUnsummon(4000);
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING)))
lichKing->CastSpell(lichKing, SPELL_SPAWN_CHEST, false);
if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_TRIGGER)))
Unit::Kill(me, trigger);
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING)))
lichKing->CastSpell(lichKing, SPELL_SPAWN_CHEST);
}
}
@@ -494,13 +490,23 @@ class npc_green_dragon_combat_trigger : public CreatureScript
{
_Reset();
me->SetReactState(REACT_PASSIVE);
summons.DespawnAll();
// Setup Archmages
me->SummonCreatureGroup(SUMMON_GROUP_ALL);
if (Is25ManRaid())
me->SummonCreatureGroup(SUMMON_GROUP_25);
else
me->SummonCreatureGroup(SUMMON_GROUP_10);
EntryCheckPredicate pred(NPC_RISEN_ARCHMAGE);
summons.DoAction(ACTION_SETUP_ARCHMAGES, pred);
}
void JustEnteredCombat(Unit* target) override
{
if (!instance->CheckRequiredBosses(DATA_VALITHRIA_DREAMWALKER, target->ToPlayer()))
{
EnterEvadeMode();
EnterEvadeMode(EVADE_REASON_SEQUENCE_BREAK);
instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT);
return;
}
@@ -510,6 +516,8 @@ class npc_green_dragon_combat_trigger : public CreatureScript
instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, IN_PROGRESS);
if (Creature* valithria = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)))
valithria->AI()->DoAction(ACTION_ENTER_COMBAT);
EntryCheckPredicate pred(NPC_RISEN_ARCHMAGE);
summons.DoAction(ACTION_ENTER_COMBAT, pred);
}
void AttackStart(Unit* target) override
@@ -526,6 +534,9 @@ class npc_green_dragon_combat_trigger : public CreatureScript
void JustExitedCombat() override
{
me->setActive(false);
// JustExitedCombat is called on death too, so if creature is dead, avoid "respawn" event
if (!me->IsAlive())
return;
DoAction(ACTION_DEATH);
}
@@ -535,6 +546,8 @@ class npc_green_dragon_combat_trigger : public CreatureScript
{
instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, NOT_STARTED);
me->m_Events.AddEventAtOffset(new ValithriaDespawner(me), 5s);
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VALITHRIA_LICH_KING)))
lichKing->AI()->EnterEvadeMode();
}
}
@@ -680,6 +693,7 @@ class npc_risen_archmage : public CreatureScript
void Initialize()
{
_canCallJustEngagedWith = true;
_isInitialArchmage = false;
}
bool CanAIAttack(Unit const* target) const override
@@ -699,15 +713,8 @@ class npc_risen_archmage : public CreatureScript
void JustEngagedWith(Unit* target) override
{
me->FinishSpell(CURRENT_CHANNELED_SPELL, false);
if (me->GetSpawnId() && _canCallJustEngagedWith)
if (_isInitialArchmage && _canCallJustEngagedWith)
{
std::list<Creature*> archmages;
RisenArchmageCheck check;
Trinity::CreatureListSearcher<RisenArchmageCheck> searcher(me, archmages, check);
Cell::VisitGridObjects(me, searcher, 100.0f);
for (std::list<Creature*>::iterator itr = archmages.begin(); itr != archmages.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_ENTER_COMBAT);
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING)))
{
lichKing->EngageWithTarget(target);
@@ -724,12 +731,14 @@ class npc_risen_archmage : public CreatureScript
void DoAction(int32 action) override
{
if (action != ACTION_ENTER_COMBAT)
return;
_canCallJustEngagedWith = false;
DoZoneInCombat();
_canCallJustEngagedWith = true;
if (action == ACTION_ENTER_COMBAT)
{
_canCallJustEngagedWith = false;
DoZoneInCombat();
_canCallJustEngagedWith = true;
}
else if (action == ACTION_SETUP_ARCHMAGES)
_isInitialArchmage = true;
}
void JustSummoned(Creature* summon) override
@@ -742,10 +751,8 @@ class npc_risen_archmage : public CreatureScript
void UpdateAI(uint32 diff) override
{
if (!me->IsInCombat())
if (me->GetSpawnId())
if (!me->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
DoCast(me, SPELL_CORRUPTION);
if (!me->IsInCombat() && _isInitialArchmage && !me->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
DoCastSelf(SPELL_CORRUPTION);
if (!UpdateVictim())
return;
@@ -785,6 +792,7 @@ class npc_risen_archmage : public CreatureScript
EventMap _events;
InstanceScript* _instance;
bool _canCallJustEngagedWith;
bool _isInitialArchmage;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -877,15 +885,14 @@ class npc_suppresser : public CreatureScript
{
float x, y, z;
valithria->GetContactPoint(me, x,y,z);
me->GetMotionMaster()->MovePoint(42, x, y, z);
me->GetMotionMaster()->MovePoint(POINT_VALITHRIA, x, y, z);
}
}
void MovementInform(uint32 /*type*/, uint32 id) override
{
if (id == 42)
if (id == POINT_VALITHRIA)
{
me->SetReactState(REACT_AGGRESSIVE);
if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)))
{
AttackStart(valithria);
@@ -983,9 +990,12 @@ class npc_gluttonous_abomination : public CreatureScript
_events.ScheduleEvent(EVENT_GUT_SPRAY, 10s, 13s);
}
void JustDied(Unit* /*killer*/) override
void JustDied(Unit* killer) override
{
DoCast(me, SPELL_ROT_WORM_SPAWNER, true);
if (killer->GetEntry() == NPC_VALITHRIA_DREAMWALKER)
return;
DoCastSelf(SPELL_ROT_WORM_SPAWNER, true);
}
void UpdateAI(uint32 diff) override