Core/Auras: Rename many old aura types to their new meaning

Port From (https://github.com/TrinityCore/TrinityCore/commit/bd7c714c97beb04eb815b0aa175badfb6933ccf1)
This commit is contained in:
hondacrx
2021-02-22 15:05:41 -05:00
parent 76a351e7de
commit 7ae358bd71
8 changed files with 62 additions and 233 deletions
+1 -7
View File
@@ -6592,10 +6592,7 @@ namespace Game.Entities
sbyte comboPoints = spell != null ? spell.m_comboPointGain : (sbyte)GetPower(PowerType.ComboPoints);
// without combo points lost (duration checked in aura)
RemoveAurasByType(AuraType.RetainComboPoints);
comboPoints += (sbyte)count;
comboPoints += count;
if (comboPoints > 5)
comboPoints = 5;
@@ -6624,9 +6621,6 @@ namespace Game.Entities
}
public void ClearComboPoints()
{
// without combopoints lost (duration checked in aura)
RemoveAurasByType(AuraType.RetainComboPoints);
SetPower(PowerType.ComboPoints, 0);
}
public byte GetComboPoints() { return (byte)GetPower(PowerType.ComboPoints); }
+1 -12
View File
@@ -1232,9 +1232,7 @@ namespace Game.Entities
if (CanDualWield() || offhand.GetTemplate().GetFlags3().HasAnyFlag(ItemFlags3.AlwaysAllowDualWield))
UpdateDamagePhysical(WeaponAttackType.OffAttack);
if (HasAuraType(AuraType.ModSpellDamageOfAttackPower) ||
HasAuraType(AuraType.ModSpellHealingOfAttackPower) ||
HasAuraType(AuraType.OverrideSpellPowerByApPct))
if (HasAuraType(AuraType.OverrideSpellPowerByApPct))
UpdateSpellDamageAndHealingBonus();
if (pet != null && pet.IsPetGhoul()) // At melee attack power change for DK pet
@@ -1253,15 +1251,6 @@ namespace Game.Entities
float baseValue = value;
value *= GetPctModifierValue(unitMod, UnitModifierPctType.Base); // armor percent from items
value += GetFlatModifierValue(unitMod, UnitModifierFlatType.Total);
//add dynamic flat mods
var mResbyIntellect = GetAuraEffectsByType(AuraType.ModResistanceOfStatPercent);
foreach (var i in mResbyIntellect)
{
if (Convert.ToBoolean(i.GetMiscValue() & (int)SpellSchoolMask.Normal))
value += MathFunctions.CalculatePct(GetStat((Stats)i.GetMiscValueB()), i.GetAmount());
}
value *= GetPctModifierValue(unitMod, UnitModifierPctType.Total);
SetArmor((int)baseValue, (int)(value - baseValue));
-11
View File
@@ -2474,17 +2474,6 @@ namespace Game.Entities
// Ignore Absorption Auras
float auraAbsorbMod = GetMaxPositiveAuraModifierByMiscMask(AuraType.ModTargetAbsorbSchool, (uint)damageInfo.GetSchoolMask());
auraAbsorbMod = Math.Max(auraAbsorbMod, (float)GetMaxPositiveAuraModifier(AuraType.ModTargetAbilityAbsorbSchool, aurEff =>
{
if (!Convert.ToBoolean(aurEff.GetMiscValue() & (int)damageInfo.GetSchoolMask()))
return false;
if (!aurEff.IsAffectingSpell(damageInfo.GetSpellInfo()))
return false;
return true;
}));
MathFunctions.RoundToInterval(ref auraAbsorbMod, 0.0f, 100.0f);
int absorbIgnoringDamage = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), auraAbsorbMod);
-9
View File
@@ -78,9 +78,6 @@ namespace Game.Entities
DoneAdvertisedBenefit += (int)MathFunctions.CalculatePct(GetStat(usedStat), eff.GetAmount());
}
}
// ... and attack power
DoneAdvertisedBenefit += (int)MathFunctions.CalculatePct(GetTotalAttackPowerValue(WeaponAttackType.BaseAttack), GetTotalAuraModifierByMiscMask(AuraType.ModSpellDamageOfAttackPower, (int)schoolMask));
}
return DoneAdvertisedBenefit;
}
@@ -383,12 +380,6 @@ namespace Game.Entities
Stats usedStat = (Stats)(i.GetSpellEffectInfo().MiscValue);
advertisedBenefit += (uint)MathFunctions.CalculatePct(GetStat(usedStat), i.GetAmount());
}
// ... and attack power
var mHealingDonebyAP = GetAuraEffectsByType(AuraType.ModSpellHealingOfAttackPower);
foreach (var i in mHealingDonebyAP)
if (Convert.ToBoolean(i.GetMiscValue() & (int)schoolMask))
advertisedBenefit += (uint)MathFunctions.CalculatePct(GetTotalAttackPowerValue(WeaponAttackType.BaseAttack), i.GetAmount());
}
return advertisedBenefit;
}
-5
View File
@@ -1034,11 +1034,6 @@ namespace Game.Spells
modOwner.ApplySpellMod(GetId(), SpellModOp.ResistDispelChance, ref resistChance);
}
// Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
// Only affects offensive dispels
if (offensive && auraTarget != null)
resistChance += auraTarget.GetTotalAuraModifier(AuraType.ModDispelResist);
resistChance = resistChance < 0 ? 0 : resistChance;
resistChance = resistChance > 100 ? 100 : resistChance;
return 100 - resistChance;
+11 -127
View File
@@ -957,43 +957,6 @@ namespace Game.Spells
#endregion
#region AuraEffect Handlers
[AuraEffectHandler(AuraType.None)]
[AuraEffectHandler(AuraType.Unk46)]
[AuraEffectHandler(AuraType.Unk48)]
[AuraEffectHandler(AuraType.PetDamageMulti)]
[AuraEffectHandler(AuraType.ModCriticalThreat)]
[AuraEffectHandler(AuraType.ModCooldown)]
[AuraEffectHandler(AuraType.Unk214)]
[AuraEffectHandler(AuraType.ModDetaunt)]
[AuraEffectHandler(AuraType.ModSpellDamageFromHealing)]
[AuraEffectHandler(AuraType.ModTargetResistBySpellClass)]
[AuraEffectHandler(AuraType.ModDamageDoneForMechanic)]
[AuraEffectHandler(AuraType.BlockSpellFamily)]
[AuraEffectHandler(AuraType.Strangulate)]
[AuraEffectHandler(AuraType.ModCritChanceForCaster)]
[AuraEffectHandler(AuraType.Unk311)]
[AuraEffectHandler(AuraType.AnimReplacementSet)]
[AuraEffectHandler(AuraType.ModSpellPowerPct)]
[AuraEffectHandler(AuraType.OverrideUnlockedAzeriteEssenceRank)]
[AuraEffectHandler(AuraType.ModBlind)]
[AuraEffectHandler(AuraType.Unk335)]
[AuraEffectHandler(AuraType.MountRestrictions)]
[AuraEffectHandler(AuraType.ModResurrectedHealthByGuildMember)]
[AuraEffectHandler(AuraType.ModSpellCooldownByHaste)]
[AuraEffectHandler(AuraType.ModGatheringItemsGainedPercent)]
[AuraEffectHandler(AuraType.Unk351)]
[AuraEffectHandler(AuraType.Unk352)]
[AuraEffectHandler(AuraType.ModCamouflage)]
[AuraEffectHandler(AuraType.Unk354)]
[AuraEffectHandler(AuraType.EnableBoss1UnitFrame)]
[AuraEffectHandler(AuraType.WorgenAlteredForm)]
[AuraEffectHandler(AuraType.ProcTriggerSpellCopy)]
[AuraEffectHandler(AuraType.OverrideAutoattackWithMeleeSpell)]
[AuraEffectHandler(AuraType.ModNextSpell)]
[AuraEffectHandler(AuraType.MaxFarClipPlane)]
[AuraEffectHandler(AuraType.EnablePowerBarTimer)]
void HandleUnused(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) { }
/**************************************/
/*** VISIBILITY & PHASES ***/
/**************************************/
@@ -1949,7 +1912,7 @@ namespace Game.Spells
HandleAuraModSilence(aurApp, mode, apply);
}
[AuraEffectHandler(AuraType.AllowOnlyAbility)]
[AuraEffectHandler(AuraType.DisableCastingExceptAbilities)]
void HandleAuraAllowOnlyAbility(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag(AuraEffectHandleModes.SendForClientMask))
@@ -1963,7 +1926,7 @@ namespace Game.Spells
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target.HasAuraType(AuraType.AllowOnlyAbility))
if (target.HasAuraType(AuraType.DisableCastingExceptAbilities))
return;
target.RemovePlayerFlag(PlayerFlags.AllowOnlyAbility);
}
@@ -3135,38 +3098,6 @@ namespace Game.Spells
target.ToPlayer().UpdateSpellDamageAndHealingBonus();
}
[AuraEffectHandler(AuraType.ModSpellDamageOfAttackPower)]
void HandleModSpellDamagePercentFromAttackPower(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag((AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat)))
return;
Unit target = aurApp.GetTarget();
if (!target.IsTypeId(TypeId.Player))
return;
// Magic damage modifiers implemented in Unit.SpellDamageBonus
// This information for client side use only
// Recalculate bonus
target.ToPlayer().UpdateSpellDamageAndHealingBonus();
}
[AuraEffectHandler(AuraType.ModSpellHealingOfAttackPower)]
void HandleModSpellHealingPercentFromAttackPower(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag((AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat)))
return;
Unit target = aurApp.GetTarget();
if (!target.IsTypeId(TypeId.Player))
return;
// Recalculate bonus
target.ToPlayer().UpdateSpellDamageAndHealingBonus();
}
[AuraEffectHandler(AuraType.ModHealingDone)]
void HandleModHealingDone(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
@@ -3237,29 +3168,6 @@ namespace Game.Spells
target.SetHealth(Math.Max(MathFunctions.CalculatePct(target.GetMaxHealth(), healthPct), (zeroHealth ? 0 : 1ul)));
}
[AuraEffectHandler(AuraType.ModResistanceOfStatPercent)]
void HandleAuraModResistenceOfStatPercent(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag((AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat)))
return;
Unit target = aurApp.GetTarget();
if (!target.IsTypeId(TypeId.Player))
return;
if (GetMiscValue() != (int)SpellSchoolMask.Normal)
{
// support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
// and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
Log.outError(LogFilter.Spells, "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
return;
}
// Recalculate Armor
target.UpdateArmor();
}
[AuraEffectHandler(AuraType.ModExpertise)]
void HandleAuraModExpertise(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
@@ -3389,21 +3297,6 @@ namespace Game.Spells
HandleModPowerRegen(aurApp, mode, apply);
}
[AuraEffectHandler(AuraType.ModManaRegenFromStat)]
void HandleModManaRegen(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag((AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat)))
return;
Unit target = aurApp.GetTarget();
if (!target.IsTypeId(TypeId.Player))
return;
//Note: an increase in regen does NOT cause threat.
target.ToPlayer().UpdateManaRegen();
}
[AuraEffectHandler(AuraType.ModManaRegenPct)]
void HandleModManaRegenPct(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
@@ -3709,7 +3602,15 @@ namespace Game.Spells
[AuraEffectHandler(AuraType.InterruptRegen)]
void HandleAuraModRegenInterrupt(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
HandleModManaRegen(aurApp, mode, apply);
if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat))
return;
Unit target = aurApp.GetTarget();
if (!target.IsPlayer())
return;
target.ToPlayer().UpdateManaRegen();
}
[AuraEffectHandler(AuraType.ModWeaponCritPercent)]
@@ -4194,23 +4095,6 @@ namespace Game.Spells
target.ToPlayer().SetNoRegentCostMask(mask);
}
[AuraEffectHandler(AuraType.RetainComboPoints)]
void HandleAuraRetainComboPoints(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag(AuraEffectHandleModes.Real))
return;
Unit target = aurApp.GetTarget();
if (!target.IsTypeId(TypeId.Player))
return;
// combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
// remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
if (!apply && aurApp.GetRemoveMode() == AuraRemoveMode.Expire)
target.ToPlayer().AddComboPoints((sbyte)-GetAmount());
}
/*********************************************************/
/*** OTHERS ***/
/*********************************************************/
+3 -16
View File
@@ -3286,17 +3286,7 @@ namespace Game.Spells
if (IsAutoActionResetSpell())
{
bool found = false;
var vIgnoreReset = m_caster.GetAuraEffectsByType(AuraType.IgnoreMeleeReset);
foreach (var i in vIgnoreReset)
{
if (i.IsAffectingSpell(m_spellInfo))
{
found = true;
break;
}
}
if (!found && !m_spellInfo.HasAttribute(SpellAttr2.NotResetAutoActions))
if (!m_spellInfo.HasAttribute(SpellAttr2.NotResetAutoActions))
{
m_caster.ResetAttackTimer(WeaponAttackType.BaseAttack);
if (m_caster.HaveOffhandWeapon())
@@ -4533,9 +4523,6 @@ namespace Game.Spells
}
}
if (m_caster.HasAuraTypeWithMiscvalue(AuraType.BlockSpellFamily, (int)m_spellInfo.SpellFamilyName))
return SpellCastResult.SpellUnavailable;
bool reqCombat = true;
var stateAuras = m_caster.GetAuraEffectsByType(AuraType.AbilityIgnoreAurastate);
foreach (var aura in stateAuras)
@@ -5645,7 +5632,7 @@ namespace Game.Spells
bool CheckSpellCancelsStun(ref uint param1)
{
return CheckSpellCancelsAuraEffect(AuraType.ModStun, ref param1) &&
CheckSpellCancelsAuraEffect(AuraType.Strangulate, ref param1);
CheckSpellCancelsAuraEffect(AuraType.ModStunDisableGravity, ref param1);
}
bool CheckSpellCancelsSilence(ref uint param1)
@@ -7232,7 +7219,7 @@ namespace Game.Spells
m_spellInfo.HasAttribute(SpellAttr0.ReqAmmo) || m_spellInfo.HasAttribute(SpellAttr0.Ability);
// Apply haste rating
if (gcd > 750 && ((m_spellInfo.StartRecoveryCategory == 133 && !isMeleeOrRangedSpell) || m_caster.HasAuraTypeWithAffectMask(AuraType.ModGlobalCooldownByHaste, m_spellInfo)))
if (gcd > 750 && (m_spellInfo.StartRecoveryCategory == 133 && !isMeleeOrRangedSpell))
{
gcd = (int)(gcd * m_caster.m_unitData.ModSpellHaste);
MathFunctions.RoundToInterval(ref gcd, 750, 1500);