Package cero.games

Examples of cero.games.Player


   * @param players
   *            the player list to update
   */
  public List<Player> sort(Collection<Player> data) {
    List<Player> players = new ArrayList<Player>(data);
    Player tmp = players.get(0);
    players.remove(0);
    players.add(players.size(), tmp);
    return players;
  }
View Full Code Here


  public void roundStart(RoundEvent e) {
  }

  public void roundEnd(RoundEvent e) {
    Zone z;
    Player winner = null;
    Card52 winnersCard = null;
    boolean equality = false;
    Collection<Card> cardcol = new ArrayList<Card>();

    for (Player p : e.getGame().getPlayers()) {
      z = p.getZones().get("current");
      if (z.getCardCount() > 0) {
        Card c = z.getSortedList().get(z.getSortedList().size() - 1);
        if (c instanceof Card52) {
          if (winnersCard == null) {
            winnersCard = ((Card52) c);
            winner = p;
          } else {
            if (((Card52) c).getValue() > winnersCard.getValue()) {
              winnersCard = ((Card52) c);
              winner = p;
              equality = false;
            } else if (((Card52) c).getValue() == winnersCard
                .getValue()) {
              equality = true;
            }
          }
        }
      }
    }

    if (winner == null)
      throw new RuntimeException("There is no player ?!");

    if (!equality) {
      for (Player p : e.getGame().getPlayers()) {
        z = p.getZones().get("current");
        if (z.getCardCount() > 0) {
          for (Card c : z.getSortedList()) {
            cardcol.add(c);
            z.deleteCard(c);
          }
        }
      }
      Zone dest = winner.getZones().get("won");
      for (Card c : cardcol)
        dest.addCard(c);
    } else {
      Zone from, to;
      for (Player p : e.getGame().getPlayers()) {
View Full Code Here

    game.getRounds().get(0).addRoundListener(this);
  }

  public List<Player> sort(Collection<Player> data) {
    List<Player> players = new ArrayList<Player>(data);
    Player tmp = players.get(players.size() - 1);
    players.remove(players.size() - 1);
    players.add(0, tmp);
    return players;
  }
View Full Code Here

  }

  @Override
  public boolean executer(String parametres) {
    Game game = CommandLineLauncher.getGame();
    Player player = CommandLineLauncher.getCurrentPlayer();
    Zone from = player.getZones().get("Hand");
    Zone to = game.getZones().get("Talon");
    int cardid;
    try {
      cardid = Integer.valueOf(parametres);
    } catch (Exception e) {
View Full Code Here

  }

  @Override
  public boolean executer(String parametres) {
    Game game = CommandLineLauncher.getGame();
    Player player = CommandLineLauncher.getCurrentPlayer();
    Zone from = game.getZones().get("Stock");
    Zone to = player.getZones().get("Hand");
    //FIXME : use top card instead !
    Card playedcard = from.getSortedList().get(0);
    ArrayList<Card> colcards = new ArrayList<Card>();
    colcards.add(playedcard);
View Full Code Here

  }

  @Override
  public boolean executer(String parametres) {
    Game game = CommandLineLauncher.getGame();
    Player player = CommandLineLauncher.getCurrentPlayer();

    ActionSkipTurn action = new ActionSkipTurn();
    try {
      action.playerActed(new ActionEvent(game, player, null, null, null));
    } catch (ActionException e) {
View Full Code Here

   *            the GameEvent to listen to
   */
  public void gameStart(GameEvent e){
   
    Game g = e.getGame();
    Player p = g.getPlayers().get(0);
    DeckLayoutBase deckLayoutBase = new DeckLayoutBase();
    this.setDeckLayout(deckLayoutBase);
   
    if (g instanceof UnoGame) {
      UnoGame game = (UnoGame)g;
     
      // create graphical zones need for Uno game
      GraphicsZone Talon = new GraphicsZoneColor(game.getZones().get("Talon"));
      GraphicsZone Hand = new GraphicsZoneBase(p.getZones().get("Hand"));
      Hand.setZoneLayout(new ZoneLayoutOverLapH());
      HashMap<Player,GraphicsZone> gZoneIAMap = new HashMap<Player,GraphicsZone>();
      int i = 0;
      for(Player z : g.getPlayers()){
        if(z != p){
View Full Code Here

TOP

Related Classes of cero.games.Player

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.