Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbilityPartDraw #39

Open
FredericDesgreniers opened this issue Jul 28, 2017 · 1 comment
Open

AbilityPartDraw #39

FredericDesgreniers opened this issue Jul 28, 2017 · 1 comment

Comments

@FredericDesgreniers
Copy link
Collaborator

Draws cards from a deck

Contains target and amount.

If target.target == null, assume you draw card from your deck.

Else, calling owner.getTargetPlayer(targetboard) will return the player to get the deck from.

amount.evaluateAsExpression(targetBoard, owner) will give the number of cards to draw.

@laihaotao
Copy link
Owner

Implement as follow:

  public boolean use(GameBoard targetBoard, Player owner) {
      int cardAmount = amount.evaluateAsExpression(targetBoard, owner);
      Player player;
      if (target.target == null) {
          player = owner;
      } else {
          player = targetBoard.getOtherPlayer(owner);
      }
      for (int i = 0; i < cardAmount; i++) {
          player.drawOneCard();
      }
      return true;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants