diff --git a/sql/updates/world/custom/custom_2018_11_07_00_world.sql b/sql/updates/world/custom/custom_2018_11_07_00_world.sql new file mode 100644 index 00000000000..e8ae54c1979 --- /dev/null +++ b/sql/updates/world/custom/custom_2018_11_07_00_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_sc_ring_wyrm_knockback'; + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(81235, 'spell_sc_ring_wyrm_knockback'); diff --git a/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp b/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp index ec1f98eacde..43024530bae 100644 --- a/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp +++ b/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp @@ -21,6 +21,7 @@ #include "ObjectMgr.h" #include "Player.h" #include "ScriptedCreature.h" +#include "Spell.h" #include "SpellScript.h" #include "stonecore.h" @@ -343,10 +344,14 @@ class spell_sc_twilight_documents : public SpellScriptLoader class JumpCheck { public: - bool operator()(WorldObject* object) const + bool operator()(WorldObject* object) { - Player* player = object->ToPlayer(); - return (player && (player->IsFalling() || player->HasUnitState(UNIT_STATE_JUMPING))); + if (Unit* target = object->ToUnit()) + return (target->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) + || target->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR) + || target->HasUnitMovementFlag(MOVEMENTFLAG_PITCH_UP)); + + return false; } }; @@ -376,6 +381,27 @@ class spell_sc_quake : public SpellScriptLoader } }; +class spell_sc_ring_wyrm_knockback : public SpellScript +{ + PrepareSpellScript(spell_sc_ring_wyrm_knockback); + + void SetDest(SpellDestination& dest) + { + Unit* caster = GetCaster(); + + float angle = caster->GetOrientation(); + float x = caster->GetPositionX() + cos(caster->GetOrientation() + float(M_PI)) * 100.0f; + float y = caster->GetPositionY() + sin(caster->GetOrientation() + float(M_PI)) * 100.0f; + float z = caster->GetPositionZ(); + dest.Relocate({ x, y, z, 0.0f }); + } + + void Register() + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_sc_ring_wyrm_knockback::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM); + } +}; + class at_sc_corborus_intro : public AreaTriggerScript { public: @@ -411,6 +437,7 @@ void AddSC_stonecore() new spell_sc_anchor_here(); new spell_sc_twilight_documents(); new spell_sc_quake(); + RegisterSpellScript(spell_sc_ring_wyrm_knockback); new at_sc_corborus_intro(); new at_sc_slabhide_intro(); }