use of games.strategy.engine.data.PlayerID in project triplea by triplea-game.
the class GameDataExporter method playerRepair.
private void playerRepair(final GameData data) {
for (final PlayerID player : data.getPlayerList()) {
try {
final String playerRepair = player.getRepairFrontier().getName();
final String playername = player.getName();
xmlfile.append(" <playerRepair player=\"").append(playername).append("\" frontier=\"").append(playerRepair).append("\"/>\n");
} catch (final NullPointerException npe) {
// neutral?
}
}
}
use of games.strategy.engine.data.PlayerID in project triplea by triplea-game.
the class GameDataExporter method playertechs.
private static String playertechs(final GameData data) {
final StringBuilder returnValue = new StringBuilder();
for (final PlayerID player : data.getPlayerList()) {
if (player.getTechnologyFrontierList().getFrontiers().size() > 0) {
returnValue.append(" <playerTech player=\"").append(player.getName()).append("\">\n");
for (final TechnologyFrontier frontier : player.getTechnologyFrontierList().getFrontiers()) {
returnValue.append(" <category name=\"").append(frontier.getName()).append("\">\n");
for (final TechAdvance tech : frontier.getTechs()) {
String name = tech.getName();
final String cat = tech.getProperty();
for (final String definedName : TechAdvance.ALL_PREDEFINED_TECHNOLOGY_NAMES) {
if (definedName.equals(name)) {
name = cat;
}
}
returnValue.append(" <tech name=\"").append(name).append("\"/>\n");
}
returnValue.append(" </category>\n");
}
returnValue.append(" </playerTech>\n");
}
}
return returnValue.toString();
}
use of games.strategy.engine.data.PlayerID in project triplea by triplea-game.
the class ProUtils method getEnemyPlayers.
private static List<PlayerID> getEnemyPlayers(final PlayerID player) {
final GameData data = ProData.getData();
final List<PlayerID> enemyPlayers = new ArrayList<>();
for (final PlayerID players : data.getPlayerList().getPlayers()) {
if (!data.getRelationshipTracker().isAllied(player, players)) {
enemyPlayers.add(players);
}
}
return enemyPlayers;
}
use of games.strategy.engine.data.PlayerID in project triplea by triplea-game.
the class ProUtils method getLiveAlliedCapitals.
public static List<Territory> getLiveAlliedCapitals(final GameData data, final PlayerID player) {
final List<Territory> capitals = new ArrayList<>();
final List<PlayerID> players = getAlliedPlayers(player);
for (final PlayerID alliedPlayer : players) {
capitals.addAll(TerritoryAttachment.getAllCurrentlyOwnedCapitals(alliedPlayer, data));
}
capitals.retainAll(CollectionUtils.getMatches(capitals, Matches.territoryIsNotImpassableToLandUnits(player, data)));
capitals.retainAll(CollectionUtils.getMatches(capitals, Matches.isTerritoryAllied(player, data)));
return capitals;
}
use of games.strategy.engine.data.PlayerID in project triplea by triplea-game.
the class ProUtils method getAlliedPlayers.
private static List<PlayerID> getAlliedPlayers(final PlayerID player) {
final GameData data = ProData.getData();
final List<PlayerID> alliedPlayers = new ArrayList<>();
for (final PlayerID players : data.getPlayerList().getPlayers()) {
if (data.getRelationshipTracker().isAllied(player, players)) {
alliedPlayers.add(players);
}
}
return alliedPlayers;
}
Aggregations