|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrogue.DungeonItem
rogue.ActiveItem
public abstract class ActiveItem
An extension of DungeonItem, an ActiveItem is an abstract base class for all "active" things in the dungeon - i.e. the Player and the Monsters.
| Field Summary | |
|---|---|
protected int |
myHealth
Current "health" rating for ActiveItem, which it prefers to keep > 0. |
| Fields inherited from class rogue.DungeonItem |
|---|
myPosition, theDungeon |
| Constructor Summary | |
|---|---|
ActiveItem(int ImageNo,
DungeonGame d)
Constructor - simply passes arguments to base class constructor. |
|
| Method Summary | |
|---|---|
boolean |
alive()
Determines whether active inhabitant of dungeon is still "alive". |
void |
getHit(int damage)
Decrements health rating when an active dungeon inhabitant is attacked. |
protected void |
move(int newx,
int newy)
Moves active inhabitant of dungeon to new location. |
void |
read(java.io.BufferedReader input)
Invokes super.read() to get common properties of all DungeonItems read, then reads data common to all ActiveItems. |
protected Pt |
step(int dir)
Utility function, finds new position after movement in specified direction. |
| 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 |
| Field Detail |
|---|
protected int myHealth
| Constructor Detail |
|---|
public ActiveItem(int ImageNo,
DungeonGame d)
ImageNo - Integer that identifies icon used to display the item.d - Link to DungeonGame object| Method Detail |
|---|
public void getHit(int damage)
damage - Amount of damage caused by an attacker.public boolean alive()
protected void move(int newx,
int newy)
newx - New x coordinatenewy - New y coordinatepublic void read(java.io.BufferedReader input)
read in class DungeonIteminput - BufferedReader input stream connected to dungeon definition file.protected Pt step(int dir)
dir - Integer direction of motion - usual numeric keyboard motion control,
7 = North West, 8 = North, 9 = North East, 4 = West, 5 = no motion, 6 = East 1 = South West, 2 = South, 3 = South East,
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||