From e89a742b24b4c43f27fd4acc54b69c70b9bf2244 Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Sat, 7 Jul 2018 14:43:17 +0300 Subject: [PATCH] - Added a simple CheckDFC logic for putting counters on cards that can transform later as a result (Ludevic's Test Subject). --- .../java/forge/ai/ability/CountersPutAi.java | 17 ++++++++--------- ...devics_test_subject_ludevics_abomination.txt | 6 +++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java index 3a2f2777dc1..0f47ca9e9e0 100644 --- a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java @@ -220,13 +220,9 @@ public class CountersPutAi extends SpellAbilityAi { if ("Never".equals(logic)) { return false; - } - - if ("PayEnergy".equals(logic)) { + } else if ("PayEnergy".equals(logic)) { return true; - } - - if ("PayEnergyConservatively".equals(logic)) { + } else if ("PayEnergyConservatively".equals(logic)) { boolean onlyInCombat = ai.getController().isAI() && ((PlayerControllerAi) ai.getController()).getAi().getBooleanProperty(AiProps.CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT); boolean onlyDefensive = ai.getController().isAI() @@ -266,9 +262,7 @@ public class CountersPutAi extends SpellAbilityAi { return true; } } - } - - if (logic.equals("MarkOppCreature")) { + } else if (logic.equals("MarkOppCreature")) { if (!ph.is(PhaseType.END_OF_TURN)) { return false; } @@ -283,6 +277,11 @@ public class CountersPutAi extends SpellAbilityAi { sa.getTargets().add(bestCreat); return true; } + } else if (logic.equals("CheckDFC")) { + // for cards like Ludevic's Test Subject + if (!source.canTransform()) { + return false; + } } if (sa.getConditions() != null && !sa.getConditions().areMet(sa) && sa.getSubAbility() == null) { diff --git a/forge-gui/res/cardsfolder/l/ludevics_test_subject_ludevics_abomination.txt b/forge-gui/res/cardsfolder/l/ludevics_test_subject_ludevics_abomination.txt index 4f1c390d3d7..8d653515cfe 100644 --- a/forge-gui/res/cardsfolder/l/ludevics_test_subject_ludevics_abomination.txt +++ b/forge-gui/res/cardsfolder/l/ludevics_test_subject_ludevics_abomination.txt @@ -3,11 +3,11 @@ ManaCost:1 U Types:Creature Lizard Egg PT:0/3 K:Defender -A:AB$PutCounter | Cost$ 1 U | Defined$ Self | CounterType$ HATCHLING | CounterNum$ 1 | SubAbility$ DBBranch | SpellDescription$ Put a hatchling counter on CARDNAME. Then if there are five or more hatchling counters on it, remove all of them and transform it. -SVar:DBBranch:DB$ Branch | BranchConditionSVar$ XMarksTheSpot | References$ XMarksTheSpot | TrueSubAbility$ DBRemoveCtrs +A:AB$PutCounter | Cost$ 1 U | Defined$ Self | CounterType$ HATCHLING | CounterNum$ 1 | AILogic$ CheckDFC | SubAbility$ DBBranch | SpellDescription$ Put a hatchling counter on CARDNAME. Then if there are five or more hatchling counters on it, remove all of them and transform it. +SVar:DBBranch:DB$ Branch | BranchConditionSVar$ HatchTimer | References$ HatchTimer | TrueSubAbility$ DBRemoveCtrs SVar:DBRemoveCtrs:DB$ RemoveCounter | Defined$ Self | CounterType$ HATCHLING | CounterNum$ All | SubAbility$ DBTransform SVar:DBTransform:DB$ SetState | Defined$ Self | Mode$ Transform -SVar:XMarksTheSpot:Count$Valid Card.Self+counters_GE5_HATCHLING +SVar:HatchTimer:Count$Valid Card.Self+counters_GE5_HATCHLING SVar:Picture:http://www.wizards.com/global/images/magic/general/ludevics_test_subject.jpg AlternateMode:DoubleFaced Oracle:Defender\n{1}{U}: Put a hatchling counter on Ludevic's Test Subject. Then if there are five or more hatchling counters on it, remove all of them and transform it.