Actor Protector : PlayerPawn
{
	Health 100
	Player.MaxHealth 100
	+NOSKIN
	+NOICEDEATH
	+NODAMAGETHRUST
	+GHOST
	+QUICKTORETALIATE
	+NOTARGET
	Painchance 256
	LimitedToTeam 0
	Player.ForwardMove 0.775
	Player.SideMove 0.775
	Player.soundclass "PRT"
	Player.displayname "Protector"
	Player.startitem "ProtectorArmor", 1
	Player.StartItem "ProtectorShockRifle", 1
	Player.StartItem "ProtectorMissiles", 1
	Player.StartItem "ProtectorLightningGun", 1
	Player.StartItem "PMissiles", 80
	Player.StartItem "ShockCell", 80
	Player.StartItem "LightningCell", 4
	Player.StartItem "IAMPROTECTOR", 1
	Player.startitem "ArrowSingle", 35
	Player.StartItem "ClassID", 9
	Player.StartItem "HumanTeam", 1
	Player.scoreicon "PROTST"
	Player.ColorRange 112, 127
	DamageFactor "GhostbusterTrap", 0.0
	DamageFactor "SjasScream", 1.2
	DamageFactor "SentryShoot", 0.0
	DamageFactor "HunterSuperIceArrowTrail2", 0.0
	DamageFactor "Drone", 0.0
	DamageFactor "CreepStun", 3.0
	DamageFactor "ChokeAttack", 0.8
	DamageFactor "FrostbiteMelee", 0.8
	DamageFactor "DimmedVision", 0.5
	DamageFactor "GhostbusterExpander", 0.0
	DamageFactor "Poison", 0.0
	DamageFactor "FlaskT2", 0.0
	Species "Human"
	PainChance "Mohoph", 256
	PainChance "MohophRange", 256
	Scale 0.81
	mass 400
	States
	{
	Spawn:
		HPRT A 2
		Loop
	See:
		HPRT AB 4
		TNT1 A 0 A_SpawnItemEx ("MarineStomp", 0, 0, 0, 0, 0, -20, 0,0, 0) 
		HPRT CD 4
		TNT1 A 0 A_SpawnItemEx ("MarineStomp", 0, 0, 0, 0, 0, -20, 0,0, 0) 
		HPRT EF 4
		TNT1 A 0 A_SpawnItemEx ("MarineStomp", 0, 0, 0, 0, 0, -20, 0,0, 0) 
		Goto Spawn
	Missile:
		HPRT G 6
		Goto Spawn
	Melee:
		HPRT H 6 BRIGHT
		Goto Missile
	Pain: 
		HPRT I 8 A_Pain
		Goto Spawn
	Pain.ChokeAttack:
		HPRT I 1
		TNT1 A 0 A_GiveToTarget("ChokePainHealer", 1)
		TNT1 A 0 A_GiveToTarget("VomitPoints", 2)
		HPRT I 7 A_Pain
		Goto Spawn
	Pain.CreeperHealBall:
		HPRT I 1
		TNT1 G 0 A_GiveToTarget("CreeperHealBallHealer", 1)
		HPRT I 7 A_Pain
		Goto Spawn
	Pain.Creepstun:
		TNT1 A 0 HealThing(1)
		TNT1 A 0 A_Pain
		HPRT I 18 ACS_ExecuteAlways(986,0)
		Goto Spawn
	Pain.CreeperHealBall:
		HPRT I 1
		HPRT I 1 A_GiveToTarget("CreeperHealBallHealer", 1)
		Goto Pain
	Pain.Impale:
		TNT1 A 0 ThrustThingZ(0,10,0,1)
		Goto Pain
	Pain.DimmedVision:
		TNT1 A 0 A_Pain
		TNT1 A 0 A_GiveInventory("VisionDimmer", 1)
		TNT1 A 0 A_GiveInventory("VisionDimEffect", 1) // ACS_ExecuteAlways(753, 0)
		TNT1 A 0 ACS_ExecuteAlways(754, 0)
		TNT1 A 0 HealThing(1)
		HPRT I 7
		Goto Spawn	
	Pain.MorgBat:
		TNT1 A 0 A_giveToTarget("MorgHeal", 3)
		Goto Pain		
	Pain.Mohoph:
		HPRT G 1
		TNT1 A 0 A_GiveToTarget("MohophHeal", 1)
		goto Pain
	Pain.MohophRange:
		HPRT G 1
		TNT1 AAA 0 A_GiveToTarget("MohophHeal", 1)
		Goto Pain
	Death:
	DeathAnim:
		TNT1 A 0 A_GiveToTarget("KilledProtector", 1)
		TNT1 A 0 A_GiveToTarget("TotalKillCount", 1)
		TNT1 A 0 A_GiveToTarget("HumanKillCount", 1)
		TNT1 A 0 A_GiveToTarget("LowHPKill", 1)
		TNT1 A 0 A_GiveToTarget("CheckAchievements", 1)
		HPRT J 10
		HPRT K 9 A_PlayerScream
		TNT1 A 0 A_SpawnItemEx("ProtectorArmorPickup", 0, 0, 12, 0, 0, 8)
		HPRT L 8 A_NoBlocking
		HPRT M 7
		HPRT N -1
		stop
	GibDeath:
	Death.ImpaleBite:
		TNT1 A 0 A_GiveToTarget("ImpaleKill", 1)
		TNT1 A 0 A_GiveToTarget("DoubleImpaleKill", 1)
		TNT1 A 0 A_GiveToTarget("JitterskullPoints", 1)
		TNT1 A 0 A_GiveToTarget("VomitPoints", 10)
		TNT1 A 0 A_GiveToTarget("KilledProtector", 1)
		TNT1 A 0 A_GiveToTarget("TotalKillCount", 1)
		TNT1 A 0 A_GiveToTarget("HumanKillCount", 1)
		TNT1 A 0 A_GiveToTarget("CheckAchievements", 1)
		TNT1 A 0 A_GiveToTarget("Crunched",1)
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_PlaySound("gibbage/xsplat")
		TNT1 A 0 A_SkullPop("Custom_BloodySkullPRT")
		TNT1 A 0 A_PlaySound("gibbage/playergib") 
		TNT1 A 0 A_SpawnItemEx("ProtectorArmorPickup", 0, 0, 12, 0, 0, 8)
		TNT1 A 0 A_SpawnItemEx("GIBBER", 0, 0, 0, 0, 0, 0, 0, 160, 0)
        TNT1 A 1 A_SpawnItemEx ("CYBJUNK1", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK2", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK3", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK4", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK5", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 1 A_SpawnItemEx ("CYBJUNK1", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK2", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK3", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK4", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK5", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 1 A_SpawnItemEx ("CYBJUNK1", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK2", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK3", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK4", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK5", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 1 A_SpawnItemEx ("CYBJUNK1", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK2", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK3", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK4", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)
        TNT1 A 0 A_SpawnItemEx ("CYBJUNK5", 1, 1, random(8,32), random(0,5), random(0,5), random(8,18), random(0,360), 161, 0)		
		HPRT I 1
		BLAN A -1
		Stop
	Death.CreeperHealBall:
		TNT1 A 0 A_GiveToTarget("CreeperHealBallHealer", 1)
		TNT1 A 0 A_GiveToTarget("CreepHealKill", 1)
		TNT1 A 0 A_GiveToTarget("HealBallsFired", 1)
		TNT1 A 0 A_GiveToTarget("CreeperMaxCharge", 1)
        Goto DeathAnim
	Death.CreeperMelee:
		TNT1 A 0 A_PlaySoundEx("creeperattack", "Body")
		TNT1 A 0 A_GiveToTarget("Creeperheal",1)
		TNT1 A 0 ACS_ExecuteAlways(997,0)
		TNT1 A 0 A_GiveToTarget("CreeperMeleeKill", 1)
		TNT1 A 0 A_GiveToTarget("HealBallsFired", 1)
		TNT1 A 0 A_GiveToTarget("TotalKillCount", 1)
		TNT1 A 0 A_GiveToTarget("HumanKillCount", 1)
		TNT1 A 0 A_GiveToTarget("KilledProtector", 1)
		TNT1 A 0 A_GiveToTarget("CheckAchievements", 1)
		TNT1 A 0 A_GiveToTarget("CreeperMaxCharge", 1)
//		TNT1 A 0 A_GiveToTarget("GhoulAmmo", 1)
		HPRT J 10 A_SpawnItemEx("SoulSprite", 0, 0, 0, 0, 0, 2)
		HPRT K 9 A_PlayerScream
		TNT1 A 0 A_SpawnItemEx("ProtectorArmorPickup", 0, 0, 12, 0, 0, 8)
		HPRT L 8 A_NoBlocking
		HPRT M 7
		HPRT N -1
		Stop
	Death.MarineSuicideGrenade:
		PLAY A 0
		Goto DoomXDeath
    Death.SjasScream:
        TNT1 A 0 A_GiveToTarget("SjasScreamKill", 1)
        TNT1 A 0 A_GiveToTarget("SjasMeleeMulti", 1)
		Goto DeathAnim
    Death.JitterMelee:
        TNT1 A 0 A_GiveToTarget("JitterMeleeKill", 1)
        TNT1 A 0 A_GiveToTarget("JitterMeleeMulti", 1)
        Goto GibDeath
    Death.CreepStun:
        TNT1 A 0 A_GiveToTarget("CreepStunKill", 1)
		TNT1 A 0 A_GiveToTarget("HealBallsFired", 1)
		TNT1 A 0 A_GiveToTarget("CreeperMaxCharge", 1)
        Goto DeathAnim
    Death.ChokeVomit:
        TNT1 A 0 A_GiveToTarget("ChokeVomitKill", 1)
        Goto DeathAnim
    Death.ChokeAttack:
        TNT1 A 0 A_GiveToTarget("ChokeAttackKill", 1)
		TNT1 A 0 A_GiveToTarget("ChokeDeathHealer", 1)
        Goto GibDeath
	Death.ChokeFeast:
		TNT1 A 0 A_GiveToTarget("ChokeFeasTKill", 1)
		Goto DeathAnim		
    Death.ChokeBloodBall:
		TNT1 A 0 A_GiveToTarget("VomitPoints", 15)
        TNT1 A 0 A_GiveToTarget("ChokeBloodBallKill", 1)
		TNT1 A 0 A_GiveToTarget("ChokeBloodBallMulti", 1)
        Goto DeathAnim
    Death.FrostbiteMelee:
        TNT1 A 0 A_GiveToTarget("FrostbiteMeleeKill", 1)
        Goto GibDeath
	Death.FrostbiteMortar:
		TNT1 A 0 A_GiveToTarget("FrostyMortarKill", 1)
		Goto DeathAnim
    Death.FrostbiteIceBreath:
		TNT1 A 0 A_GiveInventory("MustLetGo", 1)
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_PlayerScream
		TNT1 A 0 A_GiveToTarget("FrostyBreathMulti", 1)
		TNT1 A 0 A_GiveToTarget("FrostbiteIceBreathKill", 1)
		TNT1 A 0 A_GiveToTarget("TotalKillCount", 1)
		TNT1 A 0 A_GiveToTarget("HumanKillCount", 1)
		TNT1 A 0 A_GiveToTarget("KilledProtector", 1)
		TNT1 A 0 A_GiveToTarget("CheckAchievements", 1)
		TNT1 A 0 A_SpawnItemEx("ProtectorArmorPickup", 0, 0, 12, 0, 0, 8)
		TNT1 A 0 A_SpawnItemEx("ProtectorIceDeath", 0, 0, 0, 0, 0, 0)
		HPRT I 1
		BLAN A -1
		Stop
    Death.Impale:
        TNT1 A 0 A_GiveToTarget("ImpaleKill", 1)
		TNT1 A 0 A_GiveToTarget("DoubleImpaleKill", 1)
        Goto DeathAnim
    Death.IceFiendMelee:
		TNT1 A 0 A_GiveToTarget("NightmareMeleeKill", 1)
	Death.DimmedVision:
	DimVisionDeath:
		TNT1 A 0 A_JumpIfInventory("VisionDimmer", 1, 1)
		Goto FadeDeath
		TNT1 A 0 A_GiveToTarget("NightmareHealer", 1)
		TNT1 A 0 A_GiveToTarget("DimDurationEffect", 2)
		TNT1 A 0 A_GiveToTarget("InvisibleCounter", 0)
		TNT1 A 0 A_GiveToTarget("DimmedMeleeKill", 1)
		TNT1 A 0 A_Jump(192, 3)
		TNT1 AA 0 A_PlaySoundEx("IcefiendBackstab1", 5, 0, 1)
		Goto FadeDeath
		TNT1 A 0 A_Jump(192, 3)
		TNT1 AA 0 A_PlaySoundEx("IcefiendBackstab2", 5, 0, 1)
		Goto FadeDeath
		TNT1 A 0 A_Jump(192, 3)
		TNT1 AA 0 A_PlaySoundEx("IcefiendBackstab3", 5, 0, 1)
		Goto FadeDeath
		TNT1 AA 0 A_PlaySoundEx("IcefiendBackstab4", 5, 0, 1)
	    Goto FadeDeath
	Death.NightmareCleave:
		TNT1 A 0 A_GiveToTarget("CleaveKill", 1)
		TNT1 A 0 A_JumpIfInventory("VisionDimmer", 1, "DimVisionDeath")
	    Goto FadeDeath
	FadeDeath:
	    TNT1 A 0 A_GiveToTarget("InvisibleCounter", 8)
		TNT1 A 0 A_GiveToTarget("KilledWitchhunter", 1)
		TNT1 A 0 A_GiveToTarget("TotalKillCount", 1)
		TNT1 A 0 A_GiveToTarget("HumanKillCount", 1)
		TNT1 A 0 A_GiveToTarget("LowHPKill", 1)
		TNT1 A 0 A_GiveToTarget("CheckAchievements", 1)
		HPRT I 1
		TNT1 A 0 A_SpawnItemEx("ProtectorArmorPickup", 0, 0, 12, 0, 0, 8)
		TNT1 A 0 A_SpawnItemEx("FadeProtector", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
		BLAN A -1
	Stop
	Death.MohophRange:
	Death.Mohoph:
		PLAY A 0 A_GiveToTarget("TransPRT",1)
		TNT1 A 0 A_GiveToTarget("MorphAmmo", 1)
		PLAY A 0 A_PlaySoundEx("MohophKill","Body")
		TNT1 A 0 A_giveToTarget("MohophDasher", 1)
		TNT1 A 0 A_GiveToTarget("MohophKill", 1)
		TNT1 A 0 A_GiveToTarget("KilledProtector2", 1)
		TNT1 A 0 A_GiveToTarget("MohophPRTText", 1)
		TNT1 A 0 A_JumpIfInTargetInventory("MohophJustMorphed", 1, 2)
		TNT1 A 0 A_Jump(256, 2)
		TNT1 A 0 A_GiveToTarget("JustMorphedKill", 1)		
		TNT1 A 0 ACS_ExecuteAlways(514, 0, 4)
		PLAY A 0 ACS_ExecuteAlways(976,0)
		TNT1 A 0 A_JumpIfInTargetInventory("MohophWarlockCheck", 1, 1)
		Goto DeathAnim
		TNT1 A 0 A_GiveToTarget("MorphAmmo", 1)
		Goto DeathAnim
	Death.MorgMelee:
		TNT1 A 0 A_GiveToTarget("MorgBatAmmo", 2)
		TNT1 A 0 A_GiveToTarget("MorgMeleeKill", 1)
		TNT1 A 0 A_GiveToTarget("MorgMulti", 1)
		Goto DeathAnim
	Death.MorgBat:
		TNT1 A 0 A_GiveToTarget("MorgBatKill", 1)
		Goto DeathAnim			
	}
}

Actor ProtectorArmor : BasicArmorBonus
{
	inventory.icon "PROTARM"
	Armor.SavePercent 25.0
	Armor.SaveAmount 50
	Armor.MaxSaveAmount 100
}

Actor ProtectorArmorShard : BasicArmorBonus
{
	inventory.icon "PROTARM"
	Armor.SavePercent 25.0
	Armor.SaveAmount 25
	Armor.MaxSaveAmount 100
}

Actor ProtectorArmorPickup : CustomInventory
{
	Inventory.MaxAmount 1
	Inventory.PickupMessage "You got the armor of a fallen Protector!"
	Inventory.PickupSound "Protector/ArmorPickup"
	Scale 0.75
	VisibleToTeam 0
	
//	+ALWAYSPICKUP
	+AUTOACTIVATE
	  States
	  {
	  Spawn:
		PRAR A -1
		Loop
		Pickup:
			TNT1 A 0 A_JumpIfInventory("HumanTeam", 1, "Check")
		Fail
		Check:
		// check warlock bone armor
			TNT1 A 0 A_JumpIfInventory("BoneShieldArmor", 1, "Failure")
			TNT1 A 0 A_JumpIfInventory("ClassID", 17, 3) // Mohoph
			TNT1 A 0 A_JumpIf(1 == ACS_executeWithResult(977, 0), "Failure")
			TNT1 A 0 A_GiveInventory("ProtectorArmor", 1)
		Stop
		Failure:
			TNT1 A 0
		Fail
	  }
}

Actor ProtectorDashEnergy : Ammo
{
	inventory.amount 1
	inventory.maxamount 100
	inventory.icon "PROTDAS"
	+IGNORESKILL
}

actor ProtectorFakeSpeed : PowerupGiver
{
  inventory.maxamount 0
  powerup.duration 24
  powerup.color "00 00 00", 0.0
  powerup.type "Speed"
  Speed 1.0
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  states
  {
  Spawn:
    TNT1 A 6
    loop
  }
}

Actor ProtectorDashCooldown : PowerDamage
{
	powerup.duration 40
	damagefactor "normal", 1.0
}

Actor UpgradeCount : Inventory
{
	inventory.maxamount 7
}

ACTOR ProtectorMissiles : Weapon
{
  Weapon.SelectionOrder 1800
  Weapon.AmmoUse1 4
  Weapon.AmmoGive1 80
  Weapon.AmmoType1 "PMissiles"
  Weapon.AmmoType2 "ProtectorDashEnergy"
  inventory.icon "PROTMIS"
  Weapon.Slotnumber 2
  AttackSound "weapons/minimisfire"
  Inventory.PickupMessage "$You got the mini missile launcher !"
  +WEAPON.NOAUTOAIM
  States
  {
  Spawn:
    MMSL A -1
    Stop
  Ready:
    ROKE AAAAAAAAAAAAAAAAAAAAAAAAAAAA 2 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("PMissiles", 0, "Ready")
	TNT1 A 0 ACS_executeAlways(996, 0, 2)	
    Loop
  Deselect:
    ROKE A 1 A_Lower
	TNT1 A 0 A_Lower
    Loop
  Select:
    TNT1 A 0 A_GiveInventory("ProtectorCantDash", 1)
    TNT1 A 0 ACS_ExecuteAlways(700, 0, WM_PROTMIS)
  SelectLoop:
    ROKE A 1 A_Raise
	TNT1 A 0 A_Raise
    Loop
  Fire:
    TNT1 A 0 A_JumpIfInventory("UpgradeCount", 3, "FireStrong")
	ROKE ABCDEFG 1	
	TNT1 A 0 A_GunFlash
	ROKE B 0 A_PlayWeaponSound("weapons/minimisfire")
	TNT1 A 0 A_giveInventory("ProtectorDashEnergy", 10)
	ROKG H 0 A_FireCustomMissile("MinMissile", 0.0, 0,  0 +10, -0.0, 2, 1.5)
	ROKG H 0 A_FireCustomMissile("MinMissile",-2.5, 0,  2 +10, -2.0, 2, 0.0)
	ROKG H 0 A_FireCustomMissile("MinMissile", 2.5, 0, -2 +10, -2.0, 2, 0.0)
	ROKG H 0 A_FireCustomMissile("MinMissile", 0.0, 1,  0 +10, -4.0, 2,-1.5)
	ROKE HIJIHGFEDCBA 2
	Goto Ready
  FireStrong:
	ROKE ABCDEFG 1	
	TNT1 A 0 A_GunFlash
	ROKE B 0 A_PlayWeaponSound("weapons/minimisfire")
	TNT1 A 0 A_giveInventory("ProtectorDashEnergy", 10)
	ROKG H 0 A_FireCustomMissile("MinMissile", 0.0, 0,  0 +10, -0.0, 2, 1.5)
	ROKG H 0 A_FireCustomMissile("MinMissile",-2.5, 0,  2 +10, -2.0, 2, 0.0)
	ROKG H 0 A_FireCustomMissile("MinMissile", 2.5, 0, -2 +10, -2.0, 2, 0.0)
	ROKG H 0 A_FireCustomMissile("MinMissile", 0.0, 1,  0 +10, -4.0, 2,-1.5)
	ROKE HIJIHGFEDCBA 1
	Goto Ready
	AltFire:
	ROKE A 1 A_JumpIfInventory("PMissiles", 1, "Continue")
	Goto Ready
	Continue:
	TNT1 A 0 A_JumpIfInventory("UpgradeCount", 3, "FireStrongX")
	ROKE ABCDEFG 1	
	TNT1 A 0 A_GunFlash
	ROKE B 0 A_PlayWeaponSound("weapons/minimisfire")
	TNT1 A 0 A_giveInventory("ProtectorDashEnergy", 5)
	TNT1 A 0 A_TakeInventory("PMissiles", 1)
	ROKG H 0 A_FireCustomMissile("MinMissileX", 1.25, 1, 10, 0.0)
	ROKE HIJEDCBA 2
	Goto Ready
  FireStrongX:
	ROKE ABCDEFG 1	
	TNT1 A 0 A_GunFlash
	ROKE B 0 A_PlayWeaponSound("weapons/minimisfire")
	TNT1 A 0 A_giveInventory("ProtectorDashEnergy", 5)
	TNT1 A 0 A_TakeInventory("PMissiles", 1)
	ROKG H 0 A_FireCustomMissile("MinMissileX", 1.25, 1, 10, 0.0)
	ROKE HIJEDCBA 1
	Goto Ready
	Flash:
		TNT1 A 6
	Stop
  }
}

ACTOR MinMissile
{
  Speed 45
  Radius 4
  Height 8
  Damage (12)
  Scale 0.8
  Projectile
  SeeSound "weapons/minimisfir"
  DeathSound "weapons/minimishit"
  DamageType "ProtectorMissile"
  Obituary "%o was eradicated by %k's mini-missiles."
  States
  {
  Spawn:
		RCKT A 0
		RCKT A 0 A_PlaySound("weapons/rocketfly", CHAN_VOICE, 0.5, 1)
    Fly:
		RCKT AAABBBCCC 1 Bright A_SpawnItemEx("RocketSmoke",0,0,0,0,0,0,0,SXF_CLIENTSIDE,0)
		Goto Fly		
  Death:
		SMIS A 0 Bright A_SetTranslucent(1.0,1)
		SMIS A 0 Bright A_StopSound(CHAN_VOICE)
		SMIS A 2 Bright A_Explode(12,80,0,0,64)
		SMIS BCDEFGHIJ 2 Bright
		Stop
  }
}

Actor MinMissileX : MinMissile {
    Speed 56
}

ACTOR RocketSmoke
{
	+NOBLOCKMAP
	+NOGRAVITY
	RenderStyle Add
	Alpha 0.33
	Scale 0.35
	VSpeed 1
	Mass 5
	States
	{
	Spawn:
	Melee:
		RSMK C 0 
		RSMK C 0 A_Jump(128,"Puff2")
		RSMK CDE 1 Bright
		SSMK DEFGHIJKLM 1
		Stop
	Puff2:
		RSMK HIJ 1 Bright
		SSMK QRSTUVWXYZ 1
		Stop
	}
}

actor PMissiles : Ammo
{
  Inventory.PickupMessage ""
  Inventory.Amount 1
  Inventory.MaxAmount 80
  Inventory.Icon "PMSLA0"
  +IGNORESKILL
  States
  {
  Spawn:
    PMSL A -1
    loop
  }
}

actor GreenProjectile : FastProjectile
{
  Radius 4
  Height 10
  Speed 65
  Damage (random(8,11))
  DamageType "ProtectorPlasma"
  MissileType "LaserTrailSpawner"
  Projectile
  RenderStyle Add
  Alpha 1.0
  Scale 1.0
  SeeSound ""
  Obituary "%o was overcharged by %k."
  States
  {
  Spawn:
	LASP A -1 Bright
	Stop
  Death:
    BIOB A 0 A_PlaySound("Weapons/ShockHit")
	BIOB A 0 A_SpawnItemEx("GreenProjFlash2")
	BIOB A 0 Bright A_Explode(11, 70, 0,0)
    BIOB CFCFCF 3
	BIOB ED 5
    stop
  }
}

Actor GreenProjectileXX : GreenProjectile
{
  Damage (10)
  Scale 1.175
  Radius 6
  Height 16
  States
  {
  Spawn:
    LASP A -1 bright A_SpawnItem("GreenProjTrail")
  }
}

ACTOR LaserTrailSpawner
{
	+NOBLOCKMAP
	+NOGRAVITY
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1 A_SpawnItemEx("GreenProjTrail",0,0,8,0,0,0,0,SXF_CLIENTSIDE,0)
		Stop
	}
}

actor GreenProjTrail
{
  +NOBLOCKMAP
  +NOGRAVITY
  RenderStyle Add
  Alpha 1.0
  Scale 1.0
  Mass 5
  States
  {
  Spawn:
    LASP A 3 Bright
    stop
  }
}


actor GreenProjFlash
{
	Radius 8
	Height 8
	Scale 0.5
	+NOGRAVITY
	States
	{
		Spawn:
		TNT1 A 3
		Stop
	}
}

actor GreenProjFlash2 : GreenProjFlash
{
	States
	{
		Spawn:
		TNT1 A 4
		Stop
	}
}

actor GreenProjSmoke
{
	Projectile
	Damage (1)
	DamageType "ProtectorPlasma"
	+RIPPER
	+BLOODLESSIMPACT
	Radius 5
	Height 10
	Speed 38
	Scale 0.58
	Alpha 0.9
	Renderstyle Add
	Obituary "%o was overcharged by %k."
	
	States
	{
		Spawn:
			GSMX AAA 1 Bright A_FadeOut(0.075)
			TNT1 A 0 A_Jump(128, "Set2")
			GSMX B 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX B 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX B 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX D 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX D 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX D 2 Bright A_FadeOut(0.075)
		Stop
		Set2:
			GSMX C 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX C 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX C 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX E 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX E 2 Bright A_FadeOut(0.075)
			TNT1 A 0 A_ScaleVelocity(0.875)
			GSMX E 2 Bright A_FadeOut(0.075)
		Stop
	}
}

Actor GreenProjSmoke2 : GreenProjSmoke
{
	Damage (2)
}

actor ShockCell : Ammo
{
  Inventory.PickupMessage "You got ammo for the shock rifle!"
  Inventory.Amount 1
  Inventory.MaxAmount 80
  Inventory.Icon "GAMMA0"
  +IGNORESKILL
  States
  {
  Spawn:
    RIAA A -1
    loop
  }
}

actor ProtectorShockRifle : Weapon
{
  Weapon.AmmoUse1 2
  Weapon.AmmoGive1 60
  Weapon.AmmoType1 "ShockCell"
  Weapon.AmmoType2 "ProtectorDashEnergy"
  inventory.icon "PROTSHK"
  weapon.selectionorder 400
  weapon.slotnumber 1
  Inventory.PickupMessage "You got the Shock Rifle"
  Attacksound ""
  +WEAPON.NOAUTOAIM
  States
  {
  Ready:
	LSSE O 0 A_PlayWeaponSound("Weapons/Shockidle")
    LSSE ONMLKJAI 3 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("ShockCell", 0, "Ready")
	TNT1 A 0 ACS_executeAlways(996, 0, 1)
    Loop
  Deselect:
    LSSE O 1 A_Lower
	TNT1 A 0 A_Lower
    Loop
  Select:
    TNT1 A 0 A_TakeInventory("ProtectorCantDash", 1)
    TNT1 A 0 ACS_ExecuteAlways(700, 0, WM_PROTSR)
  SelectLoop:
    LSSE O 1 A_Raise
	TNT1 A 0 A_Raise
   Loop
  Fire:
    LSSE A 1
	LSSE B 2
	LSSE B 0 A_PlaySound("Weapons/ShockFire")
	LSSE B 0 A_SpawnItemEx("GreenProjFlash")
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_jumpIfInventory("UpgradeCount", 2, "FireStrong")
	TNT1 A 0 A_FireCustoMMISsile("GreenProjSmoke", 0, 0, 10)
	TNT1 A 0 A_FireCustoMMISsile("GreenProjectile", 0, 1, 10, 0, 0,0)
	LSSE C 2 Bright
	LSSE C 0 A_SpawnItemEx("GreenProjFlash")
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_giveInventory("ProtectorDashEnergy", 5)
	LSSE D 2
	LSSE FGHI 1
	Goto Ready
  FireStrong:
	TNT1 A 0 A_FireCustoMMISsile("GreenProjSmoke2", 0, 0, 10)
	TNT1 A 0 A_FireCustoMMISsile("GreenProjectileXX", 0, 1, 10, 0, 0,0)
	LSSE C 1 Bright
	LSSE C 0 A_SpawnItemEx("GreenProjFlash")
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_giveInventory("ProtectorDashEnergy", 5)
	LSSE D 1
	LSSE FGHI 1
	Goto Ready
	Flash:
		TNT1 A 6
	Stop	
  Spawn:
    BGUN A -1
    Stop
  }
}

actor LightningCell : Ammo
{
  Inventory.PickupMessage "You got ammo for the railgun!"
  Inventory.Amount 25
  Inventory.MaxAmount 25
  Inventory.Icon "LGCEA0"
  +IGNORESKILL
  States
  {
  Spawn:
    LGCE A -1
    loop
  }
}

Actor ProtectorDashing : CustomInventory {
    inventory.maxamount 1
	+AUTOACTIVATE
	+ALWAYSPICKUP
	
	States {
	    Pickup:
			TNT1 A 0 SetPlayerProperty(0, 1, 0)
			TNT1 A 0 ACS_ExecuteAlways(991, 0, 1)
			TNT1 A 0 A_GiveInventory("ProtectorDashCooldown", 1)
			TNT1 A 0 A_giveInventory("ProtectorFakeSpeed", 1)
			TNT1 A 0 A_TakeInventory("ProtectorDashEnergy", 20)
		Stop
	}
}

actor LightningRing
{
  Radius 4
  Height 4
  DamageType "ProtectorLightning"
  +NOGRAVITY
  +NOBLOCKMAP
  RenderStyle Add
  Obituary "%o saw the light that %k sent."
  Alpha 0.75
  States
  {
  Spawn:
  Death:
    TNT1 A 0
    LGUT ABCDEFGHIJKLMNOP 1 bright A_Explode(random(4,5), 48, 0)
    stop
  }
}

actor LightningTrail
{
  Speed 80
  Damage (1)
  Radius 4
  Height 4
  Projectile
  DamageType "ProtectorLightning"
  Obituary "%o saw the light that %k sent."
  BounceCount 4
  +DOOMBOUNCE
  +RIPPER
  +THRUSPECIES
  Species "Human"
  States
  {
  Spawn:
    TNT1 A 1 A_SpawnItem("LightningRing",0,-15,0)
    loop
  Death:
    TNT1 A 1
    stop
  }
}

Actor LightningTrailX : LightningTrail
{
	Damage 1
	BounceCount 5
  States
  {
  Spawn:
    TNT1 A 1 A_SpawnItem("LightningRingX",0,-15,0)
    loop
  }	
}

Actor LightningRingX : LightningRing
{
  States
  {
  Spawn:
  Death:
    TNT1 A 0
    LGUT ABCDEFGHIJKLMNOP 1 bright A_Explode(random(7,8), 48, 0)
    stop
  }
}

Actor LightningGunPuff : BulletPuff
{	
	Obituary "%o saw the light that %k sent."
	DamageType "ProtectorLightning"
	States
	{
	  Spawn:
		TNT1 A 1
		Goto Melee
	  Melee:
		TNT1 A 1
		Stop
	}
}

actor ProtectorLightningGun : Weapon
{
  Scale 0.6
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 1
  Weapon.AmmoType1 "LightningCell"
  Weapon.AmmoType2 "ProtectorDashEnergy"
  inventory.icon "PROTLGUN"
  weapon.selectionorder 450
  weapon.slotnumber 3
  Inventory.PickupMessage "You got the Lightning Gun"
  Attacksound ""
  +WEAPON.NOAUTOAIM
  +WEAPON.DONTBOB
  States
  {
  Ready:
    ROIL A 0 A_PlayWeaponSound("Railgun/Idle")
    ROIL ABCDEABCDEABCDE 4 A_WeaponReady	
	TNT1 A 0 A_JumpIfInventory("LightningCell", 5, "Ready")
	TNT1 A 0 ACS_executeAlways(996, 0, 3)	
    Loop
  Deselect:
    ROIL A 1 A_Lower
	TNT1 A 0 A_Lower
    Loop
  Select:
    TNT1 A 0 A_GiveInventory("ProtectorCantDash", 1)
    TNT1 A 0 ACS_ExecuteAlways(700, 0, WM_PROTLG)
  SelectLoop:
    ROIL A 1 A_Raise
	TNT1 A 0 A_Raise
    Loop
  Fire:
    ROIL ABCDE 2 Bright
    TNT1 A 0 A_PlayWeaponSound("Weapons/LGunStart")
	ROIL E 0 A_SpawnItemEx("LGunFlash")
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_giveInventory("ProtectorDashEnergy", 20)
	TNT1 A 0 A_JumpIfInventory("UpgradeCount", 3, "FireStrong")
	ROIL A 0 A_FireCustoMMISsile("LightningTrail", 0, 1)
  ContinueF:
	TNT1 A 0 A_PlaySoundEx("weapons/lgunfire", 6)
	ROIL F 1 Bright
	ROIL G 1 Bright
	ROIL H 1 Bright
	ROIL I 2 Bright
	ROIL J 2 Bright
	ROIL K 2 Bright
	ROIL GFEDCB 2 Bright
	ROIL A 10
    Goto Ready
  FireStrong:
    TNT1 A 0 A_PlayWeaponSound("Railbonus")
    LGGN A 0 A_FireCustoMMISsile("LightningTrailX", 0, 2)
	TNT1 A 0 A_RailAttack(15, 1, 0, "DeepSkyBlue", "SkyBlue", 0, 0, "LightningGunPuff")
    Goto ContinueF
	Flash:
		TNT1 A 6
	Stop		
  Spawn:
    BGUN A -1
    Stop
  }
}

actor LGunFlash
{
	Radius 8
	Height 8
	Scale 0.5
	+NOGRAVITY
	States
	{
		Spawn:
		TNT1 A 4
		Stop
	}
}

Actor IAMPROTECTOR : Inventory
{
	inventory.maxamount 1
}

Actor DashEffectSpawnerStart : CustomInventory
{
	inventory.maxamount 100
	+AUTOACTIVATE
	
	States
	{
		Pickup:
		Use:
			TNT1 A 0 A_SpawnItem("DashEffectStart", 0, 32)
		Stop
	}
}

Actor DashEffectSpawnerEnd : DashEffectSpawnerStart
{
	States
	{
		Pickup:
		Use:
			TNT1 A 0 A_SpawnItem("DashEffectEnd", 0, 32)
		Stop
	}
}

Actor DashDamageSpawner : DashEffectSpawnerStart
{
	States
	{
		Pickup:
		Use:
			TNT1 A 0 A_SpawnItem("DashDamager", 0, 16)
		Stop
	}
}

Actor DashSparkleSpawner : DashEffectSpawnerStart
{
	States
	{
		Pickup:
		Use:
			TNT1 A 0 A_SpawnItem("DashSparkles", 0, 0)
		Stop
	}
}

Actor DashSparkles
{
	PROJECTILE
	Height 1
	Radius 1
	+RIPPER
	+BLOODLESSIMPACT
	
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("PulseSparkle", 0, 0, 32, random(-8,8), random(-8,8), random(-8,8), 0, 32, 0)
		Stop
	}
}

Actor DashDamager
{
	Obituary "%o couldn't keep up with %k dashing around."
	PROJECTILE
	DamageType "ProtectorDash"
	+RIPPER
	States
	{
		Spawn:
			TNT1 A 0
		Goto Death
		Death:
			TNT1 A 1 A_Explode(30, 96, 0)
			TNT1 A 1
		Stop
	}
}

Actor DashEffectStart
{
	PROJECTILE
	Height 1
	Radius 1
	+RIPPER
	+BLOODLESSIMPACT
	Alpha 0.2
	Renderstyle add
	
	States
	{
		Spawn:
			TNT1 AA 0 A_PlaySound("Protector/DashStart")
			NB03 DDDDDDD 1 Bright A_FadeIn(0.1)
			NB03 DDDDDDD 1 Bright A_FadeOut(0.1)
		Stop
	}
}

Actor DashEffectEnd : DashEffectStart
{
	States
	{
		Spawn:
			TNT1 AA 0 A_PlaySound("Protector/DashEnd")
			NB03 DDDDDDD 1 Bright A_FadeIn(0.1)
			NB03 DDDDDDD 1 Bright A_FadeOut(0.1)
		Stop
	}
}

Actor ProtectorCantDash : Inventory {
    inventory.maxamount 1
}