fix: Adds name support for all mods (#1128)

This commit is contained in:
Kamron Batman 2022-10-15 10:46:31 -07:00 • committed by GitHub
parent b1cf95f810
commit ffdc08259f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 404 additions and 343 deletions

View file

@ -1242,31 +1242,29 @@ namespace Server.Spells
if (!ourTransform)
{
var mods = new List<ResistanceMod>();
if (transformSpell.PhysResistOffset != 0)
{
mods.Add(new ResistanceMod(ResistanceType.Physical, transformSpell.PhysResistOffset));
caster.AddResistanceMod(new ResistanceMod(ResistanceType.Physical, "TransformSpell", transformSpell.PhysResistOffset));
}
if (transformSpell.FireResistOffset != 0)
{
mods.Add(new ResistanceMod(ResistanceType.Fire, transformSpell.FireResistOffset));
caster.AddResistanceMod(new ResistanceMod(ResistanceType.Fire, "TransformSpell", transformSpell.FireResistOffset));
}
if (transformSpell.ColdResistOffset != 0)
{
mods.Add(new ResistanceMod(ResistanceType.Cold, transformSpell.ColdResistOffset));
caster.AddResistanceMod(new ResistanceMod(ResistanceType.Cold, "TransformSpell", transformSpell.ColdResistOffset));
}
if (transformSpell.PoisResistOffset != 0)
{
mods.Add(new ResistanceMod(ResistanceType.Poison, transformSpell.PoisResistOffset));
caster.AddResistanceMod(new ResistanceMod(ResistanceType.Poison, "TransformSpell", transformSpell.PoisResistOffset));
}
if (transformSpell.NrgyResistOffset != 0)
{
mods.Add(new ResistanceMod(ResistanceType.Energy, transformSpell.NrgyResistOffset));
caster.AddResistanceMod(new ResistanceMod(ResistanceType.Energy, "TransformSpell", transformSpell.NrgyResistOffset));
}
if (!((Body)transformSpell.Body).IsHuman)
@ -1282,17 +1280,12 @@ namespace Server.Spells
caster.BodyMod = transformSpell.Body;
caster.HueMod = transformSpell.Hue;
for (var i = 0; i < mods.Count; ++i)
{
caster.AddResistanceMod(mods[i]);
}
transformSpell.DoEffect(caster);
Timer timer = new TransformTimer(caster, transformSpell);
timer.Start();
AddContext(caster, new TransformContext(timer, mods, ourType, transformSpell));
AddContext(caster, new TransformContext(timer, ourType, transformSpell));
return true;
}
}
@ -1322,12 +1315,7 @@ namespace Server.Spells
return;
}
var mods = context.Mods;
for (var i = 0; i < mods.Count; ++i)
{
m.RemoveResistanceMod(mods[i]);
}
m.RemoveResistanceMod("TransformSpell");
if (resetGraphics)
{
@ -1371,18 +1359,15 @@ namespace Server.Spells
public class TransformContext
{
public TransformContext(Timer timer, List<ResistanceMod> mods, Type type, ITransformationSpell spell)
public TransformContext(Timer timer, Type type, ITransformationSpell spell)
{
Timer = timer;
Mods = mods;
Type = type;
Spell = spell;
}
public Timer Timer { get; }
public List<ResistanceMod> Mods { get; }
public Type Type { get; }
public ITransformationSpell Spell { get; }

View file

@ -46,18 +46,18 @@ namespace Server.Spells.Bushido
{
var mods = new List<object>
{
new ResistanceMod(ResistanceType.Physical, -40),
new ResistanceMod(ResistanceType.Fire, -40),
new ResistanceMod(ResistanceType.Cold, -40),
new ResistanceMod(ResistanceType.Poison, -40),
new ResistanceMod(ResistanceType.Energy, -40)
new ResistanceMod(ResistanceType.Physical, "PhysicalResistHonorableExecution", -40),
new ResistanceMod(ResistanceType.Fire, "FireResistHonorableExecution", -40),
new ResistanceMod(ResistanceType.Cold, "ColdResistHonorableExecution", -40),
new ResistanceMod(ResistanceType.Poison, "PoisonResistHonorableExecution", -40),
new ResistanceMod(ResistanceType.Energy, "EnergyResistHonorableExecution", -40)
};
var resSpells = attacker.Skills.MagicResist.Value;
if (resSpells > 0.0)
{
mods.Add(new DefaultSkillMod(SkillName.MagicResist, true, -resSpells));
mods.Add(new DefaultSkillMod(SkillName.MagicResist, "MagicResistHonorableExecution", true, -resSpells));
}
timer = new HonorableExecutionTimer(attacker, mods);

View file

@ -78,15 +78,15 @@ namespace Server.Spells.Fifth
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
var physiMod = -25 + (int)(targ.Skills.Inscribe.Value / 20);
var otherMod = 10;
const int otherMod = 10;
mods = new[]
{
new ResistanceMod(ResistanceType.Physical, physiMod),
new ResistanceMod(ResistanceType.Fire, otherMod),
new ResistanceMod(ResistanceType.Cold, otherMod),
new ResistanceMod(ResistanceType.Poison, otherMod),
new ResistanceMod(ResistanceType.Energy, otherMod)
new ResistanceMod(ResistanceType.Physical, "PhysicalResistMagicResist", physiMod),
new ResistanceMod(ResistanceType.Fire, "FireResistMagicResist", otherMod),
new ResistanceMod(ResistanceType.Cold, "ColdResistMagicResist", otherMod),
new ResistanceMod(ResistanceType.Poison, "PoisonResistMagicResist", otherMod),
new ResistanceMod(ResistanceType.Energy, "EnergyResistMagicResist", otherMod)
};
_table[targ] = mods;

View file

@ -83,12 +83,13 @@ namespace Server.Spells.First
{
new ResistanceMod(
ResistanceType.Physical,
"PhysicalResistReactiveArmorSpell",
15 + (int)(targ.Skills.Inscribe.Value / 20)
),
new ResistanceMod(ResistanceType.Fire, -5),
new ResistanceMod(ResistanceType.Cold, -5),
new ResistanceMod(ResistanceType.Poison, -5),
new ResistanceMod(ResistanceType.Energy, -5)
new ResistanceMod(ResistanceType.Fire, "FireResistReactiveArmorSpell", -5),
new ResistanceMod(ResistanceType.Cold, "ColdResistReactiveArmorSpell", -5),
new ResistanceMod(ResistanceType.Poison, "PoisonResistReactiveArmorSpell", -5),
new ResistanceMod(ResistanceType.Energy, "EnergyResistReactiveArmorSpell", -5)
};
_table[targ] = mods;

View file

@ -101,11 +101,11 @@ namespace Server.Spells.Mysticism
ResistanceMod[] mods =
{
new(ResistanceType.Physical, offset),
new(ResistanceType.Fire, offset),
new(ResistanceType.Cold, offset),
new(ResistanceType.Poison, offset),
new(ResistanceType.Energy, offset)
new(ResistanceType.Physical, "PhysicalResistStoneFormSpell", offset),
new(ResistanceType.Fire, "FireResistStoneFormSpell", offset),
new(ResistanceType.Cold, "ColdResistStoneFormSpell", offset),
new(ResistanceType.Poison, "PoisonResistStoneFormSpell", offset),
new(ResistanceType.Energy, "EnergyResistStoneFormSpell", offset)
};
for (var i = 0; i < mods.Length; ++i)

View file

@ -71,10 +71,10 @@ namespace Server.Spells.Necromancy
ResistanceMod[] mods =
{
new(ResistanceType.Fire, -15),
new(ResistanceType.Poison, -15),
new(ResistanceType.Cold, +10),
new(ResistanceType.Physical, +10)
new(ResistanceType.Fire, "FireResistCorpseSkinSpell", -15),
new(ResistanceType.Poison, "PoisonResistCorpseSkinSpell", -15),
new(ResistanceType.Cold, "ColdResistCorpseSkinSpell", +10),
new(ResistanceType.Physical, "PhysicalResistCorpseSkinSpell", +10)
};
timer = new ExpireTimer(m, mods, duration);

View file

@ -53,7 +53,7 @@ namespace Server.Spells.Necromancy
if (!_table.ContainsKey(m))
{
var mod = new DefaultSkillMod(SkillName.MagicResist, false, m.Skills.MagicResist.Value / 2);
var mod = new DefaultSkillMod(SkillName.MagicResist, "EvilOmen", false, m.Skills.MagicResist.Value / 2);
m.AddSkillMod(mod);
_table[m] = mod;
}

View file

@ -237,11 +237,12 @@ namespace Server.Spells.Ninjitsu
m.NetState.SendSpeedControl(SpeedControlSetting.Mount);
}
// TODO: Determine if transform spell skill mods to a generic location like stat mods
SkillMod mod = null;
if (entry.StealthBonus)
{
mod = new DefaultSkillMod(SkillName.Stealth, true, 20.0) { ObeyCap = true };
mod = new DefaultSkillMod(SkillName.Stealth, "StealthAnimalForm", true, 20.0) { ObeyCap = true };
m.AddSkillMod(mod);
}
@ -249,7 +250,7 @@ namespace Server.Spells.Ninjitsu
if (entry.StealingBonus)
{
stealingMod = new DefaultSkillMod(SkillName.Stealing, true, 10.0) { ObeyCap = true };
stealingMod = new DefaultSkillMod(SkillName.Stealing, "StealingAnimalForm", true, 10.0) { ObeyCap = true };
m.AddSkillMod(stealingMod);
}

View file

@ -79,8 +79,8 @@ namespace Server.Spells.Second
var physLoss = -15 + (int)(caster.Skills.Inscribe.Value / 20);
var resistLoss = -35 + (int)(caster.Skills.Inscribe.Value / 20);
var physMod = new ResistanceMod(ResistanceType.Physical, physLoss);
var resistMod = new DefaultSkillMod(SkillName.MagicResist, true, resistLoss);
var physMod = new ResistanceMod(ResistanceType.Physical, "PhysicalResistProtectionSpell", physLoss);
var resistMod = new DefaultSkillMod(SkillName.MagicResist, "MagicResistProtectionSpell", true, resistLoss);
_table[target] = Tuple.Create(physMod, resistMod);
Registry[target] = 1000; // 100.0% protection from disruption