refactor(Scripts/Karazhan): Update Moroes (#16682)

* init

* .
This commit is contained in:
Eddy Vega
2023-07-17 05:21:13 -06:00
committed by GitHub
parent dbc39a2817
commit 3a7274709b

View File

@@ -41,7 +41,7 @@ enum Spells
SPELL_FRENZY = 37023,
SPELL_DUAL_WIELD = 29651,
SPELL_BERSERK = 26662,
SPELL_VANISH_TELEPORT = 29431,
SPELL_VANISH_TELEPORT = 29431
};
enum Misc
@@ -52,9 +52,8 @@ enum Misc
EVENT_SPELL_GARROTE = 4,
EVENT_SPELL_BLIND = 5,
EVENT_SPELL_GOUGE = 6,
EVENT_CHECK_HEALTH = 7,
EVENT_SPELL_ENRAGE = 8,
EVENT_KILL_TALK = 9,
EVENT_SPELL_ENRAGE = 7,
EVENT_KILL_TALK = 8,
ACTIVE_GUEST_COUNT = 4,
MAX_GUEST_COUNT = 6
@@ -65,17 +64,13 @@ const Position GuestsPosition[4] =
{-10987.38f, -1883.38f, 81.73f, 1.50f},
{-10989.60f, -1881.27f, 81.73f, 0.73f},
{-10978.81f, -1884.08f, 81.73f, 1.50f},
{-10976.38f, -1882.59f, 81.73f, 2.31f},
{-10976.38f, -1882.59f, 81.73f, 2.31f}
};
const uint32 GuestEntries[6] =
{
17007,
19872,
19873,
19874,
19875,
19876,
17007, 19872, 19873,
19874, 19875, 19876
};
struct boss_moroes : public BossAI
@@ -109,11 +104,13 @@ struct boss_moroes : public BossAI
uint8 rand2 = RAND(0x08, 0x10, 0x20);
_activeGuests &= ~(rand1 | rand2);
}
for (uint8 i = 0; i < MAX_GUEST_COUNT; ++i)
{
if ((1 << i) & _activeGuests)
{
me->SummonCreature(GuestEntries[i], GuestsPosition[summons.size()], TEMPSUMMON_MANUAL_DESPAWN);
}
}
_events2.Reset();
_events2.ScheduleEvent(EVENT_GUEST_TALK, 10s);
}
@@ -128,24 +125,32 @@ struct boss_moroes : public BossAI
{
BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_SPELL_VANISH, 30s);
events.ScheduleEvent(EVENT_SPELL_BLIND, 20s);
events.ScheduleEvent(EVENT_SPELL_GOUGE, 13s);
events.ScheduleEvent(EVENT_CHECK_HEALTH, 5s);
events.ScheduleEvent(EVENT_SPELL_ENRAGE, 10min);
_events2.Reset();
me->CallForHelp(20.0f);
DoZoneInCombat();
}
void KilledUnit(Unit* /*victim*/) override
void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType, SpellSchoolMask) override
{
if (HealthBelowPct(30))
{
DoCastSelf(SPELL_FRENZY, true);
}
}
void KilledUnit(Unit* victim) override
{
if (events.GetNextEventTime(EVENT_KILL_TALK) == 0)
{
Talk(SAY_KILL);
events.ScheduleEvent(EVENT_KILL_TALK, 5s);
if (victim->GetTypeId() == TYPEID_PLAYER)
{
Talk(SAY_KILL);
events.ScheduleEvent(EVENT_KILL_TALK, 5s);
}
}
}
@@ -160,9 +165,12 @@ struct boss_moroes : public BossAI
{
std::list<Creature*> guestList;
for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i)
{
if (Creature* summon = ObjectAccessor::GetCreature(*me, *i))
{
guestList.push_back(summon);
}
}
return Acore::Containers::SelectRandomContainerElement(guestList);
}
@@ -171,15 +179,17 @@ struct boss_moroes : public BossAI
_events2.Update(diff);
switch (_events2.ExecuteEvent())
{
case EVENT_GUEST_TALK:
if (Creature* guest = GetRandomGuest())
guest->AI()->Talk(SAY_GUEST);
_events2.Repeat(5s);
break;
case EVENT_GUEST_TALK2:
Talk(SAY_OUT_OF_COMBAT);
_events2.Repeat(1min, 2min);
break;
case EVENT_GUEST_TALK:
if (Creature* guest = GetRandomGuest())
{
guest->AI()->Talk(SAY_GUEST);
}
_events2.Repeat(5s);
break;
case EVENT_GUEST_TALK2:
Talk(SAY_OUT_OF_COMBAT);
_events2.Repeat(1min, 2min);
break;
}
if (!UpdateVictim())
@@ -191,14 +201,6 @@ struct boss_moroes : public BossAI
switch (events.ExecuteEvent())
{
case EVENT_CHECK_HEALTH:
if (me->HealthBelowPct(31))
{
DoCastSelf(SPELL_FRENZY, true);
break;
}
events.Repeat(1s);
break;
case EVENT_SPELL_ENRAGE:
DoCastSelf(SPELL_BERSERK, true);
break;
@@ -227,9 +229,7 @@ struct boss_moroes : public BossAI
events.SetPhase(0);
break;
}
// Xinef: not in vanish
if (events.GetPhaseMask() == 0)
if (events.GetPhaseMask() == 0) // Xinef: not in vanish
DoMeleeAttackIfReady();
}
@@ -238,41 +238,30 @@ struct boss_moroes : public BossAI
uint8 _activeGuests;
};
class spell_moroes_vanish : public SpellScriptLoader
class spell_moroes_vanish : public SpellScript
{
public:
spell_moroes_vanish() : SpellScriptLoader("spell_moroes_vanish") { }
PrepareSpellScript(spell_moroes_vanish);
class spell_moroes_vanish_SpellScript : public SpellScript
void HandleDummy(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_moroes_vanish_SpellScript);
void HandleDummy(SpellEffIndex effIndex)
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
{
Position pos = target->GetFirstCollisionPosition(5.0f, M_PI);
GetCaster()->CastSpell(target, SPELL_GARROTE_DUMMY, true);
GetCaster()->RemoveAurasDueToSpell(SPELL_VANISH);
GetCaster()->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), target->GetOrientation());
}
Position pos = target->GetFirstCollisionPosition(5.0f, M_PI);
GetCaster()->CastSpell(target, SPELL_GARROTE_DUMMY, true);
GetCaster()->RemoveAurasDueToSpell(SPELL_VANISH);
GetCaster()->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), target->GetOrientation());
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_moroes_vanish_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_moroes_vanish_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_moroes_vanish::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
void AddSC_boss_moroes()
{
RegisterKarazhanCreatureAI(boss_moroes);
new spell_moroes_vanish();
RegisterSpellScript(spell_moroes_vanish);
}