mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Convert Thrummingbird to Trigger
- Removed unused Proliferate functions - Switching Proliferate to use the Cancel button so you don't accidentally space through your Proliferate
This commit is contained in:
@@ -3494,180 +3494,6 @@ public class GameAction {
|
||||
}
|
||||
}
|
||||
|
||||
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(AllZone.HumanPlayer);
|
||||
hperms = hperms.filter(new CardListFilter(){
|
||||
public boolean addCard(Card crd)
|
||||
{
|
||||
return !crd.getName().equals("Mana Pool") /*&& crd.hasCounters()*/;
|
||||
}
|
||||
});
|
||||
|
||||
CardList cperms = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
|
||||
cperms = cperms.filter(new CardListFilter(){
|
||||
public boolean addCard(Card crd)
|
||||
{
|
||||
return !crd.getName().equals("Mana Pool") /*&& crd.hasCounters()*/;
|
||||
}
|
||||
});
|
||||
|
||||
if (c.getController().equals(AllZone.HumanPlayer))
|
||||
{
|
||||
cperms.addAll(hperms.toArray());
|
||||
final CardList unchosen = cperms;
|
||||
AllZone.InputControl.setInput(new Input() {
|
||||
private static final long serialVersionUID = -1779224307654698954L;
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.Display.showMessage("Choose permanents and/or players");
|
||||
ButtonUtil.enableOnlyOK();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectButtonOK() {
|
||||
stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectCard(Card card, PlayerZone zone)
|
||||
{
|
||||
if(!unchosen.contains(card)) return;
|
||||
unchosen.remove(card);
|
||||
ArrayList<String> choices = new ArrayList<String>();
|
||||
for(Counters c_1:Counters.values())
|
||||
if(card.getCounters(c_1) != 0) choices.add(c_1.getName());
|
||||
if (choices.size() > 0)
|
||||
card.addCounter(Counters.getType((choices.size() == 1 ? choices.get(0) : GuiUtils.getChoice("Select counter type", choices.toArray()).toString())), 1);
|
||||
}
|
||||
boolean selComputer = false;
|
||||
boolean selHuman = false;
|
||||
@Override
|
||||
public void selectPlayer(Player player){
|
||||
if (player.equals(AllZone.HumanPlayer) && selHuman == false)
|
||||
{
|
||||
selHuman = true;
|
||||
if (AllZone.HumanPlayer.getPoisonCounters() > 0)
|
||||
AllZone.HumanPlayer.addPoisonCounters(1);
|
||||
}
|
||||
if (player.equals(AllZone.ComputerPlayer) && selComputer == false)
|
||||
{
|
||||
selComputer = true;
|
||||
if (AllZone.ComputerPlayer.getPoisonCounters() > 0)
|
||||
AllZone.ComputerPlayer.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("<html>Proliferate: <br>Computer selects ");
|
||||
if (cperms.size() == 0 && hperms.size() == 0 && AllZone.HumanPlayer.getPoisonCounters() == 0)
|
||||
sb.append("<b>nothing</b>.");
|
||||
else
|
||||
{
|
||||
if (cperms.size()>0) {
|
||||
sb.append("<br>From Computer's permanents: <br><b>");
|
||||
for (Card c:cperms)
|
||||
{
|
||||
sb.append(c);
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append("</b><br>");
|
||||
}
|
||||
if (hperms.size()>0) {
|
||||
sb.append("<br>From Human's permanents: <br><b>");
|
||||
for (Card c:cperms)
|
||||
{
|
||||
sb.append(c);
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append("</b><br>");
|
||||
}
|
||||
if (AllZone.HumanPlayer.getPoisonCounters() > 0)
|
||||
sb.append("<b>Human Player</b>.");
|
||||
}//else
|
||||
sb.append("</html>");
|
||||
|
||||
|
||||
//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.HumanPlayer.getPoisonCounters() > 0)
|
||||
AllZone.HumanPlayer.addPoisonCounters(1);
|
||||
|
||||
} //comp
|
||||
}
|
||||
};
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(c).append(" - Proliferate (You choose any number of permanents and/or players with ");
|
||||
sb.append("counters on them, then give each another counter of a kind already there.)");
|
||||
ability.setStackDescription(sb.toString());
|
||||
|
||||
return ability;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GameAction gameAction = new GameAction();
|
||||
GenerateConstructedDeck gen = new GenerateConstructedDeck();
|
||||
|
||||
Reference in New Issue
Block a user