ModernUO/Projects/UOContent/Spells/First/MagicArrow.cs
Crome696 28513b00dd feat: implement Spell Focusing Sash (Closes #22)
Adds the Stygian Abyss-era Spell Focusing Sash with full lifecycle,
equipment stat block, and damage sequence behavior:

- New SpellFocusingSash (BaseMiddleTorso) with Brittle, Mana Increase,
  Defense Chance Increase, +10 Strength Requirement, and 255/255 durability.
- Context-menu enable/disable on the worn sash.
- Sequence damage modifier: -30 -> 0 over six casts, then +2 per cast
  capped at +30 (PvM) or +20 held for five casts (PvP), resetting at the
  peak, on target change, on unequip, on disable, on death, and on logout.
- Centralized eligibility gate (SpellFocusingEligible) and shared
  SpellHelper.Damage hooks, plus a direct hook in PainSpike.
- Brittle is forced on under Core.SA via AOS.IsBrittle.
- Regression tests covering stats/property ordering, enable state
  serialization, context-menu toggle, PvM and PvP sequences, target
  resets, disabled state, and non-eligible spells.
2026-07-10 08:03:19 +02:00

79 lines
2.2 KiB
C#

using System;
using Server.Spells.Mysticism;
using Server.Targeting;
namespace Server.Spells.First
{
public class MagicArrowSpell : MagerySpell, ITargetingSpell<Mobile>
{
private static readonly SpellInfo _info = new(
"Magic Arrow",
"In Por Ylem",
212,
9041,
Reagent.SulfurousAsh
);
public MagicArrowSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
{
}
public override SpellCircle Circle => SpellCircle.First;
public override bool SpellFocusingEligible => true;
private static readonly Type[] _delayedDamageSpellFamilyStacking = Core.AOS ? [typeof(NetherBoltSpell)] : null;
public override Type[] DelayedDamageSpellFamilyStacking => _delayedDamageSpellFamilyStacking;
public override bool DelayedDamage => true;
public void Target(Mobile m)
{
if (CheckHSequence(m))
{
var source = Caster;
SpellHelper.Turn(source, m);
if (Core.SA && HasDelayedDamageContext(m))
{
DoHurtFizzle();
return;
}
SpellHelper.CheckReflect((int)Circle, ref source, ref m);
double damage;
if (Core.AOS)
{
damage = GetNewAosDamage(10, 1, 4, m);
}
else
{
damage = Utility.Random(4, 4);
if (CheckResisted(m))
{
damage *= 0.75;
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
}
damage *= GetDamageScalar(m);
}
source.MovingParticles(m, 0x36E4, 5, 0, false, false, 0, 0, 3006, 0, 0, EffectLayer.RightHand, 0);
source.PlaySound(0x1E5);
SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);
}
}
public override void OnCast()
{
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
}
}
}