Ejemplo n.º 1
0
 @Override
 public void playMonopolyCard(ResourceType resource) {
   if (clientFacade.canPlayDevCard(DevCardType.MONOPOLY)) {
     clientFacade.monopoly(
         clientFacade.convertResourceType(resource), clientFacade.getPlayerIndex());
   }
 }
Ejemplo n.º 2
0
  @Override
  public void startPlayCard() {
    getPlayCardView().reset();
    DevCardList playerDevCards = clientFacade.getPlayerDevCards();

    // Set Number of each card
    getPlayCardView().setCardAmount(DevCardType.MONOPOLY, playerDevCards.getMonopoly());
    getPlayCardView().setCardAmount(DevCardType.MONUMENT, playerDevCards.getMonument());
    getPlayCardView().setCardAmount(DevCardType.ROAD_BUILD, playerDevCards.getRoadBuilding());
    getPlayCardView().setCardAmount(DevCardType.SOLDIER, playerDevCards.getSoldier());
    getPlayCardView().setCardAmount(DevCardType.YEAR_OF_PLENTY, playerDevCards.getYearOfPlenty());

    DevCardList playerOldDevCards = clientFacade.getPlayerOldDevCards();

    // Set enabled or disabled
    int currentTurn = clientFacade.getTurnTracker().getCurrentTurn();
    boolean isPlayerTurn = (currentTurn == clientFacade.getPlayerIndex());
    boolean playing = clientFacade.getTurnTracker().getStatus().equals("Playing");
    boolean playedDevCard = clientFacade.getPlayer().isPlayedDevCard();

    if (isPlayerTurn && playing && !playedDevCard) {
      if (playerOldDevCards.getMonopoly() < 1) {
        getPlayCardView().setCardEnabled(DevCardType.MONOPOLY, false);
      } else {
        getPlayCardView().setCardEnabled(DevCardType.MONOPOLY, true);
      }

      if (playerOldDevCards.getRoadBuilding() < 1) {
        getPlayCardView().setCardEnabled(DevCardType.ROAD_BUILD, false);
      } else {
        getPlayCardView().setCardEnabled(DevCardType.ROAD_BUILD, true);
      }

      if (playerOldDevCards.getSoldier() < 1) {
        getPlayCardView().setCardEnabled(DevCardType.SOLDIER, false);
      } else {
        getPlayCardView().setCardEnabled(DevCardType.SOLDIER, true);
      }

      if (playerOldDevCards.getYearOfPlenty() < 1) {
        getPlayCardView().setCardEnabled(DevCardType.YEAR_OF_PLENTY, false);
      } else {
        getPlayCardView().setCardEnabled(DevCardType.YEAR_OF_PLENTY, true);
      }

      //			if(playerDevCards.getMonument() < 1){
      //				getPlayCardView().setCardEnabled(DevCardType.MONUMENT, false);
      //			}
      //			else if(clientFacade.canPlayDevCard(DevCardType.MONUMENT)){
      //				getPlayCardView().setCardEnabled(DevCardType.MONUMENT, true);
      //			}
    } else {
      getPlayCardView().setCardEnabled(DevCardType.MONOPOLY, false);
      getPlayCardView().setCardEnabled(DevCardType.ROAD_BUILD, false);
      getPlayCardView().setCardEnabled(DevCardType.SOLDIER, false);
      getPlayCardView().setCardEnabled(DevCardType.YEAR_OF_PLENTY, false);
    }

    if (isPlayerTurn && playing) {
      if (clientFacade.canPlayDevCard(DevCardType.MONUMENT) && (playerDevCards.getMonument() > 0)) {
        getPlayCardView().setCardEnabled(DevCardType.MONUMENT, true);
      } else {
        getPlayCardView().setCardEnabled(DevCardType.MONUMENT, false);
      }
    } else {
      getPlayCardView().setCardEnabled(DevCardType.MONUMENT, false);
    }

    getPlayCardView().showModal();
  }
Ejemplo n.º 3
0
 @Override
 public void playMonumentCard() {
   clientFacade.monument(clientFacade.getPlayerIndex());
 }