#include "FIGHTER.dec"
#include "PICKUPS.dec"
#include "FRIENDLIES.dec"
#include "CHASECAM.dec"
#include "SFX.dec"
#include "Actors/Zombieman.dec"
#include "Actors/ShotgunGuy.dec"
#include "Actors/DoomImp.dec"
#include "Actors/Demon.dec"
#include "Actors/Spectre.dec"
#include "Actors/BaronOfHell.dec"
#include "Actors/LostSoul.dec"
#include "Actors/Cacodemon.dec"
#include "Actors/Cyberdemon.dec"
#include "Actors/SpiderMastermind.dec"
#include "Actors/ChaingunGuy.dec"
#include "Actors/Revenant.dec"
#include "Actors/HellKnight.dec"
#include "Actors/Archvile.dec"
#include "Actors/Arachnotron.dec"
#include "Actors/Mancubus.dec"
#include "Actors/PainElemental.dec"
#include "Actors/IconOfSin.dec"
#include "Actors/WolfensteinSS.dec"
#include "Actors/CommanderKeen.dec"
#include "Actors/ExplosiveBarrel.dec"
#include "Actors/CrucibleWeapon.dec"

ACTOR DoomguyPlayer : DoomPlayer {
	Scale 0.9
	Radius 16
	Height 56
	Health 100
	GibHealth 50
	Speed 0
	Mass 100
	DamageFactor 1
	PainChance 0
	Player.Face "STM"
	Player.JumpZ 0
	Species "Player"
	+THRUSPECIES
	+NOSKIN
	PainChance 0
	PainChance "Explosion", 256
	PainChance "CyberdemonRocket", 256
	Player.SoundClass "Marine"
	Player.DisplayName "Doomguy"
	Player.ColorRange 112, 127
	Player.StartItem "isPlayer"
	Player.StartItem "PlayerAlive"
	Player.StartItem "DoomguyWeapon"
	Player.StartItem "SourceLightSpawner"
	States {
	Spawn: 
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("ExplosiveBarrelEquipped",1,"ExplosiveBarrelSpawn")
		TNT1 A 0 A_JumpIfInventory("CrucibleEquipped",1,"CrucibleSpawn")
		Goto UnnarmedSpawn
	UnnarmedSpawn:
		DMG1 ABCDEF 5
		Loop
	Running:
		DMG1 GHIJKLMNOPQ 2
		TNT1 A 0 A_GiveInventory("FlyingKickAction",1)
		Loop
	Jump:
		DMG1 Q 2
		DMG1 RSTUVW 1
		DMG1 XYZ 2
		DMG1 [ 2
	Falling:
		DMG1 ] 1 
		Loop
	Landing:
		DMG2 ABC 2
		Goto UnnarmedSpawn
	Pain.Explosion:
	Pain.CyberdemonRocket:
	Knockdown:
		TNT1 A 0 A_GiveInventory("cantAttack",1)
		TNT1 A 0 A_JumpIfInventory("ExplosiveBarrelEquipped",1,4)
		TNT1 A 0 A_JumpIfInventory("CrucibleEquipped",1,1)
		Goto Knockdown+7
		TNT1 A 0 A_TakeInventory("CrucibleEquipped",1)
		TNT1 A 0 A_SpawnItemEx("CruciblePickup",0,0,0,0,0,5)
		Goto Knockdown+7
		TNT1 A 0 A_TakeInventory("ExplosiveBarrelEquipped",1)
		TNT1 A 0 A_SpawnItemEx("ExplosiveBarrelThrown",0,0,0,0,0,5)
		TNT1 A 0 A_ChangeFlag(NOPAIN,TRUE)
		TNT1 A 0 A_ChangeFlag(GHOST,TRUE)
		TNT1 A 0 A_GiveInventory("SetInvulnerable",1)
		TNT1 A 0 ThrustThingZ(0,20,0,0)
		DMG2 D 2 
		DMG2 EFG 2
		TNT1 A 0 A_CheckFloor("KnockdownFalling")
		DMG2 HI 2
		TNT1 A 0 A_CheckFloor("KnockdownFalling")
		DMG2 JK 2
	KnockdownFalling:
		TNT1 A 0 A_GiveInventory("isKnockdownFalling",1)
		DMG2 L 1 
		DMG2 L 1 A_JumpIf((ACS_NamedExecuteWithResult("CheckVelZ",0,1,0))>=-1,"KnockdownLanding")
		Goto KnockdownFalling+1
		Loop
	KnockdownLanding:
		TNT1 A 0 A_PlaySound("HitMedium")
		TNT1 A 0 A_TakeInventory("isKnockdownFalling",1)
		DMG2 MNOOOOOOOO 2
	GetUp:
		DMG2 PQRSTU 2
		TNT1 A 0 A_PlaySound("Jump")
		DMG2 VWXYZ 2
		TNT1 A 0 A_PlaySound("Landing")
		TNT1 A 0 A_TakeInventory("cantAttack",1)
		TNT1 A 0 A_TakeInventory("SetInvulnerable",1)
		TNT1 A 0  A_ChangeFlag(NOPAIN,FALSE)
		TNT1 A 0  A_ChangeFlag(GHOST,FALSE)
		Goto UnnarmedSpawn
	Melee:
	Missile:
		TNT1 A 0 
		Goto Spawn
	Attack1:
		DMG3 ABCD 1
		DMG3 D 2
		DMG3 EFGHIJKLMNOP 1
		Goto UnnarmedSpawn
	Attack2:
		DMG3 QRSTUVW 1
		DMG3 W 2
		DMG3 XYZ 1
		DMG4 ABCDEF 1
		Goto UnnarmedSpawn
	Attack3:
		DMG4 GHIJKLM 1
		DMG4 M 2
		DMG4 NOPQRSTUVWXYZ 1
		DMG4 [ 1
		Goto UnnarmedSpawn
	Attack4:
		DMG5 ABCDEFGHIJKLMNOPQRSTU 1
		Goto UnnarmedSpawn
	Attack5:
		DMG5 VWXYZ 1
		DMG6 ABCDE 1
		DMG6 FGHIJ 2
		Goto UnnarmedSpawn
	Attack6:
		DMG6 KLMNOPQRSTUVWXY 1
		Goto UnnarmedSpawn
	Attack7:
		DMGL ABCDEFGHIJKLMNO 2
		Goto UnnarmedSpawn
	Attack8:
		DMGL PQRSTUVWXYZ 2
		DMGL [ 2
		DMGL ] 2
		DMGM ABCDEFGHIJK 2
		Goto UnnarmedSpawn
	Attack9:
		DMGM LMNOPQRST 1
		DMGM UVWXYZ 2
		DMGM [ 2
		DMGM ] 2
		DMGN AB 2
		Goto UnnarmedSpawn
	Attack10:
		DMGN CDEFGHIJKLMNOPQRS 1
		Goto UnnarmedSpawn
	JumpAttack1:
		DMG7 ABCDEFGHIJ 1
		Goto UnnarmedSpawn
	JumpAttack2:
		DMG7 KKLLMMNOPQRSTU 1
		Goto UnnarmedSpawn
	FlyingKick:
		DMGR ABCDEFGHIJKLMNO 1
		Goto UnnarmedSpawn
	Taunt:
		DMGT ABCDEFGHIJKLMNOPQRSTUVWXYZ 2
		Goto UnnarmedSpawn
	Grapple:
		DMGO ABCDEFGH 1
		DMGO GFEDCBA 1
		Goto UnnarmedSpawn
	Grappling:
		DMGO H 1
		Loop
	GrappleFail:
		DMGO IJKLMNOPQRST 1
		Goto UnnarmedSpawn
	GrappleExecution:
		DMGP ABCDEFGHIJKLMNOPQRSTUVWXYZ 2
		DMGP [ 2
		DMGP ] 2
		Goto UnnarmedSpawn
	GrappleThrow:
		DMGQ ABCDEFGHIJKLMNOPQRSTU 2
		Goto UnnarmedSpawn
	Backdash:
		DMGS ABCD 1
		DMGS EEF 2 
		DMGS FGHIJ 1
		Goto UnnarmedSpawn
	DesperateAttack:
		DMGU AB 1
		DMGU C 12
		DMGU DEFG 1
		DMGU HIJKLMNOP 2
		DMGU QRST 1
		Goto UnnarmedSpawn
//******************************************************************************
	ExplosiveBarrelPickup:
		DMG9 ABCDEFGHIJ 2
		Goto ExplosiveBarrelSpawn
	ExplosiveBarrelLaydown:
		DMG9 JIHGFEDCBA 2
		Goto UnnarmedSpawn
	ExplosiveBarrelSpawn:
		DMG9 KLMNOP 5
		Loop
	ExplosiveBarrelRunning:
		DMG9 QRSTUVWXYZ 2
		Loop
	ExplosiveBarrelJump:
		DMGA A 2
		DMGA BCDEFG 1
		DMGA HIJK 2
	ExplosiveBarrelFalling:
		DMGA L 1 
		Loop
	ExplosiveBarrelLanding:
		DMGA MNO 2
		Goto ExplosiveBarrelSpawn
	ExplosiveBarrelThrow:
		DMGA PQRSTUVWXYZ 2
		DMGA [ 2
		DMGA ] 2
		DMGB A 2
		Goto UnnarmedSpawn
	ExplosiveBarrelThrow2:
		DMGB BCDEFGHIJK 2
		Goto UnnarmedSpawn
	CrucibleSpawn:
		DMG1 ABCDEF 5
		Loop
//******************************************************************************
	CruciblePickup:
		DMGC ABCDEFGHIJ 2
		Goto CrucibleSpawn
	CrucibleSpawn:
		DMGC KLMNOP 12
		Loop
	CrucibleRunning:
		DMGH QRSTUVWXYZ 2
		Loop
	CrucibleJump:
		DMGD A 2 
		DMGD BCDEFG 1 
		DMGD HIJK 2 
	CrucibleFalling:
		DMGD L 1
		Loop
	CrucibleLanding:
		DMGD MNO 2
		Goto CrucibleSpawn
	CrucibleAttack1:
		DMGD PQRSTUVWXYZ 2 
		DMGD [ 2 
		DMGD ] 2 
		DMGE A 2 
		Goto CrucibleSpawn
	CrucibleAttack2:
		DMGE BCDEFGHIJKLMNO 2
		Goto CrucibleSpawn
	CrucibleAttack3:
		DMGE PQRSTUVWXYZ 2
		DMGE [ 2 
		DMGE ] 2 
		DMGF AB 2 
		Goto CrucibleSpawn
	CrucibleAttack4:
		DMGF CDEFGHIJKLMNOPQRSTUV 2
		Goto CrucibleSpawn
	CrucibleAttack5:
		DMGI ABCDEFGHIJKLMNOPQRST 2 
		Goto CrucibleSpawn
	CrucibleAttack6:
		DMGJ ABCDEFGHIJKLMNOPQRST 2 
		Goto CrucibleSpawn
	CrucibleAttack7:
		DMGK ABCDEFGHIJKLMNOPQRSTUV 2 
		Goto CrucibleSpawn
	CrucibleJumpAttack:
		DMGF WXY 2
	CrucibleJumpAttackFalling:
		DMGF Z 1
		Loop
	CrucibleJumpAttackLanding:
		DMGG ABCDEFGHIJ 2
		Goto CrucibleSpawn
	CrucibleThrow:
		DMGG KL 1
		DMGG MNOPQRSTUVW 2
		Goto UnnarmedSpawn
	CrucibleThrow2:
		DMGH ABCDEFG 2
		Goto UnnarmedSpawn
	CrucibleTaunt:
		DMGT ABCDEFGHIJKLMNOPQRSTUVWXYZ 2
		Goto CrucibleSpawn
	CrucibleBackdash:
		DMGS KLMN 1
		DMGS OOO 2 
		DMGS PQRST 1
		Goto CrucibleSpawn
//******************************************************************************
	Death:
	XDeath:
		TNT1 A 0 
		TNT1 A 0 A_PlayerScream
		DMG8 A 2 A_NoBlocking
		DMG8 A 2 A_Jump(256,"PreDeath1","PreDeath2")
	PreDeath1:
	    TNT1 A 0 ACS_NamedExecuteAlways("PlayerStates",0,18,0)
	Death1:
		DMG8 BCDEFGHIJKLMN 3
		DMG8 N -1
	PreDeath2:
	    TNT1 A 0 ACS_NamedExecuteAlways("PlayerStates",0,19,0)
	Death2:
		TNT1 A 0 A_Recoil(4)
		DMG8 OPQRSTUVWXYZ 3
		DMG8 [ 3
		DMG8 ] -1
	}
}
ACTOR InventoryMaxAmount1 : Inventory {
    Inventory.MaxAmount 1
}
ACTOR PlayerAlive : InventoryMaxAmount1 {}
ACTOR PlayerRunning : InventoryMaxAmount1 {}
ACTOR PlayerJump : InventoryMaxAmount1 {}
ACTOR PlayerTaunt : InventoryMaxAmount1 {}

ACTOR Attack1 : InventoryMaxAmount1 {}
ACTOR Attack2 : InventoryMaxAmount1 {}
ACTOR Attack3 : InventoryMaxAmount1 {}
ACTOR Attack4 : InventoryMaxAmount1 {}
ACTOR Attack5 : InventoryMaxAmount1 {}
ACTOR Attack6 : InventoryMaxAmount1 {} 
ACTOR Attack7 : InventoryMaxAmount1 {} 
ACTOR Attack8 : InventoryMaxAmount1 {} 
ACTOR Attack9 : InventoryMaxAmount1 {} 
ACTOR Attack10 : InventoryMaxAmount1 {}  
ACTOR JumpAttack1 : InventoryMaxAmount1 {}
ACTOR JumpAttack2 : InventoryMaxAmount1 {}
ACTOR DesperateAttackAction : InventoryMaxAmount1 {}
ACTOR CrucibleAttack1 : InventoryMaxAmount1 {}
ACTOR CrucibleAttack2 : InventoryMaxAmount1 {}
ACTOR CrucibleAttack3 : InventoryMaxAmount1 {}
ACTOR CrucibleAttack4 : InventoryMaxAmount1 {}
ACTOR CrucibleAttack5 : InventoryMaxAmount1 {}
ACTOR CrucibleAttack6 : InventoryMaxAmount1 {}
ACTOR CrucibleAttack7 : InventoryMaxAmount1 {}
ACTOR CrucibleJumpAttack : InventoryMaxAmount1 {}

ACTOR Autocombo : Inventory {
    Inventory.MaxAmount 10
}  

ACTOR cantAttack : InventoryMaxAmount1 {}
ACTOR isJumping : InventoryMaxAmount1 {}
ACTOR isFalling : InventoryMaxAmount1 {}
ACTOR isKnockdownFalling : InventoryMaxAmount1 {}
ACTOR FlyingKickAction : InventoryMaxAmount1 {}
ACTOR DashAction : InventoryMaxAmount1 {}

ACTOR GrappleAction : InventoryMaxAmount1 {}
ACTOR Grappled : InventoryMaxAmount1 {}
ACTOR GrapplingZombieman : InventoryMaxAmount1 {}
ACTOR GrapplingShotgunGuy : InventoryMaxAmount1 {}
ACTOR GrapplingDoomImp : InventoryMaxAmount1 {}
ACTOR GrapplingDemon : InventoryMaxAmount1 {}
ACTOR GrapplingSpectre : InventoryMaxAmount1 {}
ACTOR GrapplingBaronOfHell : InventoryMaxAmount1 {}
ACTOR GrapplingLostSoul: InventoryMaxAmount1 {}
ACTOR GrapplingCacodemon : InventoryMaxAmount1 {}
ACTOR GrapplingChaingunGuy : InventoryMaxAmount1 {}
ACTOR GrapplingRevenant : InventoryMaxAmount1 {}
ACTOR GrapplingHellKnight : InventoryMaxAmount1 {}
ACTOR GrapplingArchvile : InventoryMaxAmount1 {}
ACTOR GrapplingArachnotron : InventoryMaxAmount1 {}
ACTOR GrapplingMancubus : InventoryMaxAmount1 {}
ACTOR GrapplingPainElemental : InventoryMaxAmount1 {}
ACTOR GrapplingWolfensteinSS : InventoryMaxAmount1 {}
ACTOR ThrowAction : InventoryMaxAmount1 {}
ACTOR ExplosiveBarrelEquipped : InventoryMaxAmount1 {}
ACTOR CrucibleEquipped : InventoryMaxAmount1 {}
ACTOR SetTimeFreezer : InventoryMaxAmount1 {}
ACTOR HitCombo : Inventory {
    Inventory.MaxAmount 50
}
ACTOR ScorePoint : Inventory {
    Inventory.MaxAmount 9999999
}
ACTOR ZombiemanHealth : Inventory {
    Inventory.MaxAmount 15
}
ACTOR ShotgunGuyHealth : Inventory {
    Inventory.MaxAmount 15
}
ACTOR DoomImpHealth : Inventory {
    Inventory.MaxAmount 15
}
ACTOR DemonHealth : Inventory {
    Inventory.MaxAmount 20
}
ACTOR SpectreHealth : Inventory {
    Inventory.MaxAmount 20
}
ACTOR BaronOfHellHealth : Inventory {
    Inventory.MaxAmount 50
}
ACTOR LostSoulHealth : Inventory {
    Inventory.MaxAmount 8
}
ACTOR CacodemonHealth : Inventory {
    Inventory.MaxAmount 20
}
ACTOR CyberdemonHealth : Inventory {
    Inventory.MaxAmount 100
}
ACTOR SpiderMastermindHealth : Inventory {
    Inventory.MaxAmount 200
}
ACTOR ChaingunGuyHealth : Inventory {
    Inventory.MaxAmount 15
}
ACTOR RevenantHealth : Inventory {
    Inventory.MaxAmount 30
}
ACTOR HellKnightHealth : Inventory {
    Inventory.MaxAmount 35
}
ACTOR ArchvileHealth : Inventory {
    Inventory.MaxAmount 50
}
ACTOR ArachnotronHealth : Inventory {
    Inventory.MaxAmount 25
}
ACTOR MancubusHealth : Inventory {
    Inventory.MaxAmount 60
}
ACTOR PainElementalHealth : Inventory {
    Inventory.MaxAmount 40
}
ACTOR IconOfSinHealth : Inventory {
    Inventory.MaxAmount 250
}
ACTOR WolfensteinSSHealth : Inventory {
    Inventory.MaxAmount 15
}
ACTOR CommanderKeenHealth : Inventory {
    Inventory.MaxAmount 20
}
ACTOR ExplosiveBarrelHealth : Inventory {
    Inventory.MaxAmount 20
}
ACTOR TargetIsZombieman : InventoryMaxAmount1 {}
ACTOR TargetIsShotgunGuy : InventoryMaxAmount1 {}
ACTOR TargetIsDoomImp : InventoryMaxAmount1 {}
ACTOR TargetIsDemon : InventoryMaxAmount1 {}
ACTOR TargetIsSpectre : InventoryMaxAmount1 {}
ACTOR TargetIsBaronOfHell : InventoryMaxAmount1 {}
ACTOR TargetIsLostSoul : InventoryMaxAmount1 {}
ACTOR TargetIsCacodemon : InventoryMaxAmount1 {}
ACTOR TargetIsCyberdemon : InventoryMaxAmount1 {}
ACTOR TargetIsSpiderMastermind : InventoryMaxAmount1 {}
ACTOR TargetIsChaingunGuy : InventoryMaxAmount1 {}
ACTOR TargetIsRevenant : InventoryMaxAmount1 {}
ACTOR TargetIsHellKnight : InventoryMaxAmount1 {}
ACTOR TargetIsArchvile : InventoryMaxAmount1 {}
ACTOR TargetIsArachnotron : InventoryMaxAmount1 {}
ACTOR TargetIsMancubus : InventoryMaxAmount1 {}
ACTOR TargetIsPainElemental : InventoryMaxAmount1 {}
ACTOR TargetIsIconOfSin : InventoryMaxAmount1 {}
ACTOR TargetIsWolfensteinSS : InventoryMaxAmount1 {}
ACTOR TargetIsCommanderKeen : InventoryMaxAmount1 {}
ACTOR TargetIsExplosiveBarrel : InventoryMaxAmount1 {}

ACTOR SetInvulnerable : PowerupGiver {
	Inventory.Amount 1
	Inventory.MaxAmount 1
	Powerup.Duration 20
	Powerup.Type "Invulnerable"
	Powerup.Color 128 128 128, 0
	+INVENTORY.ALWAYSPICKUP
	+INVENTORY.AUTOACTIVATE
	States {
	Spawn:
		TNT1 A -1
		Stop
	} 
}
ACTOR NoShotgun replaces Shotgun {}
ACTOR NoSuperShotgun replaces SuperShotgun {}
ACTOR NoChaingun replaces Chaingun {}
ACTOR CruciblePickup2 : CruciblePickup replaces Chainsaw {}
ACTOR NoRocketLauncher replaces RocketLauncher {}
ACTOR NoPlasmaRifle replaces PlasmaRifle {}
ACTOR NoBFG9000 replaces BFG9000 {}
ACTOR NoClip replaces Clip {}
ACTOR NoClipBox replaces ClipBox {}
ACTOR NoShell replaces Shell {}
ACTOR NoShellBox replaces ShellBox {}
ACTOR NoRocketAmmo replaces RocketAmmo {}
ACTOR NoRocketBox replaces RocketBox {}
ACTOR NoCell replaces Cell {}
ACTOR NoCellPack replaces CellPack {}
ACTOR NoBackpack replaces Backpack {}