Merge branch 'master' into 'master'

Fixed Cryptoplasm, added some simple AI logic to it.

See merge request core-developers/forge!1145
This commit is contained in:
Michael Kamensky
2018-11-28 17:21:30 +00:00
2 changed files with 13 additions and 3 deletions

View File

@@ -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()); CardCollection valid = CardLists.getValidCards(sa.getHostCard().getController().getCardsIn(ZoneType.Battlefield), sa.getParam("ValidTgts"), sa.getHostCard().getController(), sa.getHostCard());
sa.getTargets().add(ComputerUtilCard.getBestCreatureAI(valid)); sa.getTargets().add(ComputerUtilCard.getBestCreatureAI(valid));
return true; 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: // Default:
@@ -157,7 +161,14 @@ public class CloneAi extends SpellAbilityAi {
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { 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; return false;
} }

View File

@@ -4,7 +4,6 @@ Types:Creature Shapeshifter
PT:2/2 PT:2/2
# Make Svars for granting abilities and triggers on clones distinct to avoid SVars getting overwritten when cloning a clone # 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. 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 SVar:CryptoplasmCopy:DB$ Clone | ValidTgts$ Creature.Other | TgtPrompt$ Select another target creature to copy. | Optional$ True | GainThisAbility$ True | AddSVars$ CryptoplasmCopy | AILogic$ CloneBestCreature
AI:RemoveDeck:All
SVar:Picture:http://www.wizards.com/global/images/magic/general/cryptoplasm.jpg 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. 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.