fix: Fixes spell mechanics and misc bugs (#1118)

- [X] Fixes NPE from account tags.
- [X] Fixes bad skill check due to missing cast to double.
- [X] Fixes water elemental duration.
- [X] Standardizes spell summon duration by expansion.
This commit is contained in:
Kamron Batman 2022-07-14 22:01:59 -07:00 • committed by GitHub
parent 2ab0a0e063
commit d6d02de296
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 74 additions and 66 deletions

View file

@ -42,7 +42,12 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
var duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
var duration = Core.Expansion switch
{
Expansion.None => TimeSpan.FromSeconds(Caster.Skills.Magery.Value),
// T2A -> Current
_ => TimeSpan.FromSeconds(4 * Math.Min(5, Caster.Skills.Magery.Value)),
};
if (Core.AOS)
{

View file

@ -42,7 +42,12 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
var duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
var duration = Core.Expansion switch
{
Expansion.None => TimeSpan.FromSeconds(Caster.Skills.Magery.Value),
// T2A -> Current
_ => TimeSpan.FromSeconds(4 * Math.Min(5, Caster.Skills.Magery.Value)),
};
if (Core.AOS)
{

View file

@ -35,16 +35,8 @@ namespace Server.Spells.Eighth
}
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
TimeSpan duration;
if (Core.AOS)
{
duration = TimeSpan.FromSeconds(90.0);
}
else
{
duration = TimeSpan.FromSeconds(Utility.Random(80, 40));
}
// TODO: Check Demo for pre-T2A.
var duration = Core.T2A ? TimeSpan.FromSeconds(90.0) : TimeSpan.FromSeconds(Utility.Random(80, 40));
BaseCreature.Summon(new EnergyVortex(), false, Caster, new Point3D(p), 0x212, duration);
}

View file

@ -43,7 +43,12 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
var duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
var duration = Core.Expansion switch
{
Expansion.None => TimeSpan.FromSeconds(Caster.Skills.Magery.Value),
// T2A -> Current
_ => TimeSpan.FromSeconds(4 * Math.Min(5, Caster.Skills.Magery.Value)),
};
if (Core.AOS)
{

View file

@ -43,7 +43,12 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
var duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
var duration = Core.Expansion switch
{
Expansion.None => TimeSpan.FromSeconds(Caster.Skills.Magery.Value),
// T2A -> Current
_ => TimeSpan.FromSeconds(4 * Math.Min(5, Caster.Skills.Magery.Value)),
};
if (Core.AOS) /* Why two diff daemons? TODO: solve this */
{

View file

@ -42,7 +42,12 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
var duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
var duration = Core.Expansion switch
{
Expansion.None => TimeSpan.FromSeconds(Caster.Skills.Magery.Value),
// T2A -> Current
_ => TimeSpan.FromSeconds(4 * Math.Min(5, Caster.Skills.Magery.Value)),
};
if (Core.AOS)
{

View file

@ -170,7 +170,7 @@ namespace Server.Mobiles
var duration = TimeSpan.FromSeconds(30 + caster.Skills.Ninjitsu.Fixed / 40);
new UnsummonTimer(caster, this, duration).Start();
new UnsummonTimer(this, duration).Start();
SummonEnd = Core.Now + duration;
MirrorImage.AddClone(m_Caster);

View file

@ -6,11 +6,9 @@ namespace Server.Spells
internal class UnsummonTimer : Timer
{
private readonly BaseCreature m_Creature;
private Mobile m_Caster;
public UnsummonTimer(Mobile caster, BaseCreature creature, TimeSpan delay) : base(delay)
public UnsummonTimer(BaseCreature creature, TimeSpan delay) : base(delay)
{
m_Caster = caster;
m_Creature = creature;
}