actor Thunderbuss : weapon
{
	Weapon.SelectionOrder 700
	Inventory.RestrictedTo "DoomSlayer"
	Tag "Thunderbuss"
	states
	{
	spawn:
		SHOT A 1
		loop
	select:
		TNT1 A 0
		TNT1 A 0 a_playsound ("doomslayer/SSGclose")
	draw:
		TBID A 1 a_raise
		TNT1 A 0 a_takeinventory ("berserkfists",99)
		TNT1 A 0 a_giveinventory ("UsingSlayerGun",1)
		TNBS AA 0 a_raise
		loop
	deselect:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower (1, "deadlower")
		TNT1 A 0 a_playsound ("doomslayer/holster",0)
	holster:
		TNT1 A 0
		TBID A 1 a_lower
		TNT1 A 0 a_takeinventory ("UsingSlayerGun",99)
		TNBS AA 0 a_lower
		loop
	deadlower:
		TNT1 A 0
		TNT1 A 0
        TNT1 A 0 A_ClearRefire
		TNT1 AAAAAAAAAAAAA 0 a_lower
		TNT1 A 1 a_lower
		loop
	ready:
		TBID ACGHI 1 a_weaponready
		goto realready
	realready:
		TNT1 A 0 a_jumpifinventory ("raging",1,"ragestart")
		TBID IJKL 2 a_weaponready (WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNT1 A 0 a_jumpifinventory ("raging",1,"ragestart")
		loop
	Ragestart:
		TNT1 A 0
		TNT1 A 5 a_takeinventory ("raging",99)
		TNT1 A 0 A_giveinventory ("berserkfists",1)
		TNT1 A 0 A_Quake(2, 20, 0, 10,"silence")			
		TNT1 A 0 a_setinvulnerable
		RAGE ABCDDEE 2
		RAGE E 4
		TNT1 A 0 A_Quake(1, 18, 0, 10,"silence")			
		RAGE F 2
		TNT1 A 0 a_takeinventory ("UsingSlayerGun",99)
		TNT1 A 0 a_playsound ("doomslayer/channelsly",0,1,0,0.6)
		TNT1 A 0 A_SetBlend("99 15 15", 0.6, 60)
		TNT1 A 0 a_spawnitemex ("ragesplosion")
		TNT1 A 0 a_radiusthrust (12000,150,0,150)
		TNT1 A 0 a_giveinventory ("health",35)
		TNT1 A 0 a_alertmonsters
		TNT1 A 0 a_takeinventory ("zerkcharge",1)
		RAGE G 1 A_Quake(7, 55, 0, 10)	
		RAGE G 1 offset (3,37)
		RAGE G 1 offset (-2,30)
		RAGE G 1 offset (4,36)
		RAGE G 1 offset (-4,32)
		RAGE G 1 offset (3,35)
		RAGE G 1 offset (-5,28)
		RAGE G 1 offset (2,37)
		RAGE G 1 offset (-1,31)
		RAGE G 1 offset (2,35)
		RAGE G 1 offset (3,37)
		RAGE G 1 offset (-2,30)
		RAGE G 1 offset (4,36)
		RAGE G 1 offset (-4,32)
		RAGE G 1 offset (3,35)
		RAGE G 1 offset (-5,28)
		RAGE G 1 offset (2,37)
		RAGE G 1 offset (-1,31)
		RAGE G 1 offset (2,35)
		RAGE G 1 offset (3,37)
		RAGE G 1 offset (-2,30)
		RAGE G 1 offset (4,36)
		RAGE G 1 offset (-4,32)
		RAGE G 1 offset (3,35)
		RAGE G 1 offset (-5,28)
		RAGE G 1 offset (2,37)
		RAGE G 1 offset (-1,31)
		RAGE G 1 offset (2,35)
		RAGE G 1 offset (3,37)
		RAGE G 1 offset (-2,30)
		RAGE G 1 offset (4,36)
		RAGE G 1 offset (-4,32)
		RAGE G 1 offset (3,35)
		RAGE G 1 offset (-5,28)
		RAGE G 1 offset (2,37)
		RAGE G 1 offset (-1,31)
		RAGE G 1 offset (2,35)
		RAGE G 1 offset (0,32)
		RAGE G 2 
		RAGE HI 2
		TNT1 A 1 
		TNT1 A 0 a_unsetinvulnerable
		TNT1 A 0 A_giveinventory ("berserkfists",1)
		TNT1 A 1 a_selectweapon ("berserkfists")
		
		TNT1 A 0 
		TNT1 A 0 a_takeinventory ("sawglove",1)
		TNT1 A 0 a_takeinventory ("morningstar",1)
		TNT1 A 0 a_takeinventory ("Thunderbuss",1)
		TNT1 A 0 a_takeinventory ("Hydrarepeater",1)
		TNT1 A 0 a_takeinventory ("wrathcaster",1)
		TNT1 A 0 a_takeinventory ("infernorifle",1)
		TNT1 A 1 
		TNT1 A 0 a_takeinventory ("rend",1)
		TNT1 A 1
		goto deadlower
	fire:
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("maceorbs",2,"realfire")
		TNT1 A 0 a_playsound ("doomslayer/click",0)
		TBID A 1 offset (0,35)
		TBID A 1 offset (0,40)
		TBID A 1 offset (0,42)
		TBID A 1 offset (0,36)
		TBID A 1 offset (0,32)
		TBID A 3
		goto ready
	realfire:
		TNT1 A 0
		TBID O 1 bright
		TNT1 A 0 a_playsound ("Doomslayer/SSGpin",0)
		TBID P 1 bright
		TNT1 A 0 a_playsound ("Doomslayer/SSGzap",CHAN_WEAPON)
		TBID RSU 1 bright 
		TNT1 A 0 a_playsound ("Doomslayer/SSGzap",CHAN_WEAPON)
		TBID V 1 bright 
		TNT1 A 0 A_Quake(4, 13, 0, 10)
		TNT1 A 0 a_playsound ("doomslayer/SSGfire",CHAN_WEAPON)
		TNBS B 1 bright
		TNT1 A 0 a_takeinventory ("maceorbs",2)
		TNT1 A 0 a_firebullets (0,0,1,0,"flickpuff")
		TNBS C 1 bright A_FireCustomMissile("thunderpellet")
		PSPM AAAAA 0 A_FireCustomMissile("thunderpellet", Frandom(-5,5),0,0,0,0,Frandom(-5,5))
		PSPM AAAAA 0 A_FireCustomMissile("thunderpellet", Frandom(-6,7),0,0,0,0,Frandom(-4,4))
		PSPM AAAAAAAAAA 0 A_FireCustomMissile("thunderpellet", Frandom(-8,8),0,0,0,0,Frandom(-3,3))
		TNBS C 1 bright
		TNBS D 1 bright
		TNBS E 2 bright
		TNBS FG 2 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TBID A 1 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNT1 A 0 a_jumpifinventory ("maceorbs",2,"loadgem")
		goto ready
	loadgem:
		TNRL ABC 2 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNRL D 3 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNRL EFG 1 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNT1 A 0 a_playsound ("doomslayer/SSGopen",0)
		TNRL HI 1 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNRL JKLMN 2 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNT1 A 0 a_stopsound (CHAN_WEAPON)
		TNT1 A 0 a_playsound ("doomslayer/SSGload",0)
		TNRL OOPQR 1 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNT1 A 4 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		TNT1 A 0 a_playsound ("doomslayer/SSGclose",0)		
		TNRL STUVW 2 a_weaponready (WRF_NOPRIMARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		goto ready
	Altfire:
		TNT1 A 0
		TNT1 A 0 a_giveinventory ("UsingRend",1)
		TNRL AXY 1
		TNT1 A 1
		TNT1 A 0 a_playsound ("doomslayer/swordup")
		TNT1 A 0 a_jumpifinventory ("ATKringpowerup",1,"mightyswipe")
		RQML AB 1
		RSWP A 2
		TNT1 A 0 a_playsound ("doomslayer/sword",0)
		RSWP B 1 A_FireCustomMissile("slayermelee",0,0,40,0)
		RSWP C 1 A_FireCustomMissile("slayermelee",0,0,20,0)
		TNT1 A 0 A_FireCustomMissile("slayermelee",0,0,0,0)
		RSWP D 2 A_FireCustomMissile("slayermelee",0,0,-20,0)
		RSWP E 3 		
		TNT1 A 4
		LSWP A 2
		TNT1 A 0 a_playsound ("doomslayer/sword",0)
		LSWP B 1 A_FireCustomMissile("slayermelee",0,0,40,0)
		LSWP C 1 A_FireCustomMissile("slayermelee",0,0,20,0)
		LSWP D 2 A_FireCustomMissile("slayermelee",0,0,-20,0)
		LSWP E 2 
		TNT1 A 0 a_takeinventory ("UsingRend",99)
		TNT1 A 0 a_playsound ("doomslayer/sworddown")
		TNT1 A 3
		TNT1 A 2
		TNRL STUVW 1 a_weaponready (WRF_NOSECONDARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		goto ready
	Mightyswipe:
		TNT1 A 0
		TNT1 A 0
		RSWP A 2
		TNT1 A 0 a_playsound ("doomslayer/sword",0)
		RSWP B 1 A_FireCustomMissile("mightyslayermelee",0,0,40,0)
		RSWP C 1 A_FireCustomMissile("mightyslayermelee",0,0,20,0)
		TNT1 A 0 A_FireCustomMissile("mightyslayermelee",0,0,0,0)
		RSWP D 2 A_FireCustomMissile("mightyslayermelee",0,0,-20,0)
		RSWP E 3 		
		TNT1 A 4
		LSWP A 2
		TNT1 A 0 a_playsound ("doomslayer/sword",0)
		LSWP B 1 A_FireCustomMissile("mightyslayermelee",0,0,40,0)
		LSWP C 1 A_FireCustomMissile("mightyslayermelee",0,0,20,0)
		TNT1 A 0 A_FireCustomMissile("mightyslayermelee",0,0,0,0)
		LSWP D 2 A_FireCustomMissile("mightyslayermelee",0,0,-20,0)
		LSWP E 2 
		TNT1 A 0 a_takeinventory ("UsingRend",99)
		TNT1 A 0 a_playsound ("doomslayer/sworddown")
		TNT1 A 3
		TNT1 A 2
		TNRL STUVW 1 a_weaponready (WRF_NOSECONDARY|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
		goto ready
		
	Reload:
		"####" "#" 1 a_jumpifinventory ("SlayerBombCooldown",1, "quickpunch")
		TNT1 A 0 a_playsound ("doomslayer/zerkswing",0)
		DSUB AB 2
		TNT1 A 0 a_jumpifinventory ("Thunderbombcheck",1,"Thunderbomb")
		TNT1 A 0 a_jumpifinventory ("Firebombcheck",1,"Firebomb")
		TNT1 A 0 a_jumpifinventory ("Beambombcheck",1,"beambomb")
		DSUB C 1 a_firecustommissile ("spikebomb")
		TNT1 A 0 a_giveinventory ("SlayerBombCooldown",200)
		DSUB DEF 1
		TNT1 A 5 a_weaponready (WRF_ALLOWZOOM)
		TNRL STUVW 1 a_weaponready (WRF_ALLOWZOOM)
		goto ready
	quickpunch:
		TNT1 A 0
		TNT1 A 0 a_playsound ("doomslayer/zerkswing",0)
		BERS JK 2
		TNT1 A 0 a_playsound ("Doomslayer/unf",0)
		BERS L 2 a_firecustommissile ("quickpunch")
		BERS NO 1
		TNT1 A 5 
		TNRL STUVW 1 a_weaponready
		goto ready
	BeamBomb:
		TNT1 A 0
		TNT1 A 0 a_takeinventory ("bombammo",1)
		DSUB C 1 a_firecustommissile ("beambomb")
		TNT1 A 0 a_giveinventory ("SlayerBombCooldown",200)
		DSUB DEF 1
		TNT1 A 5 a_weaponready (WRF_ALLOWZOOM)
		TNRL STUVW 1 a_weaponready (WRF_ALLOWZOOM)
		goto ready
	FireBomb:
		TNT1 A 0
		TNT1 A 0 a_takeinventory ("bombammo",1)
		DSUB C 1 a_firecustommissile ("slayerfirebomb")
		TNT1 A 0 a_giveinventory ("SlayerBombCooldown",200)
		DSUB DEF 1
		TNT1 A 5 a_weaponready (WRF_ALLOWZOOM)
		TNRL STUVW 1 a_weaponready (WRF_ALLOWZOOM)
		goto ready
	ThunderBomb:
		TNT1 A 0
		TNT1 A 0 a_takeinventory ("bombammo",1)
		DSUB C 1 a_firecustommissile ("slayerThunderbomb")
		TNT1 A 0 a_giveinventory ("SlayerBombCooldown",200)
		DSUB DEF 1
		TNT1 A 5 a_weaponready (WRF_ALLOWZOOM)
		TNRL STUVW 1 a_weaponready (WRF_ALLOWZOOM)
		goto ready
		
		

	Zoom:
		"####" "#" 1 a_jumpifinventory ("SlayerDaggerCooldown",1, "quickpunch")
		TNT1 A 0 a_playsound ("doomslayer/zerkswing",0)
		DSUB AB 2
		TNT1 A 0 a_jumpifinventory ("FoodDaggercheck",1, "FoodDagger")
		TNT1 A 0 a_jumpifinventory ("AmmoDaggercheck",1, "AmmoDagger")
		TNT1 A 0 a_jumpifinventory ("SpreadDaggercheck",1, "SpreadDagger")
		TNT1 A 0 a_jumpifinventory ("GlassDaggercheck",1, "GlassDagger")
		DSUB C 1 a_firecustommissile ("draindagger")
		TNT1 A 0 a_giveinventory ("SlayerDaggerCooldown",200)
		DSUB DEF 1
		TNT1 A 5 a_weaponready (WRF_ALLOWRELOAD)
		TNRL STUVW 1 a_weaponready (WRF_ALLOWRELOAD)
		goto ready
	GlassDagger:
		TNT1 A 0
		TNT1 A 0 a_takeinventory ("daggerammo",1)
		DSUB C 1 a_firecustommissile ("Glassdagger")
		TNT1 A 0 a_giveinventory ("SlayerDaggerCooldown",200)
		DSUB DEF 1
		TNT1 A 5 a_weaponready (WRF_ALLOWRELOAD)
		TNRL STUVW 1 a_weaponready (WRF_ALLOWRELOAD)
		goto ready
	SpreadDagger:
		TNT1 A 0
		TNT1 A 0 a_takeinventory ("daggerammo",1)
		TNT1 A 0 a_firecustommissile ("SpreadDagger",-16)
		TNT1 A 0 a_firecustommissile ("SpreadDagger",-8)
		TNT1 A 0 a_firecustommissile ("SpreadDagger",-4)
		TNT1 A 0 a_firecustommissile ("SpreadDagger",4)
		TNT1 A 0 a_firecustommissile ("SpreadDagger",8)
		TNT1 A 0 a_firecustommissile ("SpreadDagger",16)
		DSUB C 1 a_firecustommissile ("Spreaddagger")
		TNT1 A 0 a_giveinventory ("SlayerDaggerCooldown",200)
		DSUB DEF 1
		TNT1 A 5 a_weaponready (WRF_ALLOWRELOAD)
		TNRL STUVW 1 a_weaponready (WRF_ALLOWRELOAD)
		goto ready
	AmmoDagger:
		TNT1 A 0
		TNT1 A 0 a_takeinventory ("daggerammo",1)
		DSUB C 1 a_firecustommissile ("Ammodagger")
		TNT1 A 0 a_giveinventory ("SlayerDaggerCooldown",200)
		DSUB DEF 1
		TNT1 A 5 a_weaponready (WRF_ALLOWRELOAD)
		TNRL STUVW 1 a_weaponready (WRF_ALLOWRELOAD)
		goto ready
	FoodDagger:
		TNT1 A 0
		TNT1 A 0 a_takeinventory ("daggerammo",1)
		DSUB C 1 a_firecustommissile ("Fooddagger")
		TNT1 A 0 a_giveinventory ("SlayerDaggerCooldown",200)
		DSUB DEF 1
		TNT1 A 5 a_weaponready (WRF_ALLOWRELOAD)
		TNRL STUVW 1 a_weaponready (WRF_ALLOWRELOAD)
		goto ready


	}
}

actor thunderpellet : macepellet
{
	damage (30)
	RenderStyle translucent
	damagetype "Thunderpellet"
	decal DoomimpScorch
	Alpha 0.75
	scale 0.50
	states
	{
	Spawn:
		TBPL A 1 bright A_SpawnItemex("teslablastTrail")
		TBPL B 1 bright A_SpawnItemex("teslablastTrail")
		TBPL C 1 bright A_SpawnItemex("teslablastTrail")
		loop
	Death:
		FAXE RSTUVWX 3 bright
		stop
	crash:
	xdeath:
		TNT1 A 0
		TNT1 A 0
		FAXE R 1 bright a_jumpifintargetinventory ("unleasher",1,"givecharge")
		FAXE STUVWX 2 bright
		stop		
	givecharge:
		TNT1 A 0
		TNT1 A 0
		FAXE R 1 bright A_GiveInventory("zerkcharge",1, AAPTR_TARGET)
		FAXE STUVWX 2 bright
		stop		
	}
}

actor teslablastTrail
{
	Radius 13
	Height 8
	Speed 20
	Damage 0
	scale 0.25
	Projectile
	+NOINTERACTION
	+RANDOMIZE
	+clientsideonly
	RenderStyle Add
	Alpha 0.75
	States
	{
	Spawn:
		TBPL ABC 3 bright
		goto death
	Death:
		TBPL ABC 4 bright A_FadeOut(0.5)
		loop
	}
}

actor sparkFX
{
	Radius 13
	Height 8
	Speed 40
	Damage 0
	scale 1
	Projectile
	+NOINTERACTION
	+RANDOMIZE
	+bright
	+clientsideonly
	RenderStyle Add
	reactiontime 2
	Alpha 0.75
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAAAAA 0  A_SpawnItemEx("sparkfxtrail")
		GRLT ABC 1 A_ChangeVelocity (random(-15, 15), random(-15, 15), random(-15,15), CVF_REPLACE)
		TNT1 AAAAAAA 0  A_SpawnItemEx("sparkfxtrail")
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 1
		stop
	}
}

actor sparkFXtrail
{
	speed 0
	scale 0.75
	alpha 0.50
	+NOINTERACTION
	+bright
	+nogravity
	+clientsideonly
	states
	{
	spawn:
		GRLT ABC 1
		TNT1 A 0 a_fadeout (0.20)
		loop
	death:
		TNT1 A 1
		stop
	}
}