public abstract class GameData
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<Knight> |
activeKnights
List of the active knights, they are references, not copies.
|
protected java.util.List<Fortune> |
fortunes
List of fortunes.
|
protected java.util.List<Knight> |
knights
List of all the knights available
|
protected java.util.List<MOB> |
monsters
List of MOBs/Monsters
|
protected static java.util.Random |
random
Random number generator, used for grabbing random items for the structures.
|
| Constructor and Description |
|---|
GameData() |
| Modifier and Type | Method and Description |
|---|---|
protected Knight |
findKnight(java.lang.String nameOrId,
java.util.List<Knight> list)
Finds a knight based on nameOrId based on the a List of knights passed into it.
|
Knight |
getActive(java.lang.String nameOrId)
Gets an active knight based on a string or id.
|
java.util.List<Knight> |
getActiveKnights()
Returns list of knights currently set as active.
|
Knight |
getKnight(java.lang.String nameOrId)
Gets an knight from the all knights list based on a string or id.
|
java.util.List<Knight> |
getKnights()
Returns all knights.
|
Fortune |
getRandomFortune()
Gets a random fortune from
fortunes |
java.util.List<MOB> |
getRandomMonsters()
Gets a random monster from
monsters assuming the max number
of monsters is less than or equal to activeKnights.size() |
java.util.List<MOB> |
getRandomMonsters(int number)
Builds a list of random monsters of size number.
|
void |
removeActive(Knight kt)
Removes a knight from the
activeKnights list and resets the damage on the knight! |
abstract void |
save(java.lang.String filename)
Required for the implementing class to be able to save the file
|
boolean |
setActive(Knight kt)
Adds a knight to the
activeKnights list, as long as there are no more
than 4 knights in the list. |
protected static final java.util.Random random
fortunes.get(random.nextInt(fortunes.size()))
protected final java.util.List<Fortune> fortunes
protected final java.util.List<MOB> monsters
protected final java.util.List<Knight> knights
protected final java.util.List<Knight> activeKnights
public java.util.List<Knight> getKnights()
knightspublic java.util.List<Knight> getActiveKnights()
activeKnightspublic Knight getActive(java.lang.String nameOrId)
nameOrId - string or ID as a stringfindKnight(String, List)public Knight getKnight(java.lang.String nameOrId)
nameOrId - string or ID as a stringfindKnight(String, List)protected Knight findKnight(java.lang.String nameOrId, java.util.List<Knight> list)
nameOrId - a name or id stringlist - the list of knights to search - often knights or activeKnightsKnight.getId(),
MOB.getName()public boolean setActive(Knight kt)
activeKnights list, as long as there are no more
than 4 knights in the list.kt - knight to addpublic void removeActive(Knight kt)
activeKnights list and resets the damage on the knight!kt - knight to removeMOB.resetDamage()public Fortune getRandomFortune()
fortunespublic java.util.List<MOB> getRandomMonsters()
monsters assuming the max number
of monsters is less than or equal to activeKnights.size()public java.util.List<MOB> getRandomMonsters(int number)
number - the number of monsters to randomly grab and copyMOB.copy()public abstract void save(java.lang.String filename)
filename - name of file to save