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

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


    int spadeStrength = 0;
    int diamondStrength = 0;
    int clubStrength = 0;

    for (Card card:this.hand) {
      Suit suit = card.getSuit();
      Value value = card.getValue();
      if(suit.equals(Suit.NONE)) {
        // nothing
      } else if(suit.equals(Suit.HEART)) {
        heartStrength += value.getIndex();
      } else if(suit.equals(Suit.SPADE)) {
        spadeStrength += value.getIndex();
      } else if(suit.equals(Suit.DIAMOND)) {
        diamondStrength += value.getIndex();
      } else if(suit.equals(Suit.CLUB)) {
        clubStrength += value.getIndex();
      }
    }

    if(heartCount >= spadeCount && heartCount >= clubCount && heartCount >= diamondCount) {
View Full Code Here


    List<CardNode> wizardCardNodes = new ArrayList<CardNode>();
    List<CardNode> jesterCardNodes = new ArrayList<CardNode>();

    for(Card card: cardList) {
      Suit suit = card.getSuit();
      if(suit.equals(Suit.HEART)) {
        heart = card;
      } else if(suit.equals(Suit.DIAMOND)) {
        diamond = card;
      } else if(suit.equals(Suit.CLUB)) {
        club = card;
      } else if(suit.equals(Suit.SPADE)) {
        spade = card;
      } else if (card.getValue().equals(Value.JESTER)) {
        jesterCardNodes.add(findCardNode(card));
      } else if (card.getValue().equals(Value.WIZARD)) {
        wizardCardNodes.add(findCardNode(card));
View Full Code Here

    for(MessageParam mp:mps) {
      if(mp.getName().equals(MessageParamConstants.SUIT.toString())) {
        suitShortName = mp.getValue();
      }
    }
    Suit suit = Suit.findSuitByShortName(suitShortName);
    return suit;
  }
View Full Code Here

        valueShortName = mp.getValue();
      } else if(mp.getName().equals(MessageParamConstants.INDEX.toString())) {
        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

    } 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()));
View Full Code Here

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

      }
    }
    if(suitShortName == null) {
      return null;
    }
    Suit suit = Suit.findSuitByShortName(suitShortName);
    Value value;
    if(valueShortName != null) {
      value = Value.findValueByShortName(valueShortName);
    } else {
      value = null;
View Full Code Here

   * Document the countCard method
   *
   * @param card
   */
  public void countCard(Card card) {
    Suit suit = card.getSuit();
    Value value = card.getValue();
    int index = findCardIndex(value);
    if(suit.equals(Suit.HEART)) {
      hearts[index] = 0;
    } else if(suit.equals(Suit.CLUB)) {
      clubs[index] = 0;
    } else if(suit.equals(Suit.SPADE)) {
      spades[index] = 0;
    } else if(suit.equals(Suit.DIAMOND)) {
      diamonds[index] = 0;
    } else if(suit.equals(Suit.NONE)) {
      if(value.equals(Value.WIZARD)) {
        wizard -= 1;
      } else {
        jester -= 1;
      }
View Full Code Here

   * @param lead
   * @param highCard
   * @param played
   */
  public void played(Card lead, Card highCard, Card played) {
    Suit suit = played.getSuit();
    Value value = played.getValue();
    if(suit.equals(Suit.HEART)) {
      setHearts(getHearts() + 1);
    } else if(suit.equals(Suit.SPADE)) {
      setSpades(getSpades() + 1);
    } else if(suit.equals(Suit.CLUB)) {
      setClubs(getSpades() + 1);
    } else if(suit.equals(Suit.DIAMOND)) {
      setDiamonds(getDiamonds() + 1);
    } else if(value.equals(Value.WIZARD)) {
      setWizards(getWizards() + 1);
    } else if(value.equals(Value.JESTER)) {
      setJesters(getJesters() + 1);
    }
    if(suit.equals(Suit.NONE)) {
      return;
    }
    if(lead == null) {
      return;
    }
    Suit leadSuit = lead.getSuit();
    if(leadSuit.equals(Suit.NONE)) {
      return;
    }
    // -1 means out of that suit;
    if(suit.equals(leadSuit) == false) {
      if(leadSuit.equals(Suit.HEART)) {
        setHasHearts(false);
      } else if(leadSuit.equals(Suit.SPADE)) {
        setHasSpades(false);
      } else if(leadSuit.equals(Suit.CLUB)) {
        setHasClubs(false);
      } else if(leadSuit.equals(Suit.DIAMOND)) {
        setHasDiamonds(false);
      }
    }
  }
View Full Code Here

TOP

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

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.