ModernUO/Projects/UOContent/Spells/Eighth/Resurrection.cs
Kamron Batman 8282b00ca2
feat: Moves gumps out of the core (#1916)
> [!Important]
> **Developer Note**
> This code change will **completely move gumps out of the core**


### Summary

- Adds `GetGumps()` convenience which exposes methods to Find/Close/Send multiple gumps. This helper is a performance improvement by eliminating the Dictionary<Player, List> lookup for gumps.
2024-08-09 19:07:32 -07:00

86 lines
2.6 KiB
C#

using Server.Engines.ConPVP;
using Server.Gumps;
using Server.Targeting;
namespace Server.Spells.Eighth
{
public class ResurrectionSpell : MagerySpell, ITargetingSpell<Mobile>
{
private static readonly SpellInfo _info = new(
"Resurrection",
"An Corp",
245,
9062,
Reagent.Bloodmoss,
Reagent.Garlic,
Reagent.Ginseng
);
public ResurrectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
{
}
public override SpellCircle Circle => SpellCircle.Eighth;
public int TargetRange => 1;
public void Target(Mobile m)
{
if (m == Caster)
{
Caster.SendLocalizedMessage(501039); // Thou can not resurrect thyself.
}
else if (!Caster.Alive)
{
Caster.SendLocalizedMessage(501040); // The resurrecter must be alive.
}
else if (m.Alive)
{
Caster.SendLocalizedMessage(501041); // Target is not dead.
}
else if (!Caster.InRange(m, 1))
{
Caster.SendLocalizedMessage(501042); // Target is not close enough.
}
else if (!m.Player)
{
Caster.SendLocalizedMessage(501043); // Target is not a being.
}
else if (m.Map?.CanFit(m.Location, 16, false, false) != true)
{
Caster.SendLocalizedMessage(501042); // Target can not be resurrected at that location.
m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
}
else if (m.Region?.IsPartOf("Khaldun") == true)
{
// The veil of death in this area is too strong and resists thy efforts to restore life.
Caster.SendLocalizedMessage(1010395);
}
else if (CheckBSequence(m, true))
{
SpellHelper.Turn(Caster, m);
m.PlaySound(0x214);
m.FixedEffect(0x376A, 10, 16);
m.SendGump(new ResurrectGump(Caster));
}
}
public override bool CheckCast()
{
if (DuelContext.CheckSuddenDeath(Caster))
{
Caster.SendMessage(0x22, "You cannot cast this spell when in sudden death.");
return false;
}
return base.CheckCast();
}
public override void OnCast()
{
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
}
}
}