org.haphazard.system.action
Class CharacterAction

java.lang.Object
  extended byorg.haphazard.XML.MessageHandler
      extended byorg.haphazard.system.action.Action
          extended byorg.haphazard.system.action.CharacterAction
Direct Known Subclasses:
Controller, GlobalGUIController

public class CharacterAction
extends Action


Field Summary
static int ATTACK
           
static int CARRY
           
static int DEFEND
           
static int DIE
           
static int DROP
           
protected  Character mCharacter
           
static int MOVE
           
protected  Character mTarget
           
protected  GlobalWorld mWorld
           
static int NOTHING
           
static int SAY
           
static int WEAR
           
 
Fields inherited from class org.haphazard.system.action.Action
mController, mExecutionTime, mTimeStarted
 
Fields inherited from class org.haphazard.XML.MessageHandler
mMessageBuffer
 
Constructor Summary
CharacterAction(Character character)
          Creates a new instance of CharacterAction
 
Method Summary
 boolean attack(Character character)
          Mounts an attack on a specified character.
 boolean carry(Item item)
          Makes the character carry an item
 boolean defend(Character character)
           
 boolean die()
          Makes the character die
 boolean drop(Item item)
          Makes the character drop an item
 int getActionType()
          Returns the action that the character is currently performing
 Character getCharacter()
          Gets the character that is doing these actions
 boolean move(Point3D location)
          Makes the character move
 boolean move(Vector3D speed)
          Makes the character move
 boolean perform()
          Performs the action
protected  boolean performAttack()
          Performs the attack
protected  boolean performCarry()
          Performs carry
protected  boolean performDeath()
          Performs death
protected  boolean performDefend()
           
protected  boolean performDrop()
          Performs drop
protected  boolean performMove()
          Performs the move action
protected  boolean performSay()
          Performs say
protected  boolean performWear()
          Performs wear
 boolean say(java.lang.String message)
          The character exclaims something
 void setCharacter(Character character)
          Sets the character for this controller
 boolean wear(Item item)
          Makes the character wear an item
 
Methods inherited from class org.haphazard.system.action.Action
equals, start
 
Methods inherited from class org.haphazard.XML.MessageHandler
addMessage, getNextMessage, hasMessage
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mCharacter

protected Character mCharacter

mWorld

protected GlobalWorld mWorld

mTarget

protected Character mTarget

NOTHING

public static final int NOTHING
See Also:
Constant Field Values

MOVE

public static final int MOVE
See Also:
Constant Field Values

ATTACK

public static final int ATTACK
See Also:
Constant Field Values

DIE

public static final int DIE
See Also:
Constant Field Values

WEAR

public static final int WEAR
See Also:
Constant Field Values

CARRY

public static final int CARRY
See Also:
Constant Field Values

DROP

public static final int DROP
See Also:
Constant Field Values

DEFEND

public static final int DEFEND
See Also:
Constant Field Values

SAY

public static final int SAY
See Also:
Constant Field Values
Constructor Detail

CharacterAction

public CharacterAction(Character character)
Creates a new instance of CharacterAction

Parameters:
character - The character associated with this action
Method Detail

setCharacter

public void setCharacter(Character character)
Sets the character for this controller

Parameters:
character - The character to control

getCharacter

public Character getCharacter()
Gets the character that is doing these actions

Returns:
The character

getActionType

public int getActionType()
Returns the action that the character is currently performing

Returns:
An enumerated int, see public static declarations

perform

public boolean perform()
Performs the action

Overrides:
perform in class Action
Returns:
true if terminated for whatever reason

move

public boolean move(Point3D location)
Makes the character move

Parameters:
location - The coordinates to move to
Returns:
false if it cannot be performed

move

public boolean move(Vector3D speed)
Makes the character move

Parameters:
speed - the speed (and direction) the character should move in
Returns:
false if it cannot be performed

attack

public boolean attack(Character character)
Mounts an attack on a specified character. The character must be within 1.0m distance

Parameters:
character - The character to attack
Returns:
true if attack will be performed

defend

public boolean defend(Character character)

die

public boolean die()
Makes the character die

Returns:
true; always successful

wear

public boolean wear(Item item)
Makes the character wear an item

Parameters:
item - The item to wear
Returns:
true if it will be performed

carry

public boolean carry(Item item)
Makes the character carry an item

Parameters:
item - The item to carry
Returns:
true if it will be performed

drop

public boolean drop(Item item)
Makes the character drop an item

Parameters:
item - The item to drop
Returns:
true if it will be performed

say

public boolean say(java.lang.String message)
The character exclaims something

Parameters:
message - The thing to say
Returns:
true if the action can be done

performMove

protected boolean performMove()
Performs the move action

Returns:
true if CharacterAction is terminated for whatever reason

performAttack

protected boolean performAttack()
Performs the attack

Returns:
true if CharacterAction is terminated for whatever reason

performDefend

protected boolean performDefend()

performDeath

protected boolean performDeath()
Performs death

Returns:
true if the CharacterAction is terminated

performWear

protected boolean performWear()
Performs wear

Returns:
true if the CharacterAction is terminated

performCarry

protected boolean performCarry()
Performs carry

Returns:
true if the CharacterAction is terminated

performDrop

protected boolean performDrop()
Performs drop

Returns:
true if the CharacterAction is terminated

performSay

protected boolean performSay()
Performs say

Returns:
true if the CharacterAction is terminated