aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxinef1 <w.szyszko2@gmail.com>2017-04-27 08:34:43 +0200
committerariel- <ariel-@users.noreply.github.com>2017-04-27 03:34:43 -0300
commite30e11d4c74872c6de87df831696aa643321f6d9 (patch)
treee42179da03aaf8dcd17226e54aefd5b20891076b
parenta4aa95a5a39d75b9e38fe03aac57ceb7d9bba90f (diff)
Core/Spells: Corrected aura SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK handling for auras with very high values (#19054)
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp11
-rw-r--r--src/server/game/Entities/Unit/Unit.h4
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp28
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 3547ac558ce..9856d018388 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -263,12 +263,12 @@ SpellSchoolMask ProcEventInfo::GetSchoolMask() const
}
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), m_spellHistory(new SpellHistory(this))
{
m_objectType |= TYPEMASK_UNIT;
@@ -353,10 +353,11 @@ Unit::Unit(bool isWorldObject) :
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
- _lastLiquid = NULL;
+ _lastLiquid = nullptr;
_oldFactionId = 0;
_isWalkingBeforeCharm = false;
+ _instantCast = false;
}
////////////////////////////////////////////////////////////
@@ -9861,7 +9862,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) * GetFloatValue(UNIT_MOD_CAST_SPEED));
+ castTime = CanInstantCast() ? 0 : int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
else if (spellInfo->HasAttribute(SPELL_ATTR0_REQ_AMMO) && !spellInfo->HasAttribute(SPELL_ATTR2_AUTOREPEAT_FLAG))
castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
else if (spellInfo->SpellVisual[0] == 3881 && 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 4fefa55816d..3b139180d2f 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -2219,6 +2219,9 @@ class TC_GAME_API Unit : public WorldObject
ObjectGuid GetTarget() const { return GetGuidValue(UNIT_FIELD_TARGET); }
virtual void SetTarget(ObjectGuid /*guid*/) = 0;
+ void SetInstantCast(bool set) { _instantCast = set; }
+ bool CanInstantCast() const { return _instantCast; }
+
// Movement info
Movement::MoveSpline * movespline;
@@ -2349,6 +2352,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 d4ec0873f64..5ec98e85be8 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3911,6 +3911,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);
}