mdh.hephaestus2
Class Global

java.lang.Object
  |
  +--mdh.hephaestus2.Global

public abstract class Global
extends Object

Constants and utility methods for Hephaestus 2.

Author:
Copyright © 2001 by Mark Hughes <kamikaze@kuoi.asui.uidaho.edu>

Field Summary
static String ABOUT
           
static int Attack
          Statistic indices.
static int Back
          Relative facings: (North + Right) % NDIRS = East, and so on.
static int Body
          Statistic indices.
static int Charm
          Statistic indices.
static int DAMAGE_EXP
          Award for causing damage to someone else, currently 1 * damage done.
static int Defense
          Statistic indices.
static String[] DIR_ABBV
          One-letter lowercase text for each direction.
static String[] DIR_NAME
          Lowercase text for each direction.
static int[] DX
          Deltas by direction.
static int[] DY
          Deltas by direction.
static int East
          Directions
static int EQ_Accessory
          Equipment positions.
static int EQ_Armor
          Equipment positions.
static int EQ_Hat
          Equipment positions.
static int EQ_Shield
          Equipment positions.
static int EQ_Weapon
          Equipment positions.
static String[] EQUIP_NAME
          Text for each equipment position.
static int Evade
          Statistic indices.
static int HitPoints
          Statistic indices.
static String HOMEPAGE
          URI of the Hephaestus home page.
static String ICON_ALERT
          Filenames of the system icons.
static String ICON_ATTACK
          Filenames of the system icons.
static String ICON_DEATH
          Filenames of the system icons.
static String ICON_DROP
          Filenames of the system icons.
static String ICON_EAST
          Filenames of the system icons.
static String ICON_EQUIP
          Filenames of the system icons.
static String ICON_ERROR
          Filenames of the system icons.
static String ICON_GAME
          Filenames of the system icons.
static String ICON_GET
          Filenames of the system icons.
static String ICON_GOLD
          Filenames of the system icons.
static String ICON_INV
          Filenames of the system icons.
static String ICON_MAGIC
          Filenames of the system icons.
static String ICON_NORTH
          Filenames of the system icons.
static String ICON_QUESTION
          Filenames of the system icons.
static String ICON_REMOVE
          Filenames of the system icons.
static String ICON_SOUTH
          Filenames of the system icons.
static String ICON_TEAST
          Filenames of the system icons.
static String ICON_TNORTH
          Filenames of the system icons.
static String ICON_TRIGGER
          Filenames of the system icons.
static String ICON_TSOUTH
          Filenames of the system icons.
static String ICON_TWEST
          Filenames of the system icons.
static String ICON_USE
          Filenames of the system icons.
static String ICON_WAIT
          Filenames of the system icons.
static String ICON_WAIT_SM
          Filenames of the system icons.
static String ICON_WEST
          Filenames of the system icons.
static int ICONSIZE
           
static String[] LAYER_NAME
          Text for each layer.
static int LAYER_Over
          Values for terrain layers.
static int LAYER_Under
          Values for terrain layers.
static int Left
          Relative facings: (North + Right) % NDIRS = East, and so on.
static int LEVEL_EXP
          Base cost for each level in experience points, currently 1000.
static int MAGIC_EXP
          Award for casting a spell, currently 10 * current level.
static int MagicAbility
          Statistic indices.
static int MagicDefense
          Statistic indices.
static int MagicEvade
          Statistic indices.
static int MagicPoints
          Statistic indices.
static int MAXPLAYERS
          Maximum number of Players allowed.
static int Mind
          Statistic indices.
static int NDIRS
          Directions
static int NEQUIP
          Equipment positions.
static int NLAYERS
          Values for terrain layers.
static int North
          Directions
static int NPRIMES
          Number of primary stats: Body, Speed, Mind, Charm.
static int NSTATS
          Statistic indices.
static int OPA_Full
          Opacity level: you can't see through it.
static String[] OPA_NAME
          Text for each opacity level.
static int OPA_None
          Opacity level: you can see through it.
static int OPA_Partial
          Opacity level: there's a "mist" over everything behind it, and you can't see through two partials.
static int Range
          Statistic indices.
static int Right
          Relative facings: (North + Right) % NDIRS = East, and so on.
static int SAVEVER
          Version number as an int, like "200".
static int South
          Directions
static int Speed
          Statistic indices.
static String[] STAT_NAME
          Text for each stat.
static long TICK_TIME
          Animation time
static int TILE_SIZE
          All tiles should be this size square.
static int TILE_SIZE2
          Half of TILE_SIZE
static int TURNS_PER_DAY
          Number of game turns (defined as 1 minute each) per day.
static int TURNS_PER_HOUR
          Number of game turns (defined as 1 minute each) per hour.
static int TYPE_Block
          Type codes for Stuff subclasses.
static int TYPE_Creature
          Type codes for Stuff subclasses.
static int TYPE_Entity
          Type codes for Stuff subclasses.
static int TYPE_Item
          Type codes for Stuff subclasses.
static int TYPE_Map
          Type codes for Stuff subclasses.
static String[] TYPE_NAME
          Text representation of TYPE_* constants.
static int TYPE_None
          Type codes for Stuff subclasses.
static int TYPE_Player
          Type codes for Stuff subclasses.
static int TYPE_Statted
          Type codes for Stuff subclasses.
static int TYPE_Stuff
          Type codes for Stuff subclasses.
static int TYPE_Terrain
          Type codes for Stuff subclasses.
static int TYPE_Thing
          Type codes for Stuff subclasses.
static String VERSION
          Minor version string, like "Hephaestus 2.00"
static String VERSIONBASE
          Major version string, like "Hephaestus 2"
static int VIEW_DIST
          Number of tiles radius visible on View.
static int VIEW_SIZE
          Size of the View panel.
static int VIEW_TILES
          Number of tiles across visible on View.
static int VIS_Full
          Visibility levels.
static String[] VIS_NAME
          Text for each visibility level.
static int VIS_None
          Visibility levels.
static int VIS_Partial
          Visibility levels.
static int West
          Directions
 
Method Summary
static int atoi(String s, int defvalue)
          Converts a string into an int.
static String first(String s)
          Returns everything in a string up to the first space.
static int getDir(int dx, int dy)
          Returns the direction represented by relative coordinates, or -1 if it is not a cardinal direction.
static Integer makeInt(int value)
          Returns an Integer representing an int, using cached objects for -256 to 256.
static String rest(String s)
          Returns everything in a string after the first space, or "" if no spaces.
static String rgb(Color c)
          Returns a six-digit hex code representing a color.
static boolean toBoolean(Object o)
          Returns true if o is a non-zero Integer or a non-empty String, false otherwise.
static Integer toInteger(Object o)
          Returns 'o' converted to an Integer, or Integer(0) if 'o' is null.
static String toString(Object o)
          Returns 'o' converted to a String, or "" if 'o' is null.
static int turnBack(int dir)
          Returns the direction opposite to 'dir'.
static int turnLeft(int dir)
          Returns the direction to the left of 'dir'.
static int turnRight(int dir)
          Returns the direction to the right of 'dir'.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSIONBASE

public static final String VERSIONBASE
Major version string, like "Hephaestus 2"

See Also:
Constant Field Values

VERSION

public static final String VERSION
Minor version string, like "Hephaestus 2.00"

See Also:
Constant Field Values

SAVEVER

public static final int SAVEVER
Version number as an int, like "200".

See Also:
Constant Field Values

ICONSIZE

public static final int ICONSIZE
See Also:
Constant Field Values

ICON_ALERT

public static final String ICON_ALERT
Filenames of the system icons.

See Also:
Constant Field Values

ICON_ATTACK

public static final String ICON_ATTACK
Filenames of the system icons.

See Also:
Constant Field Values

ICON_DEATH

public static final String ICON_DEATH
Filenames of the system icons.

See Also:
Constant Field Values

ICON_DROP

public static final String ICON_DROP
Filenames of the system icons.

See Also:
Constant Field Values

ICON_EAST

public static final String ICON_EAST
Filenames of the system icons.

See Also:
Constant Field Values

ICON_EQUIP

public static final String ICON_EQUIP
Filenames of the system icons.

See Also:
Constant Field Values

ICON_ERROR

public static final String ICON_ERROR
Filenames of the system icons.

See Also:
Constant Field Values

ICON_GAME

public static final String ICON_GAME
Filenames of the system icons.

See Also:
Constant Field Values

ICON_GET

public static final String ICON_GET
Filenames of the system icons.

See Also:
Constant Field Values

ICON_GOLD

public static final String ICON_GOLD
Filenames of the system icons.

See Also:
Constant Field Values

ICON_INV

public static final String ICON_INV
Filenames of the system icons.

See Also:
Constant Field Values

ICON_MAGIC

public static final String ICON_MAGIC
Filenames of the system icons.

See Also:
Constant Field Values

ICON_NORTH

public static final String ICON_NORTH
Filenames of the system icons.

See Also:
Constant Field Values

ICON_QUESTION

public static final String ICON_QUESTION
Filenames of the system icons.

See Also:
Constant Field Values

ICON_REMOVE

public static final String ICON_REMOVE
Filenames of the system icons.

See Also:
Constant Field Values

ICON_SOUTH

public static final String ICON_SOUTH
Filenames of the system icons.

See Also:
Constant Field Values

ICON_TEAST

public static final String ICON_TEAST
Filenames of the system icons.

See Also:
Constant Field Values

ICON_TNORTH

public static final String ICON_TNORTH
Filenames of the system icons.

See Also:
Constant Field Values

ICON_TRIGGER

public static final String ICON_TRIGGER
Filenames of the system icons.

See Also:
Constant Field Values

ICON_TSOUTH

public static final String ICON_TSOUTH
Filenames of the system icons.

See Also:
Constant Field Values

ICON_TWEST

public static final String ICON_TWEST
Filenames of the system icons.

See Also:
Constant Field Values

ICON_USE

public static final String ICON_USE
Filenames of the system icons.

See Also:
Constant Field Values

ICON_WAIT

public static final String ICON_WAIT
Filenames of the system icons.

See Also:
Constant Field Values

ICON_WAIT_SM

public static final String ICON_WAIT_SM
Filenames of the system icons.

See Also:
Constant Field Values

ICON_WEST

public static final String ICON_WEST
Filenames of the system icons.

See Also:
Constant Field Values

HOMEPAGE

public static final String HOMEPAGE
URI of the Hephaestus home page.

See Also:
Constant Field Values

ABOUT

public static final String ABOUT
See Also:
Constant Field Values

TICK_TIME

public static final long TICK_TIME
Animation time

See Also:
Constant Field Values

TILE_SIZE

public static final int TILE_SIZE
All tiles should be this size square.

See Also:
Constant Field Values

TILE_SIZE2

public static final int TILE_SIZE2
Half of TILE_SIZE

See Also:
Constant Field Values

VIEW_DIST

public static final int VIEW_DIST
Number of tiles radius visible on View.

See Also:
Constant Field Values

VIEW_TILES

public static final int VIEW_TILES
Number of tiles across visible on View.

See Also:
Constant Field Values

VIEW_SIZE

public static final int VIEW_SIZE
Size of the View panel.

See Also:
Constant Field Values

TURNS_PER_HOUR

public static int TURNS_PER_HOUR
Number of game turns (defined as 1 minute each) per hour.


TURNS_PER_DAY

public static int TURNS_PER_DAY
Number of game turns (defined as 1 minute each) per day.


MAXPLAYERS

public static int MAXPLAYERS
Maximum number of Players allowed.


TYPE_Stuff

public static final int TYPE_Stuff
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_Map

public static final int TYPE_Map
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_Terrain

public static final int TYPE_Terrain
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_Thing

public static final int TYPE_Thing
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_Block

public static final int TYPE_Block
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_Statted

public static final int TYPE_Statted
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_Item

public static final int TYPE_Item
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_Entity

public static final int TYPE_Entity
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_Creature

public static final int TYPE_Creature
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_Player

public static final int TYPE_Player
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_None

public static final int TYPE_None
Type codes for Stuff subclasses.

See Also:
Constant Field Values

TYPE_NAME

public static final String[] TYPE_NAME
Text representation of TYPE_* constants.


North

public static final int North
Directions

See Also:
Constant Field Values

East

public static final int East
Directions

See Also:
Constant Field Values

South

public static final int South
Directions

See Also:
Constant Field Values

West

public static final int West
Directions

See Also:
Constant Field Values

NDIRS

public static final int NDIRS
Directions

See Also:
Constant Field Values

DX

public static final int[] DX
Deltas by direction. DX[d] is the x-coord, DY[d] is the y-coord.


DY

public static final int[] DY
Deltas by direction. DX[d] is the x-coord, DY[d] is the y-coord.


DIR_ABBV

public static final String[] DIR_ABBV
One-letter lowercase text for each direction.


DIR_NAME

public static final String[] DIR_NAME
Lowercase text for each direction.


Right

public static final int Right
Relative facings: (North + Right) % NDIRS = East, and so on.

See Also:
Constant Field Values

Back

public static final int Back
Relative facings: (North + Right) % NDIRS = East, and so on.

See Also:
Constant Field Values

Left

public static final int Left
Relative facings: (North + Right) % NDIRS = East, and so on.

See Also:
Constant Field Values

LAYER_Under

public static final int LAYER_Under
Values for terrain layers.

See Also:
Terrain, Constant Field Values

LAYER_Over

public static final int LAYER_Over
Values for terrain layers.

See Also:
Terrain, Constant Field Values

NLAYERS

public static final int NLAYERS
Values for terrain layers.

See Also:
Terrain, Constant Field Values

LAYER_NAME

public static final String[] LAYER_NAME
Text for each layer.


VIS_None

public static final int VIS_None
Visibility levels.

See Also:
Constant Field Values

VIS_Partial

public static final int VIS_Partial
Visibility levels.

See Also:
Constant Field Values

VIS_Full

public static final int VIS_Full
Visibility levels.

See Also:
Constant Field Values

VIS_NAME

public static final String[] VIS_NAME
Text for each visibility level.


OPA_None

public static final int OPA_None
Opacity level: you can see through it.

See Also:
Constant Field Values

OPA_Partial

public static final int OPA_Partial
Opacity level: there's a "mist" over everything behind it, and you can't see through two partials.

See Also:
Constant Field Values

OPA_Full

public static final int OPA_Full
Opacity level: you can't see through it.

See Also:
Constant Field Values

OPA_NAME

public static final String[] OPA_NAME
Text for each opacity level.


LEVEL_EXP

public static final int LEVEL_EXP
Base cost for each level in experience points, currently 1000. The cost to go up one level is equal to your current level * LEVEL_EXP.

See Also:
Constant Field Values

MAGIC_EXP

public static final int MAGIC_EXP
Award for casting a spell, currently 10 * current level.

See Also:
Constant Field Values

DAMAGE_EXP

public static final int DAMAGE_EXP
Award for causing damage to someone else, currently 1 * damage done.

See Also:
Constant Field Values

Body

public static final int Body
Statistic indices.

See Also:
Constant Field Values

Speed

public static final int Speed
Statistic indices.

See Also:
Constant Field Values

Mind

public static final int Mind
Statistic indices.

See Also:
Constant Field Values

Charm

public static final int Charm
Statistic indices.

See Also:
Constant Field Values

HitPoints

public static final int HitPoints
Statistic indices.

See Also:
Constant Field Values

MagicPoints

public static final int MagicPoints
Statistic indices.

See Also:
Constant Field Values

Attack

public static final int Attack
Statistic indices.

See Also:
Constant Field Values

Evade

public static final int Evade
Statistic indices.

See Also:
Constant Field Values

Defense

public static final int Defense
Statistic indices.

See Also:
Constant Field Values

Range

public static final int Range
Statistic indices.

See Also:
Constant Field Values

MagicAbility

public static final int MagicAbility
Statistic indices.

See Also:
Constant Field Values

MagicEvade

public static final int MagicEvade
Statistic indices.

See Also:
Constant Field Values

MagicDefense

public static final int MagicDefense
Statistic indices.

See Also:
Constant Field Values

NSTATS

public static final int NSTATS
Statistic indices.

See Also:
Constant Field Values

NPRIMES

public static final int NPRIMES
Number of primary stats: Body, Speed, Mind, Charm.

See Also:
Constant Field Values

STAT_NAME

public static final String[] STAT_NAME
Text for each stat. These are slightly abbreviated to fit on the stats display.


EQ_Weapon

public static final int EQ_Weapon
Equipment positions.

See Also:
Constant Field Values

EQ_Shield

public static final int EQ_Shield
Equipment positions.

See Also:
Constant Field Values

EQ_Armor

public static final int EQ_Armor
Equipment positions.

See Also:
Constant Field Values

EQ_Hat

public static final int EQ_Hat
Equipment positions.

See Also:
Constant Field Values

EQ_Accessory

public static final int EQ_Accessory
Equipment positions.

See Also:
Constant Field Values

NEQUIP

public static final int NEQUIP
Equipment positions.

See Also:
Constant Field Values

EQUIP_NAME

public static final String[] EQUIP_NAME
Text for each equipment position.

Method Detail

atoi

public static int atoi(String s,
                       int defvalue)
Converts a string into an int.


makeInt

public static Integer makeInt(int value)
Returns an Integer representing an int, using cached objects for -256 to 256.


first

public static String first(String s)
Returns everything in a string up to the first space.


rest

public static String rest(String s)
Returns everything in a string after the first space, or "" if no spaces.


toBoolean

public static boolean toBoolean(Object o)
Returns true if o is a non-zero Integer or a non-empty String, false otherwise.


toInteger

public static Integer toInteger(Object o)
Returns 'o' converted to an Integer, or Integer(0) if 'o' is null.


toString

public static String toString(Object o)
Returns 'o' converted to a String, or "" if 'o' is null.


getDir

public static int getDir(int dx,
                         int dy)
Returns the direction represented by relative coordinates, or -1 if it is not a cardinal direction. The distance of each does not matter.


turnLeft

public static int turnLeft(int dir)
Returns the direction to the left of 'dir'.


turnBack

public static int turnBack(int dir)
Returns the direction opposite to 'dir'.


turnRight

public static int turnRight(int dir)
Returns the direction to the right of 'dir'.


rgb

public static String rgb(Color c)
Returns a six-digit hex code representing a color.