Exiles Reach: rider immune to NPC damage while on the giant boar
Build (Windows x64) / build (push) Canceled after 0s
Build (Windows x64) / linux-build (push) Canceled after 0s

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:
devbox
2026-08-23 22:18:44 +10:00
parent 23dc67639f
commit 07e78803e2
@@ -890,6 +890,18 @@ public:
class spell_riding_giant_boar_305068_AuraScript : public AuraScript 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*/) void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
Unit* owner = GetUnitOwner(); Unit* owner = GetUnitOwner();
@@ -897,12 +909,14 @@ public:
if (!owner || !player) if (!owner || !player)
return; return;
owner->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
player->RemoveAura(SPELL_RIDING_GIANT_BOAR2); player->RemoveAura(SPELL_RIDING_GIANT_BOAR2);
player->CastSpell(player, SPELL_KNOCKBACK_FOR_HACKFIX_GIANT_BOAR_LEAVE, true); player->CastSpell(player, SPELL_KNOCKBACK_FOR_HACKFIX_GIANT_BOAR_LEAVE, true);
} }
void Register() override 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); OnEffectRemove += AuraEffectRemoveFn(spell_riding_giant_boar_305068_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_LINKED_SUMMON, AURA_EFFECT_HANDLE_REAL);
} }
}; };