fixed calc scripts

This commit is contained in:
James 2022-09-27 09:20:11 +02:00
parent cffe5ac6e2
commit 94c8378497

View File

@ -266,10 +266,9 @@
<label> <input id="mob_dmg_type_max" name="mob_dmg_type" type="radio" onchange="usingDMGDice('max')" /> <span>Max Damage</span> </label> <label> <input id="mob_dmg_type_max" name="mob_dmg_type" type="radio" onchange="usingDMGDice('max')" /> <span>Max Damage</span> </label>
</div> </div>
</div> </div>
<div class="card black"> <div id="DMG_hitdice_card" class="card black">
<div class="card-content white-text"> <div class="card-content white-text">
<span class="card-title">Damage definition</span> <span class="card-title">Hitdice Damage</span>
<div id="dmg_hitdice">
<span>How many Dice are used for the calculation?</span> <span>How many Dice are used for the calculation?</span>
<div class="input-field s1"> <div class="input-field s1">
<input placeholder="[X]d6" id="mob_dmg_dice_ammount" min="1" type="number" class="white-text validate" /> <input placeholder="[X]d6" id="mob_dmg_dice_ammount" min="1" type="number" class="white-text validate" />
@ -278,18 +277,34 @@
<div class="input-field s3"> <div class="input-field s3">
<input placeholder=" 4d[Y]" id="mob_dmg_dice_type" min="1" type="number" class="white-text validate" /> <input placeholder=" 4d[Y]" id="mob_dmg_dice_type" min="1" type="number" class="white-text validate" />
</div> </div>
</div> </div>
<div id="dmg_average"> </div>
<div id="DMG_average_card" class="card black">
<div class="card-content white-text">
<span class="card-title">Hitdice Damage</span>
<span>How many Dice are used for the calculation
<span>What's the average damage of the enemy?</span> <span>What's the average damage of the enemy?</span>
<div class="input-field s1"> <div class="input-field s1">
<input placeholder="The number before the damage dice." id="mob_dmg_avg" min="1" type="number" class="white-text validate" /> <input placeholder="The number before the damage dice." id="mob_dmg_avg" min="1" type="number" class="white-text validate" />
</div> </div>
</div> </div>
<div id="dmg_max"> </div>
<div id="DMG_max_card" class="card black">
<div class="card-content white-text">
<span>What's the average damage of the enemy?</span>
<div class="input-field s1">
<input placeholder="x times the hit dieces' sides." id="mob_dmg_max" min="1" type="number" class="white-text validate" />
</div>
</div>
</div>
<div id="DMG_max_card" class="card black">
<div class="card-content white-text">
<span>What's the max rolled damage of the enemy?</span> <span>What's the max rolled damage of the enemy?</span>
<div class="input-field s1"> <div class="input-field s1">
<input placeholder="x times the hit dieces' sides." id="mob_dmg_max" min="1" type="number" class="white-text validate" /> <input placeholder="x times the hit dieces' sides." id="mob_dmg_max" min="1" type="number" class="white-text validate" />
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -964,10 +979,10 @@
$("#mob_multiattack_ammount").attr("max", $("#mob_ammount").val()) $("#mob_multiattack_ammount").attr("max", $("#mob_ammount").val())
if ($("#mob_ammount").val() > 1) { if ($("#mob_ammount").val() > 1) {
// FIX HP // FIX HP
usingHPDice(false); usingHPDice("average");
$("#mob_hp_type_rolled").attr("disabled", true); $("#mob_hp_type_rolled").attr("disabled", true);
$("#mob_hp_type_averages").prop("checked", true); $("#mob_hp_type_averages").prop("checked", true);
usingDMGDice(false); usingDMGDice("average");
$("#mob_dmg_type_rolled").attr("disabled", true); $("#mob_dmg_type_rolled").attr("disabled", true);
$("#mob_dmg_type_averages").prop("checked", true); $("#mob_dmg_type_averages").prop("checked", true);
} else { } else {
@ -1040,16 +1055,53 @@
function usingDMGDice(e) { function usingDMGDice(e) {
if (e) { switch (e) {
$("#dmg_hitdice").hide("fast"); case "dice":
$("#DMG_hitdice_card").hide("fast");
$("#DMG_average_card").hide("fast");
$("#DMG_max_card").show("fast");
$("#mob_dmg_avg").val(""); $("#mob_dmg_avg").val("");
$("#dmg_average").show("fast");
} else {
$("#dmg_average").hide("fast");
$("#mob_dmg_dice_ammount").val(""); $("#mob_dmg_dice_ammount").val("");
$("#mob_dmg_dice_type").val(""); $("#mob_dmg_dice_type").val("");
$("#dmg_hitdice").show("fast"); $("#mob_dmg_max").val("");
} break;
case "averages":
$("#DMG_max_card").hide("fast");
$("#DMG_hitdice_card").hide("fast");
$("#DMG_average_card").show("fast");
$("#mob_dmg_avg").val("");
$("#mob_dmg_dice_ammount").val("");
$("#mob_dmg_dice_type").val("");
$("#mob_dmg_max").val("");
break;
case "averages":
$("#DMG_max_card").hide("fast");
$("#DMG_hitdice_card").hide("fast");
$("#DMG_average_card").show("fast");
$("#mob_dmg_avg").val("");
$("#mob_dmg_dice_ammount").val("");
$("#mob_dmg_dice_type").val("");
$("#mob_dmg_max").val("");
break;
case "max":
$("#DMG_max_card").show("fast");
$("#DMG_hitdice_card").hide("fast");
$("#DMG_average_card").hide("fast");
$("#mob_dmg_avg").val("");
$("#mob_dmg_dice_ammount").val("");
$("#mob_dmg_dice_type").val("");
$("#mob_dmg_max").val("");
break;
}
calcDiff(); calcDiff();
} }