ACTOR CorruptedPlasmaticRifle : Weapon
{
//Creator: Makarov
//Sprite: CTRSA0
//Title: "Corrupted Plasmatic Rifle"
   Height 14
   Weapon.PreferredSkin "DTechRifle-Marine"
   Weapon.SelectionOrder 7980
   Weapon.KickBack 60
   Weapon.AmmoUse 0
   Weapon.AmmoGive 100
   Scale 0.95
   Weapon.AmmoType "CTDemonMagazine"   
   Weapon.AmmoType2 "CTDemonAmmo"
   Inventory.PickupMessage "Corrupted Rifle Obtained, you'll never need another gun again."
   Inventory.PickupSound "PlasmaRepeater/Pickup"
   Obituary "%o was obliterated by a soldier wielding a Corrupted Rifle."
   +WEAPON.AMMO_OPTIONAL
   +WEAPON.NOALERT
   -INVENTORY.UNDROPPABLE
   States
   {
   Ready:
     TNT1 A 0 A_PlaySound("PlasmaRepeater/Pickup")
	 CPRS ABCDE 1
   ReadyLoop:
     TNT1 A 0 A_JumpIfInventory("LDemonMagazine",1,2)
	 TNT1 A 0
	 Goto NoBuzzing
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady	 
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK AAA 1 A_WeaponReady
	 TNT1 A 0 A_PlaySound("weapons/legrifidle")
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK BB 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK BB 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK CC 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK CC 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK DD 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK DD 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK EE 1 A_WeaponReady
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	 CPEK EE 1 A_WeaponReady
     Goto ReadyLoop
   NoBuzzing:
     TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
     CPEK A 1 A_WeaponReady
	 Loop
   Deselect:
     TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	 CPEK A 1 A_Lower
     Goto Deselect+2
   Select:
     TNT1 A 0
	 TNT1 A 0 A_Raise
	 Wait
   Fire:
     TNT1 A 0 A_JumpIfInventory("CTDemonMagazine",2,1)
	 Goto Empty
	 TNT1 A 0 Bright A_AlertMonsters
     TNT1 A 0 Bright A_GunFlash
	 TNT1 A 0 Bright Radius_Quake(4,2,0,1,0)
     TNT1 A 0 Bright A_Light1
	 TNT1 A 0 Bright A_PlayWeaponSound("CorruptedProjectile/Fire")
     CPRF A 1 Bright A_FireCustomMissile("PlayerCorruptedProjectile",Random(100,-100)/100.00,1,0,0,0,Random(100,-100)/100.00)
	 CPRF B 1 Bright A_Light2
	 TNT1 A 0 A_TakeInventory("CTDemonMagazine",2)
     CPRF C 2 A_Light0
     TNT1 A 0 A_ReFire
     Goto ReadyLoop
   Empty:
     CPEK A 10 A_PlaySound("weapons/click2")	 
   AltFire:
  	 TNT1 A 0 A_JumpIfInventory("CTDemonMagazine",50,2)
     TNT1 A 0 A_JumpIfInventory("CTDemonAmmo",1,2)
	 TNT1 A 0
	 Goto ReadyLoop
     CPRR AB 2
	 CPRR C 3
	 CPRR D 4 A_PlaySound("weapons/demontecheject")
	 TNT1 A 0 Radius_Quake(2,2,0,1,0)
	 CPRR E 2 A_PlaySound("weapons/demontechsteam")
	 CPRR F 2 Radius_Quake(2,2,0,1,0)
	 CPRR GHI 2 Radius_Quake(2,2,0,1,0)
	 CPRR J 3 A_FireCustomMissile("CTDemonTechEmptyMag", 0, 0, 0, 1)
	 CPRR K 15 
	 CPRR LMN 2
	 TNT1 A 0 A_JumpIfInventory("CTDemonAmmo",1,"Reload")	 
     CPRR O 6 A_PlayWeaponSound("weapons/demontechload")
     CPRR O 4 A_PlayWeaponSound("weapons/demontechclick")
     CPRR CB 3
	 CPRR A 2
	 Goto ReadyLoop
   Reload:
	 TNT1 A 0 A_TakeInventory("CTDemonAmmo",1)
	 TNT1 A 0 A_GiveInventory("CTDemonMagazine",1)
	 TNT1 A 0 A_JumpIfInventory("CTDemonMagazine",50,"Full")
	 TNT1 A 0 A_JumpIfInventory("CTDemonAmmo",1,"Reload")
	 Goto AltFire+19
   Full:
     TNT1 A 0
	 Goto AltFire+19
   GrenadeCheck:
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,"GrenadeToss")
	 TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	 Goto Ready+6
   GrenadeToss:
  	 TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	 CPRS EDCBA 1
	 TNT1 A 6
	 HGRN ABC 1
	 HGRN D 3
	 HGRN EFGHI 2
	 TNT1 A 14 A_PlayWeaponSound("weapons/hgrenadepin")
	 TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	 TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1)
	 HGRN J 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
	 HGRN K 1
	 HGRN LMNO 2
	 TNT1 A 6
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,2)
     TNT1 A 0 A_TakeInventory("Hand Grenade",1)
	 TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	 TNT1 A 0
	 Goto Ready+1
   MineCheck:
	 TNT1 A 0 A_JumpIfInventory("MineAmmo",1,"MineToss")
	 TNT1 A 0 A_TakeInventory("MineAction",1)
	 Goto Ready+6
   MineToss:
  	 TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	 CPRS EDCBA 1
	 TNT1 A 10
	 TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	 MINE ABCDEF 1		
	 TNT1 A 0 A_TakeInventory("MineAmmo",1)	  
	 MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0)
	 MINE HI 1
	 MINE JK 2
	 TNT1 A 0 A_JumpIfInventory("MineAmmo",1,2)
     TNT1 A 0 A_TakeInventory("Land Mine",1)
	 TNT1 A 0 A_TakeInventory("MineAction",1)
	 TNT1 A 0
	 TNT1 A 5
	 Goto Ready+1 
  Spawn:
     CPEP A -1
     Stop
     }
}

ACTOR CTDemonMagazine : Ammo 
{
Inventory.Amount 0
Inventory.MaxAmount 50
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 50
Inventory.Icon "CPEPA0"
+IGNORESKILL
}

ACTOR CTDemonAmmo : Ammo
{
//$Category Infinity GODS
//$Sprite CPMGA0
//$Title "Corrupted Demon Ammo"
Scale 0.65
Inventory.PickupMessage "Corrupted Plasmatic Energy Cells Obtained"
Inventory.PickupSound "items/legendaryammo"
Inventory.Amount 50
Inventory.MaxAmount 250
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 500
Inventory.Icon "CPMGA0"
+NOTIMEFREEZE
States
{
Spawn:
	CPMG A -1
    Stop
    }
}

ACTOR CTDemonAmmoBox : CTDemonAmmo
{
//$Category Infinity GODS
//$Sprite CPMOA0
//$Title "Corrupted Box of Demon Ammo"
Scale 0.65
Inventory.Amount 50
Inventory.PickupMessage "Charged Corrupted Plasmatic Energy Cells Obtained"
Inventory.PickupSound "items/legendaryammopack"
+NOTIMEFREEZE
States
{
Spawn:
	CPMO A -1
	Stop
	}
}
