mdh.hephaestus2
Class Statted

java.lang.Object
  |
  +--mdh.hephaestus2.Stuff
        |
        +--mdh.hephaestus2.Thing
              |
              +--mdh.hephaestus2.Statted
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Entity, Item

public abstract class Statted
extends Thing

Anything with stats and gold value - Items, Creatures, and Players.

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

Method Summary
 void calcSecondary()
          Calculates the secondary stats from the primary stats.
 int getGold()
          Returns the gold value of this object.
 int getStat(int i)
          Returns the current value of stat 'i'.
 int getStatMax(int i)
          Returns the normal maximum value of stat 'i'.
 boolean isType(int type)
          Returns true if this class or any of its superclasses is of 'type', one of Global.TYPE_*.
 void setGold(int c)
          Sets the gold value of the object.
 void setStat(int i, int score)
          Sets the current score of stat 'i'.
 void setStatBoth(int i, int score)
          Sets both the current and maximum score of stat 'i'.
 void setStatMax(int i, int score)
          Sets the maximum score of stat 'i'.
 
Methods inherited from class mdh.hephaestus2.Thing
findGrid, findMap, getIconFilename, getNPoses, getOpacity, getPose, getProps, getTile, initProps, loc, moveto, moveto, setFacing, setOpacity, setPose, setTile
 
Methods inherited from class mdh.hephaestus2.Stuff
destroy, getBlocking, getName, getTriggerCallback, getType, id, setBlocking, setName, setTriggerCallback, toString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

calcSecondary

public void calcSecondary()
                   throws HephaestusException
Calculates the secondary stats from the primary stats.
 HitPoints = Body
 MagicPoints = Mind
 Attack = Body
 Evade = Speed
 Defense = 0
 Range = 0
 MagicAbility = Mind
 MagicEvade = Charm
 MagicDefense = 0
 
This will overwrite the secondary stats, so for Players, make sure you only call this when the Player has no equipment!

HephaestusException

getGold

public int getGold()
            throws HephaestusException
Returns the gold value of this object. For Entities, this is the amount of gold carried; for Items, this is the gold value if you buy or sell the item.

HephaestusException

getStat

public int getStat(int i)
            throws HephaestusException
Returns the current value of stat 'i'. The current score may (temporarily) exceed the "maximum" stat score, but healing and levelling up will restore it to the normal maximum.

HephaestusException
See Also:
Global.Body

getStatMax

public int getStatMax(int i)
               throws HephaestusException
Returns the normal maximum value of stat 'i'.

HephaestusException
See Also:
Global.Body

isType

public boolean isType(int type)
Description copied from class: Stuff
Returns true if this class or any of its superclasses is of 'type', one of Global.TYPE_*.

Overrides:
isType in class Thing

setGold

public void setGold(int c)
             throws HephaestusException
Sets the gold value of the object.

HephaestusException

setStat

public void setStat(int i,
                    int score)
             throws HephaestusException
Sets the current score of stat 'i'. The current score may (temporarily) exceed the "maximum" stat score, but healing and levelling up will restore it to the normal maximum.

Parameters:
i - index of the stat to modify
score - new score. The scores range from 1 to 20 for a normal human, and can go much higher; no score can go below 0. The maximum range of stat scores is -65536 to 65535; if you set outside that range, the value will wrap around.
HephaestusException
See Also:
Global.Body

setStatBoth

public void setStatBoth(int i,
                        int score)
                 throws HephaestusException
Sets both the current and maximum score of stat 'i'.

HephaestusException
See Also:
setStat(int, int)

setStatMax

public void setStatMax(int i,
                       int score)
                throws HephaestusException
Sets the maximum score of stat 'i'.

HephaestusException
See Also:
setStat(int, int)