fix(Scripts/RuinsOfAhnQiraj): Implement Rajaxx waves (#12513)

This commit is contained in:
Skjalf
2022-07-25 12:12:08 -03:00
committed by GitHub
parent accb01f180
commit cd3151df40
8 changed files with 288 additions and 24 deletions

View File

@@ -22,16 +22,6 @@
enum Yells
{
// The time of our retribution is at hand! Let darkness reign in the hearts of our enemies! Sound: 8645 Emote: 35
SAY_ANDOROV_INTRO = 0, // Before for the first wave
SAY_ANDOROV_ATTACK = 1, // Beginning the event
SAY_WAVE3 = 0,
SAY_WAVE4 = 1,
SAY_WAVE5 = 2,
SAY_WAVE6 = 3,
SAY_WAVE7 = 4,
SAY_INTRO = 5,
SAY_UNK1 = 6,
SAY_UNK2 = 7,
SAY_UNK3 = 8,
@@ -63,27 +53,25 @@ public:
struct boss_rajaxxAI : public BossAI
{
boss_rajaxxAI(Creature* creature) : BossAI(creature, DATA_RAJAXX)
{
}
boss_rajaxxAI(Creature* creature) : BossAI(creature, DATA_RAJAXX) { }
void Reset() override
{
_Reset();
enraged = false;
events.ScheduleEvent(EVENT_DISARM, 10000);
events.ScheduleEvent(EVENT_THUNDERCRASH, 12000);
}
void JustDied(Unit* /*killer*/) override
{
//SAY_DEATH
Talk(SAY_DEATH);
_JustDied();
}
void EnterCombat(Unit* /*victim*/) override
{
_EnterCombat();
events.ScheduleEvent(EVENT_DISARM, 10000);
events.ScheduleEvent(EVENT_THUNDERCRASH, 12000);
}
void UpdateAI(uint32 diff) override

View File

@@ -15,14 +15,46 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureGroups.h"
#include "InstanceScript.h"
#include "ScriptMgr.h"
#include "TaskScheduler.h"
#include "ruins_of_ahnqiraj.h"
ObjectData const creatureData[] =
{
{ NPC_OSSIRIAN, DATA_OSSIRIAN },
{ NPC_KURINNAXX, DATA_KURINNAXX }
{ NPC_KURINNAXX, DATA_KURINNAXX },
{ NPC_RAJAXX, DATA_RAJAXX },
{ NPC_OSSIRIAN, DATA_OSSIRIAN },
{ NPC_QUUEZ, DATA_QUUEZ },
{ NPC_TUUBID, DATA_TUUBID },
{ NPC_DRENN, DATA_DRENN },
{ NPC_XURREM, DATA_XURREM },
{ NPC_YEGGETH, DATA_YEGGETH },
{ NPC_PAKKON, DATA_PAKKON },
{ NPC_ZERRAN, DATA_ZERRAN },
};
enum RajaxxText
{
SAY_WAVE3 = 0,
SAY_WAVE4 = 1,
SAY_WAVE5 = 2,
SAY_WAVE6 = 3,
SAY_WAVE7 = 4,
SAY_ENGAGE = 5
};
std::array<uint32, 8> RajaxxWavesData[] =
{
{ DATA_QUUEZ, 0 },
{ DATA_TUUBID, 0 },
{ DATA_DRENN, SAY_WAVE3 },
{ DATA_XURREM, SAY_WAVE4 },
{ DATA_YEGGETH, SAY_WAVE5 },
{ DATA_PAKKON, SAY_WAVE6 },
{ DATA_ZERRAN, SAY_WAVE7 },
{ DATA_RAJAXX, SAY_ENGAGE }
};
class instance_ruins_of_ahnqiraj : public InstanceMapScript
@@ -36,6 +68,7 @@ public:
{
SetBossNumber(NUM_ENCOUNTER);
LoadObjectData(creatureData, nullptr);
_rajaxWaveCounter = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -65,12 +98,73 @@ public:
}
}
bool SetBossState(uint32 bossId, EncounterState state) override
void OnCreatureEvade(Creature* creature) override
{
if (!InstanceScript::SetBossState(bossId, state))
return false;
if (CreatureGroup* formation = creature->GetFormation())
{
if (Creature* leader = formation->GetLeader())
{
switch (leader->GetEntry())
{
case NPC_QUUEZ:
case NPC_TUUBID:
case NPC_DRENN:
case NPC_XURREM:
case NPC_YEGGETH:
case NPC_PAKKON:
case NPC_ZERRAN:
if (!formation->IsFormationInCombat())
{
ResetRajaxxWaves();
}
break;
default:
break;
}
}
}
else if (creature->GetEntry() == NPC_RAJAXX)
{
ResetRajaxxWaves();
}
}
return true;
void OnUnitDeath(Unit* unit) override
{
if (Creature* creature = unit->ToCreature())
{
if (CreatureGroup* formation = creature->GetFormation())
{
if (Creature* leader = formation->GetLeader())
{
switch (leader->GetEntry())
{
case NPC_QUUEZ:
case NPC_TUUBID:
case NPC_DRENN:
case NPC_XURREM:
case NPC_YEGGETH:
case NPC_PAKKON:
case NPC_ZERRAN:
_scheduler.CancelAll();
_scheduler.Schedule(1s, [this, formation](TaskContext /*context*/) {
if (!formation->IsAnyMemberAlive())
{
CallNextRajaxxLeader();
}
});
break;
default:
break;
}
}
}
}
}
void Update(uint32 diff) override
{
_scheduler.Update(diff);
}
void SetGuidData(uint32 type, ObjectGuid data) override
@@ -145,6 +239,46 @@ public:
OUT_LOAD_INST_DATA_COMPLETE;
}
void CallNextRajaxxLeader()
{
++_rajaxWaveCounter;
if (Creature* nextLeader = GetCreature(RajaxxWavesData[_rajaxWaveCounter].at(0)))
{
if (_rajaxWaveCounter >= 2)
{
if (Creature* rajaxx = GetCreature(DATA_RAJAXX))
{
rajaxx->AI()->Talk(RajaxxWavesData[_rajaxWaveCounter].at(1));
}
}
if (nextLeader->IsAlive())
{
nextLeader->SetInCombatWithZone();
}
else
{
CallNextRajaxxLeader();
}
}
}
void ResetRajaxxWaves()
{
_rajaxWaveCounter = 0;
for (auto const& data : RajaxxWavesData)
{
if (Creature* creature = GetCreature(data.at(0)))
{
if (CreatureGroup* group = creature->GetFormation())
{
group->RespawnFormation(true);
}
}
}
}
private:
ObjectGuid _kurinnaxxGUID;
ObjectGuid _rajaxxGUID;
@@ -153,6 +287,8 @@ public:
ObjectGuid _ayamissGUID;
ObjectGuid _ossirianGUID;
ObjectGuid _paralyzedGUID;
uint32 _rajaxWaveCounter;
TaskScheduler _scheduler;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override

View File

@@ -32,7 +32,17 @@ enum DataTypes
DATA_OSSIRIAN = 5,
NUM_ENCOUNTER = 6,
DATA_PARALYZED = 7
DATA_PARALYZED = 7,
DATA_QUUEZ = 8,
DATA_TUUBID = 9,
DATA_DRENN = 10,
DATA_XURREM = 11,
DATA_YEGGETH = 12,
DATA_PAKKON = 13,
DATA_ZERRAN = 14,
DATA_ENGAGED_FORMATION = 1
};
enum Creatures
@@ -52,7 +62,16 @@ enum Creatures
NPC_BURU_EGG = 15514,
NPC_LARVA = 15555,
NPC_SWARMER = 15546,
NPC_HORNET = 15934
NPC_HORNET = 15934,
// Rajaxx
NPC_QUUEZ = 15391,
NPC_TUUBID = 15392,
NPC_DRENN = 15389,
NPC_XURREM = 15390,
NPC_YEGGETH = 15386,
NPC_PAKKON = 15388,
NPC_ZERRAN = 15385
};
enum GameObjects