Skip to content

Improve AI handling of reveal-count effects - #11712

Merged
tool4ever merged 3 commits into
Card-Forge:masterfrom
vanja-ivancevic:codex/ai-reveal-count
Aug 29, 2026
Merged

Improve AI handling of reveal-count effects#11712
tool4ever merged 3 commits into
Card-Forge:masterfrom
vanja-ivancevic:codex/ai-reveal-count

Conversation

@vanja-ivancevic

@vanja-ivancevic vanja-ivancevic commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
  • Evaluate any-number self-reveal effects from a detached LKI host containing the cards the AI can reveal, without modifying the live card or remembered state.
  • Reuse Forge's normal AbilityUtils and SVar evaluation for the full subability chain, including Amount, Twice, and Chroma expressions.
  • Add a narrow per-API evaluation-host hook at the controller's existing alternate-host boundary, with host and cast-state restoration in try/finally.
  • Decline the effect when no eligible cards can be revealed, allow the affected cards in curated AI decks while retaining their random-deck exclusion, and identify Scent of Nightshade as a curse for targeting.
  • This prepares the reveal-count cards needed by a Fallen Empires Adventure dungeon while improving the same mechanics generally.
  • Verified with focused game-state scenarios for Scent of Cinder, Phosphorescent Feast's Chroma expression, an empty reveal set, and Cinder Seer's activated ability; the live host was unchanged after every evaluation.

Comment thread forge-ai/src/main/java/forge/ai/ability/RevealAi.java Outdated
@vanja-ivancevic
vanja-ivancevic marked this pull request as ready for review August 27, 2026 20:17
@vanja-ivancevic

Copy link
Copy Markdown
Contributor Author

Post-revision self-review: I traced this hook through canPlayAndPayFor and checked every current any-number self-reveal script it can match. It creates one detached LKI host per evaluation, does not interpret SVars or mutate live card/game state, and leaves the normal API path to evaluate ordinary counts, operators, and Chroma. Existing matches such as Rosheen, Roaring Prophet and Sacellum Godspeaker use the same reveal-to-remembered semantics. The twelve scripts changed here remain AI:RemoveDeck:Random, so they are available to curated AI decks such as Adventure NPC decks but remain excluded from random deck generation. The four focused scenarios and a clean forge-ai reactor build pass.

@tool4ever
tool4ever requested a review from Hanmac August 28, 2026 10:46
@tool4ever
tool4ever merged commit ac8c59a into Card-Forge:master Aug 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants