mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: Corrected aura SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK handling for auras with very high values (#19054)
(cherry picked from commit e30e11d4c7)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user