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 intThe armor rating of the mobprotected intThe amount of damage the MOB has takenprotected DiceTypethe type of damage die used if the mob successfully strikes the targetprotected intThe hitModifier of the MOB.protected intthe maxHP of the mob -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDamage(int damage) Adds damage to the mobs overall damage.copy()Copies the mob to a new mob.intgetArmor()Gets the armor attribute value, often between 8-20 for a D20 system, but not fixed.intGets the amount of damage the MOB has taken.Gets the Damage Die TypeintModifier to apply to "to hit" roles before calculate hitsintgetHP()Essentially returns the current HPs of the MOB.intgetMaxHP()Gets the maximum hit points attribute.getName()Returns the generic name of the MOBvoidResets 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:AttributesModifier to apply to "to hit" roles before calculate hits- Specified by:
getHitModifierin interfaceAttributes- Returns:
- whole number value of the modifier
-
getArmor
public int getArmor()Description copied from interface:AttributesGets the armor attribute value, often between 8-20 for a D20 system, but not fixed.- Specified by:
getArmorin interfaceAttributes- Returns:
- whole number value of the armor stat
-
getMaxHP
public int getMaxHP()Description copied from interface:AttributesGets the maximum hit points attribute. While HP can go over max, they should always be reset to maxHP- Specified by:
getMaxHPin 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:AttributesGets the Damage Die Type- Specified by:
getDamageDiein 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
-