script_enemy_main {
	let time = -250;
	let phase = 3;
	let sephase = 3;
	let rate = 0;
	let kaku = 50;
	let score = 0;
	let lv = 0;
	let life = 20520;
	let automove = true;
	let angle = GetAngle();
	let rank = GetSpeed();
	let arg = GetArgument();
	let ex = GetCommonData("ex");
	SetCommonData("bossx",GetX);
	SetCommonData("bossy",GetY);
	SetCommonData("bossphase",3);
	SetCommonData("bossparts1",0);
	SetCommonData("bossparts2",0);
	SetCommonData("bossatack",0);
	SetCommonData("pirtsangle1",0);
	SetCommonData("pirtsangle2",0);
	let imgEnemy = GetCurrentScriptDirectory~"img\st4boss.png";
	let tama = GetCurrentScriptDirectory~"tama.txt";
	let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
	let se2 = GetCurrentScriptDirectory~"wav\se2.wav";
	let se6 = GetCurrentScriptDirectory~"wav\se6.wav";
	let seshot1 = GetCurrentScriptDirectory~"wav\shot1.wav";
	let seshot2 = GetCurrentScriptDirectory~"wav\shot2.wav";
	@Initialize(){
		SetLife( 20520 );
		SetInvincibility( 0 );
		SetTimer(270);
		LoadGraphic( imgEnemy );
		LoadUserShotData( tama );
		Tmain1;Tmove;
		SetMovePositionHermite(224, 300, 100, 90, 100, 270, 150);
	}
	@MainLoop {
		SetCommonData("bossx",GetX);
		SetCommonData("bossy",GetY);
		if(phase==3&&GetLife<=13020){
			phase-=1;
			time=-180;
			score=60000;
			SetCommonData("bossphase",2);
			if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, 224, 240, 500);}
			PlaySE(se2);
			Tdeath(15,80,2,0);
			Tmain2;
			automove=true;
			SetMovePosition02(224+rand(20,-20), 150+rand(20,-20),90);
			sephase=2;
		}
		if(phase==2&&GetLife<=5020){
			phase-=1;
			time=-120;
			score=70000;
			SetCommonData("bossphase",1);
			if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, 224, 240, 500);}
			PlaySE(se2);
			Tdeath(15,80,2,0);
			Tshot3;
			automove=true;
			SetMovePosition02(224+rand(20,-20), 150+rand(20,-20),90);
			sephase=1;
		}
		if(phase==1&&GetLife<=20){
			phase-=1;
			score=90000;
			SetCommonData("bossphase",0);
			if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, 224, 240, 500);}
			PlaySE(se2);
			Tdeath(0,80,2,0);
			Tbaku;
			Tbossbaku;
		}
		if(phase>=1&&time>=0){
			SetCollisionA(GetX+30, GetY-30, 60);
			SetCollisionA(GetX-30, GetY-30, 60);
		}
		if(phase==2&&time>0){
			SetCollisionA(GetX+85, GetY-30, 50);
			SetCollisionA(GetX-85, GetY-30, 50);
   	}
		if(sephase==3&&GetLife<=13420){PlaySE(se6);sephase=2;}
		if(sephase==2&&GetLife<=5420){PlaySE(se6);sephase=1;}
		if(sephase==1&&GetLife<=420){PlaySE(se6);sephase=0;}
		if(GetCommonData("kakusei")>0){lv=1}
		else{lv=0}
		time++;
		yield;
	}
	@Finalize() {
	}
	@DrawLoop {
		if(time%5==0){
			if(life==GetLife){SetColor(255,255,255);}
			else{SetColor(210,210,255);}
			life=GetLife;
			if(phase==0||(time%30<5&&GetLife<920)){SetColor(255,200,200);}
		}
		SetTexture( imgEnemy );
		if(phase==2){
			if(time<0&&time>-20){
				SetGraphicRect( 224, 0, 320, 128 );
				SetGraphicAngle(180,0,0);
				DrawGraphic( GetX()+95+time*2, GetY()-35-time*2 );
				SetGraphicAngle(0,0,0);
				DrawGraphic( GetX()-95-time*2, GetY()-35-time*2 );
			}
			else if(time>=0){
				SetGraphicRect( 224, 0, 320, 128 );
				SetGraphicAngle(180,0,0);
				DrawGraphic( GetX()+95, GetY()-35 );
				SetGraphicAngle(0,0,0);
				DrawGraphic( GetX()-95, GetY()-35 );
			}
		}

		SetGraphicRect( 0, 0, 224, 224 );
		SetGraphicAngle(0,0,0);
		DrawGraphic( GetX(), GetY() );
	}

	task Tmain1{
		yield;
		wait(250);

		loop{
			if(phase<=2){return;}
			SetCommonData("bossatack",1);
			Tshot11a;
			Tshot11b;
			wait(400);
			if(phase<=2){return;}
			SetCommonData("bossatack",0);
			wait(50-lv*35);

			if(phase<=2){return;}
			SetCommonData("bossatack",2);
			Tshot12;
			wait(300);
			if(phase<=2){return;}
			SetCommonData("bossatack",0);
			wait(180-lv*100);

			if(phase<=2){return;}
			SetCommonData("bossatack",3);
			automove=false;
			SetMovePosition02(224+rand(20,-20), 450+rand(20,-20),220);
			Tshot13a;
			Tshot13b;
			wait(160);
			if(phase<=2){return;}
			SetCommonData("bossatack",0);
			wait(60);

			if(phase<=2){return;}
			SetCommonData("bossatack",4);
			Tshot14a;
			if(ex==1){Tshot14b;}
			Tmove14;
			wait(300);
			automove=true;
			if(phase<=2){return;}
			SetCommonData("bossatack",0);
			wait(140-lv*100);

			if(phase<=2){return;}
			SetCommonData("bossatack",5);
			Tshot15a;
			Tshot15b;
			wait(450);
			if(phase<=2){return;}
			SetCommonData("bossatack",0);
			wait(120-lv*80);
		}

	}

	task Tshot11a{
		yield;
		wait(30);
		let a=1;
		while(GetCommonData("bossatack")==1){
			let b=0;
			let p=atan2( GetPlayerY()-(GetY()-20), GetPlayerX()-(GetX()+a*75));
			loop(12){
				if(phase<=2){return;}
				let c=0;
				loop(4){
					CreateShotFromScript( "shota",GetX()+a*75+cos(b*37+c*90)*15, GetY()-20+sin(b*37+c*90)*15, 4+ex, p, 0, 02);
					if(ex==1){
						CreateShotFromScript( "shot1",GetX()+a*75+cos(b*37+c*90)*15, GetY()-20+sin(b*37+c*90)*15, 4+ex, b*37+c*90-a*90, 0, 02);
					}
					c++;
				}
				PlaySE(seshot1);
				wait(2-lv*1);
				b+=1*a;
			}
			wait(10-lv*8);
			a*=-1;
		}
	}
	task Tshot11b{
		yield;
		let a=1;
		while(GetCommonData("bossatack")==1){
			let b=0;
			let p=GetAngleToPlayer;
			loop(7){
				if(phase<=2){return;}
				CreateShotFromScript( "shot1",GetX()+a*28, GetY()-15, 4+ex, 90, 0, 12);
				CreateShotFromScript( "shot1",GetX()+a*23, GetY()-15, 4+ex, 90, 0, 12);
				CreateShotFromScript( "shot1",GetX()-a*60, GetY()+7, 4+ex, 90+a*14, 0, 12);
				CreateShotFromScript( "shot1",GetX()-a*65, GetY()+5, 4+ex, 90+a*14, 0, 12);
				wait(3-lv*1);
				b+=1*a;
			}
			wait(2-lv*1);
			a*=-1;
		}
	}

	task Tshot12{
		yield;
		let a=0;
		while(GetCommonData("bossatack")==2){
			if(phase<=2){return;}
			let b=a*1.73;
			loop(24){
				CreateShotFromScript( "shot1",GetX()+32+cos(90+b*15)*10, GetY()-90+sin(90+b*15)*10, 1.7+b%3*0.6+rand(-0.3,0.3)+ex, 90+b*15+rand(-5,5), 0, 02);
				CreateShotFromScript( "shot1",GetX()-32+cos(90-b*15)*10, GetY()-90+sin(90-b*15)*10, 1.7+b%3*0.6+rand(-0.3,0.3)+ex, 90-b*15+rand(-5,5), 0, 02);
				b++;;
			}
			PlaySE(seshot1);
			if(ex==0){wait(10-lv*5);}
			else{wait(8-lv*4);}
			a++;;
		}
	}

	task Tshot13a{
		yield;
		let a=0;
		while(GetCommonData("bossatack")==3){
			if(phase<=2){return;}
			let b=rand(0,1);
			loop(20){
				CreateShotFromScript( "shot6",GetX()+70, GetY()-80, 3+ex, 90+b*18, 0, 05);
				CreateShotFromScript( "shot6",GetX()-70, GetY()-80, 3+ex, 90-b*18, 0, 05);
				if(ex==1&&a%2==0){
					CreateShotFromScript( "shot1",GetX()+70, GetY()-80, 2.0, 90+b*18, 0, 05);
					CreateShotFromScript( "shot1",GetX()-70, GetY()-80, 2.0, 90-b*18, 0, 05);
				}
				b++;
			}
			PlaySE(seshot2);
			wait(10-lv*5);
			a++;
		}
	}
	task Tshot13b{
		yield;
		let a=0;
		while(GetCommonData("bossatack")==3){
			if(phase<=2){return;}
			let b=0;
			loop(1){
				CreateShotFromScript( "shot1",GetX()+60, GetY()+12, 5+ex, 90-24, 0, 13);
				CreateShotFromScript( "shot1",GetX()-60, GetY()+12, 5+ex, 90+24, 0, 13);
				b++;
			}
			PlaySE(seshot1);
			wait(4-lv*2);
			a++;
		}
	}
	task Tmove14{
		yield;
		if(phase<=2){return;}
		SetMovePositionHermite(224, 340, 270, 0, 270, 180, 100);
		wait(100);
		if(phase<=2){return;}
		SetMovePositionHermite(224, 230, 270, 180, 270, 0, 100);
		wait(100);
		if(phase<=2){return;}
		SetMovePositionHermite(224, 120, 270, 0, 270, 180, 100);
		wait(60);
		automove=true;
	}
	task Tshot14a{
		yield;
		let a=0;
		while(GetCommonData("bossatack")==4){
			if(phase<=2){return;}
			let b=0;
			loop(3+ex*2){
				CreateShotFromScript( "shot3",GetX()+70+rand(-10,10), GetY()-80+rand(-20,20), 0.04+ex*0.02, 90+rand(-10,60+ex*20), 0, 13);
				CreateShotFromScript( "shot3",GetX()-70+rand(-10,10), GetY()-80+rand(-20,20), 0.04+ex*0.02, 90+rand(-60-ex*20,10), 0, 13);
				b++;;
			}
			PlaySE(seshot1);
			wait(3-lv*2);
			a++;;
		}
	}
	task Tshot14b{
		yield;
		wait(50);
		let a=0;
		while(GetCommonData("bossatack")==4){
			if(phase<=2){return;}
			let b=-2;
			loop(7+ex*4){
				CreateShotFromScript( "shot1",GetX()+32, GetY()-90, 3.5+ex, 0-b*(15-ex*5), 0, 07);
				CreateShotFromScript( "shot1",GetX()-32, GetY()-90, 3.5+ex, 180+b*(15-ex*5), 0, 07);
				b++;
			}
			PlaySE(seshot2);
			wait(30-lv*15);
			a++;;
		}
	}
	task Tshot15a{
		yield;
		wait(40);
		let a=0;
		while(GetCommonData("bossatack")==5){
			if(phase<=2){return;}
			CreateShotFromScript( "shotb",GetX()+75, GetY()-20, 2.5, 90, 0, rand(0,25));
			if(ex==1){
			CreateShotFromScript( "shotb",GetX()+75, GetY()-20, 3.5, 90, 0, rand(0,25));
			}
			PlaySE(seshot2);
			wait(40-lv*20);
			a++;;
		}
	}
	task Tshot15b{
		yield;
		let a=0;
		while(GetCommonData("bossatack")==5){
			if(phase<=2){return;}
			CreateShotFromScript( "shot1",GetX()-70, GetY()-80, 2.5+ex, a*11.7, 0, 6);
			CreateShotFromScript( "shot1",GetX()-70, GetY()-80, 2.5+ex, 180+a*11.7, 0, 6);
			CreateShotFromScript( "shot1",GetX()-70, GetY()-80, 2.5+ex, 90-a*9.1, 0, 6);
			CreateShotFromScript( "shot1",GetX()-70, GetY()-80, 2.5+ex, 270-a*9.1, 0, 6);
			PlaySE(seshot1);
			wait(2-lv*1);
			a++;
		}
	}
////////////////////////////////////////////////////////
	task Tmain2{
		yield;
		wait(180);

		let a=0;
		loop{
			if(phase<=1){return;}
			SetCommonData("bossatack",1);
			Tshot21;
			wait(350);
			if(phase<=1){return;}
			SetCommonData("bossatack",0);
			wait(70-lv*35);
			
			if(phase<=1){return;}
			SetCommonData("bossatack",2);
			Tshot22a;
			Tshot22b;
			Tshot22c;
			wait(400);
			if(phase<=1){return;}
			SetCommonData("bossatack",0);
			wait(120-lv*60);

			if(phase<=1){return;}
			SetCommonData("bossatack",3);
			automove=false;
			SetMovePosition02(224+rand(20,-20), 460,360);
			Tshot23a;
			Tshot23b;
			wait(360);
			if(phase<=1){return;}
			SetCommonData("bossatack",4);
			Tshot24;
			wait(180);
			if(phase<=1){return;}
			SetCommonData("bossatack",5);
			wait(100-ex*20);
			if(phase<=1){return;}
			SetCommonData("bossatack",6);
			SetMovePosition02(224+rand(20,-20), 150,180);
			wait(180);
			if(phase<=1){return;}
			SetCommonData("bossatack",0);
			automove=true;
			wait(30);
			
			if(a<2){
			if(phase<=1){return;}
			SetCommonData("bossatack",7);
			Tshot25;
			wait(500);
			if(phase<=1){return;}
			SetCommonData("bossatack",0);
			wait(70-lv*35);
			}
			
			a++;
		}

	}
	task Tshot21{
		yield;
		wait(20);
		let a=1;
		let a2=1;
		while(GetCommonData("bossatack")==1){
			let p=90;
			if(a2==1){
				p=atan2( GetPlayerY()-(GetY()-0), GetPlayerX()-(GetX()+120*a));
			}
			let b=-2-ex;
			loop(5+ex*2){
				if(phase<=1){return;}
				let c=-2-ex/2;
				loop(5){
					CreateShotFromScript( "shot1",GetX()+120*a, GetY()-0, 2+ex*0.7, p+b*15+c*1.4, 0, 05);
					c++;
				}
				b++;
			}
			PlaySE(seshot2);
			wait(16-lv*8);
			a*=-1;
			if(a==1){a2*=-1;}
		}
	}
	task Tshot22a{
		yield;
		wait(30);
		let a=0;
		while(GetCommonData("bossatack")==2){
			let p=atan2( GetPlayerY()-(GetY()-80), GetPlayerX()-(GetX()+70));
			p=genteikaku(p,5);
			let b=-0.5+ex-0.5;
			loop(2+ex*1){
				if(phase<=1){return;}
				CreateShotFromScript( "shotc",GetX()-70+rand(-10,10), GetY()-80+rand(-20,20), 3+ex*0.7, p+cos(a*11.3)*45, 0, 06);
				b++;
			}
			PlaySE(seshot1);
			wait(4-lv*2);
			a++;
		}
	}
	task Tshot22b{
		yield;
		let a=0;
		while(GetCommonData("bossatack")==2){
			let p=atan2( GetPlayerY()-(GetY()-20), GetPlayerX()-(GetX()+75));
			p=genteikaku(p,4);
			let b=-3-ex*2;
			loop(7+ex*4){
				if(phase<=1){return;}
				CreateShotFromScript( "shot1",GetX()+75, GetY()-20, 1.9+ex, p+cos(a*73.4)*16+b*(11-ex*3.1), 0, 13);
				b++;
			}
			wait(20-lv*10);
			a++;
		}
	}
	task Tshot22c{
		yield;
		wait(30);
		let a=0;
		while(GetCommonData("bossatack")==2){
			let p=atan2( GetPlayerY()-(GetY()-20), GetPlayerX()-(GetX()-75));
			p=genteikaku(p,4);
			let b=0;
			loop(1+ex*1){
				if(phase<=1){return;}
				CreateShotFromScript( "shot1",GetX()-78+rand(-8,8), GetY()-15+rand(-8,8), 2.5+ex, p+rand(13,-13), 0, 11);
				b++;
			}
			wait(4-lv*2);
			a++;
		}
	}
	task Tshot23a{
		yield;
		let a=0;
		while(GetCommonData("bossatack")>=3){
			let b=0;
			loop(4){
				if(phase<=1){return;}
				CreateShotFromScript( "shot1",GetX()+25, GetY()-15, 8+ex, 45+b*90+a, 0, 13);
				CreateShotFromScript( "shot1",GetX()-25, GetY()-15, 8+ex, 45-b*90+a, 0, 13);
				b++;
			}
			PlaySE(seshot1);
			wait(1);
			if(GetCommonData("bossatack")<4){a+=2/4;}
			else if(GetCommonData("bossatack")>5){a+=2/2+ex*0.4;}
		}
	}
	task Tshot23b{
		yield;
		let a=0;
		loop(15+ex*9){
			if(phase<=1){return;}
			CreateShotFromScript( "shot5",GetX()+120, GetY()-0, 5+ex, 12+a*(24-ex*9), 0, 8);
			CreateShotFromScript( "shot5",GetX()-120, GetY()-0, 5+ex, 12+a*(24-ex*9), 0, -8);
			a++;
		}
		PlaySE(seshot2);
	}
	task Tshot24{
		yield;
		let a=1;
		let b=rand(0,1);
		while(GetCommonData("bossatack")==4){
			if(phase<=1){return;}
			CreateShotFromScript( "shotb",GetX()+70*a, GetY()-80, 5+ex, 270+sin(b*73+rand(10,-10))*50, 0, 50);
			PlaySE(seshot2);
			wait(8-lv*4);
			a*=-1;
			b++;
		}
	}
	task Tshot25{
		yield;
		let a=1;
		let b=0;
		while(GetCommonData("bossatack")==7){
			if(phase<=1){return;}
			CreateEnemyFromScript("bit2", GetX+a*110, GetY, 4.5, 90+a*30+rand(50,-50), b%3);
			wait(20-lv*10);
			a*=-1;
			b++;
		}
	}
//////////////////////////////////////////////////////
	task Tshot3{
		wait(120);
		SetCommonData("pirtsangle1",-60);
		let a=0;
		Tshot3a;
		loop(9+ex*9){
			CreateEnemyFromScript("bit1", GetX, GetY, 0, 0, a*(40-ex*20));
			loop(40-ex*20){
				SetCommonData("pirtsangle1",GetCommonData("pirtsangle1")+1.0);
				yield;
			}
			a--;
		}
		Tshot3b;
		let d=1.0;
		let a=0;
		loop{
			if(a%960>60 && a%960<260){d-=0.01}
			if(a%960>540 && a%960<740){d+=0.01}
			SetCommonData("pirtsangle1",GetCommonData("pirtsangle1")+d);
			yield;
			a++;
		}
	}
	task Tshot3a{
		let a=0+ex*0.5;
		loop{
			SetCommonData("pirtsangle2",a);
			yield;
			a++;
		}
	}
	
	task Tshot3b{
		wait(80);
		while(phase>=1){
			let a=1;
			loop(4){
				let p=atan2( GetPlayerY()-(GetY()-20), GetPlayerX()-(GetX()+a*75));
				let b=0;
				loop(15){
					let c=-2-ex*2;
					loop(5+ex*4){
						if(phase<=0){return;}
						CreateShotFromScript( "shot1",GetX()+75*a, GetY()-20, 2+b*0.5+ex, p+c*(25-7*ex), 0, 01);
						c++;
					}
					PlaySE(seshot1);
					wait(4-lv*2);
					b++;
				}
				wait(30-lv*15);
				a*=-1;
			}
			wait(30);
			let a=1;
			loop(20){
				if(phase<=0){return;}
				let b=rand(0,1);
				loop(18+6*ex){
					CreateShotFromScript( "shot1",GetX()+70*a, GetY()-80, 2+ex, b*(20-5*ex), 0, 01);
					b++;
				}
				PlaySE(seshot2);
				wait(30-lv*15);
				a*=-1;
			}
			wait(60);
			
		}
	}
	task Tmove {
		wait(150);
		SetMovePosition02(224+rand(20,-20), 150+rand(20,-20),100);
		wait(100);
		loop{
			if(automove==true){
				SetMovePosition02(224+rand(20,-20), 150+rand(20,-20),90);
			}
			wait(90);
		}
   }

   #include_function".\efanction.txt"
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

script_enemy bit1 {
	let time = -60;
	let phase = 1;
	let rate = 10;
	let kaku = 10;
	let score = 0;
	let lv = 0;
	let size = 30;
	let angle = GetAngle();
	let rank = GetSpeed();
	let arg = GetArgument();
	let ex = GetCommonData("ex");
	let imgEnemy = GetCurrentScriptDirectory~"img\st4boss.png";
	let tama = GetCurrentScriptDirectory~"tama.txt";
	let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
	let se3 = GetCurrentScriptDirectory~"wav\se3.wav";
	let seshot1 = GetCurrentScriptDirectory~"wav\shot1.wav";
	@Initialize(){
		SetLife( 500 );
		SetInvincibility( 60 );
		LoadGraphic( imgEnemy );
		LoadUserShotData( tama );
		Tshot1;Tshot2;
	}
	@MainLoop {
		SetInvincibility( 60 );
		angle = GetCommonData("pirtsangle1")+arg;
		SetX(GetCommonData("bossx")+cos(angle)*150);
		SetY(GetCommonData("bossy")+sin(angle)*150+100);
		SetCollisionA(GetX, GetY, 10);
		SetCollisionB(GetX, GetY, 10);
		if(GetCommonData("bossphase")==0){VanishEnemy;}
		if(GetCommonData("kakusei")>0){lv=1}
		else{lv=0}
		time++;
		yield;
	}
	@Finalize() {
	}
	@DrawLoop {
		SetTexture( imgEnemy );
		SetGraphicRect( 224, 128, 256, 160 );
		SetGraphicAngle( 0, 0, time*9);
		DrawGraphic( GetX(), GetY() );
	}
	task Tshot1{
		yield;
		let a=0;
		loop{
			let b=-0.50-ex*0.5;
			loop(2+ex){
				CreateShotFromScript( "shot1",GetX(), GetY(), 5+ex, angle+b*30, 0, 11);
				b++;
			}
			wait(2-lv*1);
			a++;
		}
	}
	task Tshot2{
		yield;
		let a=0;
		loop{
			let b=0;
			loop(2){
				CreateShotFromScript( "shot1",GetX(), GetY(), 1.5+ex*0.4, -GetCommonData("pirtsangle2")/3+b*180, 0, 06);
				b++;
			}
			wait(28-lv*14);
			a++;
		}
	}

	#include_function".\efanction.txt"
}


script_enemy bit2 {
	let time = 0;
	let phase = 1;
	let rate = 10;
	let kaku = 10;
	let score = 0;
	let lv = 0;
	let size = 30;
	let bitangle = 0;
	let angle = GetAngle();
	let rank = GetSpeed();
	let arg = GetArgument();
	let ex = GetCommonData("ex");
	let imgEnemy = GetCurrentScriptDirectory~"img\st4boss.png";
	let tama = GetCurrentScriptDirectory~"tama.txt";
	let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
	let se3 = GetCurrentScriptDirectory~"wav\se3.wav";
	let seshot1 = GetCurrentScriptDirectory~"wav\shot1.wav";
	@Initialize(){
		SetLife( 110 );
		SetInvincibility( 20 );
		LoadGraphic( imgEnemy );
		LoadUserShotData( tama );
		if(arg==1){
			Tshot1;
		}
		else{
			Tshot2;
		}
	}
	@MainLoop {
		if(phase==1&&GetLife<=100){
			phase-=1;
			if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, GetX, GetY, 30);}
			PlaySE(se3);
			Tdeath(2,30,2,1);
		}
		if(phase>=1){
			SetCollisionA(GetX, GetY, 20);
			SetCollisionB(GetX, GetY, 20);
		}
		if(GetCommonData("bossphase")<=1){VanishEnemy;}
		if(GetCommonData("kakusei")>0){lv=1}
		else{lv=0}
		time++;
		yield;
	}
	@Finalize() {
	}
	@DrawLoop {
		SetTexture( imgEnemy );
		SetGraphicRect( 224, 128, 256, 160 );
		SetGraphicAngle( 0, 0, time*9);
		DrawGraphic( GetX(), GetY() );
	}
	task Tshot1{
		yield;
		let a=0;
		let b=0;
		while(time<40){
			if(phase==0||GetCommonData("bossphase")==0){return;}
			loop(1){
				CreateShotFromScript( "shot1",GetX(), GetY(), 2.5+ex*0.5, GetAngle()+3+a*2, 0, 13);
				CreateShotFromScript( "shot1",GetX(), GetY(), 2.5+ex*0.5, GetAngle()-3-a*2, 0, 13);
				b++;
			}
			PlaySE(seshot1);
			wait(2-lv*1);
			a++;
			b++;
		}
		while(time<240){wait(1);}
		VanishEnemy;
	}
	task Tshot2{
		yield;
		let a=0;
		while(time<60){
			if(phase==0||GetCommonData("bossphase")==0){return;}
			let b=-ex*0.5;
			loop(1+ex){
				CreateShotFromScript( "shot1",GetX()+b*11, GetY(), 2.5+ex*0.5, GetAngle()+4+a*12, 0, 13);
				CreateShotFromScript( "shot1",GetX()+b*11, GetY(), 2.5+ex*0.5, GetAngle()-4-a*12, 0, 13);
				b++;
			}
			PlaySE(seshot1);
			wait(2-lv*1);
			a++;
		}
		while(time<240){wait(1);}
		VanishEnemy;
	}

	#include_function".\efanction.txt"
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
script_shot shota{
   let out=false;
   let gr=GetArgument;
   let lv=0;
   let time=0;
   let angle=GetAngle;
	let spd=GetSpeed/35;
   @Initialize{
      SetDefault(gr+lv*20);
      SetAngle(angle);
   }
   @MainLoop {
      if(GetX<20||GetX>428||GetY<20||GetY>460){
         out=true;
         End;
      }
      if(GetCommonData("kakusei")>0){
         lv=1;
         if(GetPoint==0){lv=2;SetSpeed(GetSpeed+0.04)}
      }
      else{lv=0}
      SetDefault(gr+lv*20);
   	if(time<30){
   		SetSpeed(GetSpeed-spd);
   	}
   	else{
   		SetSpeed(GetSpeed+spd);
   	}
      if((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2<=4){SetCommonData("gekitui",1);}
      time++;
   }
   @DrawLoop {
      DrawGraphicDefault();
   }
   @Finalize{
      if(out==false&&OnBomb==false){
         if(GetCommonData("kakusei")>0){
            CreateShotFromScript( "kinka",GetX(), GetY(), 0, 270, 0, 0);
         }
         if(OnBomb==false&&GetCommonData("kakusei")==0){
            CreateShotFromScript( "isi",GetX(), GetY(), 0, 270, 0, 0);
         }
      }
   }
}
	
script_shot shotb{//弾を撃つ弾直進
	let out=false;
	let gr=01;
	let arg=GetArgument;
	let pl=GetAngleToPlayer;
	let ex = GetCommonData("ex");
	let lv=0;
	let time=arg;
	@Initialize{
	   SetDefault(gr+lv*20);
	}
	@MainLoop {
		if(GetX<20||GetX>428||GetY<20||GetY>460){
		   out=true;
		   End;
		}
		if(GetCommonData("kakusei")>0){
		   lv=1;
		   if(GetPoint==0){lv=2;SetSpeed(GetSpeed+0.04);}
		}
		else{lv=0}
		SetDefault(gr+lv*20);
		if((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2<=4){SetCommonData("gekitui",1);}
		
		if(arg<50&&time%25<5){
			CreateShotFromScript( "shot1",GetX(), GetY(), 2+time%25*0.3+ex, 0, 0, 13);
			CreateShotFromScript( "shot1",GetX(), GetY(), 2+time%25*0.3+ex, 180, 0, 13);
		}
		if(arg==50&&time%2==0){
			CreateShotFromScript( "shotd",GetX(), GetY(), 0.1+ex*0.05, GetAngle+150, 0, 05);
			CreateShotFromScript( "shotd",GetX(), GetY(), 0.1+ex*0.05, GetAngle-150, 0, 05);
		}
		time++;
	}
	@DrawLoop {
	   DrawGraphicDefault();
	}
	@Finalize{
	   if(out==false&&OnBomb==false){
	      if(GetCommonData("kakusei")>0){
	         CreateShotFromScript( "kinka",GetX(), GetY(), 0, 270, 0, 0);
	      }
	      if(OnBomb==false&&GetCommonData("kakusei")==0){
	         CreateShotFromScript( "isi",GetX(), GetY(), 0, 270, 0, 0);
	      }
	   }
	}
}
script_shot shotc{
   let out=false;
   let gr=GetArgument;
   let lv=0;
   let time=0;
   let angle=GetAngle;
   @Initialize{
      SetDefault(gr+lv*20);
      SetAngle(angle);
   }
   @MainLoop {
      if(GetX<20||GetX>428||GetY<20||GetY>460){
         out=true;
         End;
      }
      if(GetCommonData("kakusei")>0){
         lv=1;
         if(GetPoint==0){lv=2;SetSpeed(GetSpeed+0.04)}
      }
      else{lv=0}
      SetDefault(gr+lv*20);
   	if(time==40){
   		CreateShotFromScript( "shot1",GetX(), GetY(), GetSpeed-1, GetAngle, 0, gr);
   	}
      if((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2<=4){SetCommonData("gekitui",1);}
      time++;
   }
   @DrawLoop {
      DrawGraphicDefault();
   }
   @Finalize{
      if(out==false&&OnBomb==false){
         if(GetCommonData("kakusei")>0){
            CreateShotFromScript( "kinka",GetX(), GetY(), 0, 270, 0, 0);
         }
         if(OnBomb==false&&GetCommonData("kakusei")==0){
            CreateShotFromScript( "isi",GetX(), GetY(), 0, 270, 0, 0);
         }
      }
   }
}
script_shot shotd{//加速弾
	let out=false;
	let gr=GetArgument;
	let lv=0;
	let kasoku=GetSpeed;
	let angle=GetAngle;
	let ex = GetCommonData("ex");
	@Initialize{
	   SetDefault(gr+lv*20);
		SetSpeed(-3-ex*1);
	}
	@MainLoop {
	   if(GetX<20||GetX>428||GetY<20||GetY>460){
	      out=true;
	      End;
	   }
	   if(GetCommonData("kakusei")>0){
	      lv=1;
	      if(GetPoint==0){lv=2;SetSpeed(GetSpeed+0.04)}
	   }
	   else{lv=0}
	   SetDefault(gr+lv*20);
	   if((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2<=4){SetCommonData("gekitui",1);}
	   SetSpeed(GetSpeed+kasoku);
	}
	@DrawLoop {
	   DrawGraphicDefault();
	}
	@Finalize{
	   if(out==false&&OnBomb==false){
	      if(GetCommonData("kakusei")>0){
	         CreateShotFromScript( "kinka",GetX(), GetY(), 0, 270, 0, 0);
	      }
	      if(OnBomb==false&&GetCommonData("kakusei")==0){
	         CreateShotFromScript( "isi",GetX(), GetY(), 0, 270, 0, 0);
	      }
	   }
	}
}
#include_script".\escript.txt"