Exiles Reach: trample damage from the boar, not the rider
The trample script dealt damage from the player (GetCaster), so the undead aggro'd the rider and chewed through the player's health during the boar ride. Attribute the trample damage to the boar vehicle (GetVehicleBase) so the mobs attack the boar instead.
This commit is contained in:
@@ -1001,19 +1001,27 @@ public:
|
|||||||
if (!caster || !caster->IsInWorld())
|
if (!caster || !caster->IsInWorld())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float radius = GetEffectInfo().CalcRadius(caster).Max;
|
// Damage comes from the boar vehicle so the undead aggro the boar,
|
||||||
|
// not the rider (a player-cast trample would pull threat onto the
|
||||||
|
// player and the mobs would chew through the rider's health).
|
||||||
|
Unit* source = caster;
|
||||||
|
if (Player* player = caster->ToPlayer())
|
||||||
|
if (Unit* boar = player->GetVehicleBase())
|
||||||
|
source = boar;
|
||||||
|
|
||||||
|
float radius = GetEffectInfo().CalcRadius(source).Max;
|
||||||
int32 damage = GetEffectValue();
|
int32 damage = GetEffectValue();
|
||||||
|
|
||||||
std::list<Creature*> targets;
|
std::list<Creature*> targets;
|
||||||
Trinity::AnyUnitInObjectRangeCheck u_check(caster, radius);
|
Trinity::AnyUnitInObjectRangeCheck u_check(source, radius);
|
||||||
Trinity::CreatureListSearcher<Trinity::AnyUnitInObjectRangeCheck> searcher(caster, targets, u_check);
|
Trinity::CreatureListSearcher<Trinity::AnyUnitInObjectRangeCheck> searcher(source, targets, u_check);
|
||||||
Cell::VisitGridObjects(caster, searcher, radius);
|
Cell::VisitGridObjects(source, searcher, radius);
|
||||||
|
|
||||||
for (Creature* target : targets)
|
for (Creature* target : targets)
|
||||||
{
|
{
|
||||||
if (!caster->IsValidAttackTarget(target))
|
if (!source->IsValidAttackTarget(target))
|
||||||
continue;
|
continue;
|
||||||
Unit::DealDamage(caster, target, uint32(damage), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL);
|
Unit::DealDamage(source, target, uint32(damage), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user