From 148291729f9b95003f6ae8d93a541e7c9721722f Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 10 Aug 2019 23:43:15 +0200 Subject: [PATCH] Core/Spells: ported focusing rework and fixed an additional issue that was causing channeled spells getting interrupted when being cast within the focus delay release time --- src/server/game/AI/CreatureAI.cpp | 8 +- .../game/Entities/Creature/Creature.cpp | 124 +++++++++--------- src/server/game/Entities/Creature/Creature.h | 22 ++-- src/server/game/Entities/Unit/Unit.cpp | 4 +- src/server/game/Entities/Unit/Unit.h | 2 +- src/server/game/Spells/Spell.cpp | 14 +- .../BlackwingDescent/boss_magmaw.cpp | 2 +- .../EasternKingdoms/ZulGurub/zulgurub.cpp | 2 +- .../boss_conclave_of_wind.cpp | 2 +- .../HallsOfReflection/halls_of_reflection.cpp | 2 +- .../boss_icecrown_gunship_battle.cpp | 2 +- .../Northrend/Ulduar/Ulduar/boss_thorim.cpp | 2 +- 12 files changed, 92 insertions(+), 94 deletions(-) diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 4e12bd18aa..96e4177d6a 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -216,7 +216,7 @@ void CreatureAI::SetGazeOn(Unit* target) { if (me->IsValidAttackTarget(target)) { - if (!me->IsFocusing(nullptr, true) && target != me->GetVictim()) + if (!me->HasSpellFocus() && target != me->GetVictim()) AttackStart(target); me->SetReactState(REACT_PASSIVE); } @@ -236,7 +236,7 @@ bool CreatureAI::UpdateVictimWithGaze() } if (Unit* victim = me->SelectVictim()) - if (!me->IsFocusing(nullptr, true) && victim != me->GetVictim()) + if (!me->HasSpellFocus() && victim != me->GetVictim()) AttackStart(victim); return me->GetVictim() != nullptr; @@ -250,7 +250,7 @@ bool CreatureAI::UpdateVictim() if (!me->HasReactState(REACT_PASSIVE)) { if (Unit* victim = me->SelectVictim()) - if (!me->IsFocusing(nullptr, true) && victim != me->GetVictim()) + if (!me->HasSpellFocus() && victim != me->GetVictim()) AttackStart(victim); return me->GetVictim() != nullptr; @@ -278,7 +278,7 @@ bool CreatureAI::_EnterEvadeMode(EvadeReason /*why*/) me->ResetPlayerDamageReq(); me->SetLastDamagedTime(0); me->SetCannotReachTarget(false); - me->DoNotReacquireTarget(); + me->DoNotReacquireSpellFocusTarget(); if (me->IsInEvadeMode()) return false; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 95d0449089..f066a019fa 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -207,7 +207,7 @@ m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_boundaryCheckTi m_defaultMovementType(IDLE_MOTION_TYPE), m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_cannotReachTarget(false), m_cannotReachTimer(0), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), _waypointPathId(0), _currentWaypointNodeInfo(0, 0), -m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(false), m_focusSpell(nullptr), m_focusDelay(0), m_shouldReacquireTarget(false), m_suppressedOrientation(0.0f) +m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(false) { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; @@ -688,21 +688,12 @@ void Creature::Update(uint32 diff) if (!IsAlive()) break; - if (m_shouldReacquireTarget && !IsFocusing(nullptr, true)) + if (_spellFocusInfo.delay) { - SetTarget(m_suppressedTarget); - - if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) - { - if (m_suppressedTarget) - { - if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget)) - SetFacingToObject(objTarget, false); - } - else - SetFacingTo(m_suppressedOrientation, false); - } - m_shouldReacquireTarget = false; + if (_spellFocusInfo.delay <= diff) + ReacquireSpellFocusTarget(); + else + _spellFocusInfo.delay -= diff; } // if creature is charmed, switch to charmed AI (and back) @@ -1859,9 +1850,9 @@ void Creature::setDeathState(DeathState s) else if (!m_respawnCompatibilityMode) SaveRespawnTime(0, false); - ReleaseFocus(nullptr, false); // remove spellcast focus - DoNotReacquireTarget(); // cancel delayed re-target - SetTarget(ObjectGuid::Empty); // drop target - dead mobs shouldn't ever target things + ReleaseSpellFocus(nullptr, false); // remove spellcast focus + DoNotReacquireSpellFocusTarget(); // cancel delayed re-target + SetTarget(ObjectGuid::Empty); // drop target - dead mobs shouldn't ever target things SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); @@ -2952,16 +2943,16 @@ void Creature::SetDisplayId(uint32 modelId) void Creature::SetTarget(ObjectGuid guid) { - if (IsFocusing(nullptr, true)) - m_suppressedTarget = guid; + if (HasSpellFocus()) + _spellFocusInfo.target = guid; else SetGuidValue(UNIT_FIELD_TARGET, guid); } -void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) +void Creature::SetSpellFocus(Spell const* focusSpell, WorldObject const* target) { // already focused - if (m_focusSpell) + if (_spellFocusInfo.spell) return; // Prevent dead/feigning death creatures from setting a focus target, so they won't turn @@ -2986,14 +2977,17 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) return; // store pre-cast values for target and orientation (used to later restore) - if (!IsFocusing(nullptr, true)) + if (!_spellFocusInfo.delay) { // only overwrite these fields if we aren't transitioning from one spell focus to another - m_suppressedTarget = GetGuidValue(UNIT_FIELD_TARGET); - m_suppressedOrientation = GetOrientation(); + _spellFocusInfo.target = GetGuidValue(UNIT_FIELD_TARGET); + _spellFocusInfo.orientation = GetOrientation(); } + else // don't automatically reacquire target for the previous spellcast + _spellFocusInfo.delay = 0; - m_focusSpell = focusSpell; + _spellFocusInfo.spell = focusSpell; + bool const noTurnDuringCast = spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST); // set target, then force send update packet to players if it changed to provide appropriate facing ObjectGuid newTarget = target ? target->GetGUID() : ObjectGuid::Empty; if (GetGuidValue(UNIT_FIELD_TARGET) != newTarget) @@ -3006,7 +3000,7 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) spellInfo->SpellVisual[1] ) && ( !focusSpell->GetCastTime() || // if the spell is instant cast - spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST) // client gets confused if we attempt to turn at the regularly scheduled update packet + noTurnDuringCast // client gets confused if we attempt to turn at the regularly scheduled update packet ) ) { @@ -3021,8 +3015,6 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) } } - bool const noTurnDuringCast = spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST); - if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) { // Face the target - we need to do this before the unit state is modified for no-turn spells @@ -3037,61 +3029,65 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) AddUnitState(UNIT_STATE_FOCUSING); } -bool Creature::IsFocusing(Spell const* focusSpell, bool withDelay) +bool Creature::HasSpellFocus(Spell const* focusSpell) const { if (!IsAlive()) // dead creatures cannot focus { - ReleaseFocus(nullptr, false); - return false; - } - - if (focusSpell && (focusSpell != m_focusSpell)) - return false; - - if (!m_focusSpell) - { - if (!withDelay || !m_focusDelay) - return false; - if (GetMSTimeDiffToNow(m_focusDelay) > 1000) // @todo figure out if we can get rid of this magic number somehow + if (_spellFocusInfo.spell || _spellFocusInfo.delay) { - m_focusDelay = 0; // save checks in the future - return false; + TC_LOG_WARN("entities.unit", "Creature '%s' (entry %u) has spell focus (spell id %u, delay %ums) despite being dead.", + GetName().c_str(), GetEntry(), _spellFocusInfo.spell ? _spellFocusInfo.spell->GetSpellInfo()->Id : 0, _spellFocusInfo.delay); } + return false; } - return true; + if (focusSpell) + return (focusSpell == _spellFocusInfo.spell); + else + return (_spellFocusInfo.spell || _spellFocusInfo.delay); } -void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay) +void Creature::ReleaseSpellFocus(Spell const* focusSpell, bool withDelay) { - if (!m_focusSpell) + if (!_spellFocusInfo.spell) return; // focused to something else - if (focusSpell && focusSpell != m_focusSpell) + if (focusSpell && focusSpell != _spellFocusInfo.spell) return; - if (IsPet() && !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) // player pets do not use delay system + if (_spellFocusInfo.spell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST)) + ClearUnitState(UNIT_STATE_FOCUSING); + + if (IsPet()) // player pets do not use delay system { - SetGuidValue(UNIT_FIELD_TARGET, m_suppressedTarget); - if (m_suppressedTarget) + if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) + ReacquireSpellFocusTarget(); + } + else // don't allow re-target right away to prevent visual bugs + _spellFocusInfo.delay = withDelay ? 1000 : 1; + + _spellFocusInfo.spell = nullptr; +} + +void Creature::ReacquireSpellFocusTarget() +{ + if (!HasSpellFocus()) + return; + + SetTarget(_spellFocusInfo.target); + + if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN) && !IsMovementPreventedByCasting()) + { + if (_spellFocusInfo.target) { - if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget)) + if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, _spellFocusInfo.target)) SetFacingToObject(objTarget, false); } else - SetFacingTo(m_suppressedOrientation, false); + SetFacingTo(_spellFocusInfo.orientation, false); } - else - // tell the creature that it should reacquire its actual target after the delay expires (this is handled in ::Update) - // player pets don't need to do this, as they automatically reacquire their target on focus release - MustReacquireTarget(); - - if (m_focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST)) - ClearUnitState(UNIT_STATE_FOCUSING); - - m_focusSpell = nullptr; - m_focusDelay = (!IsPet() && withDelay) ? GameTime::GetGameTimeMS() : 0; // don't allow re-target right away to prevent visual bugs + _spellFocusInfo.delay = 0; } bool Creature::IsMovementPreventedByCasting() const @@ -3104,7 +3100,7 @@ bool Creature::IsMovementPreventedByCasting() const return false; } - if (const_cast(this)->IsFocusing(nullptr, true)) + if (HasSpellFocus()) return true; if (HasUnitState(UNIT_STATE_CASTING)) diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 6358e08f3e..1c18e11870 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -327,11 +327,11 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma // Handling caster facing during spellcast void SetTarget(ObjectGuid guid) override; - void MustReacquireTarget() { m_shouldReacquireTarget = true; } // flags the Creature for forced (client displayed) target reacquisition in the next ::Update call - void DoNotReacquireTarget() { m_shouldReacquireTarget = false; m_suppressedTarget = ObjectGuid::Empty; SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty); m_suppressedOrientation = 0.0f; } - void FocusTarget(Spell const* focusSpell, WorldObject const* target); - bool IsFocusing(Spell const* focusSpell = nullptr, bool withDelay = false) override; - void ReleaseFocus(Spell const* focusSpell = nullptr, bool withDelay = true); + void ReacquireSpellFocusTarget(); + void DoNotReacquireSpellFocusTarget() { _spellFocusInfo.delay = 0; } + void SetSpellFocus(Spell const* focusSpell, WorldObject const* target); + bool HasSpellFocus(Spell const* focusSpell = nullptr) const override; + void ReleaseSpellFocus(Spell const* focusSpell = nullptr, bool withDelay = true); bool IsMovementPreventedByCasting() const override; @@ -416,11 +416,13 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma bool m_respawnCompatibilityMode; /* Spell focus system */ - Spell const* m_focusSpell; // Locks the target during spell cast for proper facing - uint32 m_focusDelay; - bool m_shouldReacquireTarget; - ObjectGuid m_suppressedTarget; // Stores the creature's "real" target while casting - float m_suppressedOrientation; // Stores the creature's "real" orientation while casting + struct + { + Spell const* spell = nullptr; + uint32 delay = 0; // ms until the creature's target should snap back (0 = no snapback scheduled) + ObjectGuid target; // the creature's "real" target while casting + float orientation = 0.0f; // the creature's "real" orientation while casting + } _spellFocusInfo; CreatureTextRepeatGroup m_textRepeat; }; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 88219c7a5c..c76da7a274 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3247,7 +3247,7 @@ bool Unit::IsMovementPreventedByCasting() const if (spell->GetSpellInfo()->IsMoveAllowedChannel()) return false; - if (const_cast(this)->IsFocusing(nullptr, true)) + if (const_cast(this)->HasSpellFocus()) return false; // prohibit movement for all other spell casts @@ -9427,7 +9427,7 @@ Unit* Creature::SelectVictim() if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target)) { - if (!IsFocusing()) + if (!HasSpellFocus()) SetInFront(target); return target; } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 70329103fb..79b55c5dc1 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1587,7 +1587,7 @@ class TC_GAME_API Unit : public WorldObject int32 GetCurrentSpellCastTime(uint32 spell_id) const; SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const; - virtual bool IsFocusing(Spell const* /*focusSpell*/ = nullptr, bool /*withDelay*/ = false) { return false; } + virtual bool HasSpellFocus(Spell const* /*focusSpell*/ = nullptr) const { return false; } virtual bool IsMovementPreventedByCasting() const; SpellHistory* GetSpellHistory() { return m_spellHistory; } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3196ed1902..4b7bd13212 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3158,11 +3158,11 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered if (!(m_spellInfo->IsNextMeleeSwingSpell() || IsAutoRepeat())) { if (m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget()) - m_caster->ToCreature()->FocusTarget(this, m_targets.GetObjectTarget()); + m_caster->ToCreature()->SetSpellFocus(this, m_targets.GetObjectTarget()); else if (m_spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST) && !m_spellInfo->HasAttribute(SPELL_ATTR1_CHANNEL_TRACK_TARGET)) - m_caster->ToCreature()->FocusTarget(this, nullptr); + m_caster->ToCreature()->SetSpellFocus(this, nullptr); else - m_caster->ToCreature()->FocusTarget(this, nullptr); + m_caster->ToCreature()->SetSpellFocus(this, nullptr); } } @@ -3466,7 +3466,7 @@ void Spell::_cast(bool skipCheck) if (!m_spellInfo->IsChanneled()) if (Creature* creatureCaster = m_caster->ToCreature()) - creatureCaster->ReleaseFocus(this); + creatureCaster->ReleaseSpellFocus(this); // Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells if ((m_spellInfo->Speed > 0.0f && !m_spellInfo->IsChanneled()) || m_spellInfo->HasAttribute(SPELL_ATTR4_UNK4)) @@ -3860,7 +3860,7 @@ void Spell::finish(bool ok) } if (Creature* creatureCaster = m_caster->ToCreature()) - creatureCaster->ReleaseFocus(this); + creatureCaster->ReleaseSpellFocus(this); if (!ok) return; @@ -4735,8 +4735,8 @@ void Spell::SendChannelStart(uint32 duration) if (channelTarget != m_caster->GetGUID()) if (Creature* creatureCaster = m_caster->ToCreature()) - if (!creatureCaster->IsFocusing(this)) - creatureCaster->FocusTarget(this, ObjectAccessor::GetWorldObject(*creatureCaster, channelTarget)); + if (!creatureCaster->HasSpellFocus(this)) + creatureCaster->SetSpellFocus(this, ObjectAccessor::GetWorldObject(*creatureCaster, channelTarget)); } m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingDescent/boss_magmaw.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingDescent/boss_magmaw.cpp index 8a8a6f9108..33d6635f57 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingDescent/boss_magmaw.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingDescent/boss_magmaw.cpp @@ -438,7 +438,7 @@ struct boss_magmaw : public BossAI { me->AttackStop(); me->SetReactState(REACT_PASSIVE); - me->ReleaseFocus(nullptr, false); + me->ReleaseSpellFocus(nullptr, false); me->SetFacingToObject(stalker, true); events.ScheduleEvent(EVENT_MASSIVE_CRASH, 5s); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.cpp index b149436d68..9788742e92 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.cpp @@ -359,7 +359,7 @@ struct npc_zulgurub_tiki_lord_mu_loa : public ScriptedAI { _EnterEvadeMode(); _events.Reset(); - me->ReleaseFocus(nullptr, false); + me->ReleaseSpellFocus(nullptr, false); me->GetMotionMaster()->MoveTargetedHome(); } diff --git a/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/boss_conclave_of_wind.cpp b/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/boss_conclave_of_wind.cpp index adb8b78576..de0e4bea41 100644 --- a/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/boss_conclave_of_wind.cpp +++ b/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/boss_conclave_of_wind.cpp @@ -1020,7 +1020,7 @@ struct npc_conclave_of_wind_ravenous_creeper : public ScriptedAI { me->SetLastDamagedTime(0); me->SetCannotReachTarget(false); - me->DoNotReacquireTarget(); + me->DoNotReacquireSpellFocusTarget(); me->GetMotionMaster()->MoveTargetedHome(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 886f1b35a3..59d08c9942 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -1343,7 +1343,7 @@ class npc_the_lich_king_escape_hor : public CreatureScript if (!me->HasReactState(REACT_PASSIVE)) { if (Unit* victim = me->SelectVictim()) - if (!me->IsFocusing(nullptr, true) && victim != me->GetVictim()) + if (!me->HasSpellFocus() && victim != me->GetVictim()) AttackStart(victim); return me->GetVictim() != nullptr; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 70015eb2e2..b931df98af 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -633,7 +633,7 @@ protected: if (!me->HasReactState(REACT_PASSIVE)) { if (Unit* victim = me->SelectVictim()) - if (!me->IsFocusing(nullptr, true) && victim != me->GetVictim()) + if (!me->HasSpellFocus() && victim != me->GetVictim()) AttackStart(victim); return me->GetVictim() != nullptr; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index 3eb9861b54..97601242e7 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -1814,7 +1814,7 @@ class spell_thorim_lightning_charge : public SpellScriptLoader { /// @workaround: focus target is not working because spell is triggered and instant if (Creature* creature = GetCaster()->ToCreature()) - creature->FocusTarget(GetSpell(), GetExplTargetWorldObject()); + creature->SetSpellFocus(GetSpell(), GetExplTargetWorldObject()); } void HandleCharge()