From 511ac17c55b590b09c1a2b2a16cf906fac7ded76 Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Mon, 26 Aug 2024 16:56:29 -0400 Subject: [PATCH] Core/Spells: Implemented SPELL_ATTR9_FACE_UNIT_TARGET_UPON_COMPLETION_OF_JUMP_CHARGE Port From (https://github.com/TrinityCore/TrinityCore/commit/5cb4536bd0492b49432b092e7ca4a458010b7d53) --- .../Framework/Constants/Spells/SpellConst.cs | 2 +- Source/Game/Spells/SpellEffects.cs | 24 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index 3b82eed3a..591cf57fe 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -1978,7 +1978,7 @@ namespace Framework.Constants NotInArena = 0x200, // 9 Not In Arena TargetMustBeGrounded = 0x400, // Target Must Be Grounded AllowWhileBanishedAuraState = 0x800, // Doesn't seem to be doing anything, banish behaves like a regular stun now - tested on patch 10.2.7 with spell 17767 (doesn't have this attribute, only SPELL_ATTR5_ALLOW_WHILE_STUNNED and was castable while banished) - Unk12 = 0x1000, // 12 + FaceUnitTargetUponCompletionOfJumpCharge = 0x1000, // Face unit target upon completion of jump charge Slam = 0x2000, // 13 UsableInRatedBattlegrounds = 0x4000, // 14 Can Be Used In Rated Battlegrounds Unk15 = 0x8000, // 15 diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 99ca77cc8..567690ba2 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -531,10 +531,16 @@ namespace Game.Spells float speedXY, speedZ; CalculateJumpSpeeds(effectInfo, unitCaster.GetExactDist2d(unitTarget), out speedXY, out speedZ); + + object facing = null; + Unit target = m_targets.GetUnitTarget(); + if (target != null && m_spellInfo.HasAttribute(SpellAttr9.FaceUnitTargetUponCompletionOfJumpCharge)) + facing = target; + JumpArrivalCastArgs arrivalCast = new(); arrivalCast.SpellId = effectInfo.TriggerSpell; arrivalCast.Target = unitTarget.GetGUID(); - unitCaster.GetMotionMaster().MoveJump(unitTarget, speedXY, speedZ, EventId.Jump, null, arrivalCast); + unitCaster.GetMotionMaster().MoveJump(unitTarget, speedXY, speedZ, EventId.Jump, facing, arrivalCast); } [SpellEffectHandler(SpellEffectName.JumpDest)] @@ -555,9 +561,14 @@ namespace Game.Spells float speedXY, speedZ; CalculateJumpSpeeds(effectInfo, unitCaster.GetExactDist2d(destTarget), out speedXY, out speedZ); - object facing = null; - if (!m_targets.GetUnitTargetGUID().IsEmpty()) + + object facing; + Unit target = m_targets.GetUnitTarget(); + if (target != null && m_spellInfo.HasAttribute(SpellAttr9.FaceUnitTargetUponCompletionOfJumpCharge)) + facing = target; + else facing = destTarget.GetOrientation(); + JumpArrivalCastArgs arrivalCast = new(); arrivalCast.SpellId = effectInfo.TriggerSpell; unitCaster.GetMotionMaster().MoveJump(destTarget, speedXY, speedZ, EventId.Jump, facing, arrivalCast); @@ -5567,6 +5578,11 @@ namespace Game.Spells if (jumpParams.TreatSpeedAsMoveTimeSeconds) speed = unitCaster.GetExactDist(destTarget) / jumpParams.Speed; + object facing = null; + Unit target = m_targets.GetUnitTarget(); + if (target != null && m_spellInfo.HasAttribute(SpellAttr9.FaceUnitTargetUponCompletionOfJumpCharge)) + facing = target; + JumpArrivalCastArgs arrivalCast = null; if (effectInfo.TriggerSpell != 0) { @@ -5588,7 +5604,7 @@ namespace Game.Spells effectExtra.ParabolicCurveId = jumpParams.ParabolicCurveId.Value; } - unitCaster.GetMotionMaster().MoveJumpWithGravity(destTarget, speed, jumpParams.JumpGravity, EventId.Jump, null, arrivalCast, effectExtra); + unitCaster.GetMotionMaster().MoveJumpWithGravity(destTarget, speed, jumpParams.JumpGravity, EventId.Jump, facing, arrivalCast, effectExtra); } [SpellEffectHandler(SpellEffectName.LearnTransmogSet)]