rogue
Class Collectable

java.lang.Object
  extended by rogue.DungeonItem
      extended by rogue.Collectable

public class Collectable
extends DungeonItem

A Collectable is an item in the dungeon that can be acquired by the player (or, possibly, by a monster). Its aquisition and consumption will result in changes to the healther and wealth ratings of the acquirer.


Field Summary
 
Fields inherited from class rogue.DungeonItem
myPosition, theDungeon
 
Constructor Summary
Collectable(int ImageNo, DungeonGame d)
          Constructor
 
Method Summary
 int health()
          Accessor function, returns "health" increment yielded by Collectable item.
 void read(java.io.BufferedReader input)
          Collectable item uses super.read() to read standard DungeonItem properties, then reads two lines of input file that should contain "healt" and "wealth" numeric values.
 int wealth()
          Accessor function, returns "wealth" increment yielded by Collectable item.
 
Methods inherited from class rogue.DungeonItem
isAt, position, show, vanish
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Collectable

public Collectable(int ImageNo,
                   DungeonGame d)
Constructor

Parameters:
ImageNo - identifies image icon used to represent the collectable item
d - Link to dungeon game object
Method Detail

read

public void read(java.io.BufferedReader input)
Collectable item uses super.read() to read standard DungeonItem properties, then reads two lines of input file that should contain "healt" and "wealth" numeric values.

Overrides:
read in class DungeonItem
Parameters:
input - Reference to BufferedReader connected to dungeon definition file.

health

public int health()
Accessor function, returns "health" increment yielded by Collectable item.

Returns:
Returns integer health rating

wealth

public int wealth()
Accessor function, returns "wealth" increment yielded by Collectable item.

Returns:
Returns integer wealth rating