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,67 +1,66 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Spells.Necromancy
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class WraithFormSpell : TransformationSpell
|
||||
{
|
||||
public class WraithFormSpell : TransformationSpell
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Wraith Form",
|
||||
"Rel Xen Um",
|
||||
203,
|
||||
9031,
|
||||
Reagent.NoxCrystal,
|
||||
Reagent.PigIron
|
||||
);
|
||||
|
||||
public WraithFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Wraith Form",
|
||||
"Rel Xen Um",
|
||||
203,
|
||||
9031,
|
||||
Reagent.NoxCrystal,
|
||||
Reagent.PigIron
|
||||
);
|
||||
}
|
||||
|
||||
public WraithFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.0);
|
||||
|
||||
public override double RequiredSkill => 20.0;
|
||||
public override int RequiredMana => 17;
|
||||
|
||||
public override int Body => Caster.Female ? 747 : 748;
|
||||
public override int Hue => Caster.Female ? 0 : 0x4001;
|
||||
|
||||
public override int PhysResistOffset => +15;
|
||||
public override int FireResistOffset => -5;
|
||||
public override int ColdResistOffset => 0;
|
||||
public override int PoisResistOffset => 0;
|
||||
public override int NrgyResistOffset => -5;
|
||||
|
||||
public static void DoWraithLeech(Mobile wraith, Mobile defender, int damageGiven)
|
||||
{
|
||||
var wraithLeech = 5 + (int)(15 * wraith.Skills.SpiritSpeak.Value / 100); // Wraith form gives 5-20% mana leech
|
||||
var manaLeech = Math.Min(defender.Mana, AOS.Scale(damageGiven, wraithLeech));
|
||||
|
||||
if (manaLeech != 0)
|
||||
{
|
||||
}
|
||||
|
||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.0);
|
||||
|
||||
public override double RequiredSkill => 20.0;
|
||||
public override int RequiredMana => 17;
|
||||
|
||||
public override int Body => Caster.Female ? 747 : 748;
|
||||
public override int Hue => Caster.Female ? 0 : 0x4001;
|
||||
|
||||
public override int PhysResistOffset => +15;
|
||||
public override int FireResistOffset => -5;
|
||||
public override int ColdResistOffset => 0;
|
||||
public override int PoisResistOffset => 0;
|
||||
public override int NrgyResistOffset => -5;
|
||||
|
||||
public static void DoWraithLeech(Mobile wraith, Mobile defender, int damageGiven)
|
||||
{
|
||||
var wraithLeech = 5 + (int)(15 * wraith.Skills.SpiritSpeak.Value / 100); // Wraith form gives 5-20% mana leech
|
||||
var manaLeech = Math.Min(defender.Mana, AOS.Scale(damageGiven, wraithLeech));
|
||||
|
||||
if (manaLeech != 0)
|
||||
{
|
||||
wraith.Mana += manaLeech;
|
||||
defender.Mana -= manaLeech;
|
||||
wraith.PlaySound(0x44D);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DoEffect(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile mobile)
|
||||
{
|
||||
mobile.IgnoreMobiles = true;
|
||||
}
|
||||
|
||||
m.PlaySound(0x17F);
|
||||
m.FixedParticles(0x374A, 1, 15, 9902, 1108, 4, EffectLayer.Waist);
|
||||
}
|
||||
|
||||
public override void RemoveEffect(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile { AccessLevel: AccessLevel.Player } mobile)
|
||||
{
|
||||
mobile.IgnoreMobiles = false;
|
||||
}
|
||||
wraith.Mana += manaLeech;
|
||||
defender.Mana -= manaLeech;
|
||||
wraith.PlaySound(0x44D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void DoEffect(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile mobile)
|
||||
{
|
||||
mobile.IgnoreMobiles = true;
|
||||
}
|
||||
|
||||
m.PlaySound(0x17F);
|
||||
m.FixedParticles(0x374A, 1, 15, 9902, 1108, 4, EffectLayer.Waist);
|
||||
}
|
||||
|
||||
public override void RemoveEffect(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile { AccessLevel: AccessLevel.Player } mobile)
|
||||
{
|
||||
mobile.IgnoreMobiles = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue