From 4d34b23a0226df9ca739fe07b2655b92570bdc07 Mon Sep 17 00:00:00 2001 From: moomarc Date: Wed, 29 May 2013 09:15:13 +0000 Subject: [PATCH] - Added Tunnel Vision --- .gitattributes | 1 + res/cardsfolder/t/tunnel_vision.txt | 9 ++++ .../card/ability/effects/DigUntilEffect.java | 54 ++++++++++++++----- 3 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 res/cardsfolder/t/tunnel_vision.txt diff --git a/.gitattributes b/.gitattributes index b8d937e955e..de844d9f10a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11596,6 +11596,7 @@ res/cardsfolder/t/tundra_kavu.txt -text res/cardsfolder/t/tundra_wolves.txt svneol=native#text/plain res/cardsfolder/t/tunnel.txt svneol=native#text/plain res/cardsfolder/t/tunnel_ignus.txt -text +res/cardsfolder/t/tunnel_vision.txt -text res/cardsfolder/t/tunneler_wurm.txt svneol=native#text/plain res/cardsfolder/t/turbulent_dreams.txt -text res/cardsfolder/t/turf_wound.txt -text diff --git a/res/cardsfolder/t/tunnel_vision.txt b/res/cardsfolder/t/tunnel_vision.txt new file mode 100644 index 00000000000..5b3bf3c130a --- /dev/null +++ b/res/cardsfolder/t/tunnel_vision.txt @@ -0,0 +1,9 @@ +Name:Tunnel Vision +ManaCost:5 U +Types:Sorcery +A:SP$ NameCard | Cost$ 5 U | Defined$ You | SubAbility$ FindThePrecious | AILogic$ MostProminentInHumanDeck | SpellDescription$ Name a card. Target player reveals cards from the top of his or her library until the named card is revealed. If it is, that player puts the rest of the revealed cards into his or her graveyard and puts the named card on top of his or her library. Otherwise, the player shuffles his or her library. +SVar:FindThePrecious:DB$ DigUntil | ValidTgts$ Player | TgtPrompt$ Select target player | IsCurse$ True | Valid$ Card.NamedCard | ValidDescription$ the named | RememberFound$ True | NoMoveFound$ True | FoundDestination$ Library | FoundLibraryPosition$ 0 | RevealedDestination$ Graveyard | NoneFoundDestination$ Library | NoneFoundLibraryPosition$ 0 | Shuffle$ True | ShuffleCondition$ NoneFound +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/tunnel_vision.jpg +Oracle:Name a card. Target player reveals cards from the top of his or her library until the named card is revealed. If it is, that player puts the rest of the revealed cards into his or her graveyard and puts the named card on top of his or her library. Otherwise, the player shuffles his or her library. +SetInfo:RAV Rare \ No newline at end of file diff --git a/src/main/java/forge/card/ability/effects/DigUntilEffect.java b/src/main/java/forge/card/ability/effects/DigUntilEffect.java index 5da6b6253eb..12b120c7569 100644 --- a/src/main/java/forge/card/ability/effects/DigUntilEffect.java +++ b/src/main/java/forge/card/ability/effects/DigUntilEffect.java @@ -100,7 +100,10 @@ public class DigUntilEffect extends SpellAbilityEffect { final int foundLibPos = AbilityUtils.calculateAmount(host, sa.getParam("FoundLibraryPosition"), sa); final ZoneType revealedDest = ZoneType.smartValueOf(sa.getParam("RevealedDestination")); final int revealedLibPos = AbilityUtils.calculateAmount(host, sa.getParam("RevealedLibraryPosition"), sa); + final ZoneType noneFoundDest = ZoneType.smartValueOf(sa.getParam("NoneFoundDestination")); + final int noneFoundLibPos = AbilityUtils.calculateAmount(host, sa.getParam("NoneFoundLibraryPosition"), sa); final ZoneType digSite = sa.hasParam("DigZone") ? ZoneType.smartValueOf(sa.getParam("DigZone")) : ZoneType.Library; + boolean shuffle = sa.hasParam("Shuffle"); for (final Player p : getTargetPlayers(sa)) { if ((tgt == null) || p.canBeTargetedBy(sa)) { @@ -125,6 +128,12 @@ public class DigUntilEffect extends SpellAbilityEffect { } } + if (shuffle && sa.hasParam("ShuffleCondition")) { + if (sa.getParam("ShuffleCondition").equals("NoneFound")) { + shuffle = found.isEmpty(); + } + } + if (revealed.size() > 0) { GuiChoose.one(p + " revealed: ", revealed); } @@ -166,22 +175,39 @@ public class DigUntilEffect extends SpellAbilityEffect { Collections.shuffle(revealed, random); } - // Allow ordering the rest of the revealed cards - if ((revealedDest.isKnown()) && revealed.size() >= 2) { - revealed = p.getController().orderMoveToZoneList(revealed, revealedDest); - } - if (revealedDest == ZoneType.Library && !sa.hasParam("Shuffle") - && !sa.hasParam("RevealRandomOrder") && revealed.size() >= 2) { - revealed = p.getController().orderMoveToZoneList(revealed, revealedDest); + if (sa.hasParam("NoneFoundDestination") && found.size() < untilAmount) { + // Allow ordering the revealed cards + if ((noneFoundDest.isKnown()) && revealed.size() >= 2) { + revealed = p.getController().orderMoveToZoneList(revealed, noneFoundDest); + } + if (noneFoundDest == ZoneType.Library && !shuffle + && !sa.hasParam("RevealRandomOrder") && revealed.size() >= 2) { + revealed = p.getController().orderMoveToZoneList(revealed, noneFoundDest); + } + + final Iterator itr = revealed.iterator(); + while (itr.hasNext()) { + final Card c = itr.next(); + game.getAction().moveTo(noneFoundDest, c, noneFoundLibPos); + } + } else { + // Allow ordering the rest of the revealed cards + if ((revealedDest.isKnown()) && revealed.size() >= 2) { + revealed = p.getController().orderMoveToZoneList(revealed, revealedDest); + } + if (revealedDest == ZoneType.Library && !shuffle + && !sa.hasParam("RevealRandomOrder") && revealed.size() >= 2) { + revealed = p.getController().orderMoveToZoneList(revealed, revealedDest); + } + + final Iterator itr = revealed.iterator(); + while (itr.hasNext()) { + final Card c = itr.next(); + game.getAction().moveTo(revealedDest, c, revealedLibPos); + } } - final Iterator itr = revealed.iterator(); - while (itr.hasNext()) { - final Card c = itr.next(); - game.getAction().moveTo(revealedDest, c, revealedLibPos); - } - - if (sa.hasParam("Shuffle")) { + if (shuffle) { p.shuffle(); } } // end foreach player