/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\engines\ML Peerless + misc areas\demitel\artifacts\Bloody.cs
Lines of code: 85
***********************************************************/


using System;
using Server.Network;
using Server.Items;

namespace Server.Items
{
	[FlipableAttribute( 0x13B2, 0x13B1 )]
	public class Bloody : CompositeBow
	{
		[CommandProperty( AccessLevel.GameMaster )]
		public bool IsModified
		{
			get{ return ( Hue == 1157 ); }
		}

		[Constructable]
		public Bloody()
		{
			Name = "a bleeding bow";
			Hue = 1645;
		}

		public override void OnDoubleClick( Mobile from )
		{
			if ( IsModified )
			{
				from.SendMessage( "The taint is allready sealed on the bow." );
			}
			else if ( !IsChildOf( from.Backpack ) )
			{
				from.SendMessage( "This must be in your backpack to modify it." );
			}
			else if ( from.Skills[SkillName.Magery].Base < 100.0 )
			{
				from.SendMessage( "Only a grandmaster mage can modify this weapon." );
			}
			else
			{
				from.BeginTarget( 2, false, Targeting.TargetFlags.None, new TargetCallback( OnTargetGears ) );
				from.SendMessage( "Select the gears you wish to use." );
			}
		}

		public void OnTargetGears( Mobile from, object targ )
		{
			Gears g = targ as Gears;

			if ( g == null || !g.IsChildOf( from.Backpack ) )
			{
				from.SendMessage( "The gears must be in your backpack." ); 
			}
			else if ( IsModified )
			{
				from.SendMessage( "That has already been modified." );
			}
			else if ( !IsChildOf( from.Backpack ) )
			{
				from.SendMessage( "This must be in your backpack to modify it." );
			}
			else if ( from.Skills[SkillName.Magery].Base < 100.0 )
			{
				from.SendMessage( "Only a grandmaster magecan modify this weapon." );
			}
			else
			{
				g.Consume();

				Name = "blood tainted bow";
				Hue = Utility.RandomList( 1157, 1194 );
				Attributes.WeaponDamage = 5 * Utility.RandomMinMax( 5, 10 );
				WeaponAttributes.HitLeechHits = 5 * Utility.RandomMinMax( 10, 20 );
				Attributes.WeaponSpeed = 5 * Utility.RandomMinMax( 1, 6 );
				Attributes.RegenHits = 2 * Utility.RandomMinMax( 1, 2 );
				from.SendMessage( "You modify it." );
			}
		}

		public Bloody( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}
}