Scripts/BRC: fixed up Raz's Furious Swipe mechanic and ensure that his Aggro Nearby Target targets engage him upon hit

This commit is contained in:
Ovahlord committed 2022-12-04 09:12:35 +01:00
1 parent ed19b938b9
commit f17caff7a0
2 files changed
+28 -2

No files matched your search

@@ -667,6 +667,9 @@ struct npc_raz_the_crazed : public EscortAI
_events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
@@ -726,6 +729,8 @@ struct npc_raz_the_crazed : public EscortAI
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
}
DoMeleeAttackIfReady();
}
private:
@@ -745,9 +750,11 @@ class spell_brc_furious_swipe_dummy : public SpellScript
if (Unit* caster = GetCaster())
{
caster->SetFacingTo(caster->GetAngle(GetHitUnit()));
caster->CastSpell(GetHitUnit(), SPELL_FURIOUS_SWIPE);
caster->SetOrientationTowards(GetHitUnit()); // Update orientation immediately
caster->CastSpell(nullptr, SPELL_FURIOUS_SWIPE);
if (caster->GetMap()->IsHeroic()) // Heroic difficulty casts the spell twice in a row
caster->CastSpell(GetHitUnit(), SPELL_FURIOUS_SWIPE);
caster->CastSpell(nullptr, SPELL_FURIOUS_SWIPE);
}
}
@@ -776,6 +783,21 @@ class spell_brc_furious_swipe : public SpellScript
}
};
class spell_brc_aggro_nearby_targets : public AuraScript
{
void HandleAggro(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (!GetTarget()->IsEngaged())
if (Unit* caster = GetCaster())
GetTarget()->EngageWithTarget(caster);
}
void Register() override
{
AfterEffectApply.Register(&spell_brc_aggro_nearby_targets::HandleAggro, EFFECT_0, SPELL_AURA_MOD_FACTION, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
class at_raz_corla_event : public AreaTriggerScript
{
public:
@@ -853,6 +875,7 @@ void AddSC_blackrock_caverns()
RegisterBlackrockCavernsCreatureAI(npc_raz_the_crazed);
RegisterSpellScript(spell_brc_furious_swipe_dummy);
RegisterSpellScript(spell_brc_furious_swipe);
RegisterSpellScript(spell_brc_aggro_nearby_targets);
new at_raz_corla_event();
new at_raz_obsidius_event();
new at_brc_quest_trigger("at_brc_corla_quest", QUEST_ID_WHAT_IS_THIS_PLACE);