Apply patch

This commit is contained in:
tool4EvEr
2023-11-05 11:51:45 +01:00
parent 5c68ded1fe
commit 6410d24e04
7 changed files with 24 additions and 22 deletions

View File

@@ -2091,9 +2091,7 @@ public class AiController {
return simPicker.chooseCardToHiddenOriginChangeZone(destination, origin, sa, fetchList, player2, decider); return simPicker.chooseCardToHiddenOriginChangeZone(destination, origin, sa, fetchList, player2, decider);
} }
if (sa.getApi() == ApiType.Explore) { if (sa.getApi() == ApiType.Learn) {
return ExploreAi.shouldPutInGraveyard(fetchList, decider);
} else if (sa.getApi() == ApiType.Learn) {
return LearnAi.chooseCardToLearn(fetchList, decider, sa); return LearnAi.chooseCardToLearn(fetchList, decider, sa);
} else { } else {
return ChangeZoneAi.chooseCardToHiddenOriginChangeZone(destination, origin, sa, fetchList, player2, decider); return ChangeZoneAi.chooseCardToHiddenOriginChangeZone(destination, origin, sa, fetchList, player2, decider);

View File

@@ -242,7 +242,7 @@ public class PlayerControllerAi extends PlayerController {
} }
@Override @Override
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params, Card cardToShow) { public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Card cardToShow, Map<String, Object> params) {
return getAi().confirmAction(sa, mode, message, params); return getAi().confirmAction(sa, mode, message, params);
} }

View File

@@ -13,9 +13,12 @@ import forge.game.card.CardCollectionView;
import forge.game.card.CardLists; import forge.game.card.CardLists;
import forge.game.card.CardPredicates; import forge.game.card.CardPredicates;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import java.util.Map;
public class ExploreAi extends SpellAbilityAi { public class ExploreAi extends SpellAbilityAi {
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility) * @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
@@ -36,7 +39,7 @@ public class ExploreAi extends SpellAbilityAi {
return true; return true;
} }
public static Card shouldPutInGraveyard(CardCollection top, Player ai) { public static boolean shouldPutInGraveyard(Card topCard, Player ai) {
int predictedMana = ComputerUtilMana.getAvailableManaSources(ai, false).size(); int predictedMana = ComputerUtilMana.getAvailableManaSources(ai, false).size();
CardCollectionView cardsOTB = ai.getCardsIn(ZoneType.Battlefield); CardCollectionView cardsOTB = ai.getCardsIn(ZoneType.Battlefield);
CardCollectionView cardsInHand = ai.getCardsIn(ZoneType.Hand); CardCollectionView cardsInHand = ai.getCardsIn(ZoneType.Hand);
@@ -52,20 +55,20 @@ public class ExploreAi extends SpellAbilityAi {
numLandsToStillNeedMore = aic.getIntProperty(AiProps.EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE); numLandsToStillNeedMore = aic.getIntProperty(AiProps.EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE);
} }
if (!top.isEmpty()) {
Card topCard = top.getFirst();
if (landsInHand.isEmpty() && landsOTB.size() <= numLandsToStillNeedMore) { if (landsInHand.isEmpty() && landsOTB.size() <= numLandsToStillNeedMore) {
// We need more lands to improve our mana base, explore away the non-lands // We need more lands to improve our mana base, explore away the non-lands
return topCard; return true;
} } else if (topCard.getCMC() - maxCMCDiff >= predictedMana && !topCard.hasSVar("DoNotDiscardIfAble")) {
if (topCard.getCMC() - maxCMCDiff >= predictedMana && !topCard.hasSVar("DoNotDiscardIfAble")) {
// We're not casting this in foreseeable future, put it in the graveyard // We're not casting this in foreseeable future, put it in the graveyard
return topCard; return true;
}
} }
// Put on top of the library (do not mark the card for placement in the graveyard) // Put on top of the library (do not mark the card for placement in the graveyard)
return null; return false;
} }
@Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return shouldPutInGraveyard((Card)params.get("RevealedCard"), player);
}
} }

View File

@@ -435,9 +435,7 @@ public class SpellAbilityPicker {
return card; return card;
} }
} }
if (sa.getApi() == ApiType.Explore) { if (sa.getApi() == ApiType.Learn) {
return ExploreAi.shouldPutInGraveyard(fetchList, decider);
} else if (sa.getApi() == ApiType.Learn) {
return LearnAi.chooseCardToLearn(fetchList, decider, sa); return LearnAi.chooseCardToLearn(fetchList, decider, sa);
} else { } else {
return ChangeZoneAi.chooseCardToHiddenOriginChangeZone(destination, origin, sa, fetchList, player2, decider); return ChangeZoneAi.chooseCardToHiddenOriginChangeZone(destination, origin, sa, fetchList, player2, decider);

View File

@@ -1,5 +1,6 @@
package forge.game.ability.effects; package forge.game.ability.effects;
import com.google.common.collect.Maps;
import forge.game.Game; import forge.game.Game;
import forge.game.GameEntityCounterTable; import forge.game.GameEntityCounterTable;
import forge.game.ability.AbilityKey; import forge.game.ability.AbilityKey;
@@ -77,9 +78,11 @@ public class ExploreEffect extends SpellAbilityEffect {
movedCard = game.getAction().moveTo(ZoneType.Hand, r, sa, moveParams); movedCard = game.getAction().moveTo(ZoneType.Hand, r, sa, moveParams);
revealedLand = true; revealedLand = true;
} else { } else {
Map<String, Object> params = Maps.newHashMap();
params.put("RevealedCard", r);
if (pl.getController().confirmAction(sa, null, if (pl.getController().confirmAction(sa, null,
Localizer.getInstance().getMessage("lblPutThisCardToYourGraveyard", Localizer.getInstance().getMessage("lblPutThisCardToYourGraveyard",
CardTranslation.getTranslatedName(r.getName())), null, r)) CardTranslation.getTranslatedName(r.getName())), r, params))
movedCard = game.getAction().moveTo(ZoneType.Graveyard, r, sa, moveParams); movedCard = game.getAction().moveTo(ZoneType.Graveyard, r, sa, moveParams);
} }

View File

@@ -187,7 +187,7 @@ public class PlayerControllerForTests extends PlayerController {
} }
@Override @Override
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> newParam, Card cardToShow) { public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Card cardToShow, Map<String, Object> params) {
return true; return true;
} }

View File

@@ -772,7 +772,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
*/ */
@Override @Override
public boolean confirmAction(final SpellAbility sa, final PlayerActionConfirmMode mode, final String message, public boolean confirmAction(final SpellAbility sa, final PlayerActionConfirmMode mode, final String message,
Map<String, Object> params, Card cardToShow) { Card cardToShow, Map<String, Object> params) {
// Another card should be displayed in the prompt on mouse over rather than the SA source // Another card should be displayed in the prompt on mouse over rather than the SA source
if (cardToShow != null) { if (cardToShow != null) {
tempShowCard(cardToShow); tempShowCard(cardToShow);