task PointExtend(){
let ExtendPoint = 250;
let ExtendCount = 0;
let Point = GetPoint;

loop{
Point = GetPoint;
SetNormPoint(ExtendPoint);
if(ExtendCount == 0){if(Point >= 250){
		ExtendPlayer(1);
		ExtendPoint = 500;
		ExtendCount = 1;}
	yield;
	}
else if(ExtendCount == 1){if(Point >= 500){
		ExtendPlayer(1);
		ExtendPoint = 750;
		ExtendCount = 2;}
	yield;
	}
else if(ExtendCount == 2){if(Point >= 750){
		ExtendPlayer(1);
		ExtendPoint = 1000;
		ExtendCount = 3;}
	yield;
	}
else if(ExtendCount == 3){if(Point >= 1000){
		ExtendPlayer(1);
		ExtendPoint = 1500;
		ExtendCount = 4;}
	yield;
	}
else if(ExtendCount == 4){if(Point >= 1500){
		ExtendPlayer(1);
		ExtendPoint = 2000;
		ExtendCount = 5;}
	yield;
	}
else if(ExtendCount == 5){if(Point >= 2000){
		ExtendPlayer(1);
		ExtendPoint = 2500;
		ExtendCount = 6;}
	yield;
	}
else if(ExtendCount == 6){if(Point >= 2500){
		ExtendPlayer(1);
		ExtendPoint = 3000;
		ExtendCount = 7;}
	yield;
	}
else if(ExtendCount == 7){if(Point >= 3000){
		ExtendPlayer(1);
		ExtendPoint = 3750;
		ExtendCount = 8;}
	yield;
	}
else if(ExtendCount == 8){if(Point >= 3750){
		ExtendPlayer(1);
		ExtendPoint = 4500;
		ExtendCount = 9;}
	yield;
	}
else if(ExtendCount == 9){if(Point >= 4500){
		ExtendPlayer(1);
		ExtendPoint = 5500;
		ExtendCount = 10;}
	yield;
	}
else if(ExtendCount == 10){if(Point >= 5500){
		ExtendPlayer(1);
		ExtendPoint = 6750;
		ExtendCount = 11;}
	yield;
	}
else if(ExtendCount == 11){if(Point >= 6750){
		ExtendPlayer(1);
		ExtendPoint = 8000;
		ExtendCount = 12;}
	yield;
	}
else if(ExtendCount == 12){if(Point >= 8000){
		ExtendPlayer(1);
		ExtendPoint = 9999;
		ExtendCount = 13;}
	yield;
	}
else if(ExtendCount == 13){if(Point >= 9999){
		ExtendPlayer(1);
		ExtendCount = 14;}
	yield;
	}
else if(ExtendCount == 14){yield;}
}
}

task ScoreExtend(){
let ExtendCount = 0;
let Score = GetScore;

loop{
if(ExtendCount == 0){if(Score >= 25000000){
		ExtendPlayer(1);
		ExtendCount = 1;}
	yield;
	}
else if(ExtendCount == 1){if(Score >= 50000000){
		ExtendPlayer(1);
		ExtendCount = 2;}
	yield;
	}
else if(ExtendCount == 2){if(Score >= 80000000){
		ExtendPlayer(1);
		ExtendCount = 3;}
	yield;
	}
else if(ExtendCount == 3){if(Score >= 120000000){
		ExtendPlayer(1);
		ExtendCount = 4;}
	yield;
	}
else if(ExtendCount == 4){if(Score >= 160000000){
		ExtendPlayer(1);
		ExtendCount = 5;}
	yield;
	}
else if(ExtendCount == 5){if(Score >= 200000000){
		ExtendPlayer(1);
		ExtendCount = 6;}
	yield;
	}
else if(ExtendCount == 6){yield;}
}
}

task MasicPointOnStage(){
SetCommonData("MASICPOINT",0);
yield;
let E = GetCommonData("EASY_START");
let N = GetCommonData("NORMAL_START");
let H = GetCommonData("HARD_START");
let L = GetCommonData("LUNATIC_START");
let ReduceToBomb;
let ReduceToMiss;
let AddToEnemy;

if(E > 0){SetCommonData("MASICPOINT",10);AddToEnemy = 5;ReduceToBomb = 1;ReduceToMiss = 10;}
if(N > 0){SetCommonData("MASICPOINT",15);AddToEnemy = 6;ReduceToBomb = 2;ReduceToMiss = 12;}
if(H > 0){SetCommonData("MASICPOINT",20);AddToEnemy = 8;ReduceToBomb = 3;ReduceToMiss = 14;}
if(L > 0){SetCommonData("MASICPOINT",30);AddToEnemy = 9;ReduceToBomb = 4;ReduceToMiss = 16;}

SetCommonData("MASICPOINT_ADD",AddToEnemy);

loop{
let a = GetCommonData("MASICPOINT");

	if(OnBomb == true){
	a -= ReduceToBomb;
	if(0 >= a){a = 0;}
	SetCommonData("MASICPOINT",a);
	while(OnBomb == true){yield;}
	}

	if(OnPlayerMissed == true){
	a -= ReduceToMiss;
	if(0 >= a){a = 0;}
	SetCommonData("MASICPOINT",a);
	while(OnPlayerMissed == true){yield;}
	}

yield;
}
}

function MasicPointDrawText(){

let textA = "MasicPoint";
let textB = ToString(GetCommonData("MASICPOINT"));

DrawText(textA,64,400,12,255);
DrawText(textB,64,412,12,255);
}

function MasicPointAddNormal{
let MasicPoint = GetCommonData("MASICPOINT");
let AddPoint = GetCommonData("MASICPOINT_ADD");

if(OnBomb == false){
MasicPoint += AddPoint;
SetCommonData("MASICPOINT",MasicPoint);
}
}

function MasicPointAddSpellCard{
let MasicPoint = GetCommonData("MASICPOINT");
let AddPoint = GetCommonData("MASICPOINT_ADD");

if(GetBombCountInThisSpell == 0&&GetMissCountInThisSpell == 0){
MasicPoint += AddPoint * 2;
SetCommonData("MASICPOINT",MasicPoint);
}
}

task MusicControl{
let stage;
let Music1 = GetCurrentScriptDirectory~"\Bgm\towaame.mp3";
let Music2 = GetCurrentScriptDirectory~"\Bgm\fukaki.mp3";

LoadMusic(Music1);
LoadMusic(Music2);

stage = GetCommonData("STAGE");
if(stage == 1){PlayMusic(Music1);}
while(stage == 1){stage = GetCommonData("STAGE");yield;}
DeleteMusic(Music1);
if(stage == 2){PlayMusic(Music2);}
while(stage == 2){stage = GetCommonData("STAGE");yield;}
DeleteMusic(Music2);
loop{yield;}
}

task BGControl{
let stage;
let BG1 = GetCurrentScriptDirectory~"\BG\yun_3780.jpg";
let BG2 = GetCurrentScriptDirectory~"\BG\eyes0048.jpg";

LoadGraphic(BG1);
LoadGraphic(BG2);

stage = GetCommonData("STAGE");
if(stage == 1){SetTexture(BG1);SetGraphicRect(0,0,384,448);DrawGraphic(GetCenterX,GetCenterY);}
while(stage == 1){stage = GetCommonData("STAGE");yield;}
if(stage == 2){SetTexture(BG2);SetGraphicRect(0,0,384,448);DrawGraphic(GetCenterX,GetCenterY);}
while(stage == 2){stage = GetCommonData("STAGE");yield;}
DeleteGraphic(BG1);
DeleteGraphic(BG2);
loop{yield;}
}
