@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);
 }
  @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;
  }
 @Override
 public String toString() {
   return Strings.format("{}: DeltaArmyCount: {}", getClass().getSimpleName(), deltaArmyCount);
 }
 @Override
 public String toString() {
   return Strings.format(
       "{}: {}: {}", getClass().getSimpleName(), gameMode.getClass().getSimpleName(), gameMode);
 }
 @Override
 public String toString() {
   return Strings.format("{} | Player: [{}]", super.toString(), player);
 }