Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roll cinder/wraith/cursed dice with no DSN #1035

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading