refactor(Scripts/Karazhan): Update Attumen and Midnight (#16681)
* init * .
This commit is contained in:
@@ -45,7 +45,6 @@ enum Spells
|
|||||||
SPELL_INTANGIBLE_PRESENCE = 29833,
|
SPELL_INTANGIBLE_PRESENCE = 29833,
|
||||||
SPELL_SPAWN_SMOKE = 10389,
|
SPELL_SPAWN_SMOKE = 10389,
|
||||||
SPELL_CHARGE = 29847,
|
SPELL_CHARGE = 29847,
|
||||||
|
|
||||||
// Midnight
|
// Midnight
|
||||||
SPELL_KNOCKDOWN = 29711,
|
SPELL_KNOCKDOWN = 29711,
|
||||||
SPELL_SUMMON_ATTUMEN = 29714,
|
SPELL_SUMMON_ATTUMEN = 29714,
|
||||||
@@ -62,17 +61,12 @@ enum Phases
|
|||||||
|
|
||||||
enum Actions
|
enum Actions
|
||||||
{
|
{
|
||||||
ACTION_SET_MIDNIGHT_PHASE,
|
ACTION_SET_MIDNIGHT_PHASE
|
||||||
};
|
};
|
||||||
|
|
||||||
class boss_attumen : public CreatureScript
|
struct boss_attumen : public BossAI
|
||||||
{
|
{
|
||||||
public:
|
boss_attumen(Creature* creature) : BossAI(creature, DATA_ATTUMEN)
|
||||||
boss_attumen() : CreatureScript("boss_attumen") { }
|
|
||||||
|
|
||||||
struct boss_attumenAI : public BossAI
|
|
||||||
{
|
|
||||||
boss_attumenAI(Creature* creature) : BossAI(creature, DATA_ATTUMEN)
|
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -98,32 +92,29 @@ public:
|
|||||||
{
|
{
|
||||||
midnight->AI()->EnterEvadeMode(why);
|
midnight->AI()->EnterEvadeMode(why);
|
||||||
}
|
}
|
||||||
|
|
||||||
me->DespawnOrUnsummon();
|
me->DespawnOrUnsummon();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScheduleTasks() override
|
void ScheduleTasks() override
|
||||||
{
|
{
|
||||||
scheduler.Schedule(Seconds(15), Seconds(25), [this](TaskContext task)
|
scheduler.Schedule(15s, 25s, [this](TaskContext task)
|
||||||
{
|
{
|
||||||
DoCastVictim(SPELL_SHADOWCLEAVE);
|
DoCastVictim(SPELL_SHADOWCLEAVE);
|
||||||
task.Repeat(Seconds(15), Seconds(25));
|
task.Repeat(15s, 25s);
|
||||||
});
|
});
|
||||||
|
scheduler.Schedule(25s, 45s, [this](TaskContext task)
|
||||||
scheduler.Schedule(Seconds(25), Seconds(45), [this](TaskContext task)
|
|
||||||
{
|
{
|
||||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
|
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
|
||||||
{
|
{
|
||||||
DoCast(target, SPELL_INTANGIBLE_PRESENCE);
|
DoCast(target, SPELL_INTANGIBLE_PRESENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
task.Repeat(Seconds(25), Seconds(45));
|
task.Repeat(25s, 45s);
|
||||||
});
|
});
|
||||||
|
scheduler.Schedule(30s, 1min, [this](TaskContext task)
|
||||||
scheduler.Schedule(Seconds(30), Seconds(60), [this](TaskContext task)
|
|
||||||
{
|
{
|
||||||
Talk(SAY_RANDOM);
|
Talk(SAY_RANDOM);
|
||||||
task.Repeat(Seconds(30), Seconds(60));
|
task.Repeat(30s, 1min);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +125,6 @@ public:
|
|||||||
{
|
{
|
||||||
damage = me->GetHealth() - 1;
|
damage = me->GetHealth() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_phase == PHASE_ATTUMEN_ENGAGES && me->HealthBelowPctDamaged(25, damage))
|
if (_phase == PHASE_ATTUMEN_ENGAGES && me->HealthBelowPctDamaged(25, damage))
|
||||||
{
|
{
|
||||||
_phase = PHASE_NONE;
|
_phase = PHASE_NONE;
|
||||||
@@ -146,10 +136,13 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KilledUnit(Unit* /*victim*/) override
|
void KilledUnit(Unit* victim) override
|
||||||
|
{
|
||||||
|
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
Talk(SAY_KILL);
|
Talk(SAY_KILL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void JustSummoned(Creature* summon) override
|
void JustSummoned(Creature* summon) override
|
||||||
{
|
{
|
||||||
@@ -165,11 +158,9 @@ public:
|
|||||||
{
|
{
|
||||||
summon->SetHealth(me->GetHealth());
|
summon->SetHealth(me->GetHealth());
|
||||||
}
|
}
|
||||||
|
|
||||||
summon->AI()->DoZoneInCombat();
|
summon->AI()->DoZoneInCombat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BossAI::JustSummoned(summon);
|
BossAI::JustSummoned(summon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,39 +170,34 @@ public:
|
|||||||
{
|
{
|
||||||
_phase = PHASE_ATTUMEN_ENGAGES;
|
_phase = PHASE_ATTUMEN_ENGAGES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (summoner->GetEntry() == NPC_ATTUMEN_THE_HUNTSMAN)
|
if (summoner->GetEntry() == NPC_ATTUMEN_THE_HUNTSMAN)
|
||||||
{
|
{
|
||||||
_phase = PHASE_MOUNTED;
|
_phase = PHASE_MOUNTED;
|
||||||
DoCastSelf(SPELL_SPAWN_SMOKE);
|
DoCastSelf(SPELL_SPAWN_SMOKE);
|
||||||
|
scheduler.Schedule(10s, 25s, [this](TaskContext task)
|
||||||
scheduler.Schedule(Seconds(10), Seconds(25), [this](TaskContext task)
|
|
||||||
{
|
{
|
||||||
Unit* target = nullptr;
|
Unit* target = nullptr;
|
||||||
std::vector<Unit*> target_list;
|
std::vector<Unit*> target_list;
|
||||||
|
|
||||||
for (auto* ref : me->GetThreatMgr().GetUnsortedThreatList())
|
for (auto* ref : me->GetThreatMgr().GetUnsortedThreatList())
|
||||||
{
|
{
|
||||||
target = ref->GetVictim();
|
target = ref->GetVictim();
|
||||||
if (target && !target->IsWithinDist(me, 8.00f, false) && target->IsWithinDist(me, 25.0f, false))
|
if (target && !target->IsWithinDist(me, 8.00f, false) && target->IsWithinDist(me, 25.0f, false))
|
||||||
|
{
|
||||||
target_list.push_back(target);
|
target_list.push_back(target);
|
||||||
|
}
|
||||||
target = nullptr;
|
target = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target_list.empty())
|
if (!target_list.empty())
|
||||||
{
|
{
|
||||||
target = Acore::Containers::SelectRandomContainerElement(target_list);
|
target = Acore::Containers::SelectRandomContainerElement(target_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
DoCast(target, SPELL_CHARGE);
|
DoCast(target, SPELL_CHARGE);
|
||||||
task.Repeat(Seconds(10), Seconds(25));
|
task.Repeat(10s, 25s);
|
||||||
});
|
});
|
||||||
|
scheduler.Schedule(25s, 35s, [this](TaskContext task)
|
||||||
scheduler.Schedule(Seconds(25), Seconds(35), [this](TaskContext task)
|
|
||||||
{
|
{
|
||||||
DoCastVictim(SPELL_KNOCKDOWN);
|
DoCastVictim(SPELL_KNOCKDOWN);
|
||||||
task.Repeat(Seconds(25), Seconds(35));
|
task.Repeat(25s, 35s);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,7 +209,6 @@ public:
|
|||||||
{
|
{
|
||||||
midnight->KillSelf();
|
midnight->KillSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
_JustDied();
|
_JustDied();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,14 +221,11 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CanMeleeHit())
|
if (!CanMeleeHit())
|
||||||
{
|
{
|
||||||
BossAI::EnterEvadeMode(EvadeReason::EVADE_REASON_BOUNDARY);
|
BossAI::EnterEvadeMode(EvadeReason::EVADE_REASON_BOUNDARY);
|
||||||
}
|
}
|
||||||
|
scheduler.Update(diff, std::bind(&BossAI::DoMeleeAttackIfReady, this));
|
||||||
scheduler.Update(diff,
|
|
||||||
std::bind(&BossAI::DoMeleeAttackIfReady, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
|
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
|
||||||
@@ -259,21 +241,18 @@ public:
|
|||||||
{
|
{
|
||||||
_phase = PHASE_NONE;
|
_phase = PHASE_NONE;
|
||||||
scheduler.CancelAll();
|
scheduler.CancelAll();
|
||||||
|
|
||||||
midnight->AI()->DoAction(ACTION_SET_MIDNIGHT_PHASE);
|
midnight->AI()->DoAction(ACTION_SET_MIDNIGHT_PHASE);
|
||||||
midnight->AttackStop();
|
midnight->AttackStop();
|
||||||
midnight->RemoveAllAttackers();
|
midnight->RemoveAllAttackers();
|
||||||
midnight->SetReactState(REACT_PASSIVE);
|
midnight->SetReactState(REACT_PASSIVE);
|
||||||
midnight->GetMotionMaster()->MoveFollow(me, 2.0f, 0.0f);
|
midnight->GetMotionMaster()->MoveFollow(me, 2.0f, 0.0f);
|
||||||
midnight->AI()->Talk(EMOTE_MOUNT_UP);
|
midnight->AI()->Talk(EMOTE_MOUNT_UP);
|
||||||
|
|
||||||
me->AttackStop();
|
me->AttackStop();
|
||||||
me->RemoveAllAttackers();
|
me->RemoveAllAttackers();
|
||||||
me->SetReactState(REACT_PASSIVE);
|
me->SetReactState(REACT_PASSIVE);
|
||||||
me->GetMotionMaster()->MoveFollow(midnight, 2.0f, 0.0f);
|
me->GetMotionMaster()->MoveFollow(midnight, 2.0f, 0.0f);
|
||||||
Talk(SAY_MOUNT);
|
Talk(SAY_MOUNT);
|
||||||
|
scheduler.Schedule(1s, [this](TaskContext task)
|
||||||
scheduler.Schedule(Seconds(1), [this](TaskContext task)
|
|
||||||
{
|
{
|
||||||
if (Creature* midnight = instance->GetCreature(DATA_MIDNIGHT))
|
if (Creature* midnight = instance->GetCreature(DATA_MIDNIGHT))
|
||||||
{
|
{
|
||||||
@@ -299,20 +278,9 @@ public:
|
|||||||
uint8 _phase;
|
uint8 _phase;
|
||||||
};
|
};
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
struct boss_midnight : public BossAI
|
||||||
{
|
{
|
||||||
return GetKarazhanAI<boss_attumenAI>(creature);
|
boss_midnight(Creature* creature) : BossAI(creature, DATA_ATTUMEN), _phase(PHASE_NONE) { }
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class boss_midnight : public CreatureScript
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
boss_midnight() : CreatureScript("boss_midnight") { }
|
|
||||||
|
|
||||||
struct boss_midnightAI : public BossAI
|
|
||||||
{
|
|
||||||
boss_midnightAI(Creature* creature) : BossAI(creature, DATA_ATTUMEN), _phase(PHASE_NONE) { }
|
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
@@ -354,7 +322,6 @@ public:
|
|||||||
summon->AI()->AttackStart(me->GetVictim());
|
summon->AI()->AttackStart(me->GetVictim());
|
||||||
summon->AI()->Talk(SAY_APPEAR);
|
summon->AI()->Talk(SAY_APPEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
BossAI::JustSummoned(summon);
|
BossAI::JustSummoned(summon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,11 +336,10 @@ public:
|
|||||||
void JustEngagedWith(Unit* who) override
|
void JustEngagedWith(Unit* who) override
|
||||||
{
|
{
|
||||||
BossAI::JustEngagedWith(who);
|
BossAI::JustEngagedWith(who);
|
||||||
|
scheduler.Schedule(15s, 25s, [this](TaskContext task)
|
||||||
scheduler.Schedule(Seconds(15), Seconds(25), [this](TaskContext task)
|
|
||||||
{
|
{
|
||||||
DoCastVictim(SPELL_KNOCKDOWN);
|
DoCastVictim(SPELL_KNOCKDOWN);
|
||||||
task.Repeat(Seconds(15), Seconds(25));
|
task.Repeat(15s, 25s);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,66 +368,50 @@ public:
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CanMeleeHit())
|
if (!CanMeleeHit())
|
||||||
{
|
{
|
||||||
BossAI::EnterEvadeMode(EvadeReason::EVADE_REASON_BOUNDARY);
|
BossAI::EnterEvadeMode(EvadeReason::EVADE_REASON_BOUNDARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
scheduler.Update(diff, std::bind(&BossAI::DoMeleeAttackIfReady, this));
|
||||||
scheduler.Update(diff,
|
|
||||||
std::bind(&BossAI::DoMeleeAttackIfReady, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8 _phase;
|
uint8 _phase;
|
||||||
};
|
};
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
class spell_midnight_fixate : public AuraScript
|
||||||
{
|
{
|
||||||
return GetKarazhanAI<boss_midnightAI>(creature);
|
PrepareAuraScript(spell_midnight_fixate)
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class spell_midnight_fixate : public SpellScriptLoader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
spell_midnight_fixate() : SpellScriptLoader("spell_midnight_fixate") { }
|
|
||||||
|
|
||||||
class spell_midnight_fixate_AuraScript : public AuraScript
|
|
||||||
{
|
|
||||||
PrepareAuraScript(spell_midnight_fixate_AuraScript);
|
|
||||||
|
|
||||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
{
|
{
|
||||||
Unit* target = GetTarget();
|
Unit* target = GetTarget();
|
||||||
if (Unit* caster = GetCaster())
|
if (Unit* caster = GetCaster())
|
||||||
|
{
|
||||||
caster->TauntApply(target);
|
caster->TauntApply(target);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
{
|
{
|
||||||
Unit* target = GetTarget();
|
Unit* target = GetTarget();
|
||||||
if (Unit* caster = GetCaster())
|
if (Unit* caster = GetCaster())
|
||||||
|
{
|
||||||
caster->TauntFadeOut(target);
|
caster->TauntFadeOut(target);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
{
|
{
|
||||||
OnEffectApply += AuraEffectApplyFn(spell_midnight_fixate_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
OnEffectApply += AuraEffectApplyFn(spell_midnight_fixate::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||||
OnEffectRemove += AuraEffectRemoveFn(spell_midnight_fixate_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
OnEffectRemove += AuraEffectRemoveFn(spell_midnight_fixate::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AuraScript* GetAuraScript() const override
|
|
||||||
{
|
|
||||||
return new spell_midnight_fixate_AuraScript();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_attumen()
|
void AddSC_boss_attumen()
|
||||||
{
|
{
|
||||||
new boss_midnight();
|
RegisterKarazhanCreatureAI(boss_midnight);
|
||||||
new boss_attumen();
|
RegisterKarazhanCreatureAI(boss_attumen);
|
||||||
new spell_midnight_fixate();
|
RegisterSpellScript(spell_midnight_fixate);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user