Skip to content

Commit

Permalink
Merge pull request #1789 from StarWarsFoundryVTT/expanded_stats_1781
Browse files Browse the repository at this point in the history
feat(stats): over threshold
  • Loading branch information
wrycu authored Feb 6, 2025
2 parents 2fda474 + caec94a commit fc9262e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* You can now adjust token wounds above the threshold ([#1769](/~https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1769))
* Token bars now display wounds above threshold and most colors are configurable ([#1769](/~https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1769))
* You can now kill a minion or minion group directly from their sheet with a single click! ([#1744](/~https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1744))
* Add derived stats of strainOverThreshold, woundsOverThreshold, hullOverThreshold, and systemStrainOverThreshold to actors (for things like Bar Brawl) ([#1781](/~https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1781))
* Fixes:
* Remove usage of deprecated `math.clamped` in favor of `math.clamp`
* Fix skill roll sometimes showing a pool of only 2 difficulty when clicked ([#1763](/~https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1763))
Expand Down
12 changes: 12 additions & 0 deletions modules/actors/actor-ffg.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ export class ActorFFG extends Actor {
return { type: item, label: game.i18n.localize(`SWFFG.Skills${item}`) === `SWFFG.Skills${item}` ? item : game.i18n.localize(`SWFFG.Skills${item}`) };
});
}

// add values for above threshold
if (["character", "nemesis"].includes(actor.type)) {
data.stats.woundsOverThreshold = data.stats.wounds.value - data.stats.wounds.max;
data.stats.strainOverThreshold = data.stats.strain.value - data.stats.strain.max;
} else if (["rival", "minion"].includes(actor.type)) {
data.stats.woundsOverThreshold = data.stats.wounds.value - data.stats.wounds.max;
} else if (["vehicle"].includes(actor.type)) {
data.stats.hullOverThreshold = data.stats.hullTrauma.value - data.stats.hullTrauma.max;
data.stats.systemStrainOverThreshold = data.stats.systemStrain.value - data.stats.systemStrain.max;
}

this._prepareSharedData.bind(this);
this._prepareSharedData(actor);
if (actor.type === "minion") this._prepareMinionData(actor);
Expand Down

0 comments on commit fc9262e

Please sign in to comment.