us.asciiroth.client.agents
Class Statue

java.lang.Object
  extended by us.asciiroth.client.agents.AgentProxy
      extended by us.asciiroth.client.agents.Statue
All Implemented Interfaces:
Agent, Animated, ColorListener, Piece

public class Statue
extends AgentProxy
implements ColorListener

A statue. Statues represent an agent, and in fact, can be turned into that agent on a color event. However, you can't wrap a player with this currently because the player cannot be serialized like that.


Field Summary
static Serializer<Statue> SERIALIZER
          Type serializer.
 
Constructor Summary
Statue(Agent agent, Color color)
          Constructor.
 
Method Summary
 int changeHealth(int value)
          Change health.
 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.
 void onColorEvent(Context ctx, Cell cell, Cell origin)
          On a color trigger, the statue turns into the agent it represents.
 void onFrame(Context ctx, Cell cell, int frame)
          Animation callback, executed once each frame for each piece animated on the board.
 void onHitBy(Event event, Cell agentLoc, Agent agent, Direction dir)
          Called when this agent is hit by another agent (another agent collides with it).
 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.
 
Methods inherited from class us.asciiroth.client.agents.AgentProxy
canEnter, getAgent, is, not, onDie, onHit, onHitBy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIALIZER

public static final Serializer<Statue> SERIALIZER
Type serializer.

Constructor Detail

Statue

public Statue(Agent agent,
              Color color)
Constructor.

Parameters:
agent -
color -
Method Detail

changeHealth

public int changeHealth(int value)
Description copied from interface: Agent
Change health. For the player, this method indicates an amount of change to health, and returns the current health of the player after being changed. For other agents, the value an adjustment to the percentage chance that the agent will be hit by an attack.

Specified by:
changeHealth in interface Agent
Overrides:
changeHealth in class AgentProxy
Parameters:
value - the damage to take or the adjustment to the percentage chance to be hit.
Returns:
returns the current health of the agent, 0 for non-player agents when they have been killed.

getColor

public Color getColor()
Description copied from interface: Piece
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.

Specified by:
getColor in interface Piece
Overrides:
getColor in class AgentProxy
Returns:
the Color of this piece

getName

public java.lang.String getName()
Description copied from interface: Piece
The visible name of the piece.

Specified by:
getName in interface Piece
Overrides:
getName in class AgentProxy
Returns:
the name of the piece as displayed to the user.

getSymbol

public Symbol getSymbol()
Description copied from interface: Piece
The symbol to display for this piece.

Specified by:
getSymbol in interface Piece
Overrides:
getSymbol in class AgentProxy
Returns:
the symbol for this piece

onColorEvent

public void onColorEvent(Context ctx,
                         Cell cell,
                         Cell origin)
On a color trigger, the statue turns into the agent it represents.

Specified by:
onColorEvent in interface ColorListener
Parameters:
ctx - a context object with references to game state

onFrame

public void onFrame(Context ctx,
                    Cell cell,
                    int frame)
Description copied from interface: Animated
Animation callback, executed once each frame for each piece animated on the board.

Specified by:
onFrame in interface Animated
Overrides:
onFrame in class AgentProxy

onHitBy

public void onHitBy(Event event,
                    Cell agentLoc,
                    Agent agent,
                    Direction dir)
Description copied from interface: Agent
Called when this agent is hit by another agent (another agent collides with it). Typically the move event will be cancelled in this method, unless this agent moves itself out of the way, such as boulders attempt to do.

Specified by:
onHitBy in interface Agent
Overrides:
onHitBy in class AgentProxy

randomSeed

public boolean randomSeed()
Description copied from interface: Animated
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.

Specified by:
randomSeed in interface Animated
Returns:
true if a random frame should begin the animated piece's timeline

0.7

2009 Alx Dark