mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 08:00:48 +01:00
Scripts/Ahn'kahet: Update Nadox to new model (#26414)
Co-authored-by: offl <offl@users.noreply.github.com>
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include "SpellScript.h"
|
||||
#include "ahnkahet.h"
|
||||
|
||||
enum Yells
|
||||
enum NadoxTexts
|
||||
{
|
||||
SAY_AGGRO = 0,
|
||||
SAY_SLAY = 1,
|
||||
@@ -30,7 +30,7 @@ enum Yells
|
||||
EMOTE_HATCHES = 4
|
||||
};
|
||||
|
||||
enum Spells
|
||||
enum NadoxSpells
|
||||
{
|
||||
// Elder Nadox
|
||||
SPELL_BROOD_PLAGUE = 56130,
|
||||
@@ -44,7 +44,7 @@ enum Spells
|
||||
SPELL_SPRINT = 56354
|
||||
};
|
||||
|
||||
enum Events
|
||||
enum NadoxEvents
|
||||
{
|
||||
EVENT_PLAGUE = 1,
|
||||
EVENT_RAGE,
|
||||
@@ -54,234 +54,201 @@ enum Events
|
||||
DATA_RESPECT_YOUR_ELDERS
|
||||
};
|
||||
|
||||
class boss_elder_nadox : public CreatureScript
|
||||
struct boss_elder_nadox : public BossAI
|
||||
{
|
||||
public:
|
||||
boss_elder_nadox() : CreatureScript("boss_elder_nadox") { }
|
||||
boss_elder_nadox(Creature* creature) : BossAI(creature, DATA_ELDER_NADOX)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
struct boss_elder_nadoxAI : public BossAI
|
||||
void Initialize()
|
||||
{
|
||||
GuardianSummoned = false;
|
||||
GuardianDied = false;
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
Talk(SAY_AGGRO);
|
||||
|
||||
events.ScheduleEvent(EVENT_PLAGUE, 13s);
|
||||
events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10s);
|
||||
|
||||
if (IsHeroic())
|
||||
{
|
||||
boss_elder_nadoxAI(Creature* creature) : BossAI(creature, DATA_ELDER_NADOX)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
GuardianSummoned = false;
|
||||
GuardianDied = false;
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
Talk(SAY_AGGRO);
|
||||
|
||||
events.ScheduleEvent(EVENT_PLAGUE, 13s);
|
||||
events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10s);
|
||||
|
||||
if (IsHeroic())
|
||||
{
|
||||
events.ScheduleEvent(EVENT_RAGE, 12s);
|
||||
events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5s);
|
||||
}
|
||||
}
|
||||
|
||||
void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
|
||||
{
|
||||
if (summon->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
|
||||
GuardianDied = true;
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type) const override
|
||||
{
|
||||
if (type == DATA_RESPECT_YOUR_ELDERS)
|
||||
return !GuardianDied ? 1 : 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* who) override
|
||||
{
|
||||
if (who->GetTypeId() == TYPEID_PLAYER)
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_PLAGUE:
|
||||
DoCast(SelectTarget(SelectTargetMethod::Random, 0, 100, true), SPELL_BROOD_PLAGUE, true);
|
||||
events.ScheduleEvent(EVENT_PLAGUE, 15s);
|
||||
break;
|
||||
case EVENT_RAGE:
|
||||
DoCast(H_SPELL_BROOD_RAGE);
|
||||
events.ScheduleEvent(EVENT_RAGE, 10s, 50s);
|
||||
break;
|
||||
case EVENT_SUMMON_SWARMER:
|
||||
/// @todo: summoned by egg
|
||||
DoCast(me, SPELL_SUMMON_SWARMERS);
|
||||
if (urand(1, 3) == 3) // 33% chance of dialog
|
||||
Talk(SAY_EGG_SAC);
|
||||
events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10s);
|
||||
break;
|
||||
case EVENT_CHECK_ENRAGE:
|
||||
if (me->HasAura(SPELL_ENRAGE))
|
||||
return;
|
||||
if (me->GetPositionZ() < 24.0f)
|
||||
DoCast(me, SPELL_ENRAGE, true);
|
||||
events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5s);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!GuardianSummoned && me->HealthBelowPct(50))
|
||||
{
|
||||
/// @todo: summoned by egg
|
||||
Talk(EMOTE_HATCHES, me);
|
||||
DoCast(me, SPELL_SUMMON_SWARM_GUARD);
|
||||
GuardianSummoned = true;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
bool GuardianSummoned;
|
||||
bool GuardianDied;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetAhnKahetAI<boss_elder_nadoxAI>(creature);
|
||||
events.ScheduleEvent(EVENT_RAGE, 12s);
|
||||
events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5s);
|
||||
}
|
||||
}
|
||||
|
||||
void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
|
||||
{
|
||||
if (summon->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
|
||||
GuardianDied = true;
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type) const override
|
||||
{
|
||||
if (type == DATA_RESPECT_YOUR_ELDERS)
|
||||
return !GuardianDied ? 1 : 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* who) override
|
||||
{
|
||||
if (who->GetTypeId() == TYPEID_PLAYER)
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_PLAGUE:
|
||||
DoCast(SelectTarget(SelectTargetMethod::Random, 0, 100, true), SPELL_BROOD_PLAGUE, true);
|
||||
events.ScheduleEvent(EVENT_PLAGUE, 15s);
|
||||
break;
|
||||
case EVENT_RAGE:
|
||||
DoCast(H_SPELL_BROOD_RAGE);
|
||||
events.ScheduleEvent(EVENT_RAGE, 10s, 50s);
|
||||
break;
|
||||
case EVENT_SUMMON_SWARMER:
|
||||
/// @todo: summoned by egg
|
||||
DoCast(me, SPELL_SUMMON_SWARMERS);
|
||||
if (urand(1, 3) == 3) // 33% chance of dialog
|
||||
Talk(SAY_EGG_SAC);
|
||||
events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10s);
|
||||
break;
|
||||
case EVENT_CHECK_ENRAGE:
|
||||
if (me->HasAura(SPELL_ENRAGE))
|
||||
return;
|
||||
if (me->GetPositionZ() < 24.0f)
|
||||
DoCast(me, SPELL_ENRAGE, true);
|
||||
events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5s);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!GuardianSummoned && me->HealthBelowPct(50))
|
||||
{
|
||||
/// @todo: summoned by egg
|
||||
Talk(EMOTE_HATCHES, me);
|
||||
DoCast(me, SPELL_SUMMON_SWARM_GUARD);
|
||||
GuardianSummoned = true;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
bool GuardianSummoned;
|
||||
bool GuardianDied;
|
||||
};
|
||||
|
||||
class npc_ahnkahar_nerubian : public CreatureScript
|
||||
struct npc_ahnkahar_nerubian : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
npc_ahnkahar_nerubian() : CreatureScript("npc_ahnkahar_nerubian") { }
|
||||
npc_ahnkahar_nerubian(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
struct npc_ahnkahar_nerubianAI : public ScriptedAI
|
||||
void Reset() override
|
||||
{
|
||||
_events.Reset();
|
||||
_events.ScheduleEvent(EVENT_SPRINT, 13s);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
npc_ahnkahar_nerubianAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void Reset() override
|
||||
switch (eventId)
|
||||
{
|
||||
_events.Reset();
|
||||
_events.ScheduleEvent(EVENT_SPRINT, 13s);
|
||||
case EVENT_SPRINT:
|
||||
DoCast(me, SPELL_SPRINT);
|
||||
_events.ScheduleEvent(EVENT_SPRINT, 20s);
|
||||
break;
|
||||
}
|
||||
|
||||
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_SPRINT:
|
||||
DoCast(me, SPELL_SPRINT);
|
||||
_events.ScheduleEvent(EVENT_SPRINT, 20s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetAhnKahetAI<npc_ahnkahar_nerubianAI>(creature);
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
};
|
||||
|
||||
// 56159 - Swarm
|
||||
class spell_ahn_kahet_swarm : public SpellScriptLoader
|
||||
class spell_ahn_kahet_swarm : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_ahn_kahet_swarm() : SpellScriptLoader("spell_ahn_kahet_swarm") { }
|
||||
PrepareSpellScript(spell_ahn_kahet_swarm);
|
||||
|
||||
class spell_ahn_kahet_swarm_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_SWARM_BUFF });
|
||||
}
|
||||
|
||||
void CountTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
_targetCount = targets.size();
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (_targetCount)
|
||||
{
|
||||
PrepareSpellScript(spell_ahn_kahet_swarm_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
if (Aura* aura = GetCaster()->GetAura(SPELL_SWARM_BUFF))
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_SWARM_BUFF });
|
||||
aura->SetStackAmount(_targetCount);
|
||||
aura->RefreshDuration();
|
||||
}
|
||||
|
||||
void CountTargets(std::list<WorldObject*>& targets)
|
||||
else
|
||||
{
|
||||
_targetCount = targets.size();
|
||||
CastSpellExtraArgs args;
|
||||
args.TriggerFlags = TRIGGERED_FULL_MASK;
|
||||
args.AddSpellMod(SPELLVALUE_AURA_STACK, _targetCount);
|
||||
GetCaster()->CastSpell(GetCaster(), SPELL_SWARM_BUFF, args);
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (_targetCount)
|
||||
{
|
||||
if (Aura* aura = GetCaster()->GetAura(SPELL_SWARM_BUFF))
|
||||
{
|
||||
aura->SetStackAmount(_targetCount);
|
||||
aura->RefreshDuration();
|
||||
}
|
||||
else
|
||||
{
|
||||
CastSpellExtraArgs args;
|
||||
args.TriggerFlags = TRIGGERED_FULL_MASK;
|
||||
args.AddSpellMod(SPELLVALUE_AURA_STACK, _targetCount);
|
||||
GetCaster()->CastSpell(GetCaster(), SPELL_SWARM_BUFF, args);
|
||||
}
|
||||
}
|
||||
else
|
||||
GetCaster()->RemoveAurasDueToSpell(SPELL_SWARM_BUFF);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ahn_kahet_swarm_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnEffectHit += SpellEffectFn(spell_ahn_kahet_swarm_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
|
||||
uint32 _targetCount = 0;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_ahn_kahet_swarm_SpellScript();
|
||||
}
|
||||
else
|
||||
GetCaster()->RemoveAurasDueToSpell(SPELL_SWARM_BUFF);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ahn_kahet_swarm::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnEffectHit += SpellEffectFn(spell_ahn_kahet_swarm::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
|
||||
uint32 _targetCount = 0;
|
||||
};
|
||||
|
||||
class achievement_respect_your_elders : public AchievementCriteriaScript
|
||||
@@ -297,8 +264,8 @@ class achievement_respect_your_elders : public AchievementCriteriaScript
|
||||
|
||||
void AddSC_boss_elder_nadox()
|
||||
{
|
||||
new boss_elder_nadox();
|
||||
new npc_ahnkahar_nerubian();
|
||||
new spell_ahn_kahet_swarm();
|
||||
RegisterAhnKahetCreatureAI(boss_elder_nadox);
|
||||
RegisterAhnKahetCreatureAI(npc_ahnkahar_nerubian);
|
||||
RegisterSpellScript(spell_ahn_kahet_swarm);
|
||||
new achievement_respect_your_elders();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user