mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Add basic AI
This commit is contained in:
@@ -240,8 +240,9 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PaymentDecision visit(final CostEnlist cost) {
|
public PaymentDecision visit(final CostEnlist cost) {
|
||||||
// currently unused
|
CardCollection choices = cost.getCardsForEnlisting(player, source, ability);
|
||||||
return null;
|
CardLists.sortByPowerDesc(choices);
|
||||||
|
return PaymentDecision.card(choices.getFirst());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import forge.game.card.CardView;
|
|||||||
import forge.game.card.CounterType;
|
import forge.game.card.CounterType;
|
||||||
import forge.game.combat.Combat;
|
import forge.game.combat.Combat;
|
||||||
import forge.game.cost.Cost;
|
import forge.game.cost.Cost;
|
||||||
|
import forge.game.cost.CostEnlist;
|
||||||
import forge.game.cost.CostPart;
|
import forge.game.cost.CostPart;
|
||||||
import forge.game.cost.CostPartMana;
|
import forge.game.cost.CostPartMana;
|
||||||
import forge.game.keyword.KeywordInterface;
|
import forge.game.keyword.KeywordInterface;
|
||||||
@@ -340,9 +341,12 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Card> enlistAttackers(List<Card> attackers) {
|
public List<Card> enlistAttackers(List<Card> attackers) {
|
||||||
// not able yet
|
CardCollection cards = CostEnlist.getCardsForEnlisting(brains.getPlayer(), null, null);
|
||||||
// TODO get best creature that can't attack and check for lethal with it
|
ComputerUtilCard.sortByEvaluateCreature(new CardCollection(attackers));
|
||||||
return Lists.newArrayList();
|
// do not enlist more than available payment choices
|
||||||
|
attackers = attackers.subList(0, cards.size());
|
||||||
|
// TODO check if not needed as defender
|
||||||
|
return attackers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class CostEnlist extends CostPartWithTrigger {
|
|||||||
return visitor.visit(this);
|
return visitor.visit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardCollection getCardsForEnlisting(Player active, Card source, SpellAbility paySA) {
|
public static CardCollection getCardsForEnlisting(Player active, Card source, SpellAbility paySA) {
|
||||||
return CardLists.getValidCards(active.getCardsIn(ZoneType.Battlefield), "Creature.notattacking+untapped+!sick", active, source, paySA);
|
return CardLists.getValidCards(active.getCardsIn(ZoneType.Battlefield), "Creature.notattacking+untapped+!sick", active, source, paySA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user