actor BerserkFists : weapon
{
	Weapon.SelectionOrder 60
	weapon.slotnumber 7
	Inventory.RestrictedTo "DoomSlayer"
	Tag "Berserk fists"
	+CHEATNOTWEAPON
	states
	{
	spawn:
		BFUG A 1
		loop
	select:
		BERS A 1 a_raise
		TNT1 A 0 a_giveinventory ("UsingSlayerFists",1)
		BERS AA 0 a_raise
		loop
	deselect:
		TNT1 A 0
		TNT1 A 0 a_selectweapon ("rend")
		BERS A 1 a_lower
		TNT1 A 0 a_takeinventory ("UsingSlayerFists",99)
		TNT1 A 0 a_takeinventory ("zerkright",99)
		TNT1 A 0 a_takeinventory ("raging",99)
		TNT1 A 0 ACS_NamedExecuteWithResult("BerserkEnd")
		TNT1 A 0 a_selectweapon ("rend")
		BERS AA 0 a_lower
		TNT1 A 0 a_takeinventory ("raging",99)
		TNT1 A 0 a_takeinventory ("zerkright",99)
		TNT1 A 0 a_selectweapon ("rend")
		loop
	ready:
		BERS ABCCBA 3 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 A_jumpifinventory ("zerkcharge",1,"ready")
		goto deselect
	fire:
		TNT1 A 0
		BERS A 1 a_jumpifinventory ("zerkcharge",1,"realfire")
		goto deselect
	realfire:
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("zerkright",1,"leftpunch")
		TNT1 A 0 a_giveinventory ("zerkright",1)
		BERS DEE 1
		TNT1 A 0 a_playsound ("doomslayer/zerkswing",0)
		BERS F 1 a_firecustommissile ("superberserkpunch")
		TNT1 A 0 a_jumpifinventory ("stingmonster",1,"superrighthit")
		BERS G 1 
		TNT1 A 0 a_jumpifinventory ("stingmonster",1,"superrighthit2")
		BERS H 1
		TNT1 A 0 a_jumpifinventory ("stingmonster",1,"superrighthit3")
		BERS I 1
		TBT1 A 0 a_jumpifinventory ("stingmonster",1,"superrighthit4")
		TNT1 A 4 a_takeinventory ("stingmonster",999)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		TNT1 A 4 a_refire
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	superrighthit:
		TNT1 A 0
		BERS F 1 offset (3,37)
		BERS F 1 offset (-1,30)
		BERS F 1 offset (0,32)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		BERS GHI 1
		TNT1 A 3
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	superrighthit2:
		TNT1 A 0
		BERS G 1 offset (3,37)
		BERS G 1 offset (-1,30)
		BERS G 1 offset (0,32)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		BERS HI 1
		TNT1 A 3
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	superrighthit3:
		TNT1 A 0
		BERS H 1 offset (3,37)
		BERS H 1 offset (-1,30)
		BERS H 1 offset (0,32)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		BERS I 1
		TNT1 A 3
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	superrighthit4:
		TNT1 A 0
		BERS I 1 offset (3,37)
		BERS I 1 offset (-1,30)
		BERS I 1 offset (0,32)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		TNT1 A 3
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	leftpunch:
		TNT1 A 0
		TNT1 A 0 a_takeinventory ("Zerkright",999)
		BERS JKK 1
		TNT1 A 0 a_playsound ("doomslayer/zerkswing",0)
		BERS L 1 a_firecustommissile ("superberserkpunch")
		TNT1 A 0 a_jumpifinventory ("stingmonster",1,"superlefthit")
		BERS M 1 
		TNT1 A 0 a_jumpifinventory ("stingmonster",1,"superlefthit2")
		BERS N 1
		TNT1 A 0 a_jumpifinventory ("stingmonster",1,"superlefthit3")
		BERS O 1
		TBT1 A 0 a_jumpifinventory ("stingmonster",1,"superlefthit4")
		TNT1 A 4 a_takeinventory ("stingmonster",999)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		TNT1 A 4 a_refire
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect		
	superlefthit:
		TNT1 A 0
		BERS L 1 offset (3,37)
		BERS L 1 offset (-1,30)
		BERS L 1 offset (0,32)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		BERS MNO 1
		TNT1 A 3
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	superlefthit2:
		TNT1 A 0
		BERS M 1 offset (3,37)
		BERS M 1 offset (-1,30)
		BERS M 1 offset (0,32)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		BERS NO 1
		TNT1 A 3
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	superlefthit3:
		TNT1 A 0
		BERS N 1 offset (3,37)
		BERS N 1 offset (-1,30)
		BERS N 1 offset (0,32)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		BERS O 1
		TNT1 A 3
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	superlefthit4:
		TNT1 A 0
		BERS O 1 offset (3,37)
		BERS O 1 offset (-1,30)
		BERS O 1 offset (0,32)
		TNT1 A 0 a_takeinventory ("stingmonster",999)
		TNT1 A 3
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	altfire:
		TNT1 A 0
		BERS A 1 a_jumpifinventory ("zerkcharge",1,"realaltfire")
		goto deselect
	Realaltfire:
		TNT1 A 2 
		RNDS A 2
		TNT1 A 0 a_playsound ("doomslayer/sword",0)
		RNDS B 1 A_FireCustomMissile("slayerdart",0,0,20,14)
		TNT1 A 0 A_FireCustomMissile("slayerdart",0,0,10,8)
		RNDS C 1 A_FireCustomMissile("slayerdart")
		RNDS D 1 A_FireCustomMissile("slayerdart",0,0,-10,-8)
		RNDS E 1 A_FireCustomMissile("slayerdart",0,0,-20,-14)
		RNDS FFGG 1
		TNT1 A 4
		BERS CBA 2 a_weaponready (WRF_DISABLESWITCH)
		TNT1 A 0 a_jumpifinventory ("zerkcharge",1, "ready")
		goto deselect
	}
}


actor superberserkpunch : fastprojectile
{
	+dontblast
	+notimefreeze
	+BLOODSPLATTER
	+FORCEXYBILLBOARD		
	+thruspecies
	+forcepain
	+extremedeath
	projectilekickback 400
	species "friendly"
	projectile
	radius 12
	height 16
	speed 100
	decal "scorch"
	damage (450)
	states
	{
	spawn:
		TNT1 A 1
		TNT1 A 0 a_changeflag ("NOINTERACTION",1)
		TNT1 A 1 a_stop
		stop
	death:
        TNT1 A 0
        TNT1 A 1
		TNT1 A 0 Radius_Quake (1,5,0,10,0)
		TNT1 A 0 a_playsound ("doomslayer/zerkmiss",CHAN_VOICE)
		TNT1 A 0 A_GiveInventory("stingmonster",1, AAPTR_TARGET)
		SLHT ABCDE 3
		stop
	crash:
        TNT1 A 0
        TNT1 A 1
		TNT1 A 0 Radius_Quake (1,5,0,10,0)
		TNT1 A 0 a_playsound ("doomslayer/zerkmiss",CHAN_VOICE)
		TNT1 A 0 A_GiveInventory("stingmonster",1, AAPTR_TARGET)
		SLHT ABCDE 3
		stop
	xdeath:
        TNT1 A 0
        TNT1 A 1
		TNT1 A 0 a_playsound ("doomslayer/zerkhit",CHAN_VOICE)
		TNT1 A 0 Radius_Quake (2,4,0,10,0)
		TNT1 A 0 A_GiveInventory("zerkcharge",1, AAPTR_TARGET)
		TNT1 A 0 A_GiveInventory("zerkshield",1, AAPTR_TARGET)
		TNT1 A 0 A_GiveInventory("stingmonster",1, AAPTR_TARGET)
		TNT1 A 0 A_GiveInventory("berserkdrain",1, AAPTR_TARGET)
		TNT1 A 0 a_spawnitemex ("berserkskost",0,0,0,20,0,0,135,SXF_TRANSFERPOINTERS)
		TNT1 A 0 a_spawnitemex ("berserkskost",0,0,0,20,0,0,270,SXF_TRANSFERPOINTERS)
		TNT1 A 0 a_spawnitemex ("berserkskost",0,0,0,20,0,0,315,SXF_TRANSFERPOINTERS)
		TNT1 A 1
		stop
	}
}


ACTOR slayerdart
{
	Radius 8
	Height 12
	Speed 45
	Damage (150)
	renderstyle add
	ALPHA 0.90
	PROJECTILE
	+THRUSPECIES
	species "friendly"
	Seesound "monster/dkndrt"
	DeathSound "weapons/firex2"
	decal "scorch"
	States
	{
	Spawn:
		DKAT ABC 3 Bright
		loop
	xdeath:
		TNT1 A 0
		DKAT D 0 Bright A_SetTranslucent (0.85,1)
		TNT1 A 0 A_GiveInventory("zerkcharge",1, AAPTR_TARGET)
		DKAT D 3 Bright
		DKAT E 3 Bright
		DKAT FG 3 Bright
		DKAT IJKLM 3 Bright
		stop
	Death:
		TNT1 A 0
		DKAT D 0 Bright A_SetTranslucent (0.85,1)
		RIP1 DEFGH 3 Bright
		stop
	}
}

actor berserkskost : skost
{
	Speed 20
	Radius 10
	Height 6
	Damage (100)
	Projectile
	+SEEKERMISSILE
	+FOILINVUL
	+SKYEXPLODE
	+NOEXPLODEFLOOR
	+bounceonwalls
	+bright
    +EXTREMEDEATH
	RenderStyle Translucent
	Alpha 0.4
	obituary "%o was clobbered by %k's Skosts."
	reactiontime 10
	states
	{
	Xdeath:
		TNT1 A 0
		TNT1 A 0		
		TNT1 A 0 A_GiveInventory("zerkcharge",random(0,1), AAPTR_TARGET)
		BSPT A 5 a_playsound ("doomslayer/spiritoof",0,1,0,0.5)
		BSPT B 3
		BSPT B 8 A_playsound ("skeleton/melee",0)
		TNT1 A 0 a_jump (10,"hehfade")
		TNT1 A 0 A_GiveInventory("skostdrain",1, AAPTR_TARGET)
		BSPT A 6
		BSPT A 1 a_fadeout (0.05)
		wait
	hehfade:
		BSPT A 10 a_playsound ("doomslayer/HEHHENH",0)
		BSPT A 1 a_fadeout (0.02)
		wait
		
	}
}

actor ragesplosion
{
	+thruspecies
	species "friendly"
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 1 a_explode (350,200,0,0,200)
		stop
	}
}

actor berserkdrain : custominventory 
{
	inventory.maxamount 1
	+INVENTORY.AUTOACTIVATE
	states
	{
	pickup:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower(100, "drain")
		stop
	drain:
		TNT1 A 0 a_giveinventory ("healchecker",1)
		TNT1 A 0 a_playsound ("doomslayer/lifedrain",0)
		TNT1 AAAAAAAAAAAAAA 0 a_spawnitemex ("MAXparticle",random(-8,16),random(-8,16),random(-10,10),random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0,160)
		TNT1 A 0 a_giveinventory ("health", 10)
		stop
	}
}

actor skostdrain : custominventory 
{
	inventory.maxamount 1
	+INVENTORY.AUTOACTIVATE
	states
	{
	pickup:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower(100, "drain")
		stop
	drain:
		TNT1 A 0 a_giveinventory ("healchecker",1)
		TNT1 A 0 a_playsound ("doomslayer/lifedrain",0)
		TNT1 AAAAAAAAAAAAAA 0 a_spawnitemex ("MAXparticle",random(-8,16),random(-8,16),random(-10,10),random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0,160)
		TNT1 A 0 a_giveinventory ("health", 3)
		stop
	}
}


actor zerkshield : powerprotection
{
	damagefactor "normal", 0.40
	Powerup.Duration -2
	Powerup.Color 0, 0, 0, 0
    inventory.maxamount 1
    +INVENTORY.AUTOACTIVATE
}




actor zerkright : inventory
{inventory.maxamount 1}

actor zerkcharge : inventory
{inventory.maxamount 200}