// Sprites by Eriance
Actor "Rocket Launcher" : RocketLauncher
{	
	Weapon.Slotnumber 5
	Inventory.PickupSound "weapons/pickup"
	+INVENTORY.UNDROPPABLE
    Weapon.BobStyle InverseSmooth
    Weapon.BobSpeed 1.6
    Weapon.BobRangeY 0.5
    Weapon.BobRangeX 0.9
	Weapon.AmmoGive 0
   States
   {
   Spawn:
      LAUN A -1
      Stop
   Ready:
      MIS9 A 1 A_WeaponReady
      Loop
   Deselect:
	  TNT1 A 0 A_TakeInventory("H_WeaponSlot5", 1)
      MIS9 A 1 A_Lower
	  TNT1 A 0 A_Lower
      Loop
   Select:
	  TNT1 A 0 A_GiveInventory("H_WeaponSlot5", 1)
	  TNT1 A 0 A_TakeInventory("DnD_WeaponID", 0x7FFFFFFF)
	  TNT1 A 0 A_GiveInventory("DnD_WeaponID", DND_WEAPON_ROCKETLAUNCHER)
	  TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_0, 20, 1 | (8 << 16))
	  TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_1, 128)
  SelectLoop:
      MIS9 A 1 A_Raise
	  TNT1 A 0 A_Raise
      Loop
   Fire:
      MIS9 D 3 Bright A_GunFlash
	  TNT1 A 0 Radius_Quake(4,3,0,1,0)
      MIS9 E 4 Bright A_GiveInventory("RocketShooter", 1)
      MIS9 FGHC 3 Bright
	  MIS9 B 4 Bright
      MIS9 A 0 A_Refire
      Goto Ready
   Flash:
      TNT1 A 3 A_Light1
      TNT1 A 4 A_Light2
      TNT1 A 3 A_Light1
      TNT1 A 2 A_Light0
      stop
   }
}

Actor RocketShooter : DnD_Activator {
	States {
		Use:
			TNT1 A 0 A_GiveInventory("DnD_UsedNonSpecial", 1)
			TNT1 A 0 A_JumpIfInventory("NetherCheck", 1, "Full")
			TNT1 A 0 A_FireCustomMissile("RocketX", 0, 1, 0, 0)
		Stop
		Full:
			TNT1 A 0 A_FireCustomMissile("RocketX_FullDMG", 0, 1, 0, 0)
		Stop
	}
}

// Sprites by Eriance
Actor "Upgraded Rocket Launcher" : RocketLauncher {	
	Weapon.Slotnumber 5
	Inventory.PickupSound "weapons/pickup"
	+INVENTORY.UNDROPPABLE
	Tag "Torpedo Launcher"
    Weapon.BobStyle InverseSmooth
    Weapon.BobSpeed 1.6
    Weapon.BobRangeY 0.5
    Weapon.BobRangeX 0.9
	-NOAUTOFIRE
	States {
		Spawn:
			WPPK G -1
		Stop
		Ready:
			RLDI A 1 A_WeaponReady
		Loop
		Deselect:
			TNT1 A 0 A_TakeInventory("H_WeaponSlot5", 1)
			RLDI A 1 A_Lower
			TNT1 A 0 A_Lower
		Loop
		Select:
			TNT1 A 0 A_GiveInventory("H_WeaponSlot5", 1)
			TNT1 A 0 A_TakeInventory("DnD_WeaponID", 0x7FFFFFFF)
			TNT1 A 0 A_GiveInventory("DnD_WeaponID", DND_WEAPON_TORPEDOLAUNCHER)
			TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_0, 15, 15 | (25 << 16))
			TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_1, 224)
	    SelectLoop:
			RLDI A 1 A_Raise
			TNT1 A 0 A_Raise
		Loop
		Fire:
			RLDI A 1
			RLDF A 1 Bright A_GunFlash
			TNT1 A 0 A_PlayWeaponSound("weapons/newrocketfire")
			TNT1 A 0 Radius_Quake(4, 3, 0, 1,0)
			RLDF B 1 Bright A_GiveInventory("RocketShooter2", 1)
			RLDF C 1 Bright Offset(14, 39)
			RLDF D 1 Bright Offset(19, 42)
			RLDF E 1 Bright Offset(21, 44)
			RLDF F 2 Offset(23, 45)
			RLDR A 1 Offset(21, 44)
			RLDR A 1 Offset(19, 43)
			RLDR B 1 Offset(17, 42)
			RLDR B 1 Offset(15, 41)
			RLDR C 1 Offset(13, 40)
			RLDR C 1 Offset(11, 39)
			RLDR D 1 Offset(9, 38)
			RLDR D 1 Offset(7, 37)
			RLDR E 1 Offset(5, 36)
			RLDR E 1 Offset(3, 35)
			RLDR F 1 Offset(1, 33)
			RLDR F 1 Offset(0, 32)
			RLDR G 1 Offset(0, 32)
			RLDR H 1 Offset(0, 32)
			RLDR I 1 Offset(0, 32)
			RLDR JKLMNOPQRST 1 Offset(0, 32)
		Goto Ready
		Flash:
			TNT1 A 3 A_Light1
			TNT1 A 4 A_Light2
			TNT1 A 3 A_Light1
			TNT1 A 2 A_Light0
		stop
	}
}

Actor RocketX : Rocket {
	+MTHRUSPECIES
	Decal "Scorch"
	Damage (ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET))
	DamageType "Explosives"
	+DONTBLAST
	+THRUGHOST
	States {
		Death:
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlare", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE | SXF_NOCHECKPOSITION, 0)
			TNT1 AAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 180))
			TNT1 AAAAAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_JumpIFInTargetInventory("Ability_ExplosionMastery", 1, "LessDmg")
			MISL B 8 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET), 144)
			MISL C 6 Bright
			MISL D 4 Bright
		Stop
		LessDmg:
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 144, 0)
			MISL B 8 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 144)
			MISL C 6 Bright
			MISL D 4 Bright
		Stop
	}	
}

ACtor RocketX_FullDMG : RocketX {
	DamageType "ExplosivesFull"
	+FORCERADIUSDMG
	-THRUGHOST
}

Actor NewRocket : RocketX
{
	Speed 48
	SeeSound ""
	Damage (ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET))
	DamageType "Explosives"
	Decal "Scorch"
	Scale 1.15
	States {
		Spawn:
			MICM A -1 Bright
		Stop
		Death:
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlare", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE | SXF_NOCHECKPOSITION, 0)
			TNT1 AAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 180))
			TNT1 AAAAAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_JumpIFInTargetInventory("Ability_ExplosionMastery", 1, "LessDmg")
			MISL B 8 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET), 128)
			MISL C 6 Bright
			MISL D 4 Bright
		Stop
		LessDmg:
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 128, 0)
			MISL B 8 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 128)
			MISL C 6 Bright
			MISL D 4 Bright
		Stop
	}
}

Actor NewRocket_FullDMG : NewRocket {
	DamageType "ExplosivesFull"
	+FORCERADIUSDMG
	-THRUGHOST
}

Actor RocketShooter2 : DnD_Activator {
	States {
		Use:
			TNT1 A 0 A_JumpIfInventory("NetherCheck", 1, "Full")
			TNT1 A 0 A_FireCustomMissile("NewRocket", 0, 1, 0, 0)
		Stop
		Full:
			TNT1 A 0 A_FireCustomMissile("NewRocket_FullDMG", 0, 1, 0, 0)
		Stop
	}
}

// Sprites by Eriance
Actor "Upgraded Rocket Launcher2" : RocketLauncher {	
	Weapon.Slotnumber 5
	Inventory.PickupSound "weapons/pickup"
	+INVENTORY.UNDROPPABLE
	Tag "Mercury Launcher"
    Weapon.BobStyle InverseSmooth
    Weapon.BobSpeed 1.6
    Weapon.BobRangeY 0.5
    Weapon.BobRangeX 0.8
	-NOAUTOFIRE
	States {
		Spawn:
			MERC X -1
		Stop
		Ready:
			MERC A 1 A_WeaponReady
		Loop
		Deselect:
			TNT1 A 0 A_StopSound(CHAN_WEAPON)
			TNT1 A 0 A_TakeInventory("H_WeaponSlot5", 1)
			MERC A 1 A_Lower
			TNT1 A 0 A_Lower
		Loop
		Select:
			TNT1 A 0 A_GiveInventory("H_WeaponSlot5", 1)
			TNT1 A 0 A_TakeInventory("DnD_WeaponID", 0x7FFFFFFF)
			TNT1 A 0 A_GiveInventory("DnD_WeaponID", DND_WEAPON_MERCURYLAUNCHER)
			TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_0, 16, 16 | (20 << 16))
			TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_1, 24)
	    SelectLoop:
			MERC A 1 A_Raise
			TNT1 A 0 A_Raise
		Loop
		Fire:
			MERC A 1 A_CheckReload
			MERC B 1 Bright A_Gunflash
			MERC BC 1 Bright
			TNT1 A 0 A_PlayWeaponSound("weapons/mercuryfire")
			TNT1 A 0 Radius_Quake(4,3,0,1,0)
			MERC C 1 Bright A_GiveInventory("RocketShooter3", 1)
			MERC DEFGHI 1 Bright
			MERC JKLMN 3
			MERC A 15
			MERC A 6 A_Refire
		Goto Ready
		Flash:
			TNT1 A 3 A_Light1
			TNT1 A 4 A_Light2
			TNT1 A 3 A_Light1
			TNT1 A 2 A_Light0
		stop
	}
}

Actor MercurySmoke : RocketSmoke {
	Renderstyle Add
	Alpha 0.85
	
	States {
		Spawn:
			OBSK ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 Bright A_FadeOut(0.03)
		Stop
	}
}

Actor MercuryRocket : RocketX {
	Speed 16
	SeeSound ""
	Damage (ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET))
	DamageType "Explosives"
	Decal "Scorch"
	Scale 1.1
	+LOOKALLAROUND
	+SCREENSEEKER
	+THRUGHOST
	+SEEKERMISSILE
	States {
		Spawn:
			TNT1 A 0
			HMMS C 12
			TNT1 A 0 A_ChangeVelocity(velx * 2.75, vely * 2.75, velz * 2.75, CVF_REPLACE)
		SpawnLoop:
			HMMS A 2 Bright A_SeekerMissile(45, 15, SMF_LOOK | SMF_PRECISE | SMF_CURSPEED)
			TNT1 A 0 A_CustomMissile("MercurySmoke", 0, 0, random(225, 315), 2, random(0, 360))
			HMMS B 2 Bright A_SeekerMissile(45, 15, SMF_LOOK | SMF_PRECISE | SMF_CURSPEED)
			TNT1 A 0 A_CustomMissile("MercurySmoke", 0, 0, random(225, 315), 2, random(0, 360))
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlare", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE | SXF_NOCHECKPOSITION, 0)
			TNT1 AAAAAAA 0 A_CustomMissile("MercurySmoke", 0, 0, random(0, 360), 2, random(0, 180))
			TNT1 AAAAAAAAAAAA 0 A_CustomMissile("MercurySmoke", 0, 0, random(0, 360), 2, random(0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_JumpIFInTargetInventory("Ability_ExplosionMastery", 1, "LessDmg")
			MISL BBBB 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET), 160)
			TNT1 AAAAAAAAAAAA 0 A_CustomMissile("MercurySmoke", 0, 0, random(0, 360), 2, random(0, 360))
			MISL CCC 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET), 160)
			TNT1 AAAAAAAAAAAA 0 A_CustomMissile("MercurySmoke", 0, 0, random(0, 360), 2, random(0, 360))
			MISL D 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET), 160)
			MISL D 2 Bright
		Stop
		LessDmg:
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160, 0)
			MISL B 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 3, 128)
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160, 0)
			MISL B 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 3, 128)
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160, 0)
			MISL B 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 3, 128)
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160, 0)
			MISL B 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 3, 128)
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160, 0)
			TNT1 AAAAAAAAAAAA 0 A_CustomMissile("MercurySmoke", 0, 0, random(0, 360), 2, random(0, 360))
			MISL C 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 3, 128)
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160, 0)
			MISL C 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 3, 128)
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160, 0)
			MISL C 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 3, 128)
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160, 0)
			TNT1 AAAAAAAAAAAA 0 A_CustomMissile("MercurySmoke", 0, 0, random(0, 360), 2, random(0, 360))
			MISL D 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160)
			MISL D 2 Bright
		Stop
	}
}

Actor MercuryRocket_FullDMG : MercuryRocket {
	DamageType "ExplosivesFull"
	+FORCERADIUSDMG
	-THRUGHOST
}

Actor RocketShooter3 : DnD_Activator {
	States {
		Use:
			TNT1 A 0 A_GiveInventory("DnD_UsedNonSpecial", 1)
			TNT1 A 0 A_JumpIfInventory("NetherCheck", 1, "Full")
			TNT1 A 0 A_FireCustomMissile("MercuryRocket", 1, 1, 0, 0)
		Stop
		Full:
			TNT1 A 0 A_FireCustomMissile("MercuryRocket_FullDMG", 1, 1, 0, 0)
		Stop
	}
}

// Sprites by Eriance
Actor "Grenade Launcher" : RocketLauncher
{	
	Weapon.Slotnumber 5
    Inventory.PickupSound "weapons/pickup"
    Inventory.PickupMessage "You got the grenade launcher!"
	Weapon.AmmoType "Grenades"
	Weapon.AmmoGive 3
	Weapon.AmmoUse 0
	Obituary "%o was blown away by %k's grenade launcher!"
	+NOAUTOAIM
	+INVENTORY.UNDROPPABLE
	Tag "Grenade Launcher"
    Weapon.BobStyle InverseSmooth
    Weapon.BobSpeed 1.6
    Weapon.BobRangeY 0.5
    Weapon.BobRangeX 0.9
   States
   {
   Spawn:
      NGLP A -1
      Stop
   Ready:
      NGLN A 1 A_WeaponReady
      Loop
   Deselect:
	  TNT1 A 0 A_TakeInventory("H_WeaponSlot5", 1)
      NGLN A 1 A_Lower
	  TNT1 A 0 A_Lower
      Loop
   Select:
	  TNT1 A 0 A_GiveInventory("H_WeaponSlot5", 1)
	  TNT1 A 0 A_TakeInventory("DnD_WeaponID", 0x7FFFFFFF)
	  TNT1 A 0 A_GiveInventory("DnD_WeaponID", DND_WEAPON_GRENADELAUNCHER)
	  TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_1, 128)
	  TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_2, 80)
   SelectLoop:
      NGLN A 1 A_Raise
	  TNT1 A 0 A_Raise
      Loop
   Fire:
	  TNT1 A 0 A_JumpIfInventory("Grenades", 1, "ContinueFire")
	  NGLN A 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
   Goto Ready
   ContinueFire:
      NGLN D 3 Bright A_GunFlash
	  TNT1 A 0 A_PlayWeaponSound("weapons/glauncherfire")
      NGLN E 3 Bright A_GiveInventory("GrenadeShooterGL", 1)
      NGLN FGH 3 Bright
	  NGLN CI 2
	  NGLN B 2
	  NGLN A 4
      NGLN A 4 A_Refire
      Goto Ready
   Flash:
      TNT1 A 3 A_Light1
      TNT1 A 4 A_Light2
      TNT1 A 3 A_Light1
      TNT1 A 2 A_Light0
      stop
	Altfire:
		TNT1 A 0 A_JumpIfInventory("AmmoSwitchCooldown", 1, "NoAction")
		NGLN A 1 A_WeaponReady(WRF_NOSWITCH | WRF_NOFIRE)
		TNT1 A 0 A_GiveInventory("AmmoSwitchCooldown", 1)
		TNT1 A 0 ACS_ExecuteAlways(DND_SPECIALAMMO_SCRIPT, 0, AMMO_TYPE_GRENADE, SPWEP_GL)
		NGLN A 1 A_WeaponReady(WRF_NOSWITCH | WRF_NOFIRE)
		TNT1 A 0 ACS_ExecuteAlways(DND_SPECIALAMMOMSG_SCRIPT, 0)
		NGLN A 1 A_WeaponReady(WRF_NOSWITCH | WRF_NOFIRE)
		TNT1 A 0 A_Refire
	Goto Ready
	NoAction:
		NGLN A 1 A_WeaponReady(WRF_NOSWITCH | WRF_NOFIRE)
	Goto Ready
   }
}

Actor "Upgraded Grenade Launcher" : RocketLauncher
{	
	Weapon.Slotnumber 5
    Inventory.PickupSound "weapons/pickup"
    Inventory.PickupMessage "You got the grenade launcher!"
	Weapon.AmmoType "Grenades"
	Weapon.AmmoGive 3
	Obituary "%o was blown away by %k's grenade launcher!"
	+NOAUTOAIM
	+INVENTORY.UNDROPPABLE
	Tag "Rotary Grenade Launcher"
	Weapon.BobStyle InverseSmooth
    Weapon.BobSpeed 1.6
    Weapon.BobRangeY 0.5
    Weapon.BobRangeX 0.9
   States
   {
   Spawn:
      RTGL Z -1
      Stop
   Ready:
      RTGL A 1 A_WeaponReady
      Loop
   Deselect:
      TNT1 A 0 A_TakeInventory("H_WeaponSlot5", 1)
      RTGL A 1 A_Lower
	  TNT1 A 0 A_Lower
      Loop
   Select:
      TNT1 A 0 A_GiveInventory("H_WeaponSlot5", 1)
	  TNT1 A 0 A_TakeInventory("DnD_WeaponID", 0x7FFFFFFF)
	  TNT1 A 0 A_GiveInventory("DnD_WeaponID", DND_WEAPON_ROTARYGRENADELAUNCHER)
	  TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_0, 192)
   SelectLoop:
      RTGL A 1 A_Raise
	  TNT1 A 0 A_Raise
      Loop
   Fire:
      RTGL BC 1 Bright A_GunFlash
	  TNT1 A 0 A_PlayWeaponSound("weapons/glauncherfiren")
	  TNT1 A 0 Radius_Quake(4,3,0,1,0)
      RTGL D 1 Bright A_GiveInventory("GrenadeShooter2", 1)
	  RTGL EF 1 Bright
	  TNT1 A 0 A_CheckReload
	  RTGL G 1
	  TNT1 A 0 A_PlaySound("weapons/glauncherload")
      RTGL GHH 1
	  RTGL IJ 5
	  RTGL K 2
      RTGL A 5 A_Refire
      Goto Ready
   Flash:
      TNT1 A 3 A_Light1
      TNT1 A 4 A_Light2
      TNT1 A 3 A_Light1
      TNT1 A 2 A_Light0
      stop
   }
}

Actor GrenadeShooter2 : DnD_Activator {
	States {
		Use:
			TNT1 A 0 A_GiveInventory("DnD_UsedNonSpecial", 1)
			TNT1 A 0 A_JumpIfInventory("NetherCheck", 1, "Full")
			TNT1 A 0 A_FireCustomMissile("NewGrenade", 0, 1, 0, 4)
		Stop
		Full:
			TNT1 A 0 A_FireCustomMissile("NewGrenade_FullDMG", 0, 1, 0, 4)
		Stop
	}
}

Actor NormalGrenade
{
	speed 28
	PROJECTILE
	Damage (ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_2, TALENT_EXPLOSIVE, DND_USETARGET))
	DamageType "Explosives"
	BounceSound "weapons/grenadebounce"
	Scale 1.0
	Radius 10
	Height 12
	+DONTBLAST
	+MTHRUSPECIES
	+EXPLODEONWATER
	+THRUGHOST
	-NOGRAVITY
	BounceType Doom
	Bouncecount 4
	BounceFactor 0.66
	Gravity 0.66
	DeathSound "Weapons/grenadexpl"
	States
	{
		Spawn:
			NGLP B 5 A_SpawnItem("GrenadeSmoke")
		Loop
		Death:
			TNT1 A 0 A_ChangeFlag("NOGRAVITY", 1)
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlare", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE | SXF_NOCHECKPOSITION, 0)
			TNT1 AAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 180))
			TNT1 AAAAAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_JumpIFInTargetInventory("Ability_ExplosionMastery", 1, "LessDmg")
			MISL B 8 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET), 144)
			MISL C 6 Bright
			MISL D 4 Bright	
		Stop
		LessDmg:
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 144, 0)
			MISL B 8 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_1, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 144)
			MISL C 6 Bright
			MISL D 4 Bright	
		Stop
	}
}

Actor NormalGrenade_FullDMG : NormalGrenade {
	DamageType "ExplosivesFull"
	+FORCERADIUSDMG
	-THRUGHOST
}

Actor NewGrenade : NormalGrenade
{
	Scale 0.55
	Damage (ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET))
	DeathSound "Weapons/grenadexpl2"
	States
	{
		Spawn:
			NGLP C 5 A_SpawnItem("GrenadeSmoke")
		Loop
		Death:
			TNT1 A 0 A_ChangeFlag("NOGRAVITY", 1)
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlare", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE | SXF_NOCHECKPOSITION, 0)
			TNT1 AAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 180))
			TNT1 AAAAAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_JumpIFInTargetInventory("Ability_ExplosionMastery", 1, "LessDmg")
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET), 176)
			TNT1 A 1 A_SpawnItem("NewGrenadeExplosion")
		Stop
		LessDmg:
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 192)
			TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 192, 0)
			TNT1 A 1 A_SpawnItem("NewGrenadeExplosion")
		Stop
	}
}

Actor NewGrenade_FullDMG : NewGrenade {
	DamageType "ExplosivesFull"
	+FORCERADIUSDMG
	-THRUGHOST
}

// Another drop only weapon, Sprites by Eriance
ACTOR "Heavy Missile Launcher" : Weapon
{	
   Inventory.PickupSound "weapons/pickup"
   Inventory.PickupMessage "You got the Heavy Missile Launcher!"
   Obituary "%o couldn't dodge %k's missiles."
   Weapon.AmmoType "MISAmmo"
   Weapon.AmmoGive 2
   Weapon.AmmoUse 1
   Weapon.Slotnumber 5
   Weapon.SelectionOrder 1600
   +INVENTORY.UNDROPPABLE
	Weapon.BobStyle InverseSmooth
    Weapon.BobSpeed 1.6
    Weapon.BobRangeY 0.5
    Weapon.BobRangeX 0.9
   States
   {
   Spawn:
      WMLN A -1
      Loop
   Ready:
      MLNG A 1 A_WeaponReady
      Loop
   Deselect:
      TNT1 A 0 A_TakeInventory("H_WeaponSlot5", 1)
      MLNG A 1 A_Lower
	  TNT1 A 0 A_Lower
      Loop
   Select:
      TNT1 A 0 A_GiveInventory("H_WeaponSlot5", 1)
	  TNT1 A 0 A_TakeInventory("DnD_WeaponID", 0x7FFFFFFF)
	  TNT1 A 0 A_GiveInventory("DnD_WeaponID", DND_WEAPON_HEAVYMISSILELAUNCHER)
	  TNT1 A 0 ACS_NamedExecuteAlways("DND Weapon Damage Cache", 0, DND_DMGID_0, 160)
	SelectLoop:
      MLNG A 1 A_Raise
	  TNT1 A 0 A_Raise
      Loop
   Fire:
      MLNG A 4
      MLNG D 0 Bright A_GunFlash
      MLNG D 4 Bright
	  TNT1 A 0 A_PlayWeaponSound("weapons/heavyrlfire")
	  TNT1 A 0 Radius_Quake(4,3,0,1,0)
      MLNG E 3 Bright A_GiveInventory("MissileShooter", 1)
	  MLNG FGHCB 3 Bright
	  MLNG A 2 
      MLNG A 2 A_Refire  
      Goto Ready
   Flash:
      TNT1 A 5 A_Light1
      TNT1 A 6 A_Light2
      TNT1 A 5 A_Light1
      TNT1 A 0 A_Light0
      stop
   }
}

ACTOR HomRocket1
{
   Radius 8
   Height 11
   Speed 32
   Damage (ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET))
   DamageType "Explosives"
   PROJECTILE
   DeathSound "weapons/heavyrlexp"
   +SeekerMissile
   +MTHRUSPECIES
   +Rockettrail
   +THRUGHOST
   +FORCEXYBILLBOARD
   +FORCERADIUSDMG
   +EXPLODEONWATER
   +DONTBLAST
//   +SCREENSEEKER
   SeeSound ""
   States
   {
   Spawn:
      HMIS AA 4 Bright
      HMIS A 2 Bright A_SeekerMissile (10,25)
      HMIS A 2 Bright
      goto Spawn+2
   Death:
      TNT1 A 0 A_SetTranslucent (0.75,1)
	  TNT1 A 0 A_SpawnItemEx ("ExplosionFlare", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE | SXF_NOCHECKPOSITION, 0)
	  TNT1 AAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 180))
	  TNT1 AAAAAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 360))	
	  TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
	  TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
	  TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
	  TNT1 A 0 A_JumpIFInTargetInventory("Ability_ExplosionMastery", 1, "LessDmg")
      MACX A 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET), 160)
      MACX BCDEFGHIJ 2 Bright
      stop
	  LessDmg:
	  TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160, 0)
      MACX A 2 Bright A_Explode(ACS_NamedExecuteWithResult("DND Weapon Damage Retrieve", DND_DMGID_0, TALENT_EXPLOSIVE, DND_USETARGET) / 2, 160)
      MACX BCDEFGHIJ 2 Bright
      stop
   }
}

Actor HomRocket1_FullDMG : HomRocket1 {
	DamageType "ExplosivesFull"
	+FORCERADIUSDMG
	-THRUGHOST
}

Actor MissileShooter : DnD_Activator {
	States {
		Use:
			TNT1 A 0 A_GiveInventory("DnD_UsedNonSpecial", 1)
			TNT1 A 0 A_JumpIfInventory("NetherCheck", 1, "Full")
	        TNT1 A 0 A_FireCustomMissile ("HomRocket1",-4,1,0,0)
			TNT1 A 0 A_FireCustomMissile ("HomRocket1",4,1,0,0)
		Stop
		Full:
	        TNT1 A 0 A_FireCustomMissile ("HomRocket1_FullDMG",-4,1,0,0)
			TNT1 A 0 A_FireCustomMissile ("HomRocket1_FullDMG",4,1,0,0)
		Stop
	}
}