- Cleanup.

This commit is contained in:
Sloth
2012-10-02 07:39:41 +00:00
parent 789e16ff25
commit f91020a8b1
25 changed files with 47 additions and 37 deletions

View File

@@ -1582,7 +1582,7 @@ public class GameAction {
} else if (choices.size() == 1) {
choice = choices.get(0);
} else {
choice = (String) GuiChoose.oneOrNone("Choose", choices);
choice = GuiChoose.oneOrNone("Choose", choices);
}
if (choice == null) {
@@ -1620,7 +1620,7 @@ public class GameAction {
} else if (choices.size() == 1) {
sa = choices.get(0);
} else {
sa = (SpellAbility) GuiChoose.oneOrNone("Choose", choices);
sa = GuiChoose.oneOrNone("Choose", choices);
}
if (sa == null) {
@@ -1709,7 +1709,7 @@ public class GameAction {
cntChoice[i] = Integer.valueOf(i);
}
final Integer chosenAmount = (Integer) GuiChoose.one("Exile how many cards?", cntChoice);
final Integer chosenAmount = GuiChoose.one("Exile how many cards?", cntChoice);
System.out.println("Delve for " + chosenAmount);
final List<Card> choices = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
final List<Card> chosen = new ArrayList<Card>();
@@ -1801,7 +1801,7 @@ public class GameAction {
String chosenColor = usableColors.get(0);
if (usableColors.size() > 1) {
if (sa.getActivatingPlayer().isHuman()) {
chosenColor = (String) GuiChoose.one("Convoke for which color?",
chosenColor = GuiChoose.one("Convoke for which color?",
usableColors);
} else {
// TODO: AI for choosing which color to
@@ -1925,7 +1925,7 @@ public class GameAction {
} else if (choices.size() == 1) {
choice = choices.get(0);
} else {
choice = (String) GuiChoose.oneOrNone("Choose", choices);
choice = GuiChoose.oneOrNone("Choose", choices);
}
final SpellAbility ability = map.get(choice);

View File

@@ -1737,7 +1737,7 @@ public final class GameActionUtil {
newSA.addSplicedCards(c);
SpellAbility child = newSA;
while (child.getSubAbility() != null) {
AbilitySub newChild = (AbilitySub) child.getSubAbility().getCopy();
AbilitySub newChild = child.getSubAbility().getCopy();
child.setSubAbility(newChild);
newChild.setParent(child);
child = newChild;

View File

@@ -1967,8 +1967,8 @@ public final class AbilityFactoryChoose {
final String choiceTitle = params.containsKey("ChoiceTitle") ? params.get("ChoiceTitle") : "Choose a card ";
final Card o = GuiChoose.oneOrNone(choiceTitle, choices);
if (o != null) {
chosen.add((Card) o);
choices.remove((Card) o);
chosen.add(o);
choices.remove(o);
} else {
break;
}
@@ -2227,7 +2227,7 @@ public final class AbilityFactoryChoose {
SpellAbility chosenSA = null;
AbilityFactory afChoice = new AbilityFactory();
if (p.isHuman()) {
String choice = (String) GuiChoose.one("Choose one", choices.values());
String choice = GuiChoose.one("Choose one", choices.values());
chosenSA = afChoice.getAbility(host.getSVar(choices.inverse().get(choice)), host);
} else { //Computer AI
chosenSA = afChoice.getAbility(host.getSVar(params.get("Choices").split(",")[0]), host);

View File

@@ -838,7 +838,7 @@ public final class AbilityFactoryCopy {
if (tgtSpells.size() == 1) {
chosenSA = tgtSpells.get(0);
} else if (sa.getActivatingPlayer().isHuman()) {
chosenSA = (SpellAbility) GuiChoose.one("Select a spell to copy", tgtSpells);
chosenSA = GuiChoose.one("Select a spell to copy", tgtSpells);
} else {
chosenSA = tgtSpells.get(0);
}

View File

@@ -1248,7 +1248,7 @@ public class AbilityFactoryCounters {
}
final String prompt = "Select the number of " + type + " counters to remove";
final String o = GuiChoose.one(prompt, choices);
counterAmount = Integer.parseInt((String) o);
counterAmount = Integer.parseInt(o);
}
}
tgtCard.subtractCounter(Counters.valueOf(type), counterAmount);

View File

@@ -226,7 +226,7 @@ public class CardFactorySorceries {
break;
}
final Card playing = (Card) check;
final Card playing = check;
if (playing.isLand()) {
if (card.getController().canPlayLand()) {
card.getController().playLand(playing);
@@ -1169,7 +1169,7 @@ public class CardFactorySorceries {
final Card check = GuiChoose.oneOrNone("Select target creature with CMC < X", grave);
if (check != null) {
final Card c = (Card) check;
final Card c = check;
if (c.canBeTargetedBy(spell)) {
ab1card[0] = c;
}

View File

@@ -1064,7 +1064,7 @@ public class CardFactoryUtil {
// ability.setTargetCard((Card)o);
sourceCard.getController().discard(sourceCard, this);
final Card c1 = (Card) o;
final Card c1 = o;
Singletons.getModel().getGameAction().moveToHand(c1);
@@ -1270,7 +1270,7 @@ public class CardFactoryUtil {
final Card o = GuiChoose.oneOrNone("Select a card", sameCost);
if (o != null) {
final Card c1 = (Card) o;
final Card c1 = o;
Singletons.getModel().getGameAction().moveToHand(c1);
}
}

View File

@@ -350,7 +350,7 @@ public class CostExile extends CostPartWithList {
.oneOrNone("Exile from " + part.getFrom(), this.typeList);
if (o != null) {
final Card c = (Card) o;
final Card c = o;
this.typeList.remove(c);
part.addToList(c);
Singletons.getModel().getGameAction().exile(c);

View File

@@ -422,7 +422,7 @@ public class CostRemoveCounter extends CostPartWithList {
.oneOrNone("Remove counter(s) from a card in " + costRemoveCounter.getZone(), this.typeList);
if (o != null) {
final Card card = (Card) o;
final Card card = o;
if (card.getCounters(costRemoveCounter.getCounter()) > 0) {
this.nRemove++;

View File

@@ -277,7 +277,7 @@ public class TargetSelection {
objects = getUniqueTargets(this.ability);
for (final Object o : objects) {
if ((o instanceof Card) && objects.contains(o)) {
choices.remove((Card) o);
choices.remove(o);
}
}
}
@@ -510,7 +510,7 @@ public class TargetSelection {
final Card check = GuiChoose.oneOrNone(message, choicesWithDone);
if (check != null) {
final Card c = (Card) check;
final Card c = check;
if (!c.equals(divBattlefield) && !c.equals(divExile) && !c.equals(divGrave)
&& !c.equals(divLibrary) && !c.equals(divStack)) {
if (c.equals(dummy)) {

View File

@@ -169,7 +169,7 @@ public final class BoosterDraft implements IBoosterDraft {
JOptionPane
.showMessageDialog(null, "No custom draft files found.", "", JOptionPane.INFORMATION_MESSAGE);
} else {
final CustomLimited draft = (CustomLimited) GuiChoose.one("Choose Custom Draft",
final CustomLimited draft = GuiChoose.one("Choose Custom Draft",
myDrafts);
this.setupCustomDraft(draft);
}

View File

@@ -101,7 +101,7 @@ class CCnt implements Comparable<CCnt> {
*/
@Override
public int compareTo(CCnt o) {
int compareCount = ((CCnt) o).getCount();
int compareCount = o.getCount();
return this.count - compareCount;
}

View File

@@ -112,6 +112,7 @@ class DeckColors {
*
* @return description.
*/
@Override
public String toString() {
return color1 + '/' + color2;
}

View File

@@ -268,7 +268,7 @@ public class SealedDeckFormat {
JOptionPane.showMessageDialog(null, "No custom sealed files found.", "",
JOptionPane.INFORMATION_MESSAGE);
} else {
final CustomLimited draft = (CustomLimited) GuiChoose.one("Choose Custom Sealed Pool",
final CustomLimited draft = GuiChoose.one("Choose Custom Sealed Pool",
customs);
final BoosterGenerator bpCustom = new BoosterGenerator(draft.getCardPool());

View File

@@ -110,13 +110,13 @@ public class Combat {
public final void initiatePossibleDefenders(final Player defender) {
this.defenders.clear();
this.defenderMap.clear();
this.defenders.add((GameEntity) defender);
this.defenderMap.put((GameEntity) defender, new ArrayList<Card>());
this.defenders.add(defender);
this.defenderMap.put(defender, new ArrayList<Card>());
List<Card> planeswalkers = defender.getCardsIn(ZoneType.Battlefield);
planeswalkers = CardListUtil.filter(planeswalkers, CardPredicates.Presets.PLANEWALKERS);
for (final Card pw : planeswalkers) {
this.defenders.add((GameEntity) pw);
this.defenderMap.put((GameEntity) pw, new ArrayList<Card>());
this.defenders.add(pw);
this.defenderMap.put(pw, new ArrayList<Card>());
}
}

View File

@@ -365,7 +365,7 @@ public class Untap extends Phase implements java.io.Serializable {
if (c.isAura()) {
final GameEntity ent = c.getEnchanting();
if ((ent instanceof Card) && list.contains((Card) ent)) {
if ((ent instanceof Card) && list.contains(ent)) {
continue;
}
} else if (c.isEquipment() && c.isEquipping()) {

View File

@@ -2032,7 +2032,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
if (player.isHuman()) {
final Card o = GuiChoose.oneOrNone("Pick a creature to return to hand", graveyardCreatures);
if (o != null) {
final Card card = (Card) o;
final Card card = o;
Singletons.getModel().getGameAction().moveToHand(card);
}

View File

@@ -66,6 +66,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
// ************ BEGIN - these methods fire updateObservers() *************
@Override
public void add(final Object o, boolean update) {
final Card c = (Card) o;

View File

@@ -213,6 +213,7 @@ public class DualListBox extends JPanel {
}
private class AddListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
Object[] selected = sourceList.getSelectedValues();
addDestinationElements(selected);
@@ -238,6 +239,7 @@ public class DualListBox extends JPanel {
}
private class AddAllListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
addAll();
setButtonState();
@@ -245,6 +247,7 @@ public class DualListBox extends JPanel {
}
private class RemoveListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
Object[] selected = destList.getSelectedValues();
addSourceElements(selected);
@@ -254,6 +257,7 @@ public class DualListBox extends JPanel {
}
private class RemoveAllListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
Iterator<Object> itr = destListModel.iterator();
@@ -297,12 +301,14 @@ public class DualListBox extends JPanel {
}
private class OkListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
finishOrdering();
}
}
private class AutoListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
addAll();
finishOrdering();

View File

@@ -689,7 +689,7 @@ public final class GuiDisplayUtil {
if (null == o) {
return;
} else {
final Card c = (Card) o;
final Card c = o;
final Counters counter = GuiChoose.oneOrNone("Which type of counter?", Counters.values());
if (null == counter) {
return;
@@ -768,7 +768,7 @@ public final class GuiDisplayUtil {
if (null == o) {
return;
} else {
final Player p = (Player) o;
final Player p = o;
final Integer[] integers = new Integer[99];
for (int j = 0; j < 99; j++) {
integers[j] = Integer.valueOf(j);

View File

@@ -16,10 +16,12 @@ class UnsortedListModel extends AbstractListModel {
model = new LinkedList<Object>();
}
@Override
public int getSize() {
return model.size();
}
@Override
public Object getElementAt(int index) {
return model.get(index);
}

View File

@@ -132,7 +132,7 @@ public enum CStatistics implements ICDoc {
VStatistics.SINGLETON_INSTANCE.getLblCMC6().setText(
cmc6 + " (" + SEditorUtil.calculatePercentage(cmc6, total) + "%)");
double amc = (double) Math.round((double) tmc / (double) total * 100) / 100.0d;
double amc = Math.round((double) tmc / (double) total * 100) / 100.0d;
VStatistics.SINGLETON_INSTANCE.getLblTotal().setText("TOTAL CARDS: " + deck.countAll());
VStatistics.SINGLETON_INSTANCE.getLblTMC().setText("TOTAL MANA COST: " + tmc);

View File

@@ -46,10 +46,10 @@ public class SDisplayUtil {
newA = new int[steps];
for (int i = 0; i < steps; i++) {
newR[i] = (int) ((255 - oldR) / steps * i);
newG[i] = (int) (oldG / steps * i);
newB[i] = (int) (oldB / steps * i);
newA[i] = (int) ((255 - oldA) / steps * i);
newR[i] = ((255 - oldR) / steps * i);
newG[i] = (oldG / steps * i);
newB[i] = (oldB / steps * i);
newA[i] = ((255 - oldA) / steps * i);
}
final TimerTask tt = new TimerTask() {

View File

@@ -307,7 +307,7 @@ public class CField implements ICDoc {
choices2.add(crd);
}
}
final Card choice = (Card) GuiChoose.oneOrNone(this.title, choices2);
final Card choice = GuiChoose.oneOrNone(this.title, choices2);
if (choice != null) {
this.doAction(choice);
}

View File

@@ -288,7 +288,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
this.extraCardSpacingX = Math.round(this.cardWidth * PlayArea.EXTRA_CARD_SPACING_X);
this.cardSpacingX = (this.cardHeight - this.cardWidth) + this.extraCardSpacingX;
this.cardSpacingY = Math.round(this.cardHeight * PlayArea.CARD_SPACING_Y);
this.stackSpacingX = (int) Math.round(this.cardWidth * PlayArea.STACK_SPACING_X);
this.stackSpacingX = Math.round(this.cardWidth * PlayArea.STACK_SPACING_X);
this.stackSpacingY = Math.round(this.cardHeight * PlayArea.STACK_SPACING_Y);
int afterFirstRow;