/*
Maniac Nonspell library. This shit is nuts.
*/
task Nonspell (type, tier){
	if (type==1){
		StarSpam(tier);
		}
	else if (type==2){
		StarSpread(tier);
		}
	else if (type==3){
		StarHalfSpread(tier);
		}
	else if (type==4){
		StarRev(tier);
		}
	}
task StarSpam (tier){
	if (tier==1){loop{
		Concentration01(60);
		Wait(60);
		SpamCenter(GetX+50, GetY);
		SpamCenter(GetX-50, GetY);
		MoveNon(90);
		Wait(90);
		}}
	else {loop{
		Concentration01(60);
		Wait(60);
		SpamCenter(GetX+50, GetY+50);
		SpamCenter(GetX-50, GetY+50);
		SpamCenter(GetX, GetY-50);
		MoveNon(90);
		Wait(90);
		}}
	}
task SpamCenter (Xcoor, Ycoor){
	loop (45){
		CreateShotA(0, Xcoor, Ycoor, 10);
		SetShotDataA(0, 0, rand(5, 10), rand(45, 135),  rand (-0.2, 0.2), 0, 0, 147);
		FireShot(0);
		PlaySE(Shot1);
		Wait(2);
		}
	}
task StarSpread(tier){
	if (tier==1){loop{
		Concentration01(60);
		Wait(60);
		SpreadCenter(GetX+50, GetY+50);
		SpreadCenter(GetX-50, GetY+50);
		MoveNon(90);
		Wait(90);
		}}
	else{loop{
		Concentration01(60);
		Wait(60);
		SpreadCenter(GetX+50, GetY+50);
		SpreadCenter(GetX-50, GetY+50);
		SpreadCenter(GetX+100, GetY-50);
		SpreadCenter(GetX-100, GetY-50);
		MoveNon(90);
		Wait(90);
		}}
	}
task SpreadCenter(Xcoor, Ycoor){
	let angle = 0;
	loop(8){loop(18){
			CreateShotA(0, Xcoor, Ycoor, 10);
			SetShotDataA(0, 0, 6,angle, 0, 0, 0, 147);
			FireShot(0);
			angle+=5;
			}
		PlaySE(Shot1);
		Wait(10);
		angle+=rand(1,10);
		}
	}
task StarHalfSpread(tier){
	if (tier==1){loop{
		Concentration01(60);
		Wait(60);
		SpreadCenter(GetX+50, GetY+50);
		SpreadCenter(GetX-50, GetY+50);
		AimCenter(GetX, GetY-50);
		MoveNon(90);
		Wait(90);
		}}
	else{loop{
		Concentration01(60);
		Wait(60);
		SpreadCenter(GetX+50, GetY+50);
		SpreadCenter(GetX-50, GetY+50);
		SpreadCenter(GetX+100, GetY-50);
		SpreadCenter(GetX-100, GetY-50);
		AimCenter(GetX, GetY);
		MoveNon(90);
		Wait(90);
		}}
	}
task AimCenter(Xcoor, Ycoor){
	ascent(i in 1..7){
		CreateShotA(0,Xcoor, Ycoor, 0);
		SetShotDataA(0, 0, 0.6*i, GetRelativeAngleToPlayer(Xcoor, Ycoor), 0, 0, 0, 135);
		FireShot(0);
		}
	PlaySE(Shot2);
	}
task StarRev(tier){
	if (tier==1){loop{
		Concentration01(60);
		Wait(60);
		RevCenter(GetX+50, GetY, GetX);
		RevCenter(GetX-50, GetY, GetX);
		MoveNon(50);
		Wait(50);
		}}
	else{loop{
		Concentration01(60);
		Wait(60);
		RevCenter(GetX+50, GetY+50, GetX);
		RevCenter(GetX-50, GetY+50, GetX);
		RevCenter(GetX+50, GetY-50, GetX);
		RevCenter(GetX-50, GetY-50, GetX);
		MoveNon(50);
		Wait(50);
		}}
	}
task RevCenter(Xcoor, Ycoor, Center){
	let dist = 0;
	let angle = 0;
	if (Xcoor>Center){loop(25){loop(6){
			CreateShotA(0, Xcoor-dist, Ycoor, 10);
			SetShotDataA(0, 0, 5,angle,  0, 0, 0, 147);
			FireShot(0);
			angle+=60;
			}
		Wait(2);
		angle+=rand(1,20);
		dist+=2;
		}}
	else{loop(25){loop(6){
			CreateShotA(0, Xcoor+dist, Ycoor, 10);
			SetShotDataA(0, 0, 5,angle,  0, 0, 0, 147);
			FireShot(0);
			angle+=60;
			}
		PlaySE(Shot1);
		Wait(2);
		angle+=rand(1,20);
		dist+=2;
		}}
	}
task MoveNon (frames){
	let MBX = [50, GetClipMaxX-50]; 
	let MBY = [50, 200];
	if (GetX > GetPlayerX && GetPlayerX > MBX[0]){
		SetMovePosition02(rand(MBX[0],GetPlayerX), rand(MBY[0],MBY[1]), frames);
		}
	else if (GetX > GetPlayerX && MBX[0]>GetPlayerX){
		SetMovePosition02(MBX[0], rand(MBY[0],MBY[1]), frames);
		}
	else if (GetPlayerX>GetX && MBX[1] > GetPlayerX){
		SetMovePosition02(rand(GetPlayerX, MBX[1]), rand(MBY[0],MBY[1]), frames);
		}
	else if (GetPlayerX>GetX && GetPlayerX > MBX[1]){
		SetMovePosition02(MBX[1], rand(MBY[0],MBY[1]), frames);
		}
	}