Scripts/TheStockades: updated all scripts to modern standards and execute Alliance specific events only when an Alliance player created the instance

This commit is contained in:
Ovahlord
2020-10-29 03:57:42 +01:00
parent 5e57c8cf85
commit 3a89bf19af
5 changed files with 253 additions and 285 deletions

View File

@@ -23,13 +23,13 @@
enum Says
{
SAY_PULL = 0, // Forest just setback!
SAY_ENRAGE = 1, // AreaTriggerMessage: Hogger Enrages!
SAY_DEATH = 2, // Yiipe!
SAY_AGGRO = 0,
SAY_ENRAGE = 1,
SAY_DEATH = 2,
SAY_WARDEN_1 = 0, // Yell - This ends here, Hogger!
SAY_WARDEN_2 = 1, // Say - He's...he's dead?
SAY_WARDEN_3 = 2 // Say - It's simply too good to be true. You couldn't have killed him so easily!
SAY_WARDEN_1 = 0,
SAY_WARDEN_2 = 1,
SAY_WARDEN_3 = 2
};
enum Spells
@@ -54,139 +54,118 @@ enum Points
POINT_FINISH = 0
};
Position const wardenthelwatermovepos = { 152.019f, 106.198f, -35.1896f, 1.082104f };
Position const wardenthelwaterpos = { 138.369f, 78.2932f, -33.85627f, 1.082104f };
Position const WardenThelwaterMovePos = { 152.019f, 106.198f, -35.1896f, 1.082104f };
Position const WardenThelWaterPos = { 138.369f, 78.2932f, -33.85627f, 1.082104f };
class boss_hogger : public CreatureScript
struct boss_hogger : public BossAI
{
public:
boss_hogger() : CreatureScript("boss_hogger") { }
boss_hogger(Creature* creature) : BossAI(creature, DATA_HOGGER), _hasEnraged(false) { }
struct boss_hoggerAI : public BossAI
void JustEngagedWith(Unit* who) override
{
boss_hoggerAI(Creature* creature) : BossAI(creature, DATA_HOGGER), _hasEnraged(false) { }
BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_VICIOUS_SLICE, 3s, 4s);
events.ScheduleEvent(EVENT_MADDENING_CALL, 1s, 2s);
}
void JustEngagedWith(Unit* who) override
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
if (instance->instance->GetTeamInInstance() == ALLIANCE)
me->SummonCreature(NPC_WARDEN_THELWATER, WardenThelWaterPos);
}
void JustSummoned(Creature* summon) override
{
BossAI::JustSummoned(summon);
if (summon->GetEntry() == NPC_WARDEN_THELWATER)
summon->GetMotionMaster()->MovePoint(POINT_FINISH, WardenThelwaterMovePos);
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
BossAI::JustEngagedWith(who);
Talk(SAY_PULL);
events.ScheduleEvent(EVENT_VICIOUS_SLICE, Seconds(3), Seconds(4));
events.ScheduleEvent(EVENT_MADDENING_CALL, Seconds(1), Seconds(2));
}
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
me->SummonCreature(NPC_WARDEN_THELWATER, wardenthelwaterpos);
}
void JustSummoned(Creature* summon) override
{
BossAI::JustSummoned(summon);
if (summon->GetEntry() == NPC_WARDEN_THELWATER)
summon->GetMotionMaster()->MovePoint(POINT_FINISH, wardenthelwatermovepos);
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
switch (eventId)
{
case EVENT_VICIOUS_SLICE:
DoCastVictim(SPELL_VICIOUS_SLICE);
events.Repeat(10s, 14s);
break;
case EVENT_MADDENING_CALL:
DoCast(SPELL_MADDENING_CALL);
events.Repeat(15s, 20s);
break;
}
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_VICIOUS_SLICE:
DoCastVictim(SPELL_VICIOUS_SLICE);
events.Repeat(Seconds(10), Seconds(14));
break;
case EVENT_MADDENING_CALL:
DoCast(SPELL_MADDENING_CALL);
events.Repeat(Seconds(15), Seconds(20));
break;
}
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
}
DoMeleeAttackIfReady();
}
void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
if (me->HealthBelowPctDamaged(30, damage) && !_hasEnraged)
{
_hasEnraged = true;
Talk(SAY_ENRAGE);
DoCastSelf(SPELL_ENRAGE);
}
}
private:
bool _hasEnraged;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetStormwindStockadeAI<boss_hoggerAI>(creature);
DoMeleeAttackIfReady();
}
void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
if (me->HealthBelowPctDamaged(30, damage) && !_hasEnraged)
{
_hasEnraged = true;
Talk(SAY_ENRAGE);
DoCastSelf(SPELL_ENRAGE);
}
}
private:
bool _hasEnraged;
};
class npc_warden_thelwater : public CreatureScript
struct npc_warden_thelwater : public ScriptedAI
{
public:
npc_warden_thelwater() : CreatureScript("npc_warden_thelwater") {}
npc_warden_thelwater(Creature* creature) : ScriptedAI(creature) {}
struct npc_warden_thelwaterAI : public ScriptedAI
void MovementInform(uint32 type, uint32 id) override
{
npc_warden_thelwaterAI(Creature* creature) : ScriptedAI(creature) {}
if (type == POINT_MOTION_TYPE && id == POINT_FINISH)
_events.ScheduleEvent(EVENT_SAY_WARDEN_1, 1s);
}
void MovementInform(uint32 type, uint32 id) override
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
if (type == POINT_MOTION_TYPE && id == POINT_FINISH)
_events.ScheduleEvent(EVENT_SAY_WARDEN_1, Seconds(1));
}
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
switch (eventId)
{
switch (eventId)
{
case EVENT_SAY_WARDEN_1:
Talk(SAY_WARDEN_1);
_events.ScheduleEvent(EVENT_SAY_WARDEN_2, Seconds(4));
break;
case EVENT_SAY_WARDEN_2:
Talk(SAY_WARDEN_2);
_events.ScheduleEvent(EVENT_SAY_WARDEN_3, Seconds(3));
break;
case EVENT_SAY_WARDEN_3:
Talk(SAY_WARDEN_3);
break;
}
case EVENT_SAY_WARDEN_1:
Talk(SAY_WARDEN_1);
_events.ScheduleEvent(EVENT_SAY_WARDEN_2, 4s);
break;
case EVENT_SAY_WARDEN_2:
Talk(SAY_WARDEN_2);
_events.ScheduleEvent(EVENT_SAY_WARDEN_3, 3s);
break;
case EVENT_SAY_WARDEN_3:
Talk(SAY_WARDEN_3);
break;
}
}
private:
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetStormwindStockadeAI<npc_warden_thelwaterAI>(creature);
}
private:
EventMap _events;
};
void AddSC_boss_hogger()
{
new boss_hogger();
new npc_warden_thelwater();
RegisterStormwindStockadeAI(boss_hogger);
RegisterStormwindStockadeAI(npc_warden_thelwater);
}

View File

@@ -21,9 +21,9 @@
enum Spells
{
SPELL_FIREBALL = 12466, //starts 1-2 secs from pull
SPELL_OVERHEAT = 86633, //probably cast every 10 secs, need to confirm.
SPELL_RAIN_OF_FIRE = 86636 //probably cast every 10 secs, need to confirm
SPELL_FIREBALL = 12466,
SPELL_OVERHEAT = 86633,
SPELL_RAIN_OF_FIRE = 86636
};
enum Events
@@ -35,80 +35,69 @@ enum Events
enum Says
{
SAY_PULL = 0, //Yell: ALL MUST BURN!
SAY_DEATH = 1 //Yell: FIRE... EXTINGUISHED!
SAY_AGGRO = 0,
SAY_DEATH = 1
};
class boss_lord_overheat : public CreatureScript
struct boss_lord_overheat : public BossAI
{
public:
boss_lord_overheat() : CreatureScript("boss_lord_overheat") {}
boss_lord_overheat(Creature* creature) : BossAI(creature, DATA_LORD_OVERHEAT) { }
struct boss_lord_overheatAI : public BossAI
void JustEngagedWith(Unit* who) override
{
boss_lord_overheatAI(Creature* creature) : BossAI(creature, DATA_LORD_OVERHEAT) { }
BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_FIREBALL, 2s);
events.ScheduleEvent(EVENT_OVERHEAT, 9s, 11s);
events.ScheduleEvent(EVENT_RAIN_OF_FIRE, 10s, 13s);
}
void JustEngagedWith(Unit* who) override
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
BossAI::JustEngagedWith(who);
Talk(SAY_PULL);
events.ScheduleEvent(EVENT_FIREBALL, Seconds(2));
events.ScheduleEvent(EVENT_OVERHEAT, Seconds(9), Seconds(11));
events.ScheduleEvent(EVENT_RAIN_OF_FIRE, Seconds(10), Seconds(13));
}
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
switch (eventId)
{
switch (eventId)
{
case EVENT_FIREBALL:
DoCastVictim(SPELL_FIREBALL);
events.Repeat(Seconds(2));
events.Repeat(2s);
break;
case EVENT_OVERHEAT:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
DoCast(target, SPELL_OVERHEAT);
events.Repeat(Seconds(9), Seconds(10));
events.Repeat(9s, 10s);
break;
case EVENT_RAIN_OF_FIRE:
DoCastAOE(SPELL_RAIN_OF_FIRE);
events.Repeat(Seconds(15), Seconds(20));
events.Repeat(15s, 20s);
break;
default:
break;
}
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
}
DoMeleeAttackIfReady();
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetStormwindStockadeAI<boss_lord_overheatAI>(creature);
DoMeleeAttackIfReady();
}
};
void AddSC_boss_lord_overheat()
{
new boss_lord_overheat();
RegisterStormwindStockadeAI(boss_lord_overheat);
}

View File

@@ -22,6 +22,7 @@
enum Spells
{
// Randolph Moloch
SPELL_WILDLY_STABBING = 86726,
SPELL_SWEEP = 86729,
SPELL_VANISH = 55964,
@@ -30,194 +31,174 @@ enum Spells
enum Events
{
// Randolph Moloch
EVENT_WILDLY_STABBING = 1,
EVENT_SWEEP,
EVENT_VANISH,
EVENT_JUST_VANISHED,
EVENT_ATTACK_RANDOM,
// Mortimer Moloch
EVENT_MORTIMER_MOLOCH_EMOTE,
EVENT_MORTIMER_MOLOCH_DEATH
};
enum Says
{
SAY_PULL = 0, //Allow me to introduce myself. I am Randolph Moloch and I will be killing you all today.
SAY_VANISH = 1, // Area Trigger: %s vanishes!
SAY_DEATH = 2, //My epic schemes, my great plans! Gone!
// Randolph Moloch
SAY_AGGRO = 0,
SAY_VANISH = 1,
SAY_DEATH = 2,
MORTIMER_MOLOCH_DEATH = 0, // %s collapses from a heart attack!
MORTIMER_MOLOCH_EMOTE = 1, //Egad! My sophisticated heart!
// Mortimer Moloch
SAY_RANDOLPH_DIED = 0,
SAY_HEART_ATTACK = 1
};
enum Points
{
POINT_FINISH = 0,
// Mortimer Moloch
POINT_FINISH = 0
};
Position const mortimerMolochPos = { 145.5811f, 0.7059f, -25.606f, 6.2f };
Position const MortimerMolochPos = { 145.5811f, 0.7059f, -25.606f, 6.2f };
class boss_randolph_moloch : public CreatureScript
struct boss_randolph_moloch : public BossAI
{
public:
boss_randolph_moloch() : CreatureScript("boss_randolph_moloch") {}
boss_randolph_moloch(Creature* creature) : BossAI(creature, DATA_RANDOLPH_MOLOCH), _vanishCount(0) { }
struct boss_randolph_molochAI : public BossAI
void JustEngagedWith(Unit* who) override
{
boss_randolph_molochAI(Creature* creature) : BossAI(creature, DATA_RANDOLPH_MOLOCH)
{
firstVanish = false;
secondVanish = false;
}
BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_WILDLY_STABBING, 4s, 5s);
events.ScheduleEvent(EVENT_SWEEP, 2s, 3s);
}
void JustEngagedWith(Unit* who) override
void JustSummoned(Creature* summon) override
{
BossAI::JustSummoned(summon);
if (summon->GetEntry() == NPC_MORTIMER_MOLOCH)
{
BossAI::JustEngagedWith(who);
Talk(SAY_PULL);
events.ScheduleEvent(EVENT_WILDLY_STABBING, Seconds(4), Seconds(5));
events.ScheduleEvent(EVENT_SWEEP, Seconds(2), Seconds(3));
summon->SetWalk(true);
summon->GetMotionMaster()->MovePoint(POINT_FINISH, me->GetPosition());
}
}
void JustSummoned(Creature* summon) override
void Reset() override
{
BossAI::Reset();
_vanishCount = 0;
}
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
if (instance->instance->GetTeamInInstance() == ALLIANCE)
me->SummonCreature(NPC_MORTIMER_MOLOCH, MortimerMolochPos);
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
BossAI::JustSummoned(summon);
if (summon->GetEntry() == NPC_MORTIMER_MOLOCH)
switch (eventId)
{
summon->SetWalk(true);
summon->GetMotionMaster()->MovePoint(POINT_FINISH, me->GetPosition());
}
}
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
me->SummonCreature(NPC_MORTIMER_MOLOCH, mortimerMolochPos);
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_WILDLY_STABBING:
DoCastVictim(SPELL_WILDLY_STABBING);
events.Repeat(Seconds(8), Seconds(12));
events.Repeat(8s, 12s);
break;
case EVENT_SWEEP:
DoCastVictim(SPELL_SWEEP);
events.ScheduleEvent(EVENT_SWEEP, Seconds(6), Seconds(7));
events.ScheduleEvent(EVENT_SWEEP, 6s, 7s);
break;
case EVENT_VANISH:
Talk(SAY_VANISH);
me->RemoveAllAuras();
DoCastSelf(SPELL_VANISH);
me->SetReactState(REACT_PASSIVE);
// me->SetInCombatState(true); // Prevents the boss from resetting
events.ScheduleEvent(EVENT_JUST_VANISHED, Seconds(2));
events.ScheduleEvent(EVENT_JUST_VANISHED, 2s);
break;
case EVENT_JUST_VANISHED:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
DoCast(target, SPELL_SHADOWSTEP, true);
DoCast(target, SPELL_SHADOWSTEP);
me->SetReactState(REACT_AGGRESSIVE);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
if (me->HealthBelowPctDamaged(71, damage) && me->HealthAbovePct(59) && !firstVanish)
{
firstVanish = true;
events.ScheduleEvent(EVENT_VANISH, Seconds(1));
}
if (me->HealthBelowPctDamaged(41, damage) && me->HealthAbovePct(29) && !secondVanish)
{
secondVanish = true;
events.ScheduleEvent(EVENT_VANISH, Seconds(1));
}
}
private:
bool firstVanish, secondVanish;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetStormwindStockadeAI<boss_randolph_molochAI>(creature);
DoMeleeAttackIfReady();
}
void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
if (me->HealthBelowPctDamaged(71, damage) && me->HealthAbovePct(59) && _vanishCount < 1)
{
events.ScheduleEvent(EVENT_VANISH, 1s);
++_vanishCount;
}
if (me->HealthBelowPctDamaged(41, damage) && me->HealthAbovePct(29) && _vanishCount < 2)
{
events.ScheduleEvent(EVENT_VANISH, 1s);
++_vanishCount;
}
}
private:
uint8 _vanishCount;
};
class npc_mortimer_moloch : public CreatureScript
struct npc_mortimer_moloch : public ScriptedAI
{
public:
npc_mortimer_moloch() : CreatureScript("npc_mortimer_moloch") {}
npc_mortimer_moloch(Creature* creature) : ScriptedAI(creature) { }
struct npc_mortimer_molochAI : public ScriptedAI
void MovementInform(uint32 type, uint32 id) override
{
npc_mortimer_molochAI(Creature* creature) : ScriptedAI(creature) {}
if (type == POINT_MOTION_TYPE)
if (id == POINT_FINISH)
_events.ScheduleEvent(EVENT_MORTIMER_MOLOCH_EMOTE, 4s);
}
void Reset() override
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
me->SetReactState(REACT_PASSIVE);
}
void MovementInform(uint32 type, uint32 id) override
{
if (type == POINT_MOTION_TYPE)
if(id == POINT_FINISH)
_events.ScheduleEvent(EVENT_MORTIMER_MOLOCH_EMOTE, Seconds(4));
}
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
switch (eventId)
{
switch (eventId)
{
case EVENT_MORTIMER_MOLOCH_EMOTE:
Talk(MORTIMER_MOLOCH_EMOTE);
_events.ScheduleEvent(EVENT_MORTIMER_MOLOCH_DEATH, Seconds(3));
Talk(SAY_HEART_ATTACK);
_events.ScheduleEvent(EVENT_MORTIMER_MOLOCH_DEATH, 3s);
break;
case EVENT_MORTIMER_MOLOCH_DEATH:
Talk(MORTIMER_MOLOCH_DEATH);
Talk(SAY_RANDOLPH_DIED);
me->KillSelf();
break;
default:
break;
}
}
}
private:
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetStormwindStockadeAI<npc_mortimer_molochAI>(creature);
}
private:
EventMap _events;
};
void AddSC_boss_randolph_moloch()
{
new boss_randolph_moloch();
new npc_mortimer_moloch();
RegisterStormwindStockadeAI(boss_randolph_moloch);
RegisterStormwindStockadeAI(npc_mortimer_moloch);
}

View File

@@ -19,6 +19,11 @@
#include "InstanceScript.h"
#include "the_stockade.h"
enum SpawnGroups
{
SPAWN_GROUP_ALLIANCE_ENTRANCE = 450
};
class instance_the_stockade : public InstanceMapScript
{
public:
@@ -31,6 +36,18 @@ public:
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
}
void Create() override
{
if (instance->GetTeamInInstance() == ALLIANCE)
instance->SpawnGroupSpawn(SPAWN_GROUP_ALLIANCE_ENTRANCE);
}
void Load(char const* /*data*/) override
{
if (instance->GetTeamInInstance() == ALLIANCE)
instance->SpawnGroupSpawn(SPAWN_GROUP_ALLIANCE_ENTRANCE);
}
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override

View File

@@ -42,10 +42,12 @@ enum SSCreatureIds
NPC_MORTIMER_MOLOCH = 46482
};
template<typename AI>
inline AI* GetStormwindStockadeAI(Creature* creature)
template <class AI, class T>
inline AI* GetStormwindStockadeAI(T* obj)
{
return GetInstanceAI<AI>(creature, StormwindStockadeScriptName);
return GetInstanceAI<AI>(obj, StormwindStockadeScriptName);
}
#define RegisterStormwindStockadeAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetStormwindStockadeAI)
#endif