actor BlakeWeapon : Weapon
{
	weapon.ammotype1 "ChargeUnit"
	weapon.ammouse1 1
	weapon.ammogive1 6
	weapon.yadjust 32
	weapon.bobstyle "Thrust"
	weapon.bobrangex 0
	weapon.bobrangey 0.5
	states
	{
		Select:
			TNT1 A 0 A_Raise
			loop
		Deselect:
			TNT1 A 0 A_Lower
			loop
	}
}

actor AutoChargePistol : BlakeWeapon
{
	attacksound "weapon/autochargepistol/attack"
	inventory.icon "STWEAP1"
	weapon.ammouse1 0
	+WEAPON.NOAUTOFIRE
	states
	{
		Ready:
			ACPG A 1 A_WeaponReady
			loop
		Fire:
			ACPG BC 3
			ACPG D 3 A_GunAttack(GAF_MACDAMAGE, "*", 1.0, 128)
			ACPG E 3
			goto Ready
		Spawn:
			ACPP A -1
			stop
	}
}

actor SlowFireProtector : BlakeWeapon
{
	attacksound "weapon/slowfireprotector/attack"
	inventory.icon "STWEAP2"
	inventory.pickupsound "weapon/slowfireprotector/pickup"
	+WEAPON.NOAUTOFIRE
	states
	{
		Ready:
			SFPG A 1 A_WeaponReady
			loop
		Fire:
			SFPG BC 3
			SFPG D 3 A_GunAttack(GAF_MACDAMAGE, "*", 1.0, 128)
			SFPG E 3
			goto Ready
		Spawn:
			SFPP A -1
			stop
	}
}

actor RapidAssaultWeapon : BlakeWeapon
{
	attacksound "weapon/rapidassaultweapon/attack"
	inventory.icon "STWEAP3"
	inventory.pickupsound "weapon/rapidassaultweapon/pickup"
	states
	{
		Ready:
			RAWG A 1 A_WeaponReady
			loop
		Fire:
			RAWG B 3
		Hold:
			RAWG C 3
			RAWG D 2.5 A_GunAttack(GAF_MACDAMAGE, "*", 1.0, 128)
			RAWG E 2.5 A_ReFire
			goto Ready
		Spawn:
			RAWP A -1
			stop
	}
}

/* Fun Fact: This weapon is supposed to fire two rounds per loop instead of
 * being just a faster version of the RAW, but the grenade malfunction code
 * was inserted at the wrong point and breaks the second fire function before
 * it falls through to actually fire.
 *
 * Seems like a classic case of improper indentation masking a critical flaw!
 */
actor DualNeutronDisruptor : BlakeWeapon
{
	attacksound "weapon/dualneutrondisruptor/attack"
	inventory.icon "STWEAP4"
	inventory.pickupsound "weapon/dualneutrondisruptor/pickup"
	states
	{
		Ready:
			DNDG A 1 A_WeaponReady
			loop
		Fire:
			DNDG B 3
		Hold:
			DNDG C 3
			DNDG D 1.5 A_GunAttack(GAF_MACDAMAGE, "*", 1.0, 128)
			DNDG E 1.5 A_ReFire
			goto Ready
		Spawn:
			DNDP A -1
			stop
	}
}

actor PlasmaGrenade : SmartAnimation
{
	seesound "plasmagrenade/fire"
	deathsound "plasmagrenade/hit"
	radius 10
	speed 14
	damage (random(40, 167))
	PROJECTILE

	action native A_PlasmaGrenadeCalcDuration();

	states
	{
		Spawn:
			GREN C 0 bright A_ScaleVelocity(frandom(1.0, 1.5))
			GREN CCBABBCD 3.5 bright A_PlasmaGrenadeCalcDuration
			GREN E 0 bright A_Scream
			GREN E 0 bright A_Explode(random(50, 177), 128, 0)
			GREN E 0 bright A_Stop
			GREN E random(3, 6) bright A_InitSmartAnim(random(3, 6))
			GREN FGH 3 bright A_SmartAnimDelay
			stop
		Death:
			EXPL A 0 bright A_Explode(random(50, 177), 128, 0)
			EXPL A random(1.5, 5) bright A_InitSmartAnim(random(3, 10))
			EXPL BCDE 1.5 bright A_SmartAnimDelay
			stop
	}
}
actor PlasmaDischargeUnit : BlakeWeapon
{
	inventory.icon "STWEAP5"
	inventory.pickupsound "weapon/plasmadischargeunit/pickup"
	weapon.ammouse1 4
	states
	{
		Ready:
			PDUG A 1 A_WeaponReady
			loop
		Fire:
			PDUG B 3
		Hold:
			PDUG C 3
			PDUG D 3 A_FireCustomMissile("PlasmaGrenade", random(-1,1))
			PDUG E 3 A_ReFire
			goto Ready
		Spawn:
			PDUP A -1
			stop
	}
}

actor AntiPlasmaShot : SmartAnimation
{
	seesound "antiplasmashot/fire"
	deathsound "antiplasmashot/hit"
	radius 10
	speed 14
	damage (random(40, 167))
	PROJECTILE
	+RIPPER
	states
	{
		Spawn:
			APCS B 3.5 bright A_ScaleVelocity(frandom(1.0, 2.0))
			APCS C -1 bright
			stop
		Death:
			APCS E 0 bright A_Explode(random(50, 177), 128, 0)
			APCS E 2.5 bright A_InitSmartAnim(random(1, 7))
			APCS FGHIJKL 0.5 bright A_SmartAnimDelay
			stop
	}
}
actor AntiPlasmaCannon : BlakeWeapon
{
	inventory.icon "STWEAP6"
	inventory.pickupsound "weapon/antiplasmacannon/pickup"
	weapon.ammouse1 8
	states
	{
		Ready:
			APCG A 1 A_WeaponReady
			loop
		Fire:
			APCG B 3
		Hold:
			APCG C 3
			APCG D 3 A_FireCustomMissile("AntiPlasmaShot", random(-1,1))
			APCG E 3 A_ReFire
			goto Ready
		Spawn:
			APCP A -1
			stop
	}
}
