actor Nutcracker : Weapon replaces BFG9000
{
  Game Doom
  Weapon.AmmoUse 1
  Weapon.AmmoGive 2
  Weapon.AmmoType "TwoBoreAmmo"
  Weapon.SlotNumber 7
  Weapon.SelectionOrder 3
  Weapon.UpSound "Nutcracker/Up"
  Weapon.Kickback 90
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "Got the glorious Van Masterson's ''Nutcracker'' T-Rex rifle! Have you seen any T-Rexes around these days? Me neither! (7)"
  Obituary "%o had the very unfortunate situation to land on the wrong side of ''Nutcracker'' barrel. %k served a well-deserved dismemberment."
  Weapon.BobStyle InverseSmooth
  Weapon.BobSpeed 1.4
  Weapon.BobRangeY 0.5
  Weapon.BobRangeX 1.1
  +NOALERT
  +NOAUTOAIM
  States
  {
  Ready:
	NTCU ABCD 1
  ReadyMain:
    NTCG A 0 A_JumpIfInventory("MacheteGoesFast",1,"CaberToss")
    NTCG A 1 A_WeaponReady(WRF_ALLOWZOOM)
    Loop
  Deselect:
	NTCU DCBA 1
	TNT1 A 0 A_StopSound(1)
    TNT1 A 0 SetPlayerProperty(0, 0, PROP_INSTANTWEAPONSWITCH)
    TNT1 AAAAAAAAAAAAAAA 0 A_Lower
    TNT1 A 1 A_Lower
    Wait
  Select:
    TNT1 A 0 SetPlayerProperty(0, 1, PROP_INSTANTWEAPONSWITCH)
    TNT1 A 0 A_Raise
    TNT1 A 1 A_Raise
    Loop
  Fire:
	NTCG A 0 A_PlaySound("Nutcracker/Fire",1,0.55)
	NTCG A 0 A_PlaySound("Nutcracker/Add",5,0.55)
	NTCG A 0 A_FireCustomMissile("GunsmokeSpawner_Large_Dark",0,0,13,0)
	NTCG A 0 A_ChangeVelocity (Cos(Pitch) * -39, 0, Sin(Pitch) * 39,CVF_RELATIVE)
	NTCG A 0 A_Recoil(20)
	NTCG A 0 A_AlertMonsters
	NTCG A 0 A_GunFlash
	NTCG A 0 A_FireCustomMissile("NutcrackerBullet",0,1,6,0,0,0)
	NTCG A 0 A_SetBlend("Yellow",0.2,12)
	NTCG A 0 A_Quake(6,14,0,16,"none")
	
	NTCG A 0 A_SetAngle(Angle-2.5)
	NTCG A 0 A_SetPitch(Pitch-2.5)
	NTCF A 1 Bright A_ZoomFactor(0.9)
	NTCG A 0 A_SetAngle(Angle-4)
	NTCG A 0 A_SetPitch(Pitch-4)
	NTCF B 1 A_ZoomFactor(0.8)
	NTCG A 0 A_SetAngle(Angle-3)
	NTCG A 0 A_SetPitch(Pitch-3)
	NTCF B 1 A_ZoomFactor(0.85)
	NTCG A 0 A_SetAngle(Angle-2.5)
	NTCG A 0 A_SetPitch(Pitch-2.5)
	NTCF C 1 A_ZoomFactor(0.875)
	NTCG A 0 A_SetAngle(Angle-2)
	NTCG A 0 A_SetPitch(Pitch-2)
	NTCF D 1 A_ZoomFactor(0.9)
	NTCG A 0 A_SetAngle(Angle-1.5)
	NTCG A 0 A_SetPitch(Pitch-1.5)
	NTCF E 1 A_ZoomFactor(0.9)
	NTCG A 0 A_SetAngle(Angle-1)
	NTCG A 0 A_SetPitch(Pitch-1)
	NTCF F 1 A_ZoomFactor(0.925)
	NTCG A 0 A_SetAngle(Angle-0.5)
	NTCG A 0 A_SetPitch(Pitch-0.5)
	NTCF G 1 A_ZoomFactor(0.95)
	NTCG A 0 A_SetAngle(Angle-0.25)
	NTCG A 0 A_SetPitch(Pitch-0.25)
	TNT1 A 1 A_ZoomFactor(0.96)
	TNT1 A 1 A_ZoomFactor(0.97)
	TNT1 A 1 A_ZoomFactor(0.98)
	TNT1 A 1 A_ZoomFactor(0.99)
	TNT1 A 0 A_ZoomFactor(1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	TNT1 A 5 A_JumpIf(Health<75,1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	TNT1 A 5 A_JumpIf(Health<50,1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	TNT1 A 5 A_JumpIf(Health<25,1)
	TNT1 A 0 A_JumpIfNoAmmo("Ready")
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCB A 1 A_JumpIf(Health<75,2)
	NTCB BCD 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCB E 1 A_JumpIf(Health<50,2)
	NTCB FGH 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCB I 1 A_JumpIf(Health<25,2)
	NTCB JKL 1
	NTCB M 0 A_PlaySound("Nutcracker/Load",4,0.8)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCB M 1 A_JumpIf(Health<75,2)
	NTCB NOP 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCB Q 1 A_JumpIf(Health<50,2)
	NTCB R 1
	NTCL AB 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCL C 1 A_JumpIf(Health<25,2)
	NTCL DEF 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCL G 1 A_JumpIf(Health<75,2)
	NTCL HIK 1
	NTCL L 0 A_PlaySound("Nutcracker/Pull",6,1.0)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCL L 1 A_JumpIf(Health<75,2)
	NTCL MNO 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCL P 1 A_JumpIf(Health<50,2)
	NTCH ABC 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	NTCH D 1 A_JumpIf(Health<25,2)
	NTCH EF 1
	NTCG A 5
	Goto ReadyMain
  Flash:
    TNT1 A 3 A_Light2
    TNT1 A 6 A_Light2
    TNT1 A 0 A_Light0
    Stop	
  Zoom:
    PCFN A 0 A_JumpIfInventory("ZoomReFire",1,"PunchHoes")
	NTCH FEDCBA 1
	SDKU A 0 A_GiveInventory("ZoomReFire",1)
  PunchHoes:
	QML1 A 0 A_Gunflash("PunchFlash", GFF_NOEXTCHANGE)
	QML1 A 0 A_JumpIfInventory("PowerStrength2",1,2)
    QML1 A 0 A_Jump(256,3)
  	FML1 A 0 A_SetBlend("Orange",0.05,10)
	FML1 A 0 A_PlaySound("Melee/Firepunch",0)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<75,2)
	"####" A 1 A_SetPitch(pitch-0.3)
	"####" B 1 A_SetPitch(pitch-0.3)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<50,2)
	"####" C 1 A_SetPitch(pitch-0.3)
	"####" D 1 A_SetPitch(pitch-0.3)
	"####" A 0 A_JumpIfInventory("PowerStrength2",1,3)
	"####" A 0 A_CustomPunch(30, 1, 0, "PunchCracker", 100)
	"####" A 0 A_Jump(256,2)
	"####" A 0 A_CustomPunch(150, 1, 0, "FlamePunchCracker", 150)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<25,2)
	"####" E 1 A_SetPitch(pitch+0.3)
	"####" F 1 A_SetPitch(pitch+0.3)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<75,2)
	"####" G 1 A_SetPitch(pitch+0.3)
	"####" H 1 A_SetPitch(pitch+0.3)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<50,2)
	"####" I 1
	"####" J 1
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<25,2)
	"####" K 1
	TNT1 A 5
	TNT1 A 0 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH|WRF_ALLOWZOOM)
	NTCH ABCDEF 1
	FMGU A 0 A_TakeInventory("ZoomReFire",1)
	Goto ReadyMain
  PunchFlash:
	NTCG D 1 A_PlaySound("Punch/Swing",6,1.0)
	NTCM ABC 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<75,2)
	NTCM BA 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<50,2)
	NTCG DD 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<25,2)
	NTCG DD 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<75,2)
	NTCG DD 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<50,2)
	NTCG DD 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<25,2)
	NTCG DD 1
	Stop
  CaberToss:
  	NTCG A 1 A_JumpIfInventory("MacheteAmmo",1,1)
	Goto ReadyMain
	MCHT A 0 A_TakeInventory("MacheteAmmo",1)
	NTCU DCBA 1

    TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	TNT1 A 1 A_JumpIf(Health<75,1)
	TNT1 A 1
    TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	TNT1 A 1 A_JumpIf(Health<50,1)
	TNT1 A 1
    TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	TNT1 A 1 A_JumpIf(Health<25,1)
	TNT1 A 1
    MC4S A 0 A_PlaySound("Machete1/Slash",1,0.9)
    MC4S A 0 A_PlaySound("Machete2/Slash",5,0.2)
	MCHT ABC 1
	TNT1 A 0 A_JumpIfInventory("PowerStrength2",1,3)
	MCHT A 0 A_SpawnItemEX("MacheterangProjectile",cos(-pitch)*48,0,32+(sin(-pitch)*48),cos(-pitch)*35,0,sin(-pitch)*35,0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	TNT1 A 0 A_Jump(256,2)
	MCHT A 0 A_SpawnItemEX("MacheterangBerserkProjectile",cos(-pitch)*48,0,32+(sin(-pitch)*48),cos(-pitch)*25,0,sin(-pitch)*25,0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	// This solution is ten times better. Just let it bouncecount out.
    TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	MCHT D 1 A_JumpIf(Health<75,1)
	MCHT E 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	MCHT F 1 A_JumpIf(Health<50,1)
	MCHT G 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	MCHT H 1 A_JumpIf(Health<25,1)
	MCHT I 1
	TNT1 A 3

	NTCU ABCD 1
	Goto ReadyMain
  Spawn:
    NTCG X -1
    Stop
	}
}

ACTOR NutcrackerBullet : FastProjectile
{
  Radius 19
  Height 14
  MissileHeight 14
  Speed 200
  Damage (20*random(1,5))
  Projectile
  +NOGRAVITY
  +RIPPER
  Renderstyle Add
  Obituary "%o had the very unfortunate situation to land in the %k's ''Nutcracker'' line of fire. Nothing was left after."
  Scale 1
  MissileType "NutcrackerTrail"
  Decal "NutcrackerChip"
  var int User_Counter;
  States
  {
  Spawn:
    TRAC A 0 NoDelay A_PlaySound("Nutcracker/Fly",5,0.8,1)
	TRAC A 1 Bright A_ChangeVelocity(0, 0, -0.15, CVF_RELATIVE)
	Loop
  Death:
	TNT1 A 0 A_SetUserVar("User_Counter",40)
  Looplet:
    TNT1 A 0 A_JumpIf(User_Counter <= 0, "Rest")
    TNT1 A 0 A_SetUserVar("User_Counter", User_Counter - 1)
	TNT1 A 0 A_SpawnItemEx("NutcrackerShatterBullet",0,0,0,frandom(125.0,100.0),0,-frandom(12.0,-12.0),frandom(0.0,360.0),SXF_TRANSFERPOINTERS,0)
	Loop
  Rest:
    TNT1 A 0 A_PlaySound("Nutcracker/Hit",5,0.8)
	TNT1 A 0 A_SpawnItemEx("NutcrackerPuff",0,0,0,0,0,0,0,SXF_CLIENTSIDE,0)
	TNT1 A 25 A_Quake(4,25,0,384,"none")
    Stop
  /*XDeath:
	TNT1 A 1
	Stop*/
  }
}

ACTOR NutcrackerShatterBullet : FastProjectile
{
  Radius 11
  Height 7
  MissileHeight 11
  Speed 125
  Damage (5*random(1,5))
  Projectile
  +NOGRAVITY
  +BLOODLESSIMPACT
  +FORCERADIUSDMG
  Renderstyle Add
  Obituary "%o was caught by stray ''Nutcracker'' impact pellet."
  Scale 0.5
  MissileType "ThrottleTrail"
  Decal "BulletChip2"
  States
  {
  Spawn:
	TRAC A 1 Bright A_ChangeVelocity(0, 0, -0.4, CVF_RELATIVE)
	Loop
  Death:
	TNT1 A 1 A_SpawnItemEx("BuellerPuff")
  XDeath:
	TNT1 A 0 A_Explode(90,96,0)
	Stop
  }
}

ACTOR NutcrackerTrail
{
	+NOINTERACTION
	+NOGRAVITY
	+FORCERADIUSDMG
	Renderstyle Add
	Alpha 0.5
	Scale 0.05
	DamageType IncreasedRange //So people won't obliterate themselves while using it.
	//I can't figure for life how the pointers are set up (if they are at all)
	//in this thing. And it works like a good DM nerf, anyway.
	States
	{
	Spawn:
	NTCT A 0 NoDelay A_Explode((50*random(1,5)),56,0)
	Looplet:
	NTCT A 1 Bright A_FadeOut(random(0.15,0.2))
	NTCT A 0 A_SetScale(ScaleX+0.05)
	Loop
	}
}