Core/Auras: Implemented SPELL_AURA_ADD_PCT_MODIFIER_BY_SPELL_LABEL and SPELL_AURA_ADD_FLAT_MODIFIER_BY_SPELL_LABEL

Port From (https://github.com/TrinityCore/TrinityCore/commit/ba4fa060d765a35507f1a73287504c3f2e440fdb)
This commit is contained in:
hondacrx
2021-10-17 09:11:00 -04:00
parent 68c4407840
commit 0b64c4a02e
8 changed files with 517 additions and 360 deletions
+35 -6
View File
@@ -259,14 +259,43 @@ namespace Game.Spells
case AuraType.AddPctModifier:
if (m_spellmod == null)
{
m_spellmod = new SpellModifier(GetBase());
m_spellmod.op = (SpellModOp)GetMiscValue();
SpellModifierByClassMask spellmod = new SpellModifierByClassMask(GetBase());
spellmod.op = (SpellModOp)GetMiscValue();
m_spellmod.type = GetAuraType() == AuraType.AddPctModifier ? SpellModType.Pct : SpellModType.Flat;
m_spellmod.spellId = GetId();
m_spellmod.mask = GetSpellEffectInfo().SpellClassMask;
spellmod.type = GetAuraType() == AuraType.AddPctModifier ? SpellModType.Pct : SpellModType.Flat;
spellmod.spellId = GetId();
spellmod.mask = GetSpellEffectInfo().SpellClassMask;
m_spellmod = spellmod;
}
m_spellmod.value = GetAmount();
(m_spellmod as SpellModifierByClassMask).value = GetAmount();
break;
case AuraType.AddFlatModifierBySpellLabel:
if (m_spellmod == null)
{
SpellFlatModifierByLabel spellmod = new SpellFlatModifierByLabel(GetBase());
spellmod.op = (SpellModOp)GetMiscValue();
spellmod.type = SpellModType.LabelFlat;
spellmod.spellId = GetId();
spellmod.value.ModIndex = GetMiscValue();
spellmod.value.LabelID = GetMiscValueB();
m_spellmod = spellmod;
}
(m_spellmod as SpellFlatModifierByLabel).value.ModifierValue = GetAmount();
break;
case AuraType.AddPctModifierBySpellLabel:
if (m_spellmod == null)
{
SpellPctModifierByLabel spellmod = new SpellPctModifierByLabel(GetBase());
spellmod.op = (SpellModOp)GetMiscValue();
spellmod.type = SpellModType.LabelPct;
spellmod.spellId = GetId();
spellmod.value.ModIndex = GetMiscValue();
spellmod.value.LabelID = GetMiscValueB();
m_spellmod = spellmod;
}
(m_spellmod as SpellPctModifierByLabel).value.ModifierValue = 1.0f + MathFunctions.CalculatePct(1.0f, GetAmount());
break;
default:
break;
+26 -4
View File
@@ -8129,20 +8129,42 @@ namespace Game.Spells
{
op = SpellModOp.HealingAndDamage;
type = SpellModType.Flat;
value = 0;
mask = new FlagArray128();
spellId = 0;
ownerAura = _ownerAura;
}
public SpellModOp op { get; set; }
public SpellModType type { get; set; }
public int value { get; set; }
public FlagArray128 mask { get; set; }
public uint spellId { get; set; }
public Aura ownerAura { get; set; }
}
public class SpellModifierByClassMask : SpellModifier
{
public SpellModifierByClassMask(Aura _ownerAura) : base(_ownerAura)
{
value = 0;
mask = new FlagArray128();
}
public int value;
public FlagArray128 mask;
}
public class SpellFlatModifierByLabel : SpellModifier
{
public SpellFlatModByLabel value = new();
public SpellFlatModifierByLabel(Aura _ownerAura) : base(_ownerAura) { }
}
class SpellPctModifierByLabel : SpellModifier
{
public SpellPctModByLabel value = new();
public SpellPctModifierByLabel(Aura _ownerAura) : base(_ownerAura) { }
}
public class WorldObjectSpellTargetCheck : ICheck<WorldObject>
{
internal WorldObject _caster;
+16 -3
View File
@@ -660,9 +660,22 @@ namespace Game.Spells
if (affectSpell == null)
return false;
// TEMP: dont use IsAffected - !familyName and !familyFlags are not valid options for spell mods
// TODO: investigate if the !familyName and !familyFlags conditions are even valid for all other (nonmod) uses of SpellInfo::IsAffected
return affectSpell.SpellFamilyName == SpellFamilyName && mod.mask & SpellFamilyFlags;
switch (mod.type)
{
case SpellModType.Flat:
case SpellModType.Pct:
// TEMP: dont use IsAffected - !familyName and !familyFlags are not valid options for spell mods
// TODO: investigate if the !familyName and !familyFlags conditions are even valid for all other (nonmod) uses of SpellInfo::IsAffected
return affectSpell.SpellFamilyName == SpellFamilyName && (mod as SpellModifierByClassMask).mask & SpellFamilyFlags;
case SpellModType.LabelFlat:
return HasLabel((uint)(mod as SpellFlatModifierByLabel).value.LabelID);
case SpellModType.LabelPct:
return HasLabel((uint)(mod as SpellPctModifierByLabel).value.LabelID);
default:
break;
}
return false;
}
public bool CanPierceImmuneAura(SpellInfo auraSpellInfo)
+2 -1
View File
@@ -1421,7 +1421,8 @@ namespace Game.Entities
if (!spellEffectInfo.IsAura())
continue;
if (spellEffectInfo.ApplyAuraName == AuraType.AddPctModifier || spellEffectInfo.ApplyAuraName == AuraType.AddFlatModifier)
if (spellEffectInfo.ApplyAuraName == AuraType.AddPctModifier || spellEffectInfo.ApplyAuraName == AuraType.AddFlatModifier
|| spellEffectInfo.ApplyAuraName == AuraType.AddPctModifierBySpellLabel || spellEffectInfo.ApplyAuraName == AuraType.AddFlatModifierBySpellLabel)
{
found = true;
break;