Skip to content

Comments

Fix missing DC value in some check context flags#21581

Merged
CarlosFdez merged 2 commits intofoundryvtt:v13-devfrom
In3luki:fix-escape-dc
Feb 22, 2026
Merged

Fix missing DC value in some check context flags#21581
CarlosFdez merged 2 commits intofoundryvtt:v13-devfrom
In3luki:fix-escape-dc

Conversation

@In3luki
Copy link
Collaborator

@In3luki In3luki commented Feb 21, 2026

When context.dc is a StatisticDifficultyClass, the DC value is a getter and is therefore non-enumerable, causing it to be dropped by the omit helper.

Closes #21205

@CarlosFdez
Copy link
Collaborator

How long is the list of properties we're seeking to pull? Perhaps a pick would be cleaner?

@In3luki
Copy link
Collaborator Author

In3luki commented Feb 21, 2026

Looks like picking would work and is indeed cleaner.

{
      dc: context.dc ? R.pick(context.dc, ["label", "scope", "slug", "value", "visible"]) : null,
}

I've looked at a check roll and an attack roll before & after and the flags look the same. The only downside is, that the list of picked properties may need to be updated if the CheckDC properties change.

@CarlosFdez
Copy link
Collaborator

Hopefully typescript would take care of that. I just prefer to avoid non-multiple of 4 indentation that prettier likes to add in these situations where possible. Its either that or adding a getTraceData() equivalent that uses that and falls back to the dc.

If I remember right value is a getter because we want to be able to defer its computation, so we can't simply convert that to a variable.

@In3luki
Copy link
Collaborator Author

In3luki commented Feb 21, 2026

Yeah, it's probably fine. The dc flag is only used for rerolls in the system and modules can request other hypothetical new properties if they need them.

@CarlosFdez CarlosFdez merged commit b19e114 into foundryvtt:v13-dev Feb 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rerolling an escape check tries to resolve over an undefined DC

2 participants