fix: Fixes cast spell speeds for various expansions (#1178)

* Adds 0.25s for all spells for SA+ Era
* Fixes Summon Creature & Blade Spirits cast delay
* Fixes minimum cast delay for chivalry spells
* Fixes poison strike and wither spells
This commit is contained in:
Kamron Batman 2022-10-01 12:25:40 -07:00 committed by GitHub
parent aa270ac868
commit 8a2c0ead3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 62 additions and 45 deletions

View file

@ -98,8 +98,19 @@ namespace Server.Spells
public virtual double GetResistPercent(Mobile target) => GetResistPercentForCircle(target, Circle);
public override TimeSpan GetCastDelay() =>
!Core.ML && Scroll is BaseWand ? TimeSpan.Zero :
!Core.AOS ? TimeSpan.FromSeconds(0.5 + 0.25 * (int)Circle) : base.GetCastDelay();
public override TimeSpan GetCastDelay()
{
if (!Core.ML || Scroll is BaseWand)
{
return TimeSpan.Zero;
}
if (!Core.AOS)
{
return TimeSpan.FromSeconds(0.5 + 0.25 * (int)Circle);
}
return base.GetCastDelay();
}
}
}

View file

@ -705,6 +705,13 @@ namespace Server.Spells
fc -= EssenceOfWindSpell.GetFCMalus(Caster);
}
if (Core.SA)
{
// At some point OSI added 0.25s to every spell. This makes the minimum 0.5s
// Note: This is done after multiplying for summon creature & blade spirits.
fc--;
}
var fcDelay = TimeSpan.FromSeconds(-(CastDelayFastScalar * fc * CastDelaySecondsPerTick));
return Utility.Max(CastDelayBase + fcDelay, CastDelayMinimum);

View file

@ -19,7 +19,7 @@ namespace Server.Spells.Chivalry
public override bool ClearHandsOnCast => false;
// public override int CastDelayBase => 1;
public override TimeSpan CastDelayMinimum => TimeSpan.FromSeconds(Core.SA ? 0.5 : 0.25);
public override int CastRecoveryBase => 7;
@ -34,20 +34,15 @@ namespace Server.Spells.Chivalry
if (Caster.TithingPoints < RequiredTithing)
{
Caster.SendLocalizedMessage(
1060173,
RequiredTithing
.ToString()
); // You must have at least ~1_TITHE_REQUIREMENT~ Tithing Points to use this ability,
// You must have at least ~1_TITHE_REQUIREMENT~ Tithing Points to use this ability,
Caster.SendLocalizedMessage(1060173, RequiredTithing.ToString());
return false;
}
if (Caster.Mana < mana)
{
Caster.SendLocalizedMessage(
1060174,
mana.ToString()
); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
// You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
Caster.SendLocalizedMessage(1060174, mana.ToString());
return false;
}
@ -67,20 +62,15 @@ namespace Server.Spells.Chivalry
if (Caster.TithingPoints < requiredTithing)
{
Caster.SendLocalizedMessage(
1060173,
RequiredTithing
.ToString()
); // You must have at least ~1_TITHE_REQUIREMENT~ Tithing Points to use this ability,
// You must have at least ~1_TITHE_REQUIREMENT~ Tithing Points to use this ability,
Caster.SendLocalizedMessage(1060173, RequiredTithing.ToString());
return false;
}
if (Caster.Mana < mana)
{
Caster.SendLocalizedMessage(
1060174,
mana.ToString()
); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
// You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
Caster.SendLocalizedMessage(1060174, mana.ToString());
return false;
}

View file

@ -21,7 +21,9 @@ namespace Server.Spells.Chivalry
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.5);
// https://uo.com/wiki/ultima-online-wiki/publish-notes/publish-108/ - 1.5 -> 2.0
// According to tests, this includes the 0.25s added penalty, so we are adjusting to 1.75s base.
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(Core.EJ ? 1.75 : 1.5);
public override double RequiredSkill => 5.0;
public override int RequiredMana => 20;

View file

@ -34,17 +34,7 @@ namespace Server.Spells.Fifth
}
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
TimeSpan duration;
if (Core.AOS)
{
duration = TimeSpan.FromSeconds(120);
}
else
{
duration = TimeSpan.FromSeconds(Utility.Random(80, 40));
}
var duration = TimeSpan.FromSeconds(Core.AOS ? 120 : Utility.Random(80, 40));
BaseCreature.Summon(new BladeSpirits(), false, Caster, new Point3D(p), 0x212, duration);
}
@ -53,12 +43,23 @@ namespace Server.Spells.Fifth
public override TimeSpan GetCastDelay()
{
if (Core.AOS)
var scalar = Core.Expansion switch
{
return TimeSpan.FromTicks(base.GetCastDelay().Ticks * (Core.SE ? 3 : 5));
>= Expansion.SE => 3,
>= Expansion.AOS => 5,
_ => 4
};
var delay = base.GetCastDelay() * scalar;
// SA made everything 0.25s slower, but that is applied after the scalar
// So remove 0.25 * scalar to compensate
if (Core.SA)
{
delay -= TimeSpan.FromSeconds(0.25 * scalar);
}
return base.GetCastDelay() + TimeSpan.FromSeconds(6.0);
return delay;
}
public override bool CheckCast()

View file

@ -91,12 +91,16 @@ namespace Server.Spells.Fifth
public override TimeSpan GetCastDelay()
{
if (Core.AOS)
var delay = base.GetCastDelay() * (Core.AOS ? 5 : 4);
// SA made everything 0.25 slower, but that is applied after the scalar
// So remove 0.25 * 5 to compensate
if (Core.SA)
{
return TimeSpan.FromTicks(base.GetCastDelay().Ticks * 5);
delay -= TimeSpan.FromSeconds(1.25);
}
return base.GetCastDelay() + TimeSpan.FromSeconds(6.0);
return delay;
}
}
}

View file

@ -14,13 +14,10 @@ namespace Server.Spells.Necromancy
public override SkillName CastSkill => SkillName.Necromancy;
public override SkillName DamageSkill => SkillName.SpiritSpeak;
// public override int CastDelayBase => base.CastDelayBase; // Reference, 3
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 double CastDelayFastScalar => Core.SE ? base.CastDelayFastScalar : 0;
public override int ComputeKarmaAward()
{

View file

@ -21,7 +21,12 @@ namespace Server.Spells.Necromancy
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.5);
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(Core.Expansion switch
{
>= Expansion.SA => 1.25,
>= Expansion.ML => 1.5,
_ => 1.0
});
public override double RequiredSkill => 60.0;