mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- CheckStyle.
This commit is contained in:
@@ -60,16 +60,17 @@ public enum CMatchUI implements CardContainer {
|
|||||||
String strAvatarIcon = p.getLobbyPlayer().getPicture();
|
String strAvatarIcon = p.getLobbyPlayer().getPicture();
|
||||||
if (strAvatarIcon != null) {
|
if (strAvatarIcon != null) {
|
||||||
final File f = new File(ForgeProps.getFile(NewConstants.IMAGE_ICON), strAvatarIcon);
|
final File f = new File(ForgeProps.getFile(NewConstants.IMAGE_ICON), strAvatarIcon);
|
||||||
if (f.exists())
|
if (f.exists()) {
|
||||||
return new ImageIcon(f.getPath()).getImage();
|
return new ImageIcon(f.getPath()).getImage();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int iAvatar = p.getLobbyPlayer().getAvatarIndex();
|
int iAvatar = p.getLobbyPlayer().getAvatarIndex();
|
||||||
return FSkin.getAvatars().get(iAvatar >= 0 ? iAvatar : defaultIndex);
|
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().setIcon(new ImageIcon(img));
|
||||||
view.getLblAvatar().getResizeTimer().start();
|
view.getLblAvatar().getResizeTimer().start();
|
||||||
}
|
}
|
||||||
@@ -100,7 +101,9 @@ public enum CMatchUI implements CardContainer {
|
|||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (Player p : players) {
|
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.
|
// A field must be initialized after it's instantiated, to update player info.
|
||||||
// No player, no init.
|
// No player, no init.
|
||||||
VField f = new VField(EDocID.valueOf("FIELD_" + i), p);
|
VField f = new VField(EDocID.valueOf("FIELD_" + i), p);
|
||||||
@@ -167,9 +170,10 @@ public enum CMatchUI implements CardContainer {
|
|||||||
|
|
||||||
public VField getFieldViewFor(Player p) {
|
public VField getFieldViewFor(Player p) {
|
||||||
for (final VField f : VMatchUI.SINGLETON_INSTANCE.getFieldViews()) {
|
for (final VField f : VMatchUI.SINGLETON_INSTANCE.getFieldViews()) {
|
||||||
if ( f.getLayoutControl().getPlayer().equals(p))
|
if (f.getLayoutControl().getPlayer().equals(p)) {
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,10 +114,15 @@ public class ControlWinLose {
|
|||||||
|
|
||||||
|
|
||||||
GameOutcome lastGame = match.getLastGameOutcome();
|
GameOutcome lastGame = match.getLastGameOutcome();
|
||||||
if ( games.isEmpty() ) return;
|
if (games.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (Player p : Singletons.getModel().getGame().getRegisteredPlayers()) {
|
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
|
// remove all the lost cards from owners' decks
|
||||||
List<CardPrinted> losses = new ArrayList<CardPrinted>();
|
List<CardPrinted> losses = new ArrayList<CardPrinted>();
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ public class GauntletWinLose extends ControlWinLose {
|
|||||||
LobbyPlayer questPlayer = Singletons.getControl().getLobby().getQuestPlayer();
|
LobbyPlayer questPlayer = Singletons.getControl().getLobby().getQuestPlayer();
|
||||||
if (match.isMatchOver()) {
|
if (match.isMatchOver()) {
|
||||||
// In all cases, update stats.
|
// 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);
|
gd.setCompleted(gd.getCompleted() + 1);
|
||||||
|
|
||||||
// Win match case
|
// Win match case
|
||||||
|
|||||||
@@ -128,17 +128,21 @@ public class QuestWinLose extends ControlWinLose {
|
|||||||
boolean isHumanWinner = outcome.getWinner().equals(questPlayer);
|
boolean isHumanWinner = outcome.getWinner().equals(questPlayer);
|
||||||
final List<CardPrinted> anteCards = new ArrayList<CardPrinted>();
|
final List<CardPrinted> anteCards = new ArrayList<CardPrinted>();
|
||||||
for (Player p : Singletons.getModel().getGame().getRegisteredPlayers()) {
|
for (Player p : Singletons.getModel().getGame().getRegisteredPlayers()) {
|
||||||
if (p.getLobbyPlayer().equals(questPlayer) == isHumanWinner) continue;
|
if (p.getLobbyPlayer().equals(questPlayer) == isHumanWinner) {
|
||||||
for(Card c : p.getCardsIn(ZoneType.Ante))
|
continue;
|
||||||
|
}
|
||||||
|
for (Card c : p.getCardsIn(ZoneType.Ante)) {
|
||||||
anteCards.add(CardDb.instance().getCard(c));
|
anteCards.add(CardDb.instance().getCard(c));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isHumanWinner) {
|
if (isHumanWinner) {
|
||||||
qc.getCards().addAllCards(anteCards);
|
qc.getCards().addAllCards(anteCards);
|
||||||
this.anteWon(anteCards);
|
this.anteWon(anteCards);
|
||||||
} else {
|
} else {
|
||||||
for(CardPrinted c : anteCards)
|
for (CardPrinted c : anteCards) {
|
||||||
qc.getCards().loseCard(c);
|
qc.getCards().loseCard(c);
|
||||||
|
}
|
||||||
this.anteLost(anteCards);
|
this.anteLost(anteCards);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -709,8 +713,10 @@ public class QuestWinLose extends ControlWinLose {
|
|||||||
*/
|
*/
|
||||||
private int getCreditsRewardForAltWin(final GameLossReason whyAiLost) {
|
private int getCreditsRewardForAltWin(final GameLossReason whyAiLost) {
|
||||||
QuestPreferences qp = Singletons.getModel().getQuestPreferences();
|
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);
|
return qp.getPreferenceInt(QPref.REWARDS_UNDEFEATED);
|
||||||
|
}
|
||||||
switch (whyAiLost) {
|
switch (whyAiLost) {
|
||||||
case LifeReachedZero:
|
case LifeReachedZero:
|
||||||
return 0; // nothing special here, ordinary kill
|
return 0; // nothing special here, ordinary kill
|
||||||
|
|||||||
@@ -254,7 +254,9 @@ public enum TargetingOverlay {
|
|||||||
float length = (float) Math.sqrt(ex * ex + ey * ey);
|
float length = (float) Math.sqrt(ex * ex + ey * ey);
|
||||||
float bendPercent = (float) Math.asin(ey / length);
|
float bendPercent = (float) Math.asin(ey / length);
|
||||||
|
|
||||||
if (endX > startX) bendPercent = -bendPercent;
|
if (endX > startX) {
|
||||||
|
bendPercent = -bendPercent;
|
||||||
|
}
|
||||||
|
|
||||||
Area arrow = getArrow(length, bendPercent);
|
Area arrow = getArrow(length, bendPercent);
|
||||||
AffineTransform af = g2d.getTransform();
|
AffineTransform af = g2d.getTransform();
|
||||||
|
|||||||
Reference in New Issue
Block a user