rename HumanPlayer to HumanProfile.
parent
6bfa6a0784
commit
bfb498b257
|
@ -10,7 +10,7 @@ import magic.model.MagicPlayer;
|
|||
import magic.model.MagicPlayerDefinition;
|
||||
import magic.model.phase.MagicMainPhase;
|
||||
import magic.model.player.AiProfile;
|
||||
import magic.model.player.HumanPlayer;
|
||||
import magic.model.player.HumanProfile;
|
||||
import magic.model.player.PlayerProfile;
|
||||
import magic.test.TestGameBuilder;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public final class GameLoader {
|
|||
ap.setAiLevel(gameState.getDifficulty());
|
||||
pp1 = ap;
|
||||
} else {
|
||||
final HumanPlayer hp = new HumanPlayer();
|
||||
final HumanProfile hp = new HumanProfile();
|
||||
hp.setPlayerName(gameState.getPlayer(0).getName());
|
||||
pp1 = hp;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public final class GameLoader {
|
|||
ap.setAiLevel(gameState.getDifficulty());
|
||||
pp2 = ap;
|
||||
} else {
|
||||
final HumanPlayer hp = new HumanPlayer();
|
||||
final HumanProfile hp = new HumanProfile();
|
||||
hp.setPlayerName(gameState.getPlayer(1).getName());
|
||||
pp2 = hp;
|
||||
}
|
||||
|
|
|
@ -3,16 +3,16 @@ package magic.model.player;
|
|||
import java.util.Properties;
|
||||
import java.util.Map;
|
||||
|
||||
public class HumanPlayer extends PlayerProfile {
|
||||
public class HumanProfile extends PlayerProfile {
|
||||
|
||||
private static final String PLAYER_TYPE = "human";
|
||||
|
||||
public HumanPlayer(final String profileId) {
|
||||
public HumanProfile(final String profileId) {
|
||||
super(profileId);
|
||||
loadProperties();
|
||||
}
|
||||
|
||||
public HumanPlayer() {
|
||||
public HumanProfile() {
|
||||
super();
|
||||
loadProperties();
|
||||
}
|
|
@ -27,7 +27,7 @@ public abstract class PlayerProfile {
|
|||
}
|
||||
|
||||
public boolean isHuman() {
|
||||
return this instanceof HumanPlayer;
|
||||
return this instanceof HumanProfile;
|
||||
}
|
||||
|
||||
protected PlayerProfile() {
|
||||
|
@ -103,7 +103,7 @@ public abstract class PlayerProfile {
|
|||
|
||||
public static PlayerProfile getHumanPlayer(final String playerId) {
|
||||
if (playerId != null && PlayerProfiles.getPlayerProfile(playerId) != null) {
|
||||
return new HumanPlayer(playerId);
|
||||
return new HumanProfile(playerId);
|
||||
} else {
|
||||
return PlayerProfiles.getDefaultHumanPlayer();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public final class PlayerProfiles {
|
|||
// Humans
|
||||
for (Path path : getProfilePaths("human")) {
|
||||
final String profileId = path.getFileName().toString();
|
||||
final HumanPlayer player = new HumanPlayer(profileId);
|
||||
final HumanProfile player = new HumanProfile(profileId);
|
||||
profilesMap.put(profileId, player);
|
||||
}
|
||||
// AIs
|
||||
|
@ -85,7 +85,7 @@ public final class PlayerProfiles {
|
|||
}
|
||||
|
||||
private static void createDefaultHumanPlayerProfiles() throws IOException {
|
||||
final HumanPlayer profile = new HumanPlayer();
|
||||
final HumanProfile profile = new HumanProfile();
|
||||
profile.setPlayerName(getDefaultPlayerProfileName());
|
||||
profile.save();
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ public class PlayerStatistics {
|
|||
sb.append(f.getStatLine("\nDuels won / lost:\t", duelsWon, " / ", duelsLost, " (", duelsWinPercentage, "%)"));
|
||||
sb.append(f.getStatLine("\nGames played:\t", gamesPlayed));
|
||||
sb.append(f.getStatLine("\nGames won / lost\t", gamesWon, " / ", gamesLost, " (", gamesWinPercentage, "%)"));
|
||||
sb.append(f.getStatLine("\nGames conceded:\t", playerProfile instanceof HumanPlayer ? gamesConceded : StatsFormatter.NO_VALUE));
|
||||
sb.append(f.getStatLine("\nGames conceded:\t", playerProfile instanceof HumanProfile ? gamesConceded : StatsFormatter.NO_VALUE));
|
||||
sb.append(f.getStatLine("\nTurns played:\t", turnsPlayed));
|
||||
sb.append(f.getStatLine("\nAverage turns per game:\t", averageTurns));
|
||||
sb.append(f.getStatLine("\nMost used color:\t", mostColor.getName()));
|
||||
|
|
|
@ -13,7 +13,7 @@ import magic.model.MagicPayedCost;
|
|||
import magic.model.MagicDuel;
|
||||
import magic.model.MagicDeckProfile;
|
||||
import magic.model.player.AiProfile;
|
||||
import magic.model.player.HumanPlayer;
|
||||
import magic.model.player.HumanProfile;
|
||||
import magic.model.stack.MagicCardOnStack;
|
||||
import magic.model.action.MagicPlayTokenAction;
|
||||
import magic.model.action.MagicPlayCardFromStackAction;
|
||||
|
@ -112,7 +112,7 @@ public abstract class TestGameBuilder {
|
|||
|
||||
final MagicDeckProfile profile=new MagicDeckProfile("bgruw");
|
||||
|
||||
final HumanPlayer hp = new HumanPlayer();
|
||||
final HumanProfile hp = new HumanProfile();
|
||||
hp.setPlayerName("Player");
|
||||
final MagicPlayerDefinition player1=new MagicPlayerDefinition(hp,profile);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import magic.model.MagicCardDefinition;
|
|||
import magic.model.MagicDeck;
|
||||
import magic.model.MagicDuel;
|
||||
import magic.model.MagicPlayerDefinition;
|
||||
import magic.model.player.HumanPlayer;
|
||||
import magic.model.player.HumanProfile;
|
||||
import magic.model.player.PlayerProfile;
|
||||
import magic.ui.duel.viewer.CardViewer;
|
||||
import magic.ui.duel.viewer.DeckDescriptionViewer;
|
||||
|
@ -266,7 +266,7 @@ public class DuelDecksPanel extends TexturedPanel {
|
|||
}
|
||||
|
||||
private int getScore(final PlayerProfile profile) {
|
||||
if (profile instanceof HumanPlayer) {
|
||||
if (profile instanceof HumanProfile) {
|
||||
return duel.getGamesWon();
|
||||
} else {
|
||||
return duel.getGamesPlayed() - duel.getGamesWon();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package magic.ui.player;
|
||||
|
||||
import magic.model.player.HumanPlayer;
|
||||
import magic.model.player.HumanProfile;
|
||||
import magic.ui.widget.FontsAndBorders;
|
||||
import magic.ui.MagicStyle;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
@ -19,17 +19,17 @@ import magic.ui.IconImages;
|
|||
|
||||
@SuppressWarnings("serial")
|
||||
public class HumanPlayerJList
|
||||
extends JList<HumanPlayer> {
|
||||
extends JList<HumanProfile> {
|
||||
|
||||
public HumanPlayerJList() {
|
||||
setOpaque(false);
|
||||
setCellRenderer(new HumanPlayerListRenderer());
|
||||
}
|
||||
|
||||
private class HumanPlayerListRenderer extends JPanel implements ListCellRenderer<HumanPlayer> {
|
||||
private class HumanPlayerListRenderer extends JPanel implements ListCellRenderer<HumanProfile> {
|
||||
|
||||
private Color foreColor;
|
||||
private HumanPlayer profile;
|
||||
private HumanProfile profile;
|
||||
|
||||
public HumanPlayerListRenderer() {
|
||||
setOpaque(false);
|
||||
|
@ -37,8 +37,8 @@ public class HumanPlayerJList
|
|||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(
|
||||
JList<? extends HumanPlayer> list,
|
||||
HumanPlayer profile,
|
||||
JList<? extends HumanProfile> list,
|
||||
HumanProfile profile,
|
||||
int index,
|
||||
boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import magic.data.DeckUtils;
|
|||
import magic.data.DuelConfig;
|
||||
import magic.exception.InvalidDeckException;
|
||||
import magic.model.MagicDeck;
|
||||
import magic.model.player.HumanPlayer;
|
||||
import magic.model.player.HumanProfile;
|
||||
import magic.model.player.IPlayerProfileListener;
|
||||
import magic.model.player.PlayerProfile;
|
||||
import magic.model.player.PlayerProfiles;
|
||||
|
@ -197,7 +197,7 @@ public class NewDuelSettingsScreen
|
|||
}
|
||||
|
||||
private void selectNewProfile(final PlayerProfile playerProfile) {
|
||||
if (playerProfile instanceof HumanPlayer) {
|
||||
if (playerProfile instanceof HumanProfile) {
|
||||
ScreenController.showSelectHumanPlayerScreen(this, playerProfile);
|
||||
} else {
|
||||
ScreenController.showSelectAiProfileScreen(this, playerProfile);
|
||||
|
@ -232,7 +232,7 @@ public class NewDuelSettingsScreen
|
|||
}
|
||||
|
||||
private DuelPlayerPanel getDuelPlayerPanel(final PlayerProfile player) {
|
||||
if (player instanceof HumanPlayer) {
|
||||
if (player instanceof HumanProfile) {
|
||||
return playerPanels[0];
|
||||
} else {
|
||||
return playerPanels[1];
|
||||
|
@ -252,7 +252,7 @@ public class NewDuelSettingsScreen
|
|||
*/
|
||||
@Override
|
||||
public void PlayerProfileDeleted(PlayerProfile deletedPlayer) {
|
||||
if (deletedPlayer instanceof HumanPlayer) {
|
||||
if (deletedPlayer instanceof HumanProfile) {
|
||||
final PlayerProfile playerProfile = PlayerProfiles.getDefaultHumanPlayer();
|
||||
DuelConfig.getInstance().setPlayerProfile(0, playerProfile);
|
||||
getDuelPlayerPanel(playerProfile).setPlayer(playerProfile);
|
||||
|
@ -274,7 +274,7 @@ public class NewDuelSettingsScreen
|
|||
}
|
||||
|
||||
private void saveSelectedPlayerProfile(final PlayerProfile player) {
|
||||
if (player instanceof HumanPlayer) {
|
||||
if (player instanceof HumanProfile) {
|
||||
DuelConfig.getInstance().setPlayerProfile(0, player);
|
||||
} else {
|
||||
DuelConfig.getInstance().setPlayerProfile(1, player);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package magic.ui.screen;
|
||||
|
||||
import magic.model.player.HumanPlayer;
|
||||
import magic.model.player.HumanProfile;
|
||||
import magic.model.player.IPlayerProfileListener;
|
||||
import magic.model.player.PlayerProfile;
|
||||
import magic.model.player.PlayerProfiles;
|
||||
|
@ -28,9 +28,9 @@ public class SelectHumanPlayerScreen
|
|||
refreshProfilesJList(playerProfile);
|
||||
}
|
||||
|
||||
private HumanPlayer[] getPlayerProfilesArray() {
|
||||
private HumanProfile[] getPlayerProfilesArray() {
|
||||
final List<PlayerProfile> sortedPlayersList = getSortedPlayersList();
|
||||
return sortedPlayersList.toArray(new HumanPlayer[sortedPlayersList.size()]);
|
||||
return sortedPlayersList.toArray(new HumanProfile[sortedPlayersList.size()]);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -38,7 +38,7 @@ public class SelectHumanPlayerScreen
|
|||
*/
|
||||
@Override
|
||||
protected void createDefaultPlayerProfiles() throws IOException {
|
||||
final HumanPlayer profile = new HumanPlayer();
|
||||
final HumanProfile profile = new HumanProfile();
|
||||
profile.setPlayerName(getDefaultPlayerProfileName());
|
||||
profile.save();
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class SelectHumanPlayerScreen
|
|||
JOptionPane.PLAIN_MESSAGE,
|
||||
null, null, null);
|
||||
if (newName != null && !newName.trim().isEmpty()) {
|
||||
final PlayerProfile newProfile = new HumanPlayer();
|
||||
final PlayerProfile newProfile = new HumanProfile();
|
||||
newProfile.setPlayerName(newName);
|
||||
newProfile.save();
|
||||
PlayerProfiles.getPlayerProfiles().put(newProfile.getId(), newProfile);
|
||||
|
|
|
@ -24,7 +24,7 @@ import javax.swing.JScrollPane;
|
|||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
import magic.model.player.AiProfile;
|
||||
import magic.model.player.HumanPlayer;
|
||||
import magic.model.player.HumanProfile;
|
||||
import magic.model.player.IPlayerProfileListener;
|
||||
import magic.model.player.PlayerProfile;
|
||||
import magic.model.player.PlayerProfiles;
|
||||
|
|
Loading…
Reference in New Issue