Code cleanup

This commit is contained in:
drdev
2014-03-09 20:53:48 +00:00
parent 3ce0c595ce
commit 00b73bce10
2 changed files with 24 additions and 36 deletions

View File

@@ -998,8 +998,9 @@ public class PlayerControllerHuman extends PlayerController {
InputProliferate inp = new InputProliferate(); InputProliferate inp = new InputProliferate();
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
if ( inp.hasCancelled() ) if (inp.hasCancelled()) {
return null; return null;
}
return inp.getProliferationMap(); return inp.getProliferationMap();
} }
@@ -1007,7 +1008,6 @@ public class PlayerControllerHuman extends PlayerController {
public boolean chooseTargetsFor(SpellAbility currentAbility) { public boolean chooseTargetsFor(SpellAbility currentAbility) {
final TargetSelection select = new TargetSelection(currentAbility); final TargetSelection select = new TargetSelection(currentAbility);
return select.chooseTargets(null); return select.chooseTargets(null);
} }
@Override @Override

View File

@@ -1,5 +1,8 @@
package forge.player; package forge.player;
import java.awt.event.MouseEvent;
import java.util.*;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@@ -65,12 +68,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import javax.swing.*;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.*;
/** /**
* A prototype for player controller class * A prototype for player controller class
@@ -119,16 +116,6 @@ public class PlayerControllerHuman extends PlayerController {
return null; //TODO: delay ability until choice made return null; //TODO: delay ability until choice made
} }
/**
* TODO: Write javadoc for this method.
* @param c
*/
/**public void playFromSuspend(Card c) {
c.setSuspendCast(true);
HumanPlay.playCardWithoutPayingManaCost(player, c);
}**/
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.game.player.PlayerController#mayPlaySpellAbilityForFree(forge.card.spellability.SpellAbility) * @see forge.game.player.PlayerController#mayPlaySpellAbilityForFree(forge.card.spellability.SpellAbility)
*/ */
@@ -155,7 +142,6 @@ public class PlayerControllerHuman extends PlayerController {
CardPool main = deck.get(DeckSection.Main); CardPool main = deck.get(DeckSection.Main);
int mainSize = main.countAll(); int mainSize = main.countAll();
int sbSize = sideboard.countAll(); int sbSize = sideboard.countAll();
int combinedDeckSize = mainSize + sbSize; int combinedDeckSize = mainSize + sbSize;
@@ -258,7 +244,6 @@ public class PlayerControllerHuman extends PlayerController {
return Lists.newArrayList(inp.getSelected()); return Lists.newArrayList(inp.getSelected());
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.game.player.PlayerController#chooseCardsForEffect(java.util.Collection, forge.card.spellability.SpellAbility, java.lang.String, int, boolean) * @see forge.game.player.PlayerController#chooseCardsForEffect(java.util.Collection, forge.card.spellability.SpellAbility, java.lang.String, int, boolean)
*/ */
@@ -276,8 +261,9 @@ public class PlayerControllerHuman extends PlayerController {
boolean cardsAreInMyHandOrBattlefield = true; boolean cardsAreInMyHandOrBattlefield = true;
for (Card c : sourceList) { for (Card c : sourceList) {
Zone z = c.getZone(); Zone z = c.getZone();
if ( z != null && ( z.is(ZoneType.Battlefield) || z.is(ZoneType.Hand, player))) if (z != null && (z.is(ZoneType.Battlefield) || z.is(ZoneType.Hand, player))) {
continue; continue;
}
cardsAreInMyHandOrBattlefield = false; cardsAreInMyHandOrBattlefield = false;
break; break;
} }
@@ -879,7 +865,7 @@ public class PlayerControllerHuman extends PlayerController {
private byte chooseColorCommon(String message, Card c, ColorSet colors, boolean withColorless) { private byte chooseColorCommon(String message, Card c, ColorSet colors, boolean withColorless) {
int cntColors = colors.countColors(); int cntColors = colors.countColors();
if( withColorless ) cntColors++; if (withColorless) { cntColors++; }
String[] colorNames = new String[cntColors]; String[] colorNames = new String[cntColors];
int i = 0; int i = 0;
if (withColorless) if (withColorless)
@@ -987,7 +973,8 @@ public class PlayerControllerHuman extends PlayerController {
final String p2Str = String.format("Pile 2 (%s cards)", pile2.size()); final String p2Str = String.format("Pile 2 (%s cards)", pile2.size());
final String[] possibleValues = { p1Str , p2Str }; final String[] possibleValues = { p1Str , p2Str };
return GuiDialog.confirm(sa.getHostCard(), "Choose a Pile", possibleValues); return GuiDialog.confirm(sa.getHostCard(), "Choose a Pile", possibleValues);
} else { }
else {
final Card[] disp = new Card[pile1.size() + pile2.size() + 2]; final Card[] disp = new Card[pile1.size() + pile2.size() + 2];
disp[0] = new Card(-1); disp[0] = new Card(-1);
disp[0].setName("Pile 1"); disp[0].setName("Pile 1");
@@ -1053,10 +1040,11 @@ public class PlayerControllerHuman extends PlayerController {
while(true) { while(true) {
cp = chooseSinglePaperCard(sa, message, cpp, sa.getHostCard().getName()); cp = chooseSinglePaperCard(sa, message, cpp, sa.getHostCard().getName());
Card instanceForPlayer = Card.fromPaperCard(cp, player); // the Card instance for test needs a game to be tested Card instanceForPlayer = Card.fromPaperCard(cp, player); // the Card instance for test needs a game to be tested
if (instanceForPlayer.isValid(valid, sa.getHostCard().getController(), sa.getHostCard())) if (instanceForPlayer.isValid(valid, sa.getHostCard().getController(), sa.getHostCard())) {
return cp.getName(); return cp.getName();
} }
} }
}
@Override @Override
public Card chooseSingleCardForZoneChange(ZoneType destination, List<ZoneType> origin, SpellAbility sa, List<Card> fetchList, String selectPrompt, boolean b, Player decider) { public Card chooseSingleCardForZoneChange(ZoneType destination, List<ZoneType> origin, SpellAbility sa, List<Card> fetchList, String selectPrompt, boolean b, Player decider) {