Class PlayerGate

  extended by us.asciiroth.client.core.AbstractPiece
      extended by us.asciiroth.client.terrain.decorators.Decorator
          extended by us.asciiroth.client.terrain.decorators.PlayerGate
All Implemented Interfaces:
ColorListener, Piece, Terrain, TerrainProxy

public class PlayerGate
extends Decorator

A player gate decorates another terrain and tests to see if the player has a specific flag or item. It will block movement if the player does not, and optionally show a modal message to the user if he/she is blocked. (The message is modal to match the behavior of talking to an NPC).

This can be used in tandom with NPCs to simulate situations where an agent will not allow the player to pass until a condition is met. It can probably be used for other things as well.

Field Summary
static Serializer<PlayerGate> SERIALIZER
          Type serializer.
Constructor Summary
PlayerGate(Terrain terrain, java.lang.String flag, java.lang.String message)
Method Summary
 void onEnterInternal(Event event, Player player, Cell cell, Direction dir)
          Override this method in subclasses in order to augment the onEnter behavior of the decorated terrain.
 Terrain proxy(Terrain terrain)
Methods inherited from class us.asciiroth.client.terrain.decorators.Decorator
canEnter, canExit, getProxiedTerrain, is, not, onAdjacentTo, onAgentEnter, onAgentExit, onColorEvent, onDrop, onEnter, onExit, onFlyOver, onNotAdjacentTo, onPickup
Methods inherited from class us.asciiroth.client.core.AbstractPiece
getColor, getName, getSymbol
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

Field Detail


public static final Serializer<PlayerGate> SERIALIZER
Type serializer.

Constructor Detail


public PlayerGate(Terrain terrain,
                  java.lang.String flag,
                  java.lang.String message)
Method Detail


public void onEnterInternal(Event event,
                            Player player,
                            Cell cell,
                            Direction dir)
Description copied from class: Decorator
Override this method in subclasses in order to augment the onEnter behavior of the decorated terrain.


public Terrain proxy(Terrain terrain)
a new proxy, with the same behavior but wrapping a different terrain


2009 Alx Dark