|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object us.asciiroth.client.agents.AgentProxy
public abstract class AgentProxy
An agent decorator that can be subclassed to alter the behavior or appearance
of an agent, usually for a period of time (hence the implementation of the
Animated
interface). Examples include paralysis and being turned
to stone (or if you prefer, statues that can come to life).
Constructor Summary | |
---|---|
AgentProxy(Agent agent,
int flags)
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 value)
Change health. |
Agent |
getAgent()
Get the agent being proxied. |
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. |
java.lang.String |
getName()
The visible name of the piece. |
Symbol |
getSymbol()
The symbol to display for this piece. |
boolean |
is(int flag)
Does this piece have the indicated bit flag? |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface us.asciiroth.client.core.Animated |
---|
randomSeed |
Constructor Detail |
---|
public AgentProxy(Agent agent, int flags)
agent
- flags
- 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 value)
Agent
changeHealth
in interface Agent
value
- the damage to take or the adjustment to the percentage
chance to be hit.
public Agent getAgent()
public Color getColor()
Piece
getColor
in interface Piece
public java.lang.String getName()
Piece
getName
in interface Piece
public Symbol getSymbol()
Piece
getSymbol
in interface Piece
public boolean is(int flag)
Piece
is
in interface Piece
Flags
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
|
0.7 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
© 2009 Alx Dark