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

// UAC-Prototype BFG-11000

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

Actor D64BFG11K: D64Weapon
{
	Weapon.AmmoUse 2
	Weapon.AmmoGive 40
	Weapon.AmmoType "Cell2"
	Inventory.Icon "BF27P0"
	Inventory.PickupMessage "You got the UAC-Prototype BFG-11000!"
	Inventory.PickUpSound "Weapons/PickUp"
	Obituary "%o was spammed the hell out by %k's UAC-Prototype BFG-11000."
	Tag "UAC-Prototype BFG-11000"
	Scale 1.0
	+WEAPON.NOAUTOFIRE
	+WEAPON.AMMO_OPTIONAL

States
{

Select:
	TNT1 A 0 A_PlaySound("Weapons/BFG2704/Up",5)
	BF27 A 1 Offset(67, 100)
	BF27 A 1 Offset(54, 81)
	BF27 A 1 Offset(32, 69)
	BF27 A 1 Offset(22, 58)
	BF27 A 1 Offset(10, 47)
	BF27 A 1 Offset(7, 39)
	BF27 A 1 Offset(2, 34)
	BF27 A 1 A_Raise
	Wait
Ready:
	TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
	B27G A 2 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
	B27G B 2 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
	B27G C 2 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
	B27G B 2 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsGrenading",1,"ThrowGrenade")
	TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
	Loop
Deselect:
	TNT1 A 0 A_StopSound(1)
	TNT1 A 0 A_StopSound(5)
	TNT1 A 0 A_PlaySound("weapons/weaponholster",3)
	BF27 A 1 Offset(2, 34)
	BF27 A 1 Offset(7, 39)
	BF27 A 1 Offset(10, 47)
	BF27 A 1 Offset(22, 58)
	BF27 A 1 Offset(32, 69)
	BF27 A 1 Offset(54, 81)
	BF27 A 1 Offset(67, 100)	
	BF27 A 1 A_Lower
	Wait
	
Fire:
	TNT1 A 0 A_JumpIfInventory("Cell2",1,2)
	Goto DryFire
	BF27 A 0 A_AlertMonsters
	BF27 A 15 A_PlayWeaponSound("Weapons/BFG2704/Charge")
	BF27 B 15
	BF27 C 4
	BF27 D 4
	BF27 E 4 Bright A_GunFlash
	TNT1 A 0 A_PlaySound("Weapons/BFG2704/Fire",1)
FireLoop:
	TNT1 A 0 A_PlaySound("Weapons/BFG2704/FireLoop", 5, 1, 1)
	TNT1 A 0 A_JumpIfInventory("Cell2",1,2)
	Goto DryFire
	TNT1 A 0 A_FireCustomMissile("2704Ball",random(8,-8),1,random(5,-5),random(5,-5),0,random(5,-5))
	TNT1 A 0 A_FireCustomMissile("2704Ball2",random(8,-8),0,random(5,-5),random(5,-5),0,random(5,-5))
	BF27 F 1 Bright A_CheckReload
	TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
	TNT1 A 0 A_FireCustomMissile("2704Ball",random(8,-8),1,random(5,-5),random(5,-5),0,random(5,-5))
	TNT1 A 0 A_FireCustomMissile("2704Ball2",random(8,-8),0,random(5,-5),random(5,-5),0,random(5,-5))
	BF27 G 1 Bright A_CheckReload
	TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
	TNT1 A 0 A_FireCustomMissile("2704Ball",random(8,-8),1,random(5,-5),random(5,-5),0,random(5,-5))
	TNT1 A 0 A_FireCustomMissile("2704Ball2",random(8,-8),0,random(5,-5),random(5,-5),0,random(5,-5))
	BF27 E 1 Bright A_CheckReload
	TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
	TNT1 A 0 A_FireCustomMissile("2704Ball",random(8,-8),1,random(5,-5),random(5,-5),0,random(5,-5))
	TNT1 A 0 A_FireCustomMissile("2704Ball2",random(8,-8),0,random(5,-5),random(5,-5),0,random(5,-5))
	BF27 G 1 Bright A_CheckReload
	TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
	BF27 A 0 A_ReFire("FireLoop")
	BF27 F 1 Bright A_PlaySound("Weapons/BFG2704/FireEnd", 1)
	BF27 E 2 Bright
	TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
	BF27 DCB 5 A_StopSound(5)
	Goto Ready
	
	
AltFire:
	TNT1 A 0 A_JumpIfInventory("Cell2",20,2)
	Goto Dryfire
	BF27 A 0 A_JumpIfNoAmmo("Ready")
	BF27 A 15 A_PlayWeaponSound("Weapons/BFG2704/Charge")
	BF27 B 15
	BF27 C 4
	BF27 D 4
	BF27 E 4 Bright A_GunFlash
	TNT1 A 0 A_PlaySound("Weapons/BFG2704/AltFire", 1)
	TNT1 A 0 A_FireCustomMissile("2704ClusterBall",0,1,0,0,0,0)
	TNT1 A 0 A_TakeInventory("Cell2",10,TIF_NOTAKEINFINITE)
	TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
	BF27 F 1 Bright A_CheckReload
	BF27 F 1 Bright 
	BF27 E 2 Bright 
	BF27 DCB 10
	TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
	Goto Ready
	
	DryFire:
	TNT1 A 0 A_StopSound(5)
	TNT1 A 0 A_Print("No ammunition. Go find more.",1)
	Goto Ready
	
//Kick
	DoKick:
		TNT1 A 0 A_JumpIf (momZ > 0, "AirBorne")
		TNT1 A 0 A_JumpIf (momZ < 0, "AirBorne")
		TNT1 A 0 A_JumpIfInventory("BerserkStrength",1,"BerserkKick")
		KICK A 1 Offset(0,32)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK B 1 A_ZoomFactor(0.99)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK C 1 A_ZoomFactor(0.98)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK D 1 A_ZoomFactor(0.97)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK E 1 A_ZoomFactor(0.96)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK F 1 A_ZoomFactor(0.95)
		TNT1 A 0 A_CustomPunch(2 * random(1, 10),0,0,"KickPuff") 
		Goto FireEnd
		BerserkKick:
		KICK A 1 Offset(0,32)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK B 1 A_ZoomFactor(0.99)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK C 1 A_ZoomFactor(0.98)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK D 1 A_ZoomFactor(0.97)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK E 1 A_ZoomFactor(0.96)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK F 1 A_ZoomFactor(0.95)
		TNT1 A 0 A_CustomPunch(20 * random(5, 10),0,0,"KickPuff")
		Goto FireEnd
		FireEnd:
		KICK GHIH 1
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK G 1 A_ZoomFactor(0.96)
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK F 1 A_ZoomFactor(0.97)
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK E 1 A_ZoomFactor(0.98)
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK D 1 A_ZoomFactor(0.99)
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK C 1 A_ZoomFactor(1.00)
		TNT1 A 3
		KICK BA 1
		Goto Ready
		AirBorne:
		TNT1 A 0 A_JumpIfInventory("BerserkStrength",1,"AirBerserk")
		TNT1 A 0 Offset(-1,32)
		KIKK ABCDE 1 A_Recoil(-2)
		KIKK F 3 A_CustomPunch (15,0,0,"KickPuff") 
		Goto EndFire
		AirBerserk:
		TNT1 A 0 Offset(-1,32)
		KIKK ABCDE 1 A_Recoil(-2)
		KIKK F 3 A_CustomPunch (25 * random(5, 10),0,0,"KickPuff")
		Goto EndFire
		EndFire:
		KIKK GHIJK 2 
		Goto Ready
		
//Throw Grenade
	ThrowGrenade:
		TNT1 A 0 A_JumpIf(waterlevel>2,"DryFire")
		TNT1 A 0 A_JumpIfInventory("GrenadeAmmo",1,1)
		Goto Dryfire
		TNT1 A 0 A_StopSound(1)
		TNT1 A 0 Offset(-20,32)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND B 1 Offset(0,24)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND C 1 Offset(0,23)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND D 1 Offset(0,26) A_PlaySound("weapons/SHG/throw")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND D 1 Offset(0,28)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		TNT1 A 0 A_SpawnItemEx("RealGrenade",0,1,24,cos(pitch)*40,0,sin(-pitch)*40,3,SXF_TRANSFERPITCH|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_TakeInventory("GrenadeAmmo",1)
		MAND E 1 Offset(-3,30)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND E 1 Offset(-6,31)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND F 1 Offset(-9,32)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND F 1 Offset(-12,33)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		TNT1 A 0 A_TakeInventory("GetOnWithIt", 100)
		TNT1 A 0 A_JumpIfNoAmmo("DryFire")
		TNT1 A 7 Offset (75, 152)
		TNT1 A 1 Offset (6, 42)
		Goto Ready

	Spawn:
		BF27 P -1
		Loop	
}
}


Actor 2704Ball : PlasmaBall
{
Damage 10
DamageType Plasma
BounceType "Classic"
BounceFactor 1.0
Obituary "%o was spammed the hell out by %k's BFG-2704."
SeeSound ""
Decal GreenPlasmaScorch
DamageType Desintegrate
States
{
Spawn:
	BBGB AB 6 Bright
	Loop
Death:
	BBGB C 6 Bright
	BBGB DE 4 Bright
	Stop
}
}
	
Actor 2704Ball2 : 2704Ball
{
Decal RedPlasmaScorch
States
{
Spawn:
	BBG2 AB 6 Bright
	Loop
Death:
	BBG2 CDEF 3 Bright
	BBG2 GHI 3 Bright thrustthingz(0,5,0,0)
	Stop
}
}

Actor 2704ClusterBall : BFGBall
{
Damage 5
+RIPPER
DamageType Plasma
Obituary "%o was spammed the hell out by %k's BFG-2704."
SeeSound ""
DamageType Desintegrate
DeathSound "BFG2704/ClusterHit"
Scale 0.5
States
{
Spawn:
	CGS1 A 1 Bright A_CustomMissile("2704Ball", 0, 0, random(-179, 179), 1, random(-15, 15))
	TNT1 A 0 Bright A_CustomMissile("2704Ball2", 0, 0, random(-179, 179), 1, random(-15, 15))
	TNT1 A 0 Bright A_SpawnItem("2704ClusterWave")
	CGS1 B 1 Bright A_CustomMissile("2704Ball", 0, 0, random(-179, 179), 1, random(-15, 15))
	TNT1 A 0 Bright A_CustomMissile("2704Ball2", 0, 0, random(-179, 179), 1, random(-15, 15))
	TNT1 A 0 Bright A_SpawnItem("2704ClusterWave")
	CGS1 C 1 Bright A_CustomMissile("2704Ball", 0, 0, random(-179, 179), 1, random(-15, 15))
	TNT1 A 0 Bright A_CustomMissile("2704Ball2", 0, 0, random(-179, 179), 1, random(-15, 15))
	TNT1 A 0 Bright A_SpawnItem("2704ClusterWave")
	CGS1 D 1 Bright A_CustomMissile("2704Ball", 0, 0, random(-179, 179), 1, random(-15, 15))
	TNT1 A 0 Bright A_CustomMissile("2704Ball2", 0, 0, random(-179, 179), 1, random(-15, 15))
	TNT1 A 0 Bright A_SpawnItem("2704ClusterWave")
	Loop
Death:
	BLST A 0 Radius_Quake(15,15,0,40,0)
	TNT1 A 0 A_Explode(100, 100)
	CGS1 A 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_SetScale(0.45)
	TNT1 A 0 A_FadeOut(0.5)
	CGS1 B 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_SetScale(0.4)
	TNT1 A 0 A_FadeOut(0.5)
	CGS1 C 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_SetScale(0.35)
	TNT1 A 0 A_FadeOut(0.5)
	CGS1 D 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_SetScale(0.3)
	TNT1 A 0 A_FadeOut(0.5)
	CGS1 A 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_SetScale(0.25)
	TNT1 A 0 A_FadeOut(0.5)
	CGS1 B 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_SetScale(0.2)
	TNT1 A 0 A_FadeOut(0.5)
	CGS1 C 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_SetScale(0.15)
	TNT1 A 0 A_FadeOut(0.5)
	CGS1 D 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_SetScale(0.1)
	TNT1 A 0 A_FadeOut(0.5)
	CGS1 A 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_SetScale(0.05)
	TNT1 A 0 A_FadeOut(0.5)
	CGS1 B 1 Bright A_SpawnItem("2704ClusterWave")
	TNT1 A 0 A_Stop
}
}

ACTOR 2704ClusterWave
{   
   Radius 10
   Height 10
   Speed 0
   +Noclip
   +ripper
   PROJECTILE
   RENDERSTYLE Add
   states
   {
   Spawn:
     SHOG ABCD 1 BRIGHT A_FadeOut(0.0625)
	 SHOG EFGHI 1 BRIGHT A_FadeOut(0.0625)
	 SHOG JKLMN 1 BRIGHT A_FadeOut(0.0625)
	 SHOG OP 1 BRIGHT A_FadeOut(0.0625)
     Stop
   }
}
