/*
CREDITS:

Sprites:
Weapon - Apogee (ROTT)
Projectile - ID (Doom 3)
Giant Rolling Stone, Stone fragments - CutmanMike? (Propably not his work, hence the ?, but I got that from some mod of his, I think...)

Sounds:
Up - Valve (Team Fortress 2)
Pickup idle - ?
Pickup - Blizzard (Diablo 2)
Fire - Perkristian
Charge - ?
Excalistorm - Totally no idea, it's a huge mashup of sounds made by me aeons ago.
Rolling stone hum - ?
Rolling stone, impact - Croteam (Serious Sam 3)
Switch to Excalistorm, Summon Rolling Stone - Blizzard (Diablo 2)
Switch to Rolling Stone - ?
Launch Rolling Stone - Raven (Wolfenstein 3)
*/

actor ExcalibatPickup : CustomInventory
{
   	Inventory.PickupMessage "You got the ''Excalibat''! No comment is needed, name says everything you need to know. (1)"
	Inventory.PickupSound "Weapons/ExcalibatPick"
	DropItem "Excalibat"
	+FLOAT
	+FLOATBOB
	Scale 0.5
	States
	{
		Spawn:
		BBTG XX 0 A_PlaySound("Weapons/ExcalibatChant",5,1.0,1)
		BBTG X 1 Bright A_SpawnItemEx("ExcalibatParticle",frandom(-3,3),frandom(-3,3),frandom(10,50),0,0,frandom(0.5,0.75),0,128,0)
		Loop
		Pickup:
		TNT1 A 0 A_JumpIfInventory("Excalibat",1,"Bailure")
		Goto Success
		Bailure:
		BBTG X 1 Bright A_SpawnItemEx("ExcalibatParticle",frandom(-3,3),frandom(-3,3),frandom(10,50),0,0,frandom(0.5,0.75),0,128,0)
		Fail
		Success:
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_GiveInventory("Excalibat")
		Stop
	}
}

ACTOR Excalibat : Weapon 24515
{
	//$Category Weapons
	//$Title Excalibat
	//$Sprite BBTGX0
	Inventory.PickupSound "Weapons/ExcalibatPick"
   	Inventory.PickupMessage "You got the ''Excalibat''! No comment is needed, name says everything you need to know. (1)"
	Weapon.UpSound "Weapons/ExcalibatBonk"
	Weapon.SelectionOrder 7
	Obituary "%k has slained %o with the excaliblast!"
	Weapon.AmmoType "ExcaliAmmo"
	Weapon.AmmoGive 100
	Weapon.AmmoUse 20
	Weapon.AmmoType2 "ExcaliAmmo"
	Weapon.AmmoUse2 1
	Weapon.Kickback 125
	Weapon.SlotNumber 1
	+WEAPON.MELEEWEAPON
	+NOALERT
	+FLOATBOB
	+AMMO_OPTIONAL
	+ALT_AMMO_OPTIONAL
	Scale 0.5
	States
	{
	Spawn:
		BBTG X 1 Bright A_SpawnItemEx("ExcalibatParticle",frandom(-3,3),frandom(-3,3),frandom(10,50),0,0,frandom(0.5,0.75),0,128,0)
		Loop
	Ready:
		BBTG A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("RO_GotoReload", 1, "Reload")
		Loop
	Deselect:
		BBTG A 0 A_ZoomFactor(1)
     	BBTG A 0 SetPlayerProperty(0,0,0)
		BBTG A 0 A_StopSound(5)
		BBTG A 1 A_Lower
		BBTG A 0 A_Lower
		Loop
	Select:
		BBTG A 1 A_Raise
		BBTG A 0 A_Raise
		Loop
	Fire:
    	BBTG A 0 A_JumpIfInventory("ExcaliAmmo",20,1)
    	Goto Ready
    	BBTG ABC 1
    	TNT1 A 2
		BBTX A 0 A_SetBlend("Green", 0.45, 12)
		BBTX A 0 A_Quake(4,11,0,2,0)
		BBTX A 0 A_PlayWeaponSound("Weapons/ExcalibatWoosh")

		BBTG A 0 A_ZoomFactor(0.7)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
   	 	TNT1 A 0 A_AlertMonsters
   	 	TNT1 A 0 A_FireCustomMissile("ExcalibatBolt",-40,1,0,0)
   	 	BBTX A 1 Bright A_FireCustomMissile("ExcalibatBolt",-35,0,0,0)
   
   		BBTG A 0 A_ZoomFactor(0.75)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
      	TNT1 A 0 A_AlertMonsters
      	TNT1 A 0 A_FireCustomMissile("ExcalibatBolt",-30,0,0,0)
   	 	BBTX B 1 Bright A_FireCustomMissile("ExcalibatBolt",-25,0,0,0)
   
   		BBTG A 0 A_ZoomFactor(0.8)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
      	TNT1 A 0 A_AlertMonsters
      	TNT1 A 0 A_FireCustomMissile("ExcalibatBolt",-20,0,0,0)
      	BBTX C 1 Bright A_FireCustomMissile("ExcalibatBolt",-15,0,0,0)
      
 		BBTG A 0 A_ZoomFactor(0.85)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
        TNT1 A 0 A_AlertMonsters
   	 	TNT1 A 0 A_FireCustomMissile("ExcalibatBolt",-10,0,0,0)
   	 	BBTX D 1 Bright A_FireCustomMissile("ExcalibatBolt",-5,0,0,0)
   
   		BBTG A 0 A_ZoomFactor(0.875)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
      	TNT1 A 0 A_AlertMonsters
   	 	TNT1 A 0 A_FireCustomMissile("ExcalibatBolt",5,0,0,0)
   	 	BBTX E 1 Bright A_FireCustomMissile("ExcalibatBolt",10,0,0,0)

		BBTG A 0 A_ZoomFactor(0.9)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
   	 	TNT1 A 0 A_AlertMonsters
   	 	TNT1 A 0 A_FireCustomMissile("ExcalibatBolt",15,0,0,0)
      	BBTX F 1 Bright A_FireCustomMissile("ExcalibatBolt",20,0,0,0)

		BBTG A 0 A_ZoomFactor(0.925)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
   	 	TNT1 A 0 A_AlertMonsters
   	 	TNT1 A 0 A_FireCustomMissile("ExcalibatBolt",25,0,0,0)
      	BBTX G 1 Bright A_FireCustomMissile("ExcalibatBolt",30,0,0,0)

		BBTG A 0 A_ZoomFactor(0.95)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
   	 	TNT1 A 0 A_AlertMonsters
   	 	TNT1 A 0 A_FireCustomMissile("ExcalibatBolt",35,0,0,0)
      	BBTX H 1 Bright A_FireCustomMissile("ExcalibatBolt",40,0,0,0)
      	TNT1 A 1 A_ZoomFactor(0.975)
      	TNT1 A 1 A_ZoomFactor(0.985)
      	TNT1 A 1 A_ZoomFactor(1)
      	TNT1 A 17
      	TNT1 A 0 A_ClearReFire
        BBTG CBA 1
		Goto Ready
	AltFire:
       	BBTG A 0 A_JumpIfInventory("ExcaliMode",1,"StoneFire")
       	BBTG A 0 A_JumpIfInventory("ExcaliAmmo",1,1)
       	Goto Ready
    	BBTG ABC 1
		BBTG A 0 A_PlaySound("Weapons/ExcalibatCharge",5,1,0,ATTN_NORM)
    	TNT1 A 0 A_GiveInventory("ExcalibatStrachoNaLachoImbaInator",1)
   	 	BBTG A 0 A_AlertMonsters

		TNT1 A 13 A_Quake(1,13,0,2,0)
		TNT1 A 13 A_Quake(2,13,0,2,0)
		TNT1 A 13 A_Quake(3,13,0,2,0)
		TNT1 A 13 A_Quake(4,13,0,2,0)
		BBTX A 0 A_ReFire
		//Goto Fire+4
	AltHold:
       	BBTG A 0 A_JumpIfInventory("ExcaliMode",1,"Ready")
       	BBTG A 0 A_JumpIfInventory("ExcaliAmmo",1,1)
       	Goto Ready
		BBTG A 0 A_ZoomFactor(0.7)
		BBTG A 0 A_PlaySound("Weapons/ExcalibatLoop",5,1,1,ATTN_NONE)
    	BBTG A 0 SetPlayerProperty(0,1,0)
    	BBTG A 0 A_ChangeFlag("INVULNERABLE",1)
    	BBTG A 0 A_ChangeFlag("REFLECTIVE",1)

       	BBTG A 0 A_JumpIfNoAmmo("EndTheMadness")
		TNT1 A 0 ThrustThing(angle*256/360, frandom(6,-6), 0, 0)
		TNT1 A 0 A_SetBlend("Green", 0.25, 1)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-400+random(30,75),0)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
         BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",0,1,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",45,0,0,0,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",90,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",135,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",180,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",225,0,0,0,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",270,0,0,0,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",315,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatSwirl",0,1,0,0)
		BBTX B 1 Bright

       	BBTG A 0 A_JumpIfNoAmmo("EndTheMadness")
		TNT1 A 0 ThrustThing(angle*256/360, frandom(6,-6), 0, 0)
		TNT1 A 0 A_SetBlend("Green", 0.245, 1)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-400+random(30,75),0)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-200,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",0,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",45,0,0,0,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",90,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",135,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",180,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",225,0,0,0,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",270,0,0,0,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",315,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatSwirl",0,0,0,0,0)
		BBTX C 1 Bright

       	BBTG A 0 A_JumpIfNoAmmo("EndTheMadness")
		TNT1 A 0 ThrustThing(angle*256/360, frandom(6,-6), 0, 0)
		TNT1 A 0 A_SetBlend("Green", 0.235, 1)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-400+random(30,75),0)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-200,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",0,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",45,0,0,0,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",90,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",135,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",180,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",225,0,0,0,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",270,0,0,0,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",315,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatSwirl",0,1,0,0)
		BBTX D 1 Bright

       	BBTG A 0 A_JumpIfNoAmmo("EndTheMadness")
		TNT1 A 0 ThrustThing(angle*256/360, frandom(6,-6), 0, 0)
		TNT1 A 0 A_SetBlend("Green", 0.225, 1)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-400+random(30,75),0)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-200,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",0,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",45,0,0,0,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",90,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",135,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",180,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",225,0,0,0,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",270,0,0,0,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",315,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatSwirl",0,0,0,0,0)
		BBTX E 1 Bright

       	BBTG A 0 A_JumpIfNoAmmo("EndTheMadness")
		TNT1 A 0 ThrustThing(angle*256/360, frandom(6,-6), 0, 0)
		TNT1 A 0 A_SetBlend("Green", 0.235, 1)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-400+random(30,75),0)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-200,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",0,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",45,0,0,0,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",90,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",135,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",180,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",225,0,0,0,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",270,0,0,0,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",315,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatSwirl",0,1,0,0)
		BBTX F 1 Bright

       	BBTG A 0 A_JumpIfNoAmmo("EndTheMadness")
		TNT1 A 0 ThrustThing(angle*256/360, frandom(6,-6), 0, 0)
		TNT1 A 0 A_SetBlend("Green", 0.245, 1)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-400+random(30,75),0)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-200,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",0,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",45,0,0,0,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",90,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",135,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",180,0,0,0,0)
      	BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",225,0,0,0,0)
        //BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",270,0,0,0,0)
        BBTG F 0 A_FireCustomMissile("ExcalibatChaosBolt",315,0,0,0,0)
      	//BBTG F 0 A_FireCustomMissile("ExcalibatSwirl",0,0,0,0,0)
		BBTX H 1 Bright
		
		BBTG C 0 A_ReFire
	EndTheMadness:
    	BBTG A 0 SetPlayerProperty(0,0,0)
		BBTG A 0 A_PlaySound("Weapons/ExcalibatEnd",5,1,0,ATTN_NORM)
    	TNT1 A 0 A_TakeInventory("PowerBaseball",1)
		TNT1 A 0 A_SetBlend("Green", 0.445, 16)
		BBTG A 0 A_ZoomFactor(0.75)
		TNT1 A 1 ACS_Execute(851,0,0,-300,0)
		BBTG A 0 A_ZoomFactor(0.775)
		TNT1 A 1 ACS_Execute(851,0,0,-300,0)
		BBTG A 0 A_ZoomFactor(0.8)
		TNT1 A 1 ACS_Execute(851,0,0,-200,0)
		BBTG A 0 A_ZoomFactor(0.825)
		TNT1 A 1 ACS_Execute(851,0,0,-200,0)
		BBTG A 0 A_ZoomFactor(0.85)
		TNT1 A 1 ACS_Execute(851,0,0,-100,0)
		BBTG A 0 A_ZoomFactor(0.875)
		TNT1 A 1 ACS_Execute(851,0,0,-100,0)
		BBTG A 0 A_ZoomFactor(0.9)
		TNT1 A 1 ACS_Execute(851,0,0,-50,0)
		BBTG A 0 A_ZoomFactor(0.925)
		TNT1 A 1 ACS_Execute(851,0,0,-50,0)
		BBTG A 0 A_ZoomFactor(0.95)
		TNT1 A 1 ACS_Execute(851,0,0,-25,0)
		BBTG A 0 A_ZoomFactor(0.975)
		TNT1 A 1 ACS_Execute(851,0,0,-25,0)
		BBTG A 0 A_ZoomFactor(0.985)
    	BBTG A 0 A_ChangeFlag("INVULNERABLE",0)
    	BBTG A 0 A_ChangeFlag("REFLECTIVE",0)
    	BBTG C 1 A_ZoomFactor(0.995)
    	BBTG B 1 A_ZoomFactor(1)
		BBTG AAA 1
		STCG A 0 A_ClearReFire
		BBTG A 12
    	Goto Ready
	StoneFire:
		TNT1 A 0 A_JumpIfInventory("ExcaliAmmo",100,1)
		Goto Ready
		BBTG ABC 1
		HEMD A 0 SetPlayerProperty(0,1,0)
		TNT1 A 10
		HEMD A 0 A_PlaySound("Weapons/StoneSpawn",5)
		HEMD A 0 A_TakeInventory("ExcaliAmmo",100,TIF_NOTAKEINFINITE)
		HEMD A 0 A_SpawnItemEx("StoneReadyForHurrr",60)
		HEMD A 0 A_Quake(2,10,0,2,0)
		HEMD ABCDEFGHIJ 1
		HEMD A 0 A_Quake(3,13,0,2,0)
		HEMD K 1 A_ZoomFactor(0.9)
		HEMD L 1 A_ZoomFactor(0.7)
		HEMD M 1 A_ZoomFactor(0.65)
		HEMD N 1 A_ZoomFactor(0.675)
		HEMD O 1 A_ZoomFactor(0.7)
		HEMD P 1 A_ZoomFactor(0.8)
		HEMD Q 1 A_ZoomFactor(0.9)
		HEMD R 1 A_ZoomFactor(0.925)
		HEMD S 1 A_ZoomFactor(0.95)
		TNT1 A 1 A_ZoomFactor(0.975)
		TNT1 A 1 A_ZoomFactor(1)
		TNT1 A 13
		BBTX A 0 A_SetBlend("Green", 0.45, 12)
		BBTX A 0 A_Quake(6,11,0,2,0)
		BBTX A 0 A_PlaySound("Weapons/StoneLaunch",1,1.0,0,ATTN_NONE)

		BBTG A 0 A_ZoomFactor(0.7)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
   	 	TNT1 A 0 A_AlertMonsters
   	 	TNT1 A 0 A_FireCustomMissile("RollingStone")
   	 	BBTX A 1 Bright
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
   	 	BBTX B 1 Bright A_ZoomFactor(0.5)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
   		BBTX C 1 Bright A_ZoomFactor(0.6)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
   		BBTX D 1 Bright A_ZoomFactor(0.7)
   	 	TNT1 A 0 ACS_Execute(851,0,0,-100,0)
   		BBTX E 1 Bright A_ZoomFactor(0.8)
     		BBTX A 0 SetPlayerProperty(0,0,0)
		TNT1 A 1 A_ZoomFactor(0.9)
		TNT1 A 1 A_ZoomFactor(0.995)
      		TNT1 A 1 A_ZoomFactor(1)
      		TNT1 A 17
      		TNT1 A 0 A_ClearReFire
          	BBTG CBA 1
		Goto Ready
    Reload: //Switches to Rolling Stone Mode
		BBTG A 0 A_JumpIfInventory("ExcaliMode",1,"UnReload")
		BBTG A 0 A_PlaySound("Weapons/RockNRollMode",5)
		BBTG A 0 A_PlaySound("Weapons/StoneChunk",6)
		TNT1 A 0 A_SetBlend("Grey", 0.25, 24)
		TNT1 A 0 A_Quake(1,10,0,5,"none")
		TNT1 A 0 A_Print("''Sisyphus Best Buddy'' Mode")
		TNT1 AA 0 A_SpawnItemEx("MissileExpSmoke", random(15,-15), random(15,-15), 30+random(15,-15),frandom(0.1,0.2),frandom(0.1,0.2),frandom(0.1,0.2),0,128,0)
		BBTG A 0 A_GiveInventory("ExcaliMode",1)
		BBTG A 18 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
    	Goto Ready
	UnReload: //Switches to Excalistorm Mode
		BBTG A 0 A_PlaySound("Weapons/ExcalistormMode",5)
		TNT1 A 0 A_SetBlend("Green", 0.25, 24)
		TNT1 A 0 A_Quake(1,10,0,5,"none")
		TNT1 A 0 A_Print("Excalistorm Mode")
		TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx("ExcalibatParticle", random(15,-15), random(15,-15), 30+random(15,-15),0,0,frandom(0.5,0.75),0,128,0)
		BBTG A 0 A_TakeInventory("ExcaliMode",1)
		BBTG A 18 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
    	Goto Ready
	}
}

ACTOR ExcaliMode : Inventory
{
	Inventory.MaxAmount 1
}

ACTOR ExcaliAmmo : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 100
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 100
	Inventory.Icon "BBTGX0"
}

ACTOR ExcalibatBolt
{
	Radius 11
	Height 8
	Speed 60
	Damage 50
	PROJECTILE
	Scale 0.25
	Renderstyle Add
	+NOGRAVITY
	+EXPLODEONWATER
	+FORCERADIUSDMG
	+FOILINVUL
	+DONTBLAST
	Obituary "%k has slained %o with the excaliblast!"
	States
	{
	Spawn:
		D3BP ABCDEFG 1 Bright A_SpawnItemEx("ExcalibatTrail")
		Loop
	Death:
		D3BX A 0 A_PlaySound("Weapons/ExcalibatHit",0,0.75,0,ATTN_NORM)
		D3BX A 0 A_Explode(200,192,0,1)
		D3BX A 0 A_SpawnItemEx("ExcalibatExp")
		stop
	}
}

ACTOR ExcalibatTrail
{
	Scale 0.25
	Alpha 0.75
	+NOGRAVITY
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			D3BP A 0
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP A 1 Bright A_FadeOut(0.055)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP B 1 Bright A_FadeOut(0.045)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP C 1 Bright A_FadeOut(0.055)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP D 1 Bright A_FadeOut(0.045)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP E 1 Bright A_FadeOut(0.055)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP F 1 Bright A_FadeOut(0.045)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP G 1 Bright A_FadeOut(0.055)
			Loop
	}
}

ACTOR ExcalibatExp
{
	Alpha 0.75
	+NOGRAVITY
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			D3BP A 0
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BX A 1 Bright A_FadeOut(0.05)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BX B 1 Bright A_FadeOut(0.05)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BX C 1 Bright A_FadeOut(0.045)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BX D 1 Bright A_FadeOut(0.035)
			D3BP A 0 //A_SetScale(ScaleX+0.025,ScaleY+0.025)
			D3BX E 1 Bright A_FadeOut(0.025)
			D3BP A 0 //A_SetScale(ScaleX+0.025,ScaleY+0.025)
			D3BX F 1 Bright A_FadeOut(0.015)
		Looplo:
			D3BP A 0 //A_SetScale(ScaleX+0.025,ScaleY+0.025)
			D3BX G 1 Bright A_FadeOut(0.065)
			Loop
	}
}

//Alt-Fire

ACTOR ExcalibatChaosBolt : ExcalibatBolt
{
	Radius 11
	Height 8
	Speed 60
	Damage 60
	PROJECTILE
	Scale 0.25
	Renderstyle Add
	+NOGRAVITY
	+EXPLODEONWATER
	+FORCERADIUSDMG
	+FOILINVUL
	+DONTBLAST
	Obituary "%k has slained %o by the almighty power of excalistorm!"
	Deathsound "Weapons/ExcalibatHit"
	States
	{
	Spawn:
		D3BP ABCDEFG 1 Bright A_SpawnItemEx("ExcalibatTrail2")
	MegaSpaceShitOfApocalypse:
		D3BP A 1 Bright A_ChangeVelocity (frandom(-4, 4), frandom(-4, 4), frandom(-4, 4), 0)
		D3BP A 0 A_SpawnItemEx("ExcalibatTrail2")
		Loop
	ChaoticSpaceSausageOfDoom:
		D3BP A 1 Bright A_SpawnItemEx("ExcalibatTrail")
		TNT1 A 0 A_ChangeVelocity (frandom(-4, 4), frandom(-4, 4), frandom(-4, 4), 0)
		D3BP B 1 Bright A_SpawnItemEx("ExcalibatTrail")
		TNT1 A 0 A_ChangeVelocity (frandom(-4, 4), frandom(-4, 4), frandom(-4, 4), 0)
		D3BP C 1 Bright A_SpawnItemEx("ExcalibatTrail")
		TNT1 A 0 A_ChangeVelocity (frandom(-4, 4), frandom(-4, 4), frandom(-4, 4), 0)
		D3BP D 1 Bright A_SpawnItemEx("ExcalibatTrail")
		TNT1 A 0 A_ChangeVelocity (frandom(-4, 4), frandom(-4, 4), frandom(-4, 4), 0)
		D3BP E 1 Bright A_SpawnItemEx("ExcalibatTrail")
		TNT1 A 0 A_ChangeVelocity (frandom(-4, 4), frandom(-4, 4), frandom(-4, 4), 0)
		D3BP F 1 Bright A_SpawnItemEx("ExcalibatTrail")
		TNT1 A 0 A_ChangeVelocity (frandom(-4, 4), frandom(-4, 4), frandom(-4, 4), 0)
		D3BP G 1 Bright A_SpawnItemEx("ExcalibatTrail")
		TNT1 A 0 A_ChangeVelocity (frandom(-4, 4), frandom(-4, 4), frandom(-4, 4), 0)
		Loop
	Death:
		D3BX A 0 A_PlaySound("Weapons/ExcalibatHit",0,0.5,0,ATTN_NORM)
		D3BX A 0 A_Explode(150,192,0,1)
		D3BX A 0 A_SpawnItemEx("ExcalibatExp")
		stop
	}
}

ACTOR ExcalibatTrail2 : ExcalibatTrail
{
	Alpha 0.6
	States
	{
		Spawn:
			D3BP A 0
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP A 1 Bright A_FadeOut(0.075)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP B 1 Bright A_FadeOut(0.065)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP C 1 Bright A_FadeOut(0.075)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP D 1 Bright A_FadeOut(0.065)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP E 1 Bright A_FadeOut(0.075)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP F 1 Bright A_FadeOut(0.065)
			D3BP A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			D3BP G 1 Bright A_FadeOut(0.075)
			Loop
	}
}

ACTOR ExcalibatStrachoNaLachoImbaInator : PowerupGiver
{
   +INVENTORY.AUTOACTIVATE
   +INVENTORY.ALWAYSPICKUP
   Inventory.MaxAmount 0
   Powerup.Type Baseball
  powerup.color "Green" 0.0
   Inventory.PickupMessage "Teh monsters fears your baseball bat!"
   States
   {
   Spawn:
       TNT1 A 1 Bright
       Loop
   }
}


ACTOR PowerBaseball : PowerFrightener
{
  Powerup.Duration 0x7FFFFFFF
}

actor ExcalibatSwirl
{
  Radius 1
  Height 1
  Speed 0
  +FORCERADIUSDMG
  +FOILINVUL
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1 A_Explode(100000,192,0,1)
    Stop
  }
}

//Pickup & Mode change particle

ACTOR ExcalibatParticle
{
	Scale 0.0175
	Alpha 0.75
	+NOGRAVITY
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			D3BP A 0
			TNT1 A 0 A_ChangeVelocity (frandom(-0.25, 0.25), frandom(-0.25, 0.25), 0, 0)
			D3BP A 1 Bright A_FadeOut(0.035)
			TNT1 A 0 A_ChangeVelocity (frandom(-0.25, 0.25), frandom(-0.25, 0.25), 0, 0)
			D3BP B 1 Bright A_FadeOut(0.035)
			TNT1 A 0 A_ChangeVelocity (frandom(-0.25, 0.25), frandom(-0.25, 0.25), 0, 0)
			D3BP C 1 Bright A_FadeOut(0.035)
			TNT1 A 0 A_ChangeVelocity (frandom(-0.25, 0.25), frandom(-0.25, 0.25), 0, 0)
			D3BP D 1 Bright A_FadeOut(0.035)
			TNT1 A 0 A_ChangeVelocity (frandom(-0.25, 0.25), frandom(-0.25, 0.25), 0, 0)
			D3BP E 1 Bright A_FadeOut(0.035)
			TNT1 A 0 A_ChangeVelocity (frandom(-0.25, 0.25), frandom(-0.25, 0.25), 0, 0)
			D3BP F 1 Bright A_FadeOut(0.035)
			TNT1 A 0 A_ChangeVelocity (frandom(-0.25, 0.25), frandom(-0.25, 0.25), 0, 0)
			D3BP G 1 Bright A_FadeOut(0.035)
			Loop
	}
}

//Stone Mode

ACTOR StoneReadyForHurrr
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	Scale 0
	States
	{
	Spawn:
	TNT1 A 0
	ROL2 FEDCBA 1 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
	ROLR ZYXWVUTSRQPONM 1 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
	ROLR M 14
	Stop
	}
}

ACTOR RollingStone
{
	Radius 20
	Height 16
	Speed 80
	Damage 1
	BounceSound "Weapons/StoneBounce"
 	+MISSILE
 	+STEPMISSILE
 	+DROPOFF
 	+NOEXPLODEFLOOR
	+THRUGHOST
	+BOUNCEONFLOORS
	+BOUNCEONWALLS
	+BOUNCEONCEILINGS
	+CANBOUNCEWATER
	+RIPPER
	+BLOODLESSIMPACT
	+FORCERADIUSDMG
	-NOGRAVITY
	MaxStepHeight 64
	BounceFactor 1
	BounceCount 20
	ReactionTime 12
	Obituary "%o was made into a pancake by %k's and Sisyphus best buddy." //Rock of Ages, anyone?
	Scale 1
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Quake (4, 33, 0, 256,"none") 
	TNT1 A 0 A_PlaySound("Weapons/RollingStone1",5,1.0,1)
	TNT1 A 0 A_PlaySound("Weapons/RollingStone2",6,0.8,1)
	TNT1 A 0 A_Countdown
	ROL2 FEDCBA 1 A_Explode(240,192,0)
	ROLR ZYXWVUTSRQPONMLKJIHGFEDCBA 1 A_Explode(240,192,0)
	Loop
	Death:
	TNT1 A 0
	TNT1 A 0 A_PlaySound("Weapons/StoneExplode",5,1.0,0)
	TNT1 A 0 A_PlaySound("Weapons/StoneExplode2",6,1.0,0)
	TNT1 A 0 A_Quake (6, 35, 0, 768, "none") 
	TNT1 A 0 A_SpawnItemEx("StoneExplode",0,0,0,0,0,0,0,128,0)
	Stop
	}
}

Actor StoneExplode
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("StoneSmokeBlastSpawner",0,0,0,0,0,0,0,128,0)
	TNT1 A 0 A_SpawnItemEx("StoneSmokeStaticSpawner",0,0,0,0,0,0,0,128,0)
	TNT1 A 0 A_SpawnItemEx("StoneChunkSpawner",0,0,0,0,0,0,0,128,0)
	Stop
	}
}

Actor StoneSmokeBlastSpawner
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	ReactionTime 150
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("StoneSmoke",random(60,-60),random(60,-60),random(60,-60),frandom(5,3),frandom(5,3),frandom(4,-4),random(0,359),128,0)
	Loop
	Death:
	Stop
	}
}

Actor StoneSmokeStaticSpawner
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	ReactionTime 30
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("StoneSmoke",random(80,-80),random(80,-80),random(60,-60),frandom(0.1,0.05),frandom(0.1,0.05),frandom(0.1,0.05),random(0,359),128,0)
	Loop
	Death:
	Stop
	}
}

Actor StoneChunkSpawner
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	ReactionTime 25
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Countdown
	TNT1 A 0 A_SpawnItemEx("StoneChunk",random(30,-30),random(30,-30),random(30,-30),frandom(10,6),frandom(10,6),frandom(12,3),random(0,359),128,0)
	Loop
	Death:
	Stop
	}
}

ACTOR StoneSmoke : MissileExpSmoke
{
	Scale 0.8
	Alpha 0.75
	+CLIENTSIDEONLY
}

ACTOR StoneChunk
{
	Radius 10
	Height 8
	Projectile
	Gravity 1
	BounceSound "Weapons/StoneChunk"
	-NOGRAVITY
	+BOUNCEONWALLS 
	+CLIENTSIDEONLY
	Scale 0.25
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 //A_SetScale(frandom(0.4,0.1), frandom(0.4,0.1))
	TNT1 A 0 A_Jump(255,"B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
	B:
	RCKF B 1
	Loop
	C:
	RCKF C 1
	Loop
	D:
	RCKF D 1
	Loop
	E:
	RCKF E 1
	Loop
	F:
	RCKF F 1
	Loop
	G:
	RCKF G 1
	Loop
	H:
	RCKF H 1
	Loop
	I:
	RCKF I 1
	Loop
	J:
	RCKF J 1
	Loop
	K:
	RCKF K 1
	Loop
	L:
	RCKF L 1
	Loop
	M:
	RCKF M 1
	Loop
	N:
	RCKF N 1
	Loop
	O:
	RCKF O 1
	Loop
	P:
	RCKF P 1
	Loop
	Q:
	RCKF Q 1
	Loop
	R:
	RCKF R 1
	Loop
	S:
	RCKF S 1
	Loop
	T:
	RCKF T 1
	Loop
	U:
	RCKF U 1
	Loop
	V:
	RCKF V 1
	Loop
	W:
	RCKF W 1
	Loop
	X:
	RCKF X 1
	Loop
	Y:
	RCKF Y 1
	Loop
	Z:
	RCKF Z 1
	Loop
	Death:
	"####" "#" 175
	"####" "#" 1 A_FadeOut(0.05)
	Wait
	}
}
