- RemAIDeck update: next iteration.

This commit is contained in:
Agetian
2017-10-03 11:09:10 +00:00
parent 08a6af547c
commit d4e72f07f9
15 changed files with 26 additions and 26 deletions

View File

@@ -38,6 +38,7 @@ import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.player.PlayerPredicates;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellPermanent;
import forge.game.staticability.StaticAbility;
import forge.game.trigger.Trigger;
import forge.game.zone.ZoneType;
@@ -1265,12 +1266,16 @@ public class SpecialCardAi {
}
}
// Yawgmoth's Will (can potentially be expanded for other broadly similar effects too)
// Yawgmoth's Will and other cards with similar effect, e.g. Magus of the Will
public static class YawgmothsWill {
public static boolean consider(final Player ai, final SpellAbility sa) {
CardCollectionView cardsInGY = ai.getCardsIn(ZoneType.Graveyard);
if (cardsInGY.size() == 0) {
return false;
} else if (ai.getGame().getPhaseHandler().getPlayerTurn() != ai) {
// The AI is not very good at deciding for what to viably do during the opp's turn when this
// comes from an instant speed effect (e.g. Magus of the Will)
return false;
}
int minManaAdj = 2; // we want the AI to have some spare mana for possible other spells to cast
@@ -1287,8 +1292,8 @@ public class SpecialCardAi {
continue;
}
if (ComputerUtilAbility.getAbilitySourceName(ab).equals(ComputerUtilAbility.getAbilitySourceName(sa))
|| ab.hasParam("AINoRecursiveCheck")) {
if ((ComputerUtilAbility.getAbilitySourceName(ab).equals(ComputerUtilAbility.getAbilitySourceName(sa))
&& !(ab instanceof SpellPermanent)) || ab.hasParam("AINoRecursiveCheck")) {
// prevent infinitely recursing abilities that are susceptible to reentry
continue;
}

View File

@@ -1,11 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilMana;
import forge.ai.SpecialCardAi;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
@@ -46,6 +41,8 @@ public class DigAi extends SpellAbilityAi {
if ("Never".equals(sa.getParam("AILogic"))) {
return false;
} else if ("AtOppEndOfTurn".equals(sa.getParam("AILogic"))) {
return game.getPhaseHandler().getNextTurn() == ai && game.getPhaseHandler().is(PhaseType.END_OF_TURN);
}
// don't deck yourself