diff --git a/GURPS/gurps.css b/GURPS/gurps.css index 2ff65f6505..c17ff37b78 100644 --- a/GURPS/gurps.css +++ b/GURPS/gurps.css @@ -6589,6 +6589,34 @@ input[name="attr_tool_tabs"][value="macros"] ~ .sheet-tabs.sheet-options > div:n margin: 15px 0 15px 0; } +/* melee quick modifiers */ +.sheet-grid-melee-quick-modifier-header { + display: grid; + grid-template-columns: 30px 50px 1fr 75px; + font-weight: bold; + gap: 5px; +} + + +.sheet-grid-melee-quick-modifiers { + display: grid; + grid-template-columns: 30px 50px 1fr 75px; + gap: 0 5px; +} + +.sheet-grid-melee-quick-modifiers .sheet-expandable-section { + grid-column: 2 / 5; + display: none; + border-left: 2px solid var(--border-color); + border-bottom: 2px solid var(--border-color); + margin-bottom: 5px; + padding: 5px; +} + +.sheet-grid-melee-quick-modifiers input[name="attr_toggle_notes"][value="1"] ~ .sheet-expandable-section { + display: block; +} + /* Travel Tools */ .sheet-grid-travel-options { diff --git a/GURPS/gurps.html b/GURPS/gurps.html index ecdbe39f46..1a86f93c10 100644 --- a/GURPS/gurps.html +++ b/GURPS/gurps.html @@ -13158,7 +13158,7 @@ visualize what it will look like in chat. -
+
+ + +
+
+
 
+
+ Apply +
+
+
+ Description + + Enter a useful description of the modifier. + +
+
+
+
+ Modifier + + Enter an interger for the quick modifier. + +
+
+
+ + + + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+

Notes

+ +
+
+
+
+
@@ -13296,7 +13351,7 @@ visualize what it will look like in chat.
-
@@ -24855,6 +24910,27 @@ B378 {{/popupModifier}} + + + {{#rollTotal() quickModShow 1}} + + + Quick Modifiers + + + + Modifier: + + {{quickModTotal}} + + + + Summary: + + {{quickModSummary}} + + + {{/rollTotal() quickModShow 1}} {{#rollTotal() useModTool 1}} @@ -47136,8 +47212,6 @@ Characters with Skill: ${knowsSkill}`; let infoDescription = values[`${sectionName}_info_description`] ?? ""; infoDescription = infoDescription.replace(/\n/g, '\\n'); - console.log(infoDescription); - let finalNotes = notes; if (notes && infoDescription) { @@ -47450,7 +47524,7 @@ Characters with Skill: ${knowsSkill}`; rollDataArray.push(`{{bookReference=${bookReference}}}`); } - rollDataArray.push(`{{effectiveSkill=[[{${level} + @{modifier} + @{melee_roll_modifier}, ${meleeRollMaxNineValue} }kl1]]}}`); + rollDataArray.push(`{{effectiveSkill=[[{${level} + @{modifier} + @{melee_roll_modifier} + @{melee_quick_mod_total}, ${meleeRollMaxNineValue} }kl1]]}}`); if (meleeRollMaxNine) { rollDataArray.push(`{{maxNine=[[${meleeRollMaxNine}]]}}`); @@ -49610,4 +49684,71 @@ Characters with Skill: ${knowsSkill}`; } + on("change:repeating_melee-quick-modifier:apply", event => { + + updateMeleeQuickModifiers(); + + }); + + const updateMeleeQuickModifiers = () => { + + getSectionIDs("repeating_melee-quick-modifier", ids => { + + let fields = []; + + ids.forEach(id => { + + let applyField = `repeating_melee-quick-modifier_${id}_apply`; + + let nameField = `repeating_melee-quick-modifier_${id}_name`; + + let modifierField = `repeating_melee-quick-modifier_${id}_modifier`; + + fields.push(applyField, nameField, modifierField); + + }); + + getAttrs(fields, values => { + + let totalMod = 0; + + let summaryArray = []; + + let showInRoll = 0; + + ids.forEach(id => { + + let apply = values[`repeating_melee-quick-modifier_${id}_apply`] == "1"; + + if (apply) { + + showInRoll = 1; + + let name = values[`repeating_melee-quick-modifier_${id}_name`] ?? ""; + + let modifier = Number(values[`repeating_melee-quick-modifier_${id}_modifier`]) ?? 0; + + totalMod += modifier; + + summaryArray.push(`${name} (${modifier})`); + + } + + }); + + let summary = summaryArray.join(", "); + + let keyValues = { + melee_quick_mod_show_in_roll: showInRoll, + melee_quick_mod_total: totalMod, + melee_quick_mod_summary: summary + }; + + setAttrs(keyValues); + + }); + + }); + } + diff --git a/GURPS/translation.json b/GURPS/translation.json index 7db07c6a7a..b892acd6d3 100644 --- a/GURPS/translation.json +++ b/GURPS/translation.json @@ -1892,5 +1892,8 @@ "layer-three-label": "Layer Three Label", "layer-four-label": "Layer Four Label", "quick-modifiers-label": "Quick Modifiers", - "quick-modifiers-tooltip": "Use the table below to create a set of custom modifiers that can be applied to your next your roll. If the modifier is checked, it will automatically be applied to the roll, but you must remember to uncheck the quick modifier if you don't want to use it.

Note, this is a separate set of modifiers from the ones you can add to the skill." + "quick-modifiers-tooltip": "Use the table below to create a set of custom modifiers that can be applied to your next your roll. If the modifier is checked, it will automatically be applied to the roll, but you must remember to uncheck the quick modifier if you don't want to use it.

Note, this is a separate set of modifiers from the ones you can add to the skill.", + "quick-mod-description-tooltip": "Enter a description for the quick modifier.", + "quick-mod-tooltip": "Enter the modifier value." + } \ No newline at end of file