// Devastators (Duke Nukem 3D)

ACTOR Devastator : IDMWeapon
{
	Inventory.PickupSound "misc/w_pkup"
	Inventory.PickupMessage "Duke's Devastators! (Slot 5)"
	Tag "Duke's Devastators"
	Weapon.AmmoType "IDMRocketAmmo"
	Weapon.AmmoGive 15
	Weapon.AmmoUse 1
	//Weapon.PreferredSkin "DualChaingunMarine"
	Weapon.Selectionorder 50
	+WEAPON.BFG
	+WEAPON.EXPLOSIVE
	+WEAPON.NOLMS
	States
	{
    Spawn:
        DVGG A -1 Bright
        Loop
    Ready:
        DEVS A 1 A_WeaponReady
        Loop
    Deselect:
        DEVS A 1 A_Lower
        Loop
    Select:
		TNT1 A 0 A_PlaySound("weapons/devpick",CHAN_WEAPON)
		TNT1 A 0 A_Playsound("weapons/duke",CHAN_AUTO)
	Sloop:
        DEVS A 1 A_Raise
        Loop
    Fire:
		TNT1 A 0 A_Light2
	    TNT1 A 0 A_JumpIfInventory("Devcheck",1,"fire2")
		TNT1 A 0 A_PlayWeaponSound("weapons/devshot")
		TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2",1,"Level2")
		TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
		TNT1 AAAA 0 A_FireCustomMissile("DevastatorRocket",frandom(-5,5),0,5,5,1,frandom(0,2))
		DEVS B 1 Bright A_FireCustomMissile("DevastatorRocket",frandom(-5,5),1,5,5,1,frandom(0,2))
		DEVS C 2 Bright
		DEVS DE 1 Bright A_Light0
		TNT1 A 0 A_GiveInventory("Devcheck",1)
		DEVS A 1 Bright
		TNT1 A 0 A_Light2
	Fire2:
		TNT1 A 0 A_PlayWeaponSound("weapons/devshot")
		TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2",1,"Level22")
		TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad2")
		TNT1 AAAA 0 A_FireCustomMissile("DevastatorRocket",frandom(-5,5),0,-5,5,1,frandom(0,2))
		DEVS A 1 Bright A_FireCustomMissile("DevastatorRocket",frandom(-5,5),0,-5,5,1,frandom(0,2))
		DEVS F 2 Bright
		DEVS GHI 1 Bright A_Light0
		DEVS A 1 Bright
		TNT1 A 0 A_TakeInventory("Devcheck",1)
		Goto Ready
	Quad:
		TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
		TNT1 AAAA 0 A_FireCustomMissile("ExtremeDevastatorRocket",frandom(-5,5),0,5,5,1,frandom(0,2))
		DEVS B 1 Bright A_FireCustomMissile("ExtremeDevastatorRocket",frandom(-5,5),1,5,5,1,frandom(0,2))
		Goto Fire+10
	Level2:
		TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"QuadLevel2")
		DEVS AAAAAAAAA 0 A_FireCustomMissile("DevastatorRocket",frandom(-8,8),0,5,5,1,frandom(0,2))
		DEVS B 1 Bright A_FireCustomMissile("DevastatorRocket",frandom(-8,8),1,5,5,1,frandom(0,2))
		Goto Fire+10
	QuadLevel2:
		TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
		DEVS AAAAAAAAA 0 A_FireCustomMissile("ExtremeDevastatorRocket",frandom(-8,8),0,5,5,1,frandom(0,2))
		DEVS B 1 Bright A_FireCustomMissile("ExtremeDevastatorRocket",frandom(-8,8),1,5,5,1,frandom(0,2))
		Goto Fire+10
	Quad2:
		TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
		TNT1 AAAA 0 A_FireCustomMissile("ExtremeDevastatorRocket",frandom(-5,5),0,-5,5,1,frandom(0,2))
		DEVS A 1 Bright A_FireCustomMissile("ExtremeDevastatorRocket",frandom(-5,5),0,-5,5,1,frandom(0,2))
		Goto Fire2+8
	Level22:
		TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"QuadLevel22")
		DEVS AAAAAAAAA 0 A_FireCustomMissile("DevastatorRocket",frandom(-8,8),0,-5,5,1,frandom(0,2))
		DEVS A 1 Bright A_FireCustomMissile("DevastatorRocket",frandom(-8,8),0,-5,5,1,frandom(0,2))
		Goto Fire2+8
	QuadLevel22:
		TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
		DEVS AAAAAAAAA 0 A_FireCustomMissile("ExtremeDevastatorRocket",frandom(-8,8),0,-5,5,1,frandom(0,2))
		DEVS A 1 Bright A_FireCustomMissile("ExtremeDevastatorRocket",frandom(-8,8),0,-5,5,1,frandom(0,2))
		Goto Fire2+8
	}
}

ACTOR Devcheck : Inventory
{
   Inventory.MaxAmount 1
}

ACTOR DevastatorRocket : IDMRocket
{
	Radius 4
	Height 4
	Speed 32
	Scale 0.15
	Damage (10*random(1,10))
	Projectile
	SeeSound "weapons/devlnch"
	DeathSound "weapons/devexpl"
	Obituary "%o got devastated by %k's Devastators."
	SelfObituary "%o devastated %hself with %p Devastators!"
	Decal None
	-ROCKETTRAIL
    +SKYEXPLODE
    -NOTELEPORT
	+EXTREMEDEATH
	States
	{
	Spawn:
	  MNSS A 1 Bright
	  Loop
	Death:
	  TNT1 A 0
	  TNT1 A 0 A_SetScale(0.4)
	  GRNE A 3 Bright A_Explode(128,100,0)
	  GRNE BCDEFGHIJKLMN 3 Bright
      Stop
    }
}

ACTOR ExtremeDevastatorRocket : DevastatorRocket
{
	States
	{
	XDeath:
	  TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
	  Goto Death
    }
}