/*
CREDITS:
Gun Graphics - Zrrion the Insect! (Original ones from DNF, Gearbox Soft.)
Spiffy Charging Animation - Cage!
Pickup, partially - Eriance

Sounds - Welp, this will be kinda complicated.
Up - UT2004 & Wolfenstein 3 (Epic Games, Raven Software)
Idle - Not sure from where... but my spider senses are tingling it must be made by ID Software
Charge - Quake 4 (ID Software)
Fire, Load, Trigger, Blast2 - Wolfenstein 3 (Raven Software)
Add Fire - Sound from nowhere, sigh... but I think I got it from some mod by Zanaveth. Kudos to you for such great sound!
Projectile flight - A mixup of various sounds, barely can tell from which ones...
Blast1 - Diablo II & Wolfenstein 3 (Blizzard Entertaiment, Raven Soft.)
Hit - Diablo II & Quake 2 (Blizzard Ent., ID Soft.)
Loop - Again, a mixup of various sounds, even less able to tell what were used.
Struck - Starcraft II (Blizzard Ent.)
Ammo - Serious Sam 2, Quake 4(Croteam, ID Soft.)
*/

actor Gurumaster : Weapon 24540
{
  //$Category Weapons
  //$Title Gurumaster
  //$Sprite PWRGX0
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "You got a ''Gurumaster'' vearetelium cannon prototype! Can't stop loving those new lethal substances! (8)"
  obituary "%o was utilised into deuter and nutrients by %k's ''Gurumaster''."
  Weapon.UpSound "Weapons/GuruUp"
  Weapon.AmmoGive 50
  Weapon.AmmoType1 "VearAmmo"
  Weapon.AmmoUse1 20
  Weapon.AmmoType2 "VearAmmo"
  Weapon.AmmoUse2 80
  weapon.KickBack 90
  Weapon.SlotNumber 8
  +NOAUTOFIRE
  states
  {
  Spawn:
	GRMG X -1
	loop
  Select:
  	GRMU A 0 A_Raise
  	GRMU A 1 A_Raise
  	Loop
  Deselect:
  	GRMU A 0 A_StopSound(5)
    GRMU A 0 A_StopSound(6)
	GRMU A 0 A_ZoomFactor(1)
  	GRMU A 0 A_Lower
  	GRMU A 1 A_Lower
  	loop
  Ready:
  	GRMG A 0 A_PlaySound("Weapons/GuruIdle",5,1.0,1)
  	GRMG ABCDEFGHIJIHGFEDCB 1 A_WeaponReady
  	loop
  Fire:
  	GRMG A 0 A_PlaySound("Weapons/GuruTrigger",1)
  	GRMG ABCDEFGHIJ 1
  	GRMG IHGFED 1
    GRMG A 0 A_StopSound(5)
  	GRMG A 0 A_PlaySound("Weapons/GuruFire",6)
  	GRMG A 0 A_FireCustomMissile("Guruball", 0, 1, 12, 0)
  	GRMG A 0 A_Recoil(15)
	GRMG A 0 A_GunFlash
	GRMG A 0 A_SetBlend("Yellow",0.5,20)
	GRMG A 0 A_SetBlend("White",0.25,20)

	GRMF A 0 A_ZoomFactor(0.985)
	GRMF A 0 ACS_Execute(851,0,60+random(-5,5),30+random(5,-5),0)
	GRMF A 1 Bright Offset(4,36)
	GRMF A 0 A_ZoomFactor(0.975)
	GRMF A 0 ACS_Execute(851,0,60+random(-5,5),30+random(5,-5),0)
	GRMF A 1 Bright Offset(8,40)
	
	GRMF A 0 ACS_Execute(851,0,40+random(-5,5),20+random(5,-5),0)
	GRMG J 1 Bright Offset(9,41) A_ZoomFactor(0.95)
	GRMF A 0 ACS_Execute(851,0,20+random(-5,5),10+random(5,-5),0)
	GRMG I 1 Bright Offset(10,42) A_ZoomFactor(0.9)

	GRMG H 1 Bright A_ZoomFactor(0.865)

	GRMG G 1 Bright Offset(9,41) A_ZoomFactor(0.845)

	GRMG F 1 Bright Offset(8,40) A_ZoomFactor(0.825)

	GRMG E 1 Bright Offset(7,39) A_ZoomFactor(0.835)

	GRMG D 1 Bright Offset(6,38) A_ZoomFactor(0.855)

	GRMG C 1 Bright Offset(5,37) A_ZoomFactor(0.875)

	GRMG B 0 ACS_Execute(851,0,-20+random(-5,5),-10+random(5,-5),0)
	GRMG A 1 Bright Offset(4,36) A_ZoomFactor(0.925)
	GRMG A 0 ACS_Execute(851,0,-20+random(-5,5),-10+random(5,-5),0)
	GRMU A 1 Offset(3,35) A_ZoomFactor(0.965)
	GRMG A 0 ACS_Execute(851,0,-20+random(-5,5),-10+random(5,-5),0)
	GRMU A 1 Offset(2,34) A_ZoomFactor(0.985)

	GRMU A 1 Offset(1,33) A_ZoomFactor(1)
	GRMU A 1 Offset(0,32)
	GRMU A 10 A_PlaySound("Weapons/GuruLoad",1)
  	PWRG A 0 A_PlaySound("Weapons/GuruIdle",5,1.0,1)
	GRMG ABCDFEFGHIJIHGFEDCB 1
	Goto Ready
  AltFire:
  	GRMG A 0 A_PlaySound("Weapons/GuruTrigger",1)
  	GRMG ABCDEFGHIJ 1
  	GRMG A 0 A_PlaySound("Weapons/GuruCharge",6)
  	GRMG IHGFED 1
	GRMG A 0 A_GiveInventory("GuruCharge",5)
  Gurucharger:
	GRMG A 0 A_TakeInventory("GuruCharge",1)
	GRMC ABCDEFGHIJKLMNOPQRST 1 Bright A_Quake (4, 2, 0, 2,"none")
    GRMG A 0 A_JumpIfInventory("GuruCharge",1,"Gurucharger")
	GRMC ABC 1 Bright A_Quake (4, 2, 0, 2,"none")
    GRMG A 0 A_StopSound(5)
    GRMG A 0 A_PlaySound("Weapons/GuruFire",5)
  	GRMG A 0 A_PlaySound("Weapons/GuruAddFire",6)
  	GRMG A 0 A_FireCustomMissile("GuruDeathball", 0, 1, 12, 0)
  	GRMG A 0 A_Recoil(65)
	GRMG A 0 A_GunFlash
	GRMG A 0 A_SetBlend("Yellow",0.5,60)
	GRMG A 0 A_SetBlend("White",0.25,60)

	GRMF A 0 A_ZoomFactor(0.975)
	GRMF A 0 ACS_Execute(851,0,120+random(-5,5),60+random(5,-5),0)
	GRMF A 1 Bright Offset(2,34)
	GRMF A 0 A_ZoomFactor(0.95)
	GRMF A 0 ACS_Execute(851,0,120+random(-5,5),60+random(5,-5),0)
	GRMF A 1 Bright Offset(4,36)
  //Recoil
	GRMF A 0 ACS_Execute(851,0,90+random(-5,5),40+random(5,-5),0)
	GRMF A 1 Bright Offset(8,40) A_ZoomFactor(0.85)
	GRMF A 1 Bright Offset(12,44) A_ZoomFactor(0.875)
	GRMG A 0 ACS_Execute(851,0,60+random(-5,5),20+random(5,-5),0)
	GRMG J 1 Bright Offset(15,47) A_ZoomFactor(0.8)
	GRMG I 1 Bright Offset(17,49) A_ZoomFactor(0.75)

	GRMG H 1 Bright Offset(18,50) A_ZoomFactor(0.74)
	GRMG G 1 Bright Offset(19,51) A_ZoomFactor(0.73)

	GRMG F 1 Bright Offset(20,52) A_ZoomFactor(0.72)
	GRMG E 1 Bright A_ZoomFactor(0.71)

	GRMG D 1 Bright Offset(19,51) A_ZoomFactor(0.7)
	GRMG C 1 Bright Offset(18,50) A_ZoomFactor(0.69)

	GRMG B 1 Bright Offset(17,49) A_ZoomFactor(0.68)
	GRMG A 1 Bright Offset(16,48) A_ZoomFactor(0.67)

	GRMU A 1 Offset(15,47) A_ZoomFactor(0.66)
	GRMU A 0 ACS_Execute(851,0,60+random(-5,5),20+random(5,-5),0)
	GRMU A 1 Offset(14,46) A_ZoomFactor(0.67)
	GRMU A 1 Offset(13,45) A_ZoomFactor(0.68)

	GRMU A 1 Offset(12,44) A_ZoomFactor(0.69)
	GRMU A 1 Offset(11,43) A_ZoomFactor(0.7)

	GRMU A 1 Offset(10,42) A_ZoomFactor(0.71)
	GRMU A 1 Offset(9,41) A_ZoomFactor(0.72)

	GRMU A 0 ACS_Execute(851,0,-40+random(-5,5),-15+random(5,-5),0)
	GRMU A 1 Offset(8,40) A_ZoomFactor(0.73)
	GRMU A 1 Offset(7,39) A_ZoomFactor(0.74)

	GRMU A 0 ACS_Execute(851,0,-40+random(-5,5),-15+random(5,-5),0)
	GRMU A 1 Offset(6,38) A_ZoomFactor(0.75)
	GRMU A 1 Offset(5,37) A_ZoomFactor(0.775)

	GRMU A 0 ACS_Execute(851,0,-40+random(-5,5),-15+random(5,-5),0)
	GRMU A 1 Offset(4,36) A_ZoomFactor(0.8)
	GRMU A 1 Offset(3,35) A_ZoomFactor(0.825)

	GRMU A 0 ACS_Execute(851,0,-40+random(-5,5),-15+random(5,-5),0)
	GRMU A 1 Offset(2,34) A_ZoomFactor(0.85)
	GRMU A 1 Offset(1,33) A_ZoomFactor(0.875)


	GRMU A 0 ACS_Execute(851,0,-40+random(-5,5),-15+random(5,-5),0)
	GRMU A 1 Offset(0,32) A_ZoomFactor(0.9)
	GRMU A 1 A_ZoomFactor(0.925)

	GRMU A 0 ACS_Execute(851,0,-40+random(-5,5),-15+random(5,-5),0)
	GRMU A 1 A_ZoomFactor(0.925)
	GRMU A 1 A_ZoomFactor(0.95)

	GRMU A 0 ACS_Execute(851,0,-40+random(-5,5),-15+random(5,-5),0)
	GRMU A 1 A_ZoomFactor(0.975)
	GRMU A 1 A_ZoomFactor(1)

	GRMU A 10 A_PlaySound("Weapons/GuruLoad",1)
  	PWRG A 0 A_PlaySound("Weapons/GuruIdle",5,1,1)
	GRMG ABCDFEFGHIJIHGFEDCB 1
	Goto Ready
  Flash:
      TNT1 A 7 bright A_Light2
      TNT1 A 4 bright A_Light1
      TNT1 A 0 bright A_Light0
      stop
  }
}

//////////////
//MISC-STUFF//
//////////////

//COUNTER\TRIGGER

ACTOR GuruCount : Inventory
{
     Inventory.MaxAmount 999
}

ACTOR GuruCharge : Inventory
{
     Inventory.MaxAmount 5
}

//INHERITANCE

ACTOR GuruEffectInheritance
{
	+NOCLIP
	+NOINTERACTION
	+NOGRAVITY
	Alpha 0.99
	Renderstyle Add
}

ACTOR GuruSpawnerInheritance
{
	+NOCLIP
	+NOINTERACTION
	+NOGRAVITY
}

ACTOR GuruSmokeInheritance
{
	+NOINTERACTION
	+NOGRAVITY
	+FORCERADIUSDMG
	Renderstyle Add
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 1 A_Jump(255,"Spawn1","Spawn2","Spawn3","Spawn4","Spawn5","Spawn6")
	Stop
	Spawn1:
	 TNT1 A 0 //A_SetScale(ScaleX +0.003, ScaleY +0.003)
	 THD1 A 0 A_Explode(15,128)
	 THD1 A 4 Bright A_FadeOut(0.009)
	 Loop
	Spawn2:
	 TNT1 A 0 //A_SetScale(ScaleX +0.003, ScaleY +0.003)
	 THD1 A 0 A_Explode(15,128)
	 THD2 A 4 Bright A_FadeOut(0.007)
	 Loop
	Spawn3:
	 TNT1 A 0 //A_SetScale(ScaleX +0.003, ScaleY +0.003)
	 THD1 A 0 A_Explode(15,128)
	 THD3 A 4 Bright A_FadeOut(0.006)
	 Loop
	Spawn4:
	 TNT1 A 0 //A_SetScale(ScaleX -0.003, ScaleY -0.003)
	 THD1 A 0 A_Explode(15,128)
	 THD1 A 4 Bright A_FadeOut(0.0075)
	 Loop
	Spawn5:
	 TNT1 A 0 //A_SetScale(ScaleX -0.001, ScaleY -0.001)
	 THD1 A 0 A_Explode(15,128)
	 THD2 A 4 Bright A_FadeOut(0.0065)
	 Loop
	Spawn6:
	 TNT1 A 0 //A_SetScale(ScaleX -0.003, ScaleY -0.003)
	 THD1 A 0 A_Explode(15,128)
	 THD3 A 4 Bright A_FadeOut(0.008)
	 Loop
	}
}


////////
//FIRE//
////////


//PROJECTILE

ACTOR GuruBall : FastProjectile
{
  Radius 11
  Height 6
  Speed 15
  Damage 0
  Projectile
  Renderstyle Add
  +FORCERADIUSDMG
  +FOILINVUL
  +RIPPER
  +BLOODLESSIMPACT
  +DONTBLAST
  Scale 0.25
  MissileType "GuruLesserProjectileTrail"
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_PlaySound("Weapons/GuruFly",5,1.0,1)
	TNT1 A 0 A_Explode(600,64,0,1)
	TNT1 A 0 A_SpawnItemEx("GuruTrailSpark",random(28,-28),random(28,-28),random(28,-28),0,0,0,0,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruTrail",-3,0,0,0,0,0,0,0,0)
	YBAL A 1 bright
	loop
  Death:
	TNT1 A 0 A_PlaySound("Weapons/GuruBlast3",5)
	//COLLATERAL DAMAGE EFFECTS
	TNT1 A 0 A_Explode(6000,486,0,1)
	TNT1 A 0 A_BFGSpray("GuruSpray",15,20)

	//IMPACT STUFF
	TNT1 A 0 A_SpawnItemEx("GuruStruckGlowX",0,0,10,0,0,0,0,128,0)
	TNT1 A 0 A_SpawnItemEx("GuruStruckGlowY",0,0,10,0,0,0,0,128,0)
	TNT1 AAAAAAAAAAA 0 A_SpawnItemEx("GuruSphereSmoke",random(126,-126),random(126,-126),random(66,-66),0.00001*random(100000,-100000),0.00001*random(100000,-100000),0.00001*random(100000,-100000),random(0,359),0,0)
	TNT1 AAAAAAAAAAA 0 A_SpawnItemEx("GuruChunkSpark",random(126,-126),random(126,-126),random(66,-66),0,0,0,0,0,0)
	TNT1 AAAAAAAAAAAAAAAAAAA 2 A_SpawnItemEx("GuruChunkSpark",random(126,-126),random(126,-126),random(66,-66),0,0,0,0,0,0)
	Stop
  }
}

//TRAIL

ACTOR GuruTrail : GuruEffectInheritance
{
	Alpha 0.65
	Renderstyle Add
	+CLIENTSIDEONLY
	Scale 0.25
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 //A_SetScale(ScaleX -0.01, ScaleY -0.01)
	YBAL A 1 Bright A_FadeOut(0.1)
	Loop
	}
}

ACTOR GuruTrailSpark : GuruEffectInheritance
{
	Scale 0.5
	+CLIENTSIDEONLY
	States
	{
	Spawn:
	YELE ABCDEF 1 Bright A_FadeOut(0.1)
	Stop
	}
}

//IMPACT

ACTOR GuruStruckGlowY : GuruEffectInheritance
{
	Alpha 0.5
	+CLIENTSIDEONLY
	Scale 0.2
	States
	{
	Spawn:
	CBUM A 0
	YBUM A 0 //A_SetScale(ScaleX +0.025, ScaleY +0.1)
	YBUM A 1 Bright A_FadeOut(0.01)
	Loop
	}
}

ACTOR GuruStruckGlowX : GuruEffectInheritance
{
	Alpha 0.5
	+CLIENTSIDEONLY
	Scale 0.2
	States
	{
	Spawn:
	CBUM A 0
	YBUM A 0 //A_SetScale(ScaleX +0.1, ScaleY +0.025)
	YBUM A 1 Bright A_FadeOut(0.01)
	Loop
	}
}

//SPRAY

ACTOR GuruSpray : GuruSpawnerInheritance
{
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("GuruSprayGlowX",0,0,0,0,0,0,0,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruSprayGlowY",0,0,0,0,0,0,0,0,0)
	TNT1 AAAAAA 3 A_SpawnItemEx("GuruSpraySpark",random(24,-24),random(24,-24),random(24,-24),0,0,0,0,0,0)
	Stop
	}
}

ACTOR GuruSpraySpark : GuruEffectInheritance
{
	Scale 0.25
	+CLIENTSIDEONLY
	States
	{
	Spawn:
	YELE ABCDEF 2 Bright A_FadeOut(0.1)
	Stop
	}
}

ACTOR GuruSprayGlowY : GuruStruckGlowX
{
	Alpha 0.35
	+CLIENTSIDEONLY
	Scale 0.025
	States
	{
	Spawn:
	CBUM A 0
	YBUM A 0 //A_SetScale(ScaleX +0.05, ScaleY +0.01)
	YBUM A 1 Bright A_FadeOut(0.01)
	Loop
	}
}

ACTOR GuruSprayGlowX : GuruStruckGlowY
{
	Alpha 0.35
	Scale 0.025
	+CLIENTSIDEONLY
	States
	{
	Spawn:
	CBUM A 0
	YBUM A 0 //A_SetScale(ScaleX +0.01, ScaleY +0.05)
	YBUM A 1 Bright A_FadeOut(0.01)
	Loop
	}
}

////////////
//ALT FIRE//
////////////

//PROJECTILE

ACTOR GuruDeathball : FastProjectile
{
  Radius 12
  Height 7
  Speed 10
  Damage 0
  Projectile
  Renderstyle Add
  +FORCERADIUSDMG
  +FOILINVUL
  +RIPPER
  +BLOODLESSIMPACT
  +DONTBLAST
  Scale 0.35
  MissileType "GuruLesserProjectileTrail"
  DamageType "Superweapon"
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_PlaySoundEx("Weapons/GuruFly","SoundSlot6",1)
	TNT1 A 0 A_Explode(1600,92,0,1)
	TNT1 A 0 A_SpawnItemEx("GuruTrailSpark",random(42,-42),random(42,-42),random(42,-42),0,0,0,0,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruEmpowerTrail",-3,0,0,0,0,0,0,0,0)
	YBAL A 1 bright
	loop
  Death:
	TNT1 A 0 A_PlaySound("Weapons/GuruBlast",6)

	//IMPACT STUFF
	TNT1 A 0 A_SpawnItemEx("GuruGigaStruckGlowX",0,0,10,0,0,0,0,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruGigaStruckGlowY",0,0,10,0,0,0,0,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruChunkRainSpawner",0,0,15,0,0,0,0,0,0)

	//AFTER-HIT EFFECTS
	TNT1 A 0 A_SpawnItemEx("GuruSparkSpawner",0,0,10,0,0,0,0,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruSpiralSpawner",0,0,30,0,0,0,0,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruSphere",0,0,15,0,0,0,0,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruSpiralSounder",0,0,0,0,0,0,0,0,0)

	//COLLATERAL DAMAGE EFFECTS
	TNT1 A 1 A_Explode(80000,768,0,1)
	Stop
  }
}

//TRAIL

ACTOR GuruEmpowerTrail : GuruTrail
{
+CLIENTSIDEONLY
	Scale 0.35
}

//IMPACT

ACTOR GuruGigaStruckGlowX : GuruEffectInheritance
{
	Alpha 0.5
	+CLIENTSIDEONLY
	Scale 3.5
	States
	{
	Spawn:
	CBUM A 0
	YBUM A 0 //A_SetScale(ScaleX +0.4, ScaleY +0.1)
	YBUM A 1 Bright A_FadeOut(0.005)
	Loop
	}
}

ACTOR GuruGigaStruckGlowY : GuruEffectInheritance
{
	Alpha 0.5
	+CLIENTSIDEONLY
	Scale 3.5
	States
	{
	Spawn:
	CBUM A 0
	YBUM A 0 //A_SetScale(ScaleX +0.1, ScaleY +0.4)
	YBUM A 1 Bright A_FadeOut(0.005)
	Loop
	}
}

ACTOR GuruSparkSpawner : GuruSpawnerInheritance
{
	ReactionTime 90
	States
	{
	Spawn:
	Smoking:
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("GuruHitSpark",random(355,-355),random(355,-355),random(135,-20),random(2,-2),random(2,-2),random(2,-2),random(0,359),0)
	TNT1 A 2
	Loop
	Death:
	TNT1 A 1
	Stop
	}
}

ACTOR GuruHitSpark : GuruTrailSpark
{
+CLIENTSIDEONLY
	Scale 0.85
}

//SPHERE

ACTOR GuruSphere : GuruEffectInheritance
{
	Alpha 0.95
	Scale 1.25
	ReactionTime 95
	States
	{
	Spawn:
	YBAL A 0
	YBAL A 0 A_Countdown
	YBAL AA 0 A_SpawnItemEx("GuruHitSpark",random(225,-225),random(225,-225),random(-375,145),0,0,0)
	YBAL A 0 A_SpawnItemEx("GuruSphereSmoke",random(155,-155),random(155,-155),random(-75,145),0,0,0.00001*random(-300000,-100000),0,0)
	YBAL A 1 Bright
	YBAL A 0 ThrustThingZ(0, 18, 0, 0)
	Loop
	Death:
	YBAL A 0 A_SpawnItemEx("GuruSphere2",0,0,0,0,0,0,0,0,0)
	Stop
	}
}

ACTOR GuruSphere2 : GuruSphere
{
	ReactionTime 85
	States
	{
	Spawn:
	YBAL A 0
	YBAL A 0 A_Countdown
	YBAL AA 0 A_SpawnItemEx("GuruHitSpark",random(225,-225),random(225,-225),random(-325,145),0,0,0)
	YBAL A 0 A_SpawnItemEx("GuruSphereSmoke",random(155,-155),random(155,-155),random(-85,45),0,0,0.00001*random(-300000,-100000),0,0)
	YBAL A 1 Bright
	YBAL A 0 ThrustThingZ(0, 12, 0, 0)
	Loop
	Death:
	CBAL A 0 A_SpawnItemEx("GuruSphere3",0,0,0,0,0,0,0,0,0)
	Stop
	}
}

ACTOR GuruSphere3 : GuruSphere
{
	ReactionTime 75
	States
	{
	Spawn:
	YBAL A 0
	YBAL A 0 A_Countdown
	YBAL AA 0 A_SpawnItemEx("GuruHitSpark",random(225,-225),random(225,-225),random(-350,145),0,0,0)
	YBAL A 0 A_SpawnItemEx("GuruSphereSmoke",random(155,-155),random(155,-155),random(-85,45),0,0,0.00001*random(-300000,-100000),0,0)
	YBAL A 1 Bright
	YBAL A 0 ThrustThingZ(0, 6, 0, 0)
	Loop
	Death:
	CBAL A 0 A_SpawnItemEx("GuruSphere4",0,0,0,0,0,0,0,0,0)
	Stop
	}
}

ACTOR GuruSphere4 : GuruSphere
{
	ReactionTime 65
	States
	{
	Spawn:
	YBAL A 0
	YBAL A 0 A_Countdown
	YBAL AA 0 A_SpawnItemEx("GuruHitSpark",random(225,-225),random(225,-225),random(-375,145),0,0,0)
	YBAL A 0 A_SpawnItemEx("GuruSphereSmoke",random(155,-155),random(155,-155),random(-85,45),0,0,0.00001*random(-300000,-100000),0,0)
	YBAL A 1 Bright
	YBAL A 0 ThrustThingZ(0, 2, 0, 0)
	Loop
	Death:
	CBAL A 0 A_SpawnItemEx("GuruSphereStill",0,0,0,0,0,0,0,0,0)
	Stop
	}
}

ACTOR GuruSphereStill : GuruSphere
{
	ReactionTime 55
	States
	{
	Spawn:
	YBAL A 0
	YBAL A 0 A_PlaySound("Weapons/GuruFuuu",6,1)
	Looplet:
	YBAL AA 0 A_SpawnItemEx("GuruHitSpark",random(225,-225),random(225,-225),random(-400,145),0,0,0)
	YBAL A 0 A_SpawnItemEx("GuruHitSpark",random(125,-125),random(125,-125),random(-65,65),0,0,0)
	YBAL A 0 A_SpawnItemEx("GuruSphereSmoke",random(155,-155),random(155,-155),random(-85,45),0,0,0.00001*random(-300000,-100000),0,0)
	YBAL A 1 Bright
	YBAL A 0 A_Countdown
	Loop
	Death:
	YBAL A 0 A_PlaySound("Weapons/GuruBoom",6)
	YBAL A 0 A_PlaySound("Weapons/GuruBlast2",5)
	YBAL A 0 A_SpawnItemEx("GuruStormSpawner",0,0,0,0,0,0,0,0,0)
	YBAL AAA 0 A_SpawnItemEx("GuruKaboom",0,0,0,0,0,0,0,0,0)
	Stop
	}
}

ACTOR GuruSphereSmoke : GuruSmokeInheritance
{
	Scale 1.8
	Alpha 0.45
	PROJECTILE
	+CLIENTSIDEONLY
	DamageType "Superweapon"
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 1 A_Jump(255,"Spawn1","Spawn2","Spawn3","Spawn4","Spawn5","Spawn6")
	Stop
	Spawn1:
	 TNT1 A 0 //A_SetScale(ScaleX -0.002, ScaleY -0.002)
	 TNT1 A 0 A_JumpIf(Alpha<0.3,2)
	 THD1 A 0 A_Explode(10,164)
	 THD1 A 4 Bright A_FadeOut(0.0065)
	 Loop
	Spawn2:
	 TNT1 A 0 //A_SetScale(ScaleX -0.002, ScaleY -0.002)
	 TNT1 A 0 A_JumpIf(Alpha<0.3,2)
	 THD1 A 0 A_Explode(10,164)
	 THD2 A 4 Bright A_FadeOut(0.0065)
	 Loop
	Spawn3:
	 TNT1 A 0 //A_SetScale(ScaleX -0.002, ScaleY -0.002)
	 TNT1 A 0 A_JumpIf(Alpha<0.3,2)
	 THD1 A 0 A_Explode(10,164)
	 THD3 A 4 Bright A_FadeOut(0.0065)
	 Loop
	Spawn1:
	 TNT1 A 0 //A_SetScale(ScaleX -0.002, ScaleY -0.002)
	 TNT1 A 0 A_JumpIf(Alpha<0.3,2)
	 THD1 A 0 A_Explode(10,164)
	 THD1 A 4 Bright A_FadeOut(0.0065)
	 Loop
	Spawn2:
	 TNT1 A 0 //A_SetScale(ScaleX -0.002, ScaleY -0.002)
	 TNT1 A 0 A_JumpIf(Alpha<0.3,2)
	 THD1 A 0 A_Explode(10,164)
	 THD2 A 4 Bright A_FadeOut(0.0065)
	 Loop
	Spawn3:
	 TNT1 A 0 //A_SetScale(ScaleX -0.002, ScaleY -0.002)
	 TNT1 A 0 A_JumpIf(Alpha<0.3,2)
	 THD1 A 0 A_Explode(10,164)
	 THD3 A 4 Bright A_FadeOut(0.0065)
	 Loop
	}
}

//CHUNKLER

actor GuruChunkRainSpawner : GuruSpawnerInheritance
{
	ReactionTime 32
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 AAA 1 ThrustThingZ(0, 18, 0, 0)
	TNT1 A 0 A_SpawnItemEx("GuruSphereChunker",0,0,0,0,0,0,0,0,0)
	TNT1 A 0 A_Countdown
	loop
	Death:
	TNT1 A 0 //A_SpawnItemEx("GuruChunkRainSpawner2",0,0,0,0,0,0,0,128,0)
	stop
	}
}

actor GuruSphereChunker : GuruSpawnerInheritance
{
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 AAA 3 A_SpawnItemEx("GuruSphereChunk",random(100,-100),random(100,-100),random(70,-70),frandom(1,12),frandom(1,12),frandom(16,20),random(0,359),0,0)
	Stop
	Death:
	TNT1 A 0
	stop
	}
}

ACTOR GuruSphereChunk
{
	Radius 12
	Height 5
	PROJECTILE
	-NOGRAVITY
	Renderstyle Add
	Gravity 0.25
	Alpha 1
	Scale 1
 	DamageType "Superweapon"
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Jump(128,2)
	YSHK A 2 Bright A_SpawnItemEx("GuruTrailSpark",0,0,0,0,0,0,0,0,0)
	Loop
	YSHK A 2 Bright A_SpawnItemEx("GuruChunkTrail",frandom(-5,5),frandom(-5,5),frandom(-5,5),0.00001*random(10000,-10000),0.00001*random(10000,-10000),0.00001*random(10000,-10000),random(0,359),0,0)
	Goto Spawn
	Death:
	TNT1 A 0 A_PlaySound("Weapons/GuruHit")
	TNT1 A 0 A_PlaySound("Weapons/GuruBlast3",5)
	TNT1 A 0 A_Explode(5000,192)
	TNT1 AAA 0 A_SpawnItemEx("GuruChunkSpark",random(8,-8),random(8,-8),random(8,-8),0,0,0,0,0,0)
	TNT1 AA 0 A_SpawnItemEx("GuruSphereSmoke",0,0,0,0.00001*random(100000,-100000),0.00001*random(100000,-100000),0.00001*random(100000,-100000),random(0,359),0,0)
	Stop
	}
}

ACTOR GuruChunkSpark : GuruTrailSpark
{
	Scale 1.15
	+CLIENTSIDEONLY
	States
	{
	Spawn:
	YELE ABCDEF 2 Bright A_FadeOut(0.1)
	Stop
	}
}

ACTOR GuruChunkTrail : GuruSmokeInheritance
{
	Scale 0.65
	+CLIENTSIDEONLY
	Alpha 0.2
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 1 A_Jump(255,"Spawn1","Spawn2","Spawn3","Spawn4","Spawn5","Spawn6")
	Stop
	Spawn1:
	 TNT1 A 0 //A_SetScale(ScaleX +0.003, ScaleY +0.003)
	 THD1 A 1 Bright A_FadeOut(0.009)
	 Loop
	Spawn2:
	 TNT1 A 0 //A_SetScale(ScaleX +0.003, ScaleY +0.003)
	 THD2 A 1 Bright A_FadeOut(0.007)
	 Loop
	Spawn3:
	 TNT1 A 0 //A_SetScale(ScaleX +0.003, ScaleY +0.003)
	 THD3 A 1 Bright A_FadeOut(0.006)
	 Loop
	Spawn4:
	 TNT1 A 0 //A_SetScale(ScaleX -0.003, ScaleY -0.003)
	 THD1 A 1 Bright A_FadeOut(0.0075)
	 Loop
	Spawn5:
	 TNT1 A 0 //A_SetScale(ScaleX -0.001, ScaleY -0.001)
	 THD2 A 1 Bright A_FadeOut(0.0065)
	 Loop
	Spawn6:
	 TNT1 A 0 //A_SetScale(ScaleX -0.003, ScaleY -0.003)
	 THD3 A 1 Bright A_FadeOut(0.008)
	 Loop
	}
}

//SPIRAL

ACTOR GuruSpiralSounder : GuruEffectInheritance
{
+CLIENTSIDEONLY
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 375 A_PlaySound("Weapons/GuruLoop",6,1,1)
	TNT1 A 0 A_StopSound(5)
	Stop
	}
}

actor GuruSpiralSpawner : GuruSpawnerInheritance
{
	ReactionTime 95
	States
	{
	Spawn:
	TNT1 A 0
	YBAL A 0 ThrustThingZ(0, 18, 0, 0)
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,270,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,180,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,90,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,0,0,0)
	TNT1 A 1 bright A_SetAngle(9 + angle)
	loop
	Death:
	TNT1 A 0 A_SpawnItemEx("GuruSpiralSpawner2",0,0,0,0,0,0,0,0,0)
	stop
	}
}

actor GuruSpiralSpawner2 : GuruSpiralSpawner
{
	ReactionTime 85
	States
	{
	Spawn:
	TNT1 A 0
	YBAL A 0 ThrustThingZ(0, 12, 0, 0)
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,270,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,180,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,90,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,0,0,0)
	TNT1 A 1 bright A_SetAngle(9 + angle)
	loop
	Death:
	TNT1 A 0 A_SpawnItemEx("GuruSpiralSpawner3",0,0,0,0,0,0,0,0,0)
	stop
	}
}

actor GuruSpiralSpawner3 : GuruSpiralSpawner
{
	ReactionTime 75
	States
	{
	Spawn:
	TNT1 A 0
	YBAL A 0 ThrustThingZ(0, 6, 0, 0)
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,270,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,180,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,90,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,0,0,0)
	TNT1 A 1 bright A_SetAngle(9 + angle)
	loop
	Death:
	TNT1 A 0 A_SpawnItemEx("GuruSpiralSpawner4",0,0,0,0,0,0,0,0,0)
	stop
	}
}

actor GuruSpiralSpawner4 : GuruSpiralSpawner
{
	ReactionTime 65
	States
	{
	Spawn:
	TNT1 A 0
	YBAL A 0 ThrustThingZ(0, 3, 0, 0)
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,270,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,180,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,90,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,0,0,0)
	TNT1 A 1 bright A_SetAngle(9 + angle)
	loop
	Death:
	TNT1 A 0 A_SpawnItemEx("GuruSpiralSpawnerStill",0,0,0,0,0,0,0,0,0)
	stop
	}
}

actor GuruSpiralSpawnerStill : GuruSpiralSpawner
{
	ReactionTime 55
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,270,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,180,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,90,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,0,0,0)
	TNT1 A 1 bright A_SetAngle(9 + angle)
	loop
	Death:
	TNT1 A 1
	stop
	}
}

ACTOR GuruShocklet : GuruEffectInheritance
{
	ReactionTime 25
	DamageType "Superweapon"
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_Explode(19500,128)
	TNT1 A 1 A_SpawnItemEx("GuruShockletSpark",frandom(5,-5),frandom(5,-5),frandom(5,-5),frandom(1,-1),frandom(1,-1),frandom(1,-1),random(0,359),0,0)
	Loop
	Death:
	TNT1 A 1 A_SpawnItemEx("GuruShockletSphere",0,0,0,0,0,0,0,0)
	Stop
	}
}

ACTOR GuruShockletSpark : GuruTrailSpark
{
+CLIENTSIDEONLY
	Scale 0.5
}

ACTOR GuruShockletSphere : GuruEffectInheritance
{
	Alpha 0.95
	Scale 1.25
	+CLIENTSIDEONLY
	States
	{
	Spawn:
	YSHK A 0
	YSHK A 1 Bright A_FadeOut(0.1)
	YSHK A 0 //A_SetScale(ScaleX-0.05,ScaleY-0.05)
	Loop
	}
}

//SPHERE KABOOM

ACTOR GuruKaboom : GuruSpawnerInheritance
{
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("GuruKaplosionSpawner",0,0,0,0,0,0,0,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruStormSpawner",0,0,0,0,0,0,0,0,0)
	Stop
	}
}

ACTOR GuruKaplosionSpawner : GuruSpawnerInheritance
{
	+FORCERADIUSDMG
	ReactionTime 25
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Countdown
	TNT1 A 1 A_SpawnItemEx("GuruKaploder",0,0,0,0,0,0,0,0,0)
	Loop
	Death:
	TNT1 A 0
	Stop
	}
}

ACTOR GuruKaploder : GuruSpawnerInheritance
{
	+FORCERADIUSDMG
	ReactionTime 25
	DamageType "Superweapon"
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Explode(2000,1280)
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("GuruKaplosion",random(80,-80),random(80,-80),random(80,-80),frandom(25,29),frandom(25,29),frandom(-30,30),random(0,359),0,0)
	Loop
	Death:
	TNT1 A 0
	Stop
	}
}

ACTOR GuruKaplosion : GuruEffectInheritance
{
	Alpha 0.95
	Scale 0.75
	DamageType "Superweapon"
	+CLIENTSIDEONLY
	States
	{
	Spawn:
	YSHK A 0
	TNT1 A 0 A_Explode(100,128,0,1)
	YSHK A 1 Bright A_FadeOut(0.025)
	YSHK A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
	Loop
	Death:
	YBAL A 0
	Stop
	}
}

ACTOR GuruStormSpawner : GuruSpawnerInheritance
{
	ReactionTime 6
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 24 A_CustomMissile("GuruBoltage",-16,0,frandom(0,359),2) //A_SpawnItemEx("GuruBoltage",random(60,-60),random(60,-60),0,frandom(25,29),frandom(25,29),0,random(0,359),128,0)
	TNT1 A 0 A_Countdown
	Loop
	Death:
	TNT1 A 0
	Stop
	}
}

actor GuruBoltage
{
  Radius 8
  Height 13
  Speed 25
  Projectile
  +NOINTERACTION
  +NOCLIP
  +SEEKERMISSILE
  +CEILINGHUGGER
  +SPAWNCEILING
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 40
  HereComesTehBoi:
    TNT1 AAAAAAAAAAAAAAA 2 A_SeekerMissile(90,90,SMF_LOOK|SMF_PRECISE,100,7)
    TNT1 A 0 A_SpawnItemEx("GuruStormBolt",0,0,0,0,0,random(-160,-170),0,0,0)
    Stop
  }
}

ACTOR GuruStormBolt
{
   Speed 1
   Radius 8
   Height 12
   Renderstyle Add
   SeeSound ""
   PROJECTILE
   -NOGRAVITY
   +BLOODLESSIMPACT
   +RIPPER
   +FORCERADIUSDMG
   +SEEKERMISSILE
   +SCREENSEEKER
   DamageType "Superweapon"
   States
   {
   Spawn:
      TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,240,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,120,0,0)
	TNT1 A 0 A_SpawnItemEx("GuruShocklet",0,0,0,30,0,0,0,0,0)
	TNT1 A 0 bright A_SetAngle(7 + angle)
      TNT1 A 2 A_SpawnItemEx("StormBoltFade",0,0,0,frandom(0.25,-0.25),frandom(0.25,-0.25),frandom(0.25,-0.25),0,0)
      Loop
   Death:
      TNT1 A 0 A_PlaySoundEx("Weapons/GuruStruck",5)
      TNT1 A 0 A_Explode(30000,768,0,1)
      TNT1 A 0 A_SpawnItemEx("GuruBoltStruckGlowX",0,0,0,0,0,0,0,0,0)
      TNT1 A 0 A_SpawnItemEx("GuruBoltStruckGlowY",0,0,0,0,0,0,0,0,0)
      TNT1 AAAAAAA 2 A_SpawnItemEx("GuruHitSpark",random(20,-20),random(20,-20),random(30,-5),0,0,0,0,0,0)
      stop
   }
}

ACTOR StormBoltFade : GuruEffectInheritance
{
   Damage 0
   Renderstyle Add
   SeeSound ""
   PROJECTILE
   +NOGRAVITY
   +NOINTERACTION
   +FORCEYBILLBOARD
   States
   {
   Spawn:
	LITE A 0
	LITE ABCDABCDABCD 1 Bright A_FadeOut(0.05)
	Stop
   }
}
ACTOR GuruBoltStruckGlowY : GuruGigaStruckGlowY
{
	Scale 0.35
}

ACTOR GuruBoltStruckGlowX : GuruGigaStruckGlowX
{
	Scale 0.35
}
