/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\Items\Weapons\Abilities\SerpentArrow.cs
Lines of code: 51
***********************************************************/


using System;

namespace Server.Items
{
	/// <summary>
	//infectuous arrow strike
	/// </summary>
	public class SerpentArrow : WeaponAbility
	{
		public SerpentArrow()
		{
		}

		public override int BaseMana{ get{ return 35; } }

		public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if ( !Validate( attacker ) )
				return;

			ClearCurrentAbility( attacker );

			BaseWeapon weapon = attacker.Weapon as BaseWeapon;

			if ( weapon == null )
				return;
				
			//Poison p = Poison.Lesser;
			Poison p = weapon.Poison;
			
			if ( p == null || weapon.PoisonCharges <= 0 )
			{
				attacker.SendLocalizedMessage( 1061141 ); // Your weapon must have a dose of poison to perform an infectious strike!
				return;
			}				

			if ( !CheckMana( attacker, true ) )
				return;
				
			Misc.Titles.AwardKarma( attacker, -100, true ); //100 is just a guess
			
			--weapon.PoisonCharges;

			// check poison skill and stuff
			
			//if(attacker.Skills[SkillName.Poisoning].Value>25)attacker.CheckSkill( SkillName.Poisoning, 0.0, 100.0 );
			
			//int maxLevel = (int)(attacker.Skills[SkillName.Poisoning].Value / 20);

			
			//if ( maxLevel < 0 ) maxLevel = 0;
			//else if ( maxLevel > 5 ) maxLevel = 5;
			
			//p = Poison.GetPoison( Utility.Random(maxLevel) );

			int maxLevel = attacker.Skills[SkillName.Poisoning].Fixed / 200;
			if ( maxLevel < 0 ) maxLevel = 0;
			if ( p.Level > maxLevel ) p = Poison.GetPoison( maxLevel );

			if ( (attacker.Skills[SkillName.Poisoning].Value / 100.0) > Utility.RandomDouble() )
			{
				int level = p.Level + 1;
				Poison newPoison = Poison.GetPoison( level );

				if ( newPoison != null )
				{
					p = newPoison;

					attacker.SendLocalizedMessage( 1060080 ); // Your precise strike has increased the level of the poison by 1
					defender.SendLocalizedMessage( 1060081 ); // The poison seems extra effective!
				}
			}


			defender.PlaySound( 220 );
				
			attacker.MovingParticles( defender, 0x36F4, 5, 0, false, false, 362, 0, 9535, 1, 0, (EffectLayer)255, 0x100 );
		

			if ( defender.ApplyPoison( attacker, p ) != ApplyPoisonResult.Immune )
			{
				attacker.SendLocalizedMessage( 1008096, true, defender.Name ); // You have poisoned your target : 
				defender.SendLocalizedMessage( 1008097, false, attacker.Name ); //  : poisoned you!
			}
		}
	}
}ÿ