29 lines
1.7 KiB
JavaScript
29 lines
1.7 KiB
JavaScript
|
function alcCalc() {
|
||
|
let skill = parseFloat(document.getElementById('alc-skill').value);
|
||
|
let intel = parseFloat(document.getElementById('alc-int').value);
|
||
|
let mortar = parseFloat(document.getElementById('alc-mortar').value);
|
||
|
let alembic = parseFloat(document.getElementById('alc-alembic').value);
|
||
|
let calcinator = parseFloat(document.getElementById('alc-calcinator').value);
|
||
|
let retort = parseFloat(document.getElementById('alc-retort').value);
|
||
|
let potency = parseFloat(document.getElementById('alc-potency').value);
|
||
|
let cost = parseFloat(document.getElementById('alc-cost').value);
|
||
|
let output = document.getElementById('alc-output');
|
||
|
let magnitude = Math.floor(((skill * 2.0) + (intel / 4.0) + mortar + alembic + potency) / cost);
|
||
|
let duration = Math.floor(((skill * 2.0) + (intel / 4.0) + calcinator + retort + potency)/4.0);
|
||
|
output.innerHTML = "Magnitude: <b>" + magnitude.toString() + "</b> Duration: <b>" + duration.toString() + "</b>";
|
||
|
}
|
||
|
|
||
|
function spellCalc() {
|
||
|
let magnitude = parseFloat(document.getElementById('spell-magnitude').value);
|
||
|
let duration = parseFloat(document.getElementById('spell-duration').value);
|
||
|
let area = parseFloat(document.getElementById('spell-area').value);
|
||
|
let ranged = document.getElementById('spell-ranged').checked;
|
||
|
let cost = parseFloat(document.getElementById('spell-cost').value);
|
||
|
let output = document.getElementById('spell-output');
|
||
|
var mod = 60.0;
|
||
|
if (ranged) mod = 48.0;
|
||
|
let spellCost = ( (((magnitude * duration) + area) * cost) / mod );
|
||
|
let difficulty = 20 + (Math.ceil(spellCost) * 2);
|
||
|
output.innerHTML = "Cost: <b>"+spellCost+(Math.ceil(spellCost)!=spellCost?" ("+Math.ceil(spellCost)+")":"")+"</b> Difficulty: <b>"+difficulty+"</b>";
|
||
|
}
|