ACTOR CursedBFG10K : Weapon
{	
//$Category Weapons/BFG20K
//$Sprite CBGK0
//$Title "CursedBFG10K"
Scale 0.85
  Height 20
  Weapon.PreferredSkin "BFG10K-Marine"
  Weapon.SelectionOrder 2790
  Weapon.AmmoType "CRDemonAmmo"
  Weapon.AmmoUse 5
  Weapon.AmmoGive 40
  Inventory.PickupMessage "You claim the Cursed BFG10K, forged in the abyss."
  Inventory.PickupSound "weapons/pickup15k"
  Obituary "%o was blasted to a crisp by %k's BFG10K."
  +WEAPON.NOAUTOFIRE
  +INVENTORY.UNDROPPABLE
States
  {
  Spawn:
    CFG2 A -1
    Stop
  Ready:
    TNT1 A 0 A_JumpIfNoAmmo("Ready2")
    TNT1 A 0 A_PlayWeaponSound("weapons/bfg15kidle")
    CG2G AAA 1 A_WeaponReady
    CG2G BBB 1 A_WeaponReady
    CG2G CCC 1 A_WeaponReady
    CG2G DDD 1 A_WeaponReady
    Loop
  Ready2:
    TNT1 A 0 A_JumpIfInventory("NewCell",5,"Ready")
    CGE2 A 1 A_WeaponReady
	Loop
  Deselect:
  	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0 A_TakeInventory("RailgunAction",1)
    TNT1 A 0 A_JumpIfNoAmmo("Deselect2")
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	CG2G A 1 A_Lower
    Goto Deselect+5	
  Deselect2:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	CGE2 A 1 A_Lower
    Goto Deselect2+1		
  Select:
    TNT1 A 0 A_JumpIfNoAmmo("Select2")
    TNT1 A 0 A_Playsound("weapons/pickup15k")
    CG2G A 1 A_Raise
    Goto Select+2
  Select2:
    TNT1 A 0 A_PlayWeaponSound("weapons/pickup15k")
    CGE2 A 1 A_Raise
    Goto Select2+1	
  Fire:
    TNT1 A 0 A_PlaySound("weapons/charge15k")
    CG2G FGHIJ 6 Bright
  FireLoop:
    CG2G K 1 Bright
	TNT1 A 0 A_PlaySound("weapons/bfg15kfire")
	TNT1 A 0 A_FireCustomMissile("CursedPlayer10KProjectile",Random(100,-100)/100.00,1,0,0,0,Random(100,-100)/100.00)
	TNT1 A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(6,3,0,1,0)
    CG2G LMNO 1
    TNT1 A 0 A_ReFire("FireLoop")
	CG2G O 35 A_PlaySound("weapons/bfg15kcooldown")
	Goto Ready
  Flash:
    TNT1 A 2 Bright A_Light1
    TNT1 A 2 Bright A_Light2
	TNT1 A 2 Bright A_Light1
    Goto LightDone
	stop
   }
}

ACTOR CursedPlayer10KProjectile : 10KProjectile
{
  +NOTIMEFREEZE
  DECAL "Scorch"
  States
  {
  Spawn:
	TRA2 A 1 Bright
	Loop
  Death:
  XDeath:  
	TNT1 A 0
	TNT1 A 1 A_SpawnItem("CursedPlayer10KEx")
	Stop
	}
}

ACTOR CursedPlayer10KEx : Player10KEx
{
  +NOTIMEFREEZE
  +FOILINVUL
  Damagetype "Cursed"
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("CursedBFGShockwave", 0, 0, 0, 0, 0, 0, 0, 128)
	TNT1 AA 0 A_SpawnItemEx("PurpleParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
	TNT1 AAA 0 A_CustomMissile("CursedKaboom2", 0, 0, random(0,360), 2, random(0,360))
	6FE3 A 4 Bright A_Explode(180,180,0)
	6FE3 BCDEF 4 Bright
    Stop
   }
}
