
task Tshot11a{
	let a=1;
	while(GetCommonData("bossatack")==1){
		let b=0;
		loop(8){
			if(phase<=2){return;}
			let ang = angle+b*45;
			if(ex==0){
				CreateShotFromScript( "shot1",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 2.5, ang, 0, 06);
			}
			else{
				CreateShotFromScript( "shot1",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 2.5, ang+30, 0, 06);
				CreateShotFromScript( "shot1",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 2.5, ang-30, 0, 06);
			}
			b++;
		}
		wait(8-lv*4);
		a++;
	}
}
	

task Tshot11b{
	wait(80);
	let a=0;
	while(GetCommonData("bossatack")==1){
		if(phase<=2){return;}
		let p=atan2( GetPlayerY()-(GetY()), GetPlayerX()-(GetX()));
		let b=-3;
		loop(7){
			let c=-2;
			loop(5){
				CreateShotFromScript( "shot1",GetX(), GetY(), 1.2+ex*0.5, p+b*2.5+c*35, 0, 01);
				c++;
			}
			PlaySE(seshot2);
			b++;
		}
		wait(45-lv*10);
		a++;
		
		if(phase<=2||GetCommonData("bossatack")!=1){return;}
		let b=-3;
		loop(7){
			let c=-1.5;
			loop(4){
				CreateShotFromScript( "shot1",GetX(), GetY(), 1.2+ex*0.5, p+b*2.5+c*35, 0, 01);
				c++;
			}
			PlaySE(seshot2);
			b++;
		}
		wait(45-lv*10);
		a++;
	}
}

task Tshot11c{
	wait(40);
	let a=0;
	while(GetCommonData("bossatack")==1){
		let p1=atan2( GetPlayerY()-(GetY()), GetPlayerX()-(GetX()+50));
		let p2=atan2( GetPlayerY()-(GetY()), GetPlayerX()-(GetX()-50));
		let b=0;
		loop(7){
			if(phase<=2){return;}
			let c=-2;
			loop(5){
				CreateShotFromScript( "shot1",GetX()+50, GetY(), 3.5+ex, p1+c*25, 0, 11);
				CreateShotFromScript( "shot1",GetX()-50, GetY(), 3.5+ex, p2+c*25, 0, 11);
				c++;
			}
			wait(4-lv*2);
			PlaySE(seshot1);
			b++;
		}
		wait(40-lv*20);
		a++;
	}
}

task Tshot12a{
	let a=0;
	while(GetCommonData("bossatack")==2){
		let b=0;
		loop(8){
			if(phase<=2){return;}
			let ang = angle+b*45;
			CreateShotFromScript( "shot5",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 2.8+ex, 180-a*19.1, 0, 01);
			b++;
		}
		PlaySE(seshot2);
		wait(12-lv*6);
		a++;
	}
}
task Tshot12b{
	let a=0;
	while(GetCommonData("bossatack")==2){
		let b=0;
		loop(8){
			if(phase<=2){return;}
			let ang = angle+b*45;
			CreateShotFromScript( "shot1",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 2.0+ex*1.0, -a*19.1, 0, 05);
			b++;
		}
		wait(12-lv*6);
		//if(ex==0){wait(8-lv*4);}
		//else{wait(6-lv*3);}
		a++;
	}
}

task Tshot13a{
	let a=0;
	while(GetCommonData("bossatack")==3){
		let b=0;
		loop(12){
			if(phase<=2){return;}
			let c=0;
			loop(4){
				let ang = angle+c*45;
				if(ex==1&&c%4==0){
					CreateShotFromScript( "shot3",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 0.05+0.01*ex, 100, 0, 01);
					CreateShotFromScript( "shot3",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 0.05+0.01*ex, 70, 0, 01);
				}
				else{
					CreateShotFromScript( "shot3",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 0.05+0.01*ex, 90, 0, 01);
				}
				c+=2;
			}
			wait(3-lv*1);
			PlaySE(seshot1);
			b++;
		}
		wait(36-lv*18);
		a++;
	}
}
task Tshot13b{
	wait(20);
	let a=0;
	while(GetCommonData("bossatack")==3){
		if(phase<=2){return;}
		let b=0;
		loop(4){
			let ang = 45+angle+b*90;
			CreateShotFromScript( "shot1",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 2.0+ex, 90+cos(ang)*120, 0, 12);
			if(ex==1){
				CreateShotFromScript( "shot1",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 2.0, 90+cos(ang)*180, 0, 12);
			}
			b++;
		}
		wait(8-lv*4);
		a++;
	}
}

task Tshot14a{
	wait(20);
	let a=0;
	while(GetCommonData("bossatack")==4){
		let b=0;
		loop(40){
			if(phase<=2){return;}
			let c=0;
			loop(4){
				let ang = angle+c*90;
				let p=atan2( 480-(GetY()+sin(ang)*112.5-15), 224+(c-1.5)*150+sin(a*110)*50-(GetX()+cos(ang)*180));
				CreateShotFromScript( "shot1",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 2.0+b*0.25+ex, p, 0, 01);
				c++;
			}
			wait(4-lv*2);
			PlaySE(seshot1);
			b++;
		}
		wait(40-lv*40);
		a++;
	}
}

task Tshot14b{
	let a=0;
	while(GetCommonData("bossatack")==4){
		let b=0;
		loop(4){
			if(phase<=2){return;}
			let ang = angle+b*90+45;
			let p=GetAngleToPlayer();
			let c=0;
			loop(2){
				CreateShotFromScript( "shot1",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 2.0, 90+(b%2-0.5)*20+c*180, 0, 13);
				if(ex==1){
					CreateShotFromScript( "shot1",GetX()+cos(ang)*180, GetY()+sin(ang)*112.5-15, 3.0, 90+(b%2-0.5)*20+c*180, 0, 13);
				}
				c++;
			}
			b++;
		}
		wait(9-lv*4);
		a++;
	}
}

function Tshot20(let r, let n){
	let s=(2.1-(n-4)*0.27+ex*0.6)*r;
	let d=360/n;
	let a=GetAngleToPlayer()+d/2;
	loop(600){
		if(phase<=1){return;}
		let b=0;
		loop(n){
			CreateShotFromScript( "shot1",GetX(), GetY(), 6, a+b*d, 0, 11);
			b++;
		}
		//PlaySE(seshot1);
		wait(2-lv*1);
		a+=s;
	}
}

function Tshot21(){
	let a=0;
	loop(12){
		if(phase<=1){return;}
		let b=0;
		loop(4){
			let c=rand(0,1);
			loop(12){
				CreateShotFromScript( "shot1",GetX()+cos(angle+b*90)*230, GetY()+sin(angle+b*90)*230, 1.3+ex*1, c*30, 0, 06);
				if(ex==1){
					CreateShotFromScript( "shot1",GetX()+cos(angle+b*90)*230, GetY()+sin(angle+b*90)*230, 1.3+ex*1, c*30, 0, 06);
				}
				c++;
			}
			b++;
		}
		PlaySE(seshot2);
		wait(50-lv*25);
		a++;
	}
}
function Tshot22(){
	let a=0;
	loop(6){
		let b=trunc((GetAngleToPlayer() - angle + 180)/45);
		loop(8){
			if(phase<=1){return;}
			let r=230;
			if(b%2==1){r=80;}
			let p=atan2( GetPlayerY()-(GetY()+sin(angle+b*45)*r), GetPlayerX()-(GetX()+cos(angle+b*45)*r));
			let c=0;
			loop(5){
				if(ex==0){
					CreateShotFromScript( "shot1",GetX()+cos(angle+b*45)*r, GetY()+sin(angle+b*45)*r, 2.0+c*0.10, p, 0, 13);
				}
				else{
					CreateShotFromScript( "shot1",GetX()+cos(angle+b*45)*r, GetY()+sin(angle+b*45)*r, 3.0+c*0.20, p, 0, 13);
				}
				c++;
			}
			PlaySE(seshot2);
			wait(12-lv*6);
			b++;
		}
		a++;
	}
}
function Tshot23(){
	let a=1;
	loop(15){
		let b=0;
		loop(4+ex){
			if(phase<=1){return;}
			let c=0;
			loop(10+ex*10){
				CreateShotFromScript( "shotb",GetX(), GetY(), 1+ex, c*(36-ex*18), 0, a);
				c++;
			}
			b+=a;
			PlaySE(seshot1);
			wait(6-lv*3);
		}
		wait(12-lv*6);
		a*=-1;
	}
}
function Tshot24(){
	let a=0;
	loop(50+ex*50){
		if(phase<=1){return;}
		let p=GetAngleToPlayer();
		let b=1;
		loop(1){
			let c=0;
			loop(4){
				CreateShotFromScript( "shot1",GetX()+cos(angle+c*90+45)*80, GetY()+sin(angle+c*90+45)*80, 1.7+ex*1.0, b*a*14+c*90+40, 0, 13);
				CreateShotFromScript( "shot1",GetX()+cos(angle+c*90+45)*80, GetY()+sin(angle+c*90+45)*80, 1.7+ex*1.0, b*a*14+c*90-40, 0, 13);
				c++;
				b*=-1;
			}
			PlaySE(seshot1);
			//wait(4);
		}
		wait((10-lv*5)/(1+ex));
		a++;
	}
}
function Tshot25(){
	let a=GetAngleToPlayer()+180;
	loop(60){
		let b=0;
		loop(1){
			if(phase<=1){return;}
			CreateShotFromScript( "shotc",GetX(), GetY(), 2.5+ex, a, 0, 01);
			PlaySE(seshot2);
			b++;
		}
		wait(10-lv*5);
		a+=rand(70,90);
	}
}
function Tshot26(){
	let a=1;
	loop(8){
		let b=0;
		loop(1){
			if(phase<=1){return;}
			CreateShotFromScript( "shotd",GetX(), GetY(), 2.5+ex, GetAngleToPlayer()+a*(90+b*5), 0, 01);
			PlaySE(seshot2);
			b++;
		}
		wait(60-lv*30);
		a*=-1;
	}
	wait(120-lv*60);
}
function Tshot27(){
	let a=1;
	loop(8){
		let b=-0.5;
		loop(4){
			if(phase<=1){return;}
			CreateShotFromScript( "shot5",GetX(), GetY(), 3.5+ex, GetAngleToPlayer()+b*90, 0, 10);
			PlaySE(seshot2);
			b++;
		}
		wait(76-lv*38);
		a*=-1;
	}
}


task Tshot31(){
	yield;
	let r=-1;
	let w = 160;
	loop{
		if(phase<=0){return;}
		let ang=rand(0.1,360);
		let b=-7-ex*3;
		loop(15+ex*6){
			CreateShotFromScript( "shote",GetX(), GetY()+12, 3, 90+b*(12-ex*3), 0, ang*r);
			b++;
		}
		PlaySE(seshot2);
		wait(w-lv*w/2);
		r*=-1;
		if(w>100){
			w-=3;
		}
	}
}
