mdh.hephaestus2
Class Adventure

java.lang.Object
  |
  +--mdh.hephaestus2.Adventure
All Implemented Interfaces:
Serializable

public abstract class Adventure
extends Object
implements Serializable

All Hephaestus adventures must be subclasses of Adventure, and implement the newGame() method to set up the adventure.

You can define additional methods for use as callbacks with the signature:

public MoveResult foo(HashMap args) throws HephaestusException
'args' will be a hash of each named argument (as a String) to a String or an Integer. This method would be stored as a callback with a call like st.setTriggerCallback("foo").

Callbacks are used as triggers and event messages throughout Hephaestus.

Any instance variables that do not have the "transient" modifier will be saved when the user saves the game, but these must be serializable types. If you must have a non-serializable type, make it transient.

Generally, you shouldn't keep direct references to Stuff, you should use the id instead.

Author:
Copyright © 2002 by Mark Hughes <kamikaze@kuoi.asui.uidaho.edu>
See Also:
Serialized Form

Field Summary
 Game game
          The Game instance.
 World world
          The World instance.
 
Constructor Summary
Adventure()
           
 
Method Summary
 Stuff getActor(HashMap args)
          Returns the Stuff represented by "actorid" in args.
 Stuff getTarget(HashMap args)
          Returns the Stuff represented by "targetid" in args.
abstract  void newGame()
          Sets up the maps and game objects for a new adventure.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

game

public transient Game game
The Game instance.


world

public transient World world
The World instance.

Constructor Detail

Adventure

public Adventure()
          throws HephaestusException
Method Detail

getActor

public final Stuff getActor(HashMap args)
                     throws HephaestusException
Returns the Stuff represented by "actorid" in args. Most callbacks will have "actorid" equal to the Player or Creature that triggered the callback. If a Player pushes a lever Block, the Player is the actor and the Block is the target.

HephaestusException

getTarget

public final Stuff getTarget(HashMap args)
                      throws HephaestusException
Returns the Stuff represented by "targetid" in args. Many callbacks will have "targetid" equal to the Stuff that the trigger is on. If a Player pushes a lever Block, the Player is the actor and the Block is the target.

HephaestusException

newGame

public abstract void newGame()
                      throws HephaestusException
Sets up the maps and game objects for a new adventure. newGame() is called when an adventure is loaded for the first time.

HephaestusException