bulbasaur
Not quite e^(-(x-μ)²/(2σ²)) / (σ√(2π))
So, I'm making a calculator for ASB. My intents should be pretty clear by reading the code, but I'm a messy coder. Chrome's inspector says there's no errors, but it's not working.
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Bulbasaur's Reffing Calculator</title>
</head>
<body>
<center><h2>Bulbasaur's Reffing Calculator</h2></center>
<form name="calculator">
<p>Evolution modifier: <br>
<input type="radio" name="evo"> Stage 1 of 3<br>
<input type="radio" name="evo">Stage 2 of 3 or 1 of 2<br>
<input type="radio" name="evo">Stage 3 of 3 or 2 of 2 or 1 of 1<br>
Experience: <input type="text" name="exp" size="2"><br>
Same type? <input type="checkbox" name="stab"><br>
Your Sp/Atk changes: <input type="text" name="atk" size="2"><br>
Opponent's Sp/Def changes: <input type="text" name="def" size="2"><br>
Effectiveness:<br>
<input type="radio" name="effectiveness">Immunity<br>
<input type="radio" name="effectiveness">Double Resistance<br>
<Input type="radio" name="effectiveness">Resistance<br>
<input type="radio" name="effectiveness"checked>Neutral<br>
<input type="radio" name="effectiveness">Super Effective</br>
<input type="radio" name="effectiveness">Double Super Effective</br>
Base Power: <input type="text" name="bp" size="3"><br>
Other, multiplicative modifier: <input type="text" name="xmod" size="4"><br>
Other, additive modifier: <input type="text" name="+mod" size="2"><br>
PP: <input type="text" name="pp" size="2"><br>
<input type="button" value="Calculate" onclick="calculate()" >
</form>
<script language="javascript" type="text/javascript">
function calculate () {
if (document.calculator.evo[0].checked){
window.evo=0;
}
if (document.calculator.evo[1].checked){
window.evo=1;
}
if (document.calculator.evo[2].checked){
window.evo=2;
}
if (document.calculator.effectiveness[0].checked){
window.effectiveness=0;
}
if (document.calculator.effectiveness[1].checked){
window.effectiveness=0.5;
}
if (document.calculator.effectiveness[2].checked){
window.effectiveness=(2/3);
}
if (document.calculator.effectiveness[3].checked){
window.effectiveness=1;
}
if (document.calculator.effectiveness[4].checked){
window.effectiveness=1.5;
}
if (document.calculator.effectiveness[5].checked){
window.effectiveness=2;
}
if(document.calculator.stab.checked){
window.stab=1.25;
}
if(document.calculator.stab.checked==0){
window.stab=1;
}
if(document.calculator.xmod.value==null){
document.calculator.xmod.value=1;
}
expevomod = ((90 + Number(document.calculator.exp.value) + 5 * evo) / 100);
damage = Math.floor(((stab * (Number(document.calculator.bp.value) + 10 * (Number(document.calculator.atk.value) - Number(document.calculator.def.value)) * effectiveness * expevomod * Number(document.calculator.xmod.value))) / 10) + Number(document.calculator.xmod.value));
if(damage<1) {
damage=1;
}
if (Number(document.calculator.bp.value)<70) {
window.critdamage = Math.floor(((stab * ( 2 * Number(document.calculator.bp.value) + 10 * (Number(document.calculator.atk.value) - Number(document.calculator.def.value)) * effectiveness * expevomod * Number(document.calculator.xmod.value))) / 10) + Number(document.calculator.xmod.value));
}
if(Number(document.calculator.bp.value)>69) {
window.critdamage = Math.floor(((stab * (Number(document.calculator.bp.value) + 10 * (Number(document.calculator.atk.value) - Number(document.calculator.def.value) + 70) * effectiveness * expevomod * Number(document.calculator.xmod.value))) / 10) + Number(document.calculator.xmod.value));
}
if(window.critdamage<1) {
window.critdamage = 1;
}
energy = Math.floor((Math.pow(Math.log(Number(document.calculator.bp.value)),2))/(stab * Math.sqrt(Number(document.calculator.pp.value)) * expevomod));
if(energy<1) {
window.energy = 1;
}
if(window.effectiveness==0) {
damage=0;
critdamage=0;
}
document.getElementById('d').InnerHTML= damage + ', ' + critdamage + ' if it is a critical hit';
document.getElementById('e').InnerHTML= energy;
}
</script>
<p id="d">Damage:</p>
<p id="e">Energy:</p>
</body>
</html>