mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/GameObjects: Skip LoS checks for traps (#23936)
* Core/GameObjects: Skip LoS checks for traps * Core/GameObjects: Fix spells cast by traps missing always * Scripts/Spells: Fix WSG heal buff not healing The WSG green heal buff is now cast by a GameObject so the spell target should be used to calculate the healing, not the GameObject.
This commit is contained in:
@@ -1291,6 +1291,14 @@ uint8 GameObject::GetLevelForTarget(WorldObject const* target) const
|
||||
if (Unit* owner = GetOwner())
|
||||
return owner->GetLevelForTarget(target);
|
||||
|
||||
if (GetGoType() == GAMEOBJECT_TYPE_TRAP)
|
||||
{
|
||||
if (GetGOInfo()->trap.level != 0)
|
||||
return GetGOInfo()->trap.level;
|
||||
if (const Unit* targetUnit = target->ToUnit())
|
||||
return targetUnit->GetLevel();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -454,6 +454,7 @@ struct GameObjectTemplate
|
||||
case GAMEOBJECT_TYPE_CHEST: return chest.losOK == 0;
|
||||
case GAMEOBJECT_TYPE_GOOBER: return goober.losOK == 0;
|
||||
case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.losOK == 0;
|
||||
case GAMEOBJECT_TYPE_TRAP: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2872,19 +2872,19 @@ class spell_gen_restoration : public AuraScript
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
Unit* target = GetTarget();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
int32 heal = caster->CountPctFromMaxHealth(10);
|
||||
HealInfo healInfo(caster, GetTarget(), heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
|
||||
caster->HealBySpell(healInfo);
|
||||
int32 heal = target->CountPctFromMaxHealth(10);
|
||||
HealInfo healInfo(target, target, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
|
||||
target->HealBySpell(healInfo);
|
||||
|
||||
/// @todo: should proc other auras?
|
||||
if (int32 mana = caster->GetMaxPower(POWER_MANA))
|
||||
if (int32 mana = target->GetMaxPower(POWER_MANA))
|
||||
{
|
||||
mana /= 10;
|
||||
caster->EnergizeBySpell(caster, GetId(), mana, POWER_MANA);
|
||||
target->EnergizeBySpell(target, GetId(), mana, POWER_MANA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user