fix: Updates Mysticism to use circles (#1123)
This commit is contained in:
parent
c5d1927df3
commit
54da2c94a5
11 changed files with 97 additions and 66 deletions
|
|
@ -12,7 +12,6 @@ namespace Server.Spells
|
||||||
* Mana requirements formula: (14 * (circle - 1)) + 2 = 50% probability
|
* Mana requirements formula: (14 * (circle - 1)) + 2 = 50% probability
|
||||||
* Add or subtract 20 for max or min limits
|
* Add or subtract 20 for max or min limits
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static readonly double[] _requiredSkill = Core.ML ?
|
private static readonly double[] _requiredSkill = Core.ML ?
|
||||||
new[] { -46.0, -32.0, -18.0, -4.0, 10.0, 24.0, 38.0, 52.0, 66.0, 80.0 } :
|
new[] { -46.0, -32.0, -18.0, -4.0, 10.0, 24.0, 38.0, 52.0, 66.0, 80.0 } :
|
||||||
new[] { -50.0, -30.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0 };
|
new[] { -50.0, -30.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0 };
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,8 @@ namespace Server.Spells
|
||||||
{
|
{
|
||||||
if (m.Skills[MoveSkill].Value < RequiredSkill)
|
if (m.Skills[MoveSkill].Value < RequiredSkill)
|
||||||
{
|
{
|
||||||
var args = $"{RequiredSkill:F1}\t{MoveSkill.ToString()}\t ";
|
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
||||||
m.SendLocalizedMessage(
|
m.SendLocalizedMessage(1063013, $"{RequiredSkill:F1}\t{MoveSkill}\t ");
|
||||||
1063013,
|
|
||||||
args
|
|
||||||
); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,10 +102,8 @@ namespace Server.Spells
|
||||||
|
|
||||||
if (from.Mana < mana)
|
if (from.Mana < mana)
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(
|
// You need ~1_MANA_REQUIREMENT~ mana to perform that attack
|
||||||
1060181,
|
from.SendLocalizedMessage(1060181, mana.ToString());
|
||||||
mana.ToString()
|
|
||||||
); // You need ~1_MANA_REQUIREMENT~ mana to perform that attack
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace Server.Spells.Bushido
|
||||||
if (Caster.Skills[CastSkill].Value < RequiredSkill)
|
if (Caster.Skills[CastSkill].Value < RequiredSkill)
|
||||||
{
|
{
|
||||||
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
||||||
Caster.SendLocalizedMessage(1063013, $"{RequiredSkill:0.#}\t{CastSkill.ToString()}\t ");
|
Caster.SendLocalizedMessage(1063013, $"{RequiredSkill:0.#}\t{CastSkill}\t ");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,7 @@ namespace Server.Spells.Mysticism
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.5);
|
public override SpellCircle Circle => SpellCircle.Fourth;
|
||||||
|
|
||||||
public override double RequiredSkill => 33.0;
|
|
||||||
public override int RequiredMana => 11;
|
|
||||||
|
|
||||||
public void Target(IPoint3D p)
|
public void Target(IPoint3D p)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,7 @@ namespace Server.Spells.Mysticism
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.25);
|
public override SpellCircle Circle => SpellCircle.Third;
|
||||||
|
|
||||||
public override double RequiredSkill => 20.0;
|
|
||||||
public override int RequiredMana => 9;
|
|
||||||
|
|
||||||
public void Target(Mobile m)
|
public void Target(Mobile m)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Server.Spells.Mysticism
|
namespace Server.Spells.Mysticism
|
||||||
{
|
{
|
||||||
|
|
@ -20,10 +19,8 @@ namespace Server.Spells.Mysticism
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.25);
|
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||||
|
public override int GetMana() => 50;
|
||||||
public override double RequiredSkill => 70.0;
|
|
||||||
public override int RequiredMana => 40;
|
|
||||||
|
|
||||||
public void Target(IPoint3D p)
|
public void Target(IPoint3D p)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,35 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Server.Items;
|
||||||
|
|
||||||
namespace Server.Spells.Mysticism
|
namespace Server.Spells.Mysticism
|
||||||
{
|
{
|
||||||
public abstract class MysticSpell : Spell
|
public abstract class MysticSpell : Spell
|
||||||
{
|
{
|
||||||
public MysticSpell(Mobile caster, Item scroll, SpellInfo info)
|
private static int[] _manaTable = { 4, 6, 9, 11, 14, 20, 40, 50 };
|
||||||
: base(caster, scroll, info)
|
private static double[] _requiredSkill = { 0.0, 8.0, 20.0, 33.0, 45.0, 58.0, 70.0, 83.0 };
|
||||||
|
|
||||||
|
public MysticSpell(Mobile caster, Item scroll, SpellInfo info) : base(caster, scroll, info)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract double RequiredSkill { get; }
|
public abstract SpellCircle Circle { get; }
|
||||||
public abstract int RequiredMana { get; }
|
|
||||||
|
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(0.5 + 0.25 * (int)Circle);
|
||||||
|
|
||||||
|
public virtual double RequiredSkill
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var circle = (int)Circle;
|
||||||
|
|
||||||
|
if (Scroll != null)
|
||||||
|
{
|
||||||
|
circle -= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _requiredSkill[circle];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override SkillName CastSkill => SkillName.Mysticism;
|
public override SkillName CastSkill => SkillName.Mysticism;
|
||||||
|
|
||||||
|
|
@ -26,14 +45,15 @@ namespace Server.Spells.Mysticism
|
||||||
|
|
||||||
public override void GetCastSkills(out double min, out double max)
|
public override void GetCastSkills(out double min, out double max)
|
||||||
{
|
{
|
||||||
|
var requiredSkill = RequiredSkill;
|
||||||
|
|
||||||
// As per Mysticism page at the UO Herald Playguide
|
// As per Mysticism page at the UO Herald Playguide
|
||||||
// This means that we have 25% success chance at min Required Skill
|
// This means that we have 25% success chance at min Required Skill
|
||||||
|
min = requiredSkill - 12.5;
|
||||||
min = RequiredSkill - 12.5;
|
max = requiredSkill + 37.5;
|
||||||
max = RequiredSkill + 37.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetMana() => RequiredMana;
|
public override int GetMana() => Scroll is BaseWand ? 0 : _manaTable[(int)Circle];
|
||||||
|
|
||||||
public override bool CheckCast()
|
public override bool CheckCast()
|
||||||
{
|
{
|
||||||
|
|
@ -42,23 +62,21 @@ namespace Server.Spells.Mysticism
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mana = ScaleMana(RequiredMana);
|
var mana = ScaleMana(GetMana());
|
||||||
|
|
||||||
if (Caster.Mana < mana)
|
if (Caster.Mana < mana)
|
||||||
{
|
{
|
||||||
Caster.SendLocalizedMessage(
|
// You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
|
||||||
1060174,
|
Caster.SendLocalizedMessage(1060174, mana.ToString());
|
||||||
mana.ToString()
|
|
||||||
); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Caster.Skills[CastSkill].Value < RequiredSkill)
|
var requiredSkill = RequiredSkill;
|
||||||
|
|
||||||
|
if (Caster.Skills[CastSkill].Value < requiredSkill)
|
||||||
{
|
{
|
||||||
Caster.SendLocalizedMessage(
|
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
||||||
1063013,
|
Caster.SendLocalizedMessage(1063013, $"{requiredSkill:F1}\t{CastSkill}\t ");
|
||||||
$"{RequiredSkill:F1}\t{CastSkill.ToString()}\t "
|
|
||||||
); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,5 +98,45 @@ namespace Server.Spells.Mysticism
|
||||||
public static double GetBaseSkill(Mobile m) => m.Skills.Mysticism.Value;
|
public static double GetBaseSkill(Mobile m) => m.Skills.Mysticism.Value;
|
||||||
|
|
||||||
public static double GetBoostSkill(Mobile m) => Math.Max(m.Skills.Imbuing.Value, m.Skills.Focus.Value);
|
public static double GetBoostSkill(Mobile m) => Math.Max(m.Skills.Imbuing.Value, m.Skills.Focus.Value);
|
||||||
|
|
||||||
|
public virtual bool CheckResisted(Mobile target)
|
||||||
|
{
|
||||||
|
var n = GetResistPercent(target);
|
||||||
|
|
||||||
|
n /= 100.0;
|
||||||
|
|
||||||
|
if (n <= 0.0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n >= 1.0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var maxSkill = (1 + (int)Circle) * 10;
|
||||||
|
maxSkill += (1 + (int)Circle / 6) * 25;
|
||||||
|
|
||||||
|
if (target.Skills.MagicResist.Value < maxSkill)
|
||||||
|
{
|
||||||
|
target.CheckSkill(SkillName.MagicResist, 0.0, target.Skills.MagicResist.Cap);
|
||||||
|
}
|
||||||
|
|
||||||
|
return n >= Utility.RandomDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle)
|
||||||
|
{
|
||||||
|
var magicResist = target.Skills.MagicResist.Value;
|
||||||
|
var firstPercent = magicResist / 5.0;
|
||||||
|
var secondPercent = magicResist -
|
||||||
|
((Caster.Skills[CastSkill].Value - 20.0) / 5.0 + (1 + (int)circle) * 5.0);
|
||||||
|
|
||||||
|
// Seems should be about half of what stratics says.
|
||||||
|
return (firstPercent > secondPercent ? firstPercent : secondPercent) / 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual double GetResistPercent(Mobile target) => GetResistPercentForCircle(target, Circle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Server.Spells.Mysticism
|
namespace Server.Spells.Mysticism
|
||||||
{
|
{
|
||||||
|
|
@ -20,10 +19,7 @@ namespace Server.Spells.Mysticism
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.5);
|
public override SpellCircle Circle => SpellCircle.Eighth;
|
||||||
|
|
||||||
public override double RequiredSkill => 83.0;
|
|
||||||
public override int RequiredMana => 50;
|
|
||||||
|
|
||||||
public void Target(IPoint3D p)
|
public void Target(IPoint3D p)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,7 @@ namespace Server.Spells.Mysticism
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.25);
|
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||||
|
|
||||||
public override double RequiredSkill => 70.0;
|
|
||||||
public override int RequiredMana => 40;
|
|
||||||
|
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
|
|
@ -201,23 +198,22 @@ namespace Server.Spells.Mysticism
|
||||||
|
|
||||||
private class InternalTarget : Target
|
private class InternalTarget : Target
|
||||||
{
|
{
|
||||||
private readonly SpellPlagueSpell m_Owner;
|
private readonly SpellPlagueSpell _owner;
|
||||||
|
|
||||||
public InternalTarget(SpellPlagueSpell owner)
|
public InternalTarget(SpellPlagueSpell owner) : base(12, false, TargetFlags.Harmful) =>
|
||||||
: base(12, false, TargetFlags.Harmful) =>
|
_owner = owner;
|
||||||
m_Owner = owner;
|
|
||||||
|
|
||||||
protected override void OnTarget(Mobile from, object o)
|
protected override void OnTarget(Mobile from, object o)
|
||||||
{
|
{
|
||||||
if (o is Mobile mobile)
|
if (o is Mobile mobile)
|
||||||
{
|
{
|
||||||
m_Owner.Target(mobile);
|
_owner.Target(mobile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnTargetFinish(Mobile from)
|
protected override void OnTargetFinish(Mobile from)
|
||||||
{
|
{
|
||||||
m_Owner.FinishSequence();
|
_owner.FinishSequence();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Server.Factions;
|
using Server.Factions;
|
||||||
using Server.Spells.Fifth;
|
using Server.Spells.Fifth;
|
||||||
using Server.Spells.Ninjitsu;
|
using Server.Spells.Ninjitsu;
|
||||||
|
|
@ -25,10 +24,7 @@ namespace Server.Spells.Mysticism
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.5);
|
public override SpellCircle Circle => SpellCircle.Fourth;
|
||||||
|
|
||||||
public override double RequiredSkill => 33.0;
|
|
||||||
public override int RequiredMana => 11;
|
|
||||||
|
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace Server.Spells.Ninjitsu
|
||||||
if (Caster.Skills[CastSkill].Value < RequiredSkill)
|
if (Caster.Skills[CastSkill].Value < RequiredSkill)
|
||||||
{
|
{
|
||||||
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
||||||
Caster.SendLocalizedMessage(1063013, $"{RequiredSkill:F1}\t{CastSkill.ToString()}\t ");
|
Caster.SendLocalizedMessage(1063013, $"{RequiredSkill:F1}\t{CastSkill}\t ");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue