
script_enemy_main {
	#include_function ".\lib\lib_anime_mokou.txt"
	#include_function ".\Draw.txt"
	#include_function ".\lib_Functions.txt"
	let imgBoss	=csd ~ "img\dot_mokou.png";
	let imgback	=csd~"img\back2.png";

	@Initialize {
        	SetLife(880);
		SetTimer(90);
		SetScore(2500000);
		SetDamageRate(0, 0);
		InitializeAction();
		LoadUserShotData(shotData);
		LoadGraphic(imgBoss);
		LoadGraphic(imgback);
		Load;
        	CutIn(YOUMU,"朒棄乽怴奙晽夣惏丂-僼僕儎儅償僅儖働僀僲嘦-乿", NULL, 0, 0, 0, 0);
        	Main;
	}

    	@MainLoop {
        	SetCollisionA(GetX, GetY, 32);
        	SetCollisionB(GetX, GetY, 16);
		if(GetTimer==10&&counter==0){
			Timer;
			counter++;
		}
        	yield;
    	}

	@DrawLoop {
		SetColor(255,255,255);
		SetGraphicScale(1,1);
		SetAlpha(255);
		DrawBoss(imgBoss);
	}

	@BackGround {
		SetColor(100,100,255);
		SetAlpha(150);
		SetTexture(imgback);
		SetGraphicRect(0, 0, 384, 457);
		SetGraphicAngle(0, 0, 0);
		DrawGraphic(224, 240);
		if(drawcount==1){
			DrawHououZ(200, 200, 100, 100);
		}
		if(drawcount>0){
			DrawHouou(200, 200, 100, 100);
			DrawIrusion(GetX, GetY,100,255,100,100);
		}
	}

	sub standBy {
		SetMovePosition03(cenX,cenY-80, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
	}

   	task Main {
        	yield;
		standBy;
		Charge;
		PlaySE(seCharge1);
		wait(30);
		drawcount++;
		wait(30);
		drawcount++;
		wait(60);
		SetDamageRate(20, 0);
		BombBarrier;
		Att;
		moveA;
	}

	task Att{
		loop{
			shotA;
			wait(20);
			shotB;
			wait(60);
			shotA;
			wait(30);
			shotA;
			wait(30);
			shotA;
			wait(40);
			shotD;
			wait(60);
			shotC;
			shotA;
			wait(20);
			shotA;
			wait(20);
			shotA;
			wait(20);
			shotA;
			wait(20);
			shotA;
			wait(100);
			shotB;
			shotE;
			shotF;
			wait(180);
			yield;
		}
	}

	task shotA{
		CreateEnemyFromScript("FUJI2", GetX, GetY, 0, 0, 0);
		PlaySE(seShot3);		
	}

	task shotB{
		loop(5){
			let angle=0;
			while(angle<360){
			CreateShot01(GetX,GetY,2,angle,67,0);
			angle+=20;
			}
			PlaySE(seShot2);
			wait(20);
		}		
	}

	task shotC{
		loop(3){
			let angle=GetAngleToPlayer;
			loop(10){
				CreateShot01(GetX,GetY,4,angle,82,0);
				CreateShot01(GetX,GetY,4,angle-30,82,0);
				CreateShot01(GetX,GetY,4,angle+30,82,0);
				wait(2);
				PlaySE(seShot4);
			}
			wait(20);
		}		
	}

	task shotD{
		let d=1;
		let angle=130;
		if(GetX<cenX){d=-1;angle=50;}
		CreateLaserA(0,GetX,GetY,600,20,BLUE01,0);
		SetLaserDataA(0,1,angle,d*1,0,0,0);
		SetShotKillTime(0,60);
		FireShot(0);
		PlaySE(seLaser1);		
	}

	task shotE{
		let d=1;
		let angle=110;
		if(GetX>cenX){d=-1;angle=80;}
		CreateLaserA(0,GetX,GetY,600,20,BLUE01,0);
		SetLaserDataA(0,1,angle,d*1,0,0,0);
		SetShotKillTime(0,60);
		FireShot(0);
		PlaySE(seLaser1);		
	}

	task shotF{
		CreateEnemyFromScript("FUJI2", GetX-100, GetY-20, 0, 0, 0);
		CreateEnemyFromScript("FUJI2", GetX-50, GetY-10, 0, 0, 0);
		CreateEnemyFromScript("FUJI2", GetX, GetY, 0, 0, 0);
		CreateEnemyFromScript("FUJI2", GetX+50, GetY-10, 0, 0, 0);
		CreateEnemyFromScript("FUJI2", GetX+100, GetY-20, 0, 0, 0);
		PlaySE(seShot3);		
	}

	task moveA{
		loop{
			if(GetX<=GetPlayerX){
				SetAction(ACT_MOVE,60);
				SetMovePosition02(GetX+120,GetY+40,60);
				wait(240);
				SetAction(ACT_MOVE,60);
				SetMovePosition02(GetX-20,GetY-60,30);
				wait(30);
				SetAction(ACT_MOVE,60);
				SetMovePosition02(GetX-40,GetY-20,30);
				wait(210);
				standBy;
			}
			else{
				SetAction(ACT_MOVE,60);
				SetMovePosition02(GetX-120,GetY+40,60);
				wait(240);
				SetAction(ACT_MOVE,60);
				SetMovePosition02(GetX+20,GetY-60,30);
				wait(30);
				SetAction(ACT_MOVE,60);
				SetMovePosition02(GetX+40,GetY-20,30);
				wait(210);
				standBy;
			}
		yield;
		}
	}

	@Finalize{
		DeleteGraphic(imgBoss);
		Delete;
		Spell;
	}

}

#include_script ".\familiar2.txt"