diff --git a/res/card-pictures.txt b/res/card-pictures.txt index 137ef5c8202..a51c147e2ad 100644 --- a/res/card-pictures.txt +++ b/res/card-pictures.txt @@ -38,6 +38,7 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg +greater_mossdog.jpg http://www.wizards.com/global/images/magic/general/greater_mossdog.jpg reanimate.jpg http://www.wizards.com/global/images/magic/general/reanimate.jpg sound_the_call.jpg http://www.wizards.com/global/images/magic/general/sound_the_call.jpg mana_vault.jpg http://www.wizards.com/global/images/magic/general/mana_vault.jpg diff --git a/res/cards.txt b/res/cards.txt index d75f1492877..e1718285b8f 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,10 @@ +Greater Mossdog +3 G +Creature Plant Hound +no text +3/3 +Dredge 3 + Reanimate B Sorcery diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index 1cd1647f1e8..dd9aa8268ae 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -833,7 +833,34 @@ public class GameAction { PlayerZone library = AllZone.getZone(Constant.Zone.Library, player); PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player); - if(library.size() != 0) { + if(0 < getDredge().size()) { + String choices[] = {"Yes", "No"}; + Object o = AllZone.Display.getChoice("Do you want to dredge?", choices); + if(o.equals("Yes")) { + Card c = (Card) AllZone.Display.getChoice("Select card to dredge", getDredge().toArray()); + + //might have to make this more sophisticated + //dredge library, put card in hand + AllZone.Human_Hand.add(c); + AllZone.Human_Graveyard.remove(c); + + for(int i = 0; i < getDredgeNumber(c); i++) { + Card c2 = AllZone.Human_Library.get(0); + AllZone.Human_Library.remove(0); + AllZone.Human_Graveyard.add(c2); + } + } + else { + doDraw(player, library, hand); + } + }//if(0 < getDredge().size()) + else { + doDraw(player, library, hand); + } + } + + private void doDraw(String player, PlayerZone library, PlayerZone hand) { + if(library.size() != 0) { Card c = library.get(0); library.remove(0); hand.add(c); @@ -854,6 +881,31 @@ public class GameAction { } } + private ArrayList getDredge() { + ArrayList dredge = new ArrayList(); + Card c[] = AllZone.Human_Graveyard.getCards(); + + for(int outer = 0; outer < c.length; outer++) { + ArrayList a = c[outer].getKeyword(); + for(int i = 0; i < a.size(); i++) + if(a.get(i).toString().startsWith("Dredge")) { + if(AllZone.Human_Library.size() >= getDredgeNumber(c[outer])) dredge.add(c[outer]); + } + } + return dredge; + }//hasDredge() + + private int getDredgeNumber(Card c) { + ArrayList a = c.getKeyword(); + for(int i = 0; i < a.size(); i++) + if(a.get(i).toString().startsWith("Dredge")) { + String s = a.get(i).toString(); + return Integer.parseInt("" + s.charAt(s.length() - 1)); + } + + throw new RuntimeException("Input_Draw : getDredgeNumber() card doesn't have dredge - " + c.getName()); + }//getDredgeNumber() + //is this card a permanent that is in play? public boolean isCardInPlay(Card c) { return PlayerZoneUtil.isCardInZone(AllZone.Computer_Play, c) diff --git a/src/forge/Input_Draw.java b/src/forge/Input_Draw.java index 8e2494f1ebb..73dc437d4b9 100644 --- a/src/forge/Input_Draw.java +++ b/src/forge/Input_Draw.java @@ -2,9 +2,6 @@ package forge; -import java.util.ArrayList; - - public class Input_Draw extends Input { private static final long serialVersionUID = -2341125041806280507L; @@ -13,7 +10,6 @@ public class Input_Draw extends Input { if(AllZone.Phase.getActivePlayer().equals(Constant.Player.Computer)) { AllZone.GameAction.drawCard(Constant.Player.Computer); - //AllZone.Phase.nextPhase(); //for debugging: System.out.println("need to nextPhase(from Input_Draw on computer's draw) = true"); AllZone.Phase.setNeedToNextPhase(true); return; @@ -55,30 +51,9 @@ public class Input_Draw extends Input { } } - if(0 < getDredge().size()) { - String choices[] = {"Yes", "No"}; - Object o = AllZone.Display.getChoice("Do you want to dredge?", choices); - if(o.equals("Yes")) { - drawCard = false; - Card c = (Card) AllZone.Display.getChoice("Select card to dredge", getDredge().toArray()); - - //might have to make this more sophisticated - //dredge library, put card in hand - AllZone.Human_Hand.add(c); - AllZone.Human_Graveyard.remove(c); - - for(int i = 0; i < getDredgeNumber(c); i++) { - Card c2 = AllZone.Human_Library.get(0); - AllZone.Human_Library.remove(0); - AllZone.Human_Graveyard.add(c2); - } - } - }//if(0 < getDredge().size()) - if(drawCard && AllZone.Phase.getTurn() > 1) AllZone.GameAction.drawCard(Constant.Player.Human); if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw)) { - //Input_Main.canPlayLand = true; AllZone.GameInfo.setHumanCanPlayNumberOfLands(CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Human)); AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(false); @@ -88,29 +63,4 @@ public class Input_Draw extends Input { } else stop(); } } //end necro check - - public ArrayList getDredge() { - ArrayList dredge = new ArrayList(); - Card c[] = AllZone.Human_Graveyard.getCards(); - - for(int outer = 0; outer < c.length; outer++) { - ArrayList a = c[outer].getKeyword(); - for(int i = 0; i < a.size(); i++) - if(a.get(i).toString().startsWith("Dredge")) { - if(AllZone.Human_Library.size() >= getDredgeNumber(c[outer])) dredge.add(c[outer]); - } - } - return dredge; - }//hasDredge() - - public int getDredgeNumber(Card c) { - ArrayList a = c.getKeyword(); - for(int i = 0; i < a.size(); i++) - if(a.get(i).toString().startsWith("Dredge")) { - String s = a.get(i).toString(); - return Integer.parseInt("" + s.charAt(s.length() - 1)); - } - - throw new RuntimeException("Input_Draw : getDredgeNumber() card doesn't have dredge - " + c.getName()); - }//getDredgeNumber() }