mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Clean up
This commit is contained in:
@@ -1637,6 +1637,8 @@ public class AiController {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO needed to pay propaganda
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user