「javascript/サーヴァント経験値計算」の編集履歴(バックアップ)一覧に戻る

javascript/サーヴァント経験値計算 - (2015/08/19 (水) 23:13:30) のソース

//制作者はjavascript初心者なので、あまり見ないでください
#javascript(){{
function func() {
// 数値を代入
var now  = document.formN.nowLv.value;
var goal = document.formG.goalLv.value;
var exp  = 0;
var mag  = document.formC.class.value;
// 現在レベルから目標レベルまでに必要な経験値を計算
// 現在レベルが目標レベルより高い場合は、1Lv分だけ計算
if(goal <= now){exp = now * (50 * now + 50);}
else{
	for(var lv = now; lv < goal; lv++){
		exp += lv * (50 * lv + 50);
	}
}
// テーブルに入力
document.formEXP.totalEXP.value = exp;
//必要になる強化素材数を計算してテーブルに入力
document.formT1.reqT1.value = Math.ceil(exp / (1000 * mag));
document.formT2.reqT2.value = Math.ceil(exp / (3000 * mag));
document.formT3.reqT3.value = Math.ceil(exp / (9000 * mag));
document.formT4.reqT4.value = Math.ceil(exp / (27000 * mag));
}
}}
#html2(){{
<table>
<tr>
<td bgcolor="#FFF">現在のレベル</td>
<td><form name="formN" id="formN">
<input type="text" maxlength="6" size="8" name="nowLv" value="1">
</form></td>
</tr>

<tr>
<td bgcolor="#FFF">目標のレベル</td>
<td><form name="formG" id="formG">
<input type="text" maxlength="6" size="8" name="goalLv" value="1">
</form></td>
</tr>

<tr align=center>
<td bgcolor="#FFF">強化素材</td>
<td><form name="formC" id="formC"><select name="class" style="width:100px;">
<option value="1.2">クラス一致</option>
<option value="1.0">クラス不一致</option>
</select></form></td>
</tr>

<tr align=center>
<td colspan="2"><form name="calc" id="calc">
<input type="button" value="計算" onclick="func()">
</form></td>
</tr>

<tr align=center>
<td bgcolor="#FFF"><b>必要経験値</b></td>
<td bgcolor="#FFF"><form name="formEXP" id="formEXP"><input readonly type="text" size="8" name="totalEXP">
</form></td>
</tr>

<tr align=center>
<td bgcolor="#FFF">叡智の種火</td>
<td bgcolor="#FFF"><form name="formT1" id="formT1">
<input readonly type="text" maxlength="4" size="8" name="reqT1"> 個
</form></td>
</tr>

<tr align=center>
<td bgcolor="#FFF">叡智の灯火</td>
<td bgcolor="#FFF"><form name="formT2" id="formT2">
<input readonly type="text" maxlength="4" size="8" name="reqT2"> 個
</form></td>
</tr>

<tr align=center>
<td bgcolor="#FFF">叡智の大火</td>
<td bgcolor="#FFF"><form name="formT3" id="formT3">
<input readonly type="text" maxlength="4" size="8" name="reqT3"> 個
</form></td>
</tr>

<tr align=center>
<td bgcolor="#FFF">叡智の猛火</td>
<td bgcolor="#FFF"><form name="formT4" id="formT4">
<input readonly type="text" maxlength="4" size="8" name="reqT4"> 個
</form></td>
</tr>
</table>
}}