#東方弾幕風
#Title[通常攻撃4]
#Text[完成度低
雰囲気だけお楽しみください]
#BackGround[Default]
#ScriptVersion[2]

script_enemy_main{

	#include_function ".\lib\lib_anime_Sanae.txt"
	let imgBoss = GetCurrentScriptDirectory() ~ "img\dot_sanae.png";
	let shot  =GetCurrentScriptDirectory~"SE\arrow01.wav";
	let shot2  =GetCurrentScriptDirectory~"SE\kira01_r.wav";
	let shot3  =GetCurrentScriptDirectory~"SE\shoot13.wav";
	let Concentration  =GetCurrentScriptDirectory~"SE\eco00_r.wav";
	let wIni = 120;

	@Initialize{
	SetEnemyMarker(true);
	LoadGraphic(imgBoss);
	LoadUserShotData(GetCurrentScriptDirectory ~ "img\shot_All.txt");
        SetMovePosition02(GetCenterX(), 150, wIni/2);
        SetAction(ACT_MOVE, wIni/2);
        SetLife(600);
        SetTimer(90);
        SetInvincibility(wIni*2);
        SetDamageRate(12*1.5, 3.6*1.5);
	LoadGraphic(GetCurrentScriptDirectory~"img\back06_01.png");	
	InitializeAction();
	    
	    TMain();
	}
		
	@MainLoop{
		SetCollisionA(GetX(), GetY(), 32);
		SetCollisionB(GetX(), GetY(), 24);
	    yield;
	}
	
		
	@Finalize{
	DeleteGraphic(imgBoss);
	}
	
	
	task TMain{
        SetAction(ACT_MOVE, wIni/2);	    
	    yield;
	    loop(wIni/2){ yield; }
          SetAction(ACT_SHOT_B,12000);
                    PlaySE(Concentration);
	Concentration01(90);
	    loop(wIni/2){ yield; }
		let a=GetAngleToPlayer;
		let s=6;
	    loop{
		a=GetAngleToPlayer-75;
		s=6;
                    PlaySE(shot);
        SetDamageRate(0, 0);
	    loop(10){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,170);
		FireShot(1);
		s-=0.45;
		a+=15;
		}
	        loop(90){ yield; }
		a=GetAngleToPlayer+75;
		s=6;
                    PlaySE(shot);
	    loop(10){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,170);
		FireShot(1);
		s-=0.45;
		a-=15;
		}
	        loop(70){ yield; }
		a=GetAngleToPlayer-75;
		s=6;
                    PlaySE(shot);
	    loop(10){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,170);
		FireShot(1);
		s-=0.45;
		a+=15;
		}
        	SetAction(ACT_MOVE,60);
		move01;
	        loop(50){ yield; }
		a=GetAngleToPlayer+75;
		s=6;
                    PlaySE(shot);
	    loop(10){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,170);
		FireShot(1);
		s-=0.45;
		a-=15;
		}
	        loop(20){ yield; }
		a=GetAngleToPlayer-75;
		s=6;
                    PlaySE(shot);
	    loop(10){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,170);
		FireShot(1);
		s-=0.45;
		a+=15;
		}
	        loop(15){ yield; }
		a=GetAngleToPlayer+75;
		s=6;
                    PlaySE(shot);
	    loop(10){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,170);
		FireShot(1);
		s-=0.45;
		a-=15;
		}
	        loop(7){ yield; }
		a=GetAngleToPlayer-75;
		s=6;
                    PlaySE(shot);
	    loop(10){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,170);
		FireShot(1);
		s-=0.45;
		a+=15;
		}
	        loop(3){ yield; }
		a=GetAngleToPlayer-75;
		s=6;
                    PlaySE(shot);
	    loop(10){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,170);
		FireShot(1);
		s-=0.45;
		a+=15;
		}
        SetDamageRate(12*1.5, 3.6*1.5);
	        loop(120){ yield; }
                    PlaySE(Concentration);
	Concentration01(90);
        SetAction(ACT_SHOT_B,12000);
	        loop(60){ yield; }
        SetDamageRate(0, 0);
	        loop(60){ yield; }
	    loop(2){
		a=GetAngleToPlayer-75;
		s=3;
                    PlaySE(shot);
			suzu(60);
	    loop(11){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,151);
		FireShot(1);
		CreateShotA(1,GetX,GetY,15);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,s*2,a,0,-0.1,0,145);
		SetShotDirectionType(PLAYER);
		SetShotDataA(1,60,s*1.5,0,0,0,0,145);
		SetShotDirectionType(ABSOLUTE);
		FireShot(1);
		a+=15;
		s-=0.1 ;
		}
	        loop(18){ yield; }
		a=GetAngleToPlayer+75;
		s=3;
	    loop(11){
                    PlaySE(shot);
			suzu(60);
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,151);
		FireShot(1);
		CreateShotA(1,GetX,GetY,15);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,s*2,a,0,-0.1,0,145);
		SetShotDirectionType(PLAYER);
		SetShotDataA(1,60,s*1.5,0,0,0,0,145);
		SetShotDirectionType(ABSOLUTE);
		FireShot(1);
		a-=15;
		s-=0.1;
		}
	        loop(18){ yield; }
			}
        	SetAction(ACT_MOVE,60);
		move01;
	    loop(3){
		a=GetAngleToPlayer-75;
		s=3;
                    PlaySE(shot);
			suzu(60);
	    loop(11){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,151);
		FireShot(1);
		CreateShotA(1,GetX,GetY,15);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,s*2,a,0,-0.1,0,145);
		SetShotDirectionType(PLAYER);
		SetShotDataA(1,60,s*1.5,0,0,0,0,145);
		SetShotDirectionType(ABSOLUTE);
		FireShot(1);
		a+=15;
		s-=0.1 ;
		}
	        loop(18){ yield; }
		a=GetAngleToPlayer+75;
		s=3;
                    PlaySE(shot);
			suzu(60);
	    loop(11){
		CreateShotA(1,GetX,GetY,15);
		SetShotDataA(1,0,s,a,0,0,0,151);
		FireShot(1);
		CreateShotA(1,GetX,GetY,15);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,s*2,a,0,-0.1,0,145);
		SetShotDirectionType(PLAYER);
		SetShotDataA(1,60,s*1.5,0,0,0,0,145);
		SetShotDirectionType(ABSOLUTE);
		FireShot(1);
		a-=15;
		s-=0.1;
		}
	        loop(18){ yield; }
			}
        SetDamageRate(12*1.5, 3.6*1.5);
	        loop(120){ yield; }
                    PlaySE(Concentration);
	Concentration01(90);
        SetAction(ACT_SHOT_B,12000);
	        loop(60){ yield; }
        SetDamageRate(0, 0);
	        loop(60){ yield; }
		a=315;
		let a2=0;
	    loop(2){
	    loop(72){
		s=4;
                    PlaySE(shot);
			suzu(45);
	    loop(4){
		CreateShotA(1,GetX+10*cos(a),GetY+10*sin(a),15);
		SetShotDataA(1,0,s,a,0,-0.06,0,28);
		SetShotDataA(1,45,NULL,a,0,0.06,6,28);
		FireShot(1);
		s-=0.5;
		}
		loop(1){ yield; }
		a+=133+a2;
		}
		move01;
		}
        SetDamageRate(12*1.5, 3.6*1.5);
	        loop(120){ yield; }
                    PlaySE(Concentration);
	Concentration01(90);
        SetAction(ACT_SHOT_B,12000);
	        loop(60){ yield; }
        SetDamageRate(0, 0);
	        loop(60){ yield; }
			}
			}
		task suzu(t){
	        loop(t){ yield; }
                    PlaySE(shot2);
				}
			sub move01 {
	    if(GetX()>=234)
	    {
	        SetMovePosition02(GetX()-rand(25,50),rand(130,170),60);
	    }
	    else if(GetX()<=204)
	    {
	        SetMovePosition02(GetX()+rand(25,50),rand(130,170),60);
	    }
	    else if(GetX()<=GetPlayerX())
	    {
	        SetMovePosition02(GetX()+rand(25,50),rand(130,170),60);
	    }
	    else if(GetX()>=GetPlayerX())
	    {
	        SetMovePosition02(GetX()-rand(25,50),rand(130,170),60);
	    }
	}
	@DrawLoop{
	  DrawBoss(imgBoss);
		DrawGraphic(GetX(),GetY());
	}
        

}
