Core/Spells: Corrected aura SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK handling for auras with very high values
Port From (https://github.com/TrinityCore/TrinityCore/commit/9842ca3f4a843e97815512e84e9860737ab5db21)
This commit is contained in:
@@ -131,6 +131,7 @@ namespace Game.Entities
|
|||||||
uint m_transform;
|
uint m_transform;
|
||||||
bool m_cleanupDone; // lock made to not add stuff after cleanup before delete
|
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 m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world
|
||||||
|
bool _instantCast;
|
||||||
|
|
||||||
ushort _aiAnimKitId;
|
ushort _aiAnimKitId;
|
||||||
ushort _movementAnimKitId;
|
ushort _movementAnimKitId;
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ namespace Game.Entities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetInstantCast(bool set) { _instantCast = set; }
|
||||||
|
public bool CanInstantCast() { return _instantCast; }
|
||||||
|
|
||||||
// function uses real base points (typically value - 1)
|
// function uses real base points (typically value - 1)
|
||||||
public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, int? basePoints = null, uint castItemId = 0, int itemLevel = -1)
|
public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, int? basePoints = null, uint castItemId = 0, int itemLevel = -1)
|
||||||
{
|
{
|
||||||
@@ -1954,7 +1957,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (!(spellInfo.HasAttribute(SpellAttr0.Ability | SpellAttr0.Tradespell) || spellInfo.HasAttribute(SpellAttr3.NoDoneBonus))
|
if (!(spellInfo.HasAttribute(SpellAttr0.Ability | SpellAttr0.Tradespell) || spellInfo.HasAttribute(SpellAttr3.NoDoneBonus))
|
||||||
&& (IsTypeId(TypeId.Player) && spellInfo.SpellFamilyName != 0) || IsTypeId(TypeId.Unit))
|
&& (IsTypeId(TypeId.Player) && spellInfo.SpellFamilyName != 0) || IsTypeId(TypeId.Unit))
|
||||||
castTime = (int)(castTime * m_unitData.ModCastingSpeed);
|
castTime = CanInstantCast() ? 0 : (int)(castTime * m_unitData.ModCastingSpeed);
|
||||||
else if (spellInfo.HasAttribute(SpellAttr0.ReqAmmo) && !spellInfo.HasAttribute(SpellAttr2.AutorepeatFlag))
|
else if (spellInfo.HasAttribute(SpellAttr0.ReqAmmo) && !spellInfo.HasAttribute(SpellAttr2.AutorepeatFlag))
|
||||||
castTime = (int)(castTime * m_modAttackSpeedPct[(int)WeaponAttackType.RangedAttack]);
|
castTime = (int)(castTime * m_modAttackSpeedPct[(int)WeaponAttackType.RangedAttack]);
|
||||||
else if (Global.SpellMgr.IsPartOfSkillLine(SkillType.Cooking, spellInfo.Id) && HasAura(67556)) // cooking with Chef Hat.
|
else if (Global.SpellMgr.IsPartOfSkillLine(SkillType.Cooking, spellInfo.Id) && HasAura(67556)) // cooking with Chef Hat.
|
||||||
|
|||||||
@@ -3777,6 +3777,34 @@ namespace Game.Spells
|
|||||||
|
|
||||||
Unit target = aurApp.GetTarget();
|
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;
|
||||||
|
var castingSpeedNotStack = target.GetAuraEffectsByType(AuraType.ModCastingSpeedNotStack);
|
||||||
|
foreach (AuraEffect aurEff in castingSpeedNotStack)
|
||||||
|
{
|
||||||
|
if (aurEff != this && aurEff.GetAmount() >= 1000)
|
||||||
|
{
|
||||||
|
remove = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (remove)
|
||||||
|
target.SetInstantCast(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
target.ApplyCastTimePercentMod(GetAmount(), apply);
|
target.ApplyCastTimePercentMod(GetAmount(), apply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user