fix(Scripts/TheEye): Kael'thas advisors, refactor and RP (#20188)

refactor to use base advisor class

refactor doaction

extract phase enchanted weapons

sql delete script kael_phase_two
This commit is contained in:
Jelle Meeus
2024-11-14 10:06:42 +01:00
committed by GitHub
parent 87fbdb7967
commit 980b9246c8
2 changed files with 151 additions and 342 deletions

View File

@@ -0,0 +1,5 @@
--
DELETE FROM `spell_script_names` WHERE `spell_id`=36450 AND `ScriptName`='spell_kaelthas_resurrection';
DELETE FROM `spell_script_names` WHERE `spell_id`=36709 AND `ScriptName`='spell_kaelthas_kael_phase_two';
-- fix entry from 19871 to Kael'thas for ID - 36709 Kael Phase Two
UPDATE `conditions` SET `ConditionValue2` = 19622 WHERE (`SourceTypeOrReferenceId` = 13) AND (`SourceGroup` = 1) AND (`SourceEntry` = 36709) AND (`SourceId` = 0) AND (`ConditionTypeOrReference` = 31);

View File

@@ -43,14 +43,8 @@ enum KTYells
SAY_PYROBLAST = 14, SAY_PYROBLAST = 14,
// Advisors // Advisors
SAY_THALADRED_AGGRO = 0, SAY_ADVISOR_AGGRO = 0,
SAY_SANGUINAR_AGGRO = 0, SAY_ADVISOR_DEATH = 1,
SAY_CAPERNIAN_AGGRO = 0,
SAY_TELONICUS_AGGRO = 0,
SAY_THALADRED_DEATH = 1,
SAY_SANGUINAR_DEATH = 1,
SAY_CAPERNIAN_DEATH = 1,
SAY_TELONICUS_DEATH = 1,
EMOTE_THALADRED_FIXATE = 2 EMOTE_THALADRED_FIXATE = 2
}; };
@@ -120,6 +114,7 @@ enum KTSpells
// Advisors // Advisors
// Universal // Universal
SPELL_KAEL_PHASE_TWO = 36709, SPELL_KAEL_PHASE_TWO = 36709,
SPELL_PERMANENT_FEIGN_DEATH = 29266, // placed upon advisors on fake death
// Sanguinar // Sanguinar
SPELL_BELLOWING_ROAR = 44863, SPELL_BELLOWING_ROAR = 44863,
@@ -166,11 +161,10 @@ enum KTMisc
enum KTPreFightEvents enum KTPreFightEvents
{ {
EVENT_PREFIGHT_PHASE1_01 = 1, EVENT_PREFIGHT_PHASE1_01 = 1,
EVENT_PREFIGHT_PHASE1_02 = 2, EVENT_PREFIGHT_PHASE5_01 = 2,
EVENT_PREFIGHT_PHASE5_01 = 3, EVENT_PREFIGHT_PHASE5_02 = 3,
EVENT_PREFIGHT_PHASE5_02 = 4, EVENT_PREFIGHT_PHASE6_02 = 4,
EVENT_PREFIGHT_PHASE6_02 = 5, EVENT_PREFIGHT_PHASE6_03 = 5,
EVENT_PREFIGHT_PHASE6_03 = 6,
}; };
enum KTTransitionScene enum KTTransitionScene
@@ -197,11 +191,12 @@ enum KTTransitionScene
enum KTActions enum KTActions
{ {
ACTION_START_SANGUINAR = 0, ACTION_START_THALADRED = 0,
ACTION_START_CAPERNIAN = 1, ACTION_START_SANGUINAR = 1,
ACTION_START_TELONICUS = 2, ACTION_START_CAPERNIAN = 2,
ACTION_START_WEAPONS = 3, ACTION_START_TELONICUS = 3,
ACTION_PROGRESS_PHASE_CHECK = 4 ACTION_START_WEAPONS = 4,
ACTION_PROGRESS_PHASE_CHECK = 5
}; };
enum KTSpellGroups enum KTSpellGroups
@@ -241,24 +236,6 @@ struct boss_kaelthas : public BossAI
} }
} }
void SetData(uint32 type, uint32 data) override
{
if (type == DATA_RESURRECT_CAST && data == DATA_RESURRECT_CAST)
{
summons.DoForAllSummons([&](WorldObject* summon){
if (Creature* summonedCreature = summon->ToCreature())
{
if (summonedCreature->GetEntry() >= NPC_LORD_SANGUINAR && summonedCreature->GetEntry() <= NPC_THALADRED)
{
summonedCreature->SetReactState(REACT_PASSIVE);
summonedCreature->setDeathState(DeathState::JustRespawned);
summonedCreature->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
}
});
}
}
void SetRoomState(GOState state) void SetRoomState(GOState state)
{ {
//TODO: handle door closing //TODO: handle door closing
@@ -280,6 +257,7 @@ struct boss_kaelthas : public BossAI
_phase = PHASE_NONE; _phase = PHASE_NONE;
_transitionSceneReached = false; _transitionSceneReached = false;
_advisorsAlive = 4;
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_HOVER, true); // hover effect 36550 - Floating Drowned me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_HOVER, true); // hover effect 36550 - Floating Drowned
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
@@ -304,21 +282,10 @@ struct boss_kaelthas : public BossAI
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_DISABLE_MOVE); me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_DISABLE_MOVE);
Talk(SAY_INTRO); Talk(SAY_INTRO);
DoCastAOE(SPELL_REMOVE_ENCHANTED_WEAPONS, true); DoCastAOE(SPELL_REMOVE_ENCHANTED_WEAPONS, true);
ScheduleUniqueTimedEvent(23s, [&] ScheduleUniqueTimedEvent(21s, [&]
{ {
Talk(SAY_INTRO_THALADRED); IntroduceNewAdvisor(SAY_INTRO_THALADRED, ACTION_START_THALADRED);
}, EVENT_PREFIGHT_PHASE1_01); }, EVENT_PREFIGHT_PHASE1_01);
ScheduleUniqueTimedEvent(30s, [&]
{
if (Creature* thaladred = summons.GetCreatureWithEntry(NPC_THALADRED))
{
thaladred->SetReactState(REACT_AGGRESSIVE);
thaladred->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
thaladred->AI()->AttackStart(target);
thaladred->SetInCombatWithZone();
}
}, EVENT_PREFIGHT_PHASE1_02);
} }
} }
@@ -337,70 +304,35 @@ struct boss_kaelthas : public BossAI
summon->SetReactState(REACT_PASSIVE); summon->SetReactState(REACT_PASSIVE);
} }
void DoAction(int32 action) override void SpellHit(Unit* caster, SpellInfo const* spell) override
{ {
switch (action) if (_phase == PHASE_SINGLE_ADVISOR && spell->Id == SPELL_KAEL_PHASE_TWO)
{ {
case ACTION_START_SANGUINAR: switch (caster->GetEntry())
IntroduceNewAdvisor(SAY_INTRO_SANGUINAR, ACTION_START_SANGUINAR); {
break; case NPC_THALADRED:
case ACTION_START_CAPERNIAN: IntroduceNewAdvisor(SAY_INTRO_SANGUINAR, ACTION_START_SANGUINAR);
IntroduceNewAdvisor(SAY_INTRO_CAPERNIAN, ACTION_START_CAPERNIAN); break;
break; case NPC_LORD_SANGUINAR:
case ACTION_START_TELONICUS: IntroduceNewAdvisor(SAY_INTRO_CAPERNIAN, ACTION_START_CAPERNIAN);
IntroduceNewAdvisor(SAY_INTRO_TELONICUS, ACTION_START_TELONICUS); break;
break; case NPC_CAPERNIAN:
case ACTION_START_WEAPONS: IntroduceNewAdvisor(SAY_INTRO_TELONICUS, ACTION_START_TELONICUS);
ScheduleUniqueTimedEvent(3s, [&]{ break;
Talk(SAY_PHASE2_WEAPON); case NPC_TELONICUS:
DoCastSelf(SPELL_SUMMON_WEAPONS); PhaseEnchantedWeaponsExecute();
_phase = PHASE_WEAPONS; break;
}, EVENT_PREFIGHT_PHASE5_01); default:
ScheduleUniqueTimedEvent(9s, [&]{ break;
summons.DoForAllSummons([&](WorldObject* summon) }
{ }
if (Creature* summonedCreature = summon->ToCreature()) else if (_phase == PHASE_ALL_ADVISORS && spell->Id == SPELL_KAEL_PHASE_TWO)
{ {
if (!summonedCreature->GetSpawnId()) --_advisorsAlive;
{ if (_advisorsAlive == 0)
summonedCreature->SetReactState(REACT_AGGRESSIVE); {
summonedCreature->SetInCombatWithZone(); PhaseKaelExecute();
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) }
{
summonedCreature->AI()->AttackStart(target);
}
}
}
});
scheduler.Schedule(90s, GROUP_PROGRESS_PHASE, [this](TaskContext)
{
PhaseAllAdvisorsExecute();
});
}, EVENT_PREFIGHT_PHASE5_02);
break;
case ACTION_PROGRESS_PHASE_CHECK:
if (_phase == PHASE_ALL_ADVISORS)
{
bool advisorAlive = false;
summons.DoForAllSummons([&advisorAlive](WorldObject* summon)
{
if (Creature* summonedCreature = summon->ToCreature())
{
if (summonedCreature->IsAlive())
{
if (summonedCreature->GetEntry() >= NPC_LORD_SANGUINAR && summonedCreature->GetEntry() <= NPC_THALADRED)
{
advisorAlive = true;
return;
}
}
}
});
if (!advisorAlive)
PhaseKaelExecute();
}
default:
break;
} }
} }
@@ -626,6 +558,10 @@ struct boss_kaelthas : public BossAI
//switch because talk times are different //switch because talk times are different
switch (kaelAction) switch (kaelAction)
{ {
case ACTION_START_THALADRED:
attackStartTimer = 7000ms;
advisorNPCId = NPC_THALADRED;
break;
case ACTION_START_SANGUINAR: case ACTION_START_SANGUINAR:
attackStartTimer = 14500ms; attackStartTimer = 14500ms;
advisorNPCId = NPC_LORD_SANGUINAR; advisorNPCId = NPC_LORD_SANGUINAR;
@@ -650,28 +586,26 @@ struct boss_kaelthas : public BossAI
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
advisor->AI()->AttackStart(target); advisor->AI()->AttackStart(target);
advisor->SetInCombatWithZone(); advisor->SetInCombatWithZone();
advisor->AI()->Talk(SAY_ADVISOR_AGGRO);
} }
}); });
} }
void PhaseAllAdvisorsExecute() void PhaseEnchantedWeaponsExecute()
{ {
_phase = PHASE_TRANSITION; ScheduleUniqueTimedEvent(3s, [&]{
scheduler.CancelGroup(GROUP_PROGRESS_PHASE); Talk(SAY_PHASE2_WEAPON);
Talk(SAY_PHASE3_ADVANCE); DoCastSelf(SPELL_SUMMON_WEAPONS);
ScheduleUniqueTimedEvent(6s, [&]{ _phase = PHASE_WEAPONS;
DoCastSelf(SPELL_RESURRECTION); }, EVENT_PREFIGHT_PHASE5_01);
}, EVENT_PREFIGHT_PHASE6_02); ScheduleUniqueTimedEvent(9s, [&]{
ScheduleUniqueTimedEvent(12s, [&]{
_phase = PHASE_ALL_ADVISORS;
summons.DoForAllSummons([&](WorldObject* summon) summons.DoForAllSummons([&](WorldObject* summon)
{ {
if (Creature* summonedCreature = summon->ToCreature()) if (Creature* summonedCreature = summon->ToCreature())
{ {
if (summonedCreature->GetSpawnId()) if (!summonedCreature->GetSpawnId())
{ {
summonedCreature->SetReactState(REACT_AGGRESSIVE); summonedCreature->SetReactState(REACT_AGGRESSIVE);
summonedCreature->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
summonedCreature->SetInCombatWithZone(); summonedCreature->SetInCombatWithZone();
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{ {
@@ -682,9 +616,24 @@ struct boss_kaelthas : public BossAI
}); });
scheduler.Schedule(3min, GROUP_PROGRESS_PHASE, [this](TaskContext) scheduler.Schedule(3min, GROUP_PROGRESS_PHASE, [this](TaskContext)
{ {
PhaseKaelExecute(); PhaseAllAdvisorsExecute();
}); });
}, EVENT_PREFIGHT_PHASE6_03); }, EVENT_PREFIGHT_PHASE5_02);
}
void PhaseAllAdvisorsExecute()
{
_phase = PHASE_TRANSITION;
scheduler.CancelGroup(GROUP_PROGRESS_PHASE);
Talk(SAY_PHASE3_ADVANCE);
ScheduleUniqueTimedEvent(6s, [&]{
DoCastSelf(SPELL_RESURRECTION);
_phase = PHASE_ALL_ADVISORS;
}, EVENT_PREFIGHT_PHASE6_02);
scheduler.Schedule(192s, GROUP_PROGRESS_PHASE, [this](TaskContext)
{
PhaseKaelExecute();
});
} }
void PhaseKaelExecute() void PhaseKaelExecute()
@@ -769,58 +718,89 @@ struct boss_kaelthas : public BossAI
} }
private: private:
uint32 _phase; uint32 _phase;
uint8 _advisorsAlive;
bool _transitionSceneReached = false; bool _transitionSceneReached = false;
}; };
struct npc_lord_sanguinar : public ScriptedAI
struct advisor_baseAI : public ScriptedAI
{ {
npc_lord_sanguinar(Creature* creature) : ScriptedAI(creature) { advisor_baseAI(Creature* creature) : ScriptedAI(creature) {
_instance = creature->GetInstanceScript();
scheduler.SetValidator([this] scheduler.SetValidator([this]
{ {
return !me->HasUnitState(UNIT_STATE_CASTING); return !me->HasUnitState(UNIT_STATE_CASTING);
}); });
} }
virtual void ScheduleEvents() {}
void Reset() override void Reset() override
{ {
_preventDeath = true;
_feigning = false;
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
scheduler.CancelAll(); scheduler.CancelAll();
_hasDied = false;
me->SetReactState(REACT_PASSIVE);
} }
void JustEngagedWith(Unit* /*who*/) override void JustEngagedWith(Unit* /*who*/) override { ScheduleEvents(); }
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageEffectType*/, SpellSchoolMask /*spellSchoolMask*/) override
{ {
if (!_hasDied) if (!_preventDeath)
return;
if (damage >= me->GetHealth())
{ {
Talk(SAY_SANGUINAR_AGGRO); damage = me->GetHealth() - 1; // prevent death
if (_feigning)
return;
scheduler.CancelAll();
me->AttackStop();
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
DoCastAOE(SPELL_KAEL_PHASE_TWO, true);
DoCastSelf(SPELL_PERMANENT_FEIGN_DEATH, true);
_feigning = true;
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_RESURRECTION && caster->GetEntry() == NPC_KAELTHAS)
{
me->RemoveAurasDueToSpell(SPELL_PERMANENT_FEIGN_DEATH);
me->SetStandState(UNIT_STAND_STATE_STAND);
scheduler.Schedule(6s, [&](TaskContext /*context*/)
{
_preventDeath = false;
_feigning = false;
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
DoResetThreatList();
me->SetInCombatWithZone();
me->SetReactState(REACT_AGGRESSIVE);
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
AttackStart(target);
}
ScheduleEvents();
});
} }
ScheduleTimedEvent(0s, 2s, [&]{
DoCastSelf(SPELL_BELLOWING_ROAR);
}, 30s, 40s);
} }
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
if (Creature* kael = _instance->GetCreature(DATA_KAELTHAS)) Talk(SAY_ADVISOR_DEATH);
{
kael->AI()->DoAction(ACTION_PROGRESS_PHASE_CHECK);
if (!_hasDied)
{
Talk(SAY_SANGUINAR_DEATH);
DoCastSelf(SPELL_KAEL_PHASE_TWO, true);
kael->AI()->DoAction(ACTION_START_CAPERNIAN);
_hasDied = true;
}
}
scheduler.CancelAll(); scheduler.CancelAll();
DoCastAOE(SPELL_KAEL_PHASE_TWO, true);
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
if (!UpdateVictim()) scheduler.Update(diff);
if (_feigning)
return; return;
scheduler.Update(diff); if (!UpdateVictim())
return;
if (me->HasUnitState(UNIT_STATE_CASTING)) if (me->HasUnitState(UNIT_STATE_CASTING))
return; return;
@@ -828,26 +808,20 @@ struct npc_lord_sanguinar : public ScriptedAI
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
private: private:
InstanceScript* _instance; bool _preventDeath;
bool _hasDied; bool _feigning;
}; };
struct npc_capernian : public ScriptedAI struct npc_lord_sanguinar : public advisor_baseAI
{ {
npc_capernian(Creature* creature) : ScriptedAI(creature) { npc_lord_sanguinar(Creature* creature) : advisor_baseAI(creature) { };
_instance = creature->GetInstanceScript();
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void Reset() override void ScheduleEvents() override {}
{ };
scheduler.CancelAll();
_hasDied = false; struct npc_capernian : public advisor_baseAI
me->SetReactState(REACT_PASSIVE); {
} npc_capernian(Creature* creature) : advisor_baseAI(creature) { }
void AttackStart(Unit* who) override void AttackStart(Unit* who) override
{ {
@@ -861,14 +835,10 @@ struct npc_capernian : public ScriptedAI
} }
} }
void JustEngagedWith(Unit* /*who*/) override void ScheduleEvents() override
{ {
if (!_hasDied) ScheduleTimedEvent(0ms, [&]
{ {
Talk(SAY_CAPERNIAN_AGGRO);
}
ScheduleTimedEvent(0ms, [&]{
if (!me->CanCastSpell(SPELL_CAPERNIAN_FIREBALL)) if (!me->CanCastSpell(SPELL_CAPERNIAN_FIREBALL))
{ {
me->ResumeChasingVictim(); me->ResumeChasingVictim();
@@ -878,7 +848,6 @@ struct npc_capernian : public ScriptedAI
me->GetMotionMaster()->MoveChase(me->GetVictim(), 30.0f); me->GetMotionMaster()->MoveChase(me->GetVictim(), 30.0f);
DoCastVictim(SPELL_CAPERNIAN_FIREBALL); DoCastVictim(SPELL_CAPERNIAN_FIREBALL);
} }
}, 2500ms); }, 2500ms);
ScheduleTimedEvent(7000ms, 10000ms, [&]{ ScheduleTimedEvent(7000ms, 10000ms, [&]{
DoCastRandomTarget(SPELL_CONFLAGRATION, 0, 30.0f); DoCastRandomTarget(SPELL_CONFLAGRATION, 0, 30.0f);
@@ -887,63 +856,14 @@ struct npc_capernian : public ScriptedAI
DoCastRandomTarget(SPELL_ARCANE_BURST, 0, 8.0f); DoCastRandomTarget(SPELL_ARCANE_BURST, 0, 8.0f);
}, 6s); }, 6s);
} }
void JustDied(Unit* /*killer*/) override
{
if (Creature* kael = _instance->GetCreature(DATA_KAELTHAS))
{
kael->AI()->DoAction(ACTION_PROGRESS_PHASE_CHECK);
if (!_hasDied)
{
Talk(SAY_CAPERNIAN_DEATH);
DoCastSelf(SPELL_KAEL_PHASE_TWO, true);
kael->AI()->DoAction(ACTION_START_TELONICUS);
_hasDied = true;
}
}
scheduler.CancelAll();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
scheduler.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
DoMeleeAttackIfReady();
}
private:
InstanceScript* _instance;
bool _hasDied;
}; };
struct npc_telonicus : public ScriptedAI struct npc_telonicus : public advisor_baseAI
{ {
npc_telonicus(Creature* creature) : ScriptedAI(creature) { npc_telonicus(Creature* creature) : advisor_baseAI(creature) { }
_instance = creature->GetInstanceScript();
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void Reset() override void ScheduleEvents() override
{ {
scheduler.CancelAll();
_hasDied = false;
me->SetReactState(REACT_PASSIVE);
}
void JustEngagedWith(Unit* /*who*/) override
{
if (!_hasDied)
{
Talk(SAY_TELONICUS_AGGRO);
}
ScheduleTimedEvent(0ms, [&]{ ScheduleTimedEvent(0ms, [&]{
DoCastVictim(SPELL_BOMB); DoCastVictim(SPELL_BOMB);
}, 3600ms, 7100ms); }, 3600ms, 7100ms);
@@ -951,63 +871,14 @@ struct npc_telonicus : public ScriptedAI
DoCastRandomTarget(SPELL_REMOTE_TOY, 0, 100.0f); DoCastRandomTarget(SPELL_REMOTE_TOY, 0, 100.0f);
}, 15750ms); }, 15750ms);
} }
void JustDied(Unit* /*killer*/) override
{
if (Creature* kael = _instance->GetCreature(DATA_KAELTHAS))
{
kael->AI()->DoAction(ACTION_PROGRESS_PHASE_CHECK);
if (!_hasDied)
{
Talk(SAY_TELONICUS_DEATH);
DoCastSelf(SPELL_KAEL_PHASE_TWO, true);
kael->AI()->DoAction(ACTION_START_WEAPONS);
_hasDied = true;
}
}
scheduler.CancelAll();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
scheduler.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
DoMeleeAttackIfReady();
}
private:
InstanceScript* _instance;
bool _hasDied;
}; };
struct npc_thaladred : public ScriptedAI struct npc_thaladred : public advisor_baseAI
{ {
npc_thaladred(Creature* creature) : ScriptedAI(creature) { npc_thaladred(Creature* creature) : advisor_baseAI(creature) { }
_instance = creature->GetInstanceScript();
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void Reset() override void ScheduleEvents() override
{ {
scheduler.CancelAll();
me->SetReactState(REACT_PASSIVE);
_hasDied = false;
}
void JustEngagedWith(Unit* /*who*/) override
{
if (!_hasDied)
{
Talk(SAY_THALADRED_AGGRO);
}
ScheduleTimedEvent(100ms, [&] ScheduleTimedEvent(100ms, [&]
{ {
DoResetThreatList(); DoResetThreatList();
@@ -1036,56 +907,6 @@ struct npc_thaladred : public ScriptedAI
} }
}, 3600ms, 15200ms); }, 3600ms, 15200ms);
} }
void JustDied(Unit* /*killer*/) override
{
if (Creature* kael = _instance->GetCreature(DATA_KAELTHAS))
{
kael->AI()->DoAction(ACTION_PROGRESS_PHASE_CHECK);
if (!_hasDied)
{
Talk(SAY_THALADRED_DEATH);
DoCastSelf(SPELL_KAEL_PHASE_TWO, true);
kael->AI()->DoAction(ACTION_START_SANGUINAR);
_hasDied = true;
}
}
scheduler.CancelAll();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
scheduler.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
DoMeleeAttackIfReady();
}
private:
InstanceScript* _instance;
bool _hasDied;
};
class spell_kaelthas_kael_phase_two : public SpellScript
{
PrepareSpellScript(spell_kaelthas_kael_phase_two);
bool Load() override
{
if (GetCaster()->IsCreature())
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
if (Creature* kael = instance->GetCreature(DATA_KAELTHAS))
kael->AI()->SummonedCreatureDies(GetCaster()->ToCreature(), nullptr);
return true;
}
void Register() override
{
}
}; };
class spell_kaelthas_remote_toy : public AuraScript class spell_kaelthas_remote_toy : public AuraScript
@@ -1122,21 +943,6 @@ class spell_kaelthas_summon_weapons : public SpellScript
} }
}; };
class spell_kaelthas_resurrection : public SpellScript
{
PrepareSpellScript(spell_kaelthas_resurrection);
void HandleBeforeCast()
{
GetCaster()->GetAI()->SetData(DATA_RESURRECT_CAST, DATA_RESURRECT_CAST);
}
void Register() override
{
BeforeCast += SpellCastFn(spell_kaelthas_resurrection::HandleBeforeCast);
}
};
class spell_kaelthas_mind_control : public SpellScript class spell_kaelthas_mind_control : public SpellScript
{ {
PrepareSpellScript(spell_kaelthas_mind_control); PrepareSpellScript(spell_kaelthas_mind_control);
@@ -1380,10 +1186,8 @@ void AddSC_boss_kaelthas()
RegisterTheEyeAI(npc_capernian); RegisterTheEyeAI(npc_capernian);
RegisterTheEyeAI(npc_telonicus); RegisterTheEyeAI(npc_telonicus);
RegisterTheEyeAI(npc_thaladred); RegisterTheEyeAI(npc_thaladred);
RegisterSpellScript(spell_kaelthas_kael_phase_two);
RegisterSpellScript(spell_kaelthas_remote_toy); RegisterSpellScript(spell_kaelthas_remote_toy);
RegisterSpellScript(spell_kaelthas_summon_weapons); RegisterSpellScript(spell_kaelthas_summon_weapons);
RegisterSpellScript(spell_kaelthas_resurrection);
RegisterSpellScript(spell_kaelthas_mind_control); RegisterSpellScript(spell_kaelthas_mind_control);
RegisterSpellScript(spell_kaelthas_burn); RegisterSpellScript(spell_kaelthas_burn);
RegisterSpellScript(spell_kaelthas_flame_strike); RegisterSpellScript(spell_kaelthas_flame_strike);