mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +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.
(cherry picked from commit 909941e1b4)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user