//+++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++
//The player
//+++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++
actor Deriver : PlayerPawn
{
	Player.DisplayName "Deriver"
	Player.StartItem "Buran"
	Player.StartItem "IAmDeriver", 1
	Player.StartItem "IsPlayer", 1
	Player.AirCapacity 0
	Player.Scoreicon "DERIICON"
	Player.StartItem "Buran", 1
	Player.StartItem "Clip", 50
	Player.CrouchSprite "CAGY"
	Player.Portrait "CBGPIC"
	Player.StartItem "SpecialBackPack", 1
	Player.StartItem "CustomMisc", 1
	Player.StartItem "CustomAmmo", 1
	Player.jumpz 10
	Player.SoundClass "Deriver"
	Player.ColorRange 112, 127
	Species "Player"
	+THRUSPECIES
	+dontblast
	+DONTGIB
	Speed 1
	Health 100
	Radius 16
	Height 56
	Mass 100
	PainChance 255
	Player.MaxHealth 100
	Player.WeaponSlot 1, Buran
 	Player.WeaponSlot 2, DeriverShotgun
	Player.WeaponSlot 3, TridentLauncher
	Player.WeaponSlot 4, DeriverPlasma
	states
	{
	Spawn:
		TNT1 A 0 
		R1VL A Random (40,90)
		R1VL BCD 5
		Loop
	See:
		TNT1 A 0 
		R1VL EFGH 4 
		Loop
	GunAttack:
		R1VL I 1
		R1VL J 2 Bright
		R1VL KLI 2
		Goto Spawn
	Slash:
		TNT1 A 0
		R1VL MNOPQQQ 2
		Goto Spawn
	Parry:
		R1VL MRSTUUUU 2
		Goto Spawn	
	
	Pain:
		TNT1 A 0 
		R1VL V 4 A_Pain
		R1VL V 4 
		Goto Spawn
	Death:
	XDeath:
		R1VL W 2 A_PlayerScream
		R1VL X 2 A_NoBlocking
		R1VL Y 2
		TNT1 AAAAAAAAAAAAAAAAA 0 A_SpawnItemEx ("DeriverDeadParticle",0,0,Random(-15,15),random(-5,5),random(-4,4),random(4,8),0,SXF_NOCHECKPOSITION)		
		TNT1 A 1 A_SpawnItemEx ("DroppedDeriverCloak",0,0,34,0,0,Random(6,9),0,SXF_NOCHECKPOSITION|SXF_TRANSFERTRANSLATION)
		TNT1 A -1
		Stop
	}
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++
//Dead particles and the dropped cloak
//+++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++

actor DeriverDeadParticle
{
	Speed 10
	Radius 8
	Height 5
	Alpha 0.8
	Scale 1
	PROJECTILE
	+BRIGHT
	+THRUACTORS
	+MOVEWITHSECTOR
	+DONTBLAST
	+NOINTERACTION
	States
	{
	Spawn:
		R1VP A Random (1,5)
		R1VP BCDE 2
		R1VP E 2 A_ScaleVelocity (Frandom(0.60,0.80))
		R1VP E 2 A_ScaleVelocity (Frandom(0.60,0.80))
		TNT1 A 0 A_Stop
		TNT1 A 0 ThrustThingZ (0,5,0,0)
		R1VP E 2 A_SetScale (0.90,1.10)
		TNT1 A 0 ThrustThingZ (0,5,0,1)
		R1VP E 2 A_SetScale (0.70,1.30)
		TNT1 A 0 ThrustThingZ (0,10,0,1)
		R1VP E 2 A_SetScale (0.60,1.50)
		TNT1 A 0 ThrustThingZ (0,15,0,1)
		R1VP E 2 A_SetScale (0.40,2)
		TNT1 A 0 ThrustThingZ (0,30,0,1)
		R1VP E 2 A_SetScale (0.20,3)
		TNT1 A 0 ThrustThingZ (0,50,0,1)
		R1VP E 8
		Goto Death
	Death:
		TNT1 A 0
		TNT1 A 1
		Stop
	}
}


actor DroppedDeriverCloak
{
	Speed 10
	Radius 8
	Height 5
	Scale 1
	PROJECTILE
	+BRIGHT
	+THRUACTORS
	+MOVEWITHSECTOR
	+DONTBLAST
	+BOUNCEONWALLS
	+BOUNCEONCEILINGS
	States
	{
	Spawn:
		CL0K A 5
		CL0K A 1 A_ScaleVelocity (0.60)
		CL0K B 1 A_ScaleVelocity (0.30)
		CL0K C 1
		TNT1 A 0 A_Gravity
		TNT1 A 0 A_SetGravity (0.60)
		CL0K DE 2
		Goto Falling
	Falling:
		CL0K FGH 3
		Loop
	Death:
		CL0K IJKL 2
		CL0K L -1
		stop
	}
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++
//Tokens
//+++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++

actor IamDeriver : inventory
{
	+UNDROPPABLE 
	-INVBAR
	inventory.maxamount 1
}


actor DeriverOverMaxHealth : inventory
{
	+UNDROPPABLE 
	-INVBAR
	inventory.maxamount 100	
}

actor DeriverOverMaxArmor : inventory
{
	+UNDROPPABLE 
	-INVBAR
	inventory.maxamount 100	
}
