diff --git a/src/naxx40Scripts/boss_kelthuzad_40.cpp b/src/naxx40Scripts/boss_kelthuzad_40.cpp
index 28b5c44..3d59767 100644
--- a/src/naxx40Scripts/boss_kelthuzad_40.cpp
+++ b/src/naxx40Scripts/boss_kelthuzad_40.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "CreatureScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
@@ -42,8 +43,10 @@ enum Yells
enum Spells
{
// Kel'Thzuad
- SPELL_FROST_BOLT_SINGLE = 28478,
- SPELL_FROST_BOLT_MULTI = 28479,
+ SPELL_FROST_BOLT_SINGLE_10 = 28478,
+ SPELL_FROST_BOLT_SINGLE_25 = 55802,
+ SPELL_FROST_BOLT_MULTI_10 = 28479,
+ SPELL_FROST_BOLT_MULTI_25 = 55807,
SPELL_SHADOW_FISURE = 27810,
SPELL_VOID_BLAST = 27812,
SPELL_DETONATE_MANA = 27819,
@@ -61,10 +64,10 @@ enum Spells
enum Misc
{
- NPC_SOLDIER_OF_THE_FROZEN_WASTES = 351073,
- NPC_UNSTOPPABLE_ABOMINATION = 351074,
- NPC_SOUL_WEAVER = 351075,
- NPC_GUARDIAN_OF_ICECROWN = 351076,
+ // NPC_SOLDIER_OF_THE_FROZEN_WASTES = 16427,
+ // NPC_UNSTOPPABLE_ABOMINATION = 16428,
+ // NPC_SOUL_WEAVER = 16429,
+ // NPC_GUARDIAN_OF_ICECROWN = 16441,
ACTION_CALL_HELP_ON = 1,
ACTION_CALL_HELP_OFF = 2,
@@ -142,15 +145,10 @@ public:
struct boss_kelthuzad_40AI : public BossAI
{
explicit boss_kelthuzad_40AI(Creature* c) : BossAI(c, BOSS_KELTHUZAD), summons(me)
- {
- pInstance = me->GetInstanceScript();
- _justSpawned = true;
- }
+ {}
EventMap events;
SummonList summons;
- InstanceScript* pInstance;
- bool _justSpawned;
float NormalizeOrientation(float o)
{
@@ -221,35 +219,23 @@ public:
summons.DespawnAll();
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
me->SetReactState(REACT_AGGRESSIVE);
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_FLOOR)))
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_FLOOR))
{
go->SetPhaseMask(1, true);
go->SetGoState(GO_STATE_READY);
}
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_GATE)))
- {
- if(!_justSpawned) // Don't open the door if we just spawned and are still doing the conversation
- {
- go->SetGoState(GO_STATE_ACTIVE);
- }
- }
- _justSpawned = false;
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_PORTAL_1)))
- {
+
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_PORTAL_1))
go->SetGoState(GO_STATE_READY);
- }
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_PORTAL_2)))
- {
+
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_PORTAL_2))
go->SetGoState(GO_STATE_READY);
- }
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_PORTAL_3)))
- {
+
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_PORTAL_3))
go->SetGoState(GO_STATE_READY);
- }
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_PORTAL_4)))
- {
+
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_PORTAL_4))
go->SetGoState(GO_STATE_READY);
- }
}
void EnterEvadeMode(EvadeReason why) override
@@ -260,14 +246,11 @@ public:
void KilledUnit(Unit* who) override
{
- if (who->GetTypeId() != TYPEID_PLAYER)
+ if (!who->IsPlayer())
return;
Talk(SAY_SLAY);
- if (pInstance)
- {
- pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
- }
+ instance->StorePersistentData(PERSISTENT_DATA_IMMORTAL_FAIL, 1);
}
void JustDied(Unit* killer) override
@@ -279,18 +262,11 @@ public:
guardian->AI()->Talk(EMOTE_GUARDIAN_FLEE);
}
Talk(SAY_DEATH);
- if (pInstance)
- {
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_GATE)))
- {
- go->SetGoState(GO_STATE_ACTIVE);
- }
- }
}
void MoveInLineOfSight(Unit* who) override
{
- if (!me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && who->IsAlive() && me->GetDistance(who) <= 50.0f)
+ if (!me->IsInCombat() && who->IsPlayer() && who->IsAlive() && me->GetDistance(who) <= 50.0f)
AttackStart(who);
}
@@ -303,23 +279,17 @@ public:
me->SetTarget();
me->SetReactState(REACT_PASSIVE);
me->CastSpell(me, SPELL_KELTHUZAD_CHANNEL, false);
- events.ScheduleEvent(EVENT_SPAWN_POOL, 5000);
- events.ScheduleEvent(EVENT_SUMMON_SOLDIER, 6400);
- events.ScheduleEvent(EVENT_SUMMON_UNSTOPPABLE_ABOMINATION, 10000);
- events.ScheduleEvent(EVENT_SUMMON_SOUL_WEAVER, 12000);
- events.ScheduleEvent(EVENT_PHASE_2, 228000);
- events.ScheduleEvent(EVENT_ENRAGE, 900000);
- if (pInstance)
+ events.ScheduleEvent(EVENT_SPAWN_POOL, 5s);
+ events.ScheduleEvent(EVENT_SUMMON_SOLDIER, 6400ms);
+ events.ScheduleEvent(EVENT_SUMMON_UNSTOPPABLE_ABOMINATION, 10s);
+ events.ScheduleEvent(EVENT_SUMMON_SOUL_WEAVER, 12s);
+ events.ScheduleEvent(EVENT_PHASE_2, 228s);
+ events.ScheduleEvent(EVENT_ENRAGE, 15min);
+
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_FLOOR))
{
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_FLOOR)))
- {
- events.ScheduleEvent(EVENT_FLOOR_CHANGE, 15000);
- go->SetGoState(GO_STATE_ACTIVE);
- }
- }
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_GATE)))
- {
- go->SetGoState(GO_STATE_READY);
+ events.ScheduleEvent(EVENT_FLOOR_CHANGE, 15s);
+ go->SetGoState(GO_STATE_ACTIVE);
}
}
@@ -351,14 +321,11 @@ public:
switch (events.ExecuteEvent())
{
case EVENT_FLOOR_CHANGE:
- if (pInstance)
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_FLOOR))
{
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_FLOOR)))
- {
- events.ScheduleEvent(EVENT_FLOOR_CHANGE, 15000);
- go->SetGoState(GO_STATE_READY);
- go->SetPhaseMask(2, true);
- }
+ events.ScheduleEvent(EVENT_FLOOR_CHANGE, 15s);
+ go->SetGoState(GO_STATE_READY);
+ go->SetPhaseMask(2, true);
}
break;
case EVENT_SPAWN_POOL:
@@ -366,15 +333,15 @@ public:
break;
case EVENT_SUMMON_SOLDIER:
SummonHelper(NPC_SOLDIER_OF_THE_FROZEN_WASTES, 1);
- events.RepeatEvent(3100);
+ events.Repeat(3100ms);
break;
case EVENT_SUMMON_UNSTOPPABLE_ABOMINATION:
SummonHelper(NPC_UNSTOPPABLE_ABOMINATION, 1);
- events.RepeatEvent(18500);
+ events.Repeat(18s + 500ms);
break;
case EVENT_SUMMON_SOUL_WEAVER:
SummonHelper(NPC_SOUL_WEAVER, 1);
- events.RepeatEvent(30000);
+ events.Repeat(30s);
break;
case EVENT_PHASE_2:
Talk(EMOTE_PHASE_TWO);
@@ -385,42 +352,42 @@ public:
me->GetMotionMaster()->MoveChase(me->GetVictim());
me->RemoveAura(SPELL_KELTHUZAD_CHANNEL);
me->SetReactState(REACT_AGGRESSIVE);
- events.ScheduleEvent(EVENT_FROST_BOLT_SINGLE, urand(2000, 10000));
- events.ScheduleEvent(EVENT_FROST_BOLT_MULTI, urand(15000, 30000));
- events.ScheduleEvent(EVENT_DETONATE_MANA, 30000);
- events.ScheduleEvent(EVENT_PHASE_3, 1000);
- events.ScheduleEvent(EVENT_SHADOW_FISSURE, 25000);
- events.ScheduleEvent(EVENT_FROST_BLAST, 45000);
+ events.ScheduleEvent(EVENT_FROST_BOLT_SINGLE, 2s, 10s);
+ events.ScheduleEvent(EVENT_FROST_BOLT_MULTI, 15s, 30s);
+ events.ScheduleEvent(EVENT_DETONATE_MANA, 30s);
+ events.ScheduleEvent(EVENT_PHASE_3, 1s);
+ events.ScheduleEvent(EVENT_SHADOW_FISSURE, 25s);
+ events.ScheduleEvent(EVENT_FROST_BLAST, 45s);
if (Is25ManRaid())
{
- events.ScheduleEvent(EVENT_CHAINS, 90000);
+ events.ScheduleEvent(EVENT_CHAINS, 90s);
}
break;
case EVENT_ENRAGE:
me->CastSpell(me, SPELL_BERSERK, true);
break;
case EVENT_FROST_BOLT_SINGLE:
- me->CastSpell(me->GetVictim(), SPELL_FROST_BOLT_SINGLE, false);
- events.RepeatEvent(urand(2000, 10000));
+ me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_FROST_BOLT_SINGLE_10, SPELL_FROST_BOLT_SINGLE_25, SPELL_FROST_BOLT_SINGLE_10, SPELL_FROST_BOLT_SINGLE_25), false);
+ events.Repeat(2s, 10s);
break;
case EVENT_FROST_BOLT_MULTI:
- me->CastSpell(me, SPELL_FROST_BOLT_MULTI, false);
- events.RepeatEvent(urand(15000, 30000));
+ me->CastSpell(me, RAID_MODE(SPELL_FROST_BOLT_MULTI_10, SPELL_FROST_BOLT_MULTI_25, SPELL_FROST_BOLT_MULTI_10, SPELL_FROST_BOLT_MULTI_25), false);
+ events.Repeat(15s, 30s);
break;
case EVENT_SHADOW_FISSURE:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
{
me->CastSpell(target, SPELL_SHADOW_FISURE, false);
}
- events.RepeatEvent(25000);
+ events.Repeat(25s);
break;
case EVENT_FROST_BLAST:
- if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0, true))
+ if (Unit* target = SelectTarget(SelectTargetMethod::Random, RAID_MODE(1, 0, 0, 0), 0, true))
{
me->CastSpell(target, SPELL_FROST_BLAST, false);
}
Talk(SAY_FROST_BLAST);
- events.RepeatEvent(45000);
+ events.Repeat(45s);
break;
case EVENT_CHAINS:
for (uint8 i = 0; i < 3; ++i)
@@ -431,7 +398,7 @@ public:
}
}
Talk(SAY_CHAIN);
- events.RepeatEvent(90000);
+ events.Repeat(90s);
break;
case EVENT_DETONATE_MANA:
{
@@ -439,7 +406,7 @@ public:
ThreatContainer::StorageType const& threatList = me->GetThreatMgr().GetThreatList();
for (auto itr : threatList)
{
- if (itr->getTarget()->GetTypeId() == TYPEID_PLAYER
+ if (itr->getTarget()->IsPlayer()
&& itr->getTarget()->getPowerType() == POWER_MANA
&& itr->getTarget()->GetPower(POWER_MANA))
{
@@ -453,48 +420,41 @@ public:
me->CastSpell(*itr, SPELL_DETONATE_MANA, false);
Talk(SAY_SPECIAL);
}
- events.RepeatEvent(30000);
+ events.Repeat(30s);
break;
}
case EVENT_PHASE_3:
if (me->HealthBelowPct(45))
{
Talk(SAY_REQUEST_AID);
- events.DelayEvents(5500);
- events.ScheduleEvent(EVENT_P3_LICH_KING_SAY, 5000);
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_PORTAL_1)))
- {
+ events.DelayEvents(5500ms);
+ events.ScheduleEvent(EVENT_P3_LICH_KING_SAY, 5s);
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_PORTAL_1))
go->SetGoState(GO_STATE_ACTIVE);
- }
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_PORTAL_2)))
- {
+
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_PORTAL_2))
go->SetGoState(GO_STATE_ACTIVE);
- }
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_PORTAL_3)))
- {
+
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_PORTAL_3))
go->SetGoState(GO_STATE_ACTIVE);
- }
- if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_KELTHUZAD_PORTAL_4)))
- {
+
+ if (GameObject* go = instance->GetGameObject(DATA_KELTHUZAD_PORTAL_4))
go->SetGoState(GO_STATE_ACTIVE);
- }
+
break;
}
- events.RepeatEvent(1000);
+ events.Repeat(1s);
break;
case EVENT_P3_LICH_KING_SAY:
- if (pInstance)
- {
- if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(DATA_LICH_KING_BOSS)))
- {
- cr->AI()->Talk(SAY_ANSWER_REQUEST);
- }
- }
- for (uint8 i = 0 ; i < 5; ++i)
- {
+ {
+ if (Creature* cr = instance->GetCreature(DATA_LICH_KING_BOSS))
+ cr->AI()->Talk(SAY_ANSWER_REQUEST);
+
+ for (uint8 i = 0 ; i < RAID_MODE(2, 4, 4, 4); ++i)
events.ScheduleEvent(EVENT_SUMMON_GUARDIAN_OF_ICECROWN, 10000 + (i * 5000));
- }
+
break;
+ }
case EVENT_SUMMON_GUARDIAN_OF_ICECROWN:
if (Creature* cr = me->SummonCreature(NPC_GUARDIAN_OF_ICECROWN, SpawnPool[RAND(0, 1, 3, 4)]))
{
@@ -562,7 +522,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
- if (who->GetTypeId() != TYPEID_PLAYER && !who->IsPet())
+ if (!who->IsPlayer() && !who->IsPet())
return;
ScriptedAI::MoveInLineOfSight(who);
@@ -570,10 +530,8 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (me->GetEntry() == NPC_UNSTOPPABLE_ABOMINATION && me->GetInstanceScript())
- {
+ if (me->GetEntry() == NPC_UNSTOPPABLE_ABOMINATION)
me->GetInstanceScript()->SetData(DATA_ABOMINATION_KILLED, 0);
- }
}
void AttackStart(Unit* who) override
@@ -604,21 +562,19 @@ public:
me->SetInCombatWithZone();
if (me->GetEntry() == NPC_UNSTOPPABLE_ABOMINATION)
{
- events.ScheduleEvent(EVENT_MINION_FRENZY, 1000);
- events.ScheduleEvent(EVENT_MINION_MORTAL_WOUND, 5000);
+ events.ScheduleEvent(EVENT_MINION_FRENZY, 1s);
+ events.ScheduleEvent(EVENT_MINION_MORTAL_WOUND, 5s);
}
else if (me->GetEntry() == NPC_GUARDIAN_OF_ICECROWN)
{
- events.ScheduleEvent(EVENT_MINION_BLOOD_TAP, 15000);
+ events.ScheduleEvent(EVENT_MINION_BLOOD_TAP, 15s);
}
}
void KilledUnit(Unit* who) override
{
- if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript())
- {
- me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0);
- }
+ if (who->IsPlayer())
+ me->GetInstanceScript()->StorePersistentData(PERSISTENT_DATA_IMMORTAL_FAIL, 1);
}
void JustReachedHome() override
@@ -642,7 +598,7 @@ public:
{
case EVENT_MINION_MORTAL_WOUND:
me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false);
- events.RepeatEvent(15000);
+ events.Repeat(15s);
break;
case EVENT_MINION_FRENZY:
if (me->HealthBelowPct(35))
@@ -650,11 +606,11 @@ public:
me->CastSpell(me, SPELL_FRENZY, true);
break;
}
- events.RepeatEvent(1000);
+ events.Repeat(1s);
break;
case EVENT_MINION_BLOOD_TAP:
me->CastSpell(me->GetVictim(), SPELL_BLOOD_TAP, false);
- events.RepeatEvent(15000);
+ events.Repeat(15s);
break;
}
DoMeleeAttackIfReady();
@@ -666,6 +622,11 @@ class spell_kelthuzad_frost_blast : public SpellScript
{
PrepareSpellScript(spell_kelthuzad_frost_blast);
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ return ValidateSpellInfo({ SPELL_FROST_BLAST });
+ }
+
void FilterTargets(std::list& targets)
{
Unit* caster = GetCaster();
@@ -726,3 +687,4 @@ void AddSC_boss_kelthuzad_40()
// RegisterSpellScript(spell_kelthuzad_frost_blast);
// RegisterSpellScript(spell_kelthuzad_detonate_mana_aura);
}
+