Merge pull request #1973 from tool4ever/phasingfix

Phasing: store under which control it phased out
This commit is contained in:
Anthony Calosa
2022-11-28 15:17:48 +08:00
committed by GitHub
23 changed files with 113 additions and 112 deletions

View File

@@ -446,7 +446,7 @@ public class AiController {
CardCollection nonLandsInHand = CardLists.filter(player.getCardsIn(ZoneType.Hand), Predicates.not(CardPredicates.Presets.LANDS));
// Some considerations for Momir/MoJhoSto
boolean hasMomir = player.getZone(ZoneType.Command).contains(CardPredicates.nameEquals("Momir Vig, Simic Visionary Avatar"));
boolean hasMomir = player.isCardInCommand("Momir Vig, Simic Visionary Avatar");
if (hasMomir && nonLandsInHand.isEmpty()) {
// Only do this if we have an all-basic land hand, which covers both stock Momir and MoJhoSto modes
// and also a custom Vanguard setup with a customized basic land deck and Momir as the avatar.
@@ -1534,7 +1534,7 @@ public class AiController {
}
private boolean isSafeToHoldLandDropForMain2(Card landToPlay) {
boolean hasMomir = player.getZone(ZoneType.Command).contains(CardPredicates.nameEquals("Momir Vig, Simic Visionary Avatar"));
boolean hasMomir = player.isCardInCommand("Momir Vig, Simic Visionary Avatar");
if (hasMomir) {
// Don't do this in Momir variants since it messes with the AI decision making for the avatar.
return false;

View File

@@ -2054,7 +2054,7 @@ public class ComputerUtil {
return finalHandSize;
}
CardCollectionView library = ai.getZone(ZoneType.Library).getCards();
CardCollectionView library = ai.getCardsIn(ZoneType.Library);
int landsInDeck = CardLists.count(library, CardPredicates.isType("Land"));
// no land deck, can't do anything better

View File

@@ -200,13 +200,13 @@ public abstract class GameState {
// Mark the cards that need their ID remembered for various reasons
cardsReferencedByID.clear();
for (ZoneType zone : ZONES.keySet()) {
for (Card card : game.getCardsIn(zone)) {
for (Card card : game.getCardsIncludePhasingIn(zone)) {
if (card.getExiledWith() != null) {
// Remember the ID of the card that exiled this card
cardsReferencedByID.add(card.getExiledWith());
}
if (zone == ZoneType.Battlefield) {
if (card.hasCardAttachments()) {
if (!card.getAllAttachedCards().isEmpty()) {
// Remember the ID of cards that have attachments
cardsReferencedByID.add(card);
}
@@ -240,7 +240,7 @@ public abstract class GameState {
// if the zone had no cards in it (e.g. empty hand).
aiCardTexts.put(zone, "");
humanCardTexts.put(zone, "");
for (Card card : game.getCardsIn(zone)) {
for (Card card : game.getCardsIncludePhasingIn(zone)) {
if (card.getName().equals("Puzzle Goal") && card.getOracleText().contains("New Puzzle")) {
puzzleCreatorState = true;
}
@@ -264,7 +264,7 @@ public abstract class GameState {
return;
}
if (!c.getMergedCards().isEmpty()) {
if (c.hasMergedCard()) {
// we have to go by the current top card name here
newText.append(c.getTopMergedCard().getPaperCard().getName());
} else {
@@ -297,7 +297,8 @@ public abstract class GameState {
newText.append("|Monstrous");
}
if (c.isPhasedOut()) {
newText.append("|PhasedOut");
newText.append("|PhasedOut:");
newText.append(c.getPhasedOut().isAI() ? "AI" : "HUMAN");
}
if (c.isFaceDown()) {
newText.append("|FaceDown");
@@ -1328,7 +1329,10 @@ public abstract class GameState {
} else if (info.startsWith("Monstrous")) {
c.setMonstrous(true);
} else if (info.startsWith("PhasedOut")) {
c.setPhasedOut(true);
String tgt = info.substring(info.indexOf(':') + 1);
Player human = player.getGame().getPlayers().get(0);
Player ai = player.getGame().getPlayers().get(1);
c.setPhasedOut(tgt.equalsIgnoreCase("AI") ? ai : human);
} else if (info.startsWith("Counters:")) {
applyCountersToGameEntity(c, info.substring(info.indexOf(':') + 1));
} else if (info.startsWith("SummonSick")) {

View File

@@ -797,7 +797,7 @@ public class PlayerControllerAi extends PlayerController {
case "Never":
return false;
case "NothingRemembered":
if (source.getRememberedCount() == 0) {
if (!source.hasRemembered()) {
return true;
} else {
Card rem = (Card) source.getFirstRemembered();
@@ -807,7 +807,7 @@ public class PlayerControllerAi extends PlayerController {
}
break;
case "BetterTgtThanRemembered":
if (source.getRememberedCount() > 0) {
if (source.hasRemembered()) {
Card rem = (Card) source.getFirstRemembered();
// avoid pumping opponent creature
if (!rem.isInPlay() || rem.getController().isOpponentOf(source.getController())) {