actor BFGBallRun : BallRunBase
{
	Radius 13
	Height 56
	Health 100
	Speed 25
	Species "PlayerProjectiles"
	DeathSound "weapons/bfgx"
	states
	{
		Spawn:
			BFRB A 0
			goto Jump
		See:
			"####" "#" 0 A_JumpIf(user_clearTarget, "ClearTarget")
			"####" "#" 0 A_JumpIf(CallACS("GetBfgRunBallMode") == 1, "SeeNoMissile")
			"####" "#" 0 A_Jump(256, "SeeNoClearTarget")
			stop
		SeeNoMissile:
			"####" A random(0, 1) Bright
			"####" ABCDEFGH 1 Bright A_Chase("Melee", "")
			"####" A 0 ACS_NamedExecuteWithResult("PlayRunBallFootstepSound")
			"####" IJKLMNOP 1 Bright A_Chase("Melee", "")
			"####" A 0 ACS_NamedExecuteWithResult("PlayRunBallFootstepSound")
			"####" A 0 A_Jump(256, "See")
			stop
		Missile:
			BFRB X 0 A_VileAttack("", random(health, health * 8))
			BFRB X 0 ACS_NamedExecuteWithResult("BFGBallAttack", 0)
			goto Die
		Death:
			TNT1 A 0 A_ScreamAndUnblock
			BFRE A 8 Bright ACS_NamedExecuteWithResult("BFGBall_Explode")
			BFRE BCDEF 8 Bright
			stop
	}
}

actor SmallBFGBallRun : SmallBallRunBase
{
	Scale 0.5
	Radius 7
	Height 28
	Health 5
	Speed 25
	Species "PlayerProjectiles"
	DeathSound "weapons/bfgx2"
	states
	{
		Spawn:
			BFRB A 0
			goto Jump
		See:
			"####" "#" 0 A_JumpIf(user_clearTarget, "ClearTarget")
			"####" "#" 0 A_JumpIf(CallACS("GetBfgRunBallMode") == 1, "SeeNoMissile")
			"####" "#" 0 A_Jump(256, "SeeNoClearTarget")
			stop
		SeeNoMissile:
			"####" A random(0, 1) Bright
			"####" ABCDEFGH 1 Bright A_Chase("Melee", "")
			"####" A 0 ACS_NamedExecuteWithResult("PlayRunBallFootstepSound")
			"####" IJKLMNOP 1 Bright A_Chase("Melee", "")
			"####" A 0 ACS_NamedExecuteWithResult("PlayRunBallFootstepSound")
			"####" A 0 A_Jump(256, "See")
			stop
		Missile:
			BFRB X 0 A_VileAttack("", random(health, health * 8), 0, 0, 0, "BFGSplash", VAF_DMGTYPEAPPLYTODIRECT)
			BFRB X 0 ACS_NamedExecuteWithResult("BFGSmallBallAttack", 0)
			goto Die
		Death:
			TNT1 A 0 A_ScreamAndUnblock
			BFRD GHIJ 8 Bright
			stop
	}
}

actor BFGBallRB : RunBallProjectileBase
{
	Species "PlayerProjectiles"
	Radius 13
	Height 8
	Speed 25
	Damage 100
	DeathSound "weapons/bfgx"
	states
	{
		Idle:
			BFS1 AB 4 Bright
			loop
		Death:
			TNT1 A 0 ACS_NamedExecuteWithResult("BFGBall_Explode")
			BFE1 ABCDEF 8 Bright
			Stop
	}
}

actor BFGRBExtraLarge
{
	+NOGRAVITY
	+NOINTERACTION
	States
	{
		Spawn:
			BFE1 ABCDEF 8 Bright
			Stop
	}
}

actor BFG9000RB : WeaponRunBall replaces BFG9000
{
	Weapon.SlotNumber 7
	Height 20
	Weapon.SelectionOrder 2800
	Weapon.AmmoUse 40
	Weapon.AmmoUse2 40
	Weapon.AmmoGive 40
	Weapon.AmmoType "Cell"
	Weapon.AmmoType2 "Cell"
	+WEAPON.NOAUTOFIRE
	Inventory.PickupMessage "$GOTBFG9000"
	Tag "$TAG_BFG9000"
	States
	{
		Ready:
			BFGG A 1 A_WeaponReady
			Loop
		Deselect:
			BFGG A 1 A_Lower
			Loop
		Select:
			BFGG A 1 A_Raise
			Loop
		Fire:
			BFGG A 20 A_BFGSound
			BFGG B 10 A_GunFlash
			BFGG B 10 A_FireCustomMissile("BFGBallRB")
			BFGG B 20 A_ReFire
			Goto Ready
		AltFire:
			BFGG A 20 A_BFGSound
			BFGG B 10 A_GunFlash
			BFGG B 10 A_FireBFG
			BFGG B 20 A_ReFire
			Goto Ready
		Flash:
			BFGF A 11 Bright A_Light1
			BFGF B 6 Bright A_Light2
			Goto LightDone
		Spawn:
			BFUG A 0
			goto Initialize
		Transform:
			BGRB A 0
			goto super::Transform
	}
}

actor BFGBallEx : BFGBall replaces BFGBall
{
	RenderStyle "Normal"
	Alpha 1.0
	Species "PlayerProjectiles"
	+THRUSPECIES
	+SHOOTABLE
	+NOBLOOD
	-NOBLOCKMAP
	+NOTARGETSWITCH
}

actor BFGExtraEx : BFGExtra replaces BFGExtra
{
	RenderStyle "Normal"
	Alpha 1.0
	Species "PlayerProjectiles"
	+THRUSPECIES
	+SHOOTABLE
	+NOBLOOD
	-NOBLOCKMAP
	+NOTARGETSWITCH
}