// Plasma Gun (Doom)

ACTOR IDMPlasmaGun : IDMWeapon
{
  Weapon.SelectionOrder 400
  Weapon.Sisterweapon "PlasmaGunLevel2"
  Weapon.AmmoUse 1
  Weapon.AmmoGive 40
  Weapon.AmmoType "IDMCell"
  //Weapon.PreferredSkin "PlasmaGunMarine"
  Inventory.PickupMessage "Plasma Gun! (Slot 6)"
  Tag "Plasma Gun"
  +WEAPON.NOLMS
  States
  {
  Ready:
    PLSG A 1 A_WeaponReady
    Loop
  Deselect:
    TNT1 A 0 A_Lower
    TNT1 A 0 A_Lower
    PLSG A 1 A_Lower
    Loop
  Select:
	TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
  Sloop:
    TNT1 A 0 A_Raise
    TNT1 A 0 A_Raise
    PLSG A 1 A_Raise
    Loop
  Fire:
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
  Normal:
    PLSG A 3 A_FireCustomMissile("IDMPlasmaBall",0,1)
    TNT1 A 0 A_ReFire
	TNT1 A 0 A_GunFlash("Flash2")
    PLSG B 20
    Goto Ready
  Quad:
	TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	PLSG A 3 A_FireCustomMissile("ExtremePlasmaBall",0,1)
    TNT1 A 0 A_ReFire
	TNT1 A 0 A_GunFlash("Flash2")
    PLSG B 20
    Goto Ready
  Flash:
    PLSF A 1 Bright A_Light1
    PLSF B 1 Bright A_Light1
	PLSG A 1 Bright A_Light1
    PLSF A 1 Bright A_Light1
    Goto LightDone
  Flash2:
    PLSG B 5 Bright
	Goto LightDone
  Spawn:
    PLAS A -1 Bright
    Stop
  }
}

ACTOR PlasmaGunLevel2 : IDMPlasmaGun
{
  Weapon.Sisterweapon "IDMPlasmaGun"
  Weapon.AmmoUse 1
  +POWERED_UP
  +NOAUTOAIM
  States
  {
  Fire:
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
  Normal:
    PLSG A 3 A_FireCustomMissile("IDMPlasmaBall2",0,1)
    TNT1 A 0 A_ReFire
	TNT1 A 0 A_GunFlash("Flash2")
    PLSG B 20
    Goto Ready
  Quad:
	TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	PLSG A 3 A_FireCustomMissile("ExtremePlasmaBall2",0,1)
    TNT1 A 0 A_ReFire
	TNT1 A 0 A_GunFlash("Flash2")
    PLSG B 20
    Goto Ready
  }
}

// Plasma Gun's Plasma

ACTOR IDMPlasmaBall : PlasmaBall replaces PlasmaBall
{
  Speed 50
  Damage (10 * random(1,10))
  +RANDOMIZE
  -NOTELEPORT
  +SKYEXPLODE
  Alpha 1
  Obituary "%o was melted by %k's Plasma Gun."
  SelfObituary "%o discovers plasma splash damage."
  Seesound "weapons/plasmaf"
  DamageType "Plasma"
  Decal Plasmascorchlower
  Decal Plasmascorch
  States
  {
  Spawn:
    PLSS AB 4 Bright
    Loop
  Death:
	TNT1 A 0
	PLSE A 0 A_Explode(random(1,5),64,1,1,64)
	PLSE A 4 Bright A_Playsound("weapons/plasmax",0,0.25)
	PLSE BCDE 3 Bright
	Stop
  XDeath:
	PLSE A 4 Bright A_Playsound("weapons/plasmax",0,0.25)
	PLSE BCDE 3 Bright
    Stop
  }
}

ACTOR ExtremePlasmaBall : IDMPlasmaBall
{
	+EXTREMEDEATH
	States
	{
	XDeath:
		TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
		PLSE A 4 Bright A_Playsound("weapons/plasmax",0,0.25)
		PLSE BCDE 3 Bright
		Goto Death
	}
}

ACTOR IDMPlasmaBall2 : IDMPlasmaBall
{
  Speed 35
  Damage (5 * random(1,30))
  RenderStyle Add
  ProjectileKickBack 200
  Decal Plasmascorchlower
  Seesound "weapons/plasma2f"
  Deathsound "weapons/plasma2x"
  MaxTargetRange 1
  +SEEKERMISSILE
  +DONTSEEKINVISIBLE
  States
  {
  Spawn:
    BAL8 AAAABBBB 1 Bright A_SeekerMissile(0,4.25,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,255,1)
    Loop
  XDeath:
  Death:
	TNT1 A 0
    TNT1 A 0 A_Explode(random(1,5) * 5,64,1,1,64)
    BAL8 C 4 Bright A_Playsound("weapons/plasma2x",0,0.25)
    BAL8 DE 3 Bright
    Stop
  }
}

ACTOR ExtremePlasmaBall2 : IDMPlasmaBall2
{
	ProjectileKickback 400
	+EXTREMEDEATH
	States
	{
	XDeath:
		TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
		Goto Death
	}
}
