/*
CREDITS:

Sprites:
Weapon - 3DRealms (LameDuke)
Energy projectile, trail - LucasArts, Raven (JKII: Jedi Outcast)
Cannoneer projectile - Vaecrius, methinks

Sounds:
Up, In, Mode - ?
Fire - ID (Doom 3)
Flight - ?
Turbo Doc, Shield sounds - Raven (Wolfenstein 3)
Energy fire, impact - LucasArts, Raven (JKIII: Jedi Academy)
Cannoneer dry - ?
Energy dry - Raven (Wolfenstein 3)

Shield by Captain Toenail!
*/

actor Libra : Weapon 24518
{
  //$Category Weapons
  //$Title Libra
  //$Sprite RIPGX0
  inventory.pickupsound "misc/w_pkup"
  inventory.pickupmessage "You got the ''Libra'' minicannon! Screw balance of power, it's domination time! (4)"
  obituary "%o was measured, and didn't meet up with the weight class to be a boxer.\nHe was turned into a luncheon meat instead by %k's ''Libra''."
  weapon.upsound "Weapons/LibraUp"
  Weapon.SelectionOrder 5
  weapon.ammotype1 "Boolet"
  weapon.ammotype2 "PlasmaAmmo"
  weapon.ammogive1 40
  weapon.ammogive2 5
  weapon.ammouse1 0
  weapon.ammouse2 0
  weapon.slotnumber 4
  weapon.kickback 65
  Scale 0.85
  +NOALERT
  +AMMO_OPTIONAL
  +ALT_AMMO_OPTIONAL
  +NOAUTOAIM
  states
  {
  Spawn:
    RIPG X -1
    stop
  Ready:
    RIPR A 0 A_PlaySound("Weapons/LibraIn")
    RIPR HIJKLMN 1
  ReadyMain:
    RIPG A 0 A_PlaySound("Weapons/LibraShield",6,1.0,1)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPG A 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("RO_GotoReload", 1, "Reload")
	TNT1 A 0 A_JumpIfInventory("RO_GotoZoom", 1, "Zoom")
    Loop
  Deselect:
	TNT1 A 0 A_TakeInventory("DoctorModeLoop")
    RIPG A 0 ACS_Execute(711,0,100,0,0)
    RIPG A 0 A_StopSound(6)
    RIPG A 0 A_ZoomFactor(1)
    RIPG BC 1 A_Lower
    RIPR ABCDEF 1 A_Lower
  DeselectLooplet:
    RIPR G 1 A_Lower
    TNT1 A 0 A_Lower
    loop
  Select:
    RIPR G 1 A_Raise
    RIPR G 0 A_Raise
    loop
  Fire:
    TNT1 A 0 A_JumpIfInventory("CubeInfiniteAmmo",1,"POOT")
    TNT1 A 0 A_JumpIfInventory("ExtremeAmmo",1,"POOT")
    TNT1 A 0 A_JumpIfInventory("Boolet",4,"POOT")
    Goto DryBoolet
  POOT:
    TNT1 A 0 A_StopSound(6)
    TNT1 A 0 A_PlaySound("Weapons/LibraFire",1)
    TNT1 A 0 A_TakeInventory("Boolet",1,TIF_NOTAKEINFINITE)
    TNT1 A 0 A_GiveInventory("BooletCasing",1)
    TNT1 A 0 A_JumpIfInventory("Boolet",4,1)
	TNT1 A 0 A_JumpIfInventory("CaliberUpgrade",1,"ILikeBigTrainsAndICannotLie")
    TNT1 A 0 A_FireCustomMissile("LibraBullet", frandom(-2,2), 1, 9+frandom(-1,1), -3, 0, frandom(-1,1))
	Goto Hon
  ILikeBigTrainsAndICannotLie:
	TNT1 A 0 A_PlaySound("Weapons/WolgirEndFire",5)
	TNT1 A 0 A_FireCustomMissile("CaliberLibraBullet", frandom(-2,2), 1, 9+frandom(-1,1), -3, 0, frandom(-1,1))
  Hon:
	TNT1 A 0 A_GunFlash
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_Recoil(0.2)
    TNT1 A 0 ACS_Execute(851,0,20+random(2,-2),15+random(2,-2))
    RIPF A 1 BRIGHT A_ZoomFactor(0.97) //A_FireBullets (6.5,2.5, 2, 6, "BulletPuff", 1) 
    RIPF B 1 BRIGHT A_ZoomFactor(0.98)
    RIPT A 1 A_ZoomFactor(0.99)

    TNT1 A 0 A_PlayWeaponSound("Weapons/LibraFire")
    TNT1 A 0 A_TakeInventory("Boolet",1,TIF_NOTAKEINFINITE)
    TNT1 A 0 A_GiveInventory("BooletCasing",1)
	TNT1 A 0 A_JumpIfInventory("CaliberUpgrade",1,"ToasterSupreme")
    TNT1 A 0 A_FireCustomMissile("LibraBullet", frandom(-2,2), 1, 9+frandom(-1,1), -3, 0, frandom(-1,1))
	Goto HonHon
  ToasterSupreme:
	TNT1 A 0 A_PlaySound("Weapons/WolgirEndFire",5)
	TNT1 A 0 A_FireCustomMissile("CaliberLibraBullet", frandom(-2,2), 1, 9+frandom(-1,1), -3, 0, frandom(-1,1))
  HonHon:
	TNT1 A 0 A_GunFlash
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_Recoil(0.2)
    TNT1 A 0 ACS_Execute(851,0,20+random(2,-2),15+random(2,-2))
    RIPF C 1 BRIGHT A_ZoomFactor(0.97)
    RIPF D 1 BRIGHT A_ZoomFactor(0.98)
    RIPT B 1 A_ZoomFactor(0.99)

    TNT1 A 0 A_PlayWeaponSound("Weapons/LibraFire")
    TNT1 A 0 A_TakeInventory("Boolet",1,TIF_NOTAKEINFINITE)
    TNT1 A 0 A_GiveInventory("BooletCasing",1)
	TNT1 A 0 A_JumpIfInventory("CaliberUpgrade",1,"LostTrackAlready")
    TNT1 A 0 A_FireCustomMissile("LibraBullet", frandom(-2,2), 1, 9+frandom(-1,1), -3, 0, frandom(-1,1))
	Goto HonHonHon
  LostTrackAlready:
	TNT1 A 0 A_PlaySound("Weapons/WolgirEndFire",5)
	TNT1 A 0 A_FireCustomMissile("CaliberLibraBullet", frandom(-2,2), 1, 9+frandom(-1,1), -3, 0, frandom(-1,1))
  HonHonHon:
    TNT1 A 0 A_GunFlash
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_Recoil(0.2)
    TNT1 A 0 ACS_Execute(851,0,20+random(2,-2),15+random(2,-2))
    RIPF E 1 BRIGHT A_ZoomFactor(0.97)
    RIPF F 1 BRIGHT A_ZoomFactor(0.98)
    RIPT C 1 A_ZoomFactor(0.99)

    TNT1 A 0 A_PlayWeaponSound("Weapons/LibraFire")
    TNT1 A 0 A_TakeInventory("Boolet",1,TIF_NOTAKEINFINITE)
    TNT1 A 0 A_GiveInventory("BooletCasing",1)
    TNT1 A 0 A_JumpIfInventory("CaliberUpgrade",1,"AyeThatsRightThisCodeIsAMess")
    TNT1 A 0 A_FireCustomMissile("LibraBullet", frandom(-2,2), 1, 7+frandom(-1,1), -9, 0, frandom(-1,1))
	Goto HonHonHonHon
  AyeThatsRightThisCodeIsAMess:
	TNT1 A 0 A_PlaySound("Weapons/WolgirEndFire",5)
	TNT1 A 0 A_FireCustomMissile("CaliberLibraBullet", frandom(-2,2), 1, 7+frandom(-1,1), -9, 0, frandom(-1,1))
  HonHonHonHon:
    TNT1 A 0 A_GunFlash
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_Recoil(0.2)
    TNT1 A 0 ACS_Execute(851,0,20+random(2,-2),15+random(2,-2))
    RIPF G 1 BRIGHT A_ZoomFactor(0.97)
    RIPF H 1 BRIGHT A_ZoomFactor(0.98)
    RIPT D 1 A_ZoomFactor(0.99)

    TNT1 A 0 A_ReFire
    RIPG A 0 A_ZoomFactor(1)
	RIPG AAAAAA 1 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    Goto ReadyMain
  Reload:
  Zoom:
    TNT1 A 0 A_JumpIfInventory("DoctorModeLoop",1,"TurboDoctorLoop")
    TNT1 A 0 A_JumpIfInventory("BooletCasing",12,1)
	Goto DryEnergy
    TNT1 A 0 A_PlaySound("Weapons/LibraStart",5,1.0)
    TNT1 A 0 A_PlaySound("Weapons/LibraLoop",6,1.0,1)
    TNT1 A 0 ACS_Execute(711,0,150,0,0)
    TNT1 A 0 A_ZoomFactor(0.875)
  TurboDoctorLoop:
    TNT1 A 0 A_JumpIfInventory("BooletCasing",12,1)
	Goto DryEnergyRanOutInProcess
	TNT1 A 0 A_GiveInventory("DoctorModeLoop",1)
    TNT1 A 0 A_Quake(2,12,0,2,none)

    TNT1 A 0 A_AlertMonsters
    RIPG A 1 Offset(2,34)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
    RIPG A 1 Offset(0,32)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
	
    TNT1 A 0 A_AlertMonsters
    RIPG A 1 Offset(1,31)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
    RIPG A 1 Offset(-1,33)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
	
	TNT1 A 0 A_AlertMonsters
    RIPG A 1 Offset(2,32)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
    RIPG A 1 Offset(1,33)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
	
	TNT1 A 0 A_AlertMonsters
    RIPG A 1 Offset(0,32)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
    RIPG A 1 Offset(2,30)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
	
    TNT1 A 0 A_AlertMonsters
    RIPG A 1 Offset(-2,34)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
    RIPG A 1 Offset(0,32)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
	
	TNT1 A 0 A_AlertMonsters
    RIPG A 1 Offset(0,30)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
    RIPG A 1 Offset(1,31)
	TNT1 A 0 A_SetBlend("Blue",0.125,11)
	TNT1 A 0 A_SpawnItemEx("LibraGLDEF")
	TNT1 A 0 A_GiveInventory("MinorHp",1)
	TNT1 A 0 A_TakeInventory("BooletCasing",1)
	TNT1 AA 0 A_SpawnItemEx("LibraHpFX", random(15,-15), random(15,-15), 30+random(15,-15), 0, 0, 0.1*random(3,7), 0, 128, 0)
	TNT1 A 0 A_JumpIfInventory("RO_GotoReload", 1, "Reload")
	TNT1 A 0 A_JumpIfInventory("RO_GotoZoom", 1, "Zoom")
    RIPG A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	RIPG A 0 A_StopSound(6)
	TNT1 A 0 A_TakeInventory("DoctorModeLoop",1)
    TNT1 A 0 ACS_Execute(711,0,100,0,0)

    RIPG A 0 Offset(0,32) A_PlaySound("Weapons/LibraEnd",5)
    RIPG A 0 A_ZoomFactor(1)
	RIPG AAAAAAAAAAAA 1 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    Goto ReadyMain
  AltFire:
    TNT1 A 0 A_JumpIfInventory("CubeInfiniteAmmo",1,"POOTIS")
    TNT1 A 0 A_JumpIfInventory("ExtremeAmmo",1,"POOTIS")
    TNT1 A 0 A_JumpIfInventory("PlasmaAmmo",5,"POOTIS")
    Goto DryEnergy
  POOTIS:
    TNT1 A 0 A_TakeInventory("PlasmaAmmo",5,TIF_NOTAKEINFINITE)
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_GunFlash
    TNT1 A 0 A_Recoil(8)
    TNT1 A 0 ACS_Execute(851,0,40+random(5,-5),20+random(5,-5))
    TNT1 A 0 A_FireCustomMissile("LibraPowerBolt", 0, 1, 7+frandom(-1,1), -3, 0, 0)
    TNT1 A 0 A_PlaySoundEx ("Weapons/LibraBoltFire", "SoundSlot5")
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPE A 1 BRIGHT A_ZoomFactor(0.95)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPE B 1 BRIGHT A_ZoomFactor(0.97)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPE C 1 BRIGHT A_ZoomFactor(0.98)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPE D 1 BRIGHT A_ZoomFactor(0.99)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPE E 1 A_ZoomFactor(0.995)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPE F 1 A_ZoomFactor(1)
    RIPE GHI 1 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPG AAAAAAAAAAAAAAA 1 A_SpawnItemEx("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    Goto ReadyMain
  Ting:
    RIPR OPQRQPO 1
    Goto ReadyMain
  DryBoolet:
    TNT1 A 0 A_Quake(1,8,0,2,none)
    RIPG A 0 A_PlaySound("Weapons/LibraDry1")
    Goto Dry
  DryEnergyRanOutInProcess:
    RIPG A 0 A_StopSound(6)
    RIPG A 0 A_ZoomFactor(1)
	TNT1 A 0 A_TakeInventory("DoctorModeLoop")
    RIPG A 0 ACS_Execute(711,0,100,0,0)
    RIPG A 0 A_PlaySound("Weapons/LibraEnd",5)
  DryEnergy:
    TNT1 A 0 A_Quake(1,8,0,2,none)
    RIPG A 0 A_PlaySound("Weapons/LibraDry2")
    Goto Dry
  Dry:
    RIPG A 1 Offset(1,33) A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPG A 1 Offset(3,35) A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPG A 1 Offset(4,36) A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPG A 1 Offset(3,35) A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPG A 1 Offset(2,34) A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPG A 1 Offset(1,33) A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPG A 1 Offset(0,32) A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    RIPG AAAAAAAA 1 A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    Goto ReadyMain
  Flash:
    TNT1 A 4 bright A_Light1
    TNT1 A 6 bright A_Light2
    TNT1 A 0 bright A_Light0
    Stop
  }
}

//Triggers

ACTOR DoctorModeLoop : Inventory {	Inventory.MaxAmount 1	}

//Cannoneer

ACTOR LibraBullet : FastProjectile
{
	Radius 2
	Height 2
	Speed 170
	Damage 30
	PROJECTILE
	Scale 0.75
	Obituary "%o was turned into exploded mincemeat, thanks to %k's 22.7mm bullet galore."
	MissileType "LibraTrailSpawner"
	+THRUGHOST
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 ThrustThingZ(0,4,0,1)
	TNT1 A 0 A_PlaySoundEx("Weapons/LibraFly", "SoundSlot5",1)
	Looplet:
	TNT1 A 0 ThrustThingZ(0,random(-1,-2),0,1)
	ROCQ A 1 Bright
	Loop
	Death:
	TNT1 A 0 A_StopSoundEx("SoundSlot5")
	TNT1 A 0 A_JumpIfInTargetInventory("NukerUpgrade",1,"NukerDeath")
	TNT1 A 0 A_Explode(20,64,0)
	TNT1 A 0 A_SpawnItemEx("PelletExplode",0,0,0,0,0,0,0,128,0)
	TNT1 BCD 4
	stop
	NukerDeath:
	TNT1 A 0 A_Explode(40,96,0)
	TNT1 A 0 A_SpawnItemEx("NukerPelletExplode",0,0,0,0,0,0,0,128,0)
	TNT1 BCD 4
	stop
	}
}

ACTOR CaliberLibraBullet : LibraBullet
{
	Damage 60
}

ACTOR LibraBulletTrail
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	Scale 0.75
	Alpha 0.1
	Renderstyle Normal
	States
	{
		Spawn:
			TNT1 A 0
			ROCQ A 1 Bright A_FadeOut(0.05)
			Wait
	}
}

ACTOR LibraSmokeTrail
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	Alpha 0.075
	Scale 0.15
	Renderstyle Normal
	States
	{
		Spawn:
			TNT1 A 0
 			TNT1 A 0 A_FadeOut(0.005)
 		Looplet:
			//TNT1 A 0 A_SetScale(ScaleX +0.005, ScaleY +0.005)
			SMKE A 1 A_FadeOut(0.005)
			Loop
	}
}

ACTOR LibraTrailSpawner
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	States
	{
		Spawn:
			SMOK A 0
  			SMOK A 0 A_SpawnItemEx("LibraBulletTrail",0,0,10,0,0,0,0,128,0)
 			SMOK A 0 A_SpawnItemEx("LibraSmokeTrail",-6,0,10,frandom(-1,-2),0,frandom(0,1),random(-3,3),128,0)
			sTOP
	}
}

//Blaster

ACTOR LibraPowerBolt : FastProjectile
{
	Speed 50
	Damage 400
	PROJECTILE
	BounceType Hexen
	BounceCount 4
	BounceFactor 1
	Obituary "%o had a heart-warming accident, starring %k's flat plasma bolt as the cause of the said situation."
	MissileType "LibraPowerTrailSpawner"
	+DONTBLAST
	+EXPLODEONWATER
	+THRUGHOST
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 ThrustThingZ(0,10,0,1)
	TNT1 A 0 A_PlaySoundEx("Weapons/LibraFly", "SoundSlot5",1)
	Looplet:
	TNT1 A 0 ThrustThingZ(0,random(0,-1),0,1)
	TNT1 A 1
	Loop
	Death:
	TNT1 A 0 A_StopSoundEx("SoundSlot5")
	TNT1 A 0 A_PlaySound("Weapons/LibraBoltHit")
	TNT1 A 0 A_Explode(250,164,0,1)
    TNT1 A 0 A_SpawnItemEx("VindicatorHit",0,0,0,0,0,0,0,128,0)
    TNT1 A 0 A_SpawnItemEx("LibraPowerBoltHit",0,0,0,0,0,0,0,128,0)
    TNT1 A 0 A_SpawnItemEx("LibraGLDEFExp",0,0,0,0,0,0,0,128,0)
	TNT1 C 25
	stop
	}
}

ACTOR LibraPowerBoltTrail
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	XScale 0.06
	YScale -0.04
	Alpha 0.5
	Renderstyle Normal
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 //A_SetScale(ScaleX+0.05, ScaleY-0.05)
		Toopoo:
			LIBP A 1 Bright
			Stop
	}
}

ACTOR LibraPowerSmokeTrail
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	Alpha 0.3
	XScale 0.15
	YScale 0.095
	Renderstyle Add
	States
	{
		Spawn:
			LIBS A 0
			LIBS A 0 //A_SetScale(ScaleX+0.05, ScaleY-0.05)
 			LIBS A 0 A_FadeOut(0.005)
 		Looplet:
			LIBS A 1 A_FadeOut(0.005)
			Loop
	}
}

ACTOR LibraPowerTrailSpawner
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 A 0
  			TNT1 A 0 A_SpawnItemEx("LibraPowerBoltTrail",-6,0,10,0,0,0,0,128,0)
 			TNT1 A 0 A_SpawnItemEx("LibraPowerSmokeTrail",-16,0,10,frandom(-1,-2),0,0,random(-3,3),128,0)
			Stop
	}
}
ACTOR LibraPowerBoltHit
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	XScale 0.07
	YScale -0.005
	Alpha 0.75
	Renderstyle Normal
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 //A_SetScale(ScaleX+0.05, ScaleY-0.025)
		Toopoo:
			LIBP A 1 Bright //A_SetScale(ScaleX+0.1, ScaleY+0.1)
			LIBP A 0 A_FadeOut(0.15)
			Loop
	}
}

ACTOR LibraGLDEFExp
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 A 35
			Stop
	}
}


//Libra Shield, courtesy of Capt'n Toenail's Shield!

actor ShieldPart
{
  Radius 8
  Height 8
  Scale 0.5
  RenderStyle None
  Alpha 0.15
  BloodType "ShieldHit"
  +SHOOTABLE
  +NOGRAVITY
  +NOTELEPORT
  +NODAMAGE
  +DONTRIP
  +NOBLOODDECALS
  +FLOORCLIP
  +REFLECTIVE
  +GHOST
  States
  {
  Spawn:
    SHIE A 2 bright
    stop
  Death:
    TNT1 A 2
    stop
  }
}

actor ShieldPartVisual
{
  Radius 8
  Height 8
  Scale 0.5
  RenderStyle Add
  Obituary "%o was evaporated by %k's shield, mwahahaha!"
  Alpha 0.15
  +NOINTERACTION
  +CLIENTSIDEONLY
  +FLOORCLIP
  States
  {
  Spawn:
    SHIE A 2 bright
    stop
  Death:
    TNT1 A 2
    stop
  }
}

actor ShieldSpawner
{
  Radius 1
  Height 1
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner4up", 0, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner5up", 24, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner5up", -24, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner4up", 48, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner4up", -48, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner3up", 72, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner3up", -72, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner2up", 96, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldSpawner2up", -96, 0, 0, 0, 0, 0, 0, 32)
    stop
  }
}

actor ShieldSpawner5up
{
  Radius 1
  Height 1
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 16, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 32, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 48, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 64, 0, 0, 0, 0, 32)
    //TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 0, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 16, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 32, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 48, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 64, 0, 0, 0, 0, 32)
    stop
  }
}

actor ShieldSpawner4up
{
  Radius 1
  Height 1
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 8, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 24, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 40, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 56, 0, 0, 0, 0, 32)
    //TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 8, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 24, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 40, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 56, 0, 0, 0, 0, 32)
    stop
  }
}

actor ShieldSpawner3up
{
  Radius 1
  Height 1
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 16, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 32, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 48, 0, 0, 0, 0, 32)
    //TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 16, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 32, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 48, 0, 0, 0, 0, 32)
    stop
  }
}


actor ShieldSpawner2up
{
  Radius 1
  Height 1
  +NOGRAVITY
  +NOINTERACTION
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 24, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPart", 0, 0, 40, 0, 0, 0, 0, 32)
    //TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 24, 0, 0, 0, 0, 32)
    TNT1 A 0 A_SpawnItemEx ("ShieldPartVisual", 0, 0, 40, 0, 0, 0, 0, 32)
    stop
  }
}

ACTOR ShieldHit
{
  Scale 0.15
  Alpha 1
  RenderStyle Add
  +NOINTERACTION
  +NOGRAVITY
  States
  {
  Spawn:
    VINR A 0
    VINR A 0 bright A_PlaySound("Weapons/LibraImpact",0,1)
  Looplet:
    VINR A 0 A_FadeOut(0.1)
    VINR A 1 //A_SetScale(ScaleX+0.15, ScaleY+0.15)
    Loop
  }
}

//Turbo-Doctor

ACTOR LibraHpFX
{
   Renderstyle Add
   Alpha 0.4
   Scale 0.25
   Obituary "I AM ZE UBERMENSCH! OKTOBERFEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE-"
   +NOINTERACTION
   +CLIENTSIDEONLY
   +NOGRAVITY
   States
   {
   Spawn:
    MED5 B 0
    MED5 B 0 A_ChangeVelocity (frandom(-0.1, 0.1), frandom(-0.1, 0.1), frandom(-0.1, 0.1), 0)
    MED5 B 1 A_FadeOut(0.04)
    Loop
   }
}

Actor LibraGLDEF
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	States
	{
	Spawn:
	TNT1 A 2
	Stop
	}
}
