This commit is contained in:
tool4EvEr
2023-01-26 10:15:53 +01:00
parent 616309c22f
commit 5ae42b4c71
7 changed files with 11 additions and 12 deletions

View File

@@ -1637,6 +1637,8 @@ public class AiController {
return false;
}
// TODO needed to pay propaganda
return true;
}

View File

@@ -240,9 +240,9 @@ public class AiCostDecision extends CostDecisionMakerBase {
@Override
public PaymentDecision visit(final CostEnlist cost) {
CardCollection choices = cost.getCardsForEnlisting(player, source, ability);
CardCollection choices = CostEnlist.getCardsForEnlisting(player);
CardLists.sortByPowerDesc(choices);
return PaymentDecision.card(choices.getFirst());
return choices.isEmpty() ? null : PaymentDecision.card(choices.getFirst());
}
@Override

View File

@@ -1208,6 +1208,8 @@ public class ComputerUtilCombat {
theTriggers.addAll(blocker.getTriggers());
}
// TODO consider Exert + Enlist
// look out for continuous static abilities that only care for attacking creatures
if (!withoutCombatStaticAbilities) {
final CardCollectionView cardList = CardCollection.combine(game.getCardsIn(ZoneType.Battlefield), game.getCardsIn(ZoneType.Command));

View File

@@ -341,7 +341,7 @@ public class PlayerControllerAi extends PlayerController {
@Override
public List<Card> enlistAttackers(List<Card> attackers) {
CardCollection cards = CostEnlist.getCardsForEnlisting(brains.getPlayer(), null, null);
CardCollection cards = CostEnlist.getCardsForEnlisting(brains.getPlayer());
ComputerUtilCard.sortByEvaluateCreature(new CardCollection(attackers));
// do not enlist more than available payment choices
attackers = attackers.subList(0, cards.size());

View File

@@ -1081,10 +1081,6 @@ public class CardProperty {
if (card.isFirstTurnControlled()) {
return false;
}
} else if (property.startsWith("sick")) {
if (!card.isSick()) {
return false;
}
} else if (property.startsWith("startedTheTurnUntapped")) {
if (!card.hasStartedTheTurnUntapped()) {
return false;

View File

@@ -26,7 +26,6 @@ import forge.game.card.CardLists;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.trigger.TriggerType;
import forge.game.zone.ZoneType;
/**
* The Class CostExert.
@@ -70,7 +69,7 @@ public class CostEnlist extends CostPartWithTrigger {
*/
@Override
public final boolean canPay(final SpellAbility ability, final Player payer, final boolean effect) {
return true;
return !getCardsForEnlisting(payer).isEmpty();
}
@Override
@@ -101,8 +100,8 @@ public class CostEnlist extends CostPartWithTrigger {
return visitor.visit(this);
}
public static CardCollection getCardsForEnlisting(Player active, Card source, SpellAbility paySA) {
return CardLists.getValidCards(active.getCardsIn(ZoneType.Battlefield), "Creature.notattacking+untapped+!sick", active, source, paySA);
public static CardCollection getCardsForEnlisting(Player active) {
return CardLists.filter(active.getCreaturesInPlay(), c -> c.isUntapped() && !c.isSick() && !c.isAttacking());
}
}

View File

@@ -468,7 +468,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
@Override
public PaymentDecision visit(final CostEnlist cost) {
CardCollectionView list = cost.getCardsForEnlisting(player, source, ability);
CardCollectionView list = CostEnlist.getCardsForEnlisting(player);
if (list.isEmpty()) {
return null;
}