/*

==LONGARM (LASER MODE)==
A custom made and extremely powerful firearm made for Kustam.
By default it's a potent beam cannon that can punch through 
multiple soft targets. The stock of the rifle itself can be
used as bludgeoning weapon, and is designed for this: The
stock contains kinetic impact absorbers to help recharge 
the energy battery! The stock also draws from the kinetic 
battery to help deal crushing blows, as well as cause 
devestating shockwaves around Kustam when slammed against 
the ground.

Should the battery be exhausted, the rifle is capable of
drawing in energy and small particles to flash form 
and fire a baton round used to accumulate kinetic 
forces and jumpstart the battery.

Like Kustam himself, the rifle is modular, attachments
can be added to increase versatility or add additional firepower
such as a module to convert some of the accumulated biomass from
targets into a special charge module to increase firepower for
a short duration.

==EQUIPMENT LAUNCHER==
After losing his left arm while assisting Blaz in driving 
the demons out of Lothar, Kustam was left with no other choice
but to wait on the sidelines until his repair systems could
regenerate the lost limb. Luckily for him, Samson had joined
forces shortly after this incident, and volunteered to help
Kustam recover.

It didn't take long with Samson's mechanical knowledge and
ingenuity, he even installed some upgrades into the arm that
was once lost! Kustam's left arm now carries a modular equipment
launcher. This new arm draws power from an auxiliary battery
installed in Kustam, once drained, Kustam can utilize a draining
beam to draw out life force from targets and convert it into energy.
A potentially controversial gift, but one that was needed at the
time.


==SENTINEL ARMS==
A latent ability hidden away for safety's sake, Kustam can 
push his body beyond his limiters, changing his arms into
twin cannons: A heavy beam cannon and a crushing scatter
gun. Each arm contains a battery to supply energy for its weapon, 
and both are linked, so as one arm fires, energy is accumulated
into the other!

Also worth nothing that while in this form, a field is projected across
Kustam's body, giving him increased damage resistance.
*/

actor KustamLaserGun : weapon
{
	Weapon.SelectionOrder 800
	+WEAPON.AMMO_OPTIONAL
	Weapon.AmmoType "KustamLaserBattery"
	+NOAUTOAIM
	weapon.bobstyle smooth
	weapon.bobrangex 0.1
	weapon.bobrangey 0.5
	weapon.bobspeed 1
	Tag "Laser shot"
	states
	{
	spawn:
		ESHT A -1
		stop
	Select:
		TNT1 A 0
		TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_Raise
		TNT1 A 1 A_Raise
		goto Ready
	Ready:
		TNT1 A 0 
		TNT1 A 0 A_PlaySound ("Kustam/pistolspin",0)
		LM2L DEFG 1 A_WeaponReady (WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		goto RealReady
	RealReady:
		TNT1 A 0 A_JumpIfInventory ("GunArms",1,"Overclock")
		TNT1 A 0 A_JumpIfInventory ("BarrelToken",1,"BarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("GoldenBarrelToken",1,"GoldenBarrelEquip")
		//TNT1 A 0 A_JumpIfInventory ("KustamOverheat",1, "OverHeatStart")
		//TNT1 A 0 A_JumpIfInventory ("KustamLaserReload",1,"RechargeModeStart")
		LAL1 A 1 A_WeaponReady (WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNT1 A 0 A_JumpIfInventory ("BarrelToken",1,"BarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("GoldenBarrelToken",1,"GoldenBarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("GunArms",1,"Overclock")
		loop
	deselect:
		TNT1 A 0
		TNT1 A 0 A_GunFlash ("AllFlashEnd",GFF_NOEXTCHANGE)
		TNT1 A 0 A_JumpIfHealthLower (1, "DeadLower")
		TNT1 A 0 A_JumpIfInventory ("BarrelToken",1,"BarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("GoldenBarrelToken",1,"GoldenBarrelEquip")
		LL2M B 1
		TNT1 A 0 A_PlaySound ("Kustam/boltout",0)
		LL2M CDE 1
	holster:
		TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_lower
		TNT1 A 1 A_lower
		loop
	
		
	DeadLower:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAAAAAAAAAAAA 0 A_Lower
		TNT1 A 0 A_GiveInventory ("DeathResetter",1)
		TNT1 A 1 A_Lower
		wait		
	//------------------------------------------------------------------
	//------------------------------------------------------------------
	//Standard fire actions
	//------------------------------------------------------------------
	//------------------------------------------------------------------


	Fire:
		TNT1 A 0
		TNT1 A 0 A_GunFlash ("AllFlashEnd",GFF_NOEXTCHANGE)
		TNT1 A 0 A_JumpIfInventory ("BarrelToken", 1, "BarrelKick")
		TNT1 A 0 A_JumpIfInventory ("GoldenBarrelToken", 1, "GoldenBarrelKick")
		TNT1 A 0 A_JumpIfInventory ("SentinelForm", 1, "OCLaserStart")
		TNT1 A 0 A_GiveInventory ("UsingKustamPistol",1)
		TNT1 A 0 A_JumpIfInventory ("KustamLaserReload",1,2)
		LAL1 A 1 A_JumpIfInventory ("KustamLaserBattery",1, "LaserShot")
		LAL1 A 1 A_PlaySound ("Kustam/BatonShotWindup",CHAN_WEAPON)
		LAL4 ABCD 1
		LAL4 ABCD 1
			//LAL1 BB 1
			//LAL1 C 2
			//LAL1 J 1
		LAL4 E 1
		TNT1 A 0 A_PlaySound ("Kustam/BatonShot",CHAN_WEAPON)
		TNT1 A 0 A_FireBullets (0,0,1,0,"flickpuff",FBF_NOFLASH)
		TNT1 A 0 A_GunFlash ("BatonShotFlash",GFF_NOEXTCHANGE)
		TNT1 AAA 0 A_FireCustomMissile ("KustamWeaponSmoke",Random (-13, 13),0,0,1,0,0)
		LAL4 FGHI 2 A_WeaponReady (WRF_NOFIRE|WRF_NOBOB)
		LAL1 I 2 A_WeaponReady (WRF_NOFIRE)
		LAL1 A 6 A_WeaponReady (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		LAL1 A 3 A_WeaponReady (WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		Goto RealReady
		
	
	LaserShot:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("Kustam/ventretract2",0,0.80)
		LAL1 BB 1
		LAL1 C 2
		TNT1 A 0 A_PlaySound ("Kustam/ClipInstall",0,0.50)
		LAL1 J 1
		TNT1 A 0 A_TakeInventory ("KustamLaserBattery",10)
		TNT1 A 0 A_JumpIfInventory ("KustamLaserCombo", 90, "LaserLevel3")
		TNT1 A 0 A_JumpIfInventory ("KustamLaserCombo", 45, "LaserLevel2")
		LAL1 D 1 Bright
		TNT1 A 0 A_FireBullets (0,0,-1,30,"KustamPuff1",FBF_NORANDOM)
		TNT1 A 0 A_GunFlash ("LaserFlash1",GFF_NOEXTCHANGE)
		TNT1 A 0 A_AlertMonsters	
		TNT1 A 0 A_Quake (1, 6, 0, 32)
		LAL1 E 1 Bright
		LAL1 FG 2 bright
		LAL1 HH 1 
		Goto GunFireEnd
	LaserLevel2:
		LAL2 A 1 Bright
		TNT1 A 0 A_FireBullets (0,0,-1,30,"KustamPuff1",FBF_NORANDOM)
		TNT1 A 0 A_GunFlash ("LaserFlash2",GFF_NOEXTCHANGE)
		TNT1 A 0 A_AlertMonsters	
		TNT1 A 0 A_Quake (2, 6, 0, 32)
		LAL2 B 1 Bright
		LAL2 CDE 2 bright
		LAL1 HH 1 
		Goto GunFireEnd
	LaserLevel3:
		LAL3 A 1 Bright
		TNT1 A 0 A_FireBullets (0,0,-1,30,"KustamPuff1",FBF_NORANDOM)
		TNT1 A 0 A_GunFlash ("LaserFlash3",GFF_NOEXTCHANGE)
		TNT1 A 0 A_AlertMonsters	
		TNT1 A 0 A_Quake (3, 6, 0, 32)
		LAL3 B 1 Bright
		LAL3 CDEF 2 bright
		LAL1 H 1 
		Goto GunFireEnd




	LaserFlash1:
		TNT1 A 0
		TNT1 AAA 0 A_FireBullets (0,0,-1,30,"KustamPuff2",FBF_NORANDOM)
		TNT1 A 0 A_RailAttack (0, 0, 0, none, none, RGF_SILENT | RGF_FULLBRIGHT, 0, "HeatBeamTip", 0, 0, 2048, 10, 0, 0, "PistolBeam1")
		TNT1 A 0 A_PlaySound("Kustam/Laser1", 1)
		TNT1 A 1 
		stop
	LaserFlash2:
		TNT1 AAAAA 0 A_FireBullets (0,0,-1,30,"KustamPuff2",FBF_NORANDOM)
		TNT1 A 0 A_RailAttack (0, 0, 0, none, none, RGF_SILENT | RGF_FULLBRIGHT, 0, "HeatBeamTip", 0, 0, 2048, 10, 0, 0, "PistolBeam2")
		TNT1 A 0 A_PlaySound("Kustam/Laser2", 5)
		TNT1 A 0 A_PlaySound("Kustam/Laser2", 6,0.50)
		TNT1 A 1 
		stop
	LaserFlash3:
		TNT1 AAAAAAA 0 A_FireBullets (0,0,-1,30,"KustamPuff2",FBF_NORANDOM)
		TNT1 A 0 A_RailAttack (0, 0, 0, none, none, RGF_SILENT | RGF_FULLBRIGHT, 0, "HeatBeamTip", 0, 0, 2048, 10, 0, 0, "PistolBeam3")
		TNT1 A 0 A_PlaySound("Kustam/Laser3", 5)
		TNT1 A 0 A_PlaySound("Kustam/Laser3", 6,0.60)
		TNT1 A 1 
		stop
		
	BatonShotFlash:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("ReclaimatorBooster",1,"BoostedBatonShot")
		TNT1 A 1 A_FireCustomMissile ("KustamBatonShot",0,0)
		stop
	BoostedBatonShot:
		TNT1 A 0
		TNT1 A 1 A_FireCustomMissile ("KustamBatonShot",0,0)
		TNT1 A 1 A_FireCustomMissile ("KustamBatonShot",0,0)
		stop
	
	
	GunFireEnd:
		LAL1 I 1 ACS_NamedExecuteAlways("KustamAmmoWarning",0,0,0,0)	
		LAL1 A 3 A_WeaponReady (WRF_NOPRIMARY|WRF_ALLOWZOOM|WRF_ALLOWRELOAD|WRF_NOBOB)
		Goto RealReady
		


	//------------------------------------------------------------------
	//------------------------------------------------------------------
	//Altfire attacks
	//------------------------------------------------------------------
	//------------------------------------------------------------------
	Altfire:
		TNT1 A 0
		TNT1 A 0 A_GunFlash ("AllFlashEnd",GFF_NOEXTCHANGE)
		TNT1 A 0 A_JumpIfInventory ("BarrelToken", 1, "BarrelCancel")
		TNT1 A 0 A_JumpIfInventory ("GoldenBarrelToken", 1, "GoldenBarrelCancel")
		TNT1 A 0 A_JumpIfInventory ("SentinelForm", 1, "OCKineticArmStart")
		Goto StockAttack
	
	//The standard Stock attack
	StockAttack:
		KSB1 AA 1
		KSB1 BBCD 1
		TNT1 A 0 A_PlaySound ("Kustam/staffattack",CHAN_WEAPON)
		TNT1 A 0 A_FireCustomMissile ("StockStrike1",0,0,0,1)
		KSB1 EE 1
		TNT1 A 0 A_Recoil (-2)
		
		//Spacing this bullshit out for my own sake.
		
		TNT1 A 0 A_JumpIfInventory ("StockHit", 1, "StockHitStop1")
		KSB1 F 1
		TNT1 A 0 A_JumpIfInventory ("StockHit", 1, "StockHitStop1")
		KSB1 F 1
		TNT1 A 0 A_JumpIfInventory ("StockHit", 1, "StockHitStop1")
		KSB1 GGHI 1

		TNT1 A 4
		TNT1 A 0 A_JumpIfInventory ("KustamKineticReload",1,"StockReset")
		TNT1 A 0 A_Refire ("StockAttack2")
		TNT1 A 10 A_WeaponReady (WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		Goto StockReset
	StockAttack2:
		KSB2 AAB 1
		TNT1 A 0 A_PlaySound ("Kustam/staffattack",CHAN_WEAPON)
		TNT1 A 0 A_FireCustomMissile ("StockStrike1",0,0,0,1)
		TNT1 A 0 A_JumpIfInventory ("StockHit", 1, "StockHitStop2")
		KSB2 C 1
		TNT1 A 0 A_Recoil (-3)
		TNT1 A 0 A_JumpIfInventory ("StockHit", 1, "StockHitStop2")
		KSB2 DEDE 1
		KSB2 F 1
		KSB2 G 2
		TNT1 A 4
		TNT1 A 0 A_JumpIfInventory ("KustamKineticReload",1,"StockReset")
		TNT1 A 0 A_Refire ("StockAttack3")
		TNT1 A 10 A_WeaponReady (WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		Goto StockReset
	StockAttack3:
		TNT1 A 3
		KSB3 AAABB 1
		KSB3 CD 1
		TNT1 A 0 A_FireCustomMissile ("StockStrike2",0,0,0,1)
		TNT1 A 0 A_GunFlash ("StockRingCheck",GFF_NOEXTCHANGE)
		KSB3 E 1 
		KSB3 FF 2
		KSB3 GGHH 2
		KSB3 II 1
		TNT1 A 8
		Goto StockReset

	StockHitStop1:


		KSB1 FJFJ 1
		KSB1 GGHI 1

		TNT1 A 5
		TNT1 A 0 A_JumpIfInventory ("KustamKineticReload",1,"StockReset")
		TNT1 A 0 A_Refire ("StockAttack2")
		TNT1 A 15 A_WeaponReady (WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		Goto StockReset
	StockHitStop2:
		KSB2 DEDEDE 1
		KSB2 F 2
		KSB2 G 1
		KSB2 G 2
		TNT1 A 5
		TNT1 A 0 A_JumpIfInventory ("KustamKineticReload",1,"StockReset")
		TNT1 A 0 A_Refire ("StockAttack3")
		TNT1 A 15 A_WeaponReady (WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		Goto StockReset
	
	
	StockBounceOff1:
		KSF5 ABA 1
		KSF5 C 2 
		KSF5 DEFG 1 A_WeaponReady (WRF_NOSECONDARY|WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		TNT1 A 5 A_WeaponReady (WRF_NOSECONDARY|WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		Goto StockReset		
	StockBounceOff2:
		KSF6 ABA 1
		KSF6 C 2 
		KSF6 DEFG 1 A_WeaponReady (WRF_NOSECONDARY|WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		TNT1 A 5 A_WeaponReady (WRF_NOSECONDARY|WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		Goto StockReset		

	StockReset:
		TNT1 A 1 A_WeaponReady (WRF_NOSECONDARY|WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		TNT1 A 0 A_JumpIfInventory ("Gunarms",1,"Overclock")
		TNT1 A 0 A_JumpIfInventory ("BarrelToken",1,"BarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("GoldenBarrelToken",1,"GoldenBarrelEquip")
		KSB4 ABCC 1 A_WeaponReady (WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		TNT1 A 0 A_JumpIfInventory ("BarrelToken",1,"BarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("GoldenBarrelToken",1,"GoldenBarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("Gunarms",1,"Overclock")
		KSB4 D 1 A_WeaponReady (WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		TNT1 A 0 A_JumpIfInventory ("BarrelToken",1,"BarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("GoldenBarrelToken",1,"GoldenBarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("Gunarms",1,"Overclock")
		Goto RealReady
		
	//Flash states to check for the ring powerup
	StockRingCheck:
		TNT1 A 0
		TNT1 A 1 A_JumpIfInventory ("ATKringpowerup", 1, "StockSlam")
		Stop
	StockSlam:
		TNT1 A 0
		TNT1 A 1 A_FireCustomMissile ("StockShockwave",0,0)
		stop

	
	//********************************************************************
	//********************************************************************
	//INHERITANCE STUFF BELOW
	//********************************************************************
	//********************************************************************
	
	//------------------------------------------------------------------
	//------------------------------------------------------------------
	//Reload actions
	//------------------------------------------------------------------
	//------------------------------------------------------------------

	Reload:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory ("KustamGlaiveActive",99)
		TNT1 A 0 A_GunFlash ("AllFlashEnd",GFF_NOEXTCHANGE)
		TNT1 A 0 A_GiveInventory ("UsingKustamKick",1)
		TNT1 A 0 A_JumpIfInventory ("KustamAuxReload", 1, "DrainAttack")
		TNT1 A 0 A_JumpIfInventory ("KustamAuxLock",1,"FatigueKick")
		TNT1 A 0 A_JumpIfInventory ("ATKringpowerup", 1, "DoubleKick")
		LEG2 ABCC 1
		TNT1 A 0 A_PlaySound ("Kustam/SuperKick",0)
		TNT1 A 0 A_Recoil (-5)
		TNT1 A 0 A_TakeInventory ("KustamAuxBattery",1)
		TNT1 A 0 A_GiveInventory ("KustamAuxLock",999)
		LEG1 C 1 A_FireCustomMissile ("SuperKustamKick",0,0,2,-4)
		LEG1 DEDEDDEE 1
		LEG1 E 4
		LEG1 EFF 1
		TNT1 A 0 A_TakeInventory ("UsingKustamKick",99)
		LEG1 G 1
		LEG1 HI 2 
		TNT1 A 1 A_Jump (256,"AuxAttackEnd")
		goto RealReady
	DoubleKick:
		TNT1 A 2 ThrustThingZ (0,15,0,0)
		TNT1 A 2 ThrustThingZ (0,15,0,0)
		LEG4 ABCC 1
		TNT1 A 0 A_PlaySound ("Kustam/SuperKick",0)
		TNT1 A 0 A_FireCustomMissile ("SuperKustamKick",0,0,-3,-10)
		TNT1 A 0 A_TakeInventory ("KustamAuxBattery",1)
		TNT1 A 0 A_GiveInventory ("KustamAuxLock",999)
		LEG4 D 1 A_FireCustomMissile ("SuperKustamKick",0,0,3,-10)
		LEG4 EFEF 1
		LEG4 E 1
		TNT1 A 0 A_TakeInventory ("UsingKustamKick",99)
		LEG4 FGHIJJ 1 
		TNT1 A 1 A_Jump (256,"AuxAttackEnd")
		goto RealReady


	FatigueKick:
		TNT1 A 0 A_JumpIfInventory ("ATKringpowerup", 1, "FastKick")
		LEG1 AB 1
		TNT1 A 0 A_PlaySound ("Kustam/kickwoosh",0)
		LEG1 C 1 A_FireCustomMissile ("KustamKick",0,0,2,-4)
		LEG1 D 1
		LEG1 E 6
		LEG1 EFF 1
		LEG1 G 1 
		LEG1 HI 2
		TNT1 A 2
		TNT1 A 0 A_TakeInventory ("UsingKustamKick",99)
		TNT1 A 1 A_Jump (256,"AuxAttackEnd")
		goto RealReady		
	FastKick:
		TNT1 A 0
		TNT1 A 1
		LEG3 B 1
		TNT1 A 0 A_PlaySound ("Kustam/kickwoosh",0)
		LEG3 D 1 A_FireCustomMissile ("FastKustamKick",0,0,2,-4)
		LEG3 E 1
		LEG3 HI 1 
		TNT1 A 1 ThrustThingZ (0,10,0,0)
		LEG1 B 1
		TNT1 A 0 A_PlaySound ("Kustam/kickwoosh",0)
		LEG1 C 1 A_FireCustomMissile ("KustamKick",0,0,2,-4)
		LEG1 D 1
		LEG1 E 6
		LEG1 EFF 1
		LEG1 G 1 
		LEG1 HI 2
		TNT1 A 2
		TNT1 A 2 A_WeaponReady (WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNT1 A 1 A_Jump (256,"AuxAttackEnd")
		goto RealReady
		
	AuxFailure:
		TNT1 A 0
		KWG3 A 3
		TNT1 A 0 A_PlaySound ("Kustam/StaffLock",0)
		KWG3 BC 2
		KWG3 D 12
		KWG3 EFG 2
		TNT1 A 7 
		TNT1 A 0 A_Jump (256,"AuxAttackEnd")
		Goto AuxAttackEnd
		
	AuxAttackEnd:
		TNT1 A 0
		TNT1 A 2 A_WeaponReady (WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNT1 A 5 A_WeaponReady (WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		KSB4 ABCC 1 A_WeaponReady (WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		TNT1 A 0 A_JumpIfInventory ("BarrelToken",1,"BarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("GoldenBarrelToken",1,"GoldenBarrelEquip")
		TNT1 A 0 A_JumpIfInventory ("Gunarms",1,"Overclock")
		KSB4 D 1 A_WeaponReady (WRF_NOBOB|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		TNT1 A 0 A_Jump (256,"RealReady")
		goto RealReady


	//====================================================================
	//====================================================================
	//---------------------SUBWEAPON ATTACKS------------------------------
	//====================================================================
	//====================================================================

	Zoom:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory ("KustamGlaiveActive",99)
		TNT1 A 0 A_GunFlash ("AllFlashEnd",GFF_NOEXTCHANGE)
		TNT1 A 0 A_JumpIfInventory ("KustamEquipmentCooldown", 1, "AuxFailure")
		KWG1 AABC 1
		KWG1 DD 1
		TNT1 A 0 A_JumpIfInventory ("ThunderLashCheck",1, "ThunderLashShot")
		TNT1 A 0 A_JumpIfInventory ("RailBeamCheck",1, "RailBeamShot")
		TNT1 A 0 A_JumpIfInventory ("FlashBoltCheck",1, "FlashBoltShot")
		TNT1 A 0 A_JumpIfInventory ("TurretShotCheck",1, "TurretDeployShot")
	//-----------------------------------------------------	
	//Stun Pellets (Default subweapon)
	//-----------------------------------------------------	
	StunPelletBurst:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory ("KustamSubAmmo",1)
		KPBS A 0 Bright A_PlaySound("Kustam/StunPellet", 1)
		TNT1 A 0 A_GunFlash ("WristGunFlash")
		KWG1 E 1 Bright A_FireCustomMissile ("StunPellet",-8,0,-13)
		TNT1 A 0 A_AlertMonsters
		KWG1 F 1
		TNT1 A 0 
		KPBS A 0 Bright A_PlaySound("Kustam/StunPellet", 1)
		TNT1 A 0 A_GunFlash ("WristGunFlash")
		KWG1 E 1 Bright A_FireCustomMissile ("StunPellet",-4,0,-13,0,0,0)
		KWG1 F 1
		KPBS A 0 Bright A_PlaySound("Kustam/StunPellet", 1)
		TNT1 A 0 A_GunFlash ("WristGunFlash")
		KWG1 E 1 Bright A_FireCustomMissile ("StunPellet",0,0,-13,0,0,0)
		KWG1 F 1
		KPBS A 0 Bright A_PlaySound("Kustam/StunPellet", 1)
		TNT1 A 0 A_GunFlash ("WristGunFlash")
		KWG1 E 1 Bright A_FireCustomMissile ("StunPellet",4,0,-13,0,0,0)
		KWG1 F 1
		KPBS A 0 Bright A_PlaySound("Kustam/StunPellet", 1)
		TNT1 A 0 A_GunFlash ("WristGunFlash")
		KWG1 E 1 Bright A_FireCustomMissile ("StunPellet",8,0,-13,0,0,0)
		KWG1 FD 1
		TNT1 A 0 A_Jump (256,"EquipmentEnd")
		Goto RealReady


		
	//-----------------------------------------------------	
	//Flash Bolt
	//-----------------------------------------------------	
	FlashBoltShot:
		TNT1 A 0
		KPBS A 0 Bright A_PlaySound("Kustam/FlashBoltLaunch", 1)
		TNT1 A 0 A_TakeInventory ("KustamSubAmmo",1)
		TNT1 A 0 A_GunFlash ("WristGunFlash")
		KWG1 E 1 Bright A_FireCustomMissile ("FlashBolt",0,0,-13)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Jump (256,"EquipmentEnd")
		Goto RealReady

		
	//-----------------------------------------------------	
	//Rail Beam
	//-----------------------------------------------------	
	RailBeamShot:
		TNT1 A 0
		KPBS A 0 Bright A_PlaySound("Kustam/bigshot", 0,0.60)
		TNT1 A 0 A_TakeInventory ("KustamSubAmmo",1)
		KPBS A 0 Bright A_PlaySound("Kustam/RailBeamshot", 1)
		TNT1 A 0 A_FireCustomMissile ("RailBeamParticleSpawner",0,0,-13)
		TNT1 A 0 A_GunFlash ("WristGunFlash")
		KWG1 E 1 Bright A_RailAttack (250, -13, 0, none, none, RGF_SILENT | RGF_FULLBRIGHT, 0, "RailHitParticle", 0, 0, 2048, 10, 0, 0, "RailBeamCore")
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Jump (256,"EquipmentEnd")
		Goto RealReady

		
	//-----------------------------------------------------	
	//Turret Shot
	//-----------------------------------------------------	

	TurretDeployShot:
		TNT1 A 0
		KPBS A 0 Bright A_PlaySound("Kustam/bigshot", 0,0.70)
		KPBS A 0 Bright A_PlaySound("Kustam/Hvolleyshot", 1)
		TNT1 A 0 A_TakeInventory ("KustamSubAmmo",1)
		TNT1 A 0 A_GunFlash ("WristGunFlash")
		KWG1 E 1 Bright A_FireCustomMissile ("TurretDeployer",0,0,-13)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Jump (256,"EquipmentEnd")
		Goto RealReady

		
	//-----------------------------------------------------	
	//Thunder Lash
	//-----------------------------------------------------	
	ThunderLashShot:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 A_TakeInventory ("KustamSubAmmo",1)
		TNT1 AAA 0 A_RailAttack (0, random(-11,-14), 0, "none", White, RGF_SILENT | RGF_FULLBRIGHT | RGF_NOPIERCING, 100, "LashZapFX", 0.60, 0.60, 2048, 30, Frandom(0.35,0.95), 0, "SparkRailFX",random(-2,2))
		TNT1 AAA 0 A_RailAttack (0, random(-11,-14), 0, "none", White, RGF_SILENT | RGF_FULLBRIGHT | RGF_NOPIERCING, 100, "LashZapFX", 0.60, 0.60, 2048, 30, Frandom(0.35,0.95), 0, "SparkRailFX",random(-2,2))
		TNT1 A 0 A_RailAttack (0, -13, 0, "none", White, RGF_SILENT | RGF_FULLBRIGHT | RGF_NOPIERCING, 0, "LashZapFX", 0, 0, 2048, 10, 0, 0, "ThunderBeamCore")
		//TNT1 A 0 A_Quake(2, 12, 0, 32,"Silence")
		KPBS A 0 Bright A_PlaySound("ThunderLash/SparkShot", CHAN_WEAPON)
		KPBS A 0 Bright A_PlaySound("ThunderLash/AltfireBeam",0,1)
		KPBS A 0 Bright A_PlaySound("ThunderLash/AltfireBeamBacking",0,1)
		KPBS A 0 Bright A_PlaySound("Kustam/bigshot",0,0.50)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_GunFlash ("WristGunFlash")
		KWG1 E 1 Bright A_FireBullets (0,0,-1,190,"ThunderBeamTip",FBF_NORANDOM | FBF_NOFLASH)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Jump (256,"EquipmentEnd")
		Goto RealReady
	
	//Gunflash for the Wrist Gun
	WristGunFlash:
		KWG2 A 1 Bright
		Goto AllFlashEnd
	
	EquipmentEnd:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory ("KustamEquipmentCooldown",999)
		KWG1 FFDDFFFDD 1
		KWG1 D 4
		KWG1 GHI 2
		TNT1 A 1 A_Jump (256,"AuxAttackEnd")
		Goto RealReady


	//-----------------------------------------------------	
	//Drain hand (Only usable when battery is empty)
	//-----------------------------------------------------	
	DrainAttack:
		TNT1 A 0
		DRN1 AABBC 1
		TNT1 A 0 A_PlaySound ("Kustam/DrainBeamShot",5)
		TNT1 A 0 A_PlaySound ("Kustam/DrainBeamShot",6)
		DRN1 D 1 Bright
		TNT1 A 0 A_RailAttack (30, -9, 0, none, none, RGF_SILENT | RGF_FULLBRIGHT | RGF_NOPIERCING, 0, "DrainBeamTip", 0, 0, 550, 10, 25, 0, "DrainBeamCore")
		DRN1 EE 1 Bright //A_FireBullets (0,0,-1,30,"DrainHandBeam",FBF_NORANDOM, 300)
		TNT1 A 0 A_AlertMonsters
		DRN1 FF 1 Bright
		DRN1 G 2
		TNT1 A 0 A_JumpIfInventory ("KustamAuxBattery", 1, "ReloadedArm")
		DRN1 HHIIJJ 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		TNT1 A 3 A_WeaponReady (WRF_NOSWITCH)
		TNT1 A 1 A_Jump (256,"AuxAttackEnd")
		Goto RealReady
	ReloadedArm:
		DRN2 A 1 A_WeaponReady (WRF_NOSWITCH)
		DRN2 ABCDD 2 A_WeaponReady (WRF_NOSWITCH)
		DRN2 EE 1 A_WeaponReady (WRF_NOSWITCH)
		TNT1 A 0 A_PlaySound ("Kustam/DrainBurst",5)
		TNT1 A 0 A_PlaySound ("Kustam/DrainBurst2",6,0.50)
		DRN2 FF 1 A_WeaponReady (WRF_NOSWITCH)
		DRN2 GHIJJJ 2 A_WeaponReady (WRF_NOSWITCH)
		DRN2 JKJKJK 1 A_WeaponReady (WRF_NOSWITCH)
		DRN2 LMN 2 A_WeaponReady (WRF_NOSWITCH)
		TNT1 A 3 A_WeaponReady (WRF_NOSWITCH)
		TNT1 A 1 A_Jump (256,"AuxAttackEnd")
		Goto RealReady



	/*
	DrainAttack:
		TNT1 A 0
		OHT5 AABB 1
		TNT1 A 0 A_PlaySound ("Kustam/DrainBeamShot",5)
		TNT1 A 0 A_PlaySound ("Kustam/DrainBeamShot",6)
		OHT5 C 1 Bright
		TNT1 A 0 A_RailAttack (30, -4, 0, none, none, RGF_SILENT | RGF_FULLBRIGHT | RGF_NOPIERCING, 0, "DrainBeamTip", 0, 0, 550, 10, 25, 0, "DrainBeamCore")
		OHT5 D 1 Bright //A_FireBullets (0,0,-1,30,"DrainHandBeam",FBF_NORANDOM, 300)
		TNT1 A 0 A_AlertMonsters
		OHT5 E 1 Bright
		OHT5 F 4
		TNT1 A 0 A_JumpIfInventory ("KustamAuxBattery", 1, "ReloadedArm")
		OHT5 GGHHHIIJ 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		TNT1 A 3 A_WeaponReady (WRF_NOSWITCH)
		TNT1 A 0 A_Jump (256,"RealReady")
		Goto RealReady
		*/
		

	//====================================================================
	//====================================================================
	//---------------------OVERCLOCK FORM (BFG)---------------------------
	//====================================================================
	//====================================================================

		
	Overclock:
		TNT1 A 1
		TNT1 A 0 A_TakeInventory ("GunArms",99)
		TNT1 A 0 A_GiveInventory ("SentinelShield",1)
		TNT1 A 0 A_PlaySound ("Kustam/Overclock",0)
		SRM1 ABCDE 2
		TNT1 A 0 A_PlaySound ("Kustam/ClipLoad",0)
		SRM1 F 3
		SRM1 G 2
		SRM1 H 1
		SRM1 IJJJ 2
		TNT1 A 0 A_PlaySound ("Kustam/armsopen",0)
		SRM1 KLMNOPQRS 2
		TNT1 A 0 A_GiveInventory ("SentinelForm",1)		
		TNT1 A 0 A_GiveInventory ("OCLaserAmmo",200)		
		TNT1 A 0 A_GiveInventory ("OCKineticAmmo",200)		
		SRM1 S 2
		goto OverClockReady


		/*Overclock:
			TNT1 A 1
			TNT1 A 0 A_TakeInventory ("GunArms",99)
			TNT1 A 0 A_GiveInventory ("SentinelShield",1)
			TNT1 A 0 A_PlaySound ("Kustam/Overclock",0)
			OCTF ABCDEF 2
			OCTF F 3
			OCTF GHIJK 2
			TNT1 A 0 A_PlaySound ("Kustam/armsopen",0)
			OCTF LLMNOPQRSTUVW 2
			TNT1 A 0 A_GiveInventory ("SentinelForm",1)		
			TNT1 A 0 A_GiveInventory ("OCLaserAmmo",200)		
			TNT1 A 0 A_GiveInventory ("OCKineticAmmo",200)		
			OCIL A 1
			goto OverClockReady*/

	//---------------------------------------------------------------------------

	//Overclock idle-------------------------------------------------------------
	OverClockReady:
		SRM1 S 1 A_WeaponReady (WRF_NOSWITCH)
		TNT1 A 0 A_JumpIfInventory ("SentinelCharge",1,"OverClockReady")
		goto OverClockEnd
	
	//---------------------------------------------------------------------------

	//Overclock Laser Arm--------------------------------------------------------
	OCLaserStart:
		TNT1 A 0
		SRM1 S 1 A_JumpIfInventory ("SentinelCharge",1,"OCLaserAmmoCheck")
		goto OverClockEnd
	OCLaserAmmoCheck:
		TNT1 A 0
		SRM2 ABC 1
		TNT1 A 0 A_JumpIfInventory ("KustamOCLaserReload",1,"OCBatonShot")
		SRM2 C 1 A_JumpIfInventory ("OCLaserAmmo", 1, "RealFire")
	OCBatonShot:
		TNT1 A 0 A_StopSound (6)
		SRM2 D 1 A_GunFlash ("SentinelBatonFlash")
		TNT1 A 0 A_TakeInventory ("OCLaserActive",99)
		TNT1 A 0 A_PlaySound ("Kustam/BatonShot",CHAN_WEAPON)
		TNT1 A 0 A_FireCustomMissile ("KustamWeaponSmoke",Random (-13, 13),0,-7,4,0,0)
		TNT1 A 0 A_FireCustomMissile ("KustamBatonShot",0,0,-6,-1)
		SRM2 DFEC 1
		TNT1 A 0 A_Refire ("OCBatonLoopCheck")
		SRM2 CCBA 2 A_WeaponReady (WRF_NOPRIMARY|WRF_NOSWITCH)
		Goto OverClockReady
		
	Realfire:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory ("SentinelFlamerToken",999)
		TNT1 A 0 A_GiveInventory ("SentinelLaserToken",1)
		SRM2 D 1 A_GunFlash ("SentinelLaserFlash")
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("Kustam/NormalLaserStart",0)
		TNT1 A 0 A_PlaySound ("Kustam/VentLaser1",6,1,1)
		TNT1 A 0 A_FireCustomMissile ("OCBeamImpact",0,0,-8)
		TNT1 A 0 A_FireCustomMissile ("KustamWeaponSmoke",0,0,-7,2,0,0)
		TNT1 A 0 A_RailAttack (80, -7, 1, none, none, RGF_SILENT | RGF_NOPIERCING | RGF_FULLBRIGHT, 0, "OCBeamTip", 0, 0, 1024, 6, 6, 1, "OCBeamIgnite", -1)
	OCLaserLoop:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("SentinelCharge",1,2)
		TNT1 A 0 A_Jump (256, "OverClockEnd")
		SRM2 E 1 bright A_GunFlash ("SentinelLaserFlashLoop")
		TNT1 A 0 A_FireCustomMissile ("OCBeamImpact",0,0,-8)
		TNT1 A 0 A_FireCustomMissile ("KustamWeaponSmoke",0,0,-7,2,0,0)
		TNT1 A 0 A_TakeInventory ("OCLaserAmmo",5)
		TNT1 A 0 A_FireBullets (0,0,-1,0,"OCBeamTipFX1",FBF_NORANDOM,1024)
		TNT1 A 0 A_RailAttack (80, -7, 1, none, none, RGF_SILENT | RGF_NOPIERCING | RGF_FULLBRIGHT, 0, "OCBeamTip", 0, 0, 1024, 6, 6, 1, "OCBeam", -1)
		TNT1 A 0 ACS_NamedExecuteAlways("KustamAmmoWarning",0,2,0,0)	
		SRM2 F 1 bright
		SRM2 F 1 A_ReFire ("LaserLoopCheck")
		Goto OCLaserEnd
	LaserLoopCheck:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("SentinelCharge",1,2)
		TNT1 A 0 A_Jump (256, "OverClockEnd")
		TNT1 A 0 A_JumpIfInventory ("KustamOCLaserReload", 1, "OCBatonShot")
		TNT1 A 0 A_JumpIfInventory ("OCLaserAmmo", 1, "OCLaserLoop")
		SRM2 E 2 A_WeaponReady (WRF_NOPRIMARY|WRF_NOSWITCH)
		Goto OCLaserEnd
	OCBatonLoopCheck:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("SentinelCharge",1,2)
		TNT1 A 0 A_Jump (256, "OverClockEnd")
		TNT1 A 0 A_JumpIfInventory ("KustamOCLaserReload", 1, "OCBatonShot")
		TNT1 A 0 A_JumpIfInventory ("OCLaserAmmo", 1, "RealFire")
		SRM2 CCBA 2 A_WeaponReady (WRF_NOPRIMARY|WRF_NOSWITCH)
		Goto OverClockReady

	
	OCLaserEnd:
		TNT1 A 0
		TNT1 A 0 A_StopSound (6)
		TNT1 A 0 A_PlaySound("Kustam/Laser3", 5)
		TNT1 A 0 A_PlaySound("Kustam/Laser3", 6,0.60)
		TNT1 A 0 A_JumpIfInventory ("KustamOCLaserReload",1,3)
		TNT1 A 0 A_FireCustomMissile ("OCBeamImpact",0,0,-8)
		TNT1 A 0 A_GunFlash ("SentinelLaserFlashEnd")
		SRM2 D 1 Bright A_RailAttack (80, -8, 1, none, none, RGF_SILENT | RGF_NOPIERCING | RGF_FULLBRIGHT, 0, "OCBeamTip", 0, 0, 1024, 6, 6, 1, "OCBeamFinisher", -1)
		TNT1 A 0 A_TakeInventory ("OCLaserActive",99)
		SRM2 EF 1 Bright
		SRM2 GGHHHHHHIIJ 2 A_WeaponReady (WRF_NOPRIMARY|WRF_NOSWITCH)
		Goto OverClockReady
	
	
	//Flash states for the Laser Arm
	SentinelLaserFlash:
		SRF1 A 1 Bright
		GoTo AllFlashEnd
	SentinelLaserFlashLoop:
		SRF1 BC 1 Bright
		GoTo AllFlashEnd
	SentinelLaserFlashEnd:
		SRF1 DEFGH 1 Bright
		GoTo AllFlashEnd

	SentinelBatonFlash:
		SRF2 AABCD 1 Bright
		GoTo AllFlashEnd

	AllFlashEnd:
		TNT1 A 1
		stop
	//---------------------------------------------------------------------------

	//Overclock Kinetic Arm--------------------------------------------------------
	OCKineticArmStart:
		SRM1 S 1
		TNT1 A 0 A_TakeInventory ("OCLaserActive",99)
		TNT1 A 0 A_JumpIfInventory ("SentinelCharge",1,"OCKineticAmmoCheck")
		goto OverClockEnd
	OCKineticAmmoCheck:
		TNT1 A 0 A_TakeInventory ("SentinelLaserToken",999)
		TNT1 A 0 A_GiveInventory ("SentinelFlamerToken",1)
		SRM3 AB 1
		TNT1 A 0 A_JumpIfInventory ("KustamOCKineticReload",1,"OCLaserReclaimer")
		SRM3 B 1 A_JumpIfInventory ("OCKineticAmmo", 1, "KineticBlaster")
		Goto OverClockReady
	OCLaserReclaimer:
		SRM3 B 1
		TNT1 A 0 A_GunFlash ("SentinelReclaimerFlash")
		TNT1 A 0 A_PlaySound ("Kustam/ReclaimBeamShot",CHAN_WEAPON)
		SRM3 B 1
		TNT1 A 0 Bright A_FireCustomMissile("KustamScatterBeam3",-12,0,9)
		TNT1 A 0 Bright A_FireCustomMissile("KustamScatterBeam3",12,0,9)
		TNT1 A 0 Bright A_FireCustomMissile("KustamScatterBeam3",-6,0,9)
		TNT1 A 0 Bright A_FireCustomMissile("KustamScatterBeam3",6,0,9)
		TNT1 A 0 Bright A_FireCustomMissile("KustamScatterBeam3",0,0,9)
		SRM3 CC 2 A_WeaponReady (WRF_NOBOB|WRF_NOSECONDARY|WRF_NOSWITCH)
		SRM3 D 1 A_WeaponReady (WRF_NOBOB|WRF_NOSECONDARY|WRF_NOSWITCH)
		SRM3 EEBB 2 A_WeaponReady (WRF_NOBOB|WRF_NOSECONDARY|WRF_NOSWITCH)
		TNT1 A 0 A_ReFire ("OCKineticLoopCheck")
		SRM3 FG 2 A_WeaponReady (WRF_NOBOB|WRF_NOSECONDARY|WRF_NOSWITCH)
		TNT1 A 0 A_JumpIfInventory ("SentinelCharge",1,"OverClockReady")
		goto OverClockEnd
	KineticBlaster:
		SRM3 B 1
		TNT1 A 0 A_GunFlash ("SentinelKineticFlash")
		TNT1 A 0 A_PlaySound ("Kustam/SuMGLV2",6)
		SRM3 B 1
		TNT1 A 0 A_Quake(2, 10, 0, 32)
		TNT1 A 0 ACS_NamedExecuteAlways("KustamAmmoWarning",0,3,0,0)	
		TNT1 A 0 A_TakeInventory ("OCKineticAmmo",25)
		TNT1 A 0 Bright A_FireCustomMissile("KustamOverClockPellet",-6,0,9)
		TNT1 A 0 Bright A_FireCustomMissile("KustamOverClockPellet",6,0,9)
		TNT1 A 0 Bright A_FireCustomMissile("KustamOverClockPellet",0,0,9)
		TNT1 A 0 Bright A_FireCustomMissile("KustamOverClockPellet",-12,0,9)
		TNT1 A 0 Bright A_FireCustomMissile("KustamOverClockPellet",12,0,9)

		SRM3 C 2 bright 
		TNT1 A 0 A_TakeInventory ("SentinelFlamerToken",999)
		SRM3 DD 1 A_WeaponReady (WRF_NOBOB|WRF_NOSECONDARY|WRF_NOSWITCH)
		SRM3 E 4 A_WeaponReady (WRF_NOBOB|WRF_NOSECONDARY|WRF_NOSWITCH)
		SRM3 BB 2 A_WeaponReady (WRF_NOBOB|WRF_NOSECONDARY|WRF_NOSWITCH)
		TNT1 A 0 A_ReFire ("OCKineticLoopCheck")
		SRM3 FG 2 A_WeaponReady (WRF_NOBOB|WRF_NOSECONDARY|WRF_NOSWITCH)
		TNT1 A 0 A_JumpIfInventory ("SentinelCharge",1,"OverClockReady")
		goto OverClockEnd
	
	OCKineticLoopCheck:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("SentinelCharge",1,2)
		TNT1 A 0 A_Jump (256, "OverClockEnd")
		TNT1 A 0 A_JumpIfInventory ("KustamOCKineticReload", 1, "OCLaserReclaimer")
		TNT1 A 0 A_JumpIfInventory ("OCKineticAmmo", 1, "KineticBlaster")
		SRM3 FG 2 A_WeaponReady (WRF_NOBOB|WRF_NOSECONDARY|WRF_NOSWITCH)
		Goto OverClockReady


	
	//Flash states for the Kinetic Arm
	SentinelKineticFlash:
		SRF3 A 1 Bright
		SRF3 B 2 Bright
		SRF3 DD 1 Bright
		SRF3 EE 1 Bright
		GoTo AllFlashEnd

	SentinelReclaimerFlash:
		SRF4 ABBCD 1 Bright
		GoTo AllFlashEnd

	//---------------------------------------------------------------------------

	//Overclock End-------------------------------------------------------
	OverClockEnd:
		TNT1 A 0
		TNT1 A 0 A_StopSound (6)
		TNT1 A 0 A_TakeInventory ("SentinelForm",99)
		TNT1 A 0 A_TakeInventory ("GunArms",99)
		TNT1 A 0 A_TakeInventory ("SentinelCharge",999)

		TNT1 A 0 A_TakeInventory ("KustamOCLaserReload",999)	
		TNT1 A 0 A_TakeInventory ("KustamOCKineticReload",999)	
		TNT1 A 0 A_GiveInventory ("OCLaserAmmo",999)
		TNT1 A 0 A_GiveInventory ("OCKineticAmmo",999)
		TNT1 A 0 A_PlaySound ("kustam/ventretract1",0)
		SRM4 ABC 2
		TNT1 A 0 A_PlaySound ("kustam/ventretract2",0)
		SRM4 DE 2
		TNT1 A 0 A_PlaySound ("kustam/ventextend2",0)
		SRM4 F 1
		SRM4 GGHHII 2
		SRM4 JKLMN 2
		TNT1 A 15
	ArmsDown:
		TNT1 A 1
		TNT1 A 0 A_TakeInventory ("SentinelShield",999)
		TNT1 A 0 A_TakeInventory ("SentinelForm",99)
		TNT1 A 0 A_TakeInventory ("GunArms",99)
		TNT1 A 0 A_Jump (256,"Ready")
		Goto Ready


	//====================================================================
	//====================================================================
	//---------------------------THE BARREL-------------------------------
	//====================================================================
	//====================================================================

	BarrelEquip:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("Kustam/BarrelLift")
		KBR1 ABCD 1
	BarrelReady:
		KBR1 E 1 A_WeaponReady (WRF_NOSWITCH)
		loop
	BarrelKick:
		TNT1 A 0
		KBR2 A 2
		TNT1 A 2
		LEG1 AB 1
		TNT1 A 0 Offset (0,62)
		TNT1 A 0 A_PlaySound("Kustam/Kick", 5)
		TNT1 A 0 A_PlaySound("Kustam/KickEcho", 6)
		TNT1 A 0 A_PlaySound("Kustam/KickEcho", 7)
		TNT1 A 0 A_FireCustomMissile ("KustamKickedBarrel")
		LEG1 DEDEDDEE 1
		LEG1 E 4
		LEG1 EFF 1
		TNT1 A 0 A_TakeInventory ("UsingKustamKick",99)
		TNT1 A 0 A_TakeInventory ("BarrelToken",1)
		TNT1 A 0 A_TakeInventory ("GoldenBarrelToken",1)
		TNT1 A 0 A_Weaponready
		LEG1 G 1
		LEG1 HI 2 A_WeaponReady (WRF_NOSECONDARY|WRF_NOBOB)
		TNT1 A 2 
		TNT1 A 1 
		TNT1 A 0 A_Jump (256,"Ready")
		goto Ready
	BarrelCancel:
		TNT1 A 0
		TNT1 A 4 A_FireCustomMissile ("DroppedBarrel")
		TNT1 A 1 A_TakeInventory ("BarrelToken",1)
		TNT1 A 3 A_WeaponReady (WRF_NOSECONDARY|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		TNT1 A 0 A_Jump (256,"Ready")
		goto Ready
	
	//Golden Barrel

	GoldenBarrelEquip:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("Kustam/BarrelLift")
		KBR3 ABCD 1
	GoldenBarrelReady:
		KBR3 E 1 A_WeaponReady (WRF_NOSWITCH)
		loop
	GoldenBarrelKick:
		TNT1 A 0
		KBR4 A 2
		TNT1 A 2
		LEG1 AB 1
		TNT1 A 0 Offset (0,62)
		TNT1 A 0 A_PlaySound("Kustam/Kick", 5)
		TNT1 A 0 A_PlaySound("Kustam/KickEcho", 6)
		TNT1 A 0 A_PlaySound("Kustam/KickEcho", 7)
		TNT1 A 0 A_FireCustomMissile ("KustamKickedGoldenBarrel")
		LEG1 DEDEDDEE 1
		LEG1 E 4
		LEG1 EFF 1
		TNT1 A 0 A_TakeInventory ("UsingKustamKick",99)
		TNT1 A 0 A_TakeInventory ("BarrelToken",1)
		TNT1 A 0 A_TakeInventory ("GoldenBarrelToken",1)
		TNT1 A 0 A_Weaponready
		LEG1 G 1
		LEG1 HI 2 A_WeaponReady (WRF_NOSECONDARY|WRF_NOBOB)
		TNT1 A 2 
		TNT1 A 1 
		TNT1 A 0 A_Jump (256,"Ready")
		goto Ready
	GoldenBarrelCancel:
		TNT1 A 0
		TNT1 A 4 A_FireCustomMissile ("DroppedGoldenBarrel")
		TNT1 A 1 A_TakeInventory ("BarrelToken",1)
		TNT1 A 1 A_TakeInventory ("GoldenBarrelToken",1)
		TNT1 A 3 A_WeaponReady (WRF_NOSECONDARY|WRF_ALLOWZOOM|WRF_ALLOWRELOAD)
		TNT1 A 0 A_Jump (256,"Ready")
		goto Ready

	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//=====================================================
//=====================================================
//STANDARD HITSCAN ATTACK
//=====================================================
//=====================================================


ACTOR KustamPuff1 : BulletPuff
{
	+PUFFGETSOWNER
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	+THRUSPECIES
	+MTHRUSPECIES
	+PUFFONACTORS
	+bright
	+NOEXTREMEDEATH
	+FORCEXYBILLBOARD
	+FORCERADIUSDMG
	species "Friendly"
	RenderStyle Translucent
	Alpha 0.6
	VSpeed 0.20
	scale 0.60
	Mass 5
	decal KustamStaff
	States
	{
	Spawn:
	Death:
	Crash:
		TNT1 A 1 
		TNT1 A 0 A_PlaySound ("Kustam/HVolleyHit",0)
		TNT1 A 0 A_PlaySound ("Kustam/VentBoosterHit",0,0.50)
		TNT1 A 0 A_TakeFromTarget ("KustamLaserCombo",10)
		TNT1 A 0 A_TakeFromTarget ("KustamLaserComboPause",1)
		TNT1 A 0 A_RadiusGive ("BossBrainSmoother", 250, RGF_OBJECTS, 1)
		TNT1 A 0 A_SetScale (0.75,0.75)
		TNT1 A 1 A_SetScale (scalex * frandom(1.10,1.20),scaley * frandom(1.10,1.20))
		TNT1 A 0 A_PlaySound ("Kustam/HVolleyHit",0)
		TNT1 A 0 A_PlaySound ("Kustam/VentBoosterHit",0,0.30)
		SMSK AB 1 A_SpawnItemEx("SteamFX",5,0,0,frandom(-3,3),frandom(-3,3),frandom(-3,3),0,SXF_NOCHECKPOSITION)
		SMSK C 1 A_SetScale (scalex * frandom(1.10,1.20),scaley * frandom(1.10,1.20))
		SMSK D 1 A_SetScale (scalex * frandom(1.12,1.22),scaley * frandom(1.12,1.22))
		SMSK D 1 A_SetScale (scalex * frandom(1.13,1.23),scaley * frandom(1.13,1.23))
		stop	
	XDeath:
		TNT1 A 0
		TNT1 A 0 A_SetScale (0.75,0.75)
		TNT1 A 1 A_SetScale (scalex * frandom(1.10,1.20),scaley * frandom(1.10,1.20))
		TNT1 A 0 A_PlaySound ("Kustam/HVolleyHit",0)
		TNT1 A 0 A_PlaySound ("Kustam/VentBoosterHit",0,0.30)
		TNT1 A 0 A_GiveToTarget ("SentinelCharge",1)
		TNT1 A 0 A_JumpIfInTargetInventory ("LaserComboUpgrade",1,2)
		TNT1 A 0 A_Jump (256,2)
		TNT1 A 0 A_GiveToTarget ("KustamLaserCombo",12)
		TNT1 A 0 A_GiveToTarget ("KustamLaserComboPause",1)
		SMSK AB 1
		SMSK C 1 A_SetScale (scalex * frandom(1.10,1.20),scaley * frandom(1.10,1.20))
		SMSK D 1 A_SetScale (scalex * frandom(1.12,1.22),scaley * frandom(1.12,1.22))
		SMSK D 1 A_SetScale (scalex * frandom(1.13,1.23),scaley * frandom(1.13,1.23))
		stop
	}
}


ACTOR KustamPuff2 : KustamPuff1
{
	Alpha 0.10
	scale 0.50
	States
	{
	Spawn:
	Death:
	Crash:
		TNT1 A 0 
		TNT1 A 0 A_SetScale (0.75,0.75)
		TNT1 A 1 A_SetScale (scalex * frandom(1.10,1.20),scaley * frandom(1.10,1.20))
		SMSK AB 1 A_SpawnItemEx("SteamFX",5,0,0,frandom(-3,3),frandom(-3,3),frandom(-3,3),0,SXF_NOCHECKPOSITION,80)
		SMSK C 1 A_SetScale (scalex * frandom(1.10,1.20),scaley * frandom(1.10,1.20))
		SMSK D 1 A_SetScale (scalex * frandom(1.12,1.22),scaley * frandom(1.12,1.22))
		SMSK D 1 A_SetScale (scalex * frandom(1.13,1.23),scaley * frandom(1.13,1.23))
		stop	
	XDeath:
		TNT1 A 1 A_SetScale (scalex * frandom(1.10,1.20),scaley * frandom(1.10,1.20))
		//TNT1 A 0 A_PlaySound ("Kustam/HVolleyHit",0)
		TNT1 A 0 A_PlaySound ("Kustam/VentBoosterHit",0,0.05)
		TNT1 A 0 A_Jump (220,2)
		TNT1 A 0 A_GiveToTarget ("SentinelCharge",Random(0,1))
		SMSK AB 1
		SMSK C 1 A_SetScale (scalex * frandom(1.10,1.20),scaley * frandom(1.10,1.20))
		SMSK D 1 A_SetScale (scalex * frandom(1.12,1.22),scaley * frandom(1.12,1.22))
		SMSK D 1 A_SetScale (scalex * frandom(1.13,1.23),scaley * frandom(1.13,1.23))
		stop
	}
}



//Standard Beam
ACTOR PistolBeam1
{   
	+NOINTERACTION
	+NOGRAVITY
	+FORCEXYBILLBOARD
	+bright
	RenderStyle add
	Alpha 0.20
	Scale 0.25
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_CheckRange (40,"Emit")
		TNT1 A 1
		stop
	Emit:
		RSP2 A 1 A_SetScale (0.50,0.50) 
		TNT1 A 0 A_FadeIn (0.75)
		RSP2 A 1 A_SetScale (0.25,0.25) 
		RSP2 A 1 A_SetScale (0.12,0.12) 
		RSP2 A 1 A_SetScale (0.06,0.06) 
		Stop
	}
}

ACTOR PistolBeam2 : PistolBeam1
{   
	States
	{
	Emit:
		RSP2 A 1 A_SetScale (1,1) 
		TNT1 A 0 A_FadeIn (0.75)
		RSP2 A 1 A_SetScale (0.50,0.50) 
		RSP2 A 1 A_SetScale (0.25,0.25) 
		RSP2 A 1 A_SetScale (0.12,0.12) 
		Stop
	}
}

ACTOR PistolBeam3 : PistolBeam1
{   
	States
	{
	Emit:
		RSP2 A 1 A_SetScale (2,2) 
		TNT1 A 0 A_FadeIn (0.75)
		RSP2 A 1 A_SetScale (1,1) 
		RSP2 A 1 A_SetScale (0.50,0.50) 
		RSP2 A 1 A_SetScale (0.25,0.25) 
		Stop
	}
}



//=====================================================
//=====================================================
//BEAM TIP
//=====================================================
//=====================================================


ACTOR HeatBeamTip : BulletPuff
{
	+PUFFGETSOWNER
	+NOBLOCKMAP
	+NOGRAVITY
	+RANDOMIZE
	+ALWAYSPUFF
	+PUFFONACTORS
	+BLOODLESSIMPACT
	+NODAMAGETHRUST
	+THRUSPECIES
	+MTHRUSPECIES
	+THRUSPECIES
	+HITTRACER
	-ALLOWPARTICLES
	+bright
	Species "Friendly"
	RenderStyle Add
	Alpha 0.50
	VSpeed 0
	scale 0.20
	Mass 5
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1 
		TNT1 A 2
		stop
	Death:
		TNT1 A 1 
		TNT1 A 2
		stop
	Xdeath:
		TNT1 A 1 
		TNT1 A 2
		stop
	}
}



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//=====================================================
//=====================================================
//RECLAIMATOR ATTACK
//=====================================================
//=====================================================


actor KustamBatonShot : fastprojectile
{
	projectile
	+bloodlessimpact
	+thruspecies
	+dontblast
	+HITTRACER
	+bright
	species "Friendly"
	damage (30)
	Radius 8
	height 8
	scale 2
	speed 100
	decal KustamStaff
	
	ProjectileKickBack 600
	states
	{
	spawn:
		BTB1 A 1 
		loop
	Crash:
	Death:
		TNT1 A 0
		TNT1 A 0 A_Stop
		TNT1 A 0 A_SetScale (0.60,0.60)	
		TNT1 A 0 A_SetTranslucent (0.90,1)
		STBE B random(1,2)
		TNT1 A 0 A_PlaySound("Kustam/ClipPing", 5)
		TNT1 A 0 Radius_Quake (1,6,0,20,0)
		TNT1 A 0 A_SpawnItemEx ("BatonShotBounceOff",0,0,0,frandom(-5,-1),frandom(-10,10),frandom(6,12),0, SXF_NOCHECKPOSITION)
		STBE CDE 2
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0 A_Stop
		TNT1 A 0 A_SetScale (1,1)	
		TNT1 A 0 A_SetTranslucent (0.90,1)
		STBE B random(1,2)
		TNT1 A 0 Radius_Quake (1,6,0,20,0)
		TNT1 A 0 A_PlaySound("Kustam/jabhit", 5)
		TNT1 A 0 A_PlaySound("Kustam/jabhit", 6)
		TNT1 A 0 A_JumpIfInTargetInventory ("KustamOCLaserReload",1,"OCCharge")
		TNT1 A 0 A_GiveToTarget ("KustamLaserBattery", 20)
		TNT1 A 0 A_GiveToTarget ("SentinelCharge",2)
		TNT1 A 0 A_SpawnItemEx ("BatonShotBounceOff",0,0,0,frandom(-5,-1),frandom(-10,10),frandom(6,12),0, SXF_NOCHECKPOSITION)
		STBE CDE 2
		stop
	OCCharge:
		TNT1 A 0 A_GiveToTarget ("OCLaserAmmo",20)
		TNT1 A 0 A_SpawnItemEx ("BatonShotBounceOff",0,0,0,frandom(-5,-1),frandom(-10,10),frandom(6,12),0, SXF_NOCHECKPOSITION)
		STBE CDE 2
		stop
		
	}
}


ACTOR BatonShotBounceOff
{
	PROJECTILE
	Gravity .75
	BounceType Doom
	Bouncesound "Kustam/ClipPing"
	-NOGRAVITY
	//-NOBLOCKMAP
	+THRUACTORS
    +NOTELEPORT
	+NOBLOOD
	+NOEXTREMEDEATH
	+FORCERADIUSDMG
	+BLOODLESSIMPACT
	+MOVEWITHSECTOR
	Mass 5
	Radius 3
	Height 3
	Bouncecount 3
	scale 1
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump (100,2)
		TNT1 A 0 A_SetScale (-1,1)
		BTB1 BCBCBCBC 2
	Spawn2:
		BTB1 GDEF 2
		Loop
	Death:
		TNT1 A 0
		TNT1 A 0 A_Jump (60, "Death2")
		BTB1 E Random (300,450)
		Stop
	Death2:
		BTB1 H Random (300,450)
		Stop
		
	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//=====================================================
//=====================================================
//Stock ATTACKS
//=====================================================
//=====================================================


//The normal Stock attack
actor StockStrike1 : fastprojectile
{
	Projectile
	projectilekickback 100
	speed 130
	damage (60)
	obituary "%o was smashed by %k's gun stock."
	-BLOODSPLATTER
	+Bloodlessimpact
	+thruspecies
	+dontblast
	+bright
	+noblood
	+NOEXTREMEDEATH
	+DONTREFLECT
	species "friendly"
	height 10
	radius 10
	decal KustamStaff
	mass 1000000
	states
	{
	Spawn:
		TNT1 A 1
		TNT1 A 0
		stop
	Crash:
	Death:
		TNT1 A 0
		TNT1 A 0 A_Stop
		TNT1 A 0 A_GiveToTarget ("StockHit",1)
		TNT1 A 1
		TNT1 A 0 A_PlaySound("Kustam/KickMiss", 5)
		TNT1 A 0 A_PlaySound("Kustam/KickMiss", 6)
		TNT1 A 0 Radius_Quake (4,8,0,15,0)
		TNT1 A 5
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0 A_Stop
		TNT1 A 0 A_PlaySound("Kustam/Staffhit", 5)
		TNT1 A 0 A_PlaySound("Kustam/Staffhit", 6)
		TNT1 A 0 A_PlaySound("Kustam/Staffhit", 7)
		TNT1 A 0 Radius_Quake (3,3,0,10,0)
		TNT1 A 0 A_GiveToTarget ("StockHit",1)
		TNT1 A 1
		STBE B random(1,2)
		TNT1 A 0 A_Stop
		//TNT1 A 0 A_GiveToTarget ("BatonHeatExchanger",1)
		TNT1 A 0 A_JumpIfInTargetInventory ("KustamKineticReload", 1,2)
		TNT1 A 0 A_TakeFromTarget ("KustamKineticBattery",5)
		TNT1 A 0 A_GiveToTarget ("KustamLaserBattery",15)
		TNT1 A 0 A_GiveToTarget ("KustamLaserComboPause",1)
		STBE CDE 2
		stop
	}
}

//The explosive finisher
actor StockStrike2 : StockStrike1
{
	damage (60)
	decal KustamStaff
	mass 1000000
	states
	{
	Spawn:
		TNT1 A 1
		TNT1 A 0
		Goto Death
	Crash:
	Xdeath:
	Death:
		TNT1 A 0
		TNT1 A 0 A_Stop
		TNT1 A 0 A_PlaySound("Kustam/SweepHit", 5)
		TNT1 A 0 A_PlaySound("Kustam/SweepHit", 6)
		TNT1 A 0 A_PlaySound("Kustam/SweepHit", 7)
		TNT1 A 0 Radius_Quake (3,3,0,10,0)
		TNT1 A 1
		TNT1 A 0 A_TakeFromTarget ("KustamKineticBattery",10)
		TNT1 A 0 A_SpawnItemEx ("360SplashEffect",0,0,-25,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_RadiusGive ("StockSmashBooster", 90, RGF_MONSTERS)
		TNT1 A 0 A_RadiusGive ("RadialStockHit",150,RGF_MONSTERS|RGF_CUBE,1)
		//TNT1 A 0 A_Explode (80,130,0,1,130)
		TNT1 A 0 A_RadiusThrust (12000,300,RTF_NOIMPACTDAMAGE)
		TNT1 A 0 A_Stop
		TNT1 A 0 A_JumpIfInTargetInventory ("SlowModule",1,"ApplySlow")
		TNT1 A 3
		stop
	ApplySlow:
		TNT1 A 0
		TNT1 A 0 A_RadiusGive ("SlowedEffect",260,RGF_MONSTERS,1)
		TNT1 A 3
		stop
	}
}

//Radial ammo drain effect

actor RadialStockHit : custominventory
{
	+inventory.alwayspickup
	+INVENTORY.AUTOACTIVATE
	states
	{
	pickup:
		TNT1 A 0
		TNT1 A 1 A_CheckFlag ("Friendly", "NoHit")
		TNT1 A 0 A_JumpIf(CheckClass("ExplosiveBarrel", AAPTR_DEFAULT, TRUE), "NoHit")
		TNT1 A 0 A_JumpIfInventory ("SpiritSafety",1,"NoHit")
		TNT1 A 0 A_JumpIfInventory ("RadialStockSafety",1,"NoHit")
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_TakeFromTarget ("KustamKineticBattery",4)
		TNT1 A 0 A_GiveInventory("KustamLaserBattery",8, AAPTR_TARGET)
		TNT1 A 0 A_GiveToTarget ("KustamLaserComboPause",1)
		TNT1 A 1 A_SpawnItemEx ("RadialStockStrikeFX",0,0,34,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 DamageThing (60)
		TNT1 A 1 A_CheckFlag ("Float", "PullDown")
		TNT1 A 0 A_TakeInventory ("RadialStockSafety",1)
		stop
	NoHit:
		TNT1 A 0
		TNT1 A 1 A_TakeInventory ("RadialStockSafety",1)
		stop
	PullDown:
		TNT1 A 0
		TNT1 A 0 ThrustThingZ (0,45,1,0)
		TNT1 A 1 A_TakeInventory ("RadialStockSafety",1)
		stop
	}
}


actor RadialStockSafety : Powerup
{
	Powerup.Duration -1
}	


ACTOR RadialStockStrikeFX
{
	+NOBLOCKMAP
	+NOGRAVITY
	+NOCLIP
	+NOTELEPORT
	+bright
	renderstyle add
	alpha 0.70
	scale 1.50
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("Kustam/RadialHit", 5)
		TNT1 A 0 A_PlaySound("Kustam/RadialHit", 6)
		TNT1 A 0 A_PlaySound("Kustam/RadialHit", 7)
		TNT1 A 0 Radius_Quake (3,3,0,10,0)
		TNT1 A 0 A_GiveToTarget ("StockHit",1)
		TNT1 A 1
		STBE B random(1,2)
		TNT1 A 0 A_Stop
		TNT1 A 0 Radius_Quake (2,10,0,10,0)
		STBE CDE 2
		TNT1 A 2
		stop
	Death:
		TNT1 A 0
		TNT1 A 1
		stop
	}
}


//Berserk ring shockwave attack

actor StockShockwave
{
	Projectile
	projectilekickback 100
	speed 30
	-BLOODSPLATTER
	+Bloodlessimpact
	+thruspecies
	+dontblast
	+bright
	+noblood
	+NOEXTREMEDEATH
	+DONTREFLECT
	+FLOORHUGGER
	+ripper
	+FORCERADIUSDMG
	damage (0)
	species "friendly"
	height 10
	radius 10
	decal KustamStaff
	mass 1000000
	
	ReactionTime 7
	States
	{
	Spawn:
		TNT1 A 2
		TNT1 A 0 A_Explode (50,80,0,0,80)
		TNT1 A 0 A_Blast (BF_AFFECTBOSSES|BF_NOIMPACTDAMAGE,60,100,10,"InvisibleFX","Silence")
		TNT1 AA 0 A_RadiusGive ("StockSmashBooster", 90, RGF_MONSTERS)
		TNT1 A 0 A_PlaySound ("Kustam/Shockwave",5,1)
		TNT1 A 0 A_PlaySound ("Kustam/Shockwave",6,1)
		TNT1 A 1 A_SpawnItemEx ("StockShockwaveTrail",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_Countdown
		loop
	Death:
		TNT1 A 0
		TNT1 A 1
		Stop
	}
}

actor StockShockwaveTrail
{
	projectile
	+notimefreeze
	+nointeraction
    +FORCEXYBILLBOARD	
	+LOOKALLAROUND
	+DONTBLAST
	+CLIENTSIDEONLY
	+NOCLIP
	+Bright
	radius 2
	speed 50
    Scale 1.50
	renderstyle Add
	alpha 0.70
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_CheckRange (50,"Emit")
		TNT1 A 1
		stop
	Emit:
		TNT1 A 0
		KB1S AB 2
		KSPK J 1 A_SetScale (scalex * frandom(1.10,1.20),scaley * frandom(1.10,1.20))
		KSPK J 1 A_SetScale (scalex * frandom(1.12,1.22),scaley * frandom(1.12,1.22))
		KSPK J 1 A_SetScale (scalex * frandom(1.13,1.23),scaley * frandom(1.13,1.23))
		KSPK J 1 A_SetScale (scalex * frandom(1.14,1.24),scaley * frandom(1.14,1.24))
		KSPK J 1 A_SetScale (scalex * frandom(1.15,1.25),scaley * frandom(1.15,1.25))
		stop
	death:
		TNT1 A 0 
		TNT1 A 1 
		stop
	}
}



ACTOR StockSmashBooster : CustomInventory
{
	+AUTOACTIVATE
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		Stop
	Use:
		TNT1 A 0
		TNT1 A 0 A_CheckFloor ("Boomst")
		//TNT1 A 0 A_JumpIf (Z <= FloorZ+8,"PullDown")
		TNT1 A 0 ThrustThingZ (0,35,1,0)
		TNT1 A 1 
		Stop
	Boomst:
		TNT1 A 0 ThrustThingZ (0,35,0,0)
		TNT1 A 1 
		Stop
		
	/*PullDown:
		TNT1 A 0 ThrustThingZ (0,35,1,0)
		TNT1 A 1 
		Stop
		*/
	}
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//=====================================================
//=====================================================
//KICK ATTACKS
//=====================================================
//=====================================================


actor KustamKick : fastprojectile
{
	Projectile
	projectilekickback 600
	speed 160
	damage (30)
	obituary "%o was punted by %k's mighty boot."
	Damagetype "KustamKick"
	+BLOODSPLATTER
	+THRUSPECIES
	+DONTBLAST
	//+FORCEPAIN
	+bright
	+DONTREFLECT
	+HITTRACER
	species "friendly"
	height 15
	radius 12
	+NOBLOOD
	+NOEXTREMEDEATH
	decal KustamWall
	mass 1000000
	states
	{
	Spawn:
		TNT1 A 1
		stop
	Crash:
	Death:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_PlaySound("Kustam/KickMiss", 5)
		TNT1 A 0 A_PlaySound("Kustam/KickMiss", 6)
		TNT1 A 0 A_PlaySound("Kustam/KickMiss", 7)
		TNT1 A 0 Radius_Quake (4,8,0,15,0)
		TNT1 A 5 
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("Kustam/Kick", 5)
		TNT1 A 0 A_PlaySound("Kustam/KickEcho", 6)
		TNT1 A 0 A_PlaySound("Kustam/KickEcho", 7)
		TNT1 A 0 Radius_Quake (3,3,0,10,0)
		TNT1 A 0 ACS_ExecuteWithResult(991,0,1,1)//flyback//--Change arg4 for higher knockback distances. 2 is pretty big tho.
		TNT1 A 1 A_RadiusThrust (6000,20,RTF_NOIMPACTDAMAGE)
		//TNT1 A 0 A_GiveToTarget ("KustamAuxCharge",10)
		KSPK A 2
		TNT1 A 4
		stop
	}
}


actor KustamRegen : PowerRegeneration
{
	Powerup.Duration -2
	Powerup.Strength 10
	Powerup.Color 0, 0, 0, 0
    inventory.maxamount 1
    +INVENTORY.AUTOACTIVATE
}



actor FastKustamKick : KustamKick
{
	projectilekickback 0
	states
	{
	Xdeath:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("Kustam/Kick", 5)
		TNT1 A 0 A_PlaySound("Kustam/KickEcho", 6)
		TNT1 A 0 A_PlaySound("Kustam/KickEcho", 7)
		TNT1 A 0 Radius_Quake (3,3,0,10,0)
		TNT1 A 1
		KSPK A 2
		TNT1 A 4
		stop
	}
}


actor SuperKustamKick : fastprojectile
{
	Projectile
	speed 200
	damage (300)
	obituary "%o was punted by %k's mighty boot."
	+BLOODSPLATTER
	+THRUSPECIES
	+DONTBLAST
	+FORCEPAIN
	+FORCERADIUSDMG
	+bright
	+HITTRACER
	+DONTREFLECT
	species "friendly"
    damagetype "SuperKick"
	height 20
	radius 15
	+noblood
	+NOEXTREMEDEATH
	decal KustamWall
	mass 1000000
	states
	{
	Spawn:
		TNT1 A 1
		stop
	Crash:
	Death:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_PlaySound("Kustam/KickMiss", 5)
		TNT1 A 0 A_PlaySound("Kustam/KickMiss", 6)
		TNT1 A 0 A_PlaySound("Kustam/KickMiss", 7)
		TNT1 A 0 Radius_Quake (4,8,0,15,0)
		TNT1 A 5 
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0 A_Stop
		TNT1 A 0 A_PlaySound("Kustam/SuperKickHIT", 5)
		TNT1 A 0 A_PlaySound("Kustam/SuperKickHIT", 6)
		TNT1 A 0 Radius_Quake (5,10,0,20,0)
		TNT1 A 0 ACS_ExecuteWithResult(991,0,1,2)//flyback//--Change arg4 for higher knockback distances. 2 is pretty big tho.
		TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx ("KustamParticle",random(-8,8),random(-8,8),random(-10,10),random(-120,120)/15.0,random(-130,130)/12.0,random(-110,110)/17.0,0,160)
		TNT1 A 0 A_Explode (1,150,0,0,150)
		TNT1 A 0 A_GiveToTarget ("KustamRegen",1)
		TNT1 A 1 A_RadiusThrust (15000,20,RTF_NOIMPACTDAMAGE )
		TNT1 A 0 A_Stop
		KSPK BCDEFG 1
		TNT1 A 8
		stop
	}
}

ACTOR KickDeathSound
{
	+NOBLOCKMAP
	+NOGRAVITY
	+NOCLIP
	+NOTELEPORT
	+clientsideonly
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("Kustam/minorkickdeath",5,1,0,0.6)
		TNT1 A 0 A_PlaySound("Kustam/minorkickdeath",6,1,0,0.6)
		TNT1 A 0 A_PlaySound("Kustam/minorkickdeath",7,1,0,0.6)
		TNT1 A 10
		Stop
	}
}

actor bossKickDeathSound : KickDeathSound
{
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("Kustam/bosskickdeath",5,1,0,0.6)
		TNT1 A 0 A_PlaySound("Kustam/bosskickdeath",6,1,0,0.6)
		TNT1 A 0 A_PlaySound("Kustam/bosskickdeath",7,1,0,0.6)
		TNT1 A 10
		Stop
	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

	



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//=====================================================
//=====================================================
//MISC VISUAL EFFECTS
//=====================================================
//=====================================================
	

ACTOR RubyCasingSpawner //Shamelessly stolen from probably one of Weasel's mods, yoink. (Then taken by me, double yoink)
{
	Speed 10
	PROJECTILE
	+NOCLIP
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile("RubyCasing",0,0,random(-100,-80),CMF_AIMDIRECTION,random(-15,15))
		Stop
	}
}

ACTOR RubyCasing
{
	Radius 2
	Height 4
	Speed 6
	Scale 0.2
	PROJECTILE
	-NOGRAVITY
	+BOUNCEONACTORS
	+DONTSPLASH
	Gravity 0.60
	BounceType Doom
	BounceCount 3
	BounceFactor 0.6  
	+clientsideonly
	States
	{
	Spawn:
		TNT1 A 0
		RCSN ABCDEFGH 1 bright
		Loop
	Death:
		TNT1 A 0
		TNT1 AAAAAAAAA 0 A_SpawnItemEx ("KustamParticle",random(-8,8),random(-8,8),random(-10,10),random(-60,60)/20.0,random(-60,60)/20.0,random(-60,60)/20.0,0,160)
		TNT1 A 1
		stop
	}
}


ACTOR SapphireCasing
{
	Radius 4
	Height 4
	Speed 20
	Scale 0.4
	PROJECTILE
	Species "Friendly"
	+THRUSPECIES
	-NOGRAVITY
	+DONTSPLASH
	+FORCEPAIN
	Gravity 0.80
	DamageType "Dazer"
	Damage (5)
	States
	{
	Spawn:
		TNT1 A 0
		RCS2 ABCDEFGH 1 bright
		Loop
	Death:
		TNT1 A 0
		TNT1 AAAAAAAAA 0 A_SpawnItemEx ("KustamParticle",random(-8,8),random(-8,8),random(-10,10),random(-60,60)/20.0,random(-60,60)/20.0,random(-60,60)/20.0,0,160)
		TNT1 A 0 A_SetScale (1.50)
		TNT1 A 0 A_PlaySound ("Kustam/TurretShatter",0)
		FLS1 GIJK 1 Bright
		stop
	}
}


actor KustamParticle
{
	projectile
	+clientsideonly
	speed 10
	+NOINTERACTION
	+DONTBLAST
	+hexenbounce
	states
	{
	spawn:	
		KPTL AA 1  Bright 
		TNT1 AA 1  Bright 
		KPTL AA 1  Bright 
		TNT1 AA 1  Bright 
		KPTL AA 1  Bright 
		TNT1 AA 1  Bright 
		KPTL AA 1  Bright 
		TNT1 AA 1  Bright 
		KPTL AA 1  Bright 
		TNT1 AA 1  Bright 
		Stop
	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//=====================================================
//=====================================================
//VENTER REPAIR FUNCTIONS
//=====================================================
//=====================================================

actor VentRepairLow : custominventory 
{
	inventory.maxamount 1
	+INVENTORY.AUTOACTIVATE
	states
	{
	pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfHealthLower (99,"GiveHP")
		TNT1 A 1
		Stop
	GiveHP:
		TNT1 A 0
		TNT1 A 1 A_GiveInventory ("Health", 25)
		stop
	}
}

actor VentRepairMid : VentRepairLow 
{
	states
	{
	GiveHP:
		TNT1 A 0
		TNT1 A 1 A_GiveInventory ("Health", 30)
		stop
	}
}

actor VentRepairMax : VentRepairLow 
{
	states
	{
	GiveHP:
		TNT1 A 0
		TNT1 A 1 A_GiveInventory ("Health", 45)
		stop
	}
}



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//=====================================================
//=====================================================
//TOKENS
//=====================================================
//=====================================================


Actor UsingKustamPistol : Powerup
{Powerup.Duration -1}


actor UsingKustamKick : Powerup
{Powerup.Duration -1}


Actor FiredLeftVenter : Powerup
{
  Powerup.Duration -3
}


//Overclock tokens
actor SentinelLaserToken : inventory
{inventory.maxamount 1}

actor SentinelFlamerToken : inventory
{inventory.maxamount 1}

actor KustamExplosionStack : inventory
{inventory.maxamount 12}

actor SentinelForm : inventory
{inventory.maxamount 1}

