Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,101 @@
using System;
using Server.Items;
namespace Server.Spells
{
public abstract class MagerySpell : Spell
{
private static readonly int[] m_ManaTable = new int[] { 4, 6, 9, 11, 14, 20, 40, 50 };
private const double ChanceOffset = 20.0, ChanceLength = 100.0 / 7.0;
public MagerySpell(Mobile caster, Item scroll, SpellInfo info)
: base(caster, scroll, info)
{
}
public abstract SpellCircle Circle { get; }
public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromMilliseconds(((4 + (int)Circle) * CastDelaySecondsPerTick) * 1000);
}
}
public override bool ConsumeReagents()
{
if (base.ConsumeReagents())
return true;
if (ArcaneGem.ConsumeCharges(Caster, (Core.SE ? 1 : 1 + (int)Circle)))
return true;
return false;
}
public override void GetCastSkills(out double min, out double max)
{
int circle = (int)Circle;
if (Scroll != null)
circle -= 2;
double avg = ChanceLength * circle;
min = avg - ChanceOffset;
max = avg + ChanceOffset;
}
public override int GetMana()
{
if (Scroll is BaseWand)
return 0;
return m_ManaTable[(int)Circle];
}
public virtual bool CheckResisted(Mobile target)
{
double n = GetResistPercent(target);
n /= 100.0;
if (n <= 0.0)
return false;
if (n >= 1.0)
return true;
int maxSkill = (1 + (int)Circle) * 10;
maxSkill += (1 + ((int)Circle / 6)) * 25;
if (target.Skills[SkillName.MagicResist].Value < maxSkill)
target.CheckSkill(SkillName.MagicResist, 0.0, target.Skills[SkillName.MagicResist].Cap);
return (n >= Utility.RandomDouble());
}
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle)
{
double value = GetResistSkill(target);
double firstPercent = value / 5.0;
double secondPercent = value - (((Caster.Skills[CastSkill].Value - 20.0) / 5.0) + (1 + (int)circle) * 5.0);
return (firstPercent > secondPercent ? firstPercent : secondPercent) / 2.0; // Seems should be about half of what stratics says.
}
public virtual double GetResistPercent(Mobile target)
{
return GetResistPercentForCircle(target, Circle);
}
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();
}
}
}