public class Knight extends MOB
| Modifier and Type | Field and Description |
|---|---|
protected int |
id
ID - set as final, as may not change after building the knight
|
protected int |
xp
keeps track of experience points.
|
| Constructor and Description |
|---|
Knight(int id,
java.lang.String name,
int hp,
int armor,
int hitmodifier,
DiceType damageDie,
int xp)
Basic constructor for the knight object
|
| Modifier and Type | Method and Description |
|---|---|
void |
addXP(int xp)
Adds a whole number to the knights current experience point value
|
Fortune |
getActiveFortune()
Gets the active fortune currently being applied to the knight.
|
int |
getArmor()
Gets the armor value of the knight.
|
DiceType |
getDamageDie()
Gets the damageDie value of the knight.
|
int |
getHitModifier()
Gets the hit modifier value of the knight.
|
java.lang.Integer |
getId()
Gets the knights id as an Integer (not int).
|
int |
getMaxHP()
Gets the maxHP value of the knight.
|
int |
getXP()
Returns the knights experience points.
|
void |
setActiveFortune(Fortune activeFortune)
Sets the active fortune.
|
java.lang.String |
toCSV()
Returns a Comma Seperated value representation of the knight.
|
java.lang.String |
toString()
The toString for the knight, returns a 'knight card' examples of the card as as follows:
|
protected int xp
protected final int id
public Knight(int id,
java.lang.String name,
int hp,
int armor,
int hitmodifier,
DiceType damageDie,
int xp)
id - the ID - should be unique across all knightsname - the name of the knighthp - the max hitpoints of the knightarmor - the armor value of the knighthitmodifier - the hit modifier of the knightdamageDie - the damage dice they use on a successful hit.xp - the xp for the knightpublic int getArmor()
getArmor in interface AttributesgetArmor in class MOBgetActiveFortune()public int getMaxHP()
getMaxHP in interface AttributesgetMaxHP in class MOBgetActiveFortune()public DiceType getDamageDie()
getDamageDie in interface AttributesgetDamageDie in class MOBgetActiveFortune()public int getHitModifier()
getHitModifier in interface AttributesgetHitModifier in class MOBgetActiveFortune()public int getXP()
public Fortune getActiveFortune()
public void setActiveFortune(Fortune activeFortune)
activeFortune - the fortune to set to the knight.public void addXP(int xp)
xp - the amount to addxppublic java.lang.Integer getId()
public java.lang.String toString()
+============================+ | Morgawse | | id: 11 | | | | Health: 35 XP: 0 | | Power: D8 Armor: 14 | | | +============================+ +============================+ | Danu of Ireland | | id: 4 | | | | Health: 40 XP: 0 | | Power: D6 Armor: 16 | | | +============================+ +============================+ | Arthur | | id: 12 | | | | Health: 40 XP: 0 | | Power: D8 Armor: 16 | | | +============================+The split for the spacing is:
public java.lang.String toCSV()
name,maxHP,armor,hitmodifer,damageDie,xp
for example, arthur, who has won zero battles, would return:
Arthur,40,16,2,D8,0This is used when writing out the file to save.