Added extra character resources to add

This includes extra mental and physical injuries, as well as exhaustion and blood points
This commit is contained in:
DrgnRanger
2022-01-07 18:23:47 -05:00
committed by GitHub
parent 623c8083e9
commit a66fbcc855
+35 -11
View File
@@ -295,7 +295,7 @@
<div class="sheet-luck-tokens">
<span>Luck Token(s):</span>
<input type="number" name="attr_luck_tokens" title="@{luck_token}" style="width: 40px;" min = "0" max = "3" step="1">
<input type="number" name="attr_luck_tokens" title="@{luck_token}" style="width: 40px;" min = "0" step="1">
</div>
</div>
@@ -326,7 +326,7 @@
<!--Avantage or disadvantage, with an extra dice in case there is a need for more generic dice to be rolled and tracked on the sheet (usually these don't go above a d12, but they could go up to a d12 + d4, or they could be used to add to a skill with a d12 + d4 modifier)-->
<div class="sheet-advantage-disadvantage sheet-subblock">
<!--Note that these use the old checkbox system with rolls to keep advantage and disaddvantae seperated-->
<label>Advantage and Disadvantage</label>
<label>Advantage and Disadvatage</label>
<div class="sheet-rolls-row">
<div class="sheet-rolls-col sheet-substat">
<span>Advantage</span>
@@ -675,7 +675,7 @@
<label>Wealth and Property</label>
<div class="textbox">
<div class="options">
<textarea name="attr_wealth_property" style="min-height: 186px; height: 186px; max-height: 274px; max-width: 210px; min-width: 210px;"></textarea>
<textarea name="" style="min-height: 186px; height: 186px; max-height: 274px; max-width: 210px; min-width: 210px;"></textarea>
</div>
</div>
</div>
@@ -1049,6 +1049,26 @@
<span>Toggle Heroic Character:</span>
<input type="checkbox" name="attr_heroic_character" title="@{heroic_character}" value="1"/>
</div>
<div>
<span>Add Max Physical Injuries:</span>
<input type="number" name="attr_extra_physical_injuries" title="@{extra_physical_injuries}" class="sheet-biomenu" min = "0" step="1">
</div>
<div>
<span>Add Max Mental Injuries:</span>
<input type="number" name="attr_extra_mental_injuries" title="@{extra_mental_injuries}" class="sheet-biomenu" min = "0" step="1">
</div>
<div>
<span>Add Max Exhaustion:</span>
<input type="number" name="attr_extra_exhaustion" title="@{extra_exhaustion}" class="sheet-biomenu" min = "0" step="1">
</div>
<div>
<span>Add Max Blood Points:</span>
<input type="number" name="attr_extra_blood_points" title="@{extra_blood_points}" class="sheet-biomenu" min = "0" step="1">
</div>
</div>
<!--Custom roll table for this sheet, uses Jakob's Better Default Rolltemplate with some customization-->
@@ -1081,29 +1101,33 @@
});
//Changing max injuries, blood points, and max exhaustion
on("change:willpower change:constitution change:heroic_character sheet:opened", function() {
getAttrs(["willpower", "constitution", "heroic_character"], function(values) {
on("change:willpower change:constitution change:heroic_character change:extra_physical_injuries change:extra_mental_injuries change:extra_exhaustion change:extra_blood_points change:sheet:opened", function() {
getAttrs(["willpower", "constitution", "extra_physical_injuries", "extra_mental_injuries", "extra_exhaustion", "extra_blood_points", "heroic_character"], function(values) {
let will = parseInt(values["willpower"]) || 0;
let con = parseInt(values["constitution"]) || 0;
let heroic = parseInt(values["heroic_character"]) || 0;
console.log(heroic);
let extraphys = parseInt(values["extra_physical_injuries"]) || 0;
let extrament = parseInt(values["extra_mental_injuries"]) || 0;
let extraexh = parseInt(values["extra_exhaustion"]) || 0;
let extrabp = parseInt(values["extra_blood_points"]) || 0;
console.log(heroic);
let mentInjMax = will / 2;
let physInjMax = con / 2;
let mentInjMax = extrament + (will / 2);
let physInjMax = extraphys + (con / 2);
let maxInj = Math.max(mentInjMax, physInjMax);
let minInj = Math.min(mentInjMax, physInjMax)
if (heroic == 1) {
var exhMax = (2 * maxInj) + minInj;
var exhMax = (2 * maxInj) + minInj + extraexh;
}
else {
var exhMax = mentInjMax + physInjMax;
var exhMax = mentInjMax + physInjMax + extraexh;
}
setAttrs({
mental_injuries_max: mentInjMax,
physical_injuries_max: physInjMax,
blood_points_max: con,
blood_points_max: con + extrabp,
exhaustion_max: exhMax
});