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:
Giacomo Pozzoni
2019-11-24 21:00:42 +01:00
committed by GitHub
parent 94f186ee83
commit 909941e1b4
3 changed files with 16 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}