|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object us.asciiroth.client.core.Player
public class Player
This represents both the player, and the state of the game for the player. Not to be confused with the Game object which is the primary controller component for the game.
Field Summary | |
---|---|
static int |
DETECT_HIDDEN_RANGE
|
static int |
MAX_HEALTH
|
Constructor Summary | |
---|---|
Player(InputManager im,
java.lang.String name,
java.lang.String scenarioURL,
java.lang.String boardID,
int x,
int y)
|
Method Summary | |
---|---|
void |
add(int flag)
|
boolean |
canEnter(Direction direction,
Cell from,
Cell to)
Can the agent enter this terrain? This method mirrors the same method in Terrain, and both most return true for the agent to be able to move. |
int |
changeHealth(int delta)
Change health. |
void |
curePoison(Event event,
Item healer)
Cure the player of poisoning. |
void |
cureWeakness(Event event,
Item healer)
Cure the player of weakness. |
boolean |
enforceWeakness(Event event,
Cell loc,
Item item)
After picking up an item, adjust inventory if the player is weak so that he/she still only holds one item. |
PlayerBag |
getBag()
|
java.lang.String |
getBoardID()
|
Color |
getColor()
What is the color of this piece? While many piece types are permanently of color "None", many more can be parameterized with a color in order to tie them together through color-based events. |
int |
getFlags()
|
java.lang.String |
getName()
The visible name of the piece. |
java.lang.String |
getScenarioURL()
|
int |
getStartX()
|
int |
getStartY()
|
Symbol |
getSymbol()
The symbol to display for this piece. |
java.util.Map<java.lang.String,java.lang.String> |
getUnsavedMaps()
|
void |
heal(Event event,
Item healer,
int amount)
Heal the player. |
boolean |
is(int flag)
Does this piece have the indicated bit flag? |
boolean |
matchesFlagOrItem(java.lang.String token)
|
boolean |
not(int flag)
Does this piece not have the indicated flag? |
void |
onDie(Event event,
Cell agentLoc)
Called when the agent dies on a given cell. |
void |
onFrame(Context ctx,
Cell cell,
int frame)
Animation callback, executed once each frame for each piece animated on the board. |
void |
onHit(Event event,
Cell attackerLoc,
Cell agentLoc,
Agent agent)
Fired when this agent collides with the player, or if this agent is the player, when the player collides with another agent (in other words, this method will not fire if one non-player agent collides with another non-player agent). |
void |
onHitBy(Event event,
Cell agentLoc,
Agent agent,
Direction dir)
Called when this agent is hit by another agent (another agent collides with it). |
void |
onHitBy(Event event,
Cell itemLoc,
Item item,
Direction dir)
Called when this agent is hit by another item, either by being thrown, or by being wielded by the player. |
boolean |
randomSeed()
Should this animation start with a randomly seeded number as its first frame? For some animations, this can prevent all presentations of the piece on the board executing the same animation frame at the same time. |
void |
remove(int flag)
|
void |
setBoardID(java.lang.String url)
|
void |
setHealth(int health)
|
void |
setName(java.lang.String name)
|
void |
setScenarioURL(java.lang.String base)
|
void |
setStartXY(int x,
int y)
|
void |
setUnsavedMaps(java.util.Map<java.lang.String,java.lang.String> unsavedMaps)
|
void |
teleport(Event event,
Direction dir,
java.lang.String boardID,
int x,
int y)
|
boolean |
testResistance(int resistance)
|
void |
weaken(Cell cell)
Weaken the player, which will also have the consequence that the player will drop everything except the currently equipped item. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DETECT_HIDDEN_RANGE
public static final int MAX_HEALTH
Constructor Detail |
---|
public Player(InputManager im, java.lang.String name, java.lang.String scenarioURL, java.lang.String boardID, int x, int y)
Method Detail |
---|
public void add(int flag)
public boolean canEnter(Direction direction, Cell from, Cell to)
Agent
canExit
method
for agents, but it can be added if any piece ever needs it.
canEnter
in interface Agent
Terrain.canEnter(Agent, Cell, Direction)
public int changeHealth(int delta)
Agent
changeHealth
in interface Agent
delta
- the damage to take or the adjustment to the percentage
chance to be hit.
public void curePoison(Event event, Item healer)
event
- healer
- public void cureWeakness(Event event, Item healer)
event
- healer
- public boolean enforceWeakness(Event event, Cell loc, Item item)
event
- loc
- item
-
public PlayerBag getBag()
public java.lang.String getBoardID()
public Color getColor()
Piece
getColor
in interface Piece
public int getFlags()
public java.lang.String getName()
Piece
getName
in interface Piece
public java.lang.String getScenarioURL()
public int getStartX()
public int getStartY()
public Symbol getSymbol()
Piece
getSymbol
in interface Piece
public java.util.Map<java.lang.String,java.lang.String> getUnsavedMaps()
public void heal(Event event, Item healer, int amount)
event
- healer
- amount
- public boolean is(int flag)
Piece
is
in interface Piece
Flags
public boolean matchesFlagOrItem(java.lang.String token)
public boolean not(int flag)
Piece
not
in interface Piece
Flags
public void onDie(Event event, Cell agentLoc)
Agent
onDie
in interface Agent
public void onFrame(Context ctx, Cell cell, int frame)
Animated
onFrame
in interface Animated
public void onHit(Event event, Cell attackerLoc, Cell agentLoc, Agent agent)
Agent
onHit
in interface Agent
public void onHitBy(Event event, Cell agentLoc, Agent agent, Direction dir)
Agent
onHitBy
in interface Agent
public void onHitBy(Event event, Cell itemLoc, Item item, Direction dir)
Agent
onHitBy
in interface Agent
public boolean randomSeed()
Animated
randomSeed
in interface Animated
public void remove(int flag)
public void setBoardID(java.lang.String url)
public void setHealth(int health)
public void setName(java.lang.String name)
public void setScenarioURL(java.lang.String base)
public void setStartXY(int x, int y)
public void setUnsavedMaps(java.util.Map<java.lang.String,java.lang.String> unsavedMaps)
public void teleport(Event event, Direction dir, java.lang.String boardID, int x, int y)
public boolean testResistance(int resistance)
public void weaken(Cell cell)
cell
-
|
0.7 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
© 2009 Alx Dark