mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Improved AI for Momir Avatar.
This commit is contained in:
@@ -6,6 +6,7 @@ import forge.card.spellability.SpellAbility;
|
|||||||
import forge.card.spellability.Target;
|
import forge.card.spellability.Target;
|
||||||
import forge.game.ai.ComputerUtil;
|
import forge.game.ai.ComputerUtil;
|
||||||
import forge.game.ai.ComputerUtilMana;
|
import forge.game.ai.ComputerUtilMana;
|
||||||
|
import forge.game.phase.PhaseType;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
|
|
||||||
public class ChooseCardNameAi extends SpellAbilityAi {
|
public class ChooseCardNameAi extends SpellAbilityAi {
|
||||||
@@ -21,25 +22,21 @@ public class ChooseCardNameAi extends SpellAbilityAi {
|
|||||||
|
|
||||||
String logic = sa.getParam("AILogic");
|
String logic = sa.getParam("AILogic");
|
||||||
if (logic.equals("MomirAvatar")) {
|
if (logic.equals("MomirAvatar")) {
|
||||||
|
if (source.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN1)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Set PayX here to maximum value.
|
// Set PayX here to maximum value.
|
||||||
int tokenSize = ComputerUtilMana.determineLeftoverMana(sa, ai);
|
int tokenSize = ComputerUtilMana.determineLeftoverMana(sa, ai);
|
||||||
|
|
||||||
// Some basic strategy for Momir
|
// Some basic strategy for Momir
|
||||||
if (tokenSize >= 11) {
|
if (tokenSize < 2) {
|
||||||
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 {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tokenSize > 11) {
|
||||||
|
tokenSize = 11;
|
||||||
|
}
|
||||||
|
|
||||||
source.setSVar("PayX", Integer.toString(tokenSize));
|
source.setSVar("PayX", Integer.toString(tokenSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ public class AiController {
|
|||||||
List<Card> cardsInPlay = player.getCardsIn(ZoneType.Battlefield);
|
List<Card> cardsInPlay = player.getCardsIn(ZoneType.Battlefield);
|
||||||
List<Card> landsInPlay = CardLists.filter(cardsInPlay, Presets.LANDS);
|
List<Card> landsInPlay = CardLists.filter(cardsInPlay, Presets.LANDS);
|
||||||
List<Card> allCards = new ArrayList<Card>(player.getCardsIn(ZoneType.Graveyard));
|
List<Card> allCards = new ArrayList<Card>(player.getCardsIn(ZoneType.Graveyard));
|
||||||
|
allCards.addAll(player.getCardsIn(ZoneType.Command));
|
||||||
allCards.addAll(cardsInPlay);
|
allCards.addAll(cardsInPlay);
|
||||||
int maxCmcInHand = Aggregates.max(hand, CardPredicates.Accessors.fnGetCmc);
|
int maxCmcInHand = Aggregates.max(hand, CardPredicates.Accessors.fnGetCmc);
|
||||||
int max = Math.max(maxCmcInHand, 6);
|
int max = Math.max(maxCmcInHand, 6);
|
||||||
|
|||||||
Reference in New Issue
Block a user