
//Dusk damage chart (type: Dmg)
//SP: 25
//MP: 50

const int SicklesDmg = 25;
//const int SicklesDrunkDmg = 75;
const int SicklesRange = 90;


//Portable Foxy's Hook.
ACTOR Dusk_Sickles : DuskWeapon replaces fist
{
	Weapon.SelectionOrder 100
Weapon.Slotnumber 1
//	Weapon.SisterWeapon Dusk_Sickles_Fastfire

	+WEAPON.NOALERT
	+WEAPON.MELEEWEAPON

	Weapon.UpSound "sickles/raise"
	Inventory.PickupMessage "$SICK_PICK"
	Obituary "$SICK_OB"
	Tag "Sickles"
	States
	{
	Ready:
TNT1 A 0 A_JumpIfInventory("Doosk_ExplosiveBarrelWeapon",1,"Select_Barrel")
TNT1 A 0 A_JumpIfInventory("Doosk_HereticBarrelWeapon",1,"Select_HereticBarrel")
TNT1 A 0 A_JumpIfInventory("Doosk_SoapWeapon",1,"Select_Soap")

		W01C A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
	Deselect:
    TNT1 A 0 A_TakeInventory("SetWeaponMemory",50)
    TNT1 A 0 A_GiveInventory("SetWeaponMemory",1)
	DeselectLoop:
		TST1 AAA 0 A_Lower
		TST1 A 1 A_Lower
		Loop
	Select:
		TNT1 A 0 A_SetCrosshair(10)
    TNT1 A 0 A_TakeInventory("SetWeaponActual",50)
    TNT1 A 0 A_GiveInventory("SetWeaponActual",1)

//TNT1 A 0 A_JumpIfInventory("Mighty_Sickles", 1, "Fire")

//		TNT1 A 4 A_WeaponReady//(WRF_NOFIRE)
		W01A ABCDEFGHIJKLMNOPQ 1 A_WeaponReady//(WRF_NOFIRE)
		Goto Ready


	Reload://Weapon spin
	TNT1 A 0 A_PlaySound("sickles/fire")
		W01D ABCDE 1 A_WeaponReady
		W01D FGHIJKLMNOPQRSTUVW 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready
		

	Fire:
		TNT1 A 0 A_Gunflash
		TNT1 A 0 A_JumpIfInventory("Weapon_Fireleft", 1, "Fire_Left")	 

		TNT1 A 0 A_GiveInventory("Weapon_Fireleft", 1)
		Goto Fire_Continue

	Fire_Left:
        TNT1 A 0 A_TakeInventory("Weapon_Fireleft", 2)
		Goto Fire_Continue



	Fire_Continue:
		TNT1 A 0 A_JUMP(128, "Fire_Continue_AltAnim")//Jumps into random muzzleflashes animaitons.
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",31,"Fire_Continue_Stacked2")
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",1,"Fire_Continue_Stacked1")
			W01H A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W01G A 0
		"####" ABCDEFGH 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" IJKLMNOPQRST 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Continue_AltAnim:
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",31,"Fire_Continue_AltAnim_Stacked2")
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",1,"Fire_Continue_AltAnim_Stacked1")

			W01F A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W01I A 0
		"####" ABCDEFGH 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" IJKLMNOP 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready




	Fire_Continue_Stacked1:
//		TNT1 A 0 A_JUMP(128, "Fire_Continue_AltAnim_Stacked1")//Jumps into random muzzleflashes animaitons.
			W01H A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W01G A 0
		"####" ABCD 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" EFGHIJKLMNOPQRST 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready

	Fire_Continue_AltAnim_Stacked1:
			W01F A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W01I A 0
		"####" ABCD 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" EFGHIJKLMNOP 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready




	Fire_Continue_Stacked2:
			W01H A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W01G A 0
			//compensating lack of extra speed with double damage
		"####" A 0 A_CustomPunch(SicklesDmg, TRUE, 0, "SicklesPuff", SicklesRange)//A_Punch
		"####" ABCD 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" EFGHIJKLMNOPQRST 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready

	Fire_Continue_AltAnim_Stacked2:
			W01F A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W01I A 0
			//compensating lack of extra speed with double damage
		"####" A 0 A_CustomPunch(SicklesDmg, TRUE, 0, "SicklesPuff", SicklesRange)//A_Punch
		"####" ABCD 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" EFGHIJKLMNOP 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready










	Flash:
//		TNT1 A 0 A_SetReflective//The invulnerable version of this code has a bug, once deactivated it makes people with invulnerability vulnerable.
//		TNT1 A 0 A_GiveInventory("3ticinvul", 1)
//TNT1 A 0 A_TakeInventory("Mighty_Sickles",1)
		W01G A 0 A_CustomPunch(SicklesDmg, TRUE, 0, "SicklesPuff", SicklesRange)//A_Punch
		TNT1 A 1 A_PlaySound("sickles/fire", CHAN_WEAPON)
//		TNT1 A 0 A_UnSetReflective


	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("MultiplayerCheck",0,0,0,0) == 2,"Flash_NoActorMode")
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",1,	"Flash_2xjump")
TNT1 A 0 A_JumpIf(CallACS("SicklesType")==3, "Flash_ModernGZDmode")
TNT1 A 0 A_JumpIf(CallACS("SicklesType")==2, "Flash_Dooskmode")
TNT1 A 0 A_JumpIf(CallACS("SicklesType")==1, "Flash_Vanillamode")



	Flash_NoActorMode://For multiplayer mode.
		TNT1 A 1 //A_SpawnItemEx("Sickles_BlockProjectileOnly",40,0,0,  0,0,0  ,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		Goto LightDone	

	Flash_NoDeflectionMode:
		TNT1 A 1 A_SpawnItemEx("Sickles_BlockProjectileOnly",40,0,0,  0,0,0  ,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		Goto LightDone	

	Flash_VanillaMode:
		TNT1 A 1 A_SpawnItemEx("Sickles_BlockProjectileAttacks",40,0,0,  0,0,0  ,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		Goto LightDone	

	Flash_DooskMode:
		TNT1 A 1 A_SpawnItemEx("Sickles_BlockDooskProjectileAttacks",40,0,0,  0,0,0  ,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		Goto LightDone	

	Flash_ModernGZDMode:
		TNT1 A 1 A_SpawnItemEx("Sickles_AimReflectProjectileAttacks",40,0,0,  0,0,0  ,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		Goto LightDone	






//2x flash variant

	Flash_2xjump://For multiplayer mode.
TNT1 A 0 A_JumpIf(CallACS("SicklesType")==3, "Flash_ModernGZDmode_2x")
TNT1 A 0 A_JumpIf(CallACS("SicklesType")==2, "Flash_Dooskmode_2x")
TNT1 A 0 A_JumpIf(CallACS("SicklesType")==1, "Flash_Vanillamode_2x")
Goto Flash_NoActormode



	Flash_NoDeflectionMode_2x:
		TNT1 A 1 A_SpawnItemEx("Sickles_BlockProjectileOnly_2x",40,0,0,  0,0,0  ,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		Goto LightDone	

	Flash_VanillaMode_2x:
		TNT1 A 1 A_SpawnItemEx("Sickles_BlockProjectileAttacks_2x",40,0,0,  0,0,0  ,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		Goto LightDone	

	Flash_DooskMode_2x:
		TNT1 A 1 A_SpawnItemEx("Sickles_BlockDooskProjectileAttacks_2x",40,0,0,  0,0,0  ,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		Goto LightDone	

	Flash_ModernGZDMode_2x:
		TNT1 A 1 A_SpawnItemEx("Sickles_AimReflectProjectileAttacks_2x",40,0,0,  0,0,0  ,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		Goto LightDone	


	Spawn:
		TNT1 A -1
		Stop
	}
}


