/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\events and scenarios\Thanksgiving 2008\SuperMadTurkey.cs
Lines of code: 151
***********************************************************/


using System;
using Server.Mobiles;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "the remains of one foul bird" )]
	public class SuperMadTurkey : BaseCreature
	{
	
	
		public override WeaponAbility GetWeaponAbility()
		{
			return WeaponAbility.WhirlwindAttack;
		}
	
		public int HitTimes = 0; 

		[Constructable]
		public SuperMadTurkey() : base( AIType.AI_Super, FightMode.Closest, 10, 1, 0.15, 0.18 )
		{
		
			Name = "a Mad Turkey";
		    Body = 30;
			BaseSoundID = 402;
			Hue = Utility.RandomMinMax(1864, 1872) ;
			
			SetStr( 800, 830 );  
			SetDex( 100, 120 );
			SetInt( 100, 120 );

			SetHits( 2000, 3000 );
			SetMana( 100, 130 );

			SetDamage( 11, 16 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Fire, 20 );
			SetDamageType( ResistanceType.Cold, 20 );
			SetDamageType( ResistanceType.Poison, 20 );
			SetDamageType( ResistanceType.Energy, 20 );
			
			
			SetResistance( ResistanceType.Physical, 70, 80);
			SetResistance( ResistanceType.Fire, 70, 80 );
			SetResistance( ResistanceType.Cold, 60, 70 );
			SetResistance( ResistanceType.Poison, 25, 40 );
			SetResistance( ResistanceType.Energy, 25, 40 );
			
			SetSkill( SkillName.MagicResist, 80,90);
			SetSkill( SkillName.Tactics, 100,110);
			SetSkill( SkillName.Anatomy, 70,80);		
			SetSkill( SkillName.Wrestling, 100,110);
			

			Fame = 50000;
			Karma = -50000;

			VirtualArmor = 18;	
			
			PackItem( new BronzeToken() );
			PackItem( new BronzeToken() );
			PackItem( new BronzeToken() );
			PackItem( new SilverToken() );
			PackItem( new SilverToken() );
			PackItem( new GoldToken() );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.Rich, 7 );
			AddLoot( LootPack.SuperBoss, 5 );		
		}
		
		public override bool ReacquireOnMovement{ get{ return true; } }
		public override bool HasBreath{ get{ return true; } }
		public override int BreathPhysicalDamage{ get{ return 30; } } 
		public override int BreathFireDamage{ get{ return 70; } }
		public override int breathtargets{ get{ return 6; } }
		
		public override double BreathMinDelay{ get{ return 20.5; } }
		public override double BreathMaxDelay{ get{ return 30.5; } }
		
		public override bool Unprovokable{ get{ return true; } }
		public override bool Uncalmable{ get{ return true; } }
		
		public override Poison PoisonImmune{ get{ return Poison.Deadly; } }
		public override Poison HitPoison{ get{ return Poison.Deadly; } }
		public override double HitPoisonChance{ get{ return 0.2; } }
		
		public override bool AutoDispel{ get{ return true; } }
		public override double AutoDispelChance{ get{ return 0.7; } }
		public override bool CantbeSupreme{ get{ return true; } }	
		
		public override bool IsMLBoss { get { return true;} }		

		public SuperMadTurkey(Serial serial) : base(serial)
		{
		}
		
		public override void OnGaveMeleeAttack( Mobile defender )
		{	
			if ( 0.4 > Utility.RandomDouble() )
			{
				Random rand = new Random();
				HitTimes = rand.Next( 2, 7 );
			
				for (int i = 0; i < HitTimes; i++)
				{
					AOS.Damage( defender, this, 15, true, 100, 0, 0, 0, 0 );
				}
				defender.SendMessage("The turkey claws at you, hitting you " + HitTimes + " times");
			}
	
		base.OnGaveMeleeAttack( defender );
		}
		
		public override void OnGotMeleeAttack( Mobile attacker )
		{
			if (!attacker.InRange( this, 1 ))
			{
				if ( 0.4 > Utility.RandomDouble() )
				{
					Random rand = new Random();
					HitTimes = rand.Next( 2, 7 );
			
					for (int i = 0; i < HitTimes; i++)
					{
						this.MovingParticles( attacker, 0x36D4, 7, 0, false, true, 1868, 3, 9502, 4019, 0x47E, 0x100 );
						AOS.Damage( attacker, this, 15, true, 0, 100, 0, 0, 0 );
					}
					attacker.SendMessage("The turkey launches hot gravy at you, hitting you " + HitTimes + " times");
				}
			}
	
		base.OnGotMeleeAttack( attacker );
		}
		
		public override void OnDamage( int amount, Mobile attacker, bool willKill ) 
		{
			if(attacker!=null && attacker is BaseCreature && 0.3 >= Utility.RandomDouble())
			{
				if(((BaseCreature)attacker).ControlMaster!=null)
				{
					Combatant=((BaseCreature)attacker).ControlMaster;
				}
				else if(((BaseCreature)attacker).SummonMaster!=null)
				{
					Combatant=((BaseCreature)attacker).SummonMaster;
				}
			}	
				
			base.OnDamage(amount, attacker, willKill );			
		}
		
		public override void OnDamagedBySpell(Mobile attacker)
		{
			if (!attacker.InRange( this, 2 ))
			{
				if ( 0.4 > Utility.RandomDouble() )
				{
					Random rand = new Random();
					HitTimes = rand.Next( 2, 7 );
			
					for (int i = 0; i < HitTimes; i++)
					{
						this.MovingParticles( attacker, 0x36D4, 7, 0, false, true, 1868, 3, 9502, 4019, 0x47E, 0x100 );
						AOS.Damage( attacker, this, 15, true, 0, 100, 0, 0, 0 );
					}
					attacker.SendMessage("The turkey launches hot gravy at you, hitting you " + HitTimes + " times");
				}
			}
			
		base.OnDamagedBySpell( attacker );
		}
		

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

			writer.Write((int) 0);
		}

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

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