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.

(cherry picked from commit 909941e1b4)
This commit is contained in:
Giacomo Pozzoni
2019-11-24 21:00:42 +01:00
committed by Shauren
parent 1e84214f63
commit 9bede687ce
2 changed files with 17 additions and 7 deletions

View File

@@ -1444,6 +1444,16 @@ uint8 GameObject::GetLevelForTarget(WorldObject const* target) const
if (Unit* owner = GetOwner())
return owner->GetLevelForTarget(target);
if (GetGoType() == GAMEOBJECT_TYPE_TRAP)
{
if (Player const* player = target->ToPlayer())
if (Optional<ContentTuningLevels> userLevels = sDB2Manager.GetContentTuningData(GetGOInfo()->ContentTuningId, player->m_playerData->CtrOptions->ContentTuningConditionMask))
return uint8(advstd::clamp<int16>(player->GetLevel(), userLevels->MinLevel, userLevels->MaxLevel));
if (Unit const* targetUnit = target->ToUnit())
return targetUnit->GetLevel();
}
return 1;
}

View File

@@ -2690,19 +2690,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, GetSpellInfo(), mana, POWER_MANA);
target->EnergizeBySpell(target, GetSpellInfo(), mana, POWER_MANA);
}
}