// Unmaker

ACTOR Unmaker : IDMWeapon
{
  Weapon.SelectionOrder 50
  Weapon.AmmoUse 5
  Weapon.AmmoGive 100
  Weapon.AmmoType "IDMCell"
  //Weapon.PreferredSkin "UnmakerMarine"
  Inventory.PickupMessage "Unmaker! (Slot 7)"
  Tag "Unmaker"
  +WEAPON.NOAUTOAIM
  +WEAPON.BFG
  +WEAPON.NOLMS
  States
  {
  Ready:
	TNT1 A 0
	TNT1 A 0 A_Jump(1,"Idle")
	UNMK AAAAAA 1 A_WeaponReady
    Loop
  Idle:
	TNT1 A 0 A_Playsound("weapons/unmakeridle",CHAN_WEAPON)
	Goto Ready+2
  Deselect:
    UNMK A 1 A_Lower
    Loop
  Select:
	TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
  Sloop:
    UNMK A 1 A_Raise
    Loop
  Fire:
	UNMK B 18 Bright A_Playsound("weapons/unmakerchrg",CHAN_AUTO)
	TNT1 A 0 A_Gunflash
	UNMK CD 3 Bright
	TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2",1,"Level2")
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
  Normal:
	TNT1 A 0 A_Playsound("weapons/unmakerfire",CHAN_WEAPON)
  Burst:
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	UNMK E 1 Bright A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_CheckForReload(5,"Burst")
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	UNMK F 1 Bright A_FireCustomMissile("UnmakerRay",frandom(-8,8),1,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	UNMK F 1 Bright A_FireCustomMissile("UnmakerRay",frandom(-8,8),1,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),1,0,random(-2,-3))
	UNMK F 1 Bright A_FireCustomMissile("UnmakerRay",frandom(-8,8),1,0,random(-2,-3))
	UNMK F 1 Bright
	UNMK G 3 Bright A_Playsound("weapons/unmakerscrm",CHAN_AUTO)
  FireEnd:
	UNMK B 6 Bright
	UNMK A 16
	TNT1 A 0 A_Refire
	Goto Ready
  Quad:
    TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO,1)
	Goto Normal
  Level2:
	TNT1 A 0 A_Playsound("weapons/unmakerfire",CHAN_WEAPON)
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"QuadLevel2")
  Level2Burst:
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	UNMK E 1 Bright A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_CheckForReload(8,"Level2Burst")
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	TNT1 A 0 A_FireCustomMissile("UnmakerRay",frandom(-8,8),0,0,random(-2,-3))
	UNMK F 2 Bright A_FireCustomMissile("UnmakerRay",frandom(-8,8),1,0,random(-2,-3))
	UNMK F 1 Bright A_Playsound("weapons/unmakerscrm",CHAN_AUTO)
	UNMK G 3 Bright
	UNMK B 5 Bright
	TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2",1,"Level2Refire")
	Goto FireEnd
  Level2Refire:
	TNT1 A 0 A_Refire("Level2")
	Goto FireEnd
  QuadLevel2:
    TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO,1)
    Goto Level2Burst
  Flash:
	TNT1 A 6 A_Light1
	TNT1 A 5 A_Light2
	TNT1 A 5 A_Light(3)
	TNT1 A 5 A_Light1
	Goto LightDone
  Spawn:
	UNMA A -1 Bright
	Stop
  }
}

// Unmaker Laser

ACTOR UnmakerRay : FastProjectile
{
  Radius 13
  Height 8
  Speed 500
  Damage (200*random(1,5))
  DamageType "RedPlasma"
  MissileType "UnmakerTrail"
  MissileHeight 7
  RenderStyle Add
  Alpha 0.75
  SeeSound "weapons/unmakerfly"
  DeathSound "weapons/unmakerhit"
  Obituary "%o was vaporized by %k's Unmaker."
  -NOTELEPORT
  +SKYEXPLODE
  +RIPPER
  +EXTREMEDEATH
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0
  SpawnLoop:
	IPLS ABABABABABABABABABABABABABABABABABA 1 Bright
	Stop
  Death:
	TNT1 A 0
	TNT1 A 0 A_Explode(100*random(1,10),64,0)
	IPLE ABCDE 4 Bright
	Stop
  }
}

ACTOR UnmakerTrail
{
  RenderStyle Translucent
  Alpha 0.75
  +NOBLOCKMAP
  +NOGRAVITY
  +SHADOW
  +CANNOTPUSH
  +NODAMAGETHRUST
  +CLIENTSIDEONLY
  States
  {
  Spawn:
    IPLS AAAAA 4 Bright A_Fadeout(0.1)
	PLS2 AAAAA 4 Bright A_Fadeout(0.1)
    Stop
  }
}