added switch state

This commit is contained in:
James 2022-09-26 15:28:28 +02:00
parent f300ae8b52
commit bf9598eb8f
1 changed files with 30 additions and 14 deletions

View File

@ -205,8 +205,8 @@
<div class="card-content white-text">
<span class="card-title">Health kind</span>
<span>Are we using Max, Average or rolled HP?</span><br />
<label> <input id="mob_hp_type_averages" name="mob_hp_type" type="radio" checked onchange="usingHPDice(false)" /> <span>Averages</span> </label>
<label> <input id="mob_hp_type_rolled" name="mob_hp_type" type="radio" onchange="usingHPDice(true)" /> <span>Hit Dice</span> </label>
<label> <input id="mob_hp_type_averages" name="mob_hp_type" type="radio" checked onchange="usingHPDice('averages')" /> <span>Averages</span> </label>
<label> <input id="mob_hp_type_rolled" name="mob_hp_type" type="radio" onchange="usingHPDice('dice')" /> <span>Hit Dice</span> </label>
<label> <input id="mob_hp_type_max" name="mob_hp_type" type="radio" onchange="usingHPDice('max')" /> <span>Max</span> </label>
</div>
</div>
@ -987,7 +987,8 @@
}
function usingHPDice(e) {
if (e) {
switch (e) {
case "dice":
$("#HP_max_card").hide("fast");
$("#HP_average_card").hide("fast");
$("#HP_hitdice_card").show("fast");
@ -996,8 +997,8 @@
$("#mob_hp_dice_ammount").val("");
$("#mob_hp_dice_type").val("");
$("#mob_hp_max").val("");
} else if (e == false) {
break;
case "averages":
$("#HP_max_card").hide("fast");
$("#HP_hitdice_card").hide("fast");
$("#HP_average_card").show("fast");
@ -1007,17 +1008,32 @@
$("#mob_hp_dice_type").val("");
$("#mob_hp_max").val("");
} else if (e == "max") {
break;
case "averages":
$("#HP_max_card").hide("fast");
$("#HP_hitdice_card").hide("fast");
$("#HP_average_card").show("fast");
$("#HP_max_card").show("fast");
$("#HP_hitdice_card").hide("fast");
$("#HP_average_card").hide("fast");
$("#mob_hp_avg").val("");
$("#mob_hp_dice_ammount").val("");
$("#mob_hp_dice_type").val("");
$("#mob_hp_max").val("");
$("#mob_hp_avg").val("");
$("#mob_hp_dice_ammount").val("");
$("#mob_hp_dice_type").val("");
$("#mob_hp_max").val("");
}
break;
case "max":
$("#HP_max_card").show("fast");
$("#HP_hitdice_card").hide("fast");
$("#HP_average_card").hide("fast");
$("#mob_hp_avg").val("");
$("#mob_hp_dice_ammount").val("");
$("#mob_hp_dice_type").val("");
$("#mob_hp_max").val("");
break;
}
calcDiff();
}