Exiles Reach: rider immune to NPC damage while on the giant boar
Some undead still hit the player during the boar ride (mobs that aggro on sight, not via the trample). Set UNIT_FLAG_IMMUNE_TO_NPC on the player for the ride's duration so mob attacks can't reach the rider (IsValidAttackTarget checks target->IsImmuneToNPC); the boar takes the hits and the trample kills the cadavers.
This commit is contained in:
@@ -890,6 +890,18 @@ public:
|
||||
|
||||
class spell_riding_giant_boar_305068_AuraScript : public AuraScript
|
||||
{
|
||||
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* owner = GetUnitOwner();
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
// Riding the giant boar: the undead chew on the boar, not the rider.
|
||||
// Block NPC attacks on the player (the trample/charge already pull
|
||||
// threat onto the boar, so remaining direct hits shouldn't reach us).
|
||||
owner->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* owner = GetUnitOwner();
|
||||
@@ -897,12 +909,14 @@ public:
|
||||
if (!owner || !player)
|
||||
return;
|
||||
|
||||
owner->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
|
||||
player->RemoveAura(SPELL_RIDING_GIANT_BOAR2);
|
||||
player->CastSpell(player, SPELL_KNOCKBACK_FOR_HACKFIX_GIANT_BOAR_LEAVE, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_riding_giant_boar_305068_AuraScript::HandleApply, EFFECT_1, SPELL_AURA_LINKED_SUMMON, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_riding_giant_boar_305068_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_LINKED_SUMMON, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user