/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\mobiles\PoisonIvySpawn.cs
Lines of code: 88
***********************************************************/


using System;
using System.Collections;
using Server;
using Server.Network;
using Server.Items;
using Server.Targeting;
using Server.Mobiles;

namespace Server.Mobiles
{
	[CorpseName("an ivy corpse")]
	public class PoisonIvySpawn : BaseCreature
	{
		
		public override WeaponAbility GetWeaponAbility()
		{
			return WeaponAbility.CrushingBlow;
		}

		[Constructable]
		public PoisonIvySpawn() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "a poison ivy";
			Body = 8;
			Hue = 67;
			BaseSoundID = 684;

			SetStr( 161, 360 );
			SetDex( 151, 300 );
			SetInt( 21, 40 );

			SetHits( 156, 187 );

			SetDamage( 10, 28 );

			SetDamageType( ResistanceType.Physical, 50 );
			SetDamageType( ResistanceType.Poison, 50 );

			SetResistance( ResistanceType.Physical, 60, 70 );
			SetResistance( ResistanceType.Fire, 50, 60 );
			SetResistance( ResistanceType.Cold, 30, 40 );
			SetResistance( ResistanceType.Poison, 100 );
			SetResistance( ResistanceType.Energy, 100 );

			SetSkill( SkillName.Poisoning, 90.1, 100.0 );
			SetSkill( SkillName.MagicResist, 95.1, 100.0 );
			SetSkill( SkillName.Tactics, 80.1, 95.0 );
			SetSkill( SkillName.Wrestling, 120 );

			Fame = 2000;
			Karma = -2000;

			VirtualArmor = 40;
			PackItem( new Log( 10 ) );
			PackItem( new Nightshade( 10 ) );
			PackItem( new MandrakeRoot( 3 ) );
			PackItem( new MandrakeRoot( 3 ) );
		}

		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override Poison HitPoison{ get{ return Poison.Lethal; } }
		public override double HitPoisonChance{ get{ return 0.5; } }
		public override bool DisallowAllMoves{ get{ return true; } }
		
		public override void OnDamagedBySpell(Mobile attacker)
		{
			if (!attacker.InRange( this, 1 ) && this.InLOS( attacker ))
			{
				attacker.SendMessage( "The ivy throws a toxic spike at you");
				attacker.ApplyPoison( this, Poison.Lethal );
				Effects.SendPacket( attacker, attacker.Map, new HuedEffect( EffectType.Moving, Serial.Zero, Serial.Zero, 0xC7B, this.Location, attacker.Location, 10, 0, false, false, 68, 0 ) );
				AOS.Damage( attacker, this, Utility.RandomMinMax( 40, 60 ), 0, 0, 0, 100, 0 );
			}
		}
		
		public override void OnGotMeleeAttack( Mobile attacker )
		{
			if (!attacker.InRange( this, 1 ) && this.InLOS( attacker )) 
			{
			attacker.SendMessage( "The ivy throws a toxic spike at you");
			attacker.ApplyPoison( this, Poison.Lethal );
			Effects.SendPacket( attacker, attacker.Map, new HuedEffect( EffectType.Moving, Serial.Zero, Serial.Zero, 0xC7B, this.Location, attacker.Location, 10, 0, false, false, 68, 0 ) );
			AOS.Damage( attacker, this, Utility.RandomMinMax( 15, 35 ), 0, 0, 0, 100, 0 );
			}
		}
		
		public PoisonIvySpawn(Serial serial) : base(serial)
		{
		}

		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();

			if ( BaseSoundID == -1 )
				BaseSoundID = 219;
		}
	}
}