Skip to content

Commit

Permalink
feat(STUN for END): skin STUN for END dice rolls
Browse files Browse the repository at this point in the history
  • Loading branch information
phBalance authored and phBalance committed Sep 15, 2024
1 parent 7956aa9 commit 0fdf7d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fix apply knockback dialog for Firefox.
- Applying knockback now rolls knockback skinned dice.
- Using STUN for END now uses skinned dice. [#1212](https://github.com/dmdorman/hero6e-foundryvtt/issues/1212)

## Version 3.0.96

Expand Down
8 changes: 7 additions & 1 deletion module/item/item-attack.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ export async function AttackToHit(item, options) {
// -------------------------------------------------
const setManeuver = actor.items.find((o) => o.type == "maneuver" && o.name === "Set" && o.system.active);

let stunForEndHeroRoller = null;

const heroRoller = new HeroRoller()
.makeSuccessRoll()
.addNumber(11, "Base to hit")
Expand Down Expand Up @@ -567,7 +569,10 @@ export async function AttackToHit(item, options) {
return;
}

const stunForEndHeroRoller = new HeroRoller().makeBasicRoll().addDice(stunDice);
stunForEndHeroRoller = new HeroRoller()
.setPurpose(DICE_SO_NICE_CUSTOM_SETS.STUN_FOR_END)
.makeBasicRoll()
.addDice(stunDice);
await stunForEndHeroRoller.roll();
const stunRenderedResult = await stunForEndHeroRoller.render();
stunDamageForEnd = stunForEndHeroRoller.getBasicTotal();
Expand Down Expand Up @@ -917,6 +922,7 @@ export async function AttackToHit(item, options) {
rolls: targetData
.map((target) => target.roller?.rawRolls())
.flat()
.concat(stunForEndHeroRoller?.rawRolls())
.filter(Boolean),
user: game.user._id,
content: cardHtml,
Expand Down
11 changes: 11 additions & 0 deletions module/utility/dice.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ export const DICE_SO_NICE_CUSTOM_SETS = {
},
visibility: "visible",
},
STUN_FOR_END: {
colorset: "STUN for END",
foreground: "white",
background: "brown",
edge: "brown",
material: "wood",
fontScale: {
d6: 1.1,
},
visibility: "visible",
},
};

// v11/v12 compatibility shim.
Expand Down

0 comments on commit 0fdf7d2

Please sign in to comment.