diff --git a/res/cards.txt b/res/cards.txt index a29142640b4..0c8bc96e9b8 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,18 @@ +Steady Progress +2 U +Instant +no text +spDrawCards:1:Draw a card. Proliferate.:Steady Progress - draw a card, proliferate. +Proliferate + +Thrummingbird +1 U +Creature Bird Horror +no text +1/1 +Flying +Whenever CARDNAME deals combat damage to a player, proliferate. + Astral Steel 2 W Instant diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index 749a60e5060..16c73aade9d 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -4473,6 +4473,23 @@ public class CardFactoryUtil { } } } + + public static boolean isNegativeCounter(Counters c) + { + + /* + AGE(), + BLAZE(), + BRIBERY(), + ICE(), + M1M1("-1/-1"), + P0M1("+0/-1"), + P0M2("+0/-2"), + TIME(), + */ + return c == Counters.AGE || c == Counters.BLAZE || c == Counters.BRIBERY || c == Counters.ICE || + c == Counters.M1M1 || c == Counters.P0M1 || c == Counters.P0M2 || c == Counters.TIME; + } public static void main(String[] args) { @@ -4492,7 +4509,13 @@ public class CardFactoryUtil { System.out.println(manacost + " times 2 = " + multipliedTwice); System.out.println(manacost + " times 3 = " + multipliedThrice); - + if (isNegativeCounter(Counters.M1M1)) + { + System.out.println("M1M1 is a bad counter!"); + } + else + System.out.println("M1M1 is a good counter!"); + } } diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index 3af48a27aa9..427450f699a 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -8,6 +8,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Random; import java.util.Map.Entry; @@ -3861,6 +3862,159 @@ public class GameAction { secondZone.add(c); } } + + public void proliferate(final Card c, String cost) + { + Ability p = getProliferateAbility(c, cost); + AllZone.Stack.add(p); + } + + public Ability getProliferateAbility(final Card c, final String cost) + { + final Ability ability = new Ability(c, cost) + { + public void resolve() + { + CardList hperms = AllZoneUtil.getPlayerCardsInPlay(Constant.Player.Human); + hperms = hperms.filter(new CardListFilter(){ + public boolean addCard(Card crd) + { + return !crd.getName().equals("Mana Pool") /*&& crd.hasCounters()*/; + } + }); + + CardList cperms = AllZoneUtil.getPlayerCardsInPlay(Constant.Player.Computer); + cperms = cperms.filter(new CardListFilter(){ + public boolean addCard(Card crd) + { + return !crd.getName().equals("Mana Pool") /*&& crd.hasCounters()*/; + } + }); + + if (c.getController().equals(Constant.Player.Human)) + { + List selection1 = AllZone.Display.getChoicesOptional("Select permanent(s) computer controls", cperms.toArray()); + List selection2 = AllZone.Display.getChoicesOptional("Select permanent(s) you control", hperms.toArray()); + + String[] choices = {"Human", "Computer"}; + List playerSelection = AllZone.Display.getChoicesOptional("Select player(s)", choices); + + for(int m = 0; m < selection1.size(); m++) { + Card crd = selection1.get(m); + for(Counters c_1:Counters.values()) + if(crd.getCounters(c_1) != 0) crd.addCounter(c_1, 1); + } + + for(int m = 0; m < selection2.size(); m++) { + Card crd = selection2.get(m); + for(Counters c_1:Counters.values()) + if(crd.getCounters(c_1) != 0) crd.addCounter(c_1, 1); + } + + for (int i=0;i 0) + AllZone.Human_PoisonCounter.addPoisonCounters(1); + if (s.equals("Computer") && AllZone.Computer_PoisonCounter.getPoisonCounters() > 0) + AllZone.Computer_PoisonCounter.addPoisonCounters(1); + } + } + else //comp + { + cperms = cperms.filter(new CardListFilter(){ + public boolean addCard(Card crd) + { + int pos = 0; + int neg = 0; + for(Counters c_1:Counters.values()) { + if(crd.getCounters(c_1) != 0) + { + if (CardFactoryUtil.isNegativeCounter(c_1)) + neg++; + else + pos++; + } + } + return pos > neg; + } + }); + + hperms = hperms.filter(new CardListFilter(){ + public boolean addCard(Card crd) + { + int pos = 0; + int neg = 0; + for(Counters c_1:Counters.values()) { + if(crd.getCounters(c_1) != 0) + { + if (CardFactoryUtil.isNegativeCounter(c_1)) + neg++; + else + pos++; + } + } + return pos < neg; + } + }); + + StringBuilder sb = new StringBuilder(); + sb.append("Proliferate:
Computer selects "); + if (cperms.size() == 0 && hperms.size() == 0 && AllZone.Human_PoisonCounter.getPoisonCounters() == 0) + sb.append("nothing."); + else + { + if (cperms.size()>0) { + sb.append("
From Computer's permanents:
"); + for (Card c:cperms) + { + sb.append(c); + sb.append(" "); + } + sb.append("
"); + } + if (hperms.size()>0) { + sb.append("
From Human's permanents:
"); + for (Card c:cperms) + { + sb.append(c); + sb.append(" "); + } + sb.append("
"); + } + if (AllZone.Human_PoisonCounter.getPoisonCounters() > 0) + sb.append("Human Player."); + }//else + sb.append(""); + + + //add a counter for each counter type, if it would benefit the computer + for (Card c:cperms) + { + for(Counters c_1:Counters.values()) + if(c.getCounters(c_1) != 0) c.addCounter(c_1, 1); + } + + //add a counter for each counter type, if it would screw over the player + for (Card c:hperms) + { + for(Counters c_1:Counters.values()) + if(c.getCounters(c_1) != 0) c.addCounter(c_1, 1); + } + + //give human a poison counter, if he has one + if (AllZone.Human_PoisonCounter.getPoisonCounters() > 0) + AllZone.Human_PoisonCounter.addPoisonCounters(1); + + } //comp + } + }; + ability.setStackDescription(c + " - Proliferate (You choose any number of permanents and/or players with " + + "counters on them, then give each another counter of a kind already there.)"); + return ability; + + } + public static void main(String[] args) { GameAction gameAction = new GameAction(); GenerateConstructedDeck gen = new GenerateConstructedDeck(); diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 56a0914992c..61ab3e467c9 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -5085,6 +5085,9 @@ public class GameActionUtil { } } + if (c.getKeyword().contains("Whenever CARDNAME deals combat damage to a player, proliferate.")) + AllZone.GameAction.proliferate(c, "0"); + /* if (c.getKeyword().contains("Infect")) { diff --git a/src/forge/Input_StackNotEmpty.java b/src/forge/Input_StackNotEmpty.java index 551baea4a6d..b1ed26dbc96 100644 --- a/src/forge/Input_StackNotEmpty.java +++ b/src/forge/Input_StackNotEmpty.java @@ -49,6 +49,9 @@ public class Input_StackNotEmpty extends Input implements java.io.Serializable { && !(sa.getSourceCard().getKeyword().contains("Ripple:4") && sa.isAbility())) AllZone.GameAction.drawCard(sa.getSourceCard().getController()); + if(sa.getSourceCard().getKeyword().contains("Proliferate")) + AllZone.GameAction.getProliferateAbility(sa.getSourceCard(), "0").resolve(); + for(int i = 0; i < sa.getSourceCard().getKeyword().size(); i++) { String k = sa.getSourceCard().getKeyword().get(i); if(k.startsWith("Scry")) {