|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object us.asciiroth.client.core.AbstractPiece us.asciiroth.client.agents.AbstractAgent
public abstract class AbstractAgent
Abstract class for agents. It handles the use of health as a percentage chance to kill an agent.
Constructor Summary | |
---|---|
AbstractAgent(java.lang.String name,
int flags,
Color color,
int chanceToHit,
Symbol symbol)
Constructor. |
Method Summary | |
---|---|
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)
For agents, "health" is the chance of destroying an agent. |
void |
onDie(Event event,
Cell cell)
Called when the agent dies on a given cell. |
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. |
Methods inherited from class us.asciiroth.client.core.AbstractPiece |
---|
getColor, getName, getSymbol, is, not |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface us.asciiroth.client.core.Piece |
---|
getColor, getName, getSymbol, is, not |
Constructor Detail |
---|
public AbstractAgent(java.lang.String name, int flags, Color color, int chanceToHit, Symbol symbol)
name
- flags
- color
- chanceToHit
- symbol
- Method Detail |
---|
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)
changeHealth
in interface Agent
delta
- the damage to take or the adjustment to the percentage
chance to be hit.
public void onDie(Event event, Cell cell)
Agent
onDie
in interface Agent
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
|
0.7 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
© 2009 Alx Dark