update gurps

Hit Location & Armor Table. Added a new column to show the final to hit penalty
This commit is contained in:
Ken
2023-02-16 00:06:55 -08:00
parent 129d7beeee
commit ff072ca3cf
3 changed files with 124 additions and 55 deletions
+6 -5
View File
@@ -4993,7 +4993,7 @@ input[name="attr_options_tabs"][value="import-json"] ~ .sheet-tabs.sheet-options
/* by default columns layer 2-4 are hidden, only show */
.sheet-hit-location-grid {
display: grid;
grid-template-columns: 90px 43px 43px 50px 43px 43px max-content;
grid-template-columns: 90px 43px 43px 43px 50px 43px 43px max-content;
grid-gap: 0;
padding: 0;
}
@@ -5009,7 +5009,7 @@ input[name="attr_options_tabs"][value="import-json"] ~ .sheet-tabs.sheet-options
/* show armor layer 2 & summary */
input[name="attr_armor_layers"][value="2"] ~ .sheet-hit-location-grid,
input[name="attr_armor_layers"][value="2"] ~ .repcontainer .repitem .sheet-hit-location-grid {
grid-template-columns: 90px 43px 43px 50px 43px 43px max-content max-content max-content;
grid-template-columns: 90px 43px 43px 43px 50px 43px 43px max-content max-content max-content;
}
input[name="attr_armor_layers"][value="2"] ~ .sheet-hit-location-grid .sheet-layer-2,
@@ -5022,7 +5022,7 @@ input[name="attr_armor_layers"][value="2"] ~ .repcontainer .repitem .sheet-hit-l
/* show armor layer 2-3 & summary */
input[name="attr_armor_layers"][value="3"] ~ .sheet-hit-location-grid,
input[name="attr_armor_layers"][value="3"] ~ .repcontainer .repitem .sheet-hit-location-grid {
grid-template-columns: 90px 43px 43px 50px 43px 43px max-content max-content max-content max-content;
grid-template-columns: 90px 43px 43px 43px 50px 43px 43px max-content max-content max-content max-content;
}
input[name="attr_armor_layers"][value="3"] ~ .sheet-hit-location-grid .sheet-layer-2,
@@ -5037,7 +5037,7 @@ input[name="attr_armor_layers"][value="3"] ~ .repcontainer .repitem .sheet-hit-l
/* show armor layer 2-4 & summary */
input[name="attr_armor_layers"][value="4"] ~ .sheet-hit-location-grid,
input[name="attr_armor_layers"][value="4"] ~ .repcontainer .repitem .sheet-hit-location-grid {
grid-template-columns: 90px 43px 43px 50px 43px 43px max-content max-content max-content max-content max-content;
grid-template-columns: 90px 43px 43px 43px 50px 43px 43px max-content max-content max-content max-content max-content;
}
input[name="attr_armor_layers"][value="4"] ~ .sheet-hit-location-grid .sheet-layer-2,
@@ -5085,7 +5085,8 @@ input[name="attr_armor_layers"][value="4"] ~ .repcontainer .repitem .sheet-hit-l
font-size: 12px;
}
.sheet-hit-location-grid .sheet-item input[readonly="readonly"] {
.sheet-hit-location-grid .sheet-item input[readonly="readonly"],
.sheet-hit-location-grid .sheet-item input[disabled="disabled"] {
background: var(--input-disabled-bg);
text-align: center;
}
+115 -49
View File
@@ -4358,21 +4358,20 @@
<input type="text" name="attr_announcement_version" readonly="readonly" value="0" title="GURPS Character Sheet Version" />
</h4>
<!-- current version notes: 2.9.4 -->
<!-- current version notes: 2.9.5 -->
<ul>
<li>Wound Modifier Notes: Added formatting to improve legibility on roll template.
<ul>
<li>To update the Wound Modifier Notes for an existing character, go to the <b>Options->Rules</b> tab and under the section <b>Editable Wound Modifier Notes</b> click the reset button.</li>
</ul>
</li>
<li>
Slam, Falling, and Collision notes revisions. Added damage type to Falling and Collision. If the damage type is other than crushing damage is halved.
Hit Location & Armor Table. Added a new column to show the final to hit penalty, it will total the modifier for the hit location and the Size Modifier.
This should avoid weird syncing issues when changing hit location and size modifiers.
<ul>
<li>Notes in roll template. Collapsible notes section should be available when the character sheet is updated to work with Roll20s non-legacy html/css.</li>
<li>
<b>Note:</b> When the sheet is updated, it will attempt to remove the size modifier from the hit location modifier.
However, this may not work, you may have to manually adjust the hit location modifier.
</li>
</ul>
</li>
</ul>
<label class="check"><input type="checkbox" name="attr_announcements_hide" value="1">&nbsp;<b><span data-i18n="hide-until-next-update">Hide until next update</span></b></label>
<button type="action" name="act_view_updates_tab" class="reset"><span data-i18n="view-all-updates">View All Updates</span></button>
</div>
@@ -9378,7 +9377,7 @@ visualize what it will look like in chat.
<!-- tabs -->
<label>
<input type="radio" name="attr_combat_tabs" value="damage" class="tab-control" checked />
<span data-i18n="damage-label">Damage</span>
<span data-i18n="hit-locations-label">Hit Locations</span>
</label>
<label>
<input type="radio" name="attr_combat_tabs" value="defense" class="tab-control" />
@@ -9772,6 +9771,7 @@ visualize what it will look like in chat.
<input type="hidden" name="attr_armor_show_back" />
<input type="hidden" name="attr_armor_layers" />
<input type="hidden" name="attr_hit_location_modifiers_upgraded" value="false" />
<div class="hit-location-grid">
<!-- header row -->
@@ -9782,10 +9782,19 @@ visualize what it will look like in chat.
<div class="item grid-header">
<h4 class="spacer">&nbsp;</h4>
<div class="popup">
<span data-i18n="abbreviation-penalty-label">Pen</span>
<span data-i18n="abbreviation-penalty-label">PEN</span>
</div>
<span class="tooltip">
<span data-i18n="armor-penalty-tooltip">Penalty to hit this location.<br /><b>NOTE:</b> Size Modifier is factored in on <i>Applying</i> location type or changing <i>Size Modifier</i>.</span>
<span data-i18n="armor-penalty-tooltip">Penalty to hit this location.</span>
</span>
</div>
<div class="item grid-header">
<h4 class="spacer">&nbsp;</h4>
<div class="popup">
<span data-i18n="modifier-abbreviation-label">MOD</span>
</div>
<span class="tooltip">
<span data-i18n="armor-modifier-tooltip">The final <b>To Hit</b> modifier, the <b>Hit Location Penalty</b> plus the character's <b>Size Modifier</b>.</span>
</span>
</div>
<div class="item grid-header">
@@ -9915,6 +9924,9 @@ visualize what it will look like in chat.
<div class="item">
<input type="number" step="1" value="0" name="attr_penalty" title="Macro: @{NAME|repeating_hitlocation_$[row #]_penalty}" />
</div>
<div class="item">
<input type="number" value="@{penalty} + @{size}" disabled="disabled" name="attr_final_modifier" title="Macro: @{NAME|repeating_hitlocation_$[row #]_final_modifier}" />
</div>
<div class="item">
<input type="number" value="0" step="1" min="0" name="attr_defense_bonus" title="Macro: @{NAME|repeating_hitlocation_$[row #]_defense_bonus}" />
</div>
@@ -14626,7 +14638,25 @@ Slam uses either DX, Brawling, or Sumo Wrestling. Note that the -4 to hit and ef
<p>Pull Request: <span name="attr_latest_changes"></span></p>
<!-- current version notes: 2.9.4 -->
<!-- current version notes: 2.9.5 -->
<ul>
<li>
Hit Location & Armor Table. Added a new column to show the final to hit penalty, it will total the modifier for the hit location and the Size Modifier.
This should avoid weird syncing issues when changing hit location and size modifiers.
<ul>
<li>
<b>Note:</b> When the sheet is updated, it will attempt to remove the size modifier from the hit location modifier.
However, this may not work, you may have to manually adjust the hit location modifier.
</li>
</ul>
</li>
</ul>
<h4>Version: 2.9.4</h4>
<p>Pull Request: 2/6/2023</p>
<ul>
<li>Wound Modifier Notes: Added formatting to improve legibility on roll template.
<ul>
@@ -18113,9 +18143,9 @@ Diffuse: Max 2HP (Exception: Area-effect, cone, and explosion attacks cause norm
const noop = function () { }; // do nothing callback function.
const version = "2.9.4";
const version = "2.9.5";
const latestChangesDate = "2/6/2023";
const latestChangesDate = "2/20/2023";
let modCascade = true;
@@ -19321,6 +19351,8 @@ Diffuse: Max 2HP (Exception: Area-effect, cone, and explosion attacks cause norm
updateTechLevelPoints();
updateLanguagePoints();
upgradeHitLocationPenaltiesToNewVersion();
}
@@ -26992,23 +27024,9 @@ B378
}
on("change:size", (event) => {
let sizeDiff = Number(event.newValue) - Number(event.previousValue);
if (isNaN(sizeDiff)) {
sizeDiff = 0;
}
updateReach();
updateRepeatingHitLocationPenaltyCrippledValues(sizeDiff);
});
on("change:hit_points_max", (event) => {
updateRepeatingHitLocationPenaltyCrippledValues(0);
updateRepeatingHitLocationCrippledValues();
});
@@ -29707,6 +29725,68 @@ B378
});
}
function upgradeHitLocationPenaltiesToNewVersion() {
getAttrs(["hit_location_modifiers_upgraded", "size"], values => {
const upgraded = values.hit_location_modifiers_upgraded === "true";
const sizeModifier = Number(values.size) ?? 0;
let updates = {
hit_location_modifiers_upgraded: "true"
};
if (upgraded) {
// only upgraded, Leave
return;
} else if (sizeModifier == 0) {
// don't do anything if there's no size modifier
setAttrs(updates, { silent: true });
return;
}
// get all the section id numbers
getSectionIDs("repeating_hitlocation", (ids) => {
let repeatingFields = [];
// get a list of values we need from the table rows
for (let i = 0; i < ids.length; i++) {
let penaltyProp = `repeating_hitlocation_${ids[i]}_penalty`;
repeatingFields.push(penaltyProp);
}
// get the values
getAttrs(repeatingFields, function (repeatingValues) {
// loop through ids and create a list value to update
for (let i = 0; i < ids.length; i++) {
let penaltyProp = `repeating_hitlocation_${ids[i]}_penalty`;
let penalty = Number(repeatingValues[penaltyProp]);
// remove the size modifier
penalty = penalty - sizeModifier;
updates[penaltyProp] = penalty;
}
setAttrs(updates, { silent: true });
});
});
});
}
/**
@@ -29715,9 +29795,8 @@ B378
* Get original penalty value
* then update the final penalty, divisor, and disabled hit points
*
* @param {number} sizeDiff The size difference.
*/
function updateRepeatingHitLocationPenaltyCrippledValues(sizeDiff) {
function updateRepeatingHitLocationCrippledValues() {
let fields = [
"hit_points_max",
@@ -29727,6 +29806,8 @@ B378
let hitPoints = Number(values.hit_points_max);
let updates = {};
// get all the section id numbers
getSectionIDs("repeating_hitlocation", (ids) => {
@@ -29735,12 +29816,8 @@ B378
// get a list of values we need from the table rows
for (let i = 0; i < ids.length; i++) {
let penaltyProp = `repeating_hitlocation_${ids[i]}_penalty`;
let divisorProp = `repeating_hitlocation_${ids[i]}_divisor`;
repeatingFields.push(penaltyProp);
repeatingFields.push(divisorProp);
}
@@ -29748,21 +29825,13 @@ B378
// get the values
getAttrs(repeatingFields, function (repeatingValues) {
let updates = {};
// loop through ids and create a list value to update
for (let i = 0; i < ids.length; i++) {
let penaltyProp = `repeating_hitlocation_${ids[i]}_penalty`;
let penalty = Number(repeatingValues[penaltyProp]);
let divisorProp = `repeating_hitlocation_${ids[i]}_divisor`;
let divisor = Number(repeatingValues[divisorProp]);
let newPenalty = sizeDiff + penalty;
if (divisor < 0) {
divisor = 1;
}
@@ -29776,8 +29845,6 @@ B378
let crippledProp = `repeating_hitlocation_${ids[i]}_crippled`;
updates[penaltyProp] = newPenalty;
updates[crippledProp] = crippled;
}
@@ -29787,7 +29854,7 @@ B378
});
});
});
}
@@ -29988,7 +30055,6 @@ B378
});
/**
* If option to update Hit Points when changing damage table location damage
* is on, then update the current Hit Points.
+3 -1
View File
@@ -787,6 +787,7 @@
"option-enter-my-own": "Enter My Own",
"copy-paste-row-id-tooltip": "Copy/paste the Skill or Spell Row ID to link that skill to this technique.<br>When the skill/spell is updated, the technique's parent name and base skill level<br>will be updated.<br>Once entered, this will change the Skill/Spell for this particular attack to match<br>the skill/spell level of the Base Skill. Do not change this skill Level number manually.",
"name-label": "Name:",
"hit-locations-label": "Hit Locations",
"damage-label": "Damage",
"defense-label": "Defense",
"melee-label": "Melee",
@@ -811,7 +812,8 @@
"back-armor-tooltip": "Show back armor for each layer.",
"hit-location-notes-tooltip": "Enter notes and traits here.<br>Example include adding damage ntoes for <i>Unliving</i>, <i>Homogenous</i>, <i>Diffuse</i>, <i>Unbreakable Bones (Powers 52)</i>, <i>Damage Reduction (Powers 52).</i> see B380.",
"abbreviation-penalty-label": "Pen",
"armor-penalty-tooltip": "Penalty to hit this location.<br><b>NOTE:</b> Size Modifier is factored in on <i>Applying</i> location type or changing <i>Size Modifier</i>.",
"armor-penalty-tooltip": "Penalty to hit this location.",
"armor-modifier-tooltip": "The final <b>To Hit</b> modifier, the <b>Hit Location Penalty</b> plus the character's <b>Size Modifier</b>.",
"layer-1-label": "Layer 1",
"armor-layor-tooltip": "Enter DR for this location.<br>* = flexible<br>You can split the DR using with these suggested abbreviations.<br>cr = crush<br>pi = pierce<br>cut = cutting<br>imp = impaling<br>bu = burning<br><b>Alert:</b> To enter a split DR, the first number must be the primary DR, while the second number are the exceptions, this is required in order to know how to split the armor.",
"armor-layor1-tooltip": "\"Layer 1 <i>(Inner most)</i> is good for natural DR or concealable armor, such as cloth armor under a breastplate.",