let GCSD = GetCurrentScriptDirectory;
let mx =GetClipMinX();
let Mx =GetClipMaxX();
let cx =GetCenterX();
let my =GetClipMinY();
let My =GetClipMaxY();
let cy =GetCenterX();


function Wait(frame){loop(frame){yield;}}
function WaitForZeroEnemy{while(GetEnemyNum != 0){yield;}}
function MakeBoss(enemypass){CreateEnemyBossFromFile(enemypass,0,0,0,0,0);}
function MakeZako(enemypass,x,y,move,angle,level){CreateEnemyFromFile(enemypass,x,y,move,angle,level);}

function MakeZako1(x,y,level){MakeZako(GCSD~"\Stage\Zako\Enemy01.txt",x,y,0,0,level);}
function MakeZako2(x,y,level){MakeZako(GCSD~"\Stage\Zako\Enemy02.txt",x,y,0,0,level);}
function MakeZako3(x,y,level){MakeZako(GCSD~"\Stage\Zako\Enemy03.txt",x,y,0,0,level);}
function MakeZako4(x,y,level){MakeZako(GCSD~"\Stage\Zako\Enemy04.txt",x,y,0,0,level);}
function MakeZako5a(y,angle,level){MakeZako(GCSD~"\Stage\Zako\Enemy05.txt",0,y,0,angle,level);}
function MakeZako5b(y,angle,level){MakeZako(GCSD~"\Stage\Zako\Enemy05.txt",Mx+16,y,1,angle,level);}
function MakeZako6a(y,level){MakeZako(GCSD~"\Stage\Zako\Enemy06.txt",0,y,0,0,level);}
function MakeZako6b(y,level){MakeZako(GCSD~"\Stage\Zako\Enemy06.txt",Mx+16,y,0,0,level);}
function MakeZako7(level){MakeZako(GCSD~"\Stage\Zako\Enemy07.txt",Mx+16,100,0,0,level);
			MakeZako(GCSD~"\Stage\Zako\Enemy07.txt",0,150,0,0,level);
			MakeZako(GCSD~"\Stage\Zako\Enemy07.txt",cx,0,0,0,level);
			MakeZako(GCSD~"\Stage\Zako\Enemy07.txt",0,330,0,0,level);
			MakeZako(GCSD~"\Stage\Zako\Enemy07.txt",Mx+16,380,0,0,level);}


function EasyStage1{
SetCommonData("STAGE",1);
Wait(288);
loop(2){
loop(3){
Wait(12);
MakeZako1(Mx-64,0,0);
Wait(12);
MakeZako1(Mx-48,0,0);
Wait(12);
MakeZako1(Mx-80,0,0);
}
Wait(60);
loop(3){
Wait(12);
MakeZako1(mx+64,0,0);
Wait(12);
MakeZako1(mx+48,0,0);
Wait(12);
MakeZako1(mx+80,0,0);
}
Wait(60);
}
MakeZako2(cx-120,0,0);
Wait(30);
MakeZako2(cx-40,0,0);
Wait(30);
MakeZako2(cx+40,0,0);
Wait(30);
MakeZako2(cx+120,0,0);
Wait(90);
MakeZako2(cx+120,0,0);
Wait(30);
MakeZako2(cx+40,0,0);
Wait(30);
MakeZako2(cx-40,0,0);
Wait(30);
MakeZako2(cx-120,0,0);
Wait(90);
MakeZako3(cx,0,0);
Wait(300);
MakeZako3(cx-50,0,0);
MakeZako3(cx+50,0,0);
Wait(300);
MakeZako3(cx-100,0,0);
MakeZako3(cx+100,0,0);
Wait(600);
MakeBoss(GCSD~"\Stage\Boss\CirnoAE.txt");
WaitForZeroEnemy();
Wait(80);
MakeZako4(cx,0,0);
Wait(40);
loop(5){
MakeZako6a(70,0);
Wait(12);
}
Wait(60);
loop(5){
MakeZako6b(70,0);
Wait(12);
}
Wait(60);
MakeZako3(mx+64,0,0);
MakeZako2(cx-120,0,0);
Wait(60);
MakeZako2(cx+100,0,0);
Wait(60);
MakeZako2(cx-80,0,0);
Wait(60);
MakeZako2(cx+40,0,0);
Wait(300);
MakeZako3(Mx-64,0,0);
MakeZako2(cx-40,0,0);
Wait(60);
MakeZako2(cx+80,0,0);
Wait(60);
MakeZako2(cx-100,0,0);
Wait(60);
MakeZako2(cx+120,0,0);
Wait(300);
Wait(60);
MakeZako3(mx+64,0,0);
loop(5){
MakeZako6a(70,0);
Wait(12);
}
MakeZako2(cx-120,0,0);
Wait(60);
MakeZako2(cx+100,0,0);
Wait(60);
MakeZako2(cx-80,0,0);
Wait(60);
MakeZako2(cx+40,0,0);
Wait(300);
MakeZako3(Mx-64,0,0);
loop(5){
MakeZako6b(70,0);
Wait(12);
}
MakeZako2(cx-40,0,0);
Wait(60);
MakeZako2(cx+80,0,0);
Wait(60);
MakeZako2(cx-100,0,0);
Wait(60);
MakeZako2(cx+120,0,0);

MakeZako5a(cy-120,45,0);
Wait(80);
MakeZako5b(cy-120,135,0);
Wait(80);
MakeZako7(0);
Wait(300);

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

function NormalStage1{
SetCommonData("STAGE",1);
Wait(288);
loop(2){
loop(3){
Wait(12);
MakeZako1(Mx-64,0,1);
Wait(12);
MakeZako1(Mx-48,0,1);
Wait(12);
MakeZako1(Mx-80,0,1);
}
Wait(60);
loop(3){
Wait(12);
MakeZako1(mx+64,0,1);
Wait(12);
MakeZako1(mx+48,0,1);
Wait(12);
MakeZako1(mx+80,0,1);
}
Wait(60);
}
MakeZako2(cx-120,0,1);
Wait(30);
MakeZako2(cx-40,0,0);
Wait(30);
MakeZako2(cx+40,0,0);
Wait(30);
MakeZako2(cx+120,0,1);
Wait(90);
MakeZako2(cx+120,0,0);
Wait(30);
MakeZako2(cx+40,0,1);
Wait(30);
MakeZako2(cx-40,0,1);
Wait(30);
MakeZako2(cx-120,0,0);
Wait(90);
MakeZako3(cx,0,1);
Wait(300);
MakeZako3(cx-50,0,0);
MakeZako3(cx+50,0,0);
Wait(300);
MakeZako3(cx-100,0,1);
MakeZako3(cx+100,0,1);
Wait(600);
MakeBoss(GCSD~"\Stage\Boss\CirnoAN.txt");
WaitForZeroEnemy();
Wait(80);
MakeZako4(cx,0,1);
Wait(40);
loop(5){
MakeZako6a(70,1);
Wait(12);
}
Wait(60);
loop(5){
MakeZako6b(70,1);
Wait(12);
}
Wait(60);
MakeZako3(mx+64,0,1);
MakeZako2(cx-120,0,0);
Wait(60);
MakeZako2(cx+100,0,0);
Wait(60);
MakeZako2(cx-80,0,0);
Wait(60);
MakeZako2(cx+40,0,1);
Wait(300);
MakeZako3(Mx-64,0,1);
MakeZako2(cx-40,0,0);
Wait(60);
MakeZako2(cx+80,0,0);
Wait(60);
MakeZako2(cx-100,0,0);
Wait(60);
MakeZako2(cx+120,0,1);
Wait(300);
Wait(60);
MakeZako3(mx+64,0,0);
loop(5){
MakeZako6a(70,1);
Wait(12);
}
MakeZako2(cx-120,0,0);
Wait(60);
MakeZako2(cx+100,0,0);
Wait(60);
MakeZako2(cx-80,0,0);
Wait(60);
MakeZako2(cx+40,0,0);
Wait(300);
MakeZako3(Mx-64,0,0);
loop(5){
MakeZako6b(70,1);
Wait(12);
}
MakeZako2(cx-40,0,0);
Wait(60);
MakeZako2(cx+80,0,0);
Wait(60);
MakeZako2(cx-100,0,0);
Wait(60);
MakeZako2(cx+120,0,0);

MakeZako5a(cy-120,45,1);
Wait(80);
MakeZako5b(cy-120,135,1);
Wait(80);
MakeZako7(1);
Wait(300);

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


function HardStage1{
SetCommonData("STAGE",1);
Wait(288);
loop(2){
loop(3){
Wait(12);
MakeZako1(Mx-64,0,2);
Wait(12);
MakeZako1(Mx-48,0,2);
Wait(12);
MakeZako1(Mx-80,0,2);
}
Wait(60);
loop(3){
Wait(12);
MakeZako1(mx+64,0,2);
Wait(12);
MakeZako1(mx+48,0,2);
Wait(12);
MakeZako1(mx+80,0,2);
}
Wait(60);
}
MakeZako2(cx-120,0,1);
Wait(30);
MakeZako2(cx-40,0,2);
Wait(30);
MakeZako2(cx+40,0,2);
Wait(30);
MakeZako2(cx+120,0,1);
Wait(90);
MakeZako2(cx+120,0,1);
Wait(30);
MakeZako2(cx+40,0,2);
Wait(30);
MakeZako2(cx-40,0,2);
Wait(30);
MakeZako2(cx-120,0,1);
Wait(90);
MakeZako3(cx,0,2);
Wait(300);
MakeZako3(cx-50,0,0);
MakeZako3(cx+50,0,0);
Wait(300);
MakeZako3(cx-100,0,1);
MakeZako3(cx+100,0,1);
Wait(600);
MakeBoss(GCSD~"\Stage\Boss\CirnoAH.txt");
WaitForZeroEnemy();
Wait(80);
MakeZako4(cx,0,2);
Wait(40);
loop(5){
MakeZako6a(70,2);
Wait(12);
}
Wait(60);
loop(5){
MakeZako6b(70,2);
Wait(12);
}
Wait(60);
MakeZako3(mx+64,0,1);
MakeZako2(cx-120,0,1);
Wait(60);
MakeZako2(cx+100,0,1);
Wait(60);
MakeZako2(cx-80,0,1);
Wait(60);
MakeZako2(cx+40,0,1);
Wait(300);
MakeZako3(Mx-64,0,1);
MakeZako2(cx-40,0,1);
Wait(60);
MakeZako2(cx+80,0,1);
Wait(60);
MakeZako2(cx-100,0,1);
Wait(60);
MakeZako2(cx+120,0,1);
Wait(300);
Wait(60);
MakeZako3(mx+64,0,2);
loop(5){
MakeZako6a(70,1);
Wait(12);
}
MakeZako2(cx-120,0,0);
Wait(60);
MakeZako2(cx+100,0,2);
Wait(60);
MakeZako2(cx-80,0,2);
Wait(60);
MakeZako2(cx+40,0,0);
Wait(300);
MakeZako3(Mx-64,0,1);
loop(5){
MakeZako6b(70,1);
Wait(12);
}
MakeZako2(cx-40,0,0);
Wait(60);
MakeZako2(cx+80,0,2);
Wait(60);
MakeZako2(cx-100,0,2);
Wait(60);
MakeZako2(cx+120,0,0);

MakeZako5a(cy-120,45,2);
Wait(80);
MakeZako5b(cy-120,135,2);
Wait(80);
MakeZako7(2);
Wait(300);

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

function LunaticStage1{
SetCommonData("STAGE",1);
Wait(288);
loop(2){
loop(3){
Wait(12);
MakeZako1(Mx-64,0,3);
Wait(12);
MakeZako1(Mx-48,0,3);
Wait(12);
MakeZako1(Mx-80,0,3);
}
Wait(60);
loop(3){
Wait(12);
MakeZako1(mx+64,0,3);
Wait(12);
MakeZako1(mx+48,0,3);
Wait(12);
MakeZako1(mx+80,0,3);
}
Wait(60);
}
MakeZako2(cx-120,0,3);
Wait(30);
MakeZako2(cx-40,0,2);
Wait(30);
MakeZako2(cx+40,0,2);
Wait(30);
MakeZako2(cx+120,0,3);
Wait(90);
MakeZako2(cx+120,0,3);
Wait(30);
MakeZako2(cx+40,0,2);
Wait(30);
MakeZako2(cx-40,0,2);
Wait(30);
MakeZako2(cx-120,0,3);
Wait(90);
MakeZako3(cx,0,3);
Wait(300);
MakeZako3(cx-50,0,1);
MakeZako3(cx+50,0,1);
Wait(300);
MakeZako3(cx-100,0,2);
MakeZako3(cx+100,0,2);
Wait(600);
MakeBoss(GCSD~"\Stage\Boss\CirnoAL.txt");
WaitForZeroEnemy();
Wait(80);
MakeZako4(cx,0,3);
Wait(40);
loop(5){
MakeZako6a(70,3);
Wait(12);
}
Wait(60);
loop(5){
MakeZako6b(70,3);
Wait(12);
}
Wait(60);
MakeZako3(mx+64,0,3);
MakeZako2(cx-120,0,3);
Wait(60);
MakeZako2(cx+100,0,3);
Wait(60);
MakeZako2(cx-80,0,3);
Wait(60);
MakeZako2(cx+40,0,3);
Wait(300);
MakeZako3(Mx-64,0,3);
MakeZako2(cx-40,0,3);
Wait(60);
MakeZako2(cx+80,0,3);
Wait(60);
MakeZako2(cx-100,0,3);
Wait(60);
MakeZako2(cx+120,0,3);
Wait(300);
Wait(60);
MakeZako3(mx+64,0,3);
loop(5){
MakeZako6a(70,2);
Wait(12);
}
MakeZako2(cx-120,0,1);
Wait(60);
MakeZako2(cx+100,0,3);
Wait(60);
MakeZako2(cx-80,0,3);
Wait(60);
MakeZako2(cx+40,0,1);
Wait(300);
MakeZako3(Mx-64,0,3);
loop(5){
MakeZako6b(70,2);
Wait(12);
}
MakeZako2(cx-40,0,1);
Wait(60);
MakeZako2(cx+80,0,3);
Wait(60);
MakeZako2(cx-100,0,3);
Wait(60);
MakeZako2(cx+120,0,1);

MakeZako5a(cy-120,45,3);
Wait(80);
MakeZako5b(cy-120,135,3);
Wait(80);
MakeZako7(3);
Wait(300);

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

function EasyStage2{
SetCommonData("STAGE",2);
Wait(120);

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

function NormalStage2{
SetCommonData("STAGE",2);
Wait(120);

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

function HardStage2{
SetCommonData("STAGE",2);
Wait(120);

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

function LunaticStage2{
SetCommonData("STAGE",2);
Wait(120);

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