#東方弾幕風
#Title[白符「初期化」]
#Text[データを初期化します]
#Image[.]
#BackGround[User]
#Player[.\player/MarisaA\MarisaA.txt,.\player/MarisaB\MarisaB.txt,.\player/MarisaC\MarisaC.txt,.\player/MarisaD\MarisaD.txt]
#ScriptVersion[2]
script_enemy_main {
    let name    = "白符「初期化」";
let csd = GetCurrentScriptDirectory;
    let imgBoss =csd ~ "lib/dot_cirno.png"; 

	let csd=GetCurrentScriptDirectory;
	let imgBG=csd ~ "img/MenuBG.png";
	let imgItem=csd ~ "img/Item.png";
	let imgDifficult=csd ~ "img/letter.png";
	let imgResult=csd ~ "img/resultletter.png";
	let imgPlayerAndBomb=csd ~ "img/shot_all.png";
	let imgMenuEffect=csd ~ "img/effect_tiny.png";
	let imgNumber=csd ~ "img/Number.png";
	let imgBer=csd ~ "img/ber.png";

    @Initialize {		
	CreateCommonDataArea(NsScore);
	//LoadCommonDataEx(NsScore,savePathstage);
	SetCommonData(NsGetSpell,0);
	let isRep = IsReplay();
	SetCommonData(NsIsReplay,isRep);
	SetX(GetCenterX);
	SetY(GetClipMinY + 128);// 初期位置
        SetLife(100);
        LoadGraphic(imgBoss);
        SetTexture(imgBoss);
	InitializeAction();

		ascent(let i in 0..10)//ハイスコアの初期化
		{
			SetCommonDataEx(NsScore,NsHiScoreReimuAEasy[i],0);
			SetCommonDataEx(NsScore,NsHiScoreReimuBEasy[i],0);
			SetCommonDataEx(NsScore,NsHiScoreReimuCEasy[i],0);
			SetCommonDataEx(NsScore,NsHiScoreReimuDEasy[i],0);

			SetCommonDataEx(NsScore,NsHiScoreReimuANormal[i],0);
			SetCommonDataEx(NsScore,NsHiScoreReimuBNormal[i],0);
			SetCommonDataEx(NsScore,NsHiScoreReimuCNormal[i],0);
			SetCommonDataEx(NsScore,NsHiScoreReimuDNormal[i],0);

			SetCommonDataEx(NsScore,NsHiScoreReimuAHard[i],0);
			SetCommonDataEx(NsScore,NsHiScoreReimuBHard[i],0);
			SetCommonDataEx(NsScore,NsHiScoreReimuCHard[i],0);
			SetCommonDataEx(NsScore,NsHiScoreReimuDHard[i],0);

			SetCommonDataEx(NsScore,NsHiScoreReimuAEasy2[i],10-i);
			SetCommonDataEx(NsScore,NsHiScoreReimuBEasy2[i],10-i);
			SetCommonDataEx(NsScore,NsHiScoreReimuCEasy2[i],10-i);
			SetCommonDataEx(NsScore,NsHiScoreReimuDEasy2[i],10-i);

			SetCommonDataEx(NsScore,NsHiScoreReimuANormal2[i],10-i);
			SetCommonDataEx(NsScore,NsHiScoreReimuBNormal2[i],10-i);
			SetCommonDataEx(NsScore,NsHiScoreReimuCNormal2[i],10-i);
			SetCommonDataEx(NsScore,NsHiScoreReimuDNormal2[i],10-i);

			SetCommonDataEx(NsScore,NsHiScoreReimuAHard2[i],10-i);
			SetCommonDataEx(NsScore,NsHiScoreReimuBHard2[i],10-i);
			SetCommonDataEx(NsScore,NsHiScoreReimuCHard2[i],10-i);
			SetCommonDataEx(NsScore,NsHiScoreReimuDHard2[i],10-i);
		}
///////////////////////////////////////////////////////////////////////////////////////////////////////
		ascent(let i in 0..5)//ハイスコアの初期化
		{
			SetCommonDataEx(NsScore,NsStageHiScoreReimuAEasy[i],0);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuBEasy[i],0);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuCEasy[i],0);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuDEasy[i],0);

			SetCommonDataEx(NsScore,NsStageHiScoreReimuANormal[i],0);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuBNormal[i],0);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuCNormal[i],0);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuDNormal[i],0);

			SetCommonDataEx(NsScore,NsStageHiScoreReimuAHard[i],0);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuBHard[i],0);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuCHard[i],0);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuDHard[i],0);

			SetCommonDataEx(NsScore,NsStageHiScoreReimuAEasy2[i],10);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuBEasy2[i],10);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuCEasy2[i],10);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuDEasy2[i],10);

			SetCommonDataEx(NsScore,NsStageHiScoreReimuANormal2[i],10);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuBNormal2[i],10);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuCNormal2[i],10);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuDNormal2[i],10);

			SetCommonDataEx(NsScore,NsStageHiScoreReimuAHard2[i],10);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuBHard2[i],10);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuCHard2[i],10);
			SetCommonDataEx(NsScore,NsStageHiScoreReimuDHard2[i],10);
		}

		//プレイ回数の初期化
		SetCommonDataEx(NsScore,NsFrequencyReimuAEasy,0);
		SetCommonDataEx(NsScore,NsFrequencyReimuBEasy,0);
		SetCommonDataEx(NsScore,NsFrequencyReimuCEasy,0);
		SetCommonDataEx(NsScore,NsFrequencyReimuDEasy,0);

		SetCommonDataEx(NsScore,NsFrequencyReimuANormal,0);
		SetCommonDataEx(NsScore,NsFrequencyReimuBNormal,0);
		SetCommonDataEx(NsScore,NsFrequencyReimuCNormal,0);
		SetCommonDataEx(NsScore,NsFrequencyReimuDNormal,0);

		SetCommonDataEx(NsScore,NsFrequencyReimuAHard,0);
		SetCommonDataEx(NsScore,NsFrequencyReimuBHard,0);
		SetCommonDataEx(NsScore,NsFrequencyReimuCHard,0);
		SetCommonDataEx(NsScore,NsFrequencyReimuDHard,0);

		SetCommonDataEx(NsScore,"ExFlag","true");
		SetCommonDataEx(NsScore,"SecretFlag","true");//フラグの初期化

		SetCommonDataEx(NsScore,NsUpTime,0);//起動時間の初期化
		SetCommonDataEx(NsScore,NsPlayTime,0);//プレイ時間の初期化

		ascent(let k in 0..30)
		{//実績の初期化
			SetCommonDataEx(NsScore,NsAchievement[k],0);
		}

		SetCommonDataEx(NsScore,NsAllFragment,0);//総取得フラグメントの初期化
		SetCommonDataEx(NsScore,NsAllFragment2,0);

		SetCommonDataEx(NsScore,"LOWSPIRALNUM",0);//1面スパイラル回数の初期化
		SetCommonDataEx(NsScore,"UseAutoBombCount",0);//オートボム回数の初期化
		SetCommonDataEx(NsScore,"BurstModeErazeBulletNumAM",0);//誘爆弾消しの数の初期化
		SetCommonDataEx(NsScore,NsContinueCount,0);//コンティニュー回数の初期化

    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
    }

    @DrawLoop {
        DrawGraphic(GetX, GetY);
	DrawBoss( imgBoss );
    }

    @Finalize {
		DeleteGraphic(imgBoss);

	if(GetCommonDataDefault(NsIsReplay,true) == false)
	{
		SaveCommonDataEx(NsScore,savePathstage);
	}
	ClearCommonDataEx(NsScore);
	DeleteCommonData(NsGetSpell);
	DeleteCommonData(NsDefeatFrame);
	DeleteCommonData(NsDefeatPosX);
	DeleteCommonData(NsDefeatPosY);
	DeleteCommonData(NsBossFrame);
	DeleteCommonData(NsIsReplay);
//デリート&初期化したデータを保存
    }


#include_function ".\txt/stagedata.txt"
#include_function ".\lib/lib_anime_Patchouli.txt"
}
