diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 1 | ||||
| -rw-r--r-- | src/server/game/Movement/MotionMaster.cpp | 17 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellScript.cpp | 3 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellScript.h | 2 |
5 files changed, 20 insertions, 11 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index cb0c5d14a43..7f7e2f1a61f 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -581,7 +581,6 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/) // TODO: migrate these in DB _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT, (GetCreatureDifficulty()->TypeFlags & CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT) != 0); SetIgnoreFeignDeath((creatureInfo->flags_extra & CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH) != 0); - SetInteractionAllowedInCombat((GetCreatureDifficulty()->TypeFlags & CREATURE_TYPE_FLAG_ALLOW_INTERACTION_WHILE_IN_COMBAT) != 0); SetTreatAsRaidUnit((GetCreatureDifficulty()->TypeFlags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) != 0); return true; diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index bccfa78dd0d..85bb2e365f3 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -806,23 +806,34 @@ void MotionMaster::MoveKnockbackFrom(Position const& origin, float speedXY, floa if (_owner->GetTypeId() == TYPEID_PLAYER) return; - if (speedXY < 0.01f) + if (std::abs(speedXY) < 0.01f /* && std::abs(speedZ) < 0.01f */) return; Position dest = _owner->GetPosition(); + float o = dest == origin ? 0.0f : _owner->GetRelativeAngle(origin) + float(M_PI); + if (speedXY < 0) + { + speedXY = -speedXY; + o = o - float(M_PI); + } + + if (speedZ < 0) + speedZ = -speedZ; // doesn't seem to be supported on official servers - packet sent for knockback with positive and negative speed has the same flags and JumpGravity + float moveTimeHalf = speedZ / Movement::gravity; float dist = 2 * moveTimeHalf * speedXY; float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ); // Use a mmap raycast to get a valid destination. - _owner->MovePositionToFirstCollision(dest, dist, _owner->GetRelativeAngle(origin) + float(M_PI)); + _owner->MovePositionToFirstCollision(dest, dist, o); std::function<void(Movement::MoveSplineInit&)> initializer = [=, effect = (spellEffectExtraData ? Optional<Movement::SpellEffectExtraData>(*spellEffectExtraData) : Optional<Movement::SpellEffectExtraData>())](Movement::MoveSplineInit& init) { init.MoveTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), false); init.SetParabolic(max_height, 0); init.SetOrientationFixed(true); - init.SetVelocity(speedXY); + if (speedXY >= 0.01f) + init.SetVelocity(speedXY); if (effect) init.SetSpellEffectExtraData(*effect); }; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 9954a89d928..95df657d03d 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4040,9 +4040,9 @@ void Spell::EffectKnockBack() return; float ratio = 0.1f; - float speedxy = float(effectInfo->MiscValue) * ratio; - float speedz = float(damage) * ratio; - if (speedxy < 0.01f && speedz < 0.01f) + float speedXY = float(effectInfo->MiscValue) * ratio; + float speedZ = float(damage) * ratio; + if (std::abs(speedXY) < 0.01f && std::abs(speedZ) < 0.01f) return; Position origin; @@ -4056,7 +4056,7 @@ void Spell::EffectKnockBack() else //if (effectInfo->Effect == SPELL_EFFECT_KNOCK_BACK) origin = m_caster->GetPosition(); - unitTarget->KnockbackFrom(origin, speedxy, speedz); + unitTarget->KnockbackFrom(origin, speedXY, speedZ); Unit::ProcSkillsAndAuras(GetUnitCasterForEffectHandlers(), unitTarget, PROC_FLAG_NONE, { PROC_FLAG_NONE, PROC_FLAG_2_KNOCKBACK }, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_HIT, PROC_HIT_NONE, nullptr, nullptr, nullptr); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 9ffefa47fc6..db24e13cb19 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -21,7 +21,6 @@ #include "Spell.h" #include "SpellAuras.h" #include "SpellMgr.h" -#include "StringConvert.h" #include "Unit.h" #include <string> @@ -35,7 +34,7 @@ bool SpellScriptBase::_Validate(SpellInfo const* entry) return true; } -SpellScriptBase::SpellScriptBase() noexcept : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptSpellId(0) +SpellScriptBase::SpellScriptBase() noexcept : m_scriptSpellId(0), m_currentScriptState(SPELL_SCRIPT_STATE_NONE) { } diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 77c5c512fc7..739355cd21e 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -174,9 +174,9 @@ protected: Ret(* Thunk)(BaseClass&, Args..., StorageType); }; - uint8 m_currentScriptState; std::string_view m_scriptName; uint32 m_scriptSpellId; + uint8 m_currentScriptState; private: |
