/**
 * スペカ取得履歴のコモンデータ作成
 */
function CreateSpellDataArea(){
	let players = [ "Sunny", "Luna", "Star" ];
	let difficults = [ "Easy", "Normal", "Panic" ];
	let idxs = [  "1",  "2",  "3",  "4",  "5",  "6",  "7",  "8",  "9", "10", 
	             "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", 
	             "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", 
	             "31", "32", "33", "34", "35", "36", "37", "38", "39", "40" ];
	
	//データ作成
	ascent( i in 0..length( players ) ){
		ascent( j in 0..length( difficults ) ){
			ascent( k in 0..length( idxs ) ){
				let ns = players[ i ] ~ "Spell" ~ difficults[ j ] ~ idxs[ k ];
				SetCommonDataEx( "OFT_Save", ns ~ "_C", 0 );
				SetCommonDataEx( "OFT_Save", ns ~ "_P", 0 );
			}
		}
	}
}

/**
 * スペカ取得履歴の親子数値追加
 * 
 * @param {String} player    プレイヤー
 * @param {String} difficult 難易度
 * @param {String} idx       インデックス
 * @param {String} pc        親子のどちらをカウントするか
 */
function SetSpellData( player, difficult, idx, pc ){
	let ns = player ~ "Spell" ~ difficult ~ idx;
	if( pc == "Parent" ){
		ns = ns ~ "_P";
	}else{
		ns = ns ~ "_C";
	}
	
	let num = GetCommonDataDefaultEx( "OFT_Save", ns, 0 );
	num += 1;
	SetCommonDataEx( "OFT_Save", ns, num );
	
	if( pc == "Child" ){
		let ns_get = "GetSpellNum";
		num = GetCommonDataDefaultEx( "OFT", ns_get, 0 );
		num += 1;
		SetCommonDataEx( "OFT_Save", ns_get, num );
	}
}

/**
 * スペカ取得履歴の親子数値取得
 * 
 * @param {String} player    プレイヤー
 * @param {String} difficult 難易度
 * @param {String} idx       インデックス
 */
function GetSpellData( player, difficult, idx ){
	let ns = player ~ "Spell" ~ difficult ~ idx;
	let cnum = GetCommonDataDefaultEx( "OFT_Save", ns ~ "_C", 0 );
	let pnum = GetCommonDataDefaultEx( "OFT_Save", ns ~ "_P", 0 );
	
	return [ cnum, pnum ];
}

/**
 * スペカ名取得
 * 
 * @param {String} player    プレイヤー
 * @param {String} difficult 難易度
 * @param {String} idx       インデックス
 */
function GetSpellName( player, difficult, idx ){
	let name = "";
	
	alternative( idx )
		//1-M1 黒百合1
		case( "1" ){
			alternative( difficult )
				case( "Easy" ){
					name = "春符「スプリング・ウインド」";
				}
				case( "Normal" ){
					name = "春符「スプリング・ストリーム」";
				}
				case( "Panic" ){
					name = "春符「春の嵐」";
				}
		}
		//1-1 白百合1
		case( "2" ){
			alternative( difficult )
				case( "Easy" ){
					name = "萌符「フラワーグロウス」";
				}
				case( "Normal" ){
					name = "萌符「芽吹きの季節」";
				}
				case( "Panic" ){
					name = "萌符「花盛りの春」";
				}
		}
		//1-2 白百合2
		case( "3" ){
			alternative( difficult )
				case( "Easy" ){
					name = "桜符「桜花絢爛」";
				}
				case( "Normal" ){
					name = "桜符「ブルームチェリーブロッサム」";
				}
				case( "Panic" ){
					name = "桜符「エターナルウィッシュ」";
				}
		}
		//1-3 白百合3
		case( "4" ){
			alternative( difficult )
				case( "Easy" ){
					name = "春告「萌しの春風」";
				}
				case( "Normal" ){
					name = "春告「春告げの風」";
				}
				case( "Panic" ){
					name = "春告「C'est printemps」";
				}
		}
	
	return name;
}