diff --git a/.gitattributes b/.gitattributes index 7fc11be8362..3ae65386afc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -820,6 +820,7 @@ res/cardsfolder/dakmor_plague.txt -text svneol=native#text/plain res/cardsfolder/dakmor_salvage.txt -text svneol=native#text/plain res/cardsfolder/dakmor_scorpion.txt -text svneol=native#text/plain res/cardsfolder/damnation.txt -text svneol=native#text/plain +res/cardsfolder/damping_field.txt -text svneol=native#text/plain res/cardsfolder/dance_of_shadows.txt -text svneol=native#text/plain res/cardsfolder/dancing_scimitar.txt -text svneol=native#text/plain res/cardsfolder/dandan.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/damping_field.txt b/res/cardsfolder/damping_field.txt new file mode 100644 index 00000000000..f012af73ef7 --- /dev/null +++ b/res/cardsfolder/damping_field.txt @@ -0,0 +1,7 @@ +Name:Damping Field +ManaCost:2 W +Types:Enchantment +Text:Players can't untap more than one artifact during their untap steps. +SVar:Rarity:Uncommon +SVar:Picture:http://www.wizards.com/global/images/magic/general/damping_field.jpg +End diff --git a/src/forge/AllZoneUtil.java b/src/forge/AllZoneUtil.java index b94a409f8a2..eac154f36e1 100644 --- a/src/forge/AllZoneUtil.java +++ b/src/forge/AllZoneUtil.java @@ -47,12 +47,6 @@ public class AllZoneUtil { return cards.filter(lands); } - private static CardListFilter lands = new CardListFilter() { - public boolean addCard(Card c) { - return c.isLand(); - } - }; - //============================================================================= // // These functions handle getting all cards for a given player @@ -315,13 +309,6 @@ public class AllZoneUtil { return cards; } - ////////////// cardListFilter for different types - public static CardListFilter artifacts = new CardListFilter() { - public boolean addCard(Card c) { - return c.isArtifact(); - } - }; - //////////////// getting all cards of a given color public static CardList getColorInPlay(final String color) { @@ -459,4 +446,16 @@ public class AllZoneUtil { return !c.isToken(); } }; + + public static CardListFilter artifacts = new CardListFilter() { + public boolean addCard(Card c) { + return c.isArtifact(); + } + }; + + public static CardListFilter lands = new CardListFilter() { + public boolean addCard(Card c) { + return c.isLand(); + } + }; } \ No newline at end of file diff --git a/src/forge/Input_Untap.java b/src/forge/Input_Untap.java index 1893d39b5ac..b6a5559a369 100644 --- a/src/forge/Input_Untap.java +++ b/src/forge/Input_Untap.java @@ -9,8 +9,6 @@ public class Input_Untap extends Input { @Override public void showMessage() { - //GameActionUtil.executeUpkeepEffects(); - PlayerZone p = AllZone.getZone(Constant.Zone.Play, AllZone.Phase.getActivePlayer()); Card[] c = p.getCards(); @@ -23,8 +21,6 @@ public class Input_Untap extends Input { c[i].setSickness(false); } - //if(isMarbleTitanInPlay()) marbleUntap(); - //if(!isStasisInPlay()) doUntap(); if(!AllZoneUtil.isCardInPlay("Stasis")) doUntap(); if (AllZone.Phase.getTurn() != 1) @@ -37,13 +33,7 @@ public class Input_Untap extends Input { //for debugging: System.out.println("need to nextPhase(Input_Untap) = true"); AllZone.Phase.setNeedToNextPhase(true); } - - /* Converted to keyword - private boolean untapLessThanPower3() - { - //checks for Marble Titan or Meekstone - return AllZoneUtil.isCardInPlay("Marble Titan") || AllZoneUtil.isCardInPlay("Meekstone"); - } */ + private void doUntap() { @@ -84,6 +74,12 @@ public class Input_Untap extends Input { return true; } }); + list = list.filter(new CardListFilter() { + public boolean addCard(Card c) { + if(AllZoneUtil.isCardInPlay("Damping Field") && c.isArtifact()) return false; + return true; + } + }); for(Card c : list) { if(c.getKeyword().contains("You may choose not to untap CARDNAME during your untap step.")) { @@ -118,14 +114,8 @@ public class Input_Untap extends Input { if( isWinterOrbInEffect() ) { if( AllZone.Phase.getActivePlayer().equals(Constant.Player.Computer) ) { //search for lands the computer has and only untap 1 - CardList landList = new CardList(p.getCards()); - landList = landList.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isLand() && c.isTapped(); - } - }); + CardList landList = AllZoneUtil.getPlayerLandsInPlay(Constant.Player.Computer); + landList = landList.filter(AllZoneUtil.tapped); if( landList.size() > 0 ) { landList.get(0).untap(); } @@ -145,20 +135,47 @@ public class Input_Untap extends Input { } }//selectCard() };//Input - CardList landList = new CardList(p.getCards()); - landList = landList.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isLand() && c.isTapped(); - } - }); + CardList landList = AllZoneUtil.getPlayerLandsInPlay(Constant.Player.Human); + landList = landList.filter(AllZoneUtil.tapped); if( landList.size() > 0 ) { AllZone.InputControl.setInput(target); } } } + if( AllZoneUtil.isCardInPlay("Damping Field") ) { + if( AllZone.Phase.getActivePlayer().equals(Constant.Player.Computer) ) { + CardList artList = AllZoneUtil.getPlayerCardsInPlay(Constant.Player.Computer); + artList = artList.filter(AllZoneUtil.artifacts); + artList = artList.filter(AllZoneUtil.tapped); + if( artList.size() > 0 ) { + artList.get(0).untap(); + } + } + else { + Input target = new Input() { + private static final long serialVersionUID = 5555427219659889707L; + public void showMessage() { + AllZone.Display.showMessage("Damping Field - Select one artifact to untap"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) { + if(c.isArtifact() && zone.is(Constant.Zone.Play) + && c.getController().equals(Constant.Player.Human)) { + c.untap(); + stop(); + } + }//selectCard() + };//Input + CardList artList = AllZoneUtil.getPlayerCardsInPlay(Constant.Player.Human); + artList = artList.filter(AllZoneUtil.artifacts); + artList = artList.filter(AllZoneUtil.tapped); + if( artList.size() > 0 ) { + AllZone.InputControl.setInput(target); + } + } + } }//end doUntap private boolean isWinterOrbInEffect() {