ModernUO/Projects/UOContent/Holiday Stuff/Christmas/2004/SnowTarget.cs
Kamron Batman 8fd04ac5aa
fix: Codegens gifts. Unifies staff names. Thank you to the community! (#1766)
### Summary
* Adds contributors/sponsors to the "staff" list for holiday items.
* Unifies all of the staff lists
* Moves 2004 winter gifts to the appropriate folder
* Codegens the gift items

## Thank you!
Thank you to the RunUO/ServUO community, Owyn, Jaedan, the Outlands community, and the ModernUO contributors/community. Without all of you, this would not be possible! ❤️
2024-05-08 20:44:00 -07:00

62 lines
1.8 KiB
C#

using System;
using Server.Engines.ConPVP;
using Server.Targeting;
namespace Server.Items;
public class SnowTarget : Target
{
private static readonly Type[] _snowPileTypes = [typeof(SnowPile), typeof(PileOfGlacialSnow)];
public SnowTarget() : base(10, false, TargetFlags.None)
{
}
protected override void OnTarget(Mobile from, object target)
{
if (target == from)
{
from.SendLocalizedMessage(1005576); // You can't throw this at yourself.
return;
}
if (target is not Mobile targ)
{
// You can only throw a snowball at something that can throw one back.
from.SendLocalizedMessage(1005577);
return;
}
var pack = targ.Backpack;
if (from.Region.IsPartOf<SafeZone>() || targ.Region.IsPartOf<SafeZone>())
{
from.SendMessage("You may not throw snow here.");
return;
}
if (pack?.FindItemByType(_snowPileTypes) == null)
{
// You can only throw a snowball at something that can throw one back.
from.SendLocalizedMessage(1005577);
return;
}
if (!from.BeginAction<SnowPile>())
{
from.SendLocalizedMessage(1005574); // The snow is not ready to be packed yet. Keep trying.
return;
}
Timer.StartTimer(TimeSpan.FromSeconds(5.0), from.EndAction<SnowPile>);
from.PlaySound(0x145);
from.Animate(9, 1, 1, true, false, 0);
targ.SendLocalizedMessage(1010572); // You have just been hit by a snowball!
from.SendLocalizedMessage(1010573); // You throw the snowball and hit the target!
Effects.SendMovingEffect(from, targ, 0x36E4, 7, 0, false, true, 0x47F);
}
}