Core/Spell: SpellValueOverrides encapsulation

Port From (https://github.com/TrinityCore/TrinityCore/commit/5fbddef85f48f6b9140d025d7f2e14faae0af178)
This commit is contained in:
hondacrx
2021-06-22 18:43:40 -04:00
parent 046cd9f917
commit c51c4d443f
21 changed files with 74 additions and 66 deletions
+1 -2
View File
@@ -149,9 +149,8 @@ namespace Scripts.Spells.DeathKnight
if (!GetTarget().HasAura(SpellIds.VolatileShielding))
{
int bp = (int)(2 * absorbAmount * 100 / maxHealth);
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(absorbAmount, 2 * absorbAmount * 100 / maxHealth));
args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(absorbAmount, 2 * absorbAmount * 100 / maxHealth));
GetTarget().CastSpell(GetTarget(), SpellIds.RunicPowerEnergize, args);
}
}
+4 -1
View File
@@ -38,7 +38,10 @@ namespace Scripts.Spells.DemonHunter
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
{
PreventDefaultAction();
GetTarget().CastSpell(GetTarget(), SpellIds.ChaosStrikeEnergize, new CastSpellExtraArgs(TriggerCastFlags.FullMask).AddSpellMod(SpellValueMod.BasePoint0, aurEff.GetAmount()).SetTriggeringAura(aurEff));
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.AddSpellMod(SpellValueMod.BasePoint0, aurEff.GetAmount());
args.SetTriggeringAura(aurEff);
GetTarget().CastSpell(GetTarget(), SpellIds.ChaosStrikeEnergize, args);
}
public override void Register()
+5 -5
View File
@@ -786,7 +786,7 @@ namespace Scripts.Spells.Druid
return;
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()));
args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()));
GetTarget().CastSpell(eventInfo.GetProcTarget(), SpellIds.LivingSeedProc, args);
}
@@ -808,7 +808,7 @@ namespace Scripts.Spells.Druid
{
PreventDefaultAction();
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, aurEff.GetAmount());
args.AddSpellMod(SpellValueMod.BasePoint0, aurEff.GetAmount());
GetTarget().CastSpell(GetTarget(), SpellIds.LivingSeedHeal, args);
}
@@ -1187,7 +1187,7 @@ namespace Scripts.Spells.Druid
int amount = MathFunctions.CalculatePct(spellPowerCost.Amount, aurEff.GetAmount());
CastSpellExtraArgs args = new (aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, amount);
args.AddSpellMod(SpellValueMod.BasePoint0, amount);
caster.CastSpell((Unit)null, SpellIds.Exhilarate, args);
}
@@ -1244,7 +1244,7 @@ namespace Scripts.Spells.Druid
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.Languish, AuraType.PeriodicDamage);
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, amount);
args.AddSpellMod(SpellValueMod.BasePoint0, amount);
caster.CastSpell(target, SpellIds.Languish, args);
}
@@ -1327,7 +1327,7 @@ namespace Scripts.Spells.Druid
int amount = (int)eventInfo.GetHealInfo().GetHeal();
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)eventInfo.GetHealInfo().GetHeal());
args.AddSpellMod(SpellValueMod.BasePoint0, (int)eventInfo.GetHealInfo().GetHeal());
eventInfo.GetActor().CastSpell((Unit)null, SpellIds.RejuvenationT10Proc, args);
}
+4 -4
View File
@@ -753,7 +753,7 @@ namespace Scripts.Spells.Generic
Unit caster = eventInfo.GetActionTarget();
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, aurEff.GetAmount());
args.AddSpellMod(SpellValueMod.BasePoint0, aurEff.GetAmount());
caster.CastSpell(caster, SpellIds.BloodReserveHeal, args);
caster.RemoveAura(SpellIds.BloodReserveAura);
}
@@ -983,7 +983,7 @@ namespace Scripts.Spells.Generic
if (target)
{
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, basepoints0);
args.AddSpellMod(SpellValueMod.BasePoint0, basepoints0);
caster.CastSpell(target, SpellIds.ChaosBlast, args);
}
}
@@ -1728,7 +1728,7 @@ namespace Scripts.Spells.Generic
PreventDefaultAction();
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.MaxTargets, (int)aurEff.GetTickNumber() / 10 + 1);
args.AddSpellMod(SpellValueMod.MaxTargets, (int)aurEff.GetTickNumber() / 10 + 1);
GetTarget().CastSpell((Unit)null, GetSpellInfo().GetEffect(aurEff.GetEffIndex()).TriggerSpell, args);
}
@@ -2820,7 +2820,7 @@ namespace Scripts.Spells.Generic
Unit caster = eventInfo.GetActor();
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)damageInfo.GetDamage() / 2);
args.AddSpellMod(SpellValueMod.BasePoint0, (int)damageInfo.GetDamage() / 2);
caster.CastSpell(caster, SpellIds.VampiricTouchHeal, args);
}
+2 -2
View File
@@ -542,7 +542,7 @@ namespace Scripts.Spells.Holiday
case SpellIds.RamCanter:
{
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.AuraStack, 1);
args.AddSpellMod(SpellValueMod.AuraStack, 1);
target.CastSpell(target, SpellIds.RamFatigue, args);
if (aurEff.GetTickNumber() == 8)
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyYellow, true);
@@ -551,7 +551,7 @@ namespace Scripts.Spells.Holiday
case SpellIds.RamGallop:
{
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5 /*Hack*/);
args.AddSpellMod(SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5 /*Hack*/);
target.CastSpell(target, SpellIds.RamFatigue, args);
if (aurEff.GetTickNumber() == 8)
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyRed, true);
+3 -3
View File
@@ -118,7 +118,7 @@ namespace Scripts.Spells.Hunter
{
Unit caster = GetCaster();
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)caster.CountPctFromMaxHealth(30));
args.AddSpellMod(SpellValueMod.BasePoint0, (int)caster.CountPctFromMaxHealth(30));
caster.CastSpell(caster, SpellIds.PetLastStandTriggered, args);
}
@@ -262,7 +262,7 @@ namespace Scripts.Spells.Hunter
if (!caster.HasAura(SpellIds.PetHeartOfThePhoenixDebuff))
{
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, 100);
args.AddSpellMod(SpellValueMod.BasePoint0, 100);
owner.CastSpell(caster, SpellIds.PetHeartOfThePhoenixTriggered, args);
caster.CastSpell(caster, SpellIds.PetHeartOfThePhoenixDebuff, true);
}
@@ -300,7 +300,7 @@ namespace Scripts.Spells.Hunter
PreventDefaultAction();
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount()));
args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount()));
eventInfo.GetActor().CastSpell(GetCaster(), SpellIds.RoarOfSacrificeTriggered, args);
}
+8 -8
View File
@@ -597,7 +597,7 @@ namespace Scripts.Spells.Items
Unit caster = eventInfo.GetActionTarget();
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, amount);
args.AddSpellMod(SpellValueMod.BasePoint0, amount);
caster.CastSpell((Unit)null, spellId, args);
}
@@ -780,7 +780,7 @@ namespace Scripts.Spells.Items
else
{
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, absorb);
args.AddSpellMod(SpellValueMod.BasePoint0, absorb);
GetTarget().CastSpell(eventInfo.GetProcTarget(), SpellIds.ProtectionOfAncientKings, args);
}
}
@@ -833,7 +833,7 @@ namespace Scripts.Spells.Items
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.DeadlyPrecision, GetCastDifficulty());
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.AuraStack, (int)spellInfo.StackAmount);
args.AddSpellMod(SpellValueMod.AuraStack, (int)spellInfo.StackAmount);
GetCaster().CastSpell(GetCaster(), spellInfo.Id, args);
}
@@ -1198,7 +1198,7 @@ namespace Scripts.Spells.Items
Unit caster = eventInfo.GetActor();
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()));
args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()));
caster.CastSpell((Unit)null, SpellIds.Shadowmend, args);
}
@@ -1459,7 +1459,7 @@ namespace Scripts.Spells.Items
return;
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()));
args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()));
GetTarget().CastSpell((Unit)null, SpellIds.ItemNecroticTouchProc, args);
}
@@ -1587,7 +1587,7 @@ namespace Scripts.Spells.Items
return;
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, bp0);
args.AddSpellMod(SpellValueMod.BasePoint0, bp0);
caster.CastSpell(target, SpellIds.PersistentShieldTriggered, args);
}
@@ -1616,7 +1616,7 @@ namespace Scripts.Spells.Items
return;
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()));
args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()));
eventInfo.GetActor().CastSpell((Unit)null, SpellIds.HealthLink, args);
}
@@ -1947,7 +1947,7 @@ namespace Scripts.Spells.Items
Unit caster = eventInfo.GetActor();
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)caster.CountPctFromMaxHealth(aurEff.GetAmount()));
args.AddSpellMod(SpellValueMod.BasePoint0, (int)caster.CountPctFromMaxHealth(aurEff.GetAmount()));
caster.CastSpell((Unit)null, SpellIds.SwiftHandOfJusticeHeal, args);
}
+1 -1
View File
@@ -591,7 +591,7 @@ namespace Scripts.Spells.Mage
amount += (int)eventInfo.GetProcTarget().GetRemainingPeriodicAmount(eventInfo.GetActor().GetGUID(), SpellIds.Ignite, AuraType.PeriodicDamage);
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, amount);
args.AddSpellMod(SpellValueMod.BasePoint0, amount);
GetTarget().CastSpell(eventInfo.GetProcTarget(), SpellIds.Ignite, args);
}
+2 -2
View File
@@ -642,7 +642,7 @@ namespace Scripts.Spells.Paladin
if (!applications.Empty())
{
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)heal);
args.AddSpellMod(SpellValueMod.BasePoint0, (int)heal);
eventInfo.GetActor().CastSpell(applications[0].GetTarget(), SpellIds.BeaconOfLightHeal, args);
}
return;
@@ -823,7 +823,7 @@ namespace Scripts.Spells.Paladin
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.HolyMending, AuraType.PeriodicHeal);
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, amount);
args.AddSpellMod(SpellValueMod.BasePoint0, amount);
caster.CastSpell(target, SpellIds.HolyMending, args);
}
+6 -6
View File
@@ -98,7 +98,7 @@ namespace Scripts.Spells.Priest
return;
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(healInfo.GetHeal(), 10));
args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(healInfo.GetHeal(), 10));
caster.CastSpell(caster, SpellIds.OracularHeal, args);
}
@@ -267,7 +267,7 @@ namespace Scripts.Spells.Priest
// Remove the aura now, we don't want 40% healing bonus
Remove(AuraRemoveMode.EnemySpell);
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, healAmount);
args.AddSpellMod(SpellValueMod.BasePoint0, healAmount);
target.CastSpell(target, SpellIds.GuardianSpiritHeal, args);
absorbAmount = dmgInfo.GetDamage();
}
@@ -883,7 +883,7 @@ namespace Scripts.Spells.Priest
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.BlessedHealing, AuraType.PeriodicHeal);
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, amount);
args.AddSpellMod(SpellValueMod.BasePoint0, amount);
caster.CastSpell(target, SpellIds.BlessedHealing, args);
}
@@ -919,8 +919,8 @@ namespace Scripts.Spells.Priest
int teamHeal = selfHeal / 2;
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, teamHeal);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint1, selfHeal);
args.AddSpellMod(SpellValueMod.BasePoint0, teamHeal);
args.AddSpellMod(SpellValueMod.BasePoint1, selfHeal);
GetTarget().CastSpell((Unit)null, SpellIds.VampiricEmbraceHeal, args);
}
@@ -968,7 +968,7 @@ namespace Scripts.Spells.Priest
{
// backfire damage
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, aurEff.GetAmount() * 8);
args.AddSpellMod(SpellValueMod.BasePoint0, aurEff.GetAmount() * 8);
caster.CastSpell(target, SpellIds.VampiricTouchDispel, args);
}
}
+1 -1
View File
@@ -1655,7 +1655,7 @@ namespace Scripts.Spells.Quest
return;
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, 2);
args.AddSpellMod(SpellValueMod.BasePoint0, 2);
GetHitCreature().CastSpell(GetCaster(), SpellIds.RideGymer, args);
GetHitCreature().CastSpell(GetHitCreature(), SpellIds.Grabbed, true);
}
+3 -3
View File
@@ -910,7 +910,7 @@ namespace Scripts.Spells.Shaman
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.Electrified, AuraType.PeriodicDamage);
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, amount);
args.AddSpellMod(SpellValueMod.BasePoint0, amount);
caster.CastSpell(target, SpellIds.Electrified, args);
}
@@ -946,7 +946,7 @@ namespace Scripts.Spells.Shaman
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.LavaBurstBonusDamage, AuraType.PeriodicDamage);
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, amount);
args.AddSpellMod(SpellValueMod.BasePoint0, amount);
caster.CastSpell(target, SpellIds.LavaBurstBonusDamage, args);
}
@@ -1014,7 +1014,7 @@ namespace Scripts.Spells.Shaman
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.ChainedHeal, AuraType.PeriodicHeal);
CastSpellExtraArgs args = new(aurEff);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, amount);
args.AddSpellMod(SpellValueMod.BasePoint0, amount);
caster.CastSpell(target, SpellIds.ChainedHeal, args);
}
+1 -1
View File
@@ -312,7 +312,7 @@ namespace Scripts.Spells.Warrior
Unit target = eventInfo.GetActionTarget();
int bp0 = (int)MathFunctions.CalculatePct(target.GetMaxHealth(), GetSpellInfo().GetEffect(1).CalcValue());
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, bp0);
args.AddSpellMod(SpellValueMod.BasePoint0, bp0);
target.CastSpell((Unit)null, SpellIds.Stoicism, args);
}