<html>
<head>
<title>Metalix TD コスト計算機</title>
<script type="text/javascript">
<!--
function tower(method, add){
a = document.all.item(method).value;
a = a - 0 + add;
if(method != "number"){
if (a == 6){a = 5};
if (a == 0){a = 1};
}
document.all.item(method).value = a;
calc();
}
function tower_select(){
switch(document.all.item("kind").value){
case "canon":
document.all.item("kind").value = "laser";
break;
case "laser":
document.all.item("kind").value = "fire";
break;
case "fire":
default:
document.all.item("kind").value = "canon";
break;
}
calc();
}
function calc(){
switch(document.all.item("kind").value){
case "canon":
c = ((document.all.item("number").value - 0) + 1) * 150
+ Array(0, 400, 1400, 4400, 12400)[document.all.item("power").value - 1]
+ Array(0, 200, 700, 1700, 3700)[document.all.item("range").value - 1]
+ Array(0, 500, 2000, 6000, 16000)[document.all.item("quantity").value - 1]
+ Array(0, 100, 600, 1600, 3600)[document.all.item("movement").value - 1];
p = document.all.item("power").value * 10;
r = 600 / Array(8, 6, 5, 3, 2)[document.all.item("quantity").value - 1];
break;
case "laser":
c = ((document.all.item("number").value - 0) + 1) * 500
+ Array(0, 800, 2800, 7800, 19800)[document.all.item("power").value - 1]
+ Array(0, 500, 2000, 5000, 10000)[document.all.item("range").value - 1]
+ Array(0, 5000, 15000, 15000, 15000)[document.all.item("quantity").value - 1]
+ Array(0, 200, 1200, 3200, 7200)[document.all.item("movement").value - 1];
p = document.all.item("power").value * 2;
r = 600 * document.all.item("quantity").value;
break;
case "fire":
default:
c = ((document.all.item("number").value - 0) + 1) * 750
+ Array(0, 400, 1900, 4900, 12900)[document.all.item("power").value - 1]
+ Array(0, 1000, 3000, 7000, 17000)[document.all.item("range").value - 1]
+ Array(0, 1000, 6000, 21000, 21000)[document.all.item("quantity").value - 1]
+ Array(0, 300, 1800, 4800, 10800)[document.all.item("movement").value - 1];
p = (document.all.item("power").value + 2) * 25;
r = 600 / Array(100, 80, 60, 40, 40)[document.all.item("quantity").value - 1];
break;
}
document.all.item("price").innerText = p * r / 5;
document.all.item("cost").innerText = c;
document.all.item("ratio").innerText = Math.round(p * r * 400/ c);
document.all.item("sell").innerText = Math.ceil(c / 4);
}
// -->
</script>
<style><!--
td, input{text-align: right;}
--></style>
</head>
<form name="C" action="#">
<table>
<tr><td>何台目:</td><td>
<input type="text" name="number" size="2" value="1" id="number" />
<input type="button" value=" + " onclick="tower('number',1)" />
<input type="button" value=" - " onclick="tower('number',-1)" />
</td></tr>
<tr><td>種類:</td><td>
<input type="text" name="kind" size="5" value="canon" id="kind" />
<input type="button" value="変更" onclick="tower_select()" />
</td></tr>
<tr><td>攻撃力:</td><td>
<input type="text" name="power" size="1" value="1" id="power" />
<input type="button" value=" + " onclick="tower('power',1)" />
<input type="button" value=" - " onclick="tower('power',-1)" />
</td></tr>
<tr><td>攻撃範囲:</td><td>
<input type="text" name="range" size="1" value="1" id="range" />
<input type="button" value=" + " onclick="tower('range',1)" />
<input type="button" value=" - " onclick="tower('range',-1)" />
</td></tr>
<tr><td>攻撃量:</td><td>
<input type="text" name="quantity" size="1" value="1" id="quantity" />
<input type="button" value=" + " onclick="tower('quantity',1)" />
<input type="button" value=" - " onclick="tower('quantity',-1)" />
</td></tr>
<tr><td>移動力:</td><td>
<input type="text" name="movement" size="1" value="1" id="movement" />
<input type="button" value=" + " onclick="tower('movement',1)" />
<input type="button" value=" - " onclick="tower('movement',-1)" />
</td></tr>
<tr><td>経費</td><td id="cost">300</td></tr>
<tr><td>総合指数</td><td id="price" name="price">150</td></tr>
<tr><td>効率指数</td><td id="ratio">1000</td></tr>
<tr><td>売却損</td><td id="sell">75</td></tr>
</table>
</form>
</body>
</html>
最終更新:2008年03月18日 13:45