//SHIIING, sparkle sparkle.

class ItemParticle : Actor
{
	Default
	{
		Scale 0.05;
		Alpha 0.99;
		Renderstyle "Add";
		+NOINTERACTION
		+FORCEXYBILLBOARD
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0;
	SetScale:
		"####" "#" 0 A_SetScale(0.05);
	Main:
		"####" "#" 1 Bright {
			A_FadeOut(frandom(0.02,0.04));
			A_ChangeVelocity(frandom(0.1,-0.1),frandom(0.1,-0.1),frandom(0.1,-0.1),CVF_RELATIVE);
			A_SetScale(Scale.X-frandom(0.0025,0.005));
			Return A_JumpIf(Scale.X <= 0,"Null");
		}
		Loop;
	}
}

class RedParticle : ItemParticle
{
	States
	{
	Spawn:
		RPRT A 0;
		Goto Super::SetScale;
	}
}

class BlueParticle : ItemParticle
{
	States
	{
	Spawn:
		BPRT B 0;
		Goto Super::SetScale;
	}
}

class CyanParticle : ItemParticle
{
	States
	{
	Spawn:
		CPRT A 0;
		Goto Super::SetScale;
	}
}

class GreenParticle : ItemParticle
{
	States
	{
	Spawn:
		GPRT A 0;
		Goto Super::SetScale;
	}
}

class YellowParticle : ItemParticle
{
	States
	{
	Spawn:
		YPRT A 0;
		Goto Super::SetScale;
	}
}

class PurpleParticle : ItemParticle
{
	States
	{
	Spawn:
		PPRT A 0;
		Goto Super::SetScale;
	}
}

class WrathParticle : ItemParticle
{
	States
	{
	Spawn:
		OPRT A 0;
	SetScale:
		"####" "#" 0 A_SetScale(0.05);
	Main:

		"####" "#" 1 Bright {
			A_SetScale(Scale.X-frandom(0.0025,0.005));
			A_FadeOut(frandom(0.02,0.04));
			A_ChangeVelocity(0,0,frandom(-0.1,0.15),CVF_RELATIVE);
			Return A_JumpIf(Scale.X <= 0,"Null");
		}
		Loop;
	}
}

class TomeOfPowerParticle : WrathParticle
{
	Default
	{
		Renderstyle "Translucent";
	}
	
	States
	{
	Spawn:
		BPRT A 0;
		Goto Super::SetScale;
	}
}

class CoreParticle : ItemParticle //Blue Tiberium Core
{
	States
	{
	Spawn:
		BPRT E 0;
		Goto Super::SetScale;
	}
}

class EXTREMESphereParticle : ItemParticle //I think it's obvious?
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_Jump(256,"Red","Orange");
	Red:
		RPRT A 0;
		Goto Super::SetScale;
	Orange:
		OPRT A 0;
		Goto Super::SetScale;
	}
}

class WizardsEyeParticle : WrathParticle
{
	States
	{
	Spawn:
		KPRT A 0;
		Goto Super::SetScale;
	}
}

class SoulsphereParticle : ItemParticle
{
	States
	{
	Spawn:
		BPRT B 0;
	SetScale:
		"####" "#" 0 A_SetScale(0.1);
	Main:
		"####" "#" 1 Bright {
			A_SetScale(Scale.X-frandom(-0.01,0.02));
			A_FadeOut(frandom(0.02,0.04));
			A_ChangeVelocity(0,0,frandom(-0.1,0.15),CVF_RELATIVE);
			Return A_JumpIf(Scale.X <= 0,"Null");
		}
		Loop;
	}
}

class MegasphereParticle : SoulsphereParticle
{
	States
	{
	Spawn:
		KPRT A 0;
		Goto Super::SetScale;
	}
}

class ReaversphereParticle : SoulsphereParticle
{
	States
	{
	Spawn:
		CPRT A 0;
		Goto Super::SetScale;
	}
}

class InvulsphereParticle : SoulsphereParticle
{
	States
	{
	Spawn:
		GPRT A 0;
		Goto Super::SetScale;
	}
}

class AmplifierSpark : ItemParticle
{
	Default
	{
		Alpha 0.6;
	}
	
	States
	{
	Spawn:
	TNT1 A 0 NoDelay A_Jump(256,"SpriteA","SpriteB","SpriteC","SpriteD",
								"SpriteE","SpriteF","SpriteG","SpriteH");
	SpriteA:
		PLIT A 0 A_Jump(256,"SetScale");
	SpriteB:
		PLIT B 0 A_Jump(256,"SetScale");
	SpriteC:
		PLIT C 0 A_Jump(256,"SetScale");
	SpriteD:
		PLIT D 0 A_Jump(256,"SetScale");
	SpriteE:
		PLIT E 0 A_Jump(256,"SetScale");
	SpriteF:
		PLIT F 0 A_Jump(256,"SetScale");
	SpriteG:
		PLIT G 0 A_Jump(256,"SetScale");
	SpriteH:
		PLIT H 0 A_Jump(256,"SetScale");
	SetScale:
		"####" "#" 0 A_SetScale(frandom(0.025,0.1));
	Main:
		"####" "#" 1 Bright {
			A_SetScale(Scale.X+frandom(0.002,0.005));
			A_FadeOut(frandom(0.015,0.02));
			A_ChangeVelocity(frandom(-0.05,0.05),frandom(-0.05,0.05),frandom(-0.05,0.05),CVF_RELATIVE);
		}
		Loop;
	}
}

class ZerkParticle : ItemParticle //Syringe
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_Jump(256,"Red","Black");
	Red:
		RPRT A 0;
		Goto SetScale;
	Black:
		BPRT A 0 A_SetTranslucent(0.99,0);
	SetScale:
		"####" "#" 0 A_SetScale(frandom(0.06,0.03));
	Main:
		"####" "#" 1 Bright {
			A_SetScale(Scale.X-frandom(0.0025,0.005));
			A_FadeOut(frandom(0.03,0.05));
			A_ChangeVelocity(frandom(0.1,-0.1),frandom(0.1,-0.1),frandom(0.1,-0.1),CVF_RELATIVE);
			Return A_JumpIf(Scale.X <= 0,"Null");
		}
		Loop;
	}
}

class BarrelParticle : ItemParticle
{
	Default
	{
		Alpha 0.5;
	}
	
	States
	{
	Spawn:
		GPRT A 0;
		Goto Super::SetScale;
	}
}

//Tomes
class TomeParticle : Actor
{
	Default
	{
		Alpha 0.99;
		Renderstyle "Add";
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0;
	SetScale:
		"####" "#" 0 A_SetScale(0.1,0.4);
	Main:
		"####" "#" 1 Bright {
			A_FadeOut(frandom(0.02,0.04));
			A_ChangeVelocity(0,0,frandom(-0.1,0.15),CVF_RELATIVE);
			A_SetScale(Scale.X-frandom(0.01,0.02),Scale.Y-frandom(0.01,0.02));
			Return A_JumpIf(Scale.X <= 0,"Null");
		}
		Loop;
	}
}

class TomeParticleRed : TomeParticle
{
	States
	{
	Spawn:
		RPRT A 0;
		Goto Super::SetScale;
	}
}

class TomeParticleGreen : TomeParticle
{
	States
	{
	Spawn:
		GPRT A 0;
		Goto Super::SetScale;
	}
}

class TomeParticleBlue : TomeParticle
{
	States
	{
	Spawn:
		BPRT B 0;
		Goto Super::SetScale;
	}
}

class TomeParticleLightBlue : TomeParticle
{
	States
	{
	Spawn:
		LPRT A 0;
		Goto Super::SetScale;
	}
}

class TomeParticleYellow : TomeParticle
{
	States
	{
	Spawn:
		YPRT A 0;
		Goto Super::SetScale;
	}
}

class TomeParticlePurple : TomeParticle
{
	States
	{
	Spawn:
		PPRT A 0;
		Goto Super::SetScale;
	}
}

class TomeParticleOrange : TomeParticle
{
	States
	{
	Spawn:
		OPRT A 0;
		Goto Super::SetScale;
	}
}

class TomeParticleCyan : TomeParticle
{
	States
	{
	Spawn:
		CPRT A 0;
		Goto Super::SetScale;
	}
}

class TomeParticleKnives : TomeParticle
{
	States
	{
	Spawn:
		CPRT B 0;
		Goto Super::SetScale;
	}
}

class TomeParticleWhite : TomeParticle
{
	States
	{
	Spawn:
		WPRT A 0;
		Goto Super::SetScale;
	}
}

class TomeParticleBlack : TomeParticle
{
	Default
	{
		Renderstyle "Translucent";
	}
	
	States
	{
	Spawn:
		BPRT A 0;
		Goto Super::SetScale;
	}
}

class TomeParticleDarkpath : TomeParticle
{
	Default
	{
		Renderstyle "Translucent";
	}
	
	States
	{
	Spawn:
		PPRT B 0;
		Goto Super::SetScale;
	}
}

class TomeParticleDragonshout : TomeParticle
{
	States
	{
	Spawn:
		SPRT A 0;
		Goto Super::SetScale;
	}
}