- Improved AI for Momir Avatar.

This commit is contained in:
Sloth
2013-05-23 20:59:23 +00:00
parent 9cebd2952d
commit e83382cb9a
2 changed files with 12 additions and 14 deletions

View File

@@ -6,6 +6,7 @@ import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
import forge.game.ai.ComputerUtil;
import forge.game.ai.ComputerUtilMana;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
public class ChooseCardNameAi extends SpellAbilityAi {
@@ -21,25 +22,21 @@ public class ChooseCardNameAi extends SpellAbilityAi {
String logic = sa.getParam("AILogic");
if (logic.equals("MomirAvatar")) {
if (source.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN1)) {
return false;
}
// Set PayX here to maximum value.
int tokenSize = ComputerUtilMana.determineLeftoverMana(sa, ai);
// Some basic strategy for Momir
if (tokenSize >= 11) {
tokenSize = 11;
} else if (tokenSize >= 9) {
tokenSize = 9;
} else if (tokenSize >= 8) {
tokenSize = 8;
} else if (tokenSize >= 6) {
tokenSize = 6;
} else if (tokenSize >= 4) {
tokenSize = 4;
} else if (tokenSize >= 2) {
tokenSize = 2;
} else {
// Some basic strategy for Momir
if (tokenSize < 2) {
return false;
}
if (tokenSize > 11) {
tokenSize = 11;
}
source.setSVar("PayX", Integer.toString(tokenSize));
}

View File

@@ -257,6 +257,7 @@ public class AiController {
List<Card> cardsInPlay = player.getCardsIn(ZoneType.Battlefield);
List<Card> landsInPlay = CardLists.filter(cardsInPlay, Presets.LANDS);
List<Card> allCards = new ArrayList<Card>(player.getCardsIn(ZoneType.Graveyard));
allCards.addAll(player.getCardsIn(ZoneType.Command));
allCards.addAll(cardsInPlay);
int maxCmcInHand = Aggregates.max(hand, CardPredicates.Accessors.fnGetCmc);
int max = Math.max(maxCmcInHand, 6);