//==============================================================================
// Blitzgewehr (Translated as 'Thunder Rifle')
//==============================================================================

ACTOR HDLightningGun : KriegslandMediumWeapon
{
	+INVENTORY.UNDROPPABLE
	Weapon.SelectionOrder 1000
	Weapon.AmmoUse 1
	Weapon.SlotNumber 6
	Weapon.AmmoGive 30
	Weapon.AmmoType "BOBT1"
	Inventory.Pickupmessage "You got the 'Blitzgewehr!"
	Inventory.PickupSound 	"weapons/generic/pickup3"
	Obituary "%o was shocked in awe from %k's Blitzgewehr."
	Tag "Blitzgewehr"
	Scale 0.65
	States
	{
	Deselect:
		TNT1 A 0 A_StopSound(6)
		TNT1 A 0 A_StopSound(7)
		WPHG A 1 Offset(2, 34)
		WPHG A 1 Offset(7, 39)
		WPHG A 1 Offset(10, 47)
		WPHG A 1 Offset(22, 58)
		WPHG A 1 Offset(32, 69)
		WPHG A 1 Offset(54, 81)
		WPHG A 1 Offset(67, 100)
		WPHG A 1 A_Lower
		Wait 
	Ready:
		WPHG A 3 A_WeaponReady
		TNT1 A 0 A_Playsound("weapons/BTG/idle",6,0.4,1)
		TNT1 A 0 A_JumpifInventory("IsBombing",1,"ThrowGrenade")
		NULL A 0 A_JumpIfInventory("SlidePlayer",1,"IsSliding")
		TNT1 A 0 A_JumpIfInventory("IsKnifing",1,"Knife")
		TNT1 A 0 A_JumpifInventory("IsKicking",1,"Kick")
		WPHG B 3 A_WeaponReady
		TNT1 A 0 A_JumpifInventory("IsBombing",1,"ThrowGrenade")
		NULL A 0 A_JumpIfInventory("SlidePlayer",1,"IsSliding")
		TNT1 A 0 A_JumpIfInventory("IsKnifing",1,"Knife")
		TNT1 A 0 A_JumpifInventory("IsKicking",1,"Kick")
		WPHG C 3 A_WeaponReady
		TNT1 A 0 A_JumpifInventory("IsBombing",1,"ThrowGrenade")
		NULL A 0 A_JumpIfInventory("SlidePlayer",1,"IsSliding")
		TNT1 A 0 A_JumpIfInventory("IsKnifing",1,"Knife")
		TNT1 A 0 A_JumpifInventory("IsKicking",1,"Kick")
		Loop
	Select:
		TNT1 A 0 A_Playsound("weapons/generic/select3",7)
		WPHG A 1 Offset(67, 100)
		WPHG A 1 Offset(54, 81)
		WPHG A 1 Offset(32, 69)
		WPHG A 1 Offset(22, 58)
		WPHG A 1 Offset(10, 47)
		WPHG A 1 Offset(7, 39)
		WPHG A 1 Offset(2, 34)
		WPHG A 1 A_Raise
		Wait
	Fire:	
		TNT1 A 0 A_JumpIfInventory("BOBT1",1,1)
		Goto Dryfire
		TNT1 A 0 A_PlaySound("weapons/BTG/firestart",6)
		TNT1 A 0 A_PlaySound("weapons/BTG/firestart2",5)
		WPHG A 1 Offset(1,34) A_SetBlend("EF EE EF", .2, 10)
	Hold:
		TNT1 A 0 A_JumpIfInventory("BOBT1",1,1)
		Goto Dryfire
		TNT1 A 0 A_Playsound("weapons/BTG/fire",7,1,1)
		TNT1 A 0 A_Playsound("weapons/BTG/fire2",5,1,1)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Gunflash
		TNT1 A 0 A_FireCustomMissile("GunSmokeSpawner",0,0,10,0,0,0)
		WPHF A 1 BRIGHT Offset(2,35) A_RailAttack(random(3,6),5,1,"None","ADFAFF",RGF_SILENT|RGF_NOPIERCING|RGF_FULLBRIGHT,6,"ShockPuff",0,0,768,1,0.3,0)
		TNT1 A 0 A_SetBlend("A1 DE F1", .06, 5)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPHF B 1 BRIGHT Offset(4,37) A_RailAttack(random(3,6),5,0,"None","7AEFFF",RGF_SILENT|RGF_NOPIERCING|RGF_FULLBRIGHT,6,"ShockPuff",0,0,768,1,0.3,0)
		TNT1 A 0 A_SetBlend("A1 DE F1", .08, 5)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		TNT1 A 0 A_GunFlash
		WPHF C 1 BRIGHT Offset(3,36) A_RailAttack(random(3,6),5,1,"None","7AF6FF",RGF_SILENT|RGF_NOPIERCING|RGF_FULLBRIGHT,6,"ShockPuff",0,0,768,1,0.3,0)
		TNT1 A 0 A_SetBlend("A1 DE F1", .1, 5)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPHF D 1 BRIGHT Offset(2,34) A_RailAttack(random(3,6),5,0,"None","ADFAFF",RGF_SILENT|RGF_NOPIERCING|RGF_FULLBRIGHT,6,"ShockPuff",0,0,768,1,0.3,0)
		TNT1 A 0 A_SetBlend("A1 DE F1", .05, 5)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPHG A 1 Offset(1,34) A_ReFire
		WPHG A 1 Offset(0,33) A_ReFire
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_StopSound(7)
		TNT1 A 0 A_PlaySound("weapons/BTG/fireloopend2",5)
		Goto Ready
	Dryfire:
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_StopSound(7)
		TNT1 A 0 A_Print("No ammo",1)
		Goto Ready
	Kick:
		WPHG DE 1
		TNT1 A 2
		KICF A 1 Offset(-10,32)
		KICF CE 1
		KICF FG 1 A_Recoil(-1)
		TNT1 A 0 A_Jump(128,2)
		TNT1 A 0 A_PlaySound("FKPlayer/Grunt")
		KICF H 5 A_CustomPunch(6,0,0,"FightPuff") 
		KICF IGFEDC 1 
		KICF BA 1 A_Recoil(+0.5)
		TNT1 A 2
		WPHG ED 1
		Goto Ready
	IsSliding:
		TNT1 A 0 A_TakeInventory("SlidePlayer",1)
		TNT1 A 0 A_JumpIfInventory("CrouchPlayer",1,"Ready")
		WPHG DE 1
		TNT1 A 0 A_PlaySound("FKPlayer/slide/start",4)
		TNT1 A 0 A_PlaySound("FKPlayer/slide/loop",5,0.5,TRUE)
		TNT1 A 0 A_SetPitch(pitch+0.8)
		SLDK ABCDEF 2
		TNT1 A 0 A_SetPitch(pitch-0.8)
		SLDK G 6 A_FireCustomMissile("KickAttack",0,0,0,0)
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_PlaySound("FKPlayer/slide/end",6)
		SLDK HI 2
		Goto Ready
	Knife:
		WPHG DE 1
		NULL A 0 Offset(-10,32)
		NULL A 3
		WP1L AB 1
		NULL A 0 A_Jump(86,2)
		NULL A 0 A_PlaySound("FKPlayer/Grunt")
		WP1L C 1 A_CustomPunch(8,0,0,"KnifePuff")
		WP1L DEF 1
		NULL A 3
		WPHG ED 1
		Goto Ready
	Throwgrenade:
		TNT1 A 0 A_JumpIf(waterlevel>2,"Dryfire")
		TNT1 A 0 A_JumpIfInventory("BOGR1",1,1)
		Goto Dryfire
		WPHG DE 1
		TNT1 A 0 A_StopSound(1)
		TNT1 A 0 Offset(-20,32)
		TNT1 A 3 Offset(-20,32)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 A 1 Offset(0,28)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 B 1 Offset(0,24)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 C 1 Offset(0,23)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 D 1 Offset(0,26) A_PlaySound("weapons/SHG/throw")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 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("BOGR1",1)
		MND2 E 1 Offset(-3,30)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 E 1 Offset(-6,31)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 F 1 Offset(-9,32)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 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 5 Offset (75, 152)
		TNT1 A 1 Offset (6, 42)
		WPHG ED 1
		Goto Ready
	Flash:
		TNT1 A 2 A_Light1
		TNT1 A 2 A_Light2
		TNT1 A 1 A_Light1
		TNT1 A 1 A_Light0
		Stop
 	Spawn:
		WPHP A -1
		Stop
	}
}