aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2019-11-24 21:00:42 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-19 01:05:54 +0100
commit9bede687ce3d291c8af8f4deb3f1dcebba1a315d (patch)
treefd97eafbcdbf4dbcaaa172db45c1de5e9b928f57
parent1e84214f63bdf30705f22f2d324c3938351df9c2 (diff)
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 909941e1b44250b0fa646d363af817f40ca48355)
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp10
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp14
2 files changed, 17 insertions, 7 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 97e38b728fc..fec95d85617 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -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;
}
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 190f32b044f..f000c3294d1 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -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);
}
}