diff options
author | xinef1 <w.szyszko2@gmail.com> | 2017-04-27 08:34:43 +0200 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2020-04-28 14:49:14 +0200 |
commit | 9842ca3f4a843e97815512e84e9860737ab5db21 (patch) | |
tree | 7bd2f15b89da7674196a95f3c82766884f4ce5e2 /src | |
parent | 3c2882c29d8ed8b9012b6c59662f68b0237249e2 (diff) |
Core/Spells: Corrected aura SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK handling for auras with very high values (#19054)
(cherry picked from commit e30e11d4c74872c6de87df831696aa643321f6d9)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 11 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 4 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 28 |
3 files changed, 38 insertions, 5 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f15294e8054..3fad48d4e6d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -285,12 +285,12 @@ SpellNonMeleeDamage::SpellNonMeleeDamage(Unit* _attacker, Unit* _target, uint32 } Unit::Unit(bool isWorldObject) : - WorldObject(isWorldObject), m_playerMovingMe(NULL), m_lastSanctuaryTime(0), + WorldObject(isWorldObject), m_playerMovingMe(nullptr), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(), m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), - i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0), + i_AI(nullptr), i_disabledAI(nullptr), m_AutoRepeatFirstCast(false), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), - m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), + m_vehicle(nullptr), m_vehicleKit(nullptr), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this), _aiAnimKitId(0), _movementAnimKitId(0), _meleeAnimKitId(0), _spellHistory(new SpellHistory(this)) { @@ -389,10 +389,11 @@ Unit::Unit(bool isWorldObject) : m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); - _lastLiquid = NULL; + _lastLiquid = nullptr; _oldFactionId = 0; _isWalkingBeforeCharm = false; + _instantCast = false; } //////////////////////////////////////////////////////////// @@ -9158,7 +9159,7 @@ void Unit::ModSpellCastTime(SpellInfo const* spellInfo, int32 & castTime, Spell* if (!(spellInfo->HasAttribute(SPELL_ATTR0_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) || spellInfo->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) && ((GetTypeId() == TYPEID_PLAYER && spellInfo->SpellFamilyName) || GetTypeId() == TYPEID_UNIT)) - castTime = int32(float(castTime) * m_unitData->ModCastingSpeed); + castTime = CanInstantCast() ? 0 : int32(float(castTime) * m_unitData->ModCastingSpeed); else if (spellInfo->HasAttribute(SPELL_ATTR0_REQ_AMMO) && !spellInfo->HasAttribute(SPELL_ATTR2_AUTOREPEAT_FLAG)) castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]); else if (IsPartOfSkillLine(SKILL_COOKING, spellInfo->Id) && HasAura(67556)) // cooking with Chef Hat. diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index c61146e063b..7d5f47ebb04 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1999,6 +1999,9 @@ class TC_GAME_API Unit : public WorldObject ObjectGuid GetTarget() const { return m_unitData->Target; } virtual void SetTarget(ObjectGuid const& /*guid*/) = 0; + void SetInstantCast(bool set) { _instantCast = set; } + bool CanInstantCast() const { return _instantCast; } + // Movement info Movement::MoveSpline * movespline; @@ -2151,6 +2154,7 @@ class TC_GAME_API Unit : public WorldObject bool m_cleanupDone; // lock made to not add stuff after cleanup before delete bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world + bool _instantCast; uint32 _oldFactionId; ///< faction before charm bool _isWalkingBeforeCharm; ///< Are we walking before we were charmed? diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 566ecfd9df8..f43aaab35e3 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4072,6 +4072,34 @@ void AuraEffect::HandleModCastingSpeed(AuraApplication const* aurApp, uint8 mode Unit* target = aurApp->GetTarget(); + // Do not apply such auras in normal way + if (GetAmount() >= 1000) + { + if (apply) + target->SetInstantCast(true); + else + { + // only SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK can have this high amount + // it's some rare case that you have 2 auras like that, but just in case ;) + + bool remove = true; + Unit::AuraEffectList const& castingSpeedNotStack = target->GetAuraEffectsByType(SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK); + for (AuraEffect const* aurEff : castingSpeedNotStack) + { + if (aurEff != this && aurEff->GetAmount() >= 1000) + { + remove = false; + break; + } + } + + if (remove) + target->SetInstantCast(false); + } + + return; + } + target->ApplyCastTimePercentMod((float)GetAmount(), apply); } |