diff --git a/icons/statuses/dd-condition-standing.webp b/icons/statuses/dd-condition-standing.webp new file mode 100644 index 000000000..ceab4490a Binary files /dev/null and b/icons/statuses/dd-condition-standing.webp differ diff --git a/icons/statuses/dd-condition-standing.webp~ b/icons/statuses/dd-condition-standing.webp~ new file mode 100644 index 000000000..b5a95f70f Binary files /dev/null and b/icons/statuses/dd-condition-standing.webp~ differ diff --git a/lib/moustachewax.js b/lib/moustachewax.js index d7e11eaa1..f03735b21 100755 --- a/lib/moustachewax.js +++ b/lib/moustachewax.js @@ -472,10 +472,15 @@ export default function () { Handlebars.registerHelper('getPosture', function (name) { const postures = GURPS.StatusEffect.getAllPostures() - return postures[name] ?? {} // synthetic "Standing" object + return ( + postures[name] ?? { + id: 'standing', + img: 'systems/gurps/icons/statuses/dd-condition-standing.webp', + name: 'GURPS.STATUSStanding', + } + ) // synthetic "Standing" object }) - Handlebars.registerHelper('showTheMath', function () { return game.settings.get(settings.SYSTEM_NAME, settings.SETTING_SHOW_THE_MATH) ? 'checked' : '' }) @@ -496,9 +501,9 @@ export default function () { if (Array.isArray(link)) txt = link.join(',') return !!txt ? txt - .split(',') - .map((/** @type {string} */ l) => gurpslink(`[PDF:${l}]`)) - .join(', ') + .split(',') + .map((/** @type {string} */ l) => gurpslink(`[PDF:${l}]`)) + .join(', ') : '' }) @@ -604,17 +609,15 @@ export default function () { Handlebars.registerHelper('threshold-of', function (thresholds, max, value) { // return the index of the threshold that the value falls into let result = null - thresholds.some( - function ( - /** @type {{ operator: string; comparison: string; value: number; }} */ threshold, - /** @type {number} */ index - ) { - let op = getOperation(threshold.operator) - let comparison = getComparison(threshold.comparison) - let testValue = op(max, threshold.value) - return comparison(value, testValue) ? ((result = index), true) : false - } - ) + thresholds.some(function ( + /** @type {{ operator: string; comparison: string; value: number; }} */ threshold, + /** @type {number} */ index + ) { + let op = getOperation(threshold.operator) + let comparison = getComparison(threshold.comparison) + let testValue = op(max, threshold.value) + return comparison(value, testValue) ? ((result = index), true) : false + }) return result }) diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 5ed5a9a64..ac78fcbb7 100755 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -362,7 +362,7 @@ export class GurpsActorSheet extends ActorSheet { }) } // end enhanced input - // Handle the "Maneuver" dropdown on the tabbed sheet. + // Handle the Maneuver and Posture dropdowns on the tabbed sheet. html.find('#condition details').click(ev => { ev.preventDefault() const target = $(ev.currentTarget)[0] @@ -370,13 +370,21 @@ export class GurpsActorSheet extends ActorSheet { }) // Handle the "Maneuver" dropdown on the tabbed sheet. - html.find('#condition details .popup .button').click(ev => { + html.find('#condition details#maneuver .popup .button').click(ev => { ev.preventDefault() const details = $(ev.currentTarget).closest('details') const target = $(ev.currentTarget)[0] this.actor.replaceManeuver(target.alt) details.open = !details.open + }) + // Handle the "Posture" dropdown on the tabbed sheet. + html.find('#condition details#posture .popup .button').click(ev => { + ev.preventDefault() + const details = $(ev.currentTarget).closest('details') + const target = $(ev.currentTarget)[0] + this.actor.replacePosture(target.alt) + details.open = !details.open }) // On mouseover any item with the class .tooltip-manager which also has a child (image) of class .tooltippic, @@ -1003,7 +1011,7 @@ export class GurpsActorSheet extends ActorSheet { ;['name', 'uses', 'maxuses', 'techlevel', 'notes', 'pageref'].forEach( a => (obj[a] = html.find(`.${a}`).val()) ) - ;['count', 'cost', 'weight'].forEach(a => (obj[a] = parseFloat(html.find(`.${a}`).val()))) + ;['count', 'cost', 'weight'].forEach(a => (obj[a] = parseFloat(html.find(`.${a}`).val()))) let u = html.find('.save') // Should only find in Note (or equipment) if (!!u && obj.save != null) obj.save = u.is(':checked') // only set 'saved' if it was already defined let v = html.find('.ignoreImportQty') // Should only find in equipment @@ -1650,7 +1658,7 @@ export class GurpsActorTabSheet extends GurpsActorSheet { static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { classes: ['gurps', 'sheet', 'actor'], - width: 860, + width: 760, height: 600, tabs: [{ navSelector: '.gurps-sheet-tabs', contentSelector: '.sheet-body', initial: 'description' }], dragDrop: [{ dragSelector: '.item-list .item', dropSelector: null }], diff --git a/module/actor/actor.js b/module/actor/actor.js index 5bc98389f..051948a71 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -596,7 +596,7 @@ export class GurpsActor extends Actor { } _adjustMove(move, threshold, value, reason) { - switch (value) { + switch (value.toString()) { case MOVE_NONE: return { move: 0, text: i18n_f('GURPS.moveNone', { reason: reason }) } @@ -639,7 +639,7 @@ export class GurpsActor extends Actor { if (foundry.utils.getProperty(this, PROPERTY_MOVEOVERRIDE_POSTURE)) { let value = foundry.utils.getProperty(this, PROPERTY_MOVEOVERRIDE_POSTURE) - let reason = i18n(GURPS.StatusEffect.lookup(this.system.conditions.posture).label) + let reason = i18n(GURPS.StatusEffect.lookup(this.system.conditions.posture).name) adjustment = this._adjustMove(move, threshold, value, reason) } diff --git a/module/token.js b/module/token.js index 7626056fd..6af1c2f5c 100644 --- a/module/token.js +++ b/module/token.js @@ -124,7 +124,7 @@ export default class GurpsToken extends Token { } isPostureEffect(effect) { - return effect.icon && foundry.utils.getProperty(effect, 'flags.gurps.effect.type') === 'posture' + return effect.img && foundry.utils.getProperty(effect, 'flags.gurps.effect.type') === 'posture' } async setEffectActive(name, active) { diff --git a/styles/simple.css b/styles/simple.css index baabe5ace..b961636d1 100755 --- a/styles/simple.css +++ b/styles/simple.css @@ -832,7 +832,7 @@ } .gurps.sheet.actor { - min-width: 800px; + min-width: 760px; min-height: 375px; font-size: var(--font-size-13); } @@ -1173,11 +1173,11 @@ div#other { grid-area: stats; display: grid; grid-template: - 'portrait attributes-tab hp-fp encumbrance' - 'portrait qnotes hp-fp encumbrance' - 'combat-trackers combat-trackers other other' - 'combat-trackers combat-trackers other other'; - grid-template-columns: 0fr 1fr 0fr 1fr; + 'portrait attributes-tab encumbrance hp-fp' + 'portrait qnotes qnotes hp-fp' + 'combat-trackers combat-trackers other other' + 'combat-trackers combat-trackers other other'; + grid-template-columns: 0fr 1fr 1fr 0fr; grid-gap: var(--sectiongap); } @@ -1728,14 +1728,14 @@ div#other { grid-template-columns: 1fr min-content; grid-template-rows: 0fr auto auto 1fr; grid-template-areas: - 'condition condition' + 'condition combat-sidebar' 'melee combat-sidebar' 'speed-range-table combat-sidebar' 'ranged combat-sidebar'; } .sheet-body.tabbed-sheet #combat-sidebar { - grid-row: 1 / 4; + grid-area: combat-sidebar; } /* ----- combat sheet additions ----- */ @@ -2305,4 +2305,4 @@ input.gcs-input:disabled { #attributes input.gcs-input { min-width: 2.5em; -} \ No newline at end of file +} diff --git a/templates/actor/sections/conditions.hbs b/templates/actor/sections/conditions.hbs index 4a05b5f49..29903d6f5 100644 --- a/templates/actor/sections/conditions.hbs +++ b/templates/actor/sections/conditions.hbs @@ -3,67 +3,100 @@