From 927575fbfa6ea10ece1c66dd531f5a0d43e47a42 Mon Sep 17 00:00:00 2001 From: Agetian Date: Mon, 19 Jun 2017 04:58:32 +0000 Subject: [PATCH] - PumpAll AI should respect AIPreference:SacCost if specified. - Specified a basic AIPreference for Maw of the Obzedat, marked it as AI playable. --- forge-ai/src/main/java/forge/ai/ability/PumpAllAi.java | 9 +++++++++ forge-gui/res/cardsfolder/m/maw_of_the_obzedat.txt | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/PumpAllAi.java b/forge-ai/src/main/java/forge/ai/ability/PumpAllAi.java index 11abba9ab26..4e590af869f 100644 --- a/forge-ai/src/main/java/forge/ai/ability/PumpAllAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/PumpAllAi.java @@ -5,6 +5,7 @@ import com.google.common.base.Predicate; import forge.ai.ComputerUtil; import forge.ai.ComputerUtilCard; import forge.ai.ComputerUtilCombat; +import forge.ai.ComputerUtilCost; import forge.game.Game; import forge.game.GameObject; import forge.game.ability.AbilityUtils; @@ -12,6 +13,7 @@ import forge.game.card.Card; import forge.game.card.CardCollection; import forge.game.card.CardLists; import forge.game.combat.Combat; +import forge.game.cost.Cost; import forge.game.phase.PhaseType; import forge.game.player.Player; import forge.game.spellability.SpellAbility; @@ -33,6 +35,7 @@ public class PumpAllAi extends PumpAiBase { final Card source = sa.getHostCard(); final Game game = ai.getGame(); final Combat combat = game.getCombat(); + final Cost abCost = sa.getPayCosts(); final int power = AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumAtt"), sa); final int defense = AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumDef"), sa); @@ -44,6 +47,12 @@ public class PumpAllAi extends PumpAiBase { return false; } + if (abCost != null && source.hasSVar("AIPreference")) { + if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, true)) { + return false; + } + } + if (sa.hasParam("ValidCards")) { valid = sa.getParam("ValidCards"); } diff --git a/forge-gui/res/cardsfolder/m/maw_of_the_obzedat.txt b/forge-gui/res/cardsfolder/m/maw_of_the_obzedat.txt index 32fc7c6a49f..fee1e45b0c2 100644 --- a/forge-gui/res/cardsfolder/m/maw_of_the_obzedat.txt +++ b/forge-gui/res/cardsfolder/m/maw_of_the_obzedat.txt @@ -3,6 +3,6 @@ ManaCost:3 W B Types:Creature Thrull PT:3/3 A:AB$ PumpAll | Cost$ Sac<1/Creature> | ValidCards$ Creature.YouCtrl | NumAtt$ 1 | NumDef$ 1 | SpellDescription$ Creatures you control get +1/+1 until end of turn. -SVar:RemAIDeck:True +SVar:AIPreference:SacCost$Creature.token+powerLE2,Creature.cmcLE2+powerLE2 SVar:Picture:http://www.wizards.com/global/images/magic/general/maw_of_the_obzedat.jpg Oracle:Sacrifice a creature: Creatures you control get +1/+1 until end of turn.