ACTOR Sword : Weapon
{
	+WEAPON.MELEEWEAPON
	+NOALERT
	Weapon.SelectionOrder 2800
	States
	{
	Ready:
	    TNT1 A 0 A_JumpIfInventory("Punched", 1, "ReadyPunched")
		SWRD A 1 A_WeaponReady
		Loop
		ReadyPunched:
		     SWRD E 1 A_WeaponReady
			 Goto Ready
	Deselect:
	    TNT1 A 0 A_JumpIfInventory("Punched", 1, "DeselectPunched")
	    SWRD A 0 A_Lower
		SWRD A 1 A_Lower
		SWRD A 0 A_TakeInventory("SwordSelect",1)
		Loop
		    DeselectPunched:
			    SWRD E 0 A_Lower
		        SWRD E 1 A_Lower
		        SWRD E 0 A_TakeInventory("SwordSelect",1)
		        Loop
	Select:
	    TNT1 A 0 A_JumpIfInventory("Punched", 1, "SelectPunched")
	    SWRD A 0 A_Playsound("STICKY2R")
		TNT1 A 0 A_PlaySound("LoWang/Sword", 6)
		SWRD A 0 A_Raise
		SWRD A 1 A_Raise
		SWRD A 0 A_GiveInventory("SwordSelect",1)
		Goto Select+3
		     SelectPunched:
			     SWRD E 0 A_Playsound("STICKY2R")
				 TNT1 A 0 A_PlaySound("LoWang/Sword", 6)
		         SWRD E 0 A_Raise
		         SWRD E 1 A_Raise
		         SWRD E 0 A_GiveInventory("SwordSelect",1)
		         Goto SelectPunched+2
		
//----------------------Fire, This is random states---------------------------//	
	Fire:
	    TNT1 A 0 A_JumpIfInventory("Punched", 1, "FirePunched")
        SWRD A 1 A_Jump(256,"Fire1","Fire2")
		Goto ready
//----------------------------------------------------------------------------//
		
//---------------From the right to the lower left corner----------------------//
	Fire1:
	    NULL A 1
		SWRD B 2 A_Playsound("SWRDSTR1")
		SWRD C 1 
		SWRD C 1 offset(-62, 32)
		SWRD D 1 offset(1, 32) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWRD D 1 offset(-29, 48)
		SWRD D 1 offset(-58, 64)
	    SWRD D 1 offset(-87, 98)
		SWRD D 1 offset(-116, 116)
	    NULL A 5 
		NULL A 0 A_ReFire
		SWRD A 1 offset(1, 142)A_WeaponReady(1)
		SWRD A 1 offset(1, 133)A_WeaponReady(1)
	    SWRD A 1 offset(1, 124)A_WeaponReady(1)
	    SWRD A 1 offset(1, 106)A_WeaponReady(1)
	    SWRD A 1 offset(1, 97)A_WeaponReady(1)
	    SWRD A 1 offset(1, 88)A_WeaponReady(1)
		SWRD A 1 offset(1, 70)A_WeaponReady(1)
		SWRD A 1 offset(1, 60)A_WeaponReady(1)
		SWRD A 1 offset(1, 52)A_WeaponReady(1)
		SWRD A 1 offset(1, 34)A_WeaponReady(1)
		SWRD A 1 offset(1, 32)A_WeaponReady(1)
		Goto Ready
//----------------------------------------------------------------------------//	
	
//-----------------------From the right in the middle-------------------------//
	Fire2:
	    NULL A 1
		SWRD B 2 A_Playsound("SWRDSTR1")
		SWRD C 1 
		SWRD C 1 offset(-30, 32)
		SWRD D 1 offset(10, 42) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWRD D 1 offset(-8, 69)
	    SWRD D 1 offset(-27, 97)
		SWRD D 1 offset(-65, 154)
		SWRD D 1 offset(-86, 183)
		NULL A 8
		NULL A 0 A_ReFire
		SWRD A 1 offset(1, 142)A_WeaponReady(1)
		SWRD A 1 offset(1, 133)A_WeaponReady(1)
	    SWRD A 1 offset(1, 124)A_WeaponReady(1)
	    SWRD A 1 offset(1, 106)A_WeaponReady(1)
	    SWRD A 1 offset(1, 97)A_WeaponReady(1)
	    SWRD A 1 offset(1, 88)A_WeaponReady(1)
		SWRD A 1 offset(1, 70)A_WeaponReady(1)
		SWRD A 1 offset(1, 60)A_WeaponReady(1)
		SWRD A 1 offset(1, 52)A_WeaponReady(1)
		SWRD A 1 offset(1, 34)A_WeaponReady(1)
		SWRD A 1 offset(1, 32)A_WeaponReady(1)
		Goto Ready
//----------------------------------------------------------------------------//



//If you hiting monster -----> Bloody Sprites XD))) (Sorry my inglish is bad)
	FirePunched:
        SWRD E 1 A_Jump(256,"Fire1Punched","Fire2Punched")
		Goto ready
//----------------------------------------------------------------------------//
		
//---------------From the right to the lower left corner----------------------//
	Fire1Punched:
	    TNT1 A 1
		SWRD F 2 A_Playsound("SWRDSTR1")
		SWRD G 1 
		SWRD G 1 offset(-62, 32)
		SWRD H 1 offset(1, 32) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWRD H 1 offset(-29, 48)
		SWRD H 1 offset(-58, 64)
	    SWRD H 1 offset(-87, 98)
		SWRD H 1 offset(-116, 116)
	    TNT1 A 5 
		TNT1 A 0 A_ReFire
		SWRD E 1 offset(1, 142)A_WeaponReady(1)
		SWRD E 1 offset(1, 133)A_WeaponReady(1)
	    SWRD E 1 offset(1, 124)A_WeaponReady(1)
	    SWRD E 1 offset(1, 106)A_WeaponReady(1)
	    SWRD E 1 offset(1, 97)A_WeaponReady(1)
	    SWRD E 1 offset(1, 88)A_WeaponReady(1)
		SWRD E 1 offset(1, 70)A_WeaponReady(1)
		SWRD E 1 offset(1, 60)A_WeaponReady(1)
		SWRD E 1 offset(1, 52)A_WeaponReady(1)
		SWRD E 1 offset(1, 34)A_WeaponReady(1)
		SWRD E 1 offset(1, 32)A_WeaponReady(1)
		Goto Ready
//----------------------------------------------------------------------------//	
	
//-----------------------From the right in the middle-------------------------//
	Fire2Punched:
	    TNT1 A 1
		SWRD F 2 A_Playsound("SWRDSTR1")
		SWRD G 1 
		SWRD G 1 offset(-30, 32)
		SWRD H 1 offset(10, 42) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWRD H 1 offset(-8, 69)
	    SWRD H 1 offset(-27, 97)
		SWRD H 1 offset(-65, 154)
		SWRD H 1 offset(-86, 183)
		TNT1 A 8
		TNT1 A 0 A_ReFire
		SWRD E 1 offset(1, 142)A_WeaponReady(1)
		SWRD E 1 offset(1, 133)A_WeaponReady(1)
	    SWRD E 1 offset(1, 124)A_WeaponReady(1)
	    SWRD E 1 offset(1, 106)A_WeaponReady(1)
	    SWRD E 1 offset(1, 97)A_WeaponReady(1)
	    SWRD E 1 offset(1, 88)A_WeaponReady(1)
		SWRD E 1 offset(1, 70)A_WeaponReady(1)
		SWRD E 1 offset(1, 60)A_WeaponReady(1)
		SWRD E 1 offset(1, 52)A_WeaponReady(1)
		SWRD E 1 offset(1, 34)A_WeaponReady(1)
		SWRD E 1 offset(1, 32)A_WeaponReady(1)
		Goto Ready
//----------------------------------------------------------------------------//

		
//--------------------------Hold Random States--------------------------------//
	Hold6:
	    SWRD A 1 A_Jump(256,"Hold1", "Hold4", "Hold3", "Hold2" )
		Goto Ready
//----------------------------------------------------------------------------//
		
//------------From the right in the middle and left of the middle-------------//
	Hold4:
	    NULL A 3 A_JumpIf(ACS_ExecuteWithResult(288, 0,0,0) == 0, "HoldEnd")
        SWRD C 1 offset(80, 32) A_Playsound("SWRDSTR1")
		SWRD C 1 offset(50, 32)
		SWRD D 1 offset(89, 43) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		TNT1 A 0 A_GiveInventory("LoWangPunchTaunt", 1)
		SWRD D 1 offset(72, 70)
		SWRD D 1 offset(53, 97)
		SWRD D 1 offset(15, 154)
		NULL A 9
		SWR1 A 1 offset(1,32) A_Playsound("SWRDSTR1")
		SWR1 B 1 offset(1,32)
		SWR1 B 1 offset(30,32)
		SWR1 A 1 offset(107,58) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWR1 A 1 offset(126,85)
		SWR1 A 1 offset(143,113)
		SWR1 A 1 offset(182,171)
		TNT1 A 9
		TNT1 A 1 A_ReFire
		Goto HoldEnd
//----------------------------------------------------------------------------//	

//---From the right to the lower left corner and in the middle of the left----//	
	 Hold3:
	    NULL A 3 A_JumpIf(ACS_ExecuteWithResult(288, 0,0,0) == 0, "HoldEnd")
		SWRD C 1 offset(79, 32) A_Playsound("SWRDSTR1")
		SWRD C 1 offset(55, 32)
		SWRD C 1 offset(18, 32)
		SWRD D 1 offset(75, 39)  A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWRD D 1 offset(44, 33)
		SWRD D 1 offset(-20, 49)
		SWRD D 1 offset(-54, 57)
		SWRD D 1 offset(-123, 75)
		SWRD D 1 offset(-159, 84)
		NULL A 3
		SWR1 A 1 offset(1,32) A_Playsound("SWRDSTR1") 
		SWR1 B 1 offset(1,32)
		SWR1 B 1 offset(30,32)
		SWR1 A 1 offset(107,58) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWR1 A 1 offset(126,85)
		SWR1 A 1 offset(143,113)
		SWR1 A 1 offset(182,171)
		NULL A 10
		NULL A 0 A_Jump(256,"Hold4","Hold")
		NULL A 0 A_ReFire
		Goto HoldEnd
//----------------------------------------------------------------------------//	
		
//From the left to the lower right corner from the right and the lower left corner//	
//-------------------First Hold Now-------------------------------------------//	
	Hold:
	    TNT1 A 0 A_JumpIfInventory("Punched", 1, "HoldPunched")
		NULL A 3 A_JumpIf(ACS_ExecuteWithResult(288, 0,0,0) == 0, "HoldEnd")
		SWR1 B 1 offset(1, 32) A_Playsound("SWRDSTR1")
		SWR1 B 1 offset(29, 32)
		SWR1 B 1 offset(66, 32)
		SWR1 A 1 offset(152, 48) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWR1 A 1 offset(185, 56)
		SWR1 A 1 offset(217, 65)
		SWR1 A 1 offset(287, 82)
		SWR1 A 1 offset(322, 91)
		NULL A 2
		SWRD C 1 offset(79, 32) A_Playsound("SWRDSTR1")
		SWRD C 1 offset(55, 32)
		SWRD C 1 offset(18, 32)
		SWRD D 1 offset(75, 39) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)  
		SWRD D 1 offset(44, 33)
		SWRD D 1 offset(-20, 49)
		SWRD D 1 offset(-54, 57)
		SWRD D 1 offset(-123, 75)
		//SWRD D 1 offset(-159, 84)
		NULL A 3
		NULL A 0 A_Jump(256,"Hold1","Hold")
		NULL A 0 A_ReFire
		Goto HoldEnd
//----------------------------------------------------------------------------//

//---From the left to the lower right corner from the right and the middle----//
	Hold1:
	    NULL A 3 A_JumpIf(ACS_ExecuteWithResult(288, 0,0,0) == 0, "HoldEnd")
	    SWR1 A 1 offset(1,32) A_Playsound("SWRDSTR1")
		SWR1 B 1 offset(1,32)
		SWR1 B 1 offset(30,32)
		SWR1 B 1 offset(61,32)
		SWR1 A 1 offset(147,64) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		TNT1 A 0 A_GiveInventory("LoWangPunchTaunt", 1)
		SWR1 A 1 offset(176,81)
		SWR1 A 1 offset(235,115)
		SWR1 A 1 offset(267,133)
		SWR1 A 1 offset(299,151)
		SWR1 A 1 offset(332,170)
		NULL A 6
        SWRD C 1 offset(80, 32) A_Playsound("SWRDSTR1")
		SWRD C 1 offset(50, 32)
		SWRD D 1 offset(89, 43) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWRD D 1 offset(72, 70) 
		SWRD D 1 offset(53, 97)
		SWRD D 1 offset(15, 154)
		NULL A 10 
		NULL A 0 A_Jump(256,"Hold3","Hold")
		NULL A 0 A_ReFire
		Goto HoldEnd
//----------------------------------------------------------------------------//	

//--------------------------Hold Punched Random States--------------------------------//
	Hold6Punched:
	    SWRD A 1 A_Jump(256,"Hold1Punched", "Hold4Punched", "Hold3Punched", "Hold2Punched" )
		Goto Ready
//----------------------------------------------------------------------------//
		
//------------From the right in the middle and left of the middle-------------//
	Hold4Punched:
	    TNT1 A 3 A_JumpIf(ACS_ExecuteWithResult(288, 0,0,0) == 0, "HoldEndPunched")
        SWRD G 1 offset(80, 32) A_Playsound("SWRDSTR1")
		SWRD G 1 offset(50, 32)
		SWRD H 1 offset(89, 43) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		TNT1 A 0 A_GiveInventory("LoWangPunchTaunt", 1)
		SWRD H 1 offset(72, 70)
		SWRD H 1 offset(53, 97)
		SWRD H 1 offset(15, 154)
		TNT1 A 9
		SWR1 C 1 offset(1,32) A_Playsound("SWRDSTR1")
		SWR1 D 1 offset(1,32)
		SWR1 D 1 offset(30,32)
		SWR1 C 1 offset(107,58) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWR1 C 1 offset(126,85)
		SWR1 C 1 offset(143,113)
		SWR1 C 1 offset(182,171)
		TNT1 A 9
		TNT1 A 1 A_ReFire
		Goto HoldEndPunched
//----------------------------------------------------------------------------//	

//---From the right to the lower left corner and in the middle of the left----//	
	 Hold3Punched:
	    TNT1 A 3 A_JumpIf(ACS_ExecuteWithResult(288, 0,0,0) == 0, "HoldEndPunched")
		SWRD G 1 offset(79, 32) A_Playsound("SWRDSTR1")
		SWRD G 1 offset(55, 32)
		SWRD G 1 offset(18, 32)
		SWRD H 1 offset(75, 39)  A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85) 
		SWRD H 1 offset(44, 33)
		SWRD H 1 offset(-20, 49)
		SWRD H 1 offset(-54, 57)
		SWRD H 1 offset(-123, 75)
		SWRD H 1 offset(-159, 84)
		TNT1 A 3
		SWR1 C 1 offset(1,32) A_Playsound("SWRDSTR1") 
		SWR1 D 1 offset(1,32)
		SWR1 D 1 offset(30,32)
		SWR1 C 1 offset(107,58) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWR1 C 1 offset(126,85)
		SWR1 C 1 offset(143,113)
		SWR1 C 1 offset(182,171)
		TNT1 A 10
		TNT1 A 0 A_Jump(256,"Hold4Punched","HoldPunched")
		TNT1 A 0 A_ReFire
		Goto HoldEndPunched
//----------------------------------------------------------------------------//	
		
//From the left to the lower right corner from the right and the lower left corner//	
//-------------------First Hold Now-------------------------------------------//	
	HoldPunched:
	    TNT1 A 3 A_JumpIf(ACS_ExecuteWithResult(288, 0,0,0) == 0, "HoldEndPunched")
		SWR1 D 1 offset(1, 32) A_Playsound("SWRDSTR1")
		SWR1 D 1 offset(29, 32)
		SWR1 D 1 offset(66, 32)
		SWR1 C 1 offset(152, 48) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWR1 C 1 offset(185, 56)
		SWR1 C 1 offset(217, 65)
		SWR1 C 1 offset(287, 82)
		SWR1 C 1 offset(322, 91)
		TNT1 A 2
		SWRD G 1 offset(79, 32) A_Playsound("SWRDSTR1")
		SWRD G 1 offset(55, 32)
		SWRD G 1 offset(18, 32)
		SWRD H 1 offset(75, 39) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWRD H 1 offset(44, 33)
		SWRD H 1 offset(-20, 49)
		SWRD H 1 offset(-54, 57)
		SWRD H 1 offset(-123, 75)
		//SWRD D 1 offset(-159, 84)
		TNT1 A 3
		TNT1 A 0 A_Jump(256,"Hold1Punched","HoldPunched")
		TNT1 A 0 A_ReFire
		Goto HoldEnd
//----------------------------------------------------------------------------//

//---From the left to the lower right corner from the right and the middle----//
	Hold1Punched:
	    TNT1 A 3 A_JumpIf(ACS_ExecuteWithResult(288, 0,0,0) == 0, "HoldEndPunched")
	    SWR1 C 1 offset(1,32) A_Playsound("SWRDSTR1")
		SWR1 D 1 offset(1,32)
		SWR1 D 1 offset(30,32)
		SWR1 D 1 offset(61,32)
		SWR1 C 1 offset(147,64) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		TNT1 A 0 A_GiveInventory("LoWangPunchTaunt", 1)
		SWR1 C 1 offset(176,81)
		SWR1 C 1 offset(235,115)
		SWR1 C 1 offset(267,133)
		SWR1 C 1 offset(299,151)
		SWR1 C 1 offset(332,170)
		TNT1 A 6
        SWRD G 1 offset(80, 32) A_Playsound("SWRDSTR1")
		SWRD G 1 offset(50, 32)
		SWRD H 1 offset(89, 43) A_FireBullets(2, 3, 1, 90, "SwordPuff", FBF_NORANDOM, 85)
		SWRD H 1 offset(72, 70) 
		SWRD H 1 offset(53, 97)
		SWRD H 1 offset(15, 154)
		TNT1 A 10 
		TNT1 A 0 A_Jump(256,"Hold3Punched","HoldPunched")
		TNT1 A 0 A_ReFire
		Goto HoldEndPunched
//----------------------------------------------------------------------------//

//-------------------It's Hold End animation----------------------------------//
	HoldEnd:
	    SWRD A 0 A_ClearRefire
	    SWRD A 1 offset(1, 142)A_WeaponReady(1)
		SWRD A 1 offset(1, 133)A_WeaponReady(1)
	    SWRD A 1 offset(1, 124)A_WeaponReady(1)
	    SWRD A 1 offset(1, 106)A_WeaponReady(1)
	    SWRD A 1 offset(1, 97)A_WeaponReady(1)
	    SWRD A 1 offset(1, 88)A_WeaponReady(1)
		SWRD A 1 offset(1, 70)A_WeaponReady(1)
		SWRD A 1 offset(1, 60)A_WeaponReady(1)
		SWRD A 1 offset(1, 52)A_WeaponReady(1)
		SWRD A 1 offset(1, 34)A_WeaponReady(1)
		SWRD A 1 offset(1, 32)A_WeaponReady(1)
		Goto Ready
//----------------------------------------------------------------------------//		

//-------------------It's Hold End Punched animation--------------------------//
	HoldEndPunched:
	    SWRD E 0 A_ClearRefire
	    SWRD E 1 offset(1, 142)A_WeaponReady(1)
		SWRD E 1 offset(1, 133)A_WeaponReady(1)
	    SWRD E 1 offset(1, 124)A_WeaponReady(1)
	    SWRD E 1 offset(1, 106)A_WeaponReady(1)
	    SWRD E 1 offset(1, 97)A_WeaponReady(1)
	    SWRD E 1 offset(1, 88)A_WeaponReady(1)
		SWRD E 1 offset(1, 70)A_WeaponReady(1)
		SWRD E 1 offset(1, 60)A_WeaponReady(1)
		SWRD E 1 offset(1, 52)A_WeaponReady(1)
		SWRD E 1 offset(1, 34)A_WeaponReady(1)
		SWRD E 1 offset(1, 32)A_WeaponReady(1)
		Goto Ready
//----------------------------------------------------------------------------//		

		}
}
//----------------------------------------------------------------------------//
//--------It's Special Select Inventory. It's using in Player code------------//
actor SwordSelect : inventory 
{
   Inventory.MaxAmount 1
   +INVENTORY.UNDROPPABLE
   -INVENTORY.INVBAR
   States
   {
   Spawn:
      TNT1 A 1
      Stop
   }
   
}
//----------------------------------------------------------------------------//