Class MOB
Object
MOB
- All Implemented Interfaces:
Attributes
- Direct Known Subclasses:
Knight
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
FieldsModifier and TypeFieldDescriptionprotected int
The armor rating of the mobprotected int
The amount of damage the MOB has takenprotected DiceType
the type of damage die used if the mob successfully strikes the targetprotected int
The hitModifier of the MOB.protected int
the maxHP of the mob -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDamage
(int damage) Adds damage to the mobs overall damage.copy()
Copies the mob to a new mob.int
getArmor()
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 Typeint
Modifier to apply to "to hit" roles before calculate hitsint
getHP()
Essentially returns the current HPs of the MOB.int
getMaxHP()
Gets the maximum hit points attribute.getName()
Returns the generic name of the MOBvoid
Resets the damage taken to 0.toString()
Builds a MOB Card for easy printing of the stats.
-
Field Details
-
hitModifier
protected int hitModifierThe hitModifier of the MOB. Required for the Attributes implementation -
armor
protected int armorThe armor rating of the mob -
maxHP
protected int maxHPthe maxHP of the mob -
damage
protected int damageThe amount of damage the MOB has taken -
damageDie
the type of damage die used if the mob successfully strikes the target
-
-
Constructor Details
-
MOB
The basic constructor for the mob. Most of these attributes never change, once set- Parameters:
name
- name of the mobhp
- maxHP of the mobarmor
- armor of the mobhitModifier
- hitModifier of the MOBdamageDie
- 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 interfaceAttributes
- 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 interfaceAttributes
- 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 interfaceAttributes
- 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
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
Description copied from interface:Attributes
Gets the Damage Die Type- Specified by:
getDamageDie
in interfaceAttributes
- Returns:
- a DiceType often ranging from D4-D12
-
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 -
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
-