ModernUO/Projects/UOContent/Spells/Fourth/Curse.cs
Kamron Batman 4f9714818d
fix: Fixes skill requirements and cleans up magery spells (#870)
* Preps damage stacking for mysticism, necromancy fixes, and spellweaving
* Removes extra LINQ allocations
* Fixes skill requirements for magery spells.
2021-12-05 09:40:57 -08:00

83 lines
2.6 KiB
C#

using System.Collections.Generic;
using Server.Targeting;
namespace Server.Spells.Fourth
{
public class CurseSpell : MagerySpell, ISpellTargetingMobile
{
private static readonly SpellInfo _info = new(
"Curse",
"Des Sanct",
227,
9031,
Reagent.Nightshade,
Reagent.Garlic,
Reagent.SulfurousAsh
);
private static readonly HashSet<Mobile> _underEffect = new();
public CurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
{
}
public override SpellCircle Circle => SpellCircle.Fourth;
public void Target(Mobile m)
{
if (CheckHSequence(m))
{
SpellHelper.Turn(Caster, m);
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
SpellHelper.AddStatCurse(Caster, m, StatType.Str);
SpellHelper.DisableSkillCheck = true;
SpellHelper.AddStatCurse(Caster, m, StatType.Dex);
SpellHelper.AddStatCurse(Caster, m, StatType.Int);
SpellHelper.DisableSkillCheck = false;
// On OSI you CAN curse yourself and get this effect.
if (Caster.Player && m.Player /*&& Caster != m */ && !UnderEffect(m))
{
var duration = SpellHelper.GetDuration(Caster, m);
_underEffect.Add(m);
Timer.StartTimer(duration, () => RemoveEffect(m));
m.UpdateResistances();
}
m.Spell?.OnCasterHurt();
m.Paralyzed = false;
m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
m.PlaySound(0x1E1);
var percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, true) * 100);
var length = SpellHelper.GetDuration(Caster, m);
var args = $"{percentage}\t{percentage}\t{percentage}\t{10}\t{10}\t{10}\t{10}";
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Curse, 1075835, 1075836, length, m, args));
HarmfulSpell(m);
}
FinishSequence();
}
public override void OnCast()
{
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
}
public static bool RemoveEffect(Mobile m)
{
var effectRemoved = _underEffect.Remove(m);
m.UpdateResistances();
return effectRemoved;
}
public static bool UnderEffect(Mobile m) => _underEffect.Contains(m);
}
}