diff --git a/forge-ai/src/main/java/forge/ai/ability/LegendaryRuleAi.java b/forge-ai/src/main/java/forge/ai/ability/LegendaryRuleAi.java index f91ef1ba505..7ac6840c602 100644 --- a/forge-ai/src/main/java/forge/ai/ability/LegendaryRuleAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/LegendaryRuleAi.java @@ -4,8 +4,10 @@ import java.util.Map; import com.google.common.collect.Iterables; +import forge.ai.ComputerUtil; import forge.ai.SpellAbilityAi; import forge.game.card.Card; +import forge.game.card.CardCollection; import forge.game.card.CounterEnumType; import forge.game.player.Player; import forge.game.spellability.SpellAbility; @@ -23,15 +25,17 @@ public class LegendaryRuleAi extends SpellAbilityAi { protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) { return false; // should not get here } - @Override public Card chooseSingleCard(Player ai, SpellAbility sa, Iterable options, boolean isOptional, Player targetedPlayer, Map params) { // Choose a single legendary/planeswalker card to keep - Card firstOption = Iterables.getFirst(options, null); + CardCollection legends = new CardCollection(options); + CardCollection badOptions = ComputerUtil.choosePermanentsToSacrifice(ai, legends, legends.size() -1, sa, false, false); + legends.removeAll(badOptions); + Card firstOption = Iterables.getFirst(legends, null); boolean choosingFromPlanewalkers = firstOption.isPlaneswalker(); - if ( choosingFromPlanewalkers ) { + if (choosingFromPlanewalkers) { // AI decision making - should AI compare counters? } else { // AI decision making - should AI compare damage and debuffs? diff --git a/forge-game/src/main/java/forge/game/GameAction.java b/forge-game/src/main/java/forge/game/GameAction.java index ea1d5cda280..61159befd7c 100644 --- a/forge-game/src/main/java/forge/game/GameAction.java +++ b/forge-game/src/main/java/forge/game/GameAction.java @@ -1633,7 +1633,7 @@ public class GameAction { recheck = true; - Card toKeep = p.getController().chooseSingleEntityForEffect(new CardCollection(cc), new SpellAbility.EmptySa(ApiType.InternalLegendaryRule, null, p), + Card toKeep = p.getController().chooseSingleEntityForEffect(new CardCollection(cc), new SpellAbility.EmptySa(ApiType.InternalLegendaryRule, new Card(-1, game), p), "You have multiple legendary permanents named \""+name+"\" in play.\n\nChoose the one to stay on battlefield (the rest will be moved to graveyard)", null); for (Card c: cc) { if (c != toKeep) { diff --git a/forge-gui/res/cardsfolder/z/zealous_conscripts.txt b/forge-gui/res/cardsfolder/z/zealous_conscripts.txt index 50dcfafacf5..90d86fe6776 100644 --- a/forge-gui/res/cardsfolder/z/zealous_conscripts.txt +++ b/forge-gui/res/cardsfolder/z/zealous_conscripts.txt @@ -4,7 +4,7 @@ Types:Creature Human Warrior PT:3/3 K:Haste T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, untap target permanent and gain control of it until end of turn. It gains haste until end of turn. -SVar:TrigChange:DB$GainControl | TgtPrompt$ Choose target permanent | ValidTgts$ Permanent | LoseControl$ EOT | Untap$ True | AddKWs$ Haste | SpellDescription$ Untap target permanent gain control of it until end of turn. It gains haste until end of turn. +SVar:TrigChange:DB$ GainControl | TgtPrompt$ Choose target permanent | ValidTgts$ Permanent | LoseControl$ EOT | Untap$ True | AddKWs$ Haste | SpellDescription$ Untap target permanent gain control of it until end of turn. It gains haste until end of turn. SVar:PlayMain1:OPPONENTCREATURES SVar:Picture:http://www.wizards.com/global/images/magic/general/zealous_conscripts.jpg Oracle:Haste\nWhen Zealous Conscripts enters the battlefield, gain control of target permanent until end of turn. Untap that permanent. It gains haste until end of turn.