|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.haphazard.gui.engine.GraphicalObject
org.haphazard.gui.engine.MoveableGraphicalObject
org.haphazard.character.Character
A character handles everything with a person in the world
Field Summary |
Fields inherited from class org.haphazard.gui.engine.MoveableGraphicalObject |
mFacing, mLocation, mMap, mSpeedVector, mUseFogOfWar |
Fields inherited from class org.haphazard.gui.engine.GraphicalObject |
id, mDefaultSprite, mDescription, mDescriptionColor, mDescriptionDisplayTime, mDescriptionStartTime, mDimension, mLink, mName, mSpriteDisplayed, mSprites, mWeight |
Constructor Summary | |
Character()
Creates a new instance of Character |
|
Character(java.lang.String name)
Creates a new instance of Character |
Method Summary | |
void |
addBodyPart(BodyPart part)
Adds a bodypart to the character |
void |
addSkill(Skill skill)
Adds a skill to the characters repertoire |
void |
addSprite(Sprite sprite)
Adds a sprite to this object |
boolean |
canCarry(Item item)
Checks if a character can carry an item |
boolean |
canEquip(Item item)
Tests if a character can equip an item (wield if weapon, wear if clothes |
boolean |
carry(Item item)
Makes a character carry an item (adds it to the characters inventory) Hands are not included in the inventory, you'll have to "equip" the item to carry it in the hands. |
void |
createSkillNodes(java.util.Vector list,
javax.swing.tree.DefaultMutableTreeNode node,
Skill parent)
Creates and adds all children to a certain node |
Item |
drop(Item item)
Finds an item in the inventory and drops it |
javax.swing.tree.DefaultTreeModel |
getBodyTree()
Gets a treeview of the body |
CharacterAction |
getController()
Gets the controller of this character |
int |
getEquipmentWeight()
Gets the weight of the characters equipment |
java.lang.String |
getGender()
Gets the gender of the character |
javax.swing.tree.DefaultTreeModel |
getInventoryTree()
Gets a treeview of the inventory |
int |
getInventoryWeight()
Gets this characters inventory weight |
int |
getInventoryVolume()
Gets the free volume of the characters inventory |
java.util.Vector |
getItemsOnGround()
Gets the items on the tile the character is standing on |
int |
getPenalty()
Gets the characters penalty on rolls depending on wounds, weight etc |
Item |
getPrimaryWeapon()
Gets the characters primary weapon |
java.lang.String |
getPronoun()
Returns a proper pronoun to use in any textual references |
java.util.Vector |
getSkillList()
|
javax.swing.tree.DefaultTreeModel |
getSkillTree()
Gets a tree of skills |
int |
getValue(java.lang.String skill)
Gets a value of a skill |
int |
getWoundPenalty()
Gets the total penalty from wounds |
float |
getWoundStatus()
Gets a percentage of just how wounded the character is 1.0 is perfectly healthy, 0 is atleast unconscious |
java.lang.String |
heal(int bonus)
Checks the healing process of the character This function should be changed when time is introduced, wounds should then be marked with a timestamp and logged how healing proceeds |
boolean |
isDead()
Checks if the character is dead |
boolean |
isIncapacitated()
Checks if the character is incapacitated |
void |
load(java.io.InputStream stream)
Loads a character from a file |
boolean |
paintComponent(java.awt.Graphics2D g,
Map map,
java.awt.Point middleTileCoordinate)
paints the component on the screen. |
void |
remove()
Removes this character from play. |
void |
resolveExperience(java.lang.String skill,
int delta)
Resolves eventual experience |
java.lang.String |
resolveHit(int attack,
boolean critical)
Resolves the hit location and returns the BodyPart hit |
int |
roll(java.lang.String skill,
int penalty,
boolean applyWoundPenalty)
Rolls a skill, removing eventual penalties |
void |
save(java.io.OutputStream stream)
Saves the character in an XML-file |
void |
say(java.lang.String message)
Makes the character say something |
void |
setController(CharacterAction controller)
Sets the controller of this character |
void |
setGender(java.lang.String gender)
Sets the gender of the character |
void |
setNaturalWeapon(Item weapon)
Sets the characters natural weapon |
java.lang.String |
toXML(int indent)
Translates this object into an XML notation |
boolean |
wearHold(Item item)
Makes a character wear or hold an item |
Methods inherited from class org.haphazard.gui.engine.MoveableGraphicalObject |
getFacing, getLocation, getMap, loadInstance, paintComponent, setFacing, setLocation, setSpeed, update |
Methods inherited from class org.haphazard.gui.engine.GraphicalObject |
combineSprites, displayDescription, displaySprite, getAvailableSprites, getBoundingBox, getDescription, getDimension, getName, getNotResettedSprite, getResettedSprite, getWeight, isDefaultSpriteDisplayed, optimize, resetDisplayedSprite, setDefaultSprite, setDefaultSprite, setDescription, setDimension, setName, setWeight, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Character()
public Character(java.lang.String name)
name
- The name of the characterMethod Detail |
public java.lang.String getGender()
public void setGender(java.lang.String gender)
gender
- The gender to setpublic java.lang.String getPronoun()
public void setController(CharacterAction controller)
public CharacterAction getController()
public int getPenalty()
public int getWoundPenalty()
public java.lang.String resolveHit(int attack, boolean critical)
critical
- If the most critical part was hit
public boolean isIncapacitated()
public boolean isDead()
public void remove()
public java.lang.String heal(int bonus)
bonus
- Any bonuses that exists for the healing
public void addBodyPart(BodyPart part)
part
- The part to addpublic javax.swing.tree.DefaultTreeModel getBodyTree()
public float getWoundStatus()
public void setNaturalWeapon(Item weapon)
weapon
- The weapon to usepublic Item getPrimaryWeapon()
public int getValue(java.lang.String skill)
skill
- The name of the skill
public void addSkill(Skill skill)
skill
- The skill to addpublic int roll(java.lang.String skill, int penalty, boolean applyWoundPenalty)
skill
- The skill to rollpenalty
- The penalty to applyapplyWoundPenalty
- If eventual wounds make a difference
public void resolveExperience(java.lang.String skill, int delta)
skill
- The skill that is in questiondelta
- The delta value towards the difficultypublic javax.swing.tree.DefaultTreeModel getSkillTree()
public java.util.Vector getSkillList()
public boolean canEquip(Item item)
item
- The item to equip
public boolean canCarry(Item item)
item
- The item to carry
public boolean wearHold(Item item)
item
- The item to wear/hold
public boolean carry(Item item)
item
- The item to carry
public Item drop(Item item)
item
- The item to drop
public javax.swing.tree.DefaultTreeModel getInventoryTree()
public int getInventoryWeight()
public int getInventoryVolume()
public int getEquipmentWeight()
public void save(java.io.OutputStream stream)
save
in class GraphicalObject
stream
- The stream to save topublic void load(java.io.InputStream stream)
load
in class MoveableGraphicalObject
stream
- The input stream to load frompublic java.lang.String toXML(int indent)
toXML
in class MoveableGraphicalObject
indent
- The level of indentation to use
public void say(java.lang.String message)
message
- The thing to saypublic java.util.Vector getItemsOnGround()
public boolean paintComponent(java.awt.Graphics2D g, Map map, java.awt.Point middleTileCoordinate)
paintComponent
in class MoveableGraphicalObject
g
- The graphics to use to paint withmap
- the ground that "draw" this DGO. This is needed for displacementpublic void addSprite(Sprite sprite)
addSprite
in class GraphicalObject
sprite
- The sprite to addpublic void createSkillNodes(java.util.Vector list, javax.swing.tree.DefaultMutableTreeNode node, Skill parent)
list
- All skills to choose from (Strings)node
- The parent node of the skillparent
- The parent skill
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |