// Vorpal Blade (Demon Eclipse)

ACTOR Blade : IDMWeapon
{
   Inventory.PickupMessage "Vorpal Blade! (Slot 1)"
   Tag "Vorpal Blade"
   Inventory.PickupSound "misc/w_pkup"
   Obituary "%o was sliced and diced by %k's Vorpal Blade."
   //Weapon.PreferredSkin "BladeMarine"
   Weapon.AmmoType "BladeCharge"
   Weapon.SelectionOrder 1400
   Weapon.AmmoUse 100
   Weapon.AmmoGive 0
   Weapon.SisterWeapon "Blade2"
   Damagetype "Blade"
   +AMMO_OPTIONAL
   +WEAPON.NOLMS
   +WEAPON.AXEBLOOD
   AttackSound "weapons/vblhit"
   States
   {
   Spawn:
      WVBL A -1 Bright
      Loop
   Ready:
      TNT1 A 0 A_JumpIfInventory("BladeCharge",100,"IdleLevel3")
      TNT1 A 0 A_JumpIfInventory("BladeCharge",50,"IdleLevel2")
	  VBLG A 12 A_WeaponReady
	  TNT1 A 0 A_GiveInventory("BladeCharge",1)
	  Loop
   IdleLevel2:
      VB2G A 3 A_WeaponReady
      VB2G B 3 A_WeaponReady
      VB2G A 3 A_WeaponReady
      VB2G B 3 A_WeaponReady
	  TNT1 A 0 A_GiveInventory("BladeCharge",1)
      Goto Ready
   IdleLevel3:
      VB3G ABC 3 A_WeaponReady
      Goto Ready
   Deselect:
	  TNT1 A 0 A_Lower
	  TNT1 A 0 A_Lower
      VBLG A 1 A_Lower
      Loop
   Select:
	  TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
	Sloop:
	  TNT1 A 0 A_Raise
	  TNT1 A 0 A_Raise
      VBLG A 1 A_Raise
      Loop
   Fire:
	  TNT1 A 0 A_GiveInventory("BladeCharge",1)
      TNT1 A 0 A_JumpIfInventory("BladeCharge",100,"Charge100")
      TNT1 A 0 A_JumpIfInventory("BladeCharge",50,"Charge50")
      VBLG B 1
      TNT1 A 0 A_SetReflective
      VBLG C 1 A_PlayWeaponSound("monster/hamswg")
      VBLG D 1
	  TNT1 A 0 A_GunFlash
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
      VBLG EF 1 A_CustomPunch(random(200,250),1,0,"BladePuff1",116)
      VBLG G 1
      NULL A 11 A_UnSetReflective
      VBLG J 1
      VBLG IH 1
      Goto Ready
   Charge50:
      VB2G C 1
      TNT1 A 0 A_SetReflective
      VB2G D 1 A_PlayWeaponSound("monster/hamswg")
      VB2G E 1
	  TNT1 A 0 A_GunFlash
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad2")
      VB2G FG 1 A_CustomPunch(random(300,375),1,0,"BladePuff2",116)
      VB2G H 1
      NULL A 11 A_UnSetReflective
      VBLG J 1
      VBLG IH 1
      Goto Ready
   Charge100:
      VB3G D 1
      TNT1 A 0 A_SetReflective
      VB3G E 1 A_PlayWeaponSound("weapons/vblswg")
      VB3G F 1
	  TNT1 A 0 A_GunFlash
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad3")
      TNT1 A 0 A_FireCustomMissile("BladeSlash",0,1,0,0)
      VB3G GH 1 A_CustomPunch(random(400,500),1,0,"BladePuff3",116)
      VB3G I 1
      NULL A 11 A_UnSetReflective
      VBLG J 1
      VBLG IH 1
      Goto Ready
	Quad:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO)
      VBLG EF 1 A_CustomPunch(random(200,250),1,0,"ExtremeBladePuff1",116)
	  Goto Fire+11
	Quad2:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO)
      VB2G FG 1 A_CustomPunch(random(300,375),1,0,"ExtremeBladePuff2",116)
	  Goto Charge50+8
	Quad3:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO)
      TNT1 A 0 A_FireCustomMissile("BladeSlash",0,1,0,0)
      VB3G GH 1 A_CustomPunch(random(400,500),1,0,"ExtremeBladePuff3",116)
	  Goto Charge100+9
	Flash:
	  TNT1 A 1
	  Goto LightDone
    }
}

ACTOR Blade2 : Blade
{
   Weapon.SisterWeapon "Blade"
   Damagetype "Saw"
   +POWERED_UP
   States
   {
   Ready:
      VB3G ABC 3 A_WeaponReady
      Loop
   Fire:
      VB3G D 1
      TNT1 A 0 A_SetReflective
      VB3G E 1 A_PlayWeaponSound("weapons/vblswg")
      VB3G F 1
	  TNT1 A 0 A_GunFlash
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
      TNT1 A 0 A_FireCustomMissile("BladeSlash",0,1,0,0)
      TNT1 A 0 A_FireCustomMissile("BladeSlash",0,1,0,0)
      VB3G GH 1 A_CustomPunch(random(600,1200),1,0,"BladePuff4",116)
      VB3G I 1
	  TNT1 A 0 A_JumpIfInventory("PowerRageInvulnerable",1,"Rage4")
      TNT1 A 0 A_UnSetReflective
	Rage4:
      NULL A 13 A_UnSetReflective
      VBLG J 1
      VBLG IH 1
      Goto Ready
	Quad:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO)
      TNT1 A 0 A_FireCustomMissile("BladeSlash",0,1,0,0)
      TNT1 A 0 A_FireCustomMissile("BladeSlash",0,1,0,0)
      VB3G GH 1 A_CustomPunch(random(600,1200),1,0,"BladePuff4",116)
	  Goto Fire+10
   }
}

ACTOR BladeSlash
{
   Radius 8
   Height 16
   Speed 40
   Damage (200 + 50 * random(1,4))
   PROJECTILE
   RENDERSTYLE ADD
   ALPHA 0.75
   Damagetype "RedPlasma"
   +THRUGHOST
   +RIPPER
   +EXTREMEDEATH
   +SKYEXPLODE
   -NOTELEPORT
   Obituary "%o was sliced and diced by %k's Vorpal Blade."
   States
   {
   Spawn:
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      VFX4 A 1 Bright A_SpawnItem("SlashTrail",0,0)
      VFX4 A 0 Bright A_Explode(200,64,0)
      Loop
	Death:
	  TNT1 A 1
	  Stop
   }
}

ACTOR SlashTrail
{
   Radius 3
   Height 3
   PROJECTILE
   RENDERSTYLE ADD
   ALPHA 0.80
   +CLIENTSIDEONLY
   States
   {
   Spawn:
      NULL A 1
      VFX4 A 2 Bright A_FadeOut(0.10)
      Goto Spawn+1
   }
}

ACTOR BladePuff1
{   
   Radius 0
   Height 1
   Speed 0
   PROJECTILE
   RENDERSTYLE Translucent
   ALPHA 0.50
   +PUFFONACTORS
   +LOOKALLAROUND
   States
   {
   Spawn:
      VFX2 A 0
      VFX2 A 1 A_PlaySound("weapons/vblhit")
      VFX2 A 2 A_SpawnItem("BladeChargeGiver",0,0)
      VFX2 BCDE 3
      Stop
   Crash:
      VFX2 A 0
      VFX2 A 3 A_PlaySound("weapons/vblwal")
      VFX2 BCDE 3
      Stop
   }
}

ACTOR ExtremeBladePuff1 : BladePuff1
{
	States
	{
	XDeath:
	  TNT1 A 0 A_playsound("misc/crit",CHAN_AUTO)
	  Goto Spawn
	}
}

ACTOR BladePuff2
{   
   Radius 0
   Height 1
   Speed 0
   PROJECTILE
   RENDERSTYLE ADD
   ALPHA 0.85
   +PUFFONACTORS
   +LOOKALLAROUND
   States
   {
   Spawn:
      VFX3 A 0 
      VFX3 A 1 Bright A_PlaySound("weapons/vblhi2")
      VFX3 A 0 Bright A_SpawnItem("BladeHealthGiver",0,0)
      VFX3 A 2 Bright A_SpawnItem("BladeChargeGiver",0,0)
      VFX3 BCDEFGHIJ 3 Bright
      Stop
   Crash:
      VFX1 A 0
      VFX1 A 3 Bright A_PlaySound("weapons/vblwa2")
      VFX1 BCDEFG 3 Bright
      Stop
   }
}

ACTOR ExtremeBladePuff2 : BladePuff2
{
	States
	{
	XDeath:
	  TNT1 A 0 A_playsound("misc/crit",CHAN_AUTO)
	  Goto Spawn
	}
}

ACTOR BladePuff3 : BladePuff2
{   
   States
   {
   Spawn:
      VFX6 A 0 
      VFX6 A 1 Bright A_PlaySound("weapons/vblhi3")
      VFX6 A 0 Bright A_SpawnItem("BladeHealthGiver2",0,0)
      VFX6 A 2 Bright A_SpawnItem("BladeChargeGiver",0,0)
      VFX6 BCDE 3 Bright
      Stop
   Crash:
      VFX5 A 0
      VFX5 A 3 Bright A_PlaySound("weapons/vblwa2")
      VFX5 BCDEFG 3 Bright
      Stop
   }
}

ACTOR ExtremeBladePuff3 : BladePuff3
{
	States
	{
	XDeath:
	  TNT1 A 0 A_playsound("misc/crit",CHAN_AUTO)
	  Goto Spawn
	}
}

ACTOR BladePuff4 : BladePuff2
{   
   States
   {
   Spawn:
      VFX6 A 0 
      VFX6 A 1 Bright A_PlaySound("weapons/vblhi3")
      VFX6 A 0 Bright A_SpawnItem("BladeHealthGiver3",0,0)
      VFX6 A 2 Bright A_SpawnItem("BladeChargeGiver",0,0)
      VFX6 BCDE 3 Bright
      Stop
   Crash:
      VFX5 A 0
      VFX5 A 3 Bright A_PlaySound("weapons/vblwa2")
      VFX5 BCDEFG 3 Bright
      Stop
   }
}

ACTOR ExtremeBladePuff4 : BladePuff4
{
	States
	{
	XDeath:
	  TNT1 A 0 A_playsound("misc/crit",CHAN_AUTO)
	  Goto Spawn
	}
}

ACTOR BladeChargeGiver
{   
   Radius 0
   Height 1
   Speed 0
   PROJECTILE
   RENDERSTYLE NONE
   +LOOKALLAROUND
   +NOCLIP
   States
   {
   Spawn:
      NULL A 0 
      NULL A 1 Bright A_Look
      loop
   See:
	  TNT1 A 0
      NULL A 0 Bright A_FaceTarget
      NULL A 0 Bright A_FaceTarget
      NULL A 3 Bright A_GiveToTarget("BladeCharge",10)
      NULL A 3 Bright
      stop
   }
}

ACTOR BladeHealthGiver
{   
   Radius 0
   Height 1
   Speed 0
   PROJECTILE
   RENDERSTYLE NONE
   +LOOKALLAROUND
   +NOCLIP
   States
   {
   Spawn:
      NULL A 0 
      NULL A 1 Bright A_Look
      loop
   See:
	  TNT1 A 0
      NULL A 0 Bright A_FaceTarget
      NULL A 0 Bright A_FaceTarget
      NULL A 3 Bright A_GiveToTarget("Health",25)
      NULL A 3 Bright
      stop
   }
}

ACTOR BladeHealthGiver2 : BladeHealthGiver
{   
   States
   {
   Spawn:
      NULL A 0 
      NULL A 1 Bright A_Look
      loop
   See:
      NULL A 0 Bright A_FaceTarget
      NULL A 0 Bright A_FaceTarget
      NULL A 3 Bright A_GiveToTarget("Health",50)
      NULL A 3 Bright
      stop
   }
}

ACTOR BladeHealthGiver3 : BladeHealthGiver
{   
   States
   {
   Spawn:
      NULL A 0 
      NULL A 1 Bright A_Look
      loop
   See:
	  TNT1 A 0
      NULL A 0 Bright A_FaceTarget
      NULL A 0 Bright A_FaceTarget
      NULL A 3 Bright A_GiveToTarget("Health",75)
      NULL A 3 Bright
      stop
   }
}

ACTOR BladeCharge : Ammo
{
   RENDERSTYLE NONE
   Inventory.Amount 100
   Inventory.MaxAmount 100
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 100
   Inventory.PickupMessage "Blade Charged."
   Inventory.Icon STTPRCNT
   +INVENTORY.IGNORESKILL
}