health

concepts
PRELIMINAY CONCEPT
	health

UPDATE
	Mateese, 18-Jun-1994 03:00 MET

SYNOPSIS
	#include <health.h>

DESCRIPTION -- Basics
	Health is a quite tricky point to do, since the modelling of
	health itself, as the relationship to the outside world can be
	really complex.

	The health of a living is modeled using three
	parameters:

	  int A_HP  "HP"
	    The number of Health Points the living currently has.

	  int A_SP  "SP"
	    The number of Spell Points the living currently has
	    (this is not really a 'health' parameter, but uses the
	     same formulaes, so its listed here)

	  int A_POISON  "Poison"
	    The number of Poison Points the living currently has
	    soaked.

	Health points describe the ability of the living to sustain
	damage: every damage point is reduced from the amount of HP.
	If the amount of HP reaches 0, the living dies.

	Spell points describe how much power the living has to do
	mental efforts. Each efforts uses up some SP. If the amount of
	SP reaches 0, no more mental efforts are possible.

	Poison points are a measure of how much poison the living has
	soaked. In this case, the counting starts at 0, with no real
	upper limit.

	
	For each parameter exists an upper threshhold:

	  int A_MAX_HP      "MaxHP"
	  int A_MAX_SP      "MaxSP"
	  int A_MAX_POISON  "MaxPoison"

	For HP and SP, the Max value determines the highest value
	reachable by normal regeneration.
	For Poison, the Max value is the threshhold up to which the
	poisoning just affects the regeneration (the more poison, the
	lower the effective regeneration), but above which the
	poisoning directly reduces the amount of HP.
	However, poison above the threshold is neutralized
	exponentially - sometimes faster than the living can die.


	Each living has the natural ability to regenerate HP/SP and to
	degenerate Poison. It is expressed as the 'Rate':

	  int A_RATE_HP      "RateHP"
	  int A_RATE_SP      "RateSP"
	  int A_RATE_POISON  "RatePoison"

	Each value gives the amount of 1/10-points regenerated/degenerated
	per heart_beat. Note that during combat a living can't refresh
	neither HP nor SP.
	DO NOT MODIFY any rate unless you perfectly well know what you do!
	
	The Rates are not used directly for healing, instead the
	following properties are queried:

	  int P_REG_HP      "RegHP"
	  int P_REG_SP      "RegSP"
	  int P_DEG_POISON  "DegPoison"

	These properties include the Rate values, but allow for
	temporary modifications (e.g. by Potions Of Health).


	Default values for the rates are defined in /sys/health.h.


DESCRIPTION -- Advanced
	The basic health as described above is insufficient for
	advanced monsters and players, as it doesn't take into account
	the effects of food, soft drinks and alcohol.

	For these, three more parameters exist:

	  int A_ALCOHOL      "Alcohol"
	  int A_DRINK        "Drink"
	  int A_FOOD         "Food"
	    The current amount of alcohol, food or drinks the npc or
	    player currently has consumed.

	Food and drink must be at positive values for the NPC/player
	to be able to heal by itself. Negative values stop the
	automatic healing, very low values even reduce the NPC/players
	HP.

	Alcohol on the other hand can achieve just values >= 0. If
	existant, it accelerates the healing process.
	The acceleration rate is:

	  int A_RATE_ALCOHOL  "RateAlcohol"
	    The added regeneration rate the NPC/player has when being drunk.
	    This value is added to its intrinsig A_RATE_HP/A_RATE_SP.
	    It is initialized to ALCOHOL_RATE from /sys/health.h .

	The effects of hunger, thirst and drunkenness are taken into
	account when querying P_REG_HP resp. P_REG_SP, and just then.

	For all three values, upper thresholds exist as well:

	  int A_ALCOHOL      "Alcohol"
	  int A_DRINK        "Drink"
	  int A_FOOD         "Food"
	    The current amount of alcohol, food or drinks the npc
	    currently had.
	    Food and drink may go negative, where they hinder any
	    healing process.

	All three parameters are subject to an automatic degradation, 
	determined by the three parameters

	  int A_DEG_ALCOHOL  "DegAlcohol"
	  int A_DEG_DRINK    "DegDrink"
	  int A_DEG_FOOD     "DegFood"
	    The degeneration rate of A_ALCOHOL, A_DRINK and A_FOOD,
	    measured in 1/100 points per heartbeat.
	    These are initialized to ALCOHOL_DEG, DRINK_DEG and
	    DEG_FOOD from /sys/health.h .


CAVEAT
	In a normal /std/living, A_MAX_HP and A_MAX_SP are derived
	from the livings stats A_CON and A_INT, resp, and can thus not
	set freely.


BUGS
	Doc is not complete yet.


SEE ALSO
	attributes(C), combat(C), oldhealth(C), living(S), npc(S)