Skip to content

Commit

Permalink
Merge pull request #1035 from ben/no-dsn-fix
Browse files Browse the repository at this point in the history
Roll cinder/wraith/cursed dice with no DSN
  • Loading branch information
ben authored Oct 31, 2024
2 parents 2037d33 + 4585efa commit 264983f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Next Release

- Fix a bug where cinder/wraith and cursed-die rolls wouldn't work unless Dice So Nice was enabled ([#1035](https://github.com/ben/foundry-ironsworn/pull/1035))

## 1.24.4

- Fix an issue where new Ironsworn characters would have a blank sheet the first time they were opened ([#1030](https://github.com/ben/foundry-ironsworn/pull/1030))
Expand Down
6 changes: 3 additions & 3 deletions src/module/features/dice/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ export function cinderAndWraithifyRoll(roll: Roll) {

const cd0options = challengeDice[0].options as any
cd0options.appearance = {
labelColor: (game.dice3d as any).exports?.Utils?.contrastOf(cinderColor),
labelColor: (game.dice3d as any)?.exports?.Utils?.contrastOf(cinderColor),
background: cinderColor,
outline: cinderColor,
edge: cinderColor
}
const cd1options = challengeDice[1].options as any
cd1options.appearance = {
labelColor: (game.dice3d as any).exports?.Utils?.contrastOf(wraithColor),
labelColor: (game.dice3d as any)?.exports?.Utils?.contrastOf(wraithColor),
background: wraithColor,
outline: wraithColor,
edge: wraithColor
Expand All @@ -60,7 +60,7 @@ export function cursifyRoll(roll: Roll) {
const die = roll.dice[0]
const cursedColor = '#228822'
;(die.options as any).appearance = {
labelColor: (game.dice3d as any).exports?.Utils?.contrastOf(cursedColor),
labelColor: (game.dice3d as any)?.exports?.Utils?.contrastOf(cursedColor),
background: cursedColor,
outline: cursedColor,
edge: cursedColor
Expand Down
5 changes: 3 additions & 2 deletions src/module/roll-table/oracle-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,10 @@ export class OracleTable extends RollTable {
// Draw from the cursed table
const cursedResult = cursedTable.results.find(
(x) =>
originalRoll.total >= x.range[0] && originalRoll.total <= x.range[1]
(originalRoll.total ?? -1) >= x.range[0] &&
(originalRoll.total ?? -1) <= x.range[1]
)
return { cursedResults: [cursedResult], cursedDie }
return { cursedResults: compact([cursedResult]), cursedDie }
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/module/vue/sf-truths.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
ref="categoryComponents"
:key="(truth.je()._id as string)"
:je="truth.je"
v-model="categoryModels[truth.je()._id]"
v-model="categoryModels[truth.je()._id ?? '']"
/>
</section>
</div>
Expand Down Expand Up @@ -75,7 +75,7 @@ async function saveTruths() {
// Fetch values from the category components
const contentSections: string[] = []
for (const t of props.data.truths) {
const model = categoryModels.value[t.je()._id]
const model = categoryModels.value[t.je()._id ?? '']
if (model.valid)
contentSections.push(
`<h2>${model.title}</h2>
Expand Down

0 comments on commit 264983f

Please sign in to comment.