/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\engines\PlagueBeastLordQuest\Items\Organo_Pulpo.cs
Lines of code: 67
***********************************************************/


using System;
using Server;
using Server.Network;
using Server.Mobiles;

namespace Server.Items
{
	public class Organo_Pulpo : BaseOrgano
	{
		private Item m_Wound;

		public Organo_Pulpo( BrainTypes cerebro ) : base( 6002, PlagueHelper.Line[15], 296, cerebro )
		{
			Weight = 0;
		}
       
		public Organo_Pulpo( Serial serial ) : base( serial )
		{
		}

		public override void CreateTissue()
		{
			PutGuts( new Plague_deco( 6938, PlagueHelper.Line[26], Hue, false, true) , -17, 32 );
			PutGuts( new Plague_deco( 6937, PlagueHelper.Line[26], Hue, false, true) , 13, 32 );

			m_Wound = new Plague_deco( 4650, PlagueHelper.Line[8], 1, false, false );
			PutGuts( m_Wound, 1, 13 );

		    MyBrain = new PlagueBrain( HeldBrainType );
		    PutGuts( MyBrain, 0, 20 );
			PlagueBrain brain = MyBrain as PlagueBrain;

			brain.CreateTissue( -4, -5 );
		}

		public override void OpenOrganTo( Mobile from )
		{
			PlagueBeastLord plaguebl = RootParent as PlagueBeastLord;
			if ( plaguebl == null )
				return;

			from.Direction = from.GetDirectionTo( plaguebl );
			if ( IsOpened )
			{
				from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, PlagueHelper.Line[21] );
			}
			else
			{
				from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, PlagueHelper.Line[22] );
				from.PlaySound( 0x248 );
				from.PlaySound( 0x2AC );
				m_Wound.Visible = true;

				base.OpenOrganTo(from);
				if (HeldBrainType == BrainTypes.Brain_None)
				{
					PlagueBrain brain = MyBrain as PlagueBrain;
					brain.MakeBleed( from );
				}
			}
		}

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

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

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

			int version = reader.ReadInt();
			m_Wound = reader.ReadItem();

			if ( m_Wound == null )
				Delete();
		}
	}
}
