diff --git a/forge-ai/src/main/java/forge/ai/AiCostDecision.java b/forge-ai/src/main/java/forge/ai/AiCostDecision.java index a7e5c6da83e..d6620b8bf10 100644 --- a/forge-ai/src/main/java/forge/ai/AiCostDecision.java +++ b/forge-ai/src/main/java/forge/ai/AiCostDecision.java @@ -433,7 +433,7 @@ public class AiCostDecision extends CostDecisionMakerBase { totalPower = true; totalP = type.split("withTotalPowerGE")[1]; type = type.replace("+withTotalPowerGE" + totalP, ""); - totap = ComputerUtil.chooseTapTypeAccumulatePower(player, type, source, !cost.canTapSource, Integer.parseInt(totalP), tapped); + totap = ComputerUtil.chooseTapTypeAccumulatePower(player, type, ability, !cost.canTapSource, Integer.parseInt(totalP), tapped); } else { totap = ComputerUtil.chooseTapType(player, type, source, !cost.canTapSource, c, tapped); } diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtil.java b/forge-ai/src/main/java/forge/ai/ComputerUtil.java index ce474c68d63..156cfbc6f31 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtil.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtil.java @@ -497,14 +497,19 @@ public class ComputerUtil { return tapList; } - public static CardCollection chooseTapTypeAccumulatePower(final Player ai, final String type, final Card activate, final boolean tap, final int amount, final CardCollectionView exclude) { + public static CardCollection chooseTapTypeAccumulatePower(final Player ai, final String type, final SpellAbility sa, final boolean tap, final int amount, final CardCollectionView exclude) { // Used for Crewing vehicles, ideally we sort by useless creatures. Can't Attack/Defender int totalPower = 0; + final Card activate = sa.getHostCard(); CardCollection all = new CardCollection(ai.getCardsIn(ZoneType.Battlefield)); all.removeAll(exclude); CardCollection typeList = - CardLists.getValidCards(all, type.split(";"), activate.getController(), activate, null); + CardLists.getValidCards(all, type.split(";"), activate.getController(), activate, sa); + + if (sa.hasParam("Crew")) { + typeList = CardLists.getNotKeyword(typeList, "CARDNAME can't crew a vehicle"); + } // is this needed? typeList = CardLists.filter(typeList, Presets.UNTAPPED); diff --git a/forge-game/src/main/java/forge/game/cost/CostTapType.java b/forge-game/src/main/java/forge/game/cost/CostTapType.java index 4621b38bf1b..2a1ee2f3d90 100644 --- a/forge-game/src/main/java/forge/game/cost/CostTapType.java +++ b/forge-game/src/main/java/forge/game/cost/CostTapType.java @@ -127,7 +127,11 @@ public class CostTapType extends CostPartWithList { typeList.remove(source); } typeList = CardLists.filter(typeList, Presets.UNTAPPED); - + + if (ability.hasParam("Crew")) { + typeList = CardLists.getNotKeyword(typeList, "CARDNAME can't crew a vehicle"); + } + if (sameType) { for (final Card card : typeList) { if (CardLists.filter(typeList, new Predicate() { diff --git a/forge-gui/src/main/java/forge/player/HumanCostDecision.java b/forge-gui/src/main/java/forge/player/HumanCostDecision.java index 4a80a091903..6336976a8fa 100644 --- a/forge-gui/src/main/java/forge/player/HumanCostDecision.java +++ b/forge-gui/src/main/java/forge/player/HumanCostDecision.java @@ -1093,6 +1093,11 @@ public class HumanCostDecision extends CostDecisionMakerBase { CardCollection typeList = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), type.split(";"), player, source, ability); typeList = CardLists.filter(typeList, Presets.UNTAPPED); + + if (ability.hasParam("Crew")) { + typeList = CardLists.getNotKeyword(typeList, "CARDNAME can't crew a vehicle"); + } + if (c == null && !amount.equals("Any")) { final String sVar = ability.getSVar(amount); // Generalize this