コード例 #1
0
  @Handler
  void onEvent(final PlayerDefendCountryResponseSuccessEvent event) {
    Arguments.checkIsNotNull(event, "event");

    log.debug("Event received [{}].", event);

    status(
        "You defended {} against {} in {}, destroying {} & losing {}!",
        event.getDefendingCountryName(),
        event.getAttackingPlayerName(),
        event.getAttackingCountryName(),
        Strings.pluralize(Math.abs(event.getAttackingCountryArmyDelta()), "army", "armies"),
        Strings.pluralize(Math.abs(event.getDefendingCountryArmyDelta()), "army", "armies"));

    super.onEvent(event);
  }
コード例 #2
0
 @Override
 public String toString() {
   return Strings.format(
       "{}: Label Style: [{}] | Label Alignment: [{}] | Row Height: [{}] | H-Padding: [{}]",
       getClass().getSimpleName(),
       labelStyle,
       labelAlignment,
       height,
       hPadding);
 }
コード例 #3
0
  @Handler
  void onEvent(final PlayerDefendCountryResponseDeniedEvent event) {
    Arguments.checkIsNotNull(event, "event");

    log.debug("Event received [{}].", event);

    status(
        "Whoops, it looks like you aren't authorized to defend {} against {} in {}. Reason: {}",
        getBattleDialogDefendingCountryName(),
        getBattleDialogAttackerName(),
        getBattleDialogAttackingCountryName(),
        Strings.toCase(event.getReason().toString().replaceAll("_", " "), LetterCase.LOWER));

    super.onEvent(event);
  }
コード例 #4
0
  @Override
  public Card giveCard(final Id playerId, final TurnPhase turnPhase) {
    Arguments.checkIsNotNull(playerId, "playerId");
    Arguments.checkIsNotNull(turnPhase, "turnPhase");
    final int maxCardsInHand = rules.getMaxCardsInHand(turnPhase);
    Preconditions.checkIsTrue(
        playerCardHandler.countCardsInHand(playerId) < maxCardsInHand,
        Strings.format(
            "Player [{}] has reached maximum cards in hand [{}] for [{}]",
            playerId,
            maxCardsInHand,
            turnPhase));

    final Card card = cardDealer.take();
    playerCardHandler.addCardToHand(playerId, card);
    return card;
  }
コード例 #5
0
 @Override
 public String toString() {
   return Strings.format("{}: DeltaArmyCount: {}", getClass().getSimpleName(), deltaArmyCount);
 }
コード例 #6
0
 @Override
 public String toString() {
   return Strings.format(
       "{}: {}: {}", getClass().getSimpleName(), gameMode.getClass().getSimpleName(), gameMode);
 }
コード例 #7
0
 @Override
 public String toString() {
   return Strings.format("{} | Player: [{}]", super.toString(), player);
 }