mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 02:50:29 +00:00
fix(Core/RuinsOfAhnQiraj): Kurinnaxx (#12522)
This commit is contained in:
@@ -16,14 +16,16 @@
|
||||
*/
|
||||
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "TaskScheduler.h"
|
||||
#include "ruins_of_ahnqiraj.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_MORTALWOUND = 25646,
|
||||
SPELL_SANDTRAP = 25648,
|
||||
SPELL_MORTAL_WOUND = 25646,
|
||||
SPELL_SAND_TRAP = 25648,
|
||||
SPELL_ENRAGE = 26527,
|
||||
SPELL_SUMMON_PLAYER = 26446,
|
||||
SPELL_WIDE_SLASH = 25814
|
||||
@@ -32,97 +34,116 @@ enum Spells
|
||||
enum Events
|
||||
{
|
||||
EVENT_MORTAL_WOUND = 1,
|
||||
EVENT_SANDTRAP = 2,
|
||||
EVENT_SAND_TRAP = 2,
|
||||
EVENT_WIDE_SLASH = 3
|
||||
};
|
||||
|
||||
enum Texts
|
||||
{
|
||||
SAY_KURINAXX_DEATH = 5 // Yell by 'Ossirian the Unscarred'
|
||||
SAY_KURINNAXX_DEATH = 5 // Yell by 'Ossirian the Unscarred'
|
||||
};
|
||||
|
||||
class boss_kurinnaxx : public CreatureScript
|
||||
struct boss_kurinnaxx : public BossAI
|
||||
{
|
||||
public:
|
||||
boss_kurinnaxx() : CreatureScript("boss_kurinnaxx") { }
|
||||
boss_kurinnaxx(Creature* creature) : BossAI(creature, DATA_KURINNAXX) {}
|
||||
|
||||
struct boss_kurinnaxxAI : public BossAI
|
||||
void Reset() override
|
||||
{
|
||||
boss_kurinnaxxAI(Creature* creature) : BossAI(creature, DATA_KURINNAXX) {}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
_enraged = false;
|
||||
events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(8000, 10000));
|
||||
events.ScheduleEvent(EVENT_SANDTRAP, urand(5000, 15000));
|
||||
events.ScheduleEvent(EVENT_WIDE_SLASH, urand(10000, 15000));
|
||||
}
|
||||
|
||||
void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType, SpellSchoolMask) override
|
||||
{
|
||||
if (!_enraged && HealthBelowPct(30))
|
||||
{
|
||||
DoCastSelf(SPELL_ENRAGE);
|
||||
_enraged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetGuidData(DATA_OSSIRIAN)))
|
||||
{
|
||||
sCreatureTextMgr->SendChat(Ossirian, SAY_KURINAXX_DEATH, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
|
||||
}
|
||||
}
|
||||
|
||||
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_MORTAL_WOUND:
|
||||
DoCastVictim(SPELL_MORTALWOUND);
|
||||
events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(8000, 10000));
|
||||
break;
|
||||
case EVENT_SANDTRAP:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
{
|
||||
target->CastSpell(target, SPELL_SANDTRAP, true);
|
||||
}
|
||||
events.ScheduleEvent(EVENT_SANDTRAP, urand(5000, 15000));
|
||||
break;
|
||||
case EVENT_WIDE_SLASH:
|
||||
DoCastSelf(SPELL_WIDE_SLASH);
|
||||
events.ScheduleEvent(EVENT_WIDE_SLASH, urand(12000, 15000));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
private:
|
||||
bool _enraged;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetRuinsOfAhnQirajAI<boss_kurinnaxxAI>(creature);
|
||||
BossAI::Reset();
|
||||
_enraged = false;
|
||||
events.ScheduleEvent(EVENT_MORTAL_WOUND, 8s, 10s);
|
||||
events.ScheduleEvent(EVENT_SAND_TRAP, 5s, 15s);
|
||||
events.ScheduleEvent(EVENT_WIDE_SLASH, 10s, 15s);
|
||||
}
|
||||
|
||||
void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType, SpellSchoolMask) override
|
||||
{
|
||||
if (!_enraged && HealthBelowPct(30))
|
||||
{
|
||||
DoCastSelf(SPELL_ENRAGE);
|
||||
_enraged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void JustDied(Unit* killer) override
|
||||
{
|
||||
if (killer)
|
||||
killer->GetMap()->LoadGrid(-9502.80f, 2042.65f); // Ossirian grid
|
||||
|
||||
if (Creature* ossirian = instance->GetCreature(DATA_OSSIRIAN))
|
||||
{
|
||||
ossirian->setActive(true);
|
||||
if (ossirian->GetAI())
|
||||
ossirian->AI()->Talk(SAY_KURINNAXX_DEATH);
|
||||
}
|
||||
BossAI::JustDied(killer);
|
||||
}
|
||||
|
||||
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_MORTAL_WOUND:
|
||||
DoCastVictim(SPELL_MORTAL_WOUND);
|
||||
events.ScheduleEvent(EVENT_MORTAL_WOUND, 8s, 10s);
|
||||
break;
|
||||
case EVENT_SAND_TRAP:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.f, true))
|
||||
{
|
||||
target->CastSpell(target, SPELL_SAND_TRAP, true, nullptr, nullptr, me->GetGUID());
|
||||
}
|
||||
events.ScheduleEvent(EVENT_SAND_TRAP, 5s, 15s);
|
||||
break;
|
||||
case EVENT_WIDE_SLASH:
|
||||
DoCastSelf(SPELL_WIDE_SLASH);
|
||||
events.ScheduleEvent(EVENT_WIDE_SLASH, 12s, 15s);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
private:
|
||||
bool _enraged;
|
||||
};
|
||||
|
||||
struct go_sand_trap : public GameObjectAI
|
||||
{
|
||||
go_sand_trap(GameObject* go) : GameObjectAI(go) { }
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_scheduler.Schedule(5s, [this](TaskContext /*context*/)
|
||||
{
|
||||
if (InstanceScript* instance = me->GetInstanceScript())
|
||||
if (Creature* kurinnaxx = instance->GetCreature(DATA_KURINNAXX))
|
||||
me->Use(kurinnaxx);
|
||||
});
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 const diff) override
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
|
||||
protected:
|
||||
TaskScheduler _scheduler;
|
||||
};
|
||||
|
||||
void AddSC_boss_kurinnaxx()
|
||||
{
|
||||
new boss_kurinnaxx();
|
||||
RegisterRuinsOfAhnQirajCreatureAI(boss_kurinnaxx);
|
||||
RegisterGameObjectAI(go_sand_trap);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "ruins_of_ahnqiraj.h"
|
||||
|
||||
ObjectData const creatureData[] =
|
||||
{
|
||||
{ NPC_OSSIRIAN, DATA_OSSIRIAN },
|
||||
{ NPC_KURINNAXX, DATA_KURINNAXX }
|
||||
};
|
||||
|
||||
class instance_ruins_of_ahnqiraj : public InstanceMapScript
|
||||
{
|
||||
public:
|
||||
@@ -29,14 +35,17 @@ public:
|
||||
instance_ruins_of_ahnqiraj_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetBossNumber(NUM_ENCOUNTER);
|
||||
LoadObjectData(creatureData, nullptr);
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
{
|
||||
InstanceScript::OnCreatureCreate(creature);
|
||||
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_KURINAXX:
|
||||
_kurinaxxGUID = creature->GetGUID();
|
||||
case NPC_KURINNAXX:
|
||||
_kurinnaxxGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_RAJAXX:
|
||||
_rajaxxGUID = creature->GetGUID();
|
||||
@@ -75,7 +84,7 @@ public:
|
||||
switch (type)
|
||||
{
|
||||
case DATA_KURINNAXX:
|
||||
return _kurinaxxGUID;
|
||||
return _kurinnaxxGUID;
|
||||
case DATA_RAJAXX:
|
||||
return _rajaxxGUID;
|
||||
case DATA_MOAM:
|
||||
@@ -137,7 +146,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectGuid _kurinaxxGUID;
|
||||
ObjectGuid _kurinnaxxGUID;
|
||||
ObjectGuid _rajaxxGUID;
|
||||
ObjectGuid _moamGUID;
|
||||
ObjectGuid _buruGUID;
|
||||
|
||||
@@ -37,7 +37,7 @@ enum DataTypes
|
||||
|
||||
enum Creatures
|
||||
{
|
||||
NPC_KURINAXX = 15348,
|
||||
NPC_KURINNAXX = 15348,
|
||||
NPC_RAJAXX = 15341,
|
||||
NPC_MOAM = 15340,
|
||||
NPC_BURU = 15370,
|
||||
@@ -66,4 +66,6 @@ inline AI* GetRuinsOfAhnQirajAI(T* obj)
|
||||
return GetInstanceAI<AI>(obj, RuinsOfAhnQirajScriptName);
|
||||
}
|
||||
|
||||
#define RegisterRuinsOfAhnQirajCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetRuinsOfAhnQirajAI)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user