Search in sources :

Example 1 with TechRoll

use of games.strategy.triplea.delegate.dataObjects.TechRoll in project triplea by triplea-game.

the class TripleAPlayer method tech.

private void tech() {
    if (getPlayerBridge().isGameOver()) {
        return;
    }
    final ITechDelegate techDelegate;
    try {
        techDelegate = (ITechDelegate) getPlayerBridge().getRemoteDelegate();
    } catch (final ClassCastException e) {
        final String errorContext = "PlayerBridge step name: " + getPlayerBridge().getStepName() + ", Remote class name: " + getPlayerBridge().getRemoteDelegate().getClass();
        // for some reason the client is not seeing or getting these errors, so print to err too
        System.err.println(errorContext);
        ClientLogger.logQuietly(errorContext, e);
        throw new IllegalStateException(errorContext, e);
    }
    final PlayerID id = getPlayerId();
    if (!soundPlayedAlreadyTechnology) {
        ClipPlayer.play(SoundPath.CLIP_PHASE_TECHNOLOGY, id);
        soundPlayedAlreadyTechnology = true;
    }
    final TechRoll techRoll = ui.getTechRolls(id);
    if (techRoll != null) {
        final TechResults techResults = techDelegate.rollTech(techRoll.getRolls(), techRoll.getTech(), techRoll.getNewTokens(), techRoll.getWhoPaysHowMuch());
        if (techResults.isError()) {
            ui.notifyError(techResults.getErrorString());
            tech();
        } else {
            ui.notifyTechResults(techResults);
        }
    }
}
Also used : ITechDelegate(games.strategy.triplea.delegate.remote.ITechDelegate) PlayerID(games.strategy.engine.data.PlayerID) TechResults(games.strategy.triplea.delegate.dataObjects.TechResults) TechRoll(games.strategy.triplea.delegate.dataObjects.TechRoll)

Aggregations

PlayerID (games.strategy.engine.data.PlayerID)1 TechResults (games.strategy.triplea.delegate.dataObjects.TechResults)1 TechRoll (games.strategy.triplea.delegate.dataObjects.TechRoll)1 ITechDelegate (games.strategy.triplea.delegate.remote.ITechDelegate)1