Skip to content

Commit

Permalink
Merge pull request #121 from Silvertower/main
Browse files Browse the repository at this point in the history
Fix strike trait behavior for characters vs others; add license
  • Loading branch information
Silvertower authored Jan 21, 2024
2 parents c80be2e + 85a014e commit 41cb18e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"license": "CC-BY-4.0",
"scripts": {
"build": "rollup -c",
"dev": "rollup -wcm"
Expand All @@ -13,4 +14,4 @@
"rollup": "^2.56.3",
"rollup-plugin-terser": "^7.0.2"
}
}
}
19 changes: 14 additions & 5 deletions scripts/action-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1455,11 +1455,20 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
const strikeId = `${strike.item.id}-${strike.slug}`
const strikeGroupId = `strikes+${strikeId}`
let strikeGroupName = strike.label
if (this.showStrikeNames && this.showStrikeTraits && strike.weaponTraits.length) {
strikeGroupName += ' - '
strike.weaponTraits.forEach((t) => {
strikeGroupName += '[' + t.label + ']'
})
if (this.showStrikeTraits && this.showStrikeNames) {
let strikeTraits = null
if (this.actor.type === 'character') {
strikeTraits = strike.weaponTraits
}
else {
strikeTraits = strike.traits
}
if (strikeTraits.length > 0) {
strikeGroupName += ' - '
for (let trait of strikeTraits) {
strikeGroupName += '[' + trait.label + ']'
}
}
}
const strikeGroupListName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ${strike.label} (${strike.item.id})`
const image = strike.imageUrl ?? strike.item?.img
Expand Down

0 comments on commit 41cb18e

Please sign in to comment.