Class Fortune

Object
Fortune
All Implemented Interfaces:
Attributes

public class Fortune extends Object implements Attributes
Fortunes are bonuses that can be applied to knights before they go on quests. As the bonus can apply to any attribute, they implement the Attributes interface. Fortunes are immutable.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Fortune(String name, int hpBonus, int armor, int hitModifier)
    Basic constructor assuming no DamageDice replacement
    Fortune(String name, int hpBonus, int armor, int hitModifier, DiceType type)
    Constructor with a damage dice replacement by DiceType type
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Return the amount of bonus to the knights armor
    Returns the replacement damage dice for the knight.
    int
    Returns the the bonus to the knights hit modifier.
    int
    return the amount of bonus to the knights maxHP
    returns the name of the fortune card - often named after the knightly virtues.
    Returns a nicely formatted String value of the fortune.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Fortune

      public Fortune(String name, int hpBonus, int armor, int hitModifier)
      Basic constructor assuming no DamageDice replacement
      Parameters:
      name - name of fortune card
      hpBonus - hp bonus
      armor - armor bonus
      hitModifier - to hit bonus
    • Fortune

      public Fortune(String name, int hpBonus, int armor, int hitModifier, DiceType type)
      Constructor with a damage dice replacement by DiceType type
      Parameters:
      name - name of fortune card
      hpBonus - hp bonus
      armor - armor bonus
      hitModifier - to hit bonus
      type - the damage dice replacement value
  • Method Details

    • getArmor

      public int getArmor()
      Return the amount of bonus to the knights armor
      Specified by:
      getArmor in interface Attributes
      Returns:
      whole number value
    • getMaxHP

      public int getMaxHP()
      return the amount of bonus to the knights maxHP
      Specified by:
      getMaxHP in interface Attributes
      Returns:
      whole number value
    • getDamageDie

      public DiceType getDamageDie()
      Returns the replacement damage dice for the knight.
      Specified by:
      getDamageDie in interface Attributes
      Returns:
      DiceType of the knight damage die
    • getHitModifier

      public int getHitModifier()
      Returns the the bonus to the knights hit modifier.
      Specified by:
      getHitModifier in interface Attributes
      Returns:
      whole number value
    • getName

      public String getName()
      returns the name of the fortune card - often named after the knightly virtues.
      Returns:
      Name of the knight card
    • toString

      public String toString()
      Returns a nicely formatted String value of the fortune. Examples look like:
       +======================+
       |Nobility              |
       |HP Bonus:          +10|
       |AC Bonus:           +1|
       |Hit Bonus:          +1|
       |Damage Adj:          -|
       +======================+
       
      Spacing is -22s for the name, 12s for the HP Bonus, 12s for the AC bonus, 11s for the hit bonus and 10s for the damage adj. Note: AC is armor., so you are looking at using the following methods:
      Overrides:
      toString in class Object
      Returns:
      String value of the fortune