context: using System;
  using System.Collections;
  using Server.Items;
  using Server.Targeting;
  using Server.Gumps;
  using Server.SkillHandlers;
  using Server.ContextMenus;
  using System.Collections.Generic;
  
  namespace Server.Mobiles
  {
  
  	[CorpseName( "a corpse" )]
  	public class BaseBioCreature : BaseCreature
  	{
  		private Mobile m_Craftedby;
  		private bool m_HasDNA;
  
  		//Counter Attacks
  		private bool m_BluntAttack;
  		private bool m_Healing;
  		private bool m_PoisonAttack;
  
  		//Speical Attacks
  		private bool m_TrialByFire;
  		private bool m_IceBlast;
  		private bool m_CometAttack;
  		private bool m_CallOfNature;
  		private bool m_AcidRain;
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public Mobile Crafter
  		{ 
  			get{ return m_Craftedby; } 
  			set{ m_Craftedby = value; } 
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool HasDNA
  		{ 
  			get{ return m_HasDNA; } 
  			set{ m_HasDNA = value; } 
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool TrialByFire
  		{ 
  			get{ return m_TrialByFire; } 
  			set{ m_TrialByFire = value; } 
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool IceBlast
  		{ 
  			get{ return m_IceBlast; } 
  			set{ m_IceBlast = value; } 
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool CometAttack
  		{ 
  			get{ return m_CometAttack; } 
  			set{ m_CometAttack = value; } 
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool CallOfNature
  		{ 
  			get{ return m_CallOfNature; } 
  			set{ m_CallOfNature = value; } 
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool AcidRain
  		{ 
  			get{ return m_AcidRain; } 
  			set{ m_AcidRain = value; } 
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool BluntAttack
  		{ 
  			get{ return m_BluntAttack; } 
  			set{ m_BluntAttack = value; } 
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool Healing
  		{ 
  			get{ return m_Healing; } 
  			set{ m_Healing = value; } 
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool PoisonAttack
  		{ 
  			get{ return m_PoisonAttack; } 
  			set{ m_PoisonAttack = value; } 
  		}
  
  		public override WeaponAbility GetWeaponAbility()
  		{
  			switch ( Utility.Random( 3 ) )
  			{
  				default:
  				case 0: return WeaponAbility.DoubleStrike;
  				case 1: return WeaponAbility.WhirlwindAttack;
  			}
  		}
  
  		[Constructable]
  		public BaseBioCreature() : base( AIType.AI_Animal, FightMode.Closest, 10, 1, 0.2, 0.4 )
  		{
  			Name = "a bio-engienered clone";
  			Body = 775;
  
  			SetStr( 1 );
  			SetDex( 1 );
  			SetInt( 1 );
  
  			SetSkill( SkillName.MagicResist, 25.0 );
  			SetSkill( SkillName.Tactics, 25.0 );
  			SetSkill( SkillName.Wrestling, 25.0 );
  			SetSkill( SkillName.Meditation, 25.0 );
  			SetSkill( SkillName.Magery, 25.0 );
  			SetSkill( SkillName.EvalInt, 25.0 );
  			SetSkill( SkillName.Poisoning, 25.0 );
  
  			Fame = 0;
  			Karma = 0;
  
  			VirtualArmor = 1;
  
  			Tamable = true;
  			ControlSlots = 3;
  			MinTameSkill = 100.0;
  
  			Container pack = Backpack;
  
  			if ( pack != null )
  				pack.Delete();
  
  			pack = new StrongBackpack();
  			pack.Movable = false;
  
  			AddItem( pack );
  		}
  
  		public void CheckResistances()
  		{
  			if ( this.BodyValue == 400 || this.BodyValue == 401 )
  			{
  				if ( this.PhysicalResistanceSeed >= 0 )
  					this.PhysicalResistanceSeed = 0;
  
  				if ( this.FireResistSeed >= 0 )
  					this.FireResistSeed = 0;
  
  				if ( this.ColdResistSeed >= 0 )
  					this.ColdResistSeed = 0;
  
  				if ( this.PoisonResistSeed >= 0 )
  					this.PoisonResistSeed = 0;
  
  				if ( this.EnergyResistSeed >= 0 )
  					this.EnergyResistSeed = 0;
  
  				if ( this.PhysicalResistanceSeed <= 0 )
  					this.PhysicalResistanceSeed = 0;
  
  				if ( this.FireResistSeed <= 0 )
  					this.FireResistSeed = 0;
  
  				if ( this.ColdResistSeed <= 0 )
  					this.ColdResistSeed = 0;
  
  				if ( this.PoisonResistSeed <= 0 )
  					this.PoisonResistSeed = 0;
  
  				if ( this.EnergyResistSeed <= 0 )
  					this.EnergyResistSeed = 0;
  
  				if ( this.PhysicalResistance >= 70 )
  				{
  					int neg = this.PhysicalResistance - 70;
  					this.PhysicalResistanceSeed -= neg;
  				}
  
  				if ( this.FireResistance >= 70 )
  				{
  					int neg = this.FireResistance - 70;
  					this.FireResistSeed -= neg;
  				}
  
  				if ( this.ColdResistance >= 70 )
  				{
  					int neg = this.ColdResistance - 70;
  					this.ColdResistSeed -= neg;
  				}
  
  				if ( this.PoisonResistance >= 70 )
  				{
  					int neg = this.PoisonResistance - 70;
  					this.PoisonResistSeed -= neg;
  				}
  
  				if ( this.EnergyResistance >= 70 )
  				{
  					int neg = this.EnergyResistance - 70;
  					this.EnergyResistSeed -= neg;
  				}
  			}
  		}
  
  		public override bool OnDragDrop( Mobile from, Item item )
  		{
  			if ( CheckFeed( from, item ) )
  				return true;
  
  			if ( this.BodyValue == 400 || this.BodyValue == 401 && from == this.ControlMaster )
  			{
  				if ( item is BaseClothing && from == this.ControlMaster )
  				{
  					BaseClothing bc = (BaseClothing)item;
  					Item equ = this.FindItemOnLayer( bc.Layer );
  					
  					if ( bc.LootType == LootType.Blessed || bc.LootType == LootType.Newbied )
  						from.SendMessage( 53, "WARNING!!! If your pet dies while holding a blessed, insured, or newbied item. It will be lost forever." );
  
  					if ( equ != null)
  						from.AddToBackpack( equ );
  
  					this.EquipItem( bc );
  					this.CheckResistances();
  
  					return true;
  					
  				}
  				else if ( item is BaseArmor && from == this.ControlMaster )
  				{
  					BaseArmor ba = (BaseArmor)item;
  
  					Item equ = this.FindItemOnLayer( ba.Layer );
  
  					if ( ba.LootType == LootType.Blessed || ba.LootType == LootType.Newbied )
  						from.SendMessage( 53, "WARNING!!! If your pet dies while holding a blessed, insured, or newbied item. It will be lost forever." );
  
  					if ( equ != null)
  						from.AddToBackpack( equ );
  
  					if ( this.Str <= ba.StrRequirement )
  					{
  						from.SendMessage( "Your pet is not strong enough to wear this." );
  						from.AddToBackpack( ba );
  					}
  					else
  					{
  						this.EquipItem( ba );
  						this.CheckResistances();
  					}
  
  					return true;
  				}
  				else if ( item is BaseWeapon && from == this.ControlMaster )
  				{
  					BaseWeapon bw = (BaseWeapon)item;
  
  					Item weap = this.FindItemOnLayer( Layer.OneHanded );
  					Item shield = this.FindItemOnLayer( Layer.TwoHanded );
  
  					if ( bw.LootType == LootType.Blessed || bw.LootType == LootType.Newbied )
  						from.SendMessage( 53, "WARNING!!! If your pet dies while holding a blessed, insured, or newbied item. It will be lost forever." );
  
  					if ( weap != null)
  						from.AddToBackpack( weap );
  
  					if ( shield != null)
  						from.AddToBackpack( shield );
  
  					if ( this.Str <= bw.StrRequirement )
  					{
  						from.SendMessage( "Your pet is not strong enough to wear this." );
  						from.AddToBackpack( bw );
  					}
  					else
  					{
  						this.EquipItem( bw );
  						this.CheckResistances();
  					}
  
  					this.EquipItem( bw );
  					
  					return true;
  				}
  				else if ( item is BaseJewel && from == this.ControlMaster )
  				{
  					BaseJewel bj = (BaseJewel)item;
  
  					Item equ = this.FindItemOnLayer( bj.Layer );
  
  					if ( bj.LootType == LootType.Blessed || bj.LootType == LootType.Newbied )
  						from.SendMessage( 53, "Warning: The item you have droped on your pet is either blessed or newbied. If this pet is unbonded and dies you will lose this item." );
  
  					if ( equ != null)
  						from.AddToBackpack( equ );
  
  					this.EquipItem( bj );
  					this.CheckResistances();
  	
  					return true;
  				}
  				else if ( item is Lantern && from == this.ControlMaster )
  				{
  					Lantern l = (Lantern)item;
  
  					Item equ = this.FindItemOnLayer( l.Layer );
  
  					if ( l.LootType == LootType.Blessed || l.LootType == LootType.Newbied )
  						from.SendMessage( 53, "Warning: The item you have droped on your pet is either blessed or newbied. If this pet is unbonded and dies you will lose this item." );
  
  					if ( equ != null)
  						from.AddToBackpack( equ );
  
  					this.EquipItem( l );
  					this.CheckResistances();
  	
  					return true;
  				}
  				else if ( item is FishingPole && from == this.ControlMaster )
  				{
  					FishingPole fp = (FishingPole)item;
  
  					Item equ = this.FindItemOnLayer( fp.Layer );
  
  					if ( fp.LootType == LootType.Blessed || fp.LootType == LootType.Newbied )
  						from.SendMessage( 53, "Warning: The item you have droped on your pet is either blessed or newbied. If this pet is unbonded and dies you will lose this item." );
  
  					if ( equ != null)
  						from.AddToBackpack( equ );
  
  					this.EquipItem( fp );
  					this.CheckResistances();
  	
  					return true;
  				}
  				else if ( item is Torch && from == this.ControlMaster )
  				{
  					Torch t = (Torch)item;
  
  					Item equ = this.FindItemOnLayer( t.Layer );
  
  					if ( t.LootType == LootType.Blessed || t.LootType == LootType.Newbied )
  						from.SendMessage( 53, "Warning: The item you have droped on your pet is either blessed or newbied. If this pet is unbonded and dies you will lose this item." );
  
  					if ( equ != null)
  						from.AddToBackpack( equ );
  
  					this.EquipItem( t );
  					this.CheckResistances();
  	
  					return true;
  				}
  				else
  				{
  					if ( PackAnimal.CheckAccess( this, from ) )
  					{
  						AddToBackpack( item );
  						return true;
  					}
  				}
  			}
  			else
  			{
  				if ( PackAnimal.CheckAccess( this, from ) )
  				{
  					AddToBackpack( item );
  					return true;
  				}
  			}
  
  			return base.OnDragDrop( from, item );
  		}
  
  		public override void OnThink()
  		{
  			base.OnThink();
  
  			if ( this.Controlled == false )
  			{
  				this.Delete();
  			}
  
  			this.CheckResistances();
  		}
  
  		public override void AddNameProperties( ObjectPropertyList list )
  		{
  			base.AddNameProperties( list );
  
  			if ( m_Craftedby != null )
  				list.Add( 1060658, "Bio-engineered by\t{0}", m_Craftedby.Name.ToString() );
  		}
  
  		public override void OnSpeech(SpeechEventArgs e)
  		{
  			if ( e.Speech.ToLower().IndexOf( "status" ) > -1 )
  			{
  				e.Handled = true;
  				Mobile m = (Mobile)e.Mobile;
  				if ( m == this.ControlMaster )
  				{
  					m.SendGump( new AnimalLoreGump( this ) );
  				}
  				else
  				{
  					if ( this.BodyValue == 400 || this.BodyValue == 401  )
  					{
  						this.SayTo( m, "You are not my master" );
  					}
  					else
  					{
  						this.SayTo( m, "*looks confused*" );
  					}
  				}
  				
  			}
  
  			if ( e.Speech.ToLower().IndexOf( "skills" ) > -1 )
  			{
  				e.Handled = true;
  				Mobile m = (Mobile)e.Mobile;
  				if ( m == this.ControlMaster )
  				{
  					m.SendGump( new PetSkillsGump( this ) );
  				}
  				else
  				{
  					if ( this.BodyValue == 400 || this.BodyValue == 401  )
  					{
  						this.SayTo( m, "You are not my master" );
  					}
  					else
  					{
  						this.SayTo( m, "*looks confused*" );
  					}
  				}
  				
  			}
  
  			if ( e.Speech.ToLower().IndexOf( "ride" ) > -1 )
  			{
  				e.Handled = true;
  				Mobile m = (Mobile)e.Mobile;
  				if ( m == this.ControlMaster )
  				{
  					if ( this.BodyValue == 400 || this.BodyValue == 401  )
  					{
  						if ( this.Mounted == true )
  						{
  							this.SayTo( m, "I am already mounted" );
  						}
  						else
  						{
  							m.Target = new MountTarget( this, m );
  							m.SendMessage( "Select the mount you wish your bio human to ride" );
  						}
  					}
  					else
  					{
  						this.SayTo( m, "*looks confused*" );
  					}
  				}
  				else
  				{
  					if ( this.BodyValue == 400 || this.BodyValue == 401  )
  					{
  						this.SayTo( m, "You are not my master" );
  					}
  					else
  					{
  						this.SayTo( m, "*looks confused*" );
  					}
  				}
  				
  			}
  
  			if ( e.Speech.ToLower().IndexOf( "dismount" ) > -1 )
  			{
  				e.Handled = true;
  				Mobile m = (Mobile)e.Mobile;
  				if ( m == this.ControlMaster )
  				{
  					if ( this.BodyValue == 400 || this.BodyValue == 401 )
  					{
  						if ( this.Mounted == true )
  						{
  							IMount mount = this.Mount;
  							if ( mount != null )
  								mount.Rider = null;
  						}
  						else
  						{
  							this.SayTo( m, "I am not mounted." );
  						}
  
  					}
  					else
  					{
  						this.SayTo( m, "*looks confused*" );
  					}
  				}
  				else
  				{
  					if ( this.BodyValue == 400 || this.BodyValue == 401  )
  					{
  						this.SayTo( m, "You are not my master" );
  					}
  					else
  					{
  						this.SayTo( m, "*looks confused*" );
  					}
  				}
  				
  			}
  
  			if ( e.Speech.ToLower().IndexOf( "morph" ) > -1 )
  			{
  				e.Handled = true;
  				Mobile m = (Mobile)e.Mobile;
  				if ( m == this.ControlMaster )
  				{
  					if ( this.BodyValue == 400 || this.BodyValue == 401 || this.BodyValue == 469 || this.BodyValue == 447 )
  					{
  						if ( this.BodyValue == 400 )
  						{
  							if ( this.Mounted == true )
  							{
  								IMount mount = this.Mount;
  								if ( mount != null )
  									mount.Rider = null;
  							}
  
  							this.BodyValue = 469;
  						}
  						else if ( this.BodyValue == 401 )
  						{
  							if ( this.Mounted == true )
  							{
  								IMount mount = this.Mount;
  								if ( mount != null )
  									mount.Rider = null;
  							}
  
  							this.BodyValue = 447;
  						}
  						else if ( this.BodyValue == 469 )
  						{
  							this.BodyValue = 400;
  						}
  						else if ( this.BodyValue == 447 )
  						{
  							this.BodyValue = 401;
  						}
  					
  						m.SendMessage( "Your pet has morphed" );
  					}
  					else
  					{
  						this.SayTo( m, "*looks confused*" );
  					}
  				}
  				else
  				{
  					if ( this.BodyValue == 400 || this.BodyValue == 401  )
  					{
  						this.SayTo( m, "You are not my master" );
  					}
  					else
  					{
  						this.SayTo( m, "*looks confused*" );
  					}
  				}
  				
  			}
  
  			if ( e.Speech.ToLower().IndexOf( "undress" ) > -1 )
  			{
  				e.Handled = true;
  				Mobile m = (Mobile)e.Mobile;
  				if ( m == this.ControlMaster )
  				{
  					if ( this.BodyValue == 400 || this.BodyValue == 401 )
  					{
  						Item one = this.FindItemOnLayer( Layer.OneHanded );
  						Item two = this.FindItemOnLayer( Layer.TwoHanded );
  						Item shoes = this.FindItemOnLayer( Layer.Shoes );
  						Item pants = this.FindItemOnLayer( Layer.Pants );
  						Item shirt = this.FindItemOnLayer( Layer.Shirt );
  						Item helm = this.FindItemOnLayer( Layer.Helm );
  						Item gloves = this.FindItemOnLayer( Layer.Gloves );
  						Item ring = this.FindItemOnLayer( Layer.Ring );
  						Item neck = this.FindItemOnLayer( Layer.Neck );
  						Item waist = this.FindItemOnLayer( Layer.Waist );
  						Item innert = this.FindItemOnLayer( Layer.InnerTorso );
  						Item bracelet = this.FindItemOnLayer( Layer.Bracelet );
  						Item middlet = this.FindItemOnLayer( Layer.MiddleTorso );
  						Item earrings = this.FindItemOnLayer( Layer.Earrings );
  						Item arms = this.FindItemOnLayer( Layer.Arms );
  						Item cloak = this.FindItemOnLayer( Layer.Cloak );
  						Item outtert = this.FindItemOnLayer( Layer.OuterTorso );
  						Item outterl = this.FindItemOnLayer( Layer.OuterLegs );
  						Item innerl = this.FindItemOnLayer( Layer.InnerLegs );
  
  						if ( one == null && two == null && shoes == null && pants == null && shirt == null && helm == null && gloves == null && ring == null && neck == null && waist == null && innert == null && bracelet == null && middlet == null && earrings == null && arms == null && cloak == null && outtert == null && outterl == null && innerl == null )
  						{
  							this.SayTo( m, "I am already naked." );
  						}
  						else
  						{
  							if ( one != null)
  								this.AddToBackpack( one );
  
  							if ( two != null)
  								this.AddToBackpack( two );
  
  							if ( shoes != null)
  								this.AddToBackpack( shoes );
  
  							if ( pants != null)
  								this.AddToBackpack( pants );
  
  							if ( shirt != null)
  								this.AddToBackpack( shirt );
  
  							if ( helm != null)
  								this.AddToBackpack( helm );
  
  							if ( gloves != null)
  								this.AddToBackpack( gloves );
  
  							if ( ring != null)
  								this.AddToBackpack( ring );
  
  
gt: 							if ( neck != null)