jurpe.dungeon
Class PlaceHolder

java.lang.Object
  extended by jurpe.dungeon.PlaceHolder
All Implemented Interfaces:
java.io.Serializable

public class PlaceHolder
extends java.lang.Object
implements java.io.Serializable

A placeholder is the base class for every PC or NPC displayed on a map. The placeholder retains the coordinates, the color and the name of each PC and NPC shown on a HexDungeon

See Also:
jurpe.dungeon.hexmap.HexDungeon, Serialized Form

Constructor Summary
PlaceHolder(Level level, PlaceholderType phType, java.lang.String name)
          Constructor
 
Method Summary
 java.awt.Color getBackgroundColor()
          Background color
 Cell getCell()
          Get RpgMapCell in which Placeholder is
 java.awt.Color getForegroundColor()
          Foreground color
 RpgMapPoint getLastPosition()
          Get Placeholder last position in RpgMap coordinates.
 Level getLevel()
          Get placeholder's level
 java.lang.String getName()
          Get the name of this placeholder
 RpgMapPoint getPosition()
          Get Placeholder position in RpgMap coordinates
 PlaceholderType getType()
          Return the type of this placeholder, what this placeholder stands for (monster, player, money...)
 void move(Direction direction)
          Move placeholder
 void setBackgroundColor(java.awt.Color c)
          Set background color
 void setCell(Cell c)
          Set RpgMapCell in which Placeholder is
 void setCenteredPosition()
          Set centered position for this placeholder.
 void setColors(java.awt.Color foreground, java.awt.Color background)
          Set background and foreground colors
 void setDefaultInitialPosition(java.util.Random rnd)
          Set initial random position
 void setForegroundColor(java.awt.Color color)
          Set foreground color
 void setLastPosition(RpgMapPoint rpgPoint)
          Set Placeholder last position in RpgMap coordinates.
 void setLevel(Level lvl)
          Set placeholder's level
 void setPosition(RpgMapPoint rpgPoint)
          Set Placeholder Position
 void setRandomPosition(java.util.Random rnd)
          Set a random position for this placeholder.
 java.lang.String toString()
          Describes this placeholder
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlaceHolder

public PlaceHolder(Level level,
                   PlaceholderType phType,
                   java.lang.String name)
Constructor

Parameters:
level - Dungeon level
phType - Type of this placeholder
name - Name of this placeholder
Method Detail

getName

public java.lang.String getName()
Get the name of this placeholder

Returns:
Name of placeholder

getType

public PlaceholderType getType()
Return the type of this placeholder, what this placeholder stands for (monster, player, money...)

Returns:
The type of this placeholder

getPosition

public RpgMapPoint getPosition()
Get Placeholder position in RpgMap coordinates

Returns:
Placeholder position in RpgMap coordinates

getLastPosition

public RpgMapPoint getLastPosition()
Get Placeholder last position in RpgMap coordinates. Last position is the position of the placeholder before the last movement.

Returns:
last position in RpgMap coordinates

getBackgroundColor

public java.awt.Color getBackgroundColor()
Background color

Returns:
Background color

getForegroundColor

public java.awt.Color getForegroundColor()
Foreground color

Returns:
Foreground color

setLastPosition

public void setLastPosition(RpgMapPoint rpgPoint)
Set Placeholder last position in RpgMap coordinates. Last position is the position of the placeholder before the last movement.

Parameters:
rpgPoint - position in RpgMap coordinates

setColors

public void setColors(java.awt.Color foreground,
                      java.awt.Color background)
Set background and foreground colors

Parameters:
foreground - Foreground color
background - Background color

setForegroundColor

public void setForegroundColor(java.awt.Color color)
Set foreground color

Parameters:
color - Foreground color

setBackgroundColor

public void setBackgroundColor(java.awt.Color c)
Set background color

Parameters:
c - Background color

getCell

public Cell getCell()
             throws JurpeException
Get RpgMapCell in which Placeholder is

Returns:
RpgMapCell in which Placeholder is
Throws:
JurpeException

setCell

public void setCell(Cell c)
Set RpgMapCell in which Placeholder is

Parameters:
c - Cell in which this placeholder is

setPosition

public void setPosition(RpgMapPoint rpgPoint)
                 throws JurpeException
Set Placeholder Position

Parameters:
rpgPoint - coordinates of RpgMap
Throws:
JurpeException

move

public void move(Direction direction)
          throws JurpeException
Move placeholder

Parameters:
direction - Direction to move placeholder
Throws:
JurpeException

setRandomPosition

public void setRandomPosition(java.util.Random rnd)
                       throws JurpeException
Set a random position for this placeholder. The position will be chosen among free cells (cells that are not walls or specials)

Parameters:
rnd - Random Seed
Throws:
JurpeException

toString

public java.lang.String toString()
Describes this placeholder

Overrides:
toString in class java.lang.Object
Returns:
Placeholder description

setCenteredPosition

public void setCenteredPosition()
                         throws JurpeException
Set centered position for this placeholder. The position will be chosen among free cells (cells that are not walls or specials)

Throws:
JurpeException

setDefaultInitialPosition

public void setDefaultInitialPosition(java.util.Random rnd)
                               throws JurpeException
Set initial random position

Parameters:
rnd - Random Seed
Throws:
JurpeException

getLevel

public Level getLevel()
Get placeholder's level

Returns:
Level

setLevel

public void setLevel(Level lvl)
Set placeholder's level

Parameters:
lvl - Level

Jurpe - Java Universal Role Playing Engine - http://jurpe.sourceforge.net