- CheckStyle.

This commit is contained in:
Chris
2012-12-01 16:08:54 +00:00
parent 042dc9ab20
commit 88af2acb11
8 changed files with 105 additions and 87 deletions

View File

@@ -60,16 +60,17 @@ public enum CMatchUI implements CardContainer {
String strAvatarIcon = p.getLobbyPlayer().getPicture();
if (strAvatarIcon != null) {
final File f = new File(ForgeProps.getFile(NewConstants.IMAGE_ICON), strAvatarIcon);
if (f.exists())
if (f.exists()) {
return new ImageIcon(f.getPath()).getImage();
}
}
int iAvatar = p.getLobbyPlayer().getAvatarIndex();
return FSkin.getAvatars().get(iAvatar >= 0 ? iAvatar : defaultIndex);
}
private void setAvatar(final VField view, final Image img)
{
private void setAvatar(final VField view, final Image img) {
view.getLblAvatar().setIcon(new ImageIcon(img));
view.getLblAvatar().getResizeTimer().start();
}
@@ -100,7 +101,9 @@ public enum CMatchUI implements CardContainer {
int i = 1;
for (Player p : players) {
if (p.equals(localPlayer)) continue;
if (p.equals(localPlayer)) {
continue;
}
// A field must be initialized after it's instantiated, to update player info.
// No player, no init.
VField f = new VField(EDocID.valueOf("FIELD_" + i), p);
@@ -167,9 +170,10 @@ public enum CMatchUI implements CardContainer {
public VField getFieldViewFor(Player p) {
for (final VField f : VMatchUI.SINGLETON_INSTANCE.getFieldViews()) {
if ( f.getLayoutControl().getPlayer().equals(p))
if (f.getLayoutControl().getPlayer().equals(p)) {
return f;
}
}
return null;
}

View File

@@ -114,10 +114,15 @@ public class ControlWinLose {
GameOutcome lastGame = match.getLastGameOutcome();
if ( games.isEmpty() ) return;
if (games.isEmpty()) {
return;
}
for (Player p : Singletons.getModel().getGame().getRegisteredPlayers()) {
if (!p.getName().equals(lastGame.getWinner().getName())) continue; // not a loser
if (!p.getName().equals(lastGame.getWinner().getName())) {
continue; // not a loser
}
// remove all the lost cards from owners' decks
List<CardPrinted> losses = new ArrayList<CardPrinted>();

View File

@@ -82,7 +82,8 @@ public class GauntletWinLose extends ControlWinLose {
LobbyPlayer questPlayer = Singletons.getControl().getLobby().getQuestPlayer();
if (match.isMatchOver()) {
// In all cases, update stats.
lstEventRecords.set(gd.getCompleted(), match.getGamesWonBy(questPlayer) + " - " + ( match.getPlayedGames().size() - match.getGamesWonBy(questPlayer) ) );
lstEventRecords.set(gd.getCompleted(), match.getGamesWonBy(questPlayer) + " - "
+ (match.getPlayedGames().size() - match.getGamesWonBy(questPlayer)));
gd.setCompleted(gd.getCompleted() + 1);
// Win match case

View File

@@ -128,17 +128,21 @@ public class QuestWinLose extends ControlWinLose {
boolean isHumanWinner = outcome.getWinner().equals(questPlayer);
final List<CardPrinted> anteCards = new ArrayList<CardPrinted>();
for (Player p : Singletons.getModel().getGame().getRegisteredPlayers()) {
if (p.getLobbyPlayer().equals(questPlayer) == isHumanWinner) continue;
for(Card c : p.getCardsIn(ZoneType.Ante))
if (p.getLobbyPlayer().equals(questPlayer) == isHumanWinner) {
continue;
}
for (Card c : p.getCardsIn(ZoneType.Ante)) {
anteCards.add(CardDb.instance().getCard(c));
}
}
if (isHumanWinner) {
qc.getCards().addAllCards(anteCards);
this.anteWon(anteCards);
} else {
for(CardPrinted c : anteCards)
for (CardPrinted c : anteCards) {
qc.getCards().loseCard(c);
}
this.anteLost(anteCards);
}
}
@@ -709,8 +713,10 @@ public class QuestWinLose extends ControlWinLose {
*/
private int getCreditsRewardForAltWin(final GameLossReason whyAiLost) {
QuestPreferences qp = Singletons.getModel().getQuestPreferences();
if ( null == whyAiLost) // Felidar, Helix Pinnacle, etc.
if (null == whyAiLost) {
// Felidar, Helix Pinnacle, etc.
return qp.getPreferenceInt(QPref.REWARDS_UNDEFEATED);
}
switch (whyAiLost) {
case LifeReachedZero:
return 0; // nothing special here, ordinary kill

View File

@@ -254,7 +254,9 @@ public enum TargetingOverlay {
float length = (float) Math.sqrt(ex * ex + ey * ey);
float bendPercent = (float) Math.asin(ey / length);
if (endX > startX) bendPercent = -bendPercent;
if (endX > startX) {
bendPercent = -bendPercent;
}
Area arrow = getArrow(length, bendPercent);
AffineTransform af = g2d.getTransform();