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

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


   * @param wcg
   *
   * @return Card
   */
  public Card playCard(WizardCardGraph wcg) {
    Card lead2 = os.getLead();
    StringBuilder debug = new StringBuilder();
    debug.append(id + " [lead = " + lead2 + "]");

    setLeadAndHighCard(lead2, os.getHighCard());

    if(hand.size() == 1) {
      return hand.iterator().next();
    }

    Card card;
    if(desireToTakeTrick() > 0) {
      if(lead2 == null) {
        card = leadNormal();
      } else if(canTakeTrick) {
        if(desireToTakeTrick() < 30) {
          debug.append(" take Trick High");
          card = takeTrickHigh();
        } else {
          card = takeTrickMedium();
        }
      } else {
        debug.append(" take sluff low");
        card = sluffLow();
      }
    } else {
      if(lead2 == null) {
        debug.append(" take sluff low");
        card = sluffLow();
      } else {
        debug.append(" take sluff High");
        card = sluffHigh();       
      }
    }
    debug.append(" = " + card.toString());
   
    if(false) {
      _logger.info(debug.toString());
    }
    return card;
View Full Code Here


    return hand.iterator().next();
  }

  private Card findHighest(List<Card> cards) {
    Card highest = null;
    for(Card card: cards) {
      if(highest == null) {
        highest = card;
        continue;
      }
      if(highest.getValue().getIndex() < card.getValue().getIndex()) {
        highest = card;
      }
    }
    return highest;
  }
View Full Code Here

    }
    return highest;
  }

  private Card findLowest(List<Card> cards) {
    Card lowest = null;
    for(Card card: cards) {
      if(lowest == null) {
        lowest = card;
        continue;
      }
      if(lowest.getValue().getIndex() > card.getValue().getIndex()) {
        lowest = card;
      }
    }
    return lowest;
  }
View Full Code Here

    this.setDoGui(true);
  }

  @Override
  public Card playCard() {
    Card cardPlayed = cbml.findCard();
    return cardPlayed;
  }
View Full Code Here

    return msg;
  }

  private Message handleNewTrump(NewTrumpEvent e) {
    Message msg = new Message(MessageType.NEW_TRUMP);
    Card card = e.getCard();
    if(card != null) {
      msg.addMsgParam(new MessageParam(MessageParamConstants.SUIT, card.getSuit().getShortName()));
      if(card.getValue() != null) {
        msg.addMsgParam(new MessageParam(MessageParamConstants.VALUE, card.getValue().getShortNm()));
      }
      msg.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));
    }
    return msg;
   
  }
View Full Code Here

   
  }

  private Message handlePlayerPlayed(PlayerPlayedEvent e) {
    Message msg = new Message(MessageType.PLAYER_PLAYED);
    Card card = e.getCard();
    msg.addMsgParam(new MessageParam(MessageParamConstants.SUIT, card.getSuit().getShortName()));
    msg.addMsgParam(new MessageParam(MessageParamConstants.VALUE, card.getValue().getShortNm()));
    msg.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));
    handlePlayerEvent(e, msg);
    return msg;
   
  }
View Full Code Here

   *
   * @param trumpSuit
   */
  public void setTrump(Suit trumpSuit) {
    List<Card> cardList = findIsolates();
    Card heart = null;
    Card spade = null;
    Card diamond = null;
    Card club = null;

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

    for(Card card: cardList) {
View Full Code Here

  }

  private Message handlePlayerWonTrick(PlayerWonTrickEvent e) {
    Message msg = new Message(MessageType.PLAYER_WON_TRICK);
    handlePlayerEvent(e, msg);
    Card card = e.getCard();
    msg.addMsgParam(new MessageParam(MessageParamConstants.SUIT, card.getSuit().getShortName()));
    msg.addMsgParam(new MessageParam(MessageParamConstants.VALUE, card.getValue().getShortNm()));
    msg.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));   
    return msg;
  }
View Full Code Here

    GuiPlayer player = findGuiPlayer(e.getPlayerId());
    if(player.getId() != getId()) {
      player.getHandJPanel().removeCard();
    }
    Card card = e.getCard();
    player.getCardPlayed().setCard(card);

    if(isLead) {
      isLead = false;
    }
View Full Code Here

  }

  @Override
  public void handleNewTrump(NewTrumpEvent e) {
    super.handleNewTrump(e);
    Card trump = e.getCard();
    if(trump == null) {
      log("No trump");
    } else if(trump.getSuit().equals(Suit.NONE)) {
      if(trump.isJester()) {
        log("No trump");
      } else {
        log("Dealer's choice");
      }
    } else {
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.