Merge branch 'master' into 'master'

Filter valid options for the AI when choosing a card name before running the logic.

See merge request core-developers/forge!6173
This commit is contained in:
Michael Kamensky
2022-02-06 14:46:31 +00:00

View File

@@ -1204,6 +1204,12 @@ public class PlayerControllerAi extends PlayerController {
final Card source = sa.getHostCard(); final Card source = sa.getHostCard();
final String logic = sa.getParam("AILogic"); final String logic = sa.getParam("AILogic");
// Filter for valid options only
if (!valid.isEmpty()) {
aiLibrary = CardLists.getValidCards(aiLibrary, valid, source.getController(), source, sa);
oppLibrary = CardLists.getValidCards(oppLibrary, valid, source.getController(), source, sa);
}
if (source != null && source.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) { if (source != null && source.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) {
// If any Conspiracies are present, try not to choose the same name twice // If any Conspiracies are present, try not to choose the same name twice
// (otherwise the AI will spam the same name) // (otherwise the AI will spam the same name)