mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
refactor(Scripts/Outland): World Boss model update (#16279)
* init * check codestyle (ubuntu-20.04)
This commit is contained in:
@@ -22,13 +22,13 @@
|
||||
|
||||
enum Texts
|
||||
{
|
||||
SAY_INTRO = 0,
|
||||
SAY_AGGRO = 1,
|
||||
SAY_SURPREME = 2,
|
||||
SAY_KILL = 3,
|
||||
SAY_DEATH = 4,
|
||||
EMOTE_FRENZY = 5,
|
||||
SAY_RAND = 6
|
||||
SAY_INTRO = 0,
|
||||
SAY_AGGRO = 1,
|
||||
SAY_SURPREME = 2,
|
||||
SAY_KILL = 3,
|
||||
SAY_DEATH = 4,
|
||||
EMOTE_FRENZY = 5,
|
||||
SAY_RAND = 6
|
||||
};
|
||||
|
||||
enum Spells
|
||||
@@ -42,19 +42,7 @@ enum Spells
|
||||
SPELL_ENRAGE = 32964,
|
||||
SPELL_CAPTURE_SOUL = 32966,
|
||||
SPELL_TWISTED_REFLECTION = 21063,
|
||||
SPELL_BERSERK = 32965,
|
||||
};
|
||||
|
||||
enum Events
|
||||
{
|
||||
EVENT_SHADOW_VOLLEY = 1,
|
||||
EVENT_CLEAVE = 2,
|
||||
EVENT_THUNDERCLAP = 3,
|
||||
EVENT_VOID_BOLT = 4,
|
||||
EVENT_MARK_OF_KAZZAK = 5,
|
||||
EVENT_ENRAGE = 6,
|
||||
EVENT_TWISTED_REFLECTION = 7,
|
||||
EVENT_BERSERK = 8
|
||||
SPELL_BERSERK = 32965
|
||||
};
|
||||
|
||||
class boss_doomlord_kazzak : public CreatureScript
|
||||
@@ -64,21 +52,11 @@ public:
|
||||
|
||||
struct boss_doomlordkazzakAI : public ScriptedAI
|
||||
{
|
||||
boss_doomlordkazzakAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
}
|
||||
boss_doomlordkazzakAI(Creature* creature) : ScriptedAI(creature) {}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_events.Reset();
|
||||
_events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(6000, 10000));
|
||||
_events.ScheduleEvent(EVENT_CLEAVE, 7000);
|
||||
_events.ScheduleEvent(EVENT_THUNDERCLAP, urand(14000, 18000));
|
||||
_events.ScheduleEvent(EVENT_VOID_BOLT, 30000);
|
||||
_events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 25000);
|
||||
_events.ScheduleEvent(EVENT_ENRAGE, 60000);
|
||||
_events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 33000);
|
||||
_events.ScheduleEvent(EVENT_BERSERK, 180000);
|
||||
_inBerserk = false;
|
||||
}
|
||||
|
||||
void JustRespawned() override
|
||||
@@ -89,17 +67,58 @@ public:
|
||||
void JustEngagedWith(Unit* /*who*/) override
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
_scheduler.Schedule(6s, 10s, [this](TaskContext context)
|
||||
{
|
||||
DoCastVictim(SPELL_SHADOW_VOLLEY);
|
||||
context.Repeat(4s, 6s);
|
||||
}).Schedule(7s, [this](TaskContext context)
|
||||
{
|
||||
DoCastVictim(SPELL_CLEAVE);
|
||||
context.Repeat(8s, 12s);
|
||||
}).Schedule(14s, 18s, [this](TaskContext context)
|
||||
{
|
||||
DoCastVictim(SPELL_THUNDERCLAP);
|
||||
context.Repeat(10s, 14s);
|
||||
}).Schedule(30s, [this](TaskContext context)
|
||||
{
|
||||
DoCastVictim(SPELL_VOID_BOLT);
|
||||
context.Repeat(15s, 18s);
|
||||
}).Schedule(25s, [this](TaskContext context)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, PowerUsersSelector(me, POWER_MANA, 100.0f, true)))
|
||||
{
|
||||
DoCast(target, SPELL_MARK_OF_KAZZAK);
|
||||
}
|
||||
context.Repeat(20s);
|
||||
}).Schedule(1min, [this](TaskContext context)
|
||||
{
|
||||
Talk(EMOTE_FRENZY);
|
||||
DoCastSelf(SPELL_ENRAGE);
|
||||
context.Repeat(30s);
|
||||
}).Schedule(33s, [this](TaskContext context)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
|
||||
{
|
||||
DoCast(target, SPELL_TWISTED_REFLECTION);
|
||||
}
|
||||
context.Repeat(15s);
|
||||
}).Schedule(3min, [this](TaskContext /*context*/)
|
||||
{
|
||||
if (!_inBerserk)
|
||||
{
|
||||
DoCastSelf(SPELL_BERSERK);
|
||||
_inBerserk = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
// When Kazzak kills a player (not pets/totems), he regens some health
|
||||
if (victim->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
DoCast(me, SPELL_CAPTURE_SOUL);
|
||||
|
||||
Talk(SAY_KILL);
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Talk(SAY_KILL);
|
||||
DoCastSelf(SPELL_CAPTURE_SOUL);
|
||||
}
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
@@ -109,63 +128,19 @@ public:
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
// Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
_scheduler.Update(diff);
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_SHADOW_VOLLEY:
|
||||
DoCastVictim(SPELL_SHADOW_VOLLEY);
|
||||
_events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(4000, 6000));
|
||||
break;
|
||||
case EVENT_CLEAVE:
|
||||
DoCastVictim(SPELL_CLEAVE);
|
||||
_events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 12000));
|
||||
break;
|
||||
case EVENT_THUNDERCLAP:
|
||||
DoCastVictim(SPELL_THUNDERCLAP);
|
||||
_events.ScheduleEvent(EVENT_THUNDERCLAP, urand(10000, 14000));
|
||||
break;
|
||||
case EVENT_VOID_BOLT:
|
||||
DoCastVictim(SPELL_VOID_BOLT);
|
||||
_events.ScheduleEvent(EVENT_VOID_BOLT, urand(15000, 18000));
|
||||
break;
|
||||
case EVENT_MARK_OF_KAZZAK:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, PowerUsersSelector(me, POWER_MANA, 100.0f, true)))
|
||||
DoCast(target, SPELL_MARK_OF_KAZZAK);
|
||||
_events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 20000);
|
||||
break;
|
||||
case EVENT_ENRAGE:
|
||||
Talk(EMOTE_FRENZY);
|
||||
DoCast(me, SPELL_ENRAGE);
|
||||
_events.ScheduleEvent(EVENT_ENRAGE, 30000);
|
||||
break;
|
||||
case EVENT_TWISTED_REFLECTION:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
|
||||
DoCast(target, SPELL_TWISTED_REFLECTION);
|
||||
_events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 15000);
|
||||
break;
|
||||
case EVENT_BERSERK:
|
||||
DoCast(me, SPELL_BERSERK);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
TaskScheduler _scheduler;
|
||||
bool _inBerserk;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
@@ -191,18 +166,18 @@ public:
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
if (Unit* owner = GetUnitOwner())
|
||||
{
|
||||
amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
|
||||
}
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (target->GetPower(POWER_MANA) == 0)
|
||||
{
|
||||
target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, nullptr, aurEff);
|
||||
// Remove aura
|
||||
SetDuration(0);
|
||||
SetDuration(0); // Remove aura
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
enum Texts
|
||||
{
|
||||
SAY_AGGRO = 0,
|
||||
SAY_EARTHQUAKE = 1,
|
||||
SAY_OVERRUN = 2,
|
||||
SAY_SLAY = 3,
|
||||
SAY_DEATH = 4
|
||||
SAY_AGGRO = 0,
|
||||
SAY_EARTHQUAKE = 1,
|
||||
SAY_OVERRUN = 2,
|
||||
SAY_SLAY = 3,
|
||||
SAY_DEATH = 4
|
||||
};
|
||||
|
||||
enum Spells
|
||||
@@ -38,15 +38,6 @@ enum Spells
|
||||
SPELL_AURA_DEATH = 37131
|
||||
};
|
||||
|
||||
enum Events
|
||||
{
|
||||
EVENT_ENRAGE = 1,
|
||||
EVENT_ARMOR = 2,
|
||||
EVENT_CHAIN = 3,
|
||||
EVENT_QUAKE = 4,
|
||||
EVENT_OVERRUN = 5
|
||||
};
|
||||
|
||||
class boss_doomwalker : public CreatureScript
|
||||
{
|
||||
public:
|
||||
@@ -54,29 +45,23 @@ public:
|
||||
|
||||
struct boss_doomwalkerAI : public ScriptedAI
|
||||
{
|
||||
boss_doomwalkerAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
}
|
||||
boss_doomwalkerAI(Creature* creature) : ScriptedAI(creature) {}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_events.Reset();
|
||||
_events.ScheduleEvent(EVENT_ENRAGE, 0);
|
||||
_events.ScheduleEvent(EVENT_ARMOR, urand(5000, 13000));
|
||||
_events.ScheduleEvent(EVENT_CHAIN, urand(10000, 30000));
|
||||
_events.ScheduleEvent(EVENT_QUAKE, urand(25000, 35000));
|
||||
_events.ScheduleEvent(EVENT_OVERRUN, urand(30000, 45000));
|
||||
_inEnrage = false;
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
victim->CastSpell(victim, SPELL_MARK_DEATH, 0);
|
||||
|
||||
if (urand(0, 4))
|
||||
return;
|
||||
|
||||
Talk(SAY_SLAY);
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
@@ -87,13 +72,55 @@ public:
|
||||
void JustEngagedWith(Unit* /*who*/) override
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
_scheduler.Schedule(1ms, [this](TaskContext context)
|
||||
{
|
||||
if (!HealthAbovePct(20))
|
||||
{
|
||||
DoCastSelf(SPELL_ENRAGE);
|
||||
context.Repeat(6s);
|
||||
_inEnrage = true;
|
||||
}
|
||||
}).Schedule(5s, 13s, [this](TaskContext context)
|
||||
{
|
||||
DoCastVictim(SPELL_SUNDER_ARMOR);
|
||||
context.Repeat(10s, 25s);
|
||||
}).Schedule(10s, 30s, [this](TaskContext context)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
|
||||
{
|
||||
DoCast(target, SPELL_CHAIN_LIGHTNING);
|
||||
}
|
||||
context.Repeat(7s, 27s);
|
||||
}).Schedule(25s, 35s, [this](TaskContext context)
|
||||
{
|
||||
if (urand(0, 1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Talk(SAY_EARTHQUAKE);
|
||||
if (_inEnrage) // avoid enrage + earthquake
|
||||
{
|
||||
me->RemoveAurasDueToSpell(SPELL_ENRAGE);
|
||||
}
|
||||
DoCastAOE(SPELL_EARTHQUAKE);
|
||||
context.Repeat(30s, 55s);
|
||||
}).Schedule(30s, 45s, [this](TaskContext context)
|
||||
{
|
||||
Talk(SAY_OVERRUN);
|
||||
DoCastVictim(SPELL_OVERRUN);
|
||||
context.Repeat(25s, 40s);
|
||||
});
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who))
|
||||
{
|
||||
if (who->HasAura(SPELL_MARK_DEATH) && !who->HasAura(27827)) // Spirit of Redemption
|
||||
{
|
||||
who->CastSpell(who, SPELL_AURA_DEATH, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
@@ -101,59 +128,15 @@ public:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
_scheduler.Update(diff);
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_ENRAGE:
|
||||
if (!HealthAbovePct(20))
|
||||
{
|
||||
DoCast(me, SPELL_ENRAGE);
|
||||
_events.ScheduleEvent(EVENT_ENRAGE, 6000);
|
||||
_inEnrage = true;
|
||||
}
|
||||
break;
|
||||
case EVENT_OVERRUN:
|
||||
Talk(SAY_OVERRUN);
|
||||
DoCastVictim(SPELL_OVERRUN);
|
||||
_events.ScheduleEvent(EVENT_OVERRUN, urand(25000, 40000));
|
||||
break;
|
||||
case EVENT_QUAKE:
|
||||
if (urand(0, 1))
|
||||
return;
|
||||
|
||||
Talk(SAY_EARTHQUAKE);
|
||||
|
||||
//remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead
|
||||
if (_inEnrage)
|
||||
me->RemoveAurasDueToSpell(SPELL_ENRAGE);
|
||||
|
||||
DoCast(me, SPELL_EARTHQUAKE);
|
||||
_events.ScheduleEvent(EVENT_QUAKE, urand(30000, 55000));
|
||||
break;
|
||||
case EVENT_CHAIN:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
|
||||
DoCast(target, SPELL_CHAIN_LIGHTNING);
|
||||
_events.ScheduleEvent(EVENT_CHAIN, urand(7000, 27000));
|
||||
break;
|
||||
case EVENT_ARMOR:
|
||||
DoCastVictim(SPELL_SUNDER_ARMOR);
|
||||
_events.ScheduleEvent(EVENT_ARMOR, urand(10000, 25000));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
TaskScheduler _scheduler;
|
||||
bool _inEnrage;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user