Search in sources :

Example 6 with PlayerList

use of games.strategy.engine.data.PlayerList in project triplea by triplea-game.

the class AbstractRulesAttachment method setPlayers.

private void setPlayers(final String names) throws GameParseException {
    final PlayerList pl = getData().getPlayerList();
    for (final String p : names.split(":")) {
        final PlayerID player = pl.getPlayerId(p);
        if (player == null) {
            throw new GameParseException("Could not find player. name:" + p + thisErrorMsg());
        }
        m_players.add(player);
    }
}
Also used : PlayerID(games.strategy.engine.data.PlayerID) PlayerList(games.strategy.engine.data.PlayerList) GameParseException(games.strategy.engine.data.GameParseException)

Example 7 with PlayerList

use of games.strategy.engine.data.PlayerList in project triplea by triplea-game.

the class ParserTest method testAllianceMade.

@Test
public void testAllianceMade() {
    final PlayerList players = gameData.getPlayerList();
    final PlayerID castro = players.getPlayerId("castro");
    final PlayerID chretian = players.getPlayerId("chretian");
    final RelationshipTracker alliances = gameData.getRelationshipTracker();
    assertTrue(alliances.isAllied(castro, chretian));
}
Also used : PlayerID(games.strategy.engine.data.PlayerID) PlayerList(games.strategy.engine.data.PlayerList) RelationshipTracker(games.strategy.engine.data.RelationshipTracker) Test(org.junit.jupiter.api.Test)

Aggregations

PlayerList (games.strategy.engine.data.PlayerList)7 PlayerID (games.strategy.engine.data.PlayerID)5 GameData (games.strategy.engine.data.GameData)2 HashSet (java.util.HashSet)2 Test (org.junit.jupiter.api.Test)2 Joiner (com.google.common.base.Joiner)1 GameParseException (games.strategy.engine.data.GameParseException)1 PlayerManager (games.strategy.engine.data.PlayerManager)1 RelationshipTracker (games.strategy.engine.data.RelationshipTracker)1 IGame (games.strategy.engine.framework.IGame)1 DefaultPlayerBridge (games.strategy.engine.gamePlayer.DefaultPlayerBridge)1 IGamePlayer (games.strategy.engine.gamePlayer.IGamePlayer)1 IPlayerBridge (games.strategy.engine.gamePlayer.IPlayerBridge)1 RemoteName (games.strategy.engine.message.RemoteName)1 INode (games.strategy.net.INode)1 AbstractTriggerAttachment (games.strategy.triplea.attachments.AbstractTriggerAttachment)1 ICondition (games.strategy.triplea.attachments.ICondition)1 PlayerAttachment (games.strategy.triplea.attachments.PlayerAttachment)1 TriggerAttachment (games.strategy.triplea.attachments.TriggerAttachment)1 UiContext (games.strategy.triplea.ui.UiContext)1