Class MOB

Object
MOB
All Implemented Interfaces:
Attributes
Direct Known Subclasses:
Knight

public class MOB extends Object implements Attributes
A MOB, short for Mobile Object, represents all 'moving' objects in the game, most notably monsters, though knight which is a specific type of MOB (playable) inherits from MOB as they share characteristics.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    The armor rating of the mob
    protected int
    The amount of damage the MOB has taken
    protected DiceType
    the type of damage die used if the mob successfully strikes the target
    protected int
    The hitModifier of the MOB.
    protected int
    the maxHP of the mob
  • Constructor Summary

    Constructors
    Constructor
    Description
    MOB(String name, int hp, int armor, int hitModifier, DiceType damageDie)
    The basic constructor for the mob.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addDamage(int damage)
    Adds damage to the mobs overall damage.
    Copies the mob to a new mob.
    int
    Gets the armor attribute value, often between 8-20 for a D20 system, but not fixed.
    int
    Gets the amount of damage the MOB has taken.
    Gets the Damage Die Type
    int
    Modifier to apply to "to hit" roles before calculate hits
    int
    Essentially returns the current HPs of the MOB.
    int
    Gets the maximum hit points attribute.
    Returns the generic name of the MOB
    void
    Resets the damage taken to 0.
    Builds a MOB Card for easy printing of the stats.

    Methods inherited from class Object

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

    • hitModifier

      protected int hitModifier
      The hitModifier of the MOB. Required for the Attributes implementation
    • armor

      protected int armor
      The armor rating of the mob
    • maxHP

      protected int maxHP
      the maxHP of the mob
    • damage

      protected int damage
      The amount of damage the MOB has taken
    • damageDie

      protected DiceType damageDie
      the type of damage die used if the mob successfully strikes the target
  • Constructor Details

    • MOB

      public MOB(String name, int hp, int armor, int hitModifier, DiceType damageDie)
      The basic constructor for the mob. Most of these attributes never change, once set
      Parameters:
      name - name of the mob
      hp - maxHP of the mob
      armor - armor of the mob
      hitModifier - hitModifier of the MOB
      damageDie - damageDie
  • Method Details

    • getHitModifier

      public int getHitModifier()
      Description copied from interface: Attributes
      Modifier to apply to "to hit" roles before calculate hits
      Specified by:
      getHitModifier in interface Attributes
      Returns:
      whole number value of the modifier
    • getArmor

      public int getArmor()
      Description copied from interface: Attributes
      Gets the armor attribute value, often between 8-20 for a D20 system, but not fixed.
      Specified by:
      getArmor in interface Attributes
      Returns:
      whole number value of the armor stat
    • getMaxHP

      public int getMaxHP()
      Description copied from interface: Attributes
      Gets the maximum hit points attribute. While HP can go over max, they should always be reset to maxHP
      Specified by:
      getMaxHP in interface Attributes
      Returns:
      whole number value of the HP
    • getDamage

      public int getDamage()
      Gets the amount of damage the MOB has taken. Rarely used outside of the class itself. Instead it is better to use getHP()
      Returns:
      the amount of damage the MOB has taken
    • getName

      public String getName()
      Returns the generic name of the MOB
      Returns:
      the name of the MOB
    • addDamage

      public void addDamage(int damage)
      Adds damage to the mobs overall damage.
      Parameters:
      damage - the amount to add in whole numbers
    • getHP

      public int getHP()
      Essentially returns the current HPs of the MOB. Taking the the maxHP, and subtracting the damage done, gives the current HP of the mob.
      Returns:
      the whole number value of the current hit points.
    • resetDamage

      public void resetDamage()
      Resets the damage taken to 0.
    • getDamageDie

      public DiceType getDamageDie()
      Description copied from interface: Attributes
      Gets the Damage Die Type
      Specified by:
      getDamageDie in interface Attributes
      Returns:
      a DiceType often ranging from D4-D12
    • toString

      public String toString()
      Builds a MOB Card for easy printing of the stats. The game does not currently specify the specifics of this card, nor is it tested. It is here to help with testing. You may want to grab the card from Practical1
      Overrides:
      toString in class Object
      Returns:
      formatted information about the MOB
    • copy

      public MOB copy()
      Copies the mob to a new mob. Does not care about any damage taken. When copying simply construct a new version of the mob, and return that.
      Returns:
      a copy/new MOB object