mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
CostTapType: for Crew add Keyword "CARDNAME can't crew a vehicle",
now the cost does check that the creatures does not have this.
This commit is contained in:
@@ -433,7 +433,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
|||||||
totalPower = true;
|
totalPower = true;
|
||||||
totalP = type.split("withTotalPowerGE")[1];
|
totalP = type.split("withTotalPowerGE")[1];
|
||||||
type = type.replace("+withTotalPowerGE" + totalP, "");
|
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 {
|
} else {
|
||||||
totap = ComputerUtil.chooseTapType(player, type, source, !cost.canTapSource, c, tapped);
|
totap = ComputerUtil.chooseTapType(player, type, source, !cost.canTapSource, c, tapped);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -497,14 +497,19 @@ public class ComputerUtil {
|
|||||||
return tapList;
|
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
|
// Used for Crewing vehicles, ideally we sort by useless creatures. Can't Attack/Defender
|
||||||
int totalPower = 0;
|
int totalPower = 0;
|
||||||
|
final Card activate = sa.getHostCard();
|
||||||
|
|
||||||
CardCollection all = new CardCollection(ai.getCardsIn(ZoneType.Battlefield));
|
CardCollection all = new CardCollection(ai.getCardsIn(ZoneType.Battlefield));
|
||||||
all.removeAll(exclude);
|
all.removeAll(exclude);
|
||||||
CardCollection typeList =
|
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?
|
// is this needed?
|
||||||
typeList = CardLists.filter(typeList, Presets.UNTAPPED);
|
typeList = CardLists.filter(typeList, Presets.UNTAPPED);
|
||||||
|
|||||||
@@ -127,7 +127,11 @@ public class CostTapType extends CostPartWithList {
|
|||||||
typeList.remove(source);
|
typeList.remove(source);
|
||||||
}
|
}
|
||||||
typeList = CardLists.filter(typeList, Presets.UNTAPPED);
|
typeList = CardLists.filter(typeList, Presets.UNTAPPED);
|
||||||
|
|
||||||
|
if (ability.hasParam("Crew")) {
|
||||||
|
typeList = CardLists.getNotKeyword(typeList, "CARDNAME can't crew a vehicle");
|
||||||
|
}
|
||||||
|
|
||||||
if (sameType) {
|
if (sameType) {
|
||||||
for (final Card card : typeList) {
|
for (final Card card : typeList) {
|
||||||
if (CardLists.filter(typeList, new Predicate<Card>() {
|
if (CardLists.filter(typeList, new Predicate<Card>() {
|
||||||
|
|||||||
@@ -1093,6 +1093,11 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
|||||||
CardCollection typeList = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), type.split(";"), player,
|
CardCollection typeList = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), type.split(";"), player,
|
||||||
source, ability);
|
source, ability);
|
||||||
typeList = CardLists.filter(typeList, Presets.UNTAPPED);
|
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")) {
|
if (c == null && !amount.equals("Any")) {
|
||||||
final String sVar = ability.getSVar(amount);
|
final String sVar = ability.getSVar(amount);
|
||||||
// Generalize this
|
// Generalize this
|
||||||
|
|||||||
Reference in New Issue
Block a user