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
|
|
@ -290,8 +290,7 @@ namespace Server.Spells
|
|||
}
|
||||
}
|
||||
|
||||
private static SpecialMoveContext GetContext(Mobile m) =>
|
||||
_playersTable.TryGetValue(m, out var context) ? context : null;
|
||||
private static SpecialMoveContext GetContext(Mobile m) => _playersTable.GetValueOrDefault(m);
|
||||
|
||||
private class SpecialMoveTimer : Timer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -194,7 +194,10 @@ namespace Server.Spells
|
|||
(m as BaseCreature)?.OnHarmfulSpell(Caster);
|
||||
}
|
||||
|
||||
public virtual int GetNewAosDamage(int bonus, int dice, int sides, Mobile singleTarget)
|
||||
public int GetNewAosDamage(int bonus, int dice, int sides, Mobile singleTarget) =>
|
||||
GetNewAosDamage(bonus, dice, sides, true, singleTarget);
|
||||
|
||||
public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool sdi = true, Mobile singleTarget = null)
|
||||
{
|
||||
if (singleTarget != null)
|
||||
{
|
||||
|
|
@ -203,17 +206,15 @@ namespace Server.Spells
|
|||
dice,
|
||||
sides,
|
||||
Caster.Player && singleTarget.Player,
|
||||
sdi,
|
||||
GetDamageScalar(singleTarget)
|
||||
);
|
||||
}
|
||||
|
||||
return GetNewAosDamage(bonus, dice, sides, false);
|
||||
return GetNewAosDamage(bonus, dice, sides, sdi, false);
|
||||
}
|
||||
|
||||
public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer) =>
|
||||
GetNewAosDamage(bonus, dice, sides, playerVsPlayer, 1.0);
|
||||
|
||||
public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar)
|
||||
public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, bool sdi, double scalar = 1.0)
|
||||
{
|
||||
var damage = Utility.Dice(dice, sides, bonus) * 100;
|
||||
|
||||
|
|
@ -224,14 +225,17 @@ namespace Server.Spells
|
|||
var intBonus = Caster.Int / 10;
|
||||
damageBonus += intBonus;
|
||||
|
||||
var sdiBonus = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage);
|
||||
// PvP spell damage increase cap of 15% from an item's magic property
|
||||
if (playerVsPlayer && sdiBonus > 15)
|
||||
if (sdi)
|
||||
{
|
||||
sdiBonus = 15;
|
||||
}
|
||||
var sdiBonus = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage);
|
||||
// PvP spell damage increase cap of 15% from an item's magic property
|
||||
if (playerVsPlayer && sdiBonus > 15)
|
||||
{
|
||||
sdiBonus = 15;
|
||||
}
|
||||
|
||||
damageBonus += sdiBonus;
|
||||
damageBonus += sdiBonus;
|
||||
}
|
||||
|
||||
var context = TransformationSpellHelper.GetContext(Caster);
|
||||
|
||||
|
|
|
|||
|
|
@ -1022,6 +1022,7 @@ namespace Server.Spells
|
|||
StaminaSystem.DFA = dfa;
|
||||
|
||||
var damageGiven = AOS.Damage(target, from, dmg, phys, fire, cold, pois, nrgy, chaos);
|
||||
Mysticism.SpellPlagueSpell.OnMobileDamaged(target);
|
||||
|
||||
StaminaSystem.DFA = DFAlgorithm.Standard;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue