// Hand Cannon

Actor HandCannon : IDMWeapon
{
  Weapon.SelectionOrder 50
  Weapon.AmmoUse 4
  Weapon.AmmoGive 20
  Weapon.AmmoType "IDMShell"
  //Weapon.PreferredSkin "SSGMarine"
  Inventory.PickupMessage "Hand Cannon! (Slot 3)"
  Tag "Hand Cannon"
  Obituary "%o got %p ass Handed to %h by %k's Hand Cannon!"
  SelfObituary "%o handed %p own ass with %p own Hand Cannon!"
  Decal Scorch
  Decal BigScorch
  DamageType "Rocket"
  +WEAPON.BFG
  +WEAPON.NOLMS
  +WEAPON.NOAUTOAIM
  +EXTREMEDEATH
  States
  {
  Spawn:
    KSSG L -1 Bright
    Stop
  Ready:
    KSSG A 1 A_WeaponReady
    Loop
  Deselect:
    KSSG A 1 A_Lower
    Loop
  Select:
	TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
  Sloop:
    KSSG A 1 A_Raise
    Loop
  Fire:
	KSSG A 4
	KSSG A 6 A_PlayWeaponSound("Weapons/HandCannonPrime")
    KSSG A 0 A_GunFlash
	TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2",1,"Level2")
    KSSG A 0 A_PlayWeaponSound("Weapons/HandCannonFire")
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
    KSSG A 3 Offset(0,38) A_FireBullets(16.8, 7.1, 16, 10, "ExplosivePuff",FBF_NOFLASH)
	TNT1 A 0 A_CheckReload
    KSSG A 0 A_PlayWeaponSound("Weapons/HandCannonFire")
    KSSG A 2 Offset(0,40) A_FireBullets(16.8, 7.1, 16, 10, "ExplosivePuff")
    KSSG A 2 Offset(0,36) 
    KSSG A 1 Offset(0,33)
    KSSG B 5 A_CheckReload
    KSSG C 5
    KSSG D 5 A_PlaySound("Weapons/ShannonOpen")
    KSSG E 5
    KSSG K 10
    KSSG F 6
    KSSG G 7 A_PlaySound("Weapons/ShannonLoad")
    KSSG H 6
    KSSG C 5 A_PlaySound("Weapons/ShannonClose")
    KSSG B 4
    Goto Ready
  Quad:
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
    KSSG A 3 Offset(0,38) A_FireBullets(16.8, 7.1, 16, 10, "ExplosivePuff",FBF_NOFLASH)
	TNT1 A 0 A_CheckReload
    KSSG A 0 A_PlayWeaponSound("Weapons/HandCannonFire")
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
    KSSG A 2 Offset(0,40) A_FireBullets(16.8, 7.1, 16, 10, "ExplosivePuff")
	Goto Fire+10
  Level2:
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"QuadLevel2")
	TNT1 AAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("Hand",frandom(-16.8,16.8),0,0,0,0,frandom(-7.1,7.1))
    KSSG A 3 Offset(0,38) A_FireCustomMissile("Hand",frandom(-16.8,16.8),1,0,0,0,frandom(-7.1,7.1))
	TNT1 A 0 A_CheckReload
    KSSG A 0 A_PlayWeaponSound("Weapons/HandCannonFire")
	TNT1 AAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("Hand",frandom(-16.8,16.8),0,0,0,0,frandom(-7.1,7.1))
    KSSG A 2 Offset(0,40) A_FireCustomMissile("Hand",frandom(-16.8,16.8),1,0,0,0,frandom(-7.1,7.1))
	Goto Fire+10
  QuadLevel2:
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	TNT1 AAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("Hand",frandom(-16.8,16.8),0,0,0,0,frandom(-7.1,7.1))
    KSSG A 3 Offset(0,38) A_FireCustomMissile("Hand",frandom(-16.8,16.8),1,0,0,0,frandom(-7.1,7.1))
	TNT1 A 0 A_CheckReload
    KSSG A 0 A_PlayWeaponSound("Weapons/HandCannonFire")
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	TNT1 AAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("Hand",frandom(-16.8,16.8),0,0,0,0,frandom(-7.1,7.1))
    KSSG A 2 Offset(0,40) A_FireCustomMissile("Hand",frandom(-16.8,16.8),1,0,0,0,frandom(-7.1,7.1))
	Goto Fire+10
  Flash:
    KSSG J 3 Bright A_Light2
    KSSG I 3 Bright A_Light1
    Goto LightDone
  }
}

ACTOR ExplosivePuff
{
  +NOBLOCKMAP
  +NOGRAVITY
  +ALLOWPARTICLES
  +RANDOMIZE
  +PUFFONACTORS
  +SKYEXPLODE
  +PUFFGETSOWNER
  +EXTREMEDEATH
  DamageType "Rocket"
  AttackSound "misc/ricochet"
  Seesound "misc/bullethit"
  States
  {
  Spawn:
  XDeath:
  See:
	TNT1 A 0
	TNT1 A 0 A_Jump(256,"See1","See2","See3","See4")
  See1:
    PUFF A 5 Bright
    PUFF BCD 1
	Goto ExpSpawn
  See2:
    BPUF A 5 Bright
    BPUF BCD 1
	Goto ExpSpawn
  See3:
    PUFY A 5 Bright
    PUFY BCD 1
	Goto ExpSpawn
  See4:
    FPUF A 5 Bright
    FPUF BCD 1
	Goto ExpSpawn
  ExpSpawn:
	TNT1 A 0
	TNT1 A 1 A_SpawnItemEx("HandCannonExplosion",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
	Stop
  }
}

ACTOR HandCannonExplosion : IDMExplosion
{
  Obituary "%o got %p ass Handed to %h by %k's Hand Cannon!"
  SelfObituary "%o handed %p own ass with %p own Hand Cannon!"
  Alpha 0.9
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_Playsound("weapons/rocklx",CHAN_VOICE,0.5)
	MISL B 6 Bright A_Explode(128,128)
	MISL C 5 Bright
	MISL D 4 Bright
	Stop
  }
}

ACTOR Hand
{
	Projectile
	ProjectileKickBack 1000
	Damage 50
	Speed 60
	Gravity 0.3
	BounceType "Doom"
	BounceCount 20
	BounceFactor 1.0
	WallBounceFactor 1.0
	BounceSound "weapons/hand"
	Seesound "weapons/hand"
	Obituary "%o got %p ass Handed to %h by %k's Hand Cannon!"
	SelfObituary "%o handed %p own ass with %p own Hand Cannon!"
	+EXTREMEDEATH
	-NOGRAVITY
	-NOTELEPORT
	+SKYEXPLODE
	States
	{
	Spawn:
	  HAND A 1 Bright
	  Loop
	Death:
	  TNT1 A 0 A_Playsound("weapons/rocklx",CHAN_VOICE)
	  MISL B 6 Bright A_Explode(256,128)
	  MISL C 5 Bright
	  MISL D 4 Bright
	  Stop
	}
}

ACTOR Hand2 : Hand
{
	Obituary "%o was spanked by %k's Hand."
	SelfObituary "%o gave %hself a spanking."
}