let isScore;

let historyG;
let historyC;
let historyB;

let historyGRA;
let historyCRA;
let historyBRA;

let historyGRB;
let historyCRB;
let historyBRB;

let historyGMA;
let historyCMA;
let historyBMA;

let historyGMB;
let historyCMB;
let historyBMB;

let historyGO;
let historyCO;
let historyBO;

/////////////////////////////////////////////////////////////////////////////////


function StartSpellHistory(No)
{
	isScore = IsCommonDataAreaExists(NsScore);
		
	//[h
	if(isScore == false)
	{
		LoadBossAreas();
	}
	 historyG = GetCommonDataDefaultEx(NsScore,NsSpellG[No],0);
	 historyC = GetCommonDataDefaultEx(NsScore,NsSpellC[No],0);
	 historyB = GetCommonDataDefaultEx(NsScore,NsSpellB[No],0);

	StartSpellHistoryEachPlayer(No);

}

function StartSpellHistoryEachPlayer(let No)
{
if(SelectedCharacter==DefinedPlayer1)
{
	 historyGRA = GetCommonDataDefaultEx(NsScore,NsSpellGRA[No],0);
	 historyCRA = GetCommonDataDefaultEx(NsScore,NsSpellCRA[No],0);
	 historyBRA = GetCommonDataDefaultEx(NsScore,NsSpellBRA[No],0);
}

if(SelectedCharacter==DefinedPlayer2)
{
	 historyGRB = GetCommonDataDefaultEx(NsScore,NsSpellGRB[No],0);
	 historyCRB = GetCommonDataDefaultEx(NsScore,NsSpellCRB[No],0);
	 historyBRB = GetCommonDataDefaultEx(NsScore,NsSpellBRB[No],0);
}

if(SelectedCharacter==DefinedPlayer3)
{
	 historyGMA = GetCommonDataDefaultEx(NsScore,NsSpellGMA[No],0);
	 historyCMA = GetCommonDataDefaultEx(NsScore,NsSpellCMA[No],0);
	 historyBMA = GetCommonDataDefaultEx(NsScore,NsSpellBMA[No],0);
}

if(SelectedCharacter==DefinedPlayer4)
{
	 historyGMB = GetCommonDataDefaultEx(NsScore,NsSpellGMB[No],0);
	 historyCMB = GetCommonDataDefaultEx(NsScore,NsSpellCMB[No],0);
	 historyBMB = GetCommonDataDefaultEx(NsScore,NsSpellBMB[No],0);
}

if(SelectedCharacter==DefinedPlayer5)
{
	 historyGO = GetCommonDataDefaultEx(NsScore,NsSpellGO[No],0);
	 historyCO = GetCommonDataDefaultEx(NsScore,NsSpellCO[No],0);
	 historyBO = GetCommonDataDefaultEx(NsScore,NsSpellBO[No],0);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
function EndSpellHistory(No)	//XyJ擾Ɨ
{
	if(GotSpellCardBonus)
	{
		if(isScore == true)
		{
			let getSpell = GetCommonData(NsGetSpell);
			getSpell++;
			SetCommonData(NsGetSpell,getSpell);
		}
		historyG++;
		if(Bonus>historyB)
		{
			historyB=Bonus;
		}

	}
	historyC++;

	SetCommonDataEx(NsScore,NsSpellG[No],historyG);
	SetCommonDataEx(NsScore,NsSpellC[No],historyC);
	SetCommonDataEx(NsScore,NsSpellB[No],historyB);

	EndSpellHistoryEachPlayer(No);

	//f[g
	if(isScore == false)
	{
		DeleteBossAreas();
	}

}

function EndSpellHistoryEachPlayer(let No)//eX̋@̂ł̃XyJ擾Ɨ
{

if(SelectedCharacter==DefinedPlayer1)
{
	if(GotSpellCardBonus)
	{
		historyGRA++;
		if(Bonus>historyBRA)
		{
			historyBRA=Bonus;
		}
	}
	historyCRA++;
	SetCommonDataEx(NsScore,NsSpellGRA[No],historyGRA);
	SetCommonDataEx(NsScore,NsSpellCRA[No],historyCRA);
	SetCommonDataEx(NsScore,NsSpellBRA[No],historyBRA);
}

if(SelectedCharacter==DefinedPlayer2)
{
	if(GotSpellCardBonus)
	{
		historyGRB++;
		if(Bonus>historyBRB)
		{
			historyBRB=Bonus;
		}
	}
	historyCRB++;
	SetCommonDataEx(NsScore,NsSpellGRB[No],historyGRB);
	SetCommonDataEx(NsScore,NsSpellCRB[No],historyCRB);
	SetCommonDataEx(NsScore,NsSpellBRB[No],historyBRB);
}

if(SelectedCharacter==DefinedPlayer3)
{
	if(GotSpellCardBonus)
	{
		historyGMA++;
		if(Bonus>historyBMA)
		{
			historyBMA=Bonus;
		}
	}
	historyCMA++;
	SetCommonDataEx(NsScore,NsSpellGMA[No],historyGMA);
	SetCommonDataEx(NsScore,NsSpellCMA[No],historyCMA);
	SetCommonDataEx(NsScore,NsSpellBMA[No],historyBMA);
}

if(SelectedCharacter==DefinedPlayer4)
{
	if(GotSpellCardBonus)
	{
		historyGMB++;
		if(Bonus>historyBMB)
		{
			historyBMB=Bonus;
		}
	}
	historyCMB++;
	SetCommonDataEx(NsScore,NsSpellGMB[No],historyGMB);
	SetCommonDataEx(NsScore,NsSpellCMB[No],historyCMB);
	SetCommonDataEx(NsScore,NsSpellBMB[No],historyBMB);
}

if(SelectedCharacter==DefinedPlayer5)
{
	if(GotSpellCardBonus)
	{
		historyGO++;
		if(Bonus>historyBO)
		{
			historyBO=Bonus;
		}
	}
	historyCO++;
	SetCommonDataEx(NsScore,NsSpellGO[No],historyGO);
	SetCommonDataEx(NsScore,NsSpellCO[No],historyCO);
	SetCommonDataEx(NsScore,NsSpellBO[No],historyBO);
}

}
////////////////////////////////////////////////////////////////////////////////////////////
sub DrawSpellHistory
{
		if(count>=0)
		{
		DrawText("history",280,DrawY,12,255);
		DrawText(NumToString(historyG),280,DrawY,12,255);
		DrawText("/",370,DrawY,12,255);
		DrawText(NumToString(historyC+1),320,DrawY,12,255);
		}
		if(count>=80 && count<=115)
		{
			DrawY-=7.5;
		}
		count++;
}
///////////////////////////////////////////////////////////////////////////////////////////
