// -----------------------------------------
// UAC-Gyrojet "Devastator" Launcher
//------------------------------------------

Actor DevastatorSide : Ammo
{
 Inventory.MaxAmount 1
 +IGNORESKILL
}

Actor D64Devastator: D64Weapon
{
	Weapon.AmmoUse 0
	Weapon.AmmoGive 5
	Weapon.AmmoType "RocketAmmo2"
	Inventory.PickupMessage "You got the UAC-Gyrojet 'Devastator' Launcher!"
	Inventory.PickUpSound "Weapons/PickUp"
	Tag "UAC-Gyrojet 'Devastator' Launcher!"
	Obituary "%k got devastated by %o's UAC-Gyrojet 'Devastator' Launcher."
	Scale 0.9
	+WEAPON.AMMO_OPTIONAL
	+WEAPON.NOAUTOFIRE
	
	States
	{
	Select:
		TNT1 A 0 A_PlaySound("Weapons/Grenade/Up2",5)
		DDEV A 1 Offset(67, 100)
		DDEV A 1 Offset(54, 81)
		DDEV A 1 Offset(32, 69)
		DDEV A 1 Offset(22, 58)
		DDEV A 1 Offset(10, 47)
		DDEV A 1 Offset(7, 39)
		DDEV A 1 Offset(2, 34) 
		DDEV A 1 A_Raise
		Wait	
	Ready:
		TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
		DDEV A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("IsGrenading",1,"ThrowGrenade")
		TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
		Loop
	Deselect:
		DDEV A 1 Offset(2, 34)
		DDEV A 1 Offset(7, 39)
		DDEV A 1 Offset(10, 47)
		DDEV A 1 Offset(22, 58)
		DDEV A 1 Offset(32, 69)
		DDEV A 1 Offset(54, 81)
		DDEV A 1 Offset(67, 100)
		DDEV A 1 A_Lower
		Wait
		
	Fire:
		TNT1 A 0 A_JumpIfInventory("RocketAmmo2",4,1)
		Goto DryFire
    FireRight:
        TNT1 A 0 A_JumpIfInventory("DevastatorSide", 1, "FireLeft")
        TNT1 A 0 A_AlertMonsters
        TNT1 A 0 A_GiveInventory("DevastatorSide", 1)
        DDEV B 1 
        TNT1 A 0 A_GunFlash
        TNT1 A 0 A_PlaySound("Weapons/Grenade/Fire")
        TNT1 A 0 A_FireCustomMissile("DevastatorRocket",Random(6, -6), 0, 5, 0, 0, Random(4, -4))
		TNT1 A 0 A_TakeInventory("RocketAmmo2",2,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_Recoil(0.6)
        DDEV C 2 
        DDEV D 1 A_FireCustomMissile("DevastatorRocket",Random(6, -6), 0, 5, 0, 0, Random(4, -4))
		TNT1 A 0 A_Recoil(0.6)
        DDEV D 1  
        DDEV CBA 2  
        TNT1 A 0 A_ReFire
        Goto Ready
   FireLeft:
        TNT1 A 0 A_AlertMonsters
        DDEV E 1 
        TNT1 A 0 A_GunFlash
        TNT1 A 0 A_PlaySound("Weapons/Grenade/Fire")
        TNT1 A 0 A_FireCustomMissile("DevastatorRocket",Random(6, -6), 0, -5, 0, 0, Random(3, -3))
		TNT1 A 0 A_TakeInventory("RocketAmmo2",2,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_Recoil(0.6)
        DDEV F 2 
        DDEV G 1 
    	TNT1 A 0 A_FireCustomMissile("DevastatorRocket",Random(6, -6), 0, -5, 0, 0, Random(3, -3))
		TNT1 A 0 A_Recoil(0.6)
        DDEV G 1 
        DDEV FEA 2  
        TNT1 A 0 A_TakeInventory("DevastatorSide", 1)
        TNT1 A 0 A_ReFire
        Goto Ready
	AltFire:
		TNT1 A 0 A_JumpIfInventory("RocketAmmo2",2,1)
		Goto DryFire
    FireRight2:
        TNT1 A 0 A_JumpIfInventory("DevastatorSide", 1, "FireLeft2")
        TNT1 A 0 A_AlertMonsters
        TNT1 A 0 A_GiveInventory("DevastatorSide", 1)
        DDEV B 1 
        TNT1 A 0 A_GunFlash
        TNT1 A 0 A_PlaySound("Weapons/Grenade/Fire4")
        TNT1 A 0 A_FireCustomMissile("BallGrenade",Random(6, -6), 0, 5, 0, 0, Random(4, -4))
		TNT1 A 0 A_TakeInventory("RocketAmmo2",1,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_Recoil(0.6)
        DDEV C 2 
        DDEV D 1
		TNT1 A 0 A_Recoil(0.6)
        DDEV D 1  
        DDEV CBA 2  
        TNT1 A 0 A_ReFire
        Goto Ready
   FireLeft2:
        TNT1 A 0 A_AlertMonsters
        DDEV E 1 
        TNT1 A 0 A_GunFlash
        TNT1 A 0 A_PlaySound("Weapons/Grenade/Fire4")
        TNT1 A 0 A_FireCustomMissile("BallGrenade",Random(6, -6), 0, -5, 0, 0, Random(3, -3))
		TNT1 A 0 A_TakeInventory("RocketAmmo2",1,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_Recoil(0.6)
        DDEV F 2 
        DDEV G 1 
		TNT1 A 0 A_Recoil(0.6)
        DDEV G 1 
        DDEV FEA 2  
        TNT1 A 0 A_TakeInventory("DevastatorSide", 1)
        TNT1 A 0 A_ReFire
        Goto Ready
	
	DryFire:
	    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:
		DDEP A -1
		Loop
}
}

//Devastator's Rockets

ACTOR DevastatorRocket
{
	Radius 3
	Height 2
    Speed 30
	Damage 30
	Projectile
	Damagetype Explosive
	DeathSound "Sounds/Effects/Explo1"
	Obituary "%k got devastated by %o's UAC-Gyrojet 'Devastator' Launcher."
    Scale 0.3
    +FORCERADIUSDMG
	+RANDOMIZE
	+EXTREMEDEATH
	-ROCKETTRAIL
    Decal Scorch
	States
	{
	Spawn:
		ROKK A 1 Bright A_SpawnItem("GunSmokeSpawner2",0,0,0,0)
		TNT1 A 0 A_PlaySound("Weapons/Rocket/Loop", CHAN_WEAPON, 1.0, 1, ATTN_NORM)
		Loop
	Death:
		TNT1 A 0 A_SpawnItem("DevBoom")
		Stop
	}
}

//Grenades (From Kriegsland)

ACTOR BallGrenade
{
	Radius 4
	Height 4
	Speed 35
	Damage 25
	Projectile
	-NOGRAVITY
	-GRENADETRAIL
	+RANDOMIZE
	+DEHEXPLOSION
	+SHOOTABLE
	+SKYEXPLODE
	+CANBOUNCEWATER
	+EXTREMEDEATH
	Obituary "You died."
	BounceType "Doom"
	BounceFactor 0.5
	WallBounceFactor 0.4
	DeathSound "Sounds/Effects/Explo1"
	BounceSound "Weapons/Grenade/Bounce2"
	DamageType Explosive
	Obituary "%k got devastated by %o's UAC-Gyrojet 'Devastator' Launcher."
	Decal Scorch
	Gravity 0.85
	Scale 0.3
	
	States
	{
	Spawn:
	    NADE A 2 A_SpawnItemEx("GunSmokeSpawner2",0,0,0,0,0,1,0,128)
		NADE B 2 A_SpawnItemEx("GunSmokeSpawner2",0,0,0,0,0,1,0,128)
		NADE C 2 A_SpawnItemEx("GunSmokeSpawner2",0,0,0,0,0,1,0,128)
		NADE D 2 A_SpawnItemEx("GunSmokeSpawner2",0,0,0,0,0,1,0,128)
		Loop
	Death:
		TNT1 A 0 A_SpawnItem("DevBoom2")
		Stop	
	}
}