From ccf0ba63d78aed7d24be7d46b22764c01644e052 Mon Sep 17 00:00:00 2001 From: Sloth Date: Wed, 22 Feb 2012 09:20:44 +0000 Subject: [PATCH] - Added support for mandatory targeting in AF Play. --- res/cardsfolder/o/omen_machine.txt | 8 +++----- src/main/java/forge/Player.java | 2 +- .../card/abilityfactory/AbilityFactoryPlay.java | 12 ++++++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/res/cardsfolder/o/omen_machine.txt b/res/cardsfolder/o/omen_machine.txt index 6f69c81e766..536056fb787 100644 --- a/res/cardsfolder/o/omen_machine.txt +++ b/res/cardsfolder/o/omen_machine.txt @@ -5,13 +5,11 @@ Text:no text K:Players can't draw cards. T:Mode$ Phase | Phase$ Draw | ValidPlayer$ You | Execute$ TrigOmenExileCardYou | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each player's draw step, that player exiles the top card of his or her library. If it's a land card, the player puts it onto the battlefield. Otherwise, the player casts it without paying its mana cost if able. SVar:TrigOmenExileCardYou:AB$ Mill | Cost$ 0 | NumCards$ 1 | Defined$ You | Destination$ Exile | RememberMilled$ True | SubAbility$ DBOmenPlayYou -SVar:DBOmenPlayYou:DB$ Play | ValidZone$ Exile | Controller$ TriggeredPlayer | Valid$ Remembered | WithoutManaCost$ True | SubAbility$ DBOmenCleanupYou -SVar:DBOmenCleanupYou:DB$ Cleanup | ClearRemembered$ True +SVar:DBOmenPlayYou:DB$ Play | ValidZone$ Exile | Controller$ TriggeredPlayer | Valid$ Remembered | WithoutManaCost$ True | SubAbility$ DBOmenCleanup +SVar:DBOmenCleanup:DB$ Cleanup | ClearRemembered$ True T:Mode$ Phase | Phase$ Draw | ValidPlayer$ Opponent | Execute$ TrigOmenExileCardOpp | TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ At the beginning of each player's draw step, that player exiles the top card of his or her library. If it's a land card, the player puts it onto the battlefield. Otherwise, the player casts it without paying its mana cost if able. SVar:TrigOmenExileCardOpp:AB$ Mill | Cost$ 0 | NumCards$ 1 | Destination$ Exile | Defined$ Opponent | RememberMilled$ True | SubAbility$ DBOmenPlayOpp -SVar:DBOmenPlayOpp:DB$ Play | ValidZone$ Exile | Controller$ TriggeredPlayer | Valid$ Remembered | WithoutManaCost$ True | SubAbility$ DBOmenCleanupOpp -SVar:DBOmenCleanupOpp:DB$ Cleanup | ClearRemembered$ True -SVar:RemAIDeck:True +SVar:DBOmenPlayOpp:DB$ Play | ValidZone$ Exile | Controller$ TriggeredPlayer | Valid$ Remembered | WithoutManaCost$ True | SubAbility$ DBOmenCleanup SVar:RemRandomDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/omen_machine.jpg diff --git a/src/main/java/forge/Player.java b/src/main/java/forge/Player.java index 2cb334e2b01..1ffb11a6636 100644 --- a/src/main/java/forge/Player.java +++ b/src/main/java/forge/Player.java @@ -1121,7 +1121,7 @@ public abstract class Player extends GameEntity { * @return true if a player can draw a card, false otherwise */ public final boolean canDraw() { - if (AllZoneUtil.isCardInPlay("Omen Machine") || AllZoneUtil.isCardInPlay("Maralen of the Mornsong")) + if (AllZoneUtil.isCardInPlay("Omen Machine") || AllZoneUtil.isCardInPlay("Maralen of the Mornsong")) { return false; } diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryPlay.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryPlay.java index d7ca9149e28..ba0e5ee9817 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryPlay.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryPlay.java @@ -364,9 +364,9 @@ public final class AbilityFactoryPlay { tgtCards = tgtCards.filter(new CardListFilter() { @Override public boolean addCard(final Card c) { - ArrayList SpellAbilities = c.getBasicSpells(); + ArrayList spellAbilities = c.getBasicSpells(); ArrayList sas = new ArrayList(); - for (SpellAbility s : SpellAbilities) { + for (SpellAbility s : spellAbilities) { Spell spell = (Spell) s; s.setActivatingPlayer(controller); SpellAbilityRestriction res = s.getRestrictions(); @@ -397,9 +397,9 @@ public final class AbilityFactoryPlay { } // get basic spells (no flashback, etc.) - ArrayList SpellAbilities = tgtCard.getBasicSpells(); + ArrayList spellAbilities = tgtCard.getBasicSpells(); ArrayList sas = new ArrayList(); - for (SpellAbility s : SpellAbilities) { + for (SpellAbility s : spellAbilities) { s.setActivatingPlayer(controller); SpellAbilityRestriction res = s.getRestrictions(); // timing restrictions still apply @@ -420,6 +420,10 @@ public final class AbilityFactoryPlay { tgtSA = sas.get(0); } + if (tgtSA.getTarget() != null && !params.containsKey("Optional")) { + tgtSA.getTarget().setMandatory(true); + } + if (params.containsKey("WithoutManaCost")) { if (controller.isHuman()) { final SpellAbility newSA = tgtSA.copy();