ACTOR CursedRifle : "Legendary Plasmatic Rifle"
{
Weapon.AmmoUse 0
Weapon.AmmoType "CRDemonMagazine"   
Weapon.AmmoType2 "CRDemonAmmo"
Inventory.PickupSound "CursedRifle/up"
Inventory.PickupMessage "You got the Cursed Rifle! Is this an out of season april fools joke?"
Tag "Cursed Rifle"
States
{
  Spawn:
	CTEP A -1
	Loop
  Ready:
	TNT1 A 0 A_PlaySound("CursedRifle/up")
	CTRS ABCDE 1
  ReadyLoop:
	TNT1 A 0 A_JumpIfInventory("CRDemonMagazine",1,2)
	TNT1 A 0
	Goto NoBuzzing
	CTEK AAA 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK AAA 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK AAA 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK AAA 1 A_WeaponReady	 
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK AAA 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK AAA 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK AAA 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK AAA 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK AAA 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK 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")
	CTEK BB 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK BB 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK CC 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK CC 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK DD 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK DD 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK EE 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK EE 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	Goto ReadyLoop
  NoBuzzing:
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	CTEK A 1 A_WeaponReady
	Loop
  Deselect:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	TNT1 A 0 A_Lower
	CTEK A 1 A_Lower
	Goto Deselect+1
  Select:
	TNT1 A 0
	TNT1 A 0 A_Raise
	Wait
  Fire:
	TNT1 A 0 A_JumpIfInventory("CRDemonMagazine",2,1)
	Goto Empty
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(4,2,0,1,0)
	TNT1 A 0 A_Light1
	TNT1 A 0 A_PlayWeaponSound("CursedRifle/Fire")
	TNT1 A 0 A_TakeInventory("CRDemonMagazine",2)
	CTKF A 2 Bright A_FireCustomMissile("CursedRifleShotPlayer",Random(100,-100)/100.00,1,0,0,0,Random(100,-100)/100.00)
	CTKF B 2 Bright A_Light2
	CTKF C 2 A_Light0
	TNT1 A 0 A_ReFire
	Goto ReadyLoop
  Empty:
	TNT1 A 0 A_PlaySound("weapons/click2")
	CTEK AAAAAAAAAA 1 A_WeaponReady(WRF_NOFIRE)
  AltFire:
	TNT1 A 0 A_JumpIfInventory("CRDemonMagazine",100,2)
	TNT1 A 0 A_JumpIfInventory("CRDemonAmmo",1,2)
	TNT1 A 0
	Goto ReadyLoop
	CTKR AB 2
	CTKR C 3
	CTKR D 4 A_PlaySound("weapons/demontecheject")
	TNT1 A 0 Radius_Quake(2,2,0,1,0)
	CTKR E 2 A_PlaySound("weapons/demontechsteam")
	CTKR F 2 Radius_Quake(2,2,0,1,0)
	CTKR GHI 2 Radius_Quake(2,2,0,1,0)
	CTKR J 3 A_FireCustomMissile("LDemonTechEmptyMag", 0, 0, 0, 1)
	CTKR K 15 
	CTKR LMN 2
	TNT1 A 0 A_JumpIfInventory("CRDemonAmmo",1,"Reload")	 
	CTKR O 6 A_PlayWeaponSound("weapons/demontechload")
	CTKR O 4 A_PlayWeaponSound("weapons/demontechclick")
	CTKR CB 3
	CTKR A 2
	Goto ReadyLoop
  Reload:
	TNT1 A 0 A_TakeInventory("CRDemonAmmo",1)
	TNT1 A 0 A_GiveInventory("CRDemonMagazine",1)
	TNT1 A 0 A_JumpIfInventory("CRDemonMagazine",100,"Full")
	TNT1 A 0 A_JumpIfInventory("CRDemonAmmo",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") 
	CTRS EDCBA 1
	TNT1 A 6
	HGRN ABCDEFGHI 1
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadepin")
	HGRN JKLM 2
	TNT1 A 11
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1,TIF_NOTAKEINFINITE)
	HGRN N 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
	HGRN OPQRS 1
	HGRN TU 2
	TNT1 A 6 A_TakeInventory("HandGrenadeAction",1)
	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") 
	CTRS EDCBA 1
	TNT1 A 8
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	MINE ABCDEF 1
	TNT1 A 0 A_TakeInventory("MineAmmo",1,TIF_NOTAKEINFINITE)
	MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0,false)
	MINE HI 1
	MINE JKLM 1
	TNT1 A 5 A_TakeInventory("MineAction",1)
	Goto Ready+1 
	}
}

ACTOR CRDemonMagazine : Ammo 
{
+IGNORESKILL
Inventory.Amount 0
Inventory.MaxAmount 100
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 100
Inventory.Icon "CTEPA0"
}

ACTOR CRDemonAmmo : Ammo
{
Scale 0.65
+NOTIMEFREEZE
Inventory.Amount 50
Inventory.MaxAmount 250
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 500
Inventory.Icon "CAMGA0"
Inventory.PickupSound "items/legendaryammo"
Inventory.PickupMessage "Cursed Energy Cells Obtained"
States
	{
	Spawn:
		CAMG A -1
		Stop
	}
}

ACTOR CRDemonAmmoBox : CRDemonAmmo
{
Scale 0.65
Inventory.Amount 100
Inventory.PickupMessage "Cursed Nemesis Energy Cells Obtained"
Inventory.PickupSound "items/legendaryammopack"
+NOTIMEFREEZE
States
	{
	Spawn:
		CAMZ A -1
		Stop
	}
}

ACTOR CursedRifleShotPlayer : CursedRifleShot
{
+THRUSPECIES
+FOILINVUL
Species "Player"
DamageType "Cursed"
}