Package com.svanloon.game.wizard.core.card

Examples of com.svanloon.game.wizard.core.card.Card


        index = Integer.parseInt(mp.getValue());
      }
    }
    Suit suit = Suit.findSuitByShortName(suitShortName);
    Value value = Value.findValueByShortName(valueShortName);
    return new Card(value, suit, index);
  }
View Full Code Here


        cardClicked =  button;
      }
    }

    if(cardClicked != null) {
      Card card2 = cardClicked.getCard();
      String name = card2.toString();
      if(cardClicked.getY() == 0) {
        _logger.info("played Card " + name);
        this.card = cardClicked.getCard();
      } else if(cardClicked.getY() > 0) {
        for(CardButton button : buttons) {
View Full Code Here

   */
  public Card findCard() {
    waiting = true;
    while(true) {
      if(card != null) {
        Card temp = card;
        card = null;
        waiting = false;
        _logger.info("trying to play " + temp);
        return temp;
      }
View Full Code Here

    List<MessageParam> responseMps = new ArrayList<MessageParam>();
    List<MessageParam> mps = msg.getMsgParams();
    MessageType cc = msg.getMessageType();
    MessageType responseMessageType;
    if(cc.equals(MessageType.BID)) {
      Card card = getCard(mps);

      int min = findParameterAsInt(MessageParamConstants.MIN, mps);
      int max = findParameterAsInt(MessageParamConstants.MAX, mps);
      int bidNotAllowed = findParameterAsInt(MessageParamConstants.BID_NOT_ALLOWED, mps);
      int bid = player.bid(card, min, max, bidNotAllowed);

      responseMessageType = MessageType.BID;
      responseMps.add(new MessageParam(MessageParamConstants.BID, String.valueOf(bid)));
     
    //} else if (cc.equals(CommandConstants.GET_HAND)) {
   
    } else if (cc.equals(MessageType.GIVE_CARD)) {
      Card card = getCard(mps);
      player.giveCard(card);
      responseMessageType = MessageType.OK;
    } else if (cc.equals(MessageType.PICK_TRUMP)) {
      Suit suit = player.pickTrump();
      responseMessageType = MessageType.OK;
      responseMps.add(new MessageParam(MessageParamConstants.SUIT, suit.getShortName()));
    } else if (cc.equals(MessageType.PLAY_CARD)) {
      Card card = player.playCard();
      responseMessageType = MessageType.OK;
      responseMps.add(new MessageParam(MessageParamConstants.SUIT, card.getSuit().getShortName()));
      responseMps.add(new MessageParam(MessageParamConstants.VALUE, card.getValue().getShortNm()));
    } else if (cc.equals(MessageType.PLAY_CARD_IS_NOT_VALID)) {
      Card card = getCard(mps);
      player.playCardIsNotValid(card);
      responseMessageType = MessageType.OK;
    } else if (cc.equals(MessageType.PLAY_CARD_IS_VALID)) {
      Card card = getCard(mps);
      player.playCardIsValid(card);
      responseMessageType = MessageType.OK;
    } else {
      responseMessageType = MessageType.OK;
    }
View Full Code Here

      value = Value.findValueByShortName(valueShortName);
      _logger.info("valueShortName = " + valueShortName);
    }
    Suit suit = Suit.findSuitByShortName(suitShortName);
   
    return new Card(value, suit, index);
  }
View Full Code Here

      int round = getInt(mps, MessageParamConstants.ROUND);
      listener.handleNewRound(new NewRoundEvent(round));
    } else if(mt.equals(MessageType.NEW_TRICK)) {
      listener.handleNewTrick(new NewTrickEvent());
    } else if(mt.equals(MessageType.NEW_TRUMP)) {
      Card card = getCard(mps);
      listener.handleNewTrump(new NewTrumpEvent(card));
    } else if(mt.equals(MessageType.PLAYER_BID)) {
      int bid = getInt(mps, MessageParamConstants.BID);
      int id = getPlayerId(mps);
      listener.handlePlayerBid(new PlayerBidEvent(id, bid));
    } else if(mt.equals(MessageType.PLAYER_PLAYED)) {
      Card card = getCard(mps);
      int id = getPlayerId(mps);
      listener.handlePlayerPlayed(new PlayerPlayedEvent(id, card));
    } else if(mt.equals(MessageType.PLAYER_WON_TRICK)) {
      int id = getPlayerId(mps);
      Card card = getCard(mps);
      listener.handlePlayerWonTrick(new PlayerWonTrickEvent(id, card));
    } else if(mt.equals(MessageType.SCORE_EVENT)) {
      int score = getInt(mps, MessageParamConstants.SCORE);
      int id = getPlayerId(mps);
      listener.handleScore(new ScoreEvent(id, score));
View Full Code Here

    if(valueShortName != null) {
      value = Value.findValueByShortName(valueShortName);
    } else {
      value = null;
    }
    return new Card(value, suit, index);
  }
View Full Code Here

  public void handleNewTrick(NewTrickEvent e) {
    opponentSummary.newTrick();
  }

  public void handleNewTrump(NewTrumpEvent e) {
    Card trump = e.getCard();
    cardCounter.setTrump(trump);
    opponentSummary.setTrump(trump);
    wct = new WizardCardGraph(new WizardPoints());
    if(trump == null) {
      wct.setTrump(null);
    } else {
      wct.setTrump(trump.getSuit());
    }
  }
View Full Code Here

  public void handlePlayerBid(PlayerBidEvent e) {
    opponentSummary.setBid(e.getPlayerId(), e.getBid());
  }

  public void handlePlayerPlayed(PlayerPlayedEvent e) {
    Card playedCard = e.getCard();
    cardCounter.countCard(playedCard);
    opponentSummary.played(e.getPlayerId(), playedCard);
    wct.removeCard(playedCard);
  }
View Full Code Here

  @Override
  public String toString() {
    StringBuffer sb = new StringBuffer();
    Set keySet = cardNodeHashMapByCard.keySet();
    for (Iterator keySetIterator = keySet.iterator(); keySetIterator.hasNext();) {
      Card card = (Card) keySetIterator.next();
      CardNode cardNode = cardNodeHashMapByCard.get(card);
      sb.append("[{");
      sb.append(card.toString());
      sb.append("}, {");
      if (cardNode.getLighterNodeCollection() != null) {
        for (Iterator cardNodeIterator = cardNode.getLighterNodeCollection().iterator(); cardNodeIterator.hasNext();) {
          CardNode lessCardNode = (CardNode) cardNodeIterator.next();
          sb.append(lessCardNode.getCard().toString());
View Full Code Here

TOP

Related Classes of com.svanloon.game.wizard.core.card.Card

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.