From f9569895b46e5fd6889eba2686a63288df65289d Mon Sep 17 00:00:00 2001 From: Agetian Date: Sat, 2 Sep 2017 16:31:07 +0000 Subject: [PATCH] - Hermit Druid: added AILogic$ DontMillSelf --- .../src/main/java/forge/ai/ability/DigUntilAi.java | 13 ++++++++++++- forge-gui/res/cardsfolder/h/hermit_druid.txt | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/DigUntilAi.java b/forge-ai/src/main/java/forge/ai/ability/DigUntilAi.java index 249a1a3186d..7416d5bce91 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DigUntilAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DigUntilAi.java @@ -21,6 +21,7 @@ public class DigUntilAi extends SpellAbilityAi { @Override protected boolean canPlayAI(Player ai, SpellAbility sa) { Card source = sa.getHostCard(); + final String logic = sa.getParamOrDefault("AILogic", ""); double chance = .4; // 40 percent chance with instant speed stuff if (SpellAbilityAi.isSorcerySpeed(sa)) { chance = .667; // 66.7% chance for sorcery speed (since it will @@ -32,6 +33,16 @@ public class DigUntilAi extends SpellAbilityAi { Player libraryOwner = ai; Player opp = ComputerUtil.getOpponentFor(ai); + if ("DontMillSelf".equals(logic)) { + // A card that digs for specific things and puts everything revealed before it into graveyard + // (e.g. Hermit Druid) - don't use it to mill itself and also make sure there's enough playable + // material in the library after using it several times. + // TODO: maybe this should happen for any DigUntil SA with RevealedDestination$ Graveyard? + if (ai.getCardsIn(ZoneType.Library).size() < 20) { + return false; + } + } + if (sa.usesTargeting()) { sa.resetTargets(); if (!sa.canTarget(opp)) { @@ -110,7 +121,7 @@ public class DigUntilAi extends SpellAbilityAi { // or none in play with one in library, oath return creaturesInLibrary.size() > 2 || (creaturesInBattlefield.size() == 0 && creaturesInLibrary.size() > 0); - + } } return true; diff --git a/forge-gui/res/cardsfolder/h/hermit_druid.txt b/forge-gui/res/cardsfolder/h/hermit_druid.txt index 721ac924a21..e5c69efdeef 100644 --- a/forge-gui/res/cardsfolder/h/hermit_druid.txt +++ b/forge-gui/res/cardsfolder/h/hermit_druid.txt @@ -2,7 +2,7 @@ Name:Hermit Druid ManaCost:1 G Types:Creature Human Druid PT:1/1 -A:AB$ DigUntil | Cost$ G T | Valid$ Land.Basic | ValidDescription$ basic land | FoundDestination$ Hand | RevealedDestination$ Graveyard | SpellDescription$ Reveal cards from the top of your library until you reveal a basic land card. Put that card into your hand and all other cards revealed this way into your graveyard. +A:AB$ DigUntil | Cost$ G T | Valid$ Land.Basic | ValidDescription$ basic land | FoundDestination$ Hand | RevealedDestination$ Graveyard | AILogic$ DontMillSelf | SpellDescription$ Reveal cards from the top of your library until you reveal a basic land card. Put that card into your hand and all other cards revealed this way into your graveyard. SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/hermit_druid.jpg Oracle:{G}, {T}: Reveal cards from the top of your library until you reveal a basic land card. Put that card into your hand and all other cards revealed this way into your graveyard.