From 88aedb8cba3a0afc9e549aa167d7b1bb66d27130 Mon Sep 17 00:00:00 2001 From: Agetian Date: Wed, 28 Nov 2018 20:20:31 +0300 Subject: [PATCH] - Fixed Cryptoplasm, added some simple AI logic to it. --- .../src/main/java/forge/ai/ability/CloneAi.java | 13 ++++++++++++- forge-gui/res/cardsfolder/c/cryptoplasm.txt | 3 +-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/CloneAi.java b/forge-ai/src/main/java/forge/ai/ability/CloneAi.java index 9fae432551b..494632f1f50 100644 --- a/forge-ai/src/main/java/forge/ai/ability/CloneAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/CloneAi.java @@ -142,6 +142,10 @@ public class CloneAi extends SpellAbilityAi { CardCollection valid = CardLists.getValidCards(sa.getHostCard().getController().getCardsIn(ZoneType.Battlefield), sa.getParam("ValidTgts"), sa.getHostCard().getController(), sa.getHostCard()); sa.getTargets().add(ComputerUtilCard.getBestCreatureAI(valid)); return true; + } else if ("CloneBestCreature".equals(sa.getParam("AILogic"))) { + CardCollection valid = CardLists.getValidCards(sa.getHostCard().getController().getGame().getCardsIn(ZoneType.Battlefield), sa.getParam("ValidTgts"), sa.getHostCard().getController(), sa.getHostCard()); + sa.getTargets().add(ComputerUtilCard.getBestCreatureAI(valid)); + return true; } // Default: @@ -157,7 +161,14 @@ public class CloneAi extends SpellAbilityAi { */ @Override public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { - // Didn't confirm in the original code + if (sa.hasParam("AILogic") && sa.usesTargeting() && sa.isTargetNumberValid()) { + // Had a special logic for it and managed to target, so confirm if viable + if ("CloneBestCreature".equals(sa.getParam("AILogic"))) { + return ComputerUtilCard.evaluateCreature(sa.getTargets().getFirstTargetedCard()) > ComputerUtilCard.evaluateCreature(sa.getHostCard()); + } + } + + // Currently doesn't confirm anything that's not defined by AI logic return false; } diff --git a/forge-gui/res/cardsfolder/c/cryptoplasm.txt b/forge-gui/res/cardsfolder/c/cryptoplasm.txt index d5c52244cae..3b1c6947d17 100644 --- a/forge-gui/res/cardsfolder/c/cryptoplasm.txt +++ b/forge-gui/res/cardsfolder/c/cryptoplasm.txt @@ -4,7 +4,6 @@ Types:Creature Shapeshifter PT:2/2 # Make Svars for granting abilities and triggers on clones distinct to avoid SVars getting overwritten when cloning a clone T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ CryptoplasmCopy | OptionalDecider$ You | TriggerDescription$ At the beginning of your upkeep, you may have CARDNAME become a copy of another target creature. If you do, CARDNAME gains this ability. -SVar:CryptoplasmCopy:DB$ Clone | ValidTgts$ Creature.Other | TgtPrompt$ Select another target creature to copy. | Optional$ True | GainThisAbility$ True -AI:RemoveDeck:All +SVar:CryptoplasmCopy:DB$ Clone | ValidTgts$ Creature.Other | TgtPrompt$ Select another target creature to copy. | Optional$ True | GainThisAbility$ True | AddSVars$ CryptoplasmCopy | AILogic$ CloneBestCreature SVar:Picture:http://www.wizards.com/global/images/magic/general/cryptoplasm.jpg Oracle:At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.