
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(100);
		SetTimer(80);
		SetScore(2700000);
		SetDurableSpellCard;
		SetDamageRate(0, 0);
		InitializeAction();
		LoadUserShotData(shotData);
		LoadGraphic(imgBoss);
		LoadGraphic(imgback);
		Load;
        	CutIn(YOUMU,"「パゼストバイフェニックス -極- 」", NULL, 0, 0, 0, 0);
        	Main;
	}

    	@MainLoop {
		if(GetTimer==10&&counter==0){
			Timer;
			counter++;
		}
        	yield;
    	}

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

	@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, 10, 7);
		wait(60);
	}

   	task Main {
        	yield;
		standBy;
		wait(10);
		Charge;
		PlaySE(seCharge1);
		wait(120);
		moveA;
		wait(10);
		drawcount++;
		wait(30);
		drawcount++;
		wait(60);
		SetDamageRate(0, 0);
		Sum1;
		wait(880);
		DeleteEnemyShot(ALL);
		Concentration01(90);
		PlaySE(seCharge1);
		wait(90);
		Sum2;
		wait(1110);
		DeleteEnemyShot(ALL);
		Concentration01(90);
		PlaySE(seCharge1);
		wait(90);
		Sum3;
		wait(1110);
		DeleteEnemyShot(ALL);
		Concentration01(90);
		PlaySE(seCharge1);
		wait(90);
		Sum4;
	}

	task Sum1{
		let time=60;
		loop{
			if(GetTimer>62){
			CreateEnemyFromScript("FUJI1", GetX+60, GetY, 0, 0, 0);
			CreateEnemyFromScript("FUJI1", GetX-60, GetY, 0, 0, 0);
			PlaySE(seShot3);
			wait(time);
			if(time>20){
			time-=2;
			}
			}
			yield;
		}
	}

	task Sum2{
		let time=60;
		loop{
			if(GetTimer>42){
			CreateEnemyFromScript("FUJI2", GetX+60, GetY, 0, 0, 0);
			CreateEnemyFromScript("FUJI2", GetX-60, GetY, 0, 0, 0);
			PlaySE(seShot3);
			wait(time);
			if(time>20){
			time-=2;
			}
			}
			yield;
		}
	}

	task Sum3{
		let time=60;
		loop{
			if(GetTimer>22){
			CreateEnemyFromScript("FUJI3", GetX+60, GetY, 0, 0, 0);
			CreateEnemyFromScript("FUJI3", GetX-60, GetY, 0, 0, 0);
			PlaySE(seShot3);
			wait(time);
			if(time>10){
			time-=2;
			}
			}
			yield;
		}
	}

	task Sum4{
		let time=60;
		loop{
			CreateEnemyFromScript("FUJI4", GetX+60, GetY, 0, 0, 0);
			CreateEnemyFromScript("FUJI4", GetX-60, GetY, 0, 0, 0);
			PlaySE(seShot3);
			wait(time);
			if(time>20){
			time-=2;
			}
			yield;
		}
	}

	task moveA {
		loop{
		if(GetPlayerX<=100){
			SetAction(ACT_MOVE,60);
			SetMovePosition02(100,GetPlayerY,1);
		}
		else if(GetPlayerX>=348){
			SetAction(ACT_MOVE,60);
			SetMovePosition02(348,GetPlayerY,1);
		}
		else{
			SetAction(ACT_MOVE,60);
			SetMovePosition02(GetPlayerX,GetPlayerY,1);
		}
		yield;
		}
	}

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

}

#include_script ".\familiar3.txt"