diff --git a/.gitattributes b/.gitattributes index 1193b8aaa5b..0e307778140 100644 --- a/.gitattributes +++ b/.gitattributes @@ -191,6 +191,7 @@ res/cardsfolder/a/alaborn_trooper.txt svneol=native#text/plain res/cardsfolder/a/alaborn_veteran.txt svneol=native#text/plain res/cardsfolder/a/alaborn_zealot.txt svneol=native#text/plain res/cardsfolder/a/aladdin.txt svneol=native#text/plain +res/cardsfolder/a/aladdins_lamp.txt -text res/cardsfolder/a/aladdins_ring.txt svneol=native#text/plain res/cardsfolder/a/alarum.txt svneol=native#text/plain res/cardsfolder/a/albino_troll.txt svneol=native#text/plain diff --git a/res/cardsfolder/a/aladdins_lamp.txt b/res/cardsfolder/a/aladdins_lamp.txt new file mode 100644 index 00000000000..92227dd8e91 --- /dev/null +++ b/res/cardsfolder/a/aladdins_lamp.txt @@ -0,0 +1,21 @@ +Name:Aladdin's Lamp +ManaCost:10 +Types:Artifact +Text:no text +A:AB$ StoreSVar | Cost$ XCantBe0 X T | SVar$ DigNum | Type$ Count | Expression$ xPaid | SubAbility$ TheMagic | SpellDescription$ The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can't be 0. +SVar:TheMagic:DB$ Effect | Name$ Aladdin's Wish | ReplacementEffects$ DrawReplace | SVars$ ExileEffect,AladdinDraw,DBDraw,DigNum,AllButOne +SVar:DrawReplace:Event$ Draw | ValidPlayer$ You | ReplaceWith$ AladdinDraw | Description$ The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. +SVar:AladdinDraw:AB$ Dig | Cost$ 0 | DigNum$ DigNum | ChangeNum$ AllButOne | RandomOrder$ True | DestinationZone$ Library | LibraryPosition$ -1 | DestinationZone2$ Library | LibraryPosition2$ 0 | SubAbility$ DBDraw +SVar:DBDraw:DB$ Draw | NumCards$ 1 | SubAbility$ ExileEffect +SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Battlefield | Destination$ Exile +SVar:X:Count$xPaid +SVar:DigNum:Number$0 +SVar:AIPlayForSub:True +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/aladdins_lamp.jpg +SetInfo:3ED|Rare|http://magiccards.info/scans/en/rv/231.jpg +SetInfo:4ED|Rare|http://magiccards.info/scans/en/4e/309.jpg +SetInfo:ARN|Uncommon|http://magiccards.info/scans/en/an/70.jpg +Oracle:{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can't be 0. +End \ No newline at end of file diff --git a/src/main/java/forge/card/abilityfactory/effects/DigEffect.java b/src/main/java/forge/card/abilityfactory/effects/DigEffect.java index f451ab468cc..b5868ec0fab 100644 --- a/src/main/java/forge/card/abilityfactory/effects/DigEffect.java +++ b/src/main/java/forge/card/abilityfactory/effects/DigEffect.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Random; import forge.Card; import forge.CardCharacteristicName; @@ -19,6 +20,7 @@ import forge.game.player.Player; import forge.game.zone.PlayerZone; import forge.game.zone.ZoneType; import forge.gui.GuiChoose; +import forge.util.MyRandom; public class DigEffect extends SpellEffect { @@ -69,6 +71,7 @@ public class DigEffect extends SpellEffect { final boolean noMove = sa.hasParam("NoMove"); final boolean skipReorder = sa.hasParam("SkipReorder"); boolean changeAll = false; + boolean allButOne = false; final ArrayList keywords = new ArrayList(); if (sa.hasParam("Keywords")) { keywords.addAll(Arrays.asList(sa.getParam("Keywords").split(" & "))); @@ -77,8 +80,10 @@ public class DigEffect extends SpellEffect { if (sa.hasParam("ChangeNum")) { if (sa.getParam("ChangeNum").equalsIgnoreCase("All")) { changeAll = true; + } else if (sa.getParam("ChangeNum").equalsIgnoreCase("AllButOne")) { + allButOne = true; } else { - destZone1ChangeNum = Integer.parseInt(sa.getParam("ChangeNum")); + destZone1ChangeNum = AbilityFactory.calculateAmount(host, sa.getParam("ChangeNum"), sa); } } @@ -180,6 +185,27 @@ public class DigEffect extends SpellEffect { } else if (sa.hasParam("RandomChange")) { int numChanging = Math.min(destZone1ChangeNum, valid.size()); movedCards = CardLists.getRandomSubList(valid, numChanging); + } else if (allButOne) { + movedCards.addAll(valid); + if (choser.isHuman()) { + Card chosen = null; + String prompt = "Choose a card to leave in "; + if (destZone2.equals(ZoneType.Library) && (libraryPosition2 == 0)) { + prompt = "Leave which card on top of the "; + } + chosen = GuiChoose.one(prompt + destZone2, valid); + movedCards.remove(chosen); + } else { // Computer + Card chosen = CardFactoryUtil.getBestAI(valid); + if (sa.getActivatingPlayer().isHuman() && p.isHuman()) { + chosen = CardFactoryUtil.getWorstAI(valid); + } + movedCards.remove(chosen); + } + if (sa.hasParam("RandomOrder")) { + final Random random = MyRandom.getRandom(); + Collections.shuffle(movedCards, random); + } } else { int j = 0; if (choser.isHuman()) {