diff --git a/forge-ai/src/main/java/forge/ai/ability/DestroyAi.java b/forge-ai/src/main/java/forge/ai/ability/DestroyAi.java index 9a6dc7a5e40..393b2488a80 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DestroyAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DestroyAi.java @@ -1,6 +1,7 @@ package forge.ai.ability; import com.google.common.base.Predicate; +import com.google.common.base.Predicates; import forge.ai.AiController; import forge.ai.AiProps; @@ -75,7 +76,23 @@ public class DestroyAi extends SpellAbilityAi { sa.setTargetingPlayer(targetingPlayer); return targetingPlayer.getController().chooseTargetsFor(sa); } - if ("Polymorph".equals(logic)) { + if ("SarkhanDragon".equals(logic)) { + // TODO: expand this logic to make the AI force the opponent to sacrifice a big threat bigger than a 5/5 flier? + CardCollection creatures = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); + boolean hasValidTgt = !CardLists.filter(creatures, new Predicate() { + @Override + public boolean apply(Card t) { + return t.getCurrentPower() < 5 && t.getCurrentToughness() < 5; + } + } + ).isEmpty(); + if (hasValidTgt) { + Card worstCreature = ComputerUtilCard.getWorstCreatureAI(creatures); + sa.getTargets().add(worstCreature); + return true; + } + return false; + } else if ("Polymorph".equals(logic)) { list = CardLists.getTargetableCards(ai.getCardsIn(ZoneType.Battlefield), sa); if (list.isEmpty()) { return false; diff --git a/forge-gui/res/cardsfolder/s/sarkhan_the_mad.txt b/forge-gui/res/cardsfolder/s/sarkhan_the_mad.txt index 9a0305481f7..1c50f5e3526 100644 --- a/forge-gui/res/cardsfolder/s/sarkhan_the_mad.txt +++ b/forge-gui/res/cardsfolder/s/sarkhan_the_mad.txt @@ -6,12 +6,11 @@ A:AB$ Dig | Cost$ AddCounter<0/LOYALTY> | DigNum$ 1 | Reveal$ True | ChangeNum$ SVar:DBDamage:DB$ DealDamage | Defined$ Self | NumDmg$ Y | SubAbility$ DBCleanup | References$ Y SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:Y:Remembered$CardManaCost -A:AB$ Destroy | Cost$ SubCounter<2/LOYALTY> | ValidTgts$ Creature | TgtPrompt$ Select target creature | Sacrifice$ True | SubAbility$ DBToken | Planeswalker$ True | SpellDescription$ Target creature's controller sacrifices it, then that player creates a 5/5 red Dragon creature token with flying. +A:AB$ Destroy | Cost$ SubCounter<2/LOYALTY> | ValidTgts$ Creature | TgtPrompt$ Select target creature | Sacrifice$ True | SubAbility$ DBToken | Planeswalker$ True | AILogic$ SarkhanDragon | SpellDescription$ Target creature's controller sacrifices it, then that player creates a 5/5 red Dragon creature token with flying. SVar:DBToken:DB$ Token | TokenAmount$ 1 | TokenName$ Dragon | TokenTypes$ Creature,Dragon | TokenOwner$ TargetedController | TokenColors$ Red | TokenPower$ 5 | TokenToughness$ 5 | TokenImage$ r 5 5 dragon WWK | TokenKeywords$ Flying #for this AF, the DefinedCards$ Self is the target for Each damaging. They EachDamage themselves. A:AB$ EachDamage | Cost$ SubCounter<4/LOYALTY> | ValidCards$ Dragon.Creature+YouCtrl | ValidDescription$ Dragon creature you control | NumDmg$ X | DamageDesc$ damage equal to its power | ValidTgts$ Player | TgtPrompt$ Select target player | Planeswalker$ True | Ultimate$ True | References$ X | SpellDescription$ Each Dragon creature you control deals damage equal to its power to target player. #NumDmg isn't really used here. It is left for clarity. The AF pulls Damage straight from "X" hardcoded. SVar:X:Count$CardPower -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/sarkhan_the_mad.jpg Oracle:[0] Reveal the top card of your library and put it into your hand. Sarkhan the Mad deals damage to himself equal to that card's converted mana cost.\n[-2] Target creature's controller sacrifices it, then that player creates a 5/5 red Dragon creature token with flying.\n[-4] Each Dragon creature you control deals damage equal to its power to target player.