Improve AI simulation stack resolution for multiplayer choices#10567
Closed
Madwand99 wants to merge 5 commits intoCard-Forge:masterfrom
Closed
Improve AI simulation stack resolution for multiplayer choices#10567Madwand99 wants to merge 5 commits intoCard-Forge:masterfrom
Madwand99 wants to merge 5 commits intoCard-Forge:masterfrom
Conversation
tool4ever
reviewed
May 1, 2026
tool4ever
reviewed
May 1, 2026
tool4ever
reviewed
May 1, 2026
| sa.setActivatingPlayer(opponent); | ||
| game.getStack().addAndUnfreeze(sa); | ||
|
|
||
| PlayerControllerForTests throwingController = new PlayerControllerForTests(game, otherOpponent, otherOpponent.getLobbyPlayer()) { |
Contributor
There was a problem hiding this comment.
sigh, actually this test isn't proof either and it looks to me like the TODO was just outdated:
I spent the effort of actually debugging and thanks to clonePlayer I don't see how a GUI player should end up in a simulated game anyway...
Contributor
Author
There was a problem hiding this comment.
I'll close this PR. If you have any feedback on how I can actually solve the issue of AI drawing cards into Xyris -> Impact tremors -> death, let me know.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR narrows the earlier AI decision work (#10559) to the simulator stack-resolution fix plus focused sacrifice decision coverage.
GameSimulator.resolveStack() now preserves the simulated AI player’s controller while temporarily installing simulation controllers for every other player. Previously, simulated stack resolution only wrapped one opponent, usually the weakest opponent. That worked for many two-player cases, but in multiplayer a resolving spell or trigger can require choices from several players. If a non-wrapped player needed to choose cards, permanents, targets, or confirm an action, simulation could accidentally hit a normal/UI/test controller instead of an AI simulation controller.
The included regression test uses a three-player Innocent Blood scenario because it forces multiple players to make sacrifice choices during stack resolution. With the old behavior, the non-weakest third player’s controller is reached and the test fails. With the new behavior, all non-preserved players use simulation controllers and the simulated stack resolves cleanly.
This also brings over focused sacrifice tests showing deterministic, value-aware sacrifice choices: