Package dev.davwheat

Class Card


  • public class Card
    extends java.lang.Object
    Represents a Card in the Deck. Contains info about the card (message, balance change as a result), and methods to take the action.
    • Constructor Summary

      Constructors 
      Constructor Description
      Card​(java.lang.String cardMessage, double balanceChange, boolean missNextTurn)
      Creates a new Card.
    • Method Summary

      Modifier and Type Method Description
      void printCard()  
      void takeAction​(Player actor)
      Takes the action on the card against a specified player and prints info about that action.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • message

        public final java.lang.String message
      • balanceChange

        public final double balanceChange
      • missNextTurn

        public final boolean missNextTurn
    • Constructor Detail

      • Card

        public Card​(java.lang.String cardMessage,
                    double balanceChange,
                    boolean missNextTurn)
        Creates a new Card.
        Parameters:
        cardMessage - Message displayed on the card
        balanceChange - Balance change caused by the card
        missNextTurn - Whether to miss next turn because of this card
    • Method Detail

      • takeAction

        public void takeAction​(Player actor)
                        throws InsufficientBalanceException
        Takes the action on the card against a specified player and prints info about that action.

        Will adjust their bank balance as required, and make them miss the next turn if needed.

        Parameters:
        actor - Player to perform actions upon
        Throws:
        InsufficientBalanceException
      • printCard

        public void printCard()