-Fixed proliferate(used to add one of Each counter type on card)

-Fixed Skullclamp(a static effect check unequipped it before it was checked)
This commit is contained in:
jendave
2011-08-06 07:27:29 +00:00
parent 9c9d785390
commit 5edf88bc6d
2 changed files with 57 additions and 35 deletions

View File

@@ -53,4 +53,8 @@ public enum Counters {
public String getName() { public String getName() {
return name; return name;
} }
public static Counters getType(String name)
{
return Enum.valueOf(Counters.class, name.replace("/", "").replaceAll("\\+", "p").replaceAll("\\-", "m").toUpperCase());
}
} }

View File

@@ -8,7 +8,6 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -2195,23 +2194,23 @@ public class GameAction {
else throw new RuntimeException("GameAction : destroy() invalid card.getOwner() - " + c + " " else throw new RuntimeException("GameAction : destroy() invalid card.getOwner() - " + c + " "
+ c.getOwner()); + c.getOwner());
play.remove(c);
if(c.getKeyword().contains("Persist") && c.getCounters(Counters.M1M1) == 0) persist = true; if(c.getKeyword().contains("Persist") && c.getCounters(Counters.M1M1) == 0) persist = true;
//tokens don't go into the graveyard
//TODO: must change this if any cards have effects that trigger "when creatures go to the graveyard"
if(!c.isToken())
//resets the card, untaps the card, removes anything "extra", resets attack and defense
moveToGraveyard(c);
c.destroy();
if(c.isEquipped()){ // when equipped creature goes to the grave here. if(c.isEquipped()){ // when equipped creature goes to the grave here.
// Deathrender & Oathkeeper, Takeno's Daisho have similar triggers to Skullclamp // Deathrender & Oathkeeper, Takeno's Daisho have similar triggers to Skullclamp
skullClamp_destroy(c); skullClamp_destroy(c);
c.unEquipAllCards(); c.unEquipAllCards();
} }
//tokens don't go into the graveyard
//TODO: must change this if any cards have effects that trigger "when creatures go to the graveyard"
if(!c.isToken())
//resets the card, untaps the card, removes anything "extra", resets attack and defense
moveToGraveyard(c);
else play.remove(c);
c.destroy();
//destroy card effects: //destroy card effects:
PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
@@ -3927,32 +3926,51 @@ public class GameAction {
if (c.getController().equals(Constant.Player.Human)) if (c.getController().equals(Constant.Player.Human))
{ {
List<Card> selection1 = AllZone.Display.getChoicesOptional("Select permanent(s) computer controls", cperms.toArray()); cperms.addAll(hperms.toArray());
List<Card> selection2 = AllZone.Display.getChoicesOptional("Select permanent(s) you control", hperms.toArray()); final CardList unchosen = cperms;
AllZone.InputControl.setInput(new Input() {
private static final long serialVersionUID = -1779224307654698954L;
String[] choices = {"Human", "Computer"}; @Override
List<String> playerSelection = AllZone.Display.getChoicesOptional("Select player(s)", choices); public void showMessage() {
AllZone.Display.showMessage("Choose permanents and/or players");
ButtonUtil.enableOnlyOK();
}
for(int m = 0; m < selection1.size(); m++) { @Override
Card crd = selection1.get(m); public void selectButtonOK() {
for(Counters c_1:Counters.values()) stop();
if(crd.getCounters(c_1) != 0) crd.addCounter(c_1, 1); }
}
for(int m = 0; m < selection2.size(); m++) { @Override
Card crd = selection2.get(m); public void selectCard(Card card, PlayerZone zone)
for(Counters c_1:Counters.values()) {
if(crd.getCounters(c_1) != 0) crd.addCounter(c_1, 1); if(!unchosen.contains(card)) return;
} unchosen.remove(card);
ArrayList<String> choices = new ArrayList<String>();
for (int i=0;i<playerSelection.size();i++) for(Counters c_1:Counters.values())
{ if(card.getCounters(c_1) != 0) choices.add(c_1.getName());
String s = playerSelection.get(i); if (choices.size() > 0)
if (s.equals("Human") && AllZone.Human_PoisonCounter.getPoisonCounters() > 0) card.addCounter(Counters.getType((choices.size() == 1 ? choices.get(0) : AllZone.Display.getChoice("Select counter type", choices.toArray()).toString())), 1);
AllZone.Human_PoisonCounter.addPoisonCounters(1); }
if (s.equals("Computer") && AllZone.Computer_PoisonCounter.getPoisonCounters() > 0) boolean selComputer = false;
AllZone.Computer_PoisonCounter.addPoisonCounters(1); boolean selHuman = false;
} @Override
public void selectPlayer(String player){
if (player.equals("Human") && selHuman == false)
{
selHuman = true;
if (AllZone.Human_PoisonCounter.getPoisonCounters() > 0)
AllZone.Human_PoisonCounter.addPoisonCounters(1);
}
if (player.equals("Computer") && selComputer == false)
{
selComputer = true;
if (AllZone.Computer_PoisonCounter.getPoisonCounters() > 0)
AllZone.Computer_PoisonCounter.addPoisonCounters(1);
}
}
});
} }
else //comp else //comp
{ {