fix: Fixes various memory leaks and spells (#1786)
### Summary - Fixes various memory leaks related to spells - Fixes Spell Plague - Added ability to determine if `sdi` should take effect for Spell Damage. - Fixes animal form timer ticking non-stop while logged out.
This commit is contained in:
parent
6747168db0
commit
a552cf4138
51 changed files with 4164 additions and 4188 deletions
|
|
@ -1,47 +1,46 @@
|
|||
using Server.Items;
|
||||
|
||||
namespace Server.Spells.Necromancy
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public abstract class NecromancerSpell : Spell
|
||||
{
|
||||
public abstract class NecromancerSpell : Spell
|
||||
public NecromancerSpell(Mobile caster, Item scroll, SpellInfo info) : base(caster, scroll, info)
|
||||
{
|
||||
public NecromancerSpell(Mobile caster, Item scroll, SpellInfo info) : base(caster, scroll, info)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract double RequiredSkill { get; }
|
||||
public abstract int RequiredMana { get; }
|
||||
|
||||
public override SkillName CastSkill => SkillName.Necromancy;
|
||||
public override SkillName DamageSkill => SkillName.SpiritSpeak;
|
||||
|
||||
public override bool ClearHandsOnCast => false;
|
||||
|
||||
// Necromancer spells are not affected by fast cast items, though they are by fast cast recovery
|
||||
public override double CastDelayFastScalar => Core.SE ? base.CastDelayFastScalar : 0;
|
||||
|
||||
public override int ComputeKarmaAward()
|
||||
{
|
||||
// TODO: Verify this formula being that Necro spells don't HAVE a circle.
|
||||
// int karma = -(70 + (10 * (int)Circle));
|
||||
var karma = -(40 + (int)(10 * (CastDelayBase.TotalSeconds / CastDelaySecondsPerTick)));
|
||||
|
||||
// Pub 36: "Added a new property called Increased Karma Loss which grants higher karma loss for casting necromancy spells."
|
||||
if (Core.ML)
|
||||
{
|
||||
karma += AOS.Scale(karma, AosAttributes.GetValue(Caster, AosAttribute.IncreasedKarmaLoss));
|
||||
}
|
||||
|
||||
return karma;
|
||||
}
|
||||
|
||||
public override void GetCastSkills(out double min, out double max)
|
||||
{
|
||||
min = RequiredSkill;
|
||||
max = Scroll != null ? min : RequiredSkill + 40.0;
|
||||
}
|
||||
|
||||
public override bool ConsumeReagents() => base.ConsumeReagents() || ArcaneGem.ConsumeCharges(Caster, 1);
|
||||
|
||||
public override int GetMana() => RequiredMana;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract double RequiredSkill { get; }
|
||||
public abstract int RequiredMana { get; }
|
||||
|
||||
public override SkillName CastSkill => SkillName.Necromancy;
|
||||
public override SkillName DamageSkill => SkillName.SpiritSpeak;
|
||||
|
||||
public override bool ClearHandsOnCast => false;
|
||||
|
||||
// Necromancer spells are not affected by fast cast items, though they are by fast cast recovery
|
||||
public override double CastDelayFastScalar => Core.SE ? base.CastDelayFastScalar : 0;
|
||||
|
||||
public override int ComputeKarmaAward()
|
||||
{
|
||||
// TODO: Verify this formula being that Necro spells don't HAVE a circle.
|
||||
// int karma = -(70 + (10 * (int)Circle));
|
||||
var karma = -(40 + (int)(10 * (CastDelayBase.TotalSeconds / CastDelaySecondsPerTick)));
|
||||
|
||||
// Pub 36: "Added a new property called Increased Karma Loss which grants higher karma loss for casting necromancy spells."
|
||||
if (Core.ML)
|
||||
{
|
||||
karma += AOS.Scale(karma, AosAttributes.GetValue(Caster, AosAttribute.IncreasedKarmaLoss));
|
||||
}
|
||||
|
||||
return karma;
|
||||
}
|
||||
|
||||
public override void GetCastSkills(out double min, out double max)
|
||||
{
|
||||
min = RequiredSkill;
|
||||
max = Scroll != null ? min : RequiredSkill + 40.0;
|
||||
}
|
||||
|
||||
public override bool ConsumeReagents() => base.ConsumeReagents() || ArcaneGem.ConsumeCharges(Caster, 1);
|
||||
|
||||
public override int GetMana() => RequiredMana;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue