#include "Actors/Weapons/NewWeapons/Deagle.dec"
#include "Actors/Weapons/NewWeapons/DualDeagles.dec"
#include "Actors/MISC/DeagleFly.dec"
#include "Actors/MISC/DroppedDeagle.dec"

#include "Actors/Weapons/NewWeapons/RiotShield.dec"

#include "Actors/Weapons/NewWeapons/SuppressedPistol.dec"
#include "Actors/Weapons/NewWeapons/SuppressedDualPistol.dec"


ACTOR NewPistolSpawner: PistolSpawner replaces PistolSpawner
{
	//$Category Weapons
	//$Sprite P3STKA0
	//$Title "Pistol spawner"
	Inventory.PickupMessage "$GOTPISTOL"
	Inventory.PickupSound "Pistol/Draw"
	States
	{
	Spawn:
		P3ST A 0
		P3ST A 1
		P3ST A 0 A_ChangeFlag("THRUACTORS", 0)
	Stay:
		P3ST K -1
		Stop

	Pickup:
		P3ST A 0
		P3ST A 0 A_JumpIfInventory("PuristPistol", 1, "AmmoOnly")
		P3ST A 0 A_JumpIfInventory("BrutalPistol", 1, "DualPistol")
		P3ST A 0 A_JumpIfInventory("SuppressedBrutalPistol", 1, "DualPistol")
		P3ST A 0 A_JumpIfInventory("DualPistols", 1, "AmmoOnly")
		P3ST A 0 A_JumpIfInventory("SuppressedDualPistols", 1, "AmmoOnly")
	PickupNormal:
		P3ST A 0 A_GiveInventory("BrutalPistol", 1)
		P3ST A 0 A_GiveInventory("Clip1", 10)
		Stop

	DualPistol:
		P3ST A 0
		P3ST A 0 A_GiveInventory("HasDualPistol", 1)
		P3ST A 0 A_GiveInventory("Clip1", 10)
		Stop

	AmmoOnly:
		P3ST A 0
		P3ST A 0 A_GiveInventory("Clip1", 10)
		Stop
	}
}

ACTOR BrutalBeamKatana : BrutalWeaponCQCOnly
{
	Weapon.SelectionOrder 3700
	Weapon.Kickback 100
	Obituary "Nothin' Personal, %o."
	Inventory.Pickupmessage "You got the Nanotech Energy Katana! Hu Ha Hu! (Slot 1)"
	Tag "UAC Nanotech Energy Katana"
	Inventory.PickupSound "Axe/Draw"
	+WEAPON.MELEEWEAPON
	+WEAPON.NOAUTOAIM
	+FORCEXYBILLBOARD
	+WEAPON.NOALERT
	-INVENTORY.UNDROPPABLE
	Weapon.AmmoType "AmmoCell"
	Weapon.AmmoGive 20
	Scale 0.5
	States
	{
	Spawn:
		BKAT K 1 BRIGHT
		BKAT K -1 BRIGHT
		Stop
	Ready3:
	Ready:
		BKAT A 0 A_JumpIfInventory("StartDualWield",1,"DualWield")
		BKAT A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		BKAT A 0 A_Giveinventory("HasCutingWeapon",1)
		BKAT A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		BKAT A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		BKAT A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		BKAT A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		BKAT A 1  BRIGHT A_WeaponReady
		
		BKAT A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		Loop
	Deselect:
		BKT0 EABCD 1
		BKAT A 0 A_Takeinventory("PowerBloodOnVisor",1)
		BKAT A 0 A_Takeinventory("PowerBlueBloodOnVisor",1)
		BKAT A 0 A_Takeinventory("PowerGreenBloodOnVisor",1)
		BKAT A 0 A_Takeinventory("HasCutingWeapon",1)
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		BKAT A 0 A_Takeinventory("HasCutingWeapon",1)
		BKAT A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 1 A_Lower
		Loop
	Select:
		BKAT A 0 A_Giveinventory("GoSpecial",1)
		BKAT A 0 A_GiveInventory("TokenCleaner",1)
		BKAT A 0 A_Giveinventory("HasCutingWeapon",1)
		BKAT A 0 A_PlaysoundEx("CybKatana/Activate",7)
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Raise
		BKT0 DCBAE 1
		Loop
		
		
		
	CheckSprint:
		BKAT A 0
		BKAT A 1 BRIGHT A_WeaponReady(WRF_NOFIRE)
		BKAT A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		BKAT A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready
		
	StartSprint:
		BKAT A 1 BRIGHT A_WeaponReady(WRF_NOFIRE)
		BKAT A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
		
	Sprinting:	
		Sprinting:	
		BKAT A 0 offset(-9,32) 
		BKAT A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		BKAT A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		BKAT A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		BKAT A 0 offset(-9,32) A_GiveInventory("UsedStamina", 2)
		BKAT A 0 offset(-9,32)
		BKAT A 1 BRIGHT offset(-9,34) A_SetPitch(pitch -0.5)
		BKAT A 1 BRIGHT offset(-6,36) A_SetPitch(pitch -0.5)
		BKAT A 1 BRIGHT offset(-3,38) A_SetPitch(pitch -0.5)
		BKAT A 1 BRIGHT offset(0,38) A_SetPitch(pitch -0.5)
		BKAT A 1 BRIGHT offset(3,36) A_SetPitch(pitch -0.5)
		BKAT A 1 BRIGHT offset(6,34) A_SetPitch(pitch -0.5)
		BKAT A 1 BRIGHT offset(9,32) A_SetPitch(pitch -0.5)
		BKAT A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		BKAT A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		BKAT A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		BKAT A 0 offset(-9,32) A_GiveInventory("UsedStamina", 2)
		BKAT A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		BKAT A 1 BRIGHT offset(9,34) A_SetPitch(pitch +0.5)
		BKAT A 1 BRIGHT offset(6,36) A_SetPitch(pitch +0.5)
		BKAT A 1 BRIGHT offset(3,38) A_SetPitch(pitch +0.5)
		BKAT A 1 BRIGHT offset(0,38) A_SetPitch(pitch +0.5)
		BKAT A 1 BRIGHT offset(-3,36) A_SetPitch(pitch +0.5)
		BKAT A 1 BRIGHT offset(-6,34) A_SetPitch(pitch +0.5)
		BKAT A 1 BRIGHT offset(-9,32) A_SetPitch(pitch +0.5)
		BKAT A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		BKAT A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		
		Goto StopSprint
	StopSprintTired:
		BKAT A 1 BRIGHT
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		BKAT A 0 A_PlaySound("Tired", 2)
		BKAT A 0 A_TakeInventory("UsedStamina", 2)
		BKAT A 5 BRIGHT A_WeaponReady
		BKAT A 0 A_TakeInventory("UsedStamina", 2)
		BKAT A 5 BRIGHT A_WeaponReady
		BKAT A 0 A_TakeInventory("UsedStamina", 2)
		BKAT A 5 BRIGHT A_WeaponReady
		BKAT A 0 A_TakeInventory("UsedStamina", 2)
		BKAT A 5 BRIGHT A_WeaponReady
		BKAT A 0 A_TakeInventory("UsedStamina", 2)
		BKAT A 5 BRIGHT A_WeaponReady
		Goto Ready
	StopSprint:
		BKAT A 1 BRIGHT
		BKAT A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready	
		
		
	Fire:
		BKAT A 0 A_JumpIfInventory("KatanaSwitchHands", 1, "NormalCutAlt")
		BKAT A 1 BRIGHT
		BKAT C 1 BRIGHT
		BKAT D 1 BRIGHT
		BKAT A 0 A_JumpIfInventory("PowerStrength", 1, "BerserkerCut")
		TNT1 A 0 A_PlaySound("CybKatana/Swing")
		BKAT E 0 A_CustomPunch(5,1,0,"SwordPlasmaPuff",140)
		TNT1 A 0 A_PlaySound("CybKatana/Swing")
		BKAT E 1 BRIGHT A_CustomPunch(70,1,0,"SwordPlasmaPuff",180)
	    Goto FinishCuttingAnimation
	BerserkerCut:
	    TNT1 A 0 A_PlaySound("CybKatana/Swing")
		BKAT E 0 A_CustomPunch(5,1,0,"SwordPlasmaPuff",130)
		TNT1 A 0 A_PlaySound("CybKatana/Swing")
		BKAT E 1 BRIGHT A_CustomPunch(110,1,0,"SwordPlasmaPuff",180)
		Goto FinishCuttingAnimation
	FinishCuttingAnimation:
		BKAT G 1 BRIGHT
		BKAT H 1 BRIGHT
		BKAT I 1 BRIGHT
		BKAT J 1 BRIGHT
		BKAT Q 1 BRIGHT
		BKAT P 1 BRIGHT
		BKAT O 1 BRIGHT
		BKAT N 1 BRIGHT
		BKAT M 1 BRIGHT
		BKAT L 1 BRIGHT A_GiveInventory("KatanaSwitchHands", 1)
		Goto Ready
	NormalCutAlt:
		BKAT A 1 BRIGHT
		BKT2 A 1 BRIGHT
		BKT2 B 1 BRIGHT
		BKT2 C 1 BRIGHT
		BKT2 D 1 BRIGHT
		BKT2 A 0 A_JumpIfInventory("PowerStrength", 1, "BerserkerCutAlt")
		TNT1 A 0 A_PlaySound("CybKatana/Swing")
		BKT2 E 0 A_CustomPunch(5,1,0,"SwordPlasmaPuff",140)
		TNT1 A 0 A_PlaySound("CybKatana/Swing")
		BKT2 E 1  BRIGHT A_CustomPunch(70,1,0,"SwordPlasmaPuff",180)
	    Goto FinishCuttingAnimationAlt
	BerserkerCutAlt:
		TNT1 A 0 A_PlaySound("CybKatana/Swing")
		BKT2 E 0 A_CustomPunch(5,1,0,"SwordPlasmaPuff",140)
		TNT1 A 0 A_PlaySound("CybKatana/Swing")
		BKT2 E 1 BRIGHT A_CustomPunch(110,1,0,"SwordPlasmaPuff",180)
		Goto FinishCuttingAnimationAlt
	FinishCuttingAnimationAlt:
		BKT2 G 1 BRIGHT
		BKT2 H 1 BRIGHT
		BKT2 I 1 BRIGHT
		BKT2 J 1 BRIGHT
		BKAT Q 1 BRIGHT
		BKAT P 1 BRIGHT
		BKAT O 1 BRIGHT
		BKAT N 1 BRIGHT
		BKAT M 1 BRIGHT
		BKAT L 1 BRIGHT A_TakeInventory("KatanaSwitchHands", 1)
		Goto Ready
	AltFire:
		TNT1 A 0 A_JumpIfInventory("SlashModeToken",1,"CuttingBlade")
		BKAT L 1 BRIGHT
		BKAT M 1 BRIGHT
		BKAT N 1 BRIGHT
		BKAT O 1 BRIGHT
		BKAT P 1 BRIGHT
		BKAT Q 1 BRIGHT 
		BKT1 E 0 BRIGHT A_PlaySoundEx("ForceBarrier/On",7)
		BKT1 E 1 BRIGHT
		BKT1 D 1 BRIGHT
		BKT1 C 1 BRIGHT
		BKT1 B 1 BRIGHT
		BKT1 A 1 BRIGHT A_Refire
		Goto AltEnd
	AltHold:
	    BKT1 A 0 A_JumpIfInventory("AmmoCell", 1, "AltHoldContinue")
		BKT1 AAAA 1 BRIGHT A_Print("Not Enough Cells")
	    Goto AltEnd
	AltHoldContinue:
		BKT1 A 1 BRIGHT A_PlaySoundEx("ForceBarrier/Loop",7)
		BKT1 A 1 BRIGHT A_FireCustomMissile("KatanaShieldSpawnerYEET", 0, 0, 0, -35)
		BKT1 A 1 BRIGHT A_FireCustomMissile("KatanaShieldSpawnerYEET", 0, 0, 0, -35)
		BKT1 A 1 BRIGHT A_FireCustomMissile("KatanaShieldSpawnerYEET", 0, 0, 0, -35)
		BKT1 A 1 BRIGHT A_FireCustomMissile("KatanaShieldSpawnerYEET", 0, 0, 0, -35)
		BKT1 A 1 BRIGHT A_FireCustomMissile("KatanaShieldSpawnerYEET", 0, 0, 0, -35)
		BKT1 A 0 A_TakeInventory("AmmoCell",1)
		BKT1 A 1 BRIGHT A_Refire
		Goto AltEnd
	AltEnd:
		BKT1 A 1 BRIGHT A_ReFire 
		BKT1 B 1 BRIGHT A_ReFire 
		BKT1 C 1 BRIGHT A_ReFire 
		BKT1 D 1 BRIGHT A_ReFire 
		BKT1 E 1 BRIGHT A_ReFire 
		BKT1 E 0 BRIGHT A_PlaySoundEx("ForceBarrier/Off",7)
		BKAT Q 1 BRIGHT A_ReFire
		BKAT P 1 BRIGHT A_ReFire
		BKAT O 1 BRIGHT A_ReFire
		BKAT N 1 BRIGHT A_ReFire
		BKAT M 1 BRIGHT A_ReFire
		BKAT L 1 BRIGHT A_ReFire
		Goto Ready
	DualWield: //THX to Dox778 AKA Donks Seven Seventy Ate
		TNT1 A 0 A_Takeinventory("StartDualWield",1)
		TNT1 A 0 A_JumpIfInventory("SlashModeToken", 1, "DisableSlashMode")
		TNT1 A 0 A_Print("Slash Alternative Firemode Selected")
		TNT1 A 0 A_GiveInventory("SlashModeToken", 1) //include the token give at some point
		Goto Ready
	DisableSlashMode:
		TNT1 A 0 A_TakeInventory("SlashModeToken", 1) //take the token at some point
		TNT1 A 0 A_Print("Shield Alternative Firemode Selected")
		Goto Ready
	CuttingBlade:
		BKAT A 0 A_JumpIfInventory("AmmoCell", 5, "SpecialCut")
		BKAT BBBB 1 BRIGHT A_Print("Not Enough Cells")
		Goto Ready
	SpecialCut:
		BKAT A 0 A_JumpIfInventory("KatanaSwitchHands", 1, "SpecialCutAlt")
		BKAT A 1 BRIGHT
		BKAT C 1 BRIGHT
		BKAT D 1 BRIGHT A_PlaySoundEx("CybKatana/Swing",7)
		BKAT E 1 BRIGHT A_FireCustomMissile("SwordPlasmaSlash", 0, 1, 0, -5)
		BKAT F 1 BRIGHT A_TakeInventory("AmmoCell",5)
		BKAT G 1 BRIGHT
		BKAT H 1 BRIGHT
		BKAT I 1 BRIGHT
		BKAT J 1 BRIGHT
		BKAT Q 1 BRIGHT
		BKAT P 1 BRIGHT
		BKAT O 1 BRIGHT
		BKAT N 1 BRIGHT
		BKAT M 1 BRIGHT
		BKAT L 1 BRIGHT A_GiveInventory("KatanaSwitchHands", 1)
		Goto Ready
	SpecialCutAlt:
		BKAT A 1 BRIGHT
		BKT2 A 1 BRIGHT
		BKT2 B 1 BRIGHT
		BKT2 C 1 BRIGHT
		BKT2 D 1 BRIGHT A_PlaySoundEx("CybKatana/Swing",7)
		BKT2 E 1 BRIGHT A_FireCustomMissile("SwordPlasmaSlashAlt", 0, 1, 0, -5)
		BKT2 F 1 BRIGHT A_TakeInventory("AmmoCell",5)
		BKT2 G 1 BRIGHT
		BKT2 H 1 BRIGHT
		BKT2 I 1 BRIGHT
		BKT2 J 1 BRIGHT
		BKAT Q 1 BRIGHT
		BKAT P 1 BRIGHT
		BKAT O 1 BRIGHT
		BKAT N 1 BRIGHT
		BKAT M 1 BRIGHT
		BKAT L 1 BRIGHT A_TakeInventory("KatanaSwitchHands", 1)
		Goto Ready
	}
}

Actor SwordPlasmaPuff : Plasma_Ball
{
+ForcePain
+PuffOnActors
decal "SawVertical"
Scale 0.5
Attacksound "CybKatana/Hit"
states
{
Spawn:
Goto Death
XDeath:
Goto Death
Death:
PLSN A 0 A_CustomMissile ("SmallBluePlasmaFire", 0, 0, random (0, 360), 2, random (0, 360))
TNT1 AAAAA 0 A_CustomMissile ("BluePlasmaParticle", 0, 0, random (0, 360), 2, random (0, 360))
PLSE ABC 2 BRIGHT A_SpawnItem("BlueFlare")
PLSE DE 2 Bright A_SpawnItem("BlueFlareSmall")
TNT2 AAA 9 A_CustomMissile ("PlasmaSmoke", 1, 0, random (0, 360), 2, random (0, 160))
Stop
}
}

Actor SmallBluePlasmaFire: BluePlasmaFire
{
  Scale 0.3
}

Actor SwordPlasmaSlash : Plasma_Ball
{
+Ripper
+ForcePain
-Solid
Scale 0.4
Speed 25
Damage 5
RenderStyle Add
decal "SawVertical"
states
{
Spawn:
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
BWV2 A 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrail",0,0,0,0,0,0,0)
Goto Death
XDeath:
Death:
BWV2 A 1 BRIGHT A_SetTranslucent(1.0)
BWV2 A 1 BRIGHT A_SetTranslucent(0.9)
BWV2 A 1 BRIGHT A_SetTranslucent(0.8)
BWV2 A 1 BRIGHT A_SetTranslucent(0.7)
BWV2 A 1 BRIGHT A_SetTranslucent(0.6)
BWV2 A 1 BRIGHT A_SetTranslucent(0.5)
BWV2 A 1 BRIGHT A_SetTranslucent(0.4)
BWV2 A 1 BRIGHT A_SetTranslucent(0.3)
BWV2 A 1 BRIGHT A_SetTranslucent(0.2)
BWV2 A 1 BRIGHT A_SetTranslucent(0.1)
Stop
}
}

Actor SwordPlasmaSlashAlt : SwordPlasmaSlash
{
states
{
Spawn:
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
BWV2 B 1 BRIGHT A_SpawnItemEx("SwordPlasmaTrailAlt",0,0,0,0,0,0,0)
Goto Death
XDeath:
Death:
BWV2 B 1 BRIGHT A_SetTranslucent(1.0)
BWV2 B 1 BRIGHT A_SetTranslucent(0.9)
BWV2 B 1 BRIGHT A_SetTranslucent(0.8)
BWV2 B 1 BRIGHT A_SetTranslucent(0.7)
BWV2 B 1 BRIGHT A_SetTranslucent(0.6)
BWV2 B 1 BRIGHT A_SetTranslucent(0.5)
BWV2 B 1 BRIGHT A_SetTranslucent(0.4)
BWV2 B 1 BRIGHT A_SetTranslucent(0.3)
BWV2 B 1 BRIGHT A_SetTranslucent(0.2)
BWV2 B 1 BRIGHT A_SetTranslucent(0.1)
Stop
}
}

Actor SwordPlasmaTrail : SwordPlasmaSlash
{
+NoInteraction
+ClientsideOnly
Damage 0
states
{
Spawn:
BWV2 A 1 BRIGHT A_SetTranslucent(0.8)
BWV2 A 1 BRIGHT A_SetTranslucent(0.7)
BWV2 A 1 BRIGHT A_SetTranslucent(0.6)
BWV2 A 1 BRIGHT A_SetTranslucent(0.5)
BWV2 A 1 BRIGHT A_SetTranslucent(0.4)
BWV2 A 1 BRIGHT A_SetTranslucent(0.3)
BWV2 A 1 BRIGHT A_SetTranslucent(0.2)
BWV2 A 1 BRIGHT A_SetTranslucent(0.1)
Stop
}
}

Actor SwordPlasmaTrailAlt : SwordPlasmaSlashAlt
{
+NoInteraction
+ClientsideOnly
Damage 0
states
{
Spawn:
BWV2 B 1 BRIGHT A_SetTranslucent(0.8)
BWV2 B 1 BRIGHT A_SetTranslucent(0.7)
BWV2 B 1 BRIGHT A_SetTranslucent(0.6)
BWV2 B 1 BRIGHT A_SetTranslucent(0.5)
BWV2 B 1 BRIGHT A_SetTranslucent(0.4)
BWV2 B 1 BRIGHT A_SetTranslucent(0.3)
BWV2 B 1 BRIGHT A_SetTranslucent(0.2)
BWV2 B 1 BRIGHT A_SetTranslucent(0.1)
Stop
}
}


/*
// Disable this because we already have a path to the Beam Katana with plasma gun
// and railgun
ACTOR ChainsawSpawnerNew : CustomInventory Replaces Chainsaw
{
 scale 0.8
 radius 24
 height 24
 +THRUACTORS +FORCEXYBILLBOARD
 inventory.pickupsound "weapons/chainsaw/draw"
 Inventory.PickupMessage "$GOTCHAINSAW"
 Mass 1
	States
	{

	 Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(64,"SpawnKatana")
		TNT1 A 0 A_SpawnItemEx("EvidenceCheckerChainsaw", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		CSAW A 10
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 0)
		CSAW A -1
		Stop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "Purist")
		TNT1 A 0 A_GiveInventory("Chain_Saw", 1)
		Stop
	Purist:
		TNT1 A 0 A_GiveInventory("Chain_saw", 1)
		Stop
	SpawnKatana:
		TNT1 A 0 A_SpawnItemEx("BrutalBeamKatana", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		stop
	}
}
*/

Actor KatanaSwitchHands : Ammo
{
 Inventory.MaxAmount 1
}

actor KatanaShieldSpawner5 //from Realm667's Deployable Shield
{
  Radius 1
  Height 1
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 16, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 32, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 48, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 64, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPartVisual", 0, 0, 16, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPartVisual", 0, 0, 32, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPartVisual", 0, 0, 48, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPartVisual", 0, 0, 64, 0, 0, 0, 0, 32)
    stop
  }
}

actor KatanaShieldSpawner4
{
  Radius 1
  Height 1
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 8, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 24, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 40, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 56, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPartVisual", 0, 0, 24, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPartVisual", 0, 0, 40, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPartVisual", 0, 0, 56, 0, 0, 0, 0, 32)
    stop
  }
}


actor KatanaShieldSpawner3
{
  Radius 1
  Height 1
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 16, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 32, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPart", 0, 0, 48, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPartVisual", 0, 0, 32, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("KatShieldPartVisual", 0, 0, 48, 0, 0, 0, 0, 32)
    stop
  }
}

actor KatShieldPart
{
  Radius 10
  Height 16
  Scale 0.5
  RenderStyle None
  Alpha 0.25
  Bloodtype "KatanaShieldHit"
  +SHOOTABLE
  +NOGRAVITY
  +NOTELEPORT
  +NODAMAGE
  +NORADIUSDMG
  +DONTRIP
  +NOBLOODDECALS
  +FLOORCLIP
  States
  {
  Spawn:
    KHXA A 4 bright
    stop
  Death:
    TNT1 A 2
    stop
  }
}

actor KatShieldPartVisual
{
  Radius 8
  Height 8
  Scale 0.5
  RenderStyle Add	//Fuzzy looks great in software mode
  Alpha 0.25
  +NOINTERACTION
  +CLIENTSIDEONLY
  +FLOORCLIP
  States
  {
  Spawn:
    KHXA A 4 bright
    stop
  Death:
    TNT1 A 2
    stop
  }
}

actor KatanaShieldSpawnerYEET
{
  Radius 1
  Height 1
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("KatanaShieldSpawner5", 8, 0, 0)
    TNT1 A 0 A_SpawnItemEx ("KatanaShieldSpawner4", 8, 24, 0)
    TNT1 A 0 A_SpawnItemEx ("KatanaShieldSpawner4", 8, -24, 0)
    TNT1 A 0 A_SpawnItemEx ("KatanaShieldSpawner3", 8, 48, 0)
    TNT1 A 0 A_SpawnItemEx ("KatanaShieldSpawner3", 8, -48, 0)
    stop
  }
}

actor KatanaShieldHit
{
  Radius 1
  Height 1
  Scale 0.5
  Renderstyle Add
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    KH1T A 0 bright
    KH1T A 1 bright A_Stop
    KH1T A 0 bright A_PlaySound ("ForceBarrier/Hit")
    KH1T BCDEFGH 1 bright
    stop
  }
}

ACTOR SlashModeToken: Inventory { Inventory.MaxAmount 1 }

/*
// This only spawns Beam Katana for some reason
actor PlasmagunReplacer2 : PlasmagunReplacer Replaces PLasmaRifle
{
	States
	{
	Vanilla:
	Spawn1:
		TNT1 A 0 A_SpawnItemEx ("BrutalBeamKatana",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		Goto Super::Spawn1
		Stop

	ForceSpawn2:
		TNT1 A 0 A_SpawnItemEx ("BrutalBeamKatana",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		Goto Super::ForceSpawn2
		Stop
	}
}
*/

// Override plasma and railgun spawning from actors/Weapons/WeaponSpawners.dec
actor PlasmagunReplacer2 : BasicWeaponPickup Replaces PLasmaRifle
{
	//$Category Weapons
	//$Sprite TNT1A0
	//$Title "Tweakable Plasmagun spawner"
	//$Arg0 What weapon to spawn
	//$Arg0Tooltip Select the weapon to spawn.
	//$Arg0Type 11
	//$Arg0Enum { 0 = "Configurable by user (DEFAULT)"; 1 = "Force Plasmagun"; 2 = "Force Railgun"; }
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(args[0] == 1, "Spawn1")
		TNT1 A 0 A_JumpIf(args[0] == 2, "ForceSpawn2")
		TNT1 A 0 ACS_NamedExecuteAlways("BDDisablePlasmaRifleSpawner", 0, 0, 0, 0)
		TNT1 A 5
		TNT1 A 0 A_Jump(48, "Spawn2")
	Vanilla:
	Spawn1:
		TNT1 A 0 A_SpawnItemEx ("BrutalBeamKatana",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A -1 A_SpawnItemEx ("PLasmagunSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		Stop

	Spawn2:
		TNT1 A 0 A_JumpIf( CallACS("CheckGamemode",0,0,0,0) != 0, "ForceSpawn2")
		TNT1 A 0 A_JumpIfInventory("Plasma_Gun",1,"ForceSpawn2",AAPTR_PLAYER1)
		Goto Vanilla
	ForceSpawn2:
		TNT1 A 0 A_SpawnItemEx ("BrutalBeamKatana",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A -1 A_SpawnItemEx ("RailgunSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		Stop
	}
}
