- Some tidying up in ChooseColorAi

This commit is contained in:
Agetian
2017-01-02 15:25:20 +00:00
parent 9f2158c762
commit c6b8c2cf4e

View File

@@ -34,13 +34,14 @@ public class ChooseColorAi extends SpellAbilityAi {
return false;
}
if ("Nykthos, Shrine to Nyx".equals(sa.getHostCard().getName())) {
if ("Nykthos, Shrine to Nyx".equals(source.getName())) {
PhaseHandler ph = game.getPhaseHandler();
if (!ph.isPlayerTurn(ai) || ph.getPhase().isBefore(PhaseType.MAIN2)) {
return false;
}
String prominentColor = ComputerUtilCard.getMostProminentColor(ai.getCardsIn(ZoneType.Battlefield));
int devotion = CardFactoryUtil.xCount(sa.getHostCard(), "Count$Devotion." + prominentColor);
int devotion = CardFactoryUtil.xCount(source, "Count$Devotion." + prominentColor);
//int numLands = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals(MagicColor.Constant.BASIC_LANDS.get(MagicColor.getIndexOfFirstColor(MagicColor.fromName(prominentColor))))).size(); // TODO: maybe this logic also has to take the number of available lands of most prominent color type into account
// do not use Nykthos if devotion to most prominent color is less than 4 (since {2} is paid to activate Nykthos, and Nykthos itself is tapped too)
@@ -49,7 +50,7 @@ public class ChooseColorAi extends SpellAbilityAi {
}
}
if ("Oona, Queen of the Fae".equals(sa.getHostCard().getName())) {
if ("Oona, Queen of the Fae".equals(source.getName())) {
PhaseHandler ph = game.getPhaseHandler();
if (ph.isPlayerTurn(ai) || ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
return false;
@@ -60,7 +61,7 @@ public class ChooseColorAi extends SpellAbilityAi {
return true;
}
if ("Addle".equals(sa.getHostCard().getName())) {
if ("Addle".equals(source.getName())) {
PhaseHandler ph = game.getPhaseHandler();
if (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS) || ai.getOpponent().getCardsIn(ZoneType.Hand).isEmpty()) {
return false;