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

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


    CardNode cardNode = new CardNode(card);

    Set keySet = cardNodeHashMapByCard.keySet();
    for (Iterator keySetIterator = keySet.iterator(); keySetIterator.hasNext();) {
      Card indexCardKey = (Card) keySetIterator.next();

      CardNode indexedNode = cardNodeHashMapByCard.get(indexCardKey);
      int indexValue = pc.getIndex(indexCardKey.getValue());

      int cardValue = pc.getIndex(card.getValue());
     
      if ( indexValue + 1 == cardValue) {
        indexedNode.addHeavierNode(cardNode);
View Full Code Here


    // no cards have been played yet, so anything is available.
    if(trickTracker.isLead()) {
      return true;
    }

    Card lead = null;
    for(Play play : trickTracker.getPlayCollection() ) {
      Card temp = play.getCard();
      if(temp.getSuit().equals(Suit.NONE)) {
        if(temp.getValue().equals(Value.JESTER)) {
          // jester played, so find the next non-jester for what's lead.
          continue;
        }
        // wizard lead so anything can be played
        return true;
View Full Code Here

    gameEventNotifier.notify(new NewTrickEvent());
    round.newTrick();
    Trick trick = round.getCurrentTrick();
    TrickTracker trickTracker = new TrickTracker(trump);
    for (Player player: new PlayerIterator(_playerCollection, lead)) {
      Card card = null;
      for (boolean isValid = false; isValid == false;) {
        // need to make sure the card is valid. otherwise repeat
        gameEventNotifier.notify(new PlayerNeedsToPlay(player.getId()));
        card = player.playCard();
        if (ValidityChecker.checkValidity(trickTracker, trump, card, player)) {
          isValid = true;
          gameEventNotifier.notify(new PlayerPlayedEvent(player.getId(), card));
          player.playCardIsValid(card);
        } else {
          player.playCardIsNotValid(card);
        }
      }
      trickTracker.addCardPlayed(player.getId(), card);
      trick.add(new Play(player.getId(), card));
      if (card != null && card.isWizard()) {
        trick.setWizardPlayed(true);
      }
    }
    int winnerId = trickTracker.winningPlay().getPlayerId();
    Card winningCard = trickTracker.winningPlay().getCard();
    trick.setWinner(winnerId);
    gameEventNotifier.notify(new PlayerWonTrickEvent(winnerId, winningCard));

    return trickTracker;
  }
View Full Code Here

      dealer = (dealer + 1)% _playerCollection.size();
      lead = (dealer + 1)% _playerCollection.size();
      gameEventNotifier.notify(new NewRoundEvent(roundId));
      _game.newRound(roundId);
      Round round = _game.getCurrentRound();
      Card trump = dealCards(roundId, dealer, lead);
      gameEventNotifier.notify(new NewTrumpEvent(trump));
      round.setTrump(trump);

      if(trump != null && trump.getValue().equals(Value.WIZARD)) {
        Player trumpPicker = _playerCollection.get(dealer);
        //_logger.info(trumpPicker.getName() + " gets to pick trump.");
        trump = new Card(null, trumpPicker.pickTrump(), -1);
        gameEventNotifier.notify(new NewTrumpEvent(trump));
        round.setTrump(trump);
      }
      int cardsDealt = roundId;
      Bid bid = bid(trump, lead, cardsDealt, round);
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.