Core/Spell: SpellValueOverrides encapsulation
Port From (https://github.com/TrinityCore/TrinityCore/commit/5fbddef85f48f6b9140d025d7f2e14faae0af178)
This commit is contained in:
@@ -1276,7 +1276,7 @@ namespace Game.Spells
|
||||
if (caster.HasAura(64760))
|
||||
{
|
||||
CastSpellExtraArgs args = new(GetEffect(0));
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, GetEffect(0).GetAmount());
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, GetEffect(0).GetAmount());
|
||||
caster.CastSpell(target, 64801, args);
|
||||
}
|
||||
}
|
||||
@@ -1331,7 +1331,7 @@ namespace Game.Spells
|
||||
{
|
||||
float multiplier = aurEff.GetAmount();
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, MathFunctions.CalculatePct(caster.GetMaxPower(PowerType.Mana), multiplier));
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, MathFunctions.CalculatePct(caster.GetMaxPower(PowerType.Mana), multiplier));
|
||||
caster.CastSpell(caster, 47755, args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4619,7 +4619,7 @@ namespace Game.Spells
|
||||
CastSpellExtraArgs args = new(this);
|
||||
|
||||
if (GetAmount() != 0) // If amount avalible cast with basepoints (Crypt Fever for example)
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, GetAmount());
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, GetAmount());
|
||||
|
||||
caster.CastSpell(target, triggeredSpellId, args);
|
||||
}
|
||||
@@ -4883,7 +4883,7 @@ namespace Game.Spells
|
||||
{
|
||||
CastSpellExtraArgs args = new(this);
|
||||
for (int i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0 + i, GetAmount());
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0 + i, GetAmount());
|
||||
|
||||
triggerCaster.CastSpell(target, triggerSpellId, args);
|
||||
Log.outDebug(LogFilter.Spells, "AuraEffect.HandlePeriodicTriggerSpellWithValueAuraTick: Spell {0} Trigger {1}", GetId(), triggeredSpellInfo.Id);
|
||||
@@ -5272,7 +5272,7 @@ namespace Game.Spells
|
||||
int feedAmount = MathFunctions.CalculatePct(gainedAmount, manaFeedVal);
|
||||
|
||||
CastSpellExtraArgs args = new(this);
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, feedAmount);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, feedAmount);
|
||||
caster.CastSpell(caster, 32554, args);
|
||||
}
|
||||
}
|
||||
@@ -5425,7 +5425,7 @@ namespace Game.Spells
|
||||
if (triggeredSpellInfo != null)
|
||||
{
|
||||
CastSpellExtraArgs args = new(this);
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, GetAmount());
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, GetAmount());
|
||||
triggerCaster.CastSpell(triggerTarget, triggerSpellId, args);
|
||||
Log.outDebug(LogFilter.Spells, "AuraEffect.HandleProcTriggerSpellWithValueAuraProc: Triggering spell {0} with value {1} from aura {2} proc", triggeredSpellInfo.Id, GetAmount(), GetId());
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ namespace Game.Spells
|
||||
// set basepoints for trigger with value effect
|
||||
if (effectInfo.Effect == SpellEffectName.TriggerSpellWithValue)
|
||||
for (int i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0 + i, damage);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0 + i, damage);
|
||||
|
||||
// original caster guid only for GO cast
|
||||
m_caster.CastSpell(targets, spellInfo.Id, args);
|
||||
@@ -435,7 +435,7 @@ namespace Game.Spells
|
||||
// set basepoints for trigger with value effect
|
||||
if (effectInfo.Effect == SpellEffectName.TriggerMissileSpellWithValue)
|
||||
for (int i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0 + i, damage);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0 + i, damage);
|
||||
|
||||
// original caster guid only for GO cast
|
||||
m_caster.CastSpell(targets, spellInfo.Id, args);
|
||||
@@ -474,7 +474,7 @@ namespace Game.Spells
|
||||
case 52349: // Overtake
|
||||
{
|
||||
CastSpellExtraArgs args1 = new(m_originalCasterGUID);
|
||||
args1.SpellValueOverrides.Add(SpellValueMod.BasePoint0, damage);
|
||||
args1.AddSpellMod(SpellValueMod.BasePoint0, damage);
|
||||
unitTarget.CastSpell(unitTarget, spellInfo.Id, args1);
|
||||
return;
|
||||
}
|
||||
@@ -492,7 +492,7 @@ namespace Game.Spells
|
||||
// set basepoints for trigger with value effect
|
||||
if (effectInfo.Effect == SpellEffectName.ForceCastWithValue)
|
||||
for (int i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0 + i, damage);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0 + i, damage);
|
||||
|
||||
unitTarget.CastSpell(m_caster, spellInfo.Id, args);
|
||||
}
|
||||
@@ -1746,7 +1746,7 @@ namespace Game.Spells
|
||||
|
||||
// if we have small value, it indicates seat position
|
||||
if (basePoints > 0 && basePoints < SharedConst.MaxVehicleSeats)
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, basePoints);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, basePoints);
|
||||
|
||||
m_originalCaster.CastSpell(summon, spellId, args);
|
||||
|
||||
@@ -3176,7 +3176,7 @@ namespace Game.Spells
|
||||
if (totem != null && totem.IsTotem())
|
||||
{
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, damage);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, damage);
|
||||
m_caster.CastSpell(totem, 55277, args);
|
||||
}
|
||||
}
|
||||
@@ -3571,12 +3571,8 @@ namespace Game.Spells
|
||||
|
||||
ExecuteLogEffectDestroyItem(effIndex, foodItem.GetEntry());
|
||||
|
||||
uint count = 1;
|
||||
player.DestroyItemCount(foodItem, ref count, true);
|
||||
// @todo fix crash when a spell has two effects, both pointed at the same item target
|
||||
|
||||
int pct;
|
||||
int levelDiff = (int)(pet.GetLevel() - foodItem.GetTemplate().GetBaseItemLevel());
|
||||
int levelDiff = (int)pet.GetLevel() - (int)foodItem.GetTemplate().GetBaseItemLevel();
|
||||
if (levelDiff >= 30)
|
||||
return;
|
||||
else if (levelDiff >= 20)
|
||||
@@ -3586,7 +3582,13 @@ namespace Game.Spells
|
||||
else
|
||||
pct = 50;
|
||||
|
||||
m_caster.CastSpell(pet, effectInfo.TriggerSpell, new CastSpellExtraArgs(SpellValueMod.BasePoint0, pct).SetTriggerFlags(TriggerCastFlags.FullMask));
|
||||
uint count = 1;
|
||||
player.DestroyItemCount(foodItem, ref count, true);
|
||||
// @todo fix crash when a spell has two effects, both pointed at the same item target
|
||||
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, pct);
|
||||
m_caster.CastSpell(pet, effectInfo.TriggerSpell, args);
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.DismissPet)]
|
||||
@@ -4272,7 +4274,7 @@ namespace Game.Spells
|
||||
if (mana != 0)
|
||||
{
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, mana);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, mana);
|
||||
m_caster.CastSpell(m_caster, 39104, args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user