From ffc11501fe6b381c0fd060aefd3a2f73c96c4fba Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sun, 6 May 2018 23:30:36 +0200 Subject: [PATCH] Core/Spells: fixed Mage Flame Orb and Frostfire Orb behaivior --- src/server/game/Spells/SpellMgr.cpp | 6 ++-- src/server/scripts/Spells/spell_mage.cpp | 23 ++++++++------ src/server/scripts/World/npcs_special.cpp | 38 +++++++++++------------ 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index ae77412b54e..56002dca9c7 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2880,8 +2880,10 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->Effects[EFFECT_0].BonusMultiplier = spellInfo->Effects[EFFECT_1].BonusMultiplier; }); - // Flame Orb / Frostfire Orb - ApplySpellFix({ 82690, 84717 }, [](SpellInfo* spellInfo) + ApplySpellFix({ + 82690, // Flame Orb + 84717 // Frostfire Orb + }, [](SpellInfo* spellInfo) { spellInfo->Effects[EFFECT_0].Amplitude = 1000; }); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index aea6c1945ff..37ecb83a1b2 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -68,10 +68,10 @@ enum MageSpells SPELL_MAGE_FROSTFIRE_ORB_SUMMON = 84714, SPELL_MAGE_FROSTFIRE_ORB_AOE = 84718, - SPELL_MAGE_FROSTFIRE_ORB_DAMAGE = 95969, - SPELL_MAGE_FROSTFIRE_ORB_DAMAGE_SLOW = 84721, - - SPELL_MAGE_FROSTFIRE_BOLT_CHILL_EFFECT = 44614, + SPELL_MAGE_FROSTFIRE_ORB_DAMAGE_R1 = 95969, + SPELL_MAGE_FROSTFIRE_ORB_DAMAGE_R2 = 84721, + SPELL_MAGE_FROSTFIRE_ORB_RANK_R2 = 84727, + SPELL_MAGE_FROSTFIRE_BOLT_CHILL_EFFECT = 44614, SPELL_MAGE_HOT_STREAK = 44445, SPELL_MAGE_HOT_STREAK_TRIGGERED = 48108, @@ -1740,10 +1740,11 @@ class spell_mage_flame_orb_aoe_dummy: public SpellScriptLoader SPELL_MAGE_FLAME_ORB_AOE, SPELL_MAGE_FROSTFIRE_ORB_AOE, SPELL_MAGE_FLAME_ORB_BEAM_DUMMY, - SPELL_MAGE_FROSTFIRE_ORB_DAMAGE, - SPELL_MAGE_FROSTFIRE_ORB_DAMAGE_SLOW, + SPELL_MAGE_FROSTFIRE_ORB_DAMAGE_R1, + SPELL_MAGE_FROSTFIRE_ORB_DAMAGE_R2, SPELL_MAGE_FLAME_ORB_DAMAGE, - SPELL_MAGE_FLAME_ORB_SELF_SNARE + SPELL_MAGE_FLAME_ORB_SELF_SNARE, + SPELL_MAGE_FROSTFIRE_ORB_RANK_R2, }); } @@ -1777,8 +1778,12 @@ class spell_mage_flame_orb_aoe_dummy: public SpellScriptLoader break; case SPELL_MAGE_FROSTFIRE_ORB_AOE: caster->CastSpell(caster, SPELL_MAGE_FLAME_ORB_SELF_SNARE, true); - caster->CastSpell(caster, SPELL_MAGE_FLAME_ORB_BEAM_DUMMY, true); - // summoner->CastSpell(target, target->HasAura(SPELL_MAGE_FROSTFIRE_BOLT_CHILL_EFFECT) ? SPELL_MAGE_FROSTFIRE_ORB_DAMAGE_SLOW : SPELL_MAGE_FROSTFIRE_ORB_DAMAGE, true); + caster->CastSpell(target, SPELL_MAGE_FLAME_ORB_BEAM_DUMMY, true); + + if (summoner->HasAura(SPELL_MAGE_FROSTFIRE_ORB_RANK_R2)) + summoner->CastSpell(target, SPELL_MAGE_FROSTFIRE_ORB_DAMAGE_R2, true); + else + summoner->CastSpell(target, SPELL_MAGE_FROSTFIRE_ORB_DAMAGE_R1, true); break; default: break; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 5e964c6b016..b9b97756e10 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -29,6 +29,7 @@ #include "ObjectMgr.h" #include "PassiveAI.h" #include "Pet.h" +#include "PetAI.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "ScriptMgr.h" @@ -3012,7 +3013,7 @@ public: enum MageOrb { - EVENT_START_MOVING = 1, + EVENT_MOVE_FORWARD = 1, EVENT_APPLY_PERIODIC_EFFECT = 2, EVENT_EXPLODE = 3, @@ -3020,7 +3021,7 @@ enum MageOrb SPELL_FROSTFIRE_ORB_AURA = 84717, NPC_FLAME_ORB = 44214, - NPC_FROSTFIRE_ORB = 45322, + NPC_FROSTFIRE_ORB = 45322 }; @@ -3030,15 +3031,23 @@ class npc_mage_orb : public CreatureScript public: npc_mage_orb() : CreatureScript("npc_mage_orb") { } - struct npc_mage_orbAI : public ScriptedAI + struct npc_mage_orbAI : public PetAI { - npc_mage_orbAI(Creature* creature) : ScriptedAI(creature) { } + npc_mage_orbAI(Creature* creature) : PetAI(creature) { } - void IsSummonedBy(Unit* /*summoner*/) override + void AttackStart(Unit* /*target*/) override { - events.ScheduleEvent(EVENT_START_MOVING, Milliseconds(1)); + // Calling MovePoint again to apply movement speed changes + if (me->isMoving()) + me->GetMotionMaster()->MovePoint(0, pos); + } + + void IsSummonedBy(Unit* summoner) override + { + pos = summoner->GetPosition(); + summoner->MovePositionToFirstCollision(pos, 100.0f, 0.0f); + events.ScheduleEvent(EVENT_MOVE_FORWARD, Milliseconds(1)); events.ScheduleEvent(EVENT_APPLY_PERIODIC_EFFECT, Milliseconds(400)); - me->m_ControlledByPlayer = false; } void UpdateAI(uint32 diff) override @@ -3049,21 +3058,10 @@ class npc_mage_orb : public CreatureScript { switch (eventId) { - case EVENT_START_MOVING: - { + case EVENT_MOVE_FORWARD: me->GetMotionMaster()->Clear(); - pos.SetOrientation(me->GetOrientation()); - pos.m_positionX = me->GetPositionX() + cos(pos.GetOrientation()) * 100.0f; - pos.m_positionY = me->GetPositionY() + sin(pos.GetOrientation()) * 100.0f; - float ground; - me->GetMap()->GetWaterOrGroundLevel(me->GetPhaseShift(), pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), &ground); - pos.m_positionZ = ground; - Movement::MoveSplineInit init(me); - init.SetSmooth(); - init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false); - init.Launch(); + me->GetMotionMaster()->MovePoint(0, pos); break; - } case EVENT_APPLY_PERIODIC_EFFECT: DoCastSelf(me->GetEntry() == NPC_FLAME_ORB ? SPELL_FLAME_ORB_AURA : SPELL_FROSTFIRE_ORB_AURA, true); break;