wyvern.kernel.player
Class Heart

java.lang.Object
  extended bywyvern.kernel.player.Heart

public class Heart
extends java.lang.Object

Handles heartbeat timer every 5 seconds, computing regeration of all the player's time-sensitive stats (health, mana, food, etc.)

You could, if you wanted, replace a player's Heart with a subclass of this one, and give them different recovery rates for various stats.

Version:
1.0, Jan 07, 2004
Author:
Steve Yegge

Field Summary
protected  int beats_
           
protected  PlayerImpl player_
           
 
Constructor Summary
Heart(PlayerImpl p)
          Constructs a new Heart for the specified Player.
 
Method Summary
 void beat()
          Called by PlayerImpl.heartBeat().
protected  void computeFood()
          Maybe deducts from food level.
protected  void computeHitPointRegen()
          Maybe updates HP.
protected  void computeShoutPoints()
          Computes how many shout points to give to the player.
protected  void computeSpellPointRegen()
          Maybe increases mana
 int getBeats()
          Returns the number of heartbeats the player has had since they logged in.
 PlayerImpl getPlayer()
           
 void setPlayer(PlayerImpl p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beats_

protected transient int beats_

player_

protected PlayerImpl player_
Constructor Detail

Heart

public Heart(PlayerImpl p)
Constructs a new Heart for the specified Player.

Method Detail

getPlayer

public PlayerImpl getPlayer()

setPlayer

public void setPlayer(PlayerImpl p)

getBeats

public int getBeats()
Returns the number of heartbeats the player has had since they logged in.


beat

public void beat()
Called by PlayerImpl.heartBeat(). Updates HP, SP, food, shout, and other properties. Autosaves at regular intervals.


computeHitPointRegen

protected void computeHitPointRegen()
Maybe updates HP.


computeFood

protected void computeFood()
Maybe deducts from food level.


computeSpellPointRegen

protected void computeSpellPointRegen()
Maybe increases mana


computeShoutPoints

protected void computeShoutPoints()
Computes how many shout points to give to the player.