Skip to content

Commit

Permalink
Fix Knockback ADD buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
mjeffw committed Jan 18, 2025
1 parent 47f02f6 commit d588830
Show file tree
Hide file tree
Showing 7 changed files with 543 additions and 541 deletions.
2 changes: 1 addition & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@
"GURPS.statsTab": "Werte",
"GURPS.suffersAMajorWound": "{name} erleidet eine Schwere Wunde",
"GURPS.suffersHeadVitalsWound": "{name} wurde am {location} getroffen, und verursachte Schock.",
"GURPS.suffersKnockback": "{name} prallt {classStart}([PDF:{pdfref}]){classEnd} {yards} {unit} zurück.",
"GURPS.suffersKnockback": "{name} prallt ([PDF:{pdfref}]) {yards} {unit} zurück.",
"GURPS.swimmerFlyer": "Schwimmer / Flieger",
"GURPS.swimmersOrFlyersSuffer": "Schwimmer Flieger",
"GURPS.target": "Ziel",
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@
"GURPS.statsTab": "Stats",
"GURPS.suffersAMajorWound": "{name} suffers a Major Wound",
"GURPS.suffersHeadVitalsWound": "{name} was struck in the {location} with a Shock penalty.",
"GURPS.suffersKnockback": "{name} suffers Knockback {classStart}([PDF:{pdfref}]){classEnd} of {yards} {unit}.",
"GURPS.suffersKnockback": "{name} suffers Knockback ([PDF:{pdfref}]) of {yards} {unit}.",
"GURPS.swimmerFlyer": "Swimmer / Flyer",
"GURPS.swimmersOrFlyersSuffer": "Swimmers Flyers",
"GURPS.target": "Target",
Expand Down
2 changes: 1 addition & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@
"GURPS.statsTab": "Stats",
"GURPS.suffersAMajorWound": "{name} souffre d'une Blessure Grave",
"GURPS.suffersHeadVitalsWound": "{name} a été touché sur {location} avec une pénalité de Choc.",
"GURPS.suffersKnockback": "{name} est Renversé {classStart}([PDF:{pdfref}]){classEnd} ou {yards} {unit}.",
"GURPS.suffersKnockback": "{name} est Renversé ([PDF:{pdfref}]) ou {yards} {unit}.",
"GURPS.swimmerFlyer": "Aquatique / Volant",
"GURPS.swimmersOrFlyersSuffer": "Aquatique Volant",
"GURPS.target": "Cible",
Expand Down
2 changes: 1 addition & 1 deletion lang/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@
"GURPS.statsTab": "Características",
"GURPS.suffersAMajorWound": "{name} sofre um Ferimento Grave",
"GURPS.suffersHeadVitalsWound": "{name} foi atingido(a) no(a) {location} com uma Penalidade de Choque.",
"GURPS.suffersKnockback": "{name} sofre uma Projeção {classStart}([PDF:{pdfref}]){classEnd} de {yards} {unit}.",
"GURPS.suffersKnockback": "{name} sofre uma Projeção ([PDF:{pdfref}]) de {yards} {unit}.",
"GURPS.swimmerFlyer": "Nadador/Voador",
"GURPS.swimmersOrFlyersSuffer": "Nadadores ou voadores sofrem",
"GURPS.target": "Alvo",
Expand Down
23 changes: 15 additions & 8 deletions module/damage/applydamage.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,21 @@ export default class ApplyDamageDialog extends Application {
let dataEffect = ev.currentTarget.attributes['data-effect'].value
let effect = JSON.parse(dataEffect)
let otf = ''

switch (effect.type) {
case 'headvitalshit':
case 'majorwound':
case 'crippling':
const htCheck =
effect.modifier === 0 ? 'HT' : effect.modifier < 0 ? `HT+${-effect.modifier}` : `HT-${effect.modifier}`
(effect?.modifier ?? 0) === 0
? 'HT'
: effect.modifier < 0
? `HT+${-effect.modifier}`
: `HT-${effect.modifier}`

otf = `/r [!${htCheck}]`
break

case 'knockback':
const dx = i18n('GURPS.attributesDX')
const dxCheck = effect?.modifier && effect.modifier === 0 ? dx : `${dx} -${effect.modifier}`
Expand All @@ -514,15 +521,13 @@ export default class ApplyDamageDialog extends Application {
effect?.modifier && effect.modifier === 0
? localeAcrobaticsName
: `${localeAcrobaticsName} -${effect.modifier}`
const acrobaticsCheck =
effect?.modifier && effect.modifier === 0 ? 'Acrobatics' : `Acrobatics -${effect.modifier}`
const localeJudoName = i18n('GURPS.skillJudo')
const localeJudoCheck =
effect?.modifier && effect.modifier === 0 ? localeJudoName : `${localeJudoName} -${effect.modifier}`
const judoCheck = effect?.modifier && effect.modifier === 0 ? 'Judo' : `Judo -${effect.modifier}`
otf = `/r [!${dxCheck}|!SK:${acrobaticsCheck}|!Sk:${localeAcrobaticsCheck}|!SK:${judoCheck}|!Sk:${localeJudoCheck}]`
otf = `/r [!${dxCheck} | Sk:${localeAcrobaticsCheck} | Sk:${localeJudoCheck}]`
break
}

if (!!otf) await this.actor.runOTF(otf)
}

Expand Down Expand Up @@ -596,6 +601,8 @@ export default class ApplyDamageDialog extends Application {
await toggleEffect(effect.effectName, span)
break
}

this.render(false)
}

/**
Expand Down Expand Up @@ -665,8 +672,8 @@ export default class ApplyDamageDialog extends Application {
let judo = i18n('GURPS.skillJudo')
let judoCheck = object.modifier === 0 ? judo : `${judo}-${object.modifier}`

let button = `/r [/if {![${dxCheck}|Sk:Acrobatics|Sk:${acroCheck}|Sk:Judo|Sk:${judoCheck}]} {/st + prone}]`
if (!!token) button = `/r [/sel ${token.id} \\\\ ${button}]`
let button = `/if ![${dxCheck} | Sk:${acroCheck} | Sk:${judoCheck}] {/st + prone}`
if (!!token) button = `/sel ${token.id} \\\\ ${button}`

let templateData = {
name: !!token ? token.name : this.actor.name,
Expand Down Expand Up @@ -698,7 +705,7 @@ export default class ApplyDamageDialog extends Application {

let msgData = {
content: message,
user: game.user.id,
author: game.user.id,
type: CONST.CHAT_MESSAGE_STYLES.OOC,
}
if (game.settings.get(settings.SYSTEM_NAME, settings.SETTING_WHISPER_STATUS_EFFECTS)) {
Expand Down
1 change: 1 addition & 0 deletions module/damage/damagecalculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,7 @@ class DamageCalculator {
if (this.isCripplingInjury) {
_effects.push({
type: 'crippling',
modifier: 0,
amount: Math.floor(this._parent.locationMaxHP),
detail: this._parent.hitLocation,
reduceInjury: this.isInjuryReducedByLocation,
Expand Down
Loading

0 comments on commit d588830

Please sign in to comment.