function MakeZako34a(y,level){MakeZako(GCSD~"\Stage\Zako\Enemy34.txt",0,y,0,0,level);}
function MakeZako34b(y,level){MakeZako(GCSD~"\Stage\Zako\Enemy34.txt",Mx+32,y,0,0,level);}
function MakeZako35(x,stopy,level){MakeZako(GCSD~"\Stage\Zako\Enemy35.txt",x,stopy,0,0,level);}

function MakeZako36(x,y,level){MakeZako(GCSD~"\Stage\Zako\Enemy36.txt",x,y,0,0,level);}
function MakeZako37(x,y,level){MakeZako(GCSD~"\Stage\Zako\Enemy37.txt",x,y,0,0,level);}
function MakeZako38(x,y,level){MakeZako(GCSD~"\Stage\Zako\Enemy38.txt",x,y,0,0,level);}

function MakeZako39(x,level){MakeZako(GCSD~"\Stage\Zako\Enemy39.txt",x,0,0,0,level);}
function MakeZako40a(y,level){MakeZako(GCSD~"\Stage\Zako\Enemy40.txt",0,y,0,0,level);}
function MakeZako40b(y,level){MakeZako(GCSD~"\Stage\Zako\Enemy40.txt",Mx+16,y,1,0,level);}
function MakeZako41(x,level){MakeZako(GCSD~"\Stage\Zako\Enemy41.txt",x,0,0,0,level);}

function EasyStage6A{
SetCommonData("STAGE",6);
SetCommonData("STAGE6_CHOOSE",1);
let level = 0;
Wait(150);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(120);

MakeZako25(cx,level);

Wait(250);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(250);

MakeZako36(cx,cy - 120,level);

WaitForZeroEnemy();
Wait(550);

if(ChackThePlayer == 1){MakeEvent("REIMU61");}
if(ChackThePlayer == 2){MakeEvent("MARISA61");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA61");}
if(ChackThePlayer == 4){MakeEvent("RUMIA61");}
WaitForEvent();


MakeBoss(GCSD~"\Stage\Boss\ByakurenE.txt");
WaitForZeroEnemy();

if(GetAllowedContinueCount != 3||GetCommonData("EASY_START") > 0)
{//コンティニューをしたかEasyなら、バッドエンド
if(ChackThePlayer == 1){MakeEvent("REIMU102");}
if(ChackThePlayer == 2){MakeEvent("MARISA102");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA102");}
if(ChackThePlayer == 4){MakeEvent("RUMIA102");}
WaitForEvent();
Wait(120);
ClearStage();
}

else if(GetPlayerLife <= 2)
{//残機が１以下だったら、ノーマルエンド
if(ChackThePlayer == 1){MakeEvent("REIMU101");}
if(ChackThePlayer == 2){MakeEvent("MARISA101");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA101");}
if(ChackThePlayer == 4){MakeEvent("RUMIA101");}
WaitForEvent();
Wait(120);
ClearStage();
}

else
{//上記のいずれでもなかったら、会話で終了
if(ChackThePlayer == 1){MakeEvent("REIMU62");}
if(ChackThePlayer == 2){MakeEvent("MARISA62");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA62");}
if(ChackThePlayer == 4){MakeEvent("RUMIA62");}
WaitForEvent();
}

}

function EasyStage6B{
SetCommonData("STAGE",6);
SetCommonData("STAGE6_CHOOSE",2);
let level = 0;
Wait(150);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(120);

MakeZako25(cx-100,level);
MakeZako25(cx+100,level);
MakeZako25(cx,level);

Wait(250);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

loop(10){
MakeZako34a(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);


Wait(60);

loop(10){
MakeZako34b(64,level);
Wait(10);
}

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(60);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(250);

MakeZako37(cx,cy - 120,level);

WaitForZeroEnemy();
Wait(550);

if(ChackThePlayer == 1){MakeEvent("REIMU63");}
if(ChackThePlayer == 2){MakeEvent("MARISA63");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA63");}
if(ChackThePlayer == 4){MakeEvent("RUMIA63");}
WaitForEvent();


MakeBoss(GCSD~"\Stage\Boss\flanE.txt");
WaitForZeroEnemy();

if(GetAllowedContinueCount != 3||GetCommonData("EASY_START") > 0){//コンティニューをしたかEasyなら、バッドエンド
if(ChackThePlayer == 1){MakeEvent("REIMU104");}
if(ChackThePlayer == 2){MakeEvent("MARISA104");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA104");}
if(ChackThePlayer == 4){MakeEvent("RUMIA104");}
WaitForEvent();

Wait(120);
ClearStage();
}
else if(GetPlayerLife <= 2){//残機が１以下だったら、ノーマルエンド
if(ChackThePlayer == 1){MakeEvent("REIMU103");}
if(ChackThePlayer == 2){MakeEvent("MARISA103");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA103");}
if(ChackThePlayer == 4){MakeEvent("RUMIA103");}
WaitForEvent();

Wait(120);
ClearStage();
}
else{//上記のいずれでもなかったら、会話イベント
if(ChackThePlayer == 1){MakeEvent("REIMU64");}
if(ChackThePlayer == 2){MakeEvent("MARISA64");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA64");}
if(ChackThePlayer == 4){MakeEvent("RUMIA64");}
WaitForEvent();
}

}

function NormalStage6A{
SetCommonData("STAGE",6);
SetCommonData("STAGE6_CHOOSE",1);
let level = 1;
Wait(150);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(120);

MakeZako25(cx,level);

Wait(250);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(250);

MakeZako36(cx,cy - 120,level);

WaitForZeroEnemy();
Wait(550);

if(ChackThePlayer == 1){MakeEvent("REIMU61");}
if(ChackThePlayer == 2){MakeEvent("MARISA61");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA61");}
if(ChackThePlayer == 4){MakeEvent("RUMIA61");}
WaitForEvent();


MakeBoss(GCSD~"\Stage\Boss\ByakurenN.txt");
WaitForZeroEnemy();

if(GetAllowedContinueCount != 3||GetCommonData("EASY_START") > 0){//コンティニューをしたかEasyなら、バッドエンド
if(ChackThePlayer == 1){MakeEvent("REIMU102");}
if(ChackThePlayer == 2){MakeEvent("MARISA102");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA102");}
if(ChackThePlayer == 4){MakeEvent("RUMIA102");}
WaitForEvent();

Wait(120);
ClearStage();
}
else if(GetPlayerLife <= 2){//残機が１以下だったら、ノーマルエンド
if(ChackThePlayer == 1){MakeEvent("REIMU101");}
if(ChackThePlayer == 2){MakeEvent("MARISA101");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA101");}
if(ChackThePlayer == 4){MakeEvent("RUMIA101");}
WaitForEvent();

Wait(120);
ClearStage();
}
else{//上記のいずれでもなかったら、会話イベント
if(ChackThePlayer == 1){MakeEvent("REIMU62");}
if(ChackThePlayer == 2){MakeEvent("MARISA62");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA62");}
if(ChackThePlayer == 4){MakeEvent("RUMIA62");}
WaitForEvent();
}
}

function NormalStage6B{
SetCommonData("STAGE",6);
SetCommonData("STAGE6_CHOOSE",2);
let level = 1;
Wait(150);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(120);

MakeZako25(cx-100,level);
MakeZako25(cx+100,level);
MakeZako25(cx,level);

Wait(250);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

loop(10){
MakeZako34a(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);


Wait(60);

loop(10){
MakeZako34b(64,level);
Wait(10);
}

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(60);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(250);

MakeZako37(cx,cy - 120,level);

WaitForZeroEnemy();
Wait(550);

if(ChackThePlayer == 1){MakeEvent("REIMU63");}
if(ChackThePlayer == 2){MakeEvent("MARISA63");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA63");}
if(ChackThePlayer == 4){MakeEvent("RUMIA63");}
WaitForEvent();


MakeBoss(GCSD~"\Stage\Boss\flanN.txt");
WaitForZeroEnemy();

if(GetAllowedContinueCount != 3||GetCommonData("EASY_START") > 0){//コンティニューをしたかEasyなら、バッドエンド
if(ChackThePlayer == 1){MakeEvent("REIMU104");}
if(ChackThePlayer == 2){MakeEvent("MARISA104");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA104");}
if(ChackThePlayer == 4){MakeEvent("RUMIA104");}
WaitForEvent();

Wait(120);
ClearStage();
}
else if(GetPlayerLife <= 2){//残機が１以下だったら、ノーマルエンド
if(ChackThePlayer == 1){MakeEvent("REIMU103");}
if(ChackThePlayer == 2){MakeEvent("MARISA103");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA103");}
if(ChackThePlayer == 4){MakeEvent("RUMIA103");}
WaitForEvent();

Wait(120);
ClearStage();
}
else{//上記のいずれでもなかったら、会話イベント
if(ChackThePlayer == 1){MakeEvent("REIMU64");}
if(ChackThePlayer == 2){MakeEvent("MARISA64");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA64");}
if(ChackThePlayer == 4){MakeEvent("RUMIA64");}
WaitForEvent();
}

}

function HardStage6A{
SetCommonData("STAGE",6);
SetCommonData("STAGE6_CHOOSE",1);
let level = 2;
Wait(150);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(120);

MakeZako25(cx,level);

Wait(250);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(250);

MakeZako36(cx,cy - 120,level);

WaitForZeroEnemy();
Wait(550);

if(ChackThePlayer == 1){MakeEvent("REIMU61");}
if(ChackThePlayer == 2){MakeEvent("MARISA61");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA61");}
if(ChackThePlayer == 4){MakeEvent("RUMIA61");}
WaitForEvent();


MakeBoss(GCSD~"\Stage\Boss\ByakurenH.txt");
WaitForZeroEnemy();

if(GetAllowedContinueCount != 3||GetCommonData("EASY_START") > 0){//コンティニューをしたかEasyなら、バッドエンド
if(ChackThePlayer == 1){MakeEvent("REIMU102");}
if(ChackThePlayer == 2){MakeEvent("MARISA102");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA102");}
if(ChackThePlayer == 4){MakeEvent("RUMIA102");}
WaitForEvent();

Wait(120);
ClearStage();
}
else if(GetPlayerLife <= 2){//残機が１以下だったら、ノーマルエンド
if(ChackThePlayer == 1){MakeEvent("REIMU101");}
if(ChackThePlayer == 2){MakeEvent("MARISA101");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA101");}
if(ChackThePlayer == 4){MakeEvent("RUMIA101");}
WaitForEvent();

Wait(120);
ClearStage();
}
else{//上記のいずれでもなかったら、会話イベント
if(ChackThePlayer == 1){MakeEvent("REIMU62");}
if(ChackThePlayer == 2){MakeEvent("MARISA62");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA62");}
if(ChackThePlayer == 4){MakeEvent("RUMIA62");}
WaitForEvent();
}
}

function HardStage6B{
SetCommonData("STAGE",6);
SetCommonData("STAGE6_CHOOSE",2);
let level = 2;
Wait(150);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(120);

MakeZako25(cx-100,level);
MakeZako25(cx+100,level);
MakeZako25(cx,level);

Wait(250);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

loop(10){
MakeZako34a(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);


Wait(60);

loop(10){
MakeZako34b(64,level);
Wait(10);
}

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(60);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(250);

MakeZako37(cx,cy - 120,level);

WaitForZeroEnemy();
Wait(550);

if(ChackThePlayer == 1){MakeEvent("REIMU63");}
if(ChackThePlayer == 2){MakeEvent("MARISA63");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA63");}
if(ChackThePlayer == 4){MakeEvent("RUMIA63");}
WaitForEvent();


MakeBoss(GCSD~"\Stage\Boss\flanH.txt");
WaitForZeroEnemy();

if(GetAllowedContinueCount != 3||GetCommonData("EASY_START") > 0){//コンティニューをしたかEasyなら、バッドエンド
if(ChackThePlayer == 1){MakeEvent("REIMU104");}
if(ChackThePlayer == 2){MakeEvent("MARISA104");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA104");}
if(ChackThePlayer == 4){MakeEvent("RUMIA104");}
WaitForEvent();

Wait(120);
ClearStage();
}
else if(GetPlayerLife <= 2){//残機が１以下だったら、ノーマルエンド
if(ChackThePlayer == 1){MakeEvent("REIMU103");}
if(ChackThePlayer == 2){MakeEvent("MARISA103");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA103");}
if(ChackThePlayer == 4){MakeEvent("RUMIA103");}
WaitForEvent();

Wait(120);
ClearStage();
}
else{//上記のいずれでもなかったら、会話イベント
if(ChackThePlayer == 1){MakeEvent("REIMU64");}
if(ChackThePlayer == 2){MakeEvent("MARISA64");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA64");}
if(ChackThePlayer == 4){MakeEvent("RUMIA64");}
WaitForEvent();
}


}

function LunaticStage6A{
SetCommonData("STAGE",6);
SetCommonData("STAGE6_CHOOSE",1);
let level = 3;
Wait(150);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(120);

MakeZako25(cx,level);

Wait(250);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(250);

MakeZako36(cx,cy - 120,level);

WaitForZeroEnemy();
Wait(550);

if(ChackThePlayer == 1){MakeEvent("REIMU61");}
if(ChackThePlayer == 2){MakeEvent("MARISA61");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA61");}
if(ChackThePlayer == 4){MakeEvent("RUMIA61");}
WaitForEvent();


MakeBoss(GCSD~"\Stage\Boss\ByakurenL.txt");
WaitForZeroEnemy();

if(GetAllowedContinueCount != 3||GetCommonData("EASY_START") > 0){//コンティニューをしたかEasyなら、バッドエンド
if(ChackThePlayer == 1){MakeEvent("REIMU102");}
if(ChackThePlayer == 2){MakeEvent("MARISA102");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA102");}
if(ChackThePlayer == 4){MakeEvent("RUMIA102");}
WaitForEvent();

Wait(120);
ClearStage();
}
else if(GetPlayerLife <= 2){//残機が１以下だったら、ノーマルエンド
if(ChackThePlayer == 1){MakeEvent("REIMU101");}
if(ChackThePlayer == 2){MakeEvent("MARISA101");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA101");}
if(ChackThePlayer == 4){MakeEvent("RUMIA101");}
WaitForEvent();

Wait(120);
ClearStage();
}
else{//上記のいずれでもなかったら、会話イベント
if(ChackThePlayer == 1){MakeEvent("REIMU62");}
if(ChackThePlayer == 2){MakeEvent("MARISA62");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA62");}
if(ChackThePlayer == 4){MakeEvent("RUMIA62");}
WaitForEvent();
}
}

function LunaticStage6B{
SetCommonData("STAGE",6);
SetCommonData("STAGE6_CHOOSE",2);
let level = 3;
Wait(150);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(120);

MakeZako25(cx-100,level);
MakeZako25(cx+100,level);
MakeZako25(cx,level);

Wait(250);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

loop(10){
MakeZako34a(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);


Wait(60);

loop(10){
MakeZako34b(64,level);
Wait(10);
}

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(60);

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(50);

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

Wait(50);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);

Wait(250);

MakeZako37(cx,cy - 120,level);

WaitForZeroEnemy();
Wait(550);

if(ChackThePlayer == 1){MakeEvent("REIMU63");}
if(ChackThePlayer == 2){MakeEvent("MARISA63");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA63");}
if(ChackThePlayer == 4){MakeEvent("RUMIA63");}
WaitForEvent();


MakeBoss(GCSD~"\Stage\Boss\flanL.txt");
WaitForZeroEnemy();

if(GetAllowedContinueCount != 3||GetCommonData("EASY_START") > 0){//コンティニューをしたかEasyなら、バッドエンド
if(ChackThePlayer == 1){MakeEvent("REIMU104");}
if(ChackThePlayer == 2){MakeEvent("MARISA104");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA104");}
if(ChackThePlayer == 4){MakeEvent("RUMIA104");}
WaitForEvent();

Wait(120);
ClearStage();
}
else if(GetPlayerLife <= 2){//残機が１以下だったら、ノーマルエンド
if(ChackThePlayer == 1){MakeEvent("REIMU103");}
if(ChackThePlayer == 2){MakeEvent("MARISA103");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA103");}
if(ChackThePlayer == 4){MakeEvent("RUMIA103");}
WaitForEvent();

Wait(120);
ClearStage();
}
else{//上記のいずれでもなかったら、会話イベント
if(ChackThePlayer == 1){MakeEvent("REIMU64");}
if(ChackThePlayer == 2){MakeEvent("MARISA64");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA64");}
if(ChackThePlayer == 4){MakeEvent("RUMIA64");}
WaitForEvent();
}


}


function ClearBonusAdd(level){
let score = 50000000 + GetPlayerLife * 20000000 + GetPlayerBomb * 1000000 + GetCommonData("MAGICPOINT") * 100000;
let levelbonus;

alternative(level)
case(0){levelbonus = 0.5;}
case(1){levelbonus = 1;}
case(2){levelbonus = 1.2;}
case(3){levelbonus = 1.5;}
AddScore(score * levelbonus);
}





function NormalStageFinal{
SetCommonData("STAGE",7);
let level = 1;
Wait(150);

MakeZako38(cx,cy,level);
Wait(1500);

let x1 = Mx - 64;
let x2 = mx + 64;
loop(2){
loop(3){
Wait(12);
MakeZako1(x1,0,level);
Wait(12);
MakeZako1(x1 + 16,0,level);
Wait(12);
MakeZako1(x1 - 16,0,level);
x1 -= 23.41;
}
MakeZako19(cx+150,level);
MakeZako3(cx,0,level);
Wait(150);
loop(2){
loop(3){
Wait(12);
MakeZako1(x2,0,level);
Wait(12);
MakeZako1(x2 - 16,0,level);
Wait(12);
MakeZako1(x2 + 16,0,level);
x2 += 23.41;
}
}
MakeZako19(cx-150,level);
MakeZako3(cx,0,level);
Wait(150);
}
Wait(300);

MakeZako25(cx - 60,level);
MakeZako25(cx + 60,level);

Wait(320);

let wait = 110;
loop(3){
MakeZako21(mx+18,level);
Wait(wait);
MakeZako21(Mx-18,level);
Wait(wait);
MakeZako21(mx+43,level);
Wait(wait);
wait -= 5;
MakeZako21(Mx-43,level);
Wait(wait);
MakeZako21(mx+31,level);
Wait(wait);
MakeZako21(Mx-31,level);
Wait(wait);
wait -= 5;
}


MakeZako30(cx,cy - 32,level);
MakeZako31(cx,cy - 32,level);
WaitForZeroEnemy;
Wait(120);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);


loop(10){
MakeZako34b(64,level);
Wait(10);
}

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(250);


let wait = 100;
MakeZako21(cx,level);
Wait(wait);
MakeZako21(cx - 40,level);
Wait(wait);
MakeZako21(cx + 40,level);
Wait(wait);
MakeZako21(cx - 20,level);
Wait(wait);
MakeZako21(cx + 20,level);
Wait(wait);

loop(2){
MakeZako21(cx,level);
loop(10){
MakeZako6a(120,level);
Wait(10);
}
Wait(50);
MakeZako21(cx - 40,level);
loop(10){
MakeZako6b(120,level);
Wait(10);
}
Wait(50);
MakeZako21(cx + 40,level);
loop(10){
MakeZako18(mx + 16,level);
Wait(10);
}
Wait(50);
MakeZako21(cx - 20,level);
loop(10){
MakeZako18(Mx - 16,level);
Wait(10);
}
Wait(50);
MakeZako21(cx + 20,level);
loop(5){
MakeZako18(mx + 16,level);
Wait(10);
MakeZako18(Mx - 16,level);
Wait(10);
}
Wait(250);
}

MakeZako27a(cx - 170,cy - 170,level);
MakeZako27b(cx + 170,cy - 170,level);
Wait(5);
MakeZako27a(cx - 110,cy - 110,level);
MakeZako27b(cx + 110,cy - 110,level);
Wait(5);
MakeZako27a(cx - 50,cy - 50,level);
MakeZako27b(cx + 50,cy - 50,level);
Wait(5);
MakeZako27a(cx - 30,cy,level);
MakeZako27b(cx + 30,cy,level);
Wait(180);
MakeZako24(0,64,level);
MakeZako24(Mx + 32,64,level);
Wait(180);


loop(6){
let x = 64;
Wait(100);
MakeZako39(cx+x,level);
Wait(200);
MakeZako39(cx-x,level);
Wait(100);
x += 16;
}

Wait(228);
let y = 300;
loop(8){
MakeZako40a(y,level);
Wait(35);
y -= 15;
MakeZako40b(y,level);
Wait(35);
y -= 15;
}
Wait(50);

let n = 0;
loop(15){
let x1 = [64,96,128,160,192,224,256,288,320,352,384];
let a = 0;
loop(11){
MakeZako41(x1[a]+n,level);
a++;}
Wait(150);
n = rand(-16,16);
}

WaitForZeroEnemy;
Wait(200);
if(ChackThePlayer == 1){MakeEvent("REIMU7");}
if(ChackThePlayer == 2){MakeEvent("MARISA7");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA7");}
if(ChackThePlayer == 4){MakeEvent("RUMIA7");}
WaitForEvent();

MakeBoss(GCSD~"\Stage\Boss\YouNA.txt");
WaitForZeroEnemy;
Wait(300);
ClearBonusAdd(level);
Wait(300);
if(ChackThePlayer == 1){MakeEvent("REIMU105");}
if(ChackThePlayer == 2){MakeEvent("MARISA105");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA105");}
if(ChackThePlayer == 4){MakeEvent("RUMIA105");}
WaitForEvent();
}

function HardStageFinal{
SetCommonData("STAGE",7);
let level = 2;
Wait(150);

MakeZako38(cx,cy,level);
Wait(1500);

let x1 = Mx - 64;
let x2 = mx + 64;
loop(2){
loop(3){
Wait(12);
MakeZako1(x1,0,level);
Wait(12);
MakeZako1(x1 + 16,0,level);
Wait(12);
MakeZako1(x1 - 16,0,level);
x1 -= 23.41;
}
MakeZako19(cx+150,level);
MakeZako3(cx,0,level);
Wait(150);
loop(2){
loop(3){
Wait(12);
MakeZako1(x2,0,level);
Wait(12);
MakeZako1(x2 - 16,0,level);
Wait(12);
MakeZako1(x2 + 16,0,level);
x2 += 23.41;
}
}
MakeZako19(cx-150,level);
MakeZako3(cx,0,level);
Wait(150);
}
Wait(300);

MakeZako25(cx - 60,level);
MakeZako25(cx + 60,level);

Wait(320);

let wait = 110;
loop(3){
MakeZako21(mx+18,level);
Wait(wait);
MakeZako21(Mx-18,level);
Wait(wait);
MakeZako21(mx+43,level);
Wait(wait);
wait -= 5;
MakeZako21(Mx-43,level);
Wait(wait);
MakeZako21(mx+31,level);
Wait(wait);
MakeZako21(Mx-31,level);
Wait(wait);
wait -= 5;
}


MakeZako30(cx,cy - 32,level);
MakeZako31(cx,cy - 32,level);
Wait(120);
WaitForZeroEnemy;

MakeBoss(GCSD~"\Stage\Boss\No.122 「レイン・フェアリーウォール　-Hard-」.txt");
WaitForZeroEnemy;
Wait(120);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);


loop(10){
MakeZako34b(64,level);
Wait(10);
}

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(250);


let wait = 100;
MakeZako21(cx,level);
Wait(wait);
MakeZako21(cx - 40,level);
Wait(wait);
MakeZako21(cx + 40,level);
Wait(wait);
MakeZako21(cx - 20,level);
Wait(wait);
MakeZako21(cx + 20,level);
Wait(wait);

loop(2){
MakeZako21(cx,level);
loop(10){
MakeZako6a(120,level);
Wait(10);
}
Wait(50);
MakeZako21(cx - 40,level);
loop(10){
MakeZako6b(120,level);
Wait(10);
}
Wait(50);
MakeZako21(cx + 40,level);
loop(10){
MakeZako18(mx + 16,level);
Wait(10);
}
Wait(50);
MakeZako21(cx - 20,level);
loop(10){
MakeZako18(Mx - 16,level);
Wait(10);
}
Wait(50);
MakeZako21(cx + 20,level);
loop(5){
MakeZako18(mx + 16,level);
Wait(10);
MakeZako18(Mx - 16,level);
Wait(10);
}
Wait(250);
}

MakeZako27a(cx - 170,cy - 170,level);
MakeZako27b(cx + 170,cy - 170,level);
Wait(5);
MakeZako27a(cx - 110,cy - 110,level);
MakeZako27b(cx + 110,cy - 110,level);
Wait(5);
MakeZako27a(cx - 50,cy - 50,level);
MakeZako27b(cx + 50,cy - 50,level);
Wait(5);
MakeZako27a(cx - 30,cy,level);
MakeZako27b(cx + 30,cy,level);
Wait(180);
MakeZako24(0,64,level);
MakeZako24(Mx + 32,64,level);
Wait(180);


loop(6){
let x = 64;
Wait(100);
MakeZako39(cx+x,level);
Wait(200);
MakeZako39(cx-x,level);
Wait(100);
x += 16;
}

Wait(228);
let y = 300;
loop(8){
MakeZako40a(y,level);
Wait(35);
y -= 15;
MakeZako40b(y,level);
Wait(35);
y -= 15;
}
Wait(50);

let n = 0;
loop(15){
let x1 = [64,96,128,160,192,224,256,288,320,352,384];
let a = 0;
loop(11){
MakeZako41(x1[a]+n,level);
a++;}
Wait(200);
n = rand(-16,16);
}

WaitForZeroEnemy;
Wait(300);
if(ChackThePlayer == 1){MakeEvent("REIMU7");}
if(ChackThePlayer == 2){MakeEvent("MARISA7");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA7");}
if(ChackThePlayer == 4){MakeEvent("RUMIA7");}
WaitForEvent();

MakeBoss(GCSD~"\Stage\Boss\YouHA.txt");
WaitForZeroEnemy;
Wait(300);
ClearBonusAdd(level);
Wait(300);
if(ChackThePlayer == 1){MakeEvent("REIMU105");}
if(ChackThePlayer == 2){MakeEvent("MARISA105");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA105");}
if(ChackThePlayer == 4){MakeEvent("RUMIA105");}
WaitForEvent();
}

function LunaticStageFinal{
SetCommonData("STAGE",7);
let level = 3;
Wait(150);

MakeZako38(cx,cy,level);
Wait(1500);

let x1 = Mx - 64;
let x2 = mx + 64;
loop(2){
loop(3){
Wait(12);
MakeZako1(x1,0,level);
Wait(12);
MakeZako1(x1 + 16,0,level);
Wait(12);
MakeZako1(x1 - 16,0,level);
x1 -= 23.41;
}
MakeZako19(cx+150,level);
MakeZako3(cx,0,level);
Wait(150);
loop(2){
loop(3){
Wait(12);
MakeZako1(x2,0,level);
Wait(12);
MakeZako1(x2 - 16,0,level);
Wait(12);
MakeZako1(x2 + 16,0,level);
x2 += 23.41;
}
}
MakeZako19(cx-150,level);
MakeZako3(cx,0,level);
Wait(150);
}
Wait(300);

MakeZako25(cx - 60,level);
MakeZako25(cx + 60,level);

Wait(320);

let wait = 110;
loop(3){
MakeZako21(mx+18,level);
Wait(wait);
MakeZako21(Mx-18,level);
Wait(wait);
MakeZako21(mx+43,level);
Wait(wait);
wait -= 5;
MakeZako21(Mx-43,level);
Wait(wait);
MakeZako21(mx+31,level);
Wait(wait);
MakeZako21(Mx-31,level);
Wait(wait);
wait -= 5;
}


MakeZako30(cx,cy - 32,level);
MakeZako31(cx,cy - 32,level);
Wait(120);
WaitForZeroEnemy;

MakeBoss(GCSD~"\Stage\Boss\DaiyouseiL.txt");
WaitForZeroEnemy;
Wait(120);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

loop(10){
MakeZako34b(64,level);
Wait(10);
}

Wait(250);

MakeZako35(cx - 20,80,level);
MakeZako35(cx + 20,80,level);
MakeZako35(cx - 180,80,level);
MakeZako35(cx + 180,80,level);


loop(10){
MakeZako34b(64,level);
Wait(10);
}

MakeZako35(cx - 60,80,level);
MakeZako35(cx + 60,80,level);
MakeZako35(cx - 140,80,level);
MakeZako35(cx + 140,80,level);

loop(10){
MakeZako34a(64,level);
Wait(10);
}

MakeZako35(cx - 120,80,level);
MakeZako35(cx + 120,80,level);
MakeZako35(cx - 80,80,level);
MakeZako35(cx + 80,80,level);

Wait(250);


let wait = 100;
MakeZako21(cx,level);
Wait(wait);
MakeZako21(cx - 40,level);
Wait(wait);
MakeZako21(cx + 40,level);
Wait(wait);
MakeZako21(cx - 20,level);
Wait(wait);
MakeZako21(cx + 20,level);
Wait(wait);

loop(2){
MakeZako21(cx,level);
loop(10){
MakeZako6a(120,level);
Wait(10);
}
Wait(50);
MakeZako21(cx - 40,level);
loop(10){
MakeZako6b(120,level);
Wait(10);
}
Wait(50);
MakeZako21(cx + 40,level);
loop(10){
MakeZako18(mx + 16,level);
Wait(10);
}
Wait(50);
MakeZako21(cx - 20,level);
loop(10){
MakeZako18(Mx - 16,level);
Wait(10);
}
Wait(50);
MakeZako21(cx + 20,level);
loop(5){
MakeZako18(mx + 16,level);
Wait(10);
MakeZako18(Mx - 16,level);
Wait(10);
}
Wait(250);
}

MakeZako27a(cx - 170,cy - 170,level);
MakeZako27b(cx + 170,cy - 170,level);
Wait(5);
MakeZako27a(cx - 110,cy - 110,level);
MakeZako27b(cx + 110,cy - 110,level);
Wait(5);
MakeZako27a(cx - 50,cy - 50,level);
MakeZako27b(cx + 50,cy - 50,level);
Wait(5);
MakeZako27a(cx - 30,cy,level);
MakeZako27b(cx + 30,cy,level);
Wait(180);
MakeZako24(0,64,level);
MakeZako24(Mx + 32,64,level);
Wait(180);


loop(6){
let x = 64;
Wait(100);
MakeZako39(cx+x,level);
Wait(200);
MakeZako39(cx-x,level);
Wait(100);
x += 16;
}

Wait(228);
let y = 300;
loop(8){
MakeZako40a(y,level);
Wait(35);
y -= 15;
MakeZako40b(y,level);
Wait(35);
y -= 15;
}
Wait(50);

let n = 0;
loop(15){
let x1 = [64,96,128,160,192,224,256,288,320,352,384];
let a = 0;
loop(11){
MakeZako41(x1[a]+n,level);
a++;}
Wait(200);
n = rand(-16,16);
}

WaitForZeroEnemy;
Wait(300);
if(ChackThePlayer == 1){MakeEvent("REIMU7");}
if(ChackThePlayer == 2){MakeEvent("MARISA7");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA7");}
if(ChackThePlayer == 4){MakeEvent("RUMIA7");}
WaitForEvent();

MakeBoss(GCSD~"\Stage\Boss\YouLA.txt");
WaitForZeroEnemy;
Wait(300);
ClearBonusAdd(level);
Wait(300);

if(ChackThePlayer == 1){MakeEvent("REIMU105");}
if(ChackThePlayer == 2){MakeEvent("MARISA105");}
if(ChackThePlayer == 3){MakeEvent("SAKUYA105");}
if(ChackThePlayer == 4){MakeEvent("RUMIA105");}
WaitForEvent();
}