Package cero.games

Examples of cero.games.ActionException


   * @inheritDoc
   */
  public void playerActed(ActionEvent event) throws ActionException {
    this.event = event;
    if (!canAct(event))
      throw new ActionException(
          "This action can't be played that way. Action : "
              + this.getClass().getName() + ", event : "
              + event.toString());
    if (event.getCards() != null && !event.getCards().isEmpty()) {
      if (event.getZoneFrom() == null)
        throw new ActionException("Cards must come from a zone");
      else if (!event.getZoneFrom().getSortedList().containsAll(
          event.getCards()))
        throw new ActionException(
            "Cards must come from the \"from\" zone");
    }
  }
View Full Code Here


  }

  @Override
  public void playerActed(ActionEvent event) throws ActionException {
    if (event.getCards().size() != 1)
      throw new ActionException("You must play exactly one card");
    super.playerActed(event);
  }
View Full Code Here

    }
  }

  private void validateEvent(ActionEvent event) throws ActionException {
    if (event.getCards() != null && event.getCards().size() != 0)
      throw new ActionException("You can't define the card you want to pick");
    if (event.getZoneFrom() != event.getGame().getZones().get("Stock"))
      throw new ActionException(
          "You're supposed to pick cards from the stock zone");
    if (event.getZoneTo() != event.getPlayer().getZones().get("Hand"))
      throw new ActionException(
          "You're supposed to pick cards to your hand");
  }
View Full Code Here

  @Override
  public void playerActed(ActionEvent event) throws ActionException {
    if (event.getCards() != null)
      if (event.getCards().size() != 1)
        throw new ActionException("You must play exactly one card");
    super.playerActed(event);
  }
View Full Code Here

TOP

Related Classes of cero.games.ActionException

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.