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

Fix runelord from prompting for arcane thesis #18518

Merged
merged 2 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 15 additions & 1 deletion src/module/item/base/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,23 @@ class ItemPF2e<TParent extends ActorPF2e | null = ActorPF2e | null> extends Item
for (const item of [...items]) {
// Pre-load this item's self: roll options for predication by preCreate rule elements
item.prepareActorData?.();
const rules = item.prepareRuleElements({ suppressWarnings: true });

// Mark suppressed feats as suppressed during preCreate.
// This must happen *after* rules are fetched, as suppressing kills the rules
// Our only goal is to prevent choice sets, which are not salvageable
const sourceId = item.sourceId;
if (sourceId && item.isOfType("feat")) {
const suppressed =
items.some(
(i) => i.isOfType("feat") && i.system.subfeatures.suppressedFeatures.includes(sourceId),
) || actor.itemTypes.feat.some((f) => f.system.subfeatures.suppressedFeatures.includes(sourceId));
if (suppressed) {
item.suppressed = true;
}
}

const itemSource = item._source;
const rules = item.prepareRuleElements({ suppressWarnings: true });
for (const rule of rules) {
const ruleSource = itemSource.system.rules[rules.indexOf(rule)] as RuleElementSource;
await rule.preCreate?.({
Expand Down
3 changes: 3 additions & 0 deletions src/module/rules/rule-element/choice-set/rule-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ class ChoiceSetRuleElement extends RuleElementPF2e<ChoiceSetSchema> {
return;
}

// If this choice set is on a suppressed item, skip
if (this.item.isOfType("feat") && this.item.suppressed) return;

const rollOptions = new Set([this.actor.getRollOptions(), this.item.getRollOptions("parent")].flat());
const predicate = this.resolveInjectedProperties(this.predicate);
if (!predicate.test(rollOptions)) return;
Expand Down