oldhealth

concepts
CONCEPT
	health

LAST UPDATE
	Organimedes, Wed Nov 18 18:08:51 MET DST 1992 <to be changed>

DESCRIPTION
	Health is everything which is concerned with the gain and loss of
	hitpoints or spellpoints, as well as certain (autoloading) items,
	such as shout_curses or viruses.

	Health is something that affects only living objects, and mainly
	players. Players will have to eat and drink to maintain their
	shape, or even to regain hit points / spell points. This can be
	performed by buying foodstuff or beverages in shops or visiting
	a pub. The main difference is that the stuff bought in a pub
	cannot be carried around.

	Non-interactive livings (that is, monsters) are not susceptible
	to hunger or thirst.

	Food and drink can affect health in the following ways:
	- Food usually satiates, drinks quench a player's thirst. Thirst
	  and hunger are implemented as the properties "FoodStuff" and
	  "FoodSoak" (P_FD_STUFF and P_FD_SOAK, respectively). A player
	  cannot consume food or drinks endlessly because he/she will be
	  full after having consumed about a two day's ration.
	  The value of a two day's ration (in property units) is currently
	  hardcoded into /std/player.c as 100 units. That is, a day's
	  ration is currently 50 units.
	  A well-nourished player (that is a player with property values
	  of "FoodStuff" and "FoodSoak" greater 0), will regain one HP
	  and one SP every 5th heart beat.
	- Alcoholic drinks accelerate the regaining of hit and spell
	  points insofar that the player regenerates 1 HP and 1 SP each
	  every second heart beat (in addition to the normal regeneration
	  every 5th heart beat). Intoxication does not affect fighting
	  and communication abilities yet.
	- Food or drink can heal the player immediately. Strong healing
	  should be used only sparingly in the game and avoided for normal
	  foodstuff or beverages. Reserve it for potions of healing or
	  similar things.
	- What about poison?

	A player loses HP and SP usually in one of the following ways:
	- HP are mostly lost in fights when the opponent scores a hit,
	  or casts some magic onto the player. The loss of HP by a weapon
	  hit is influenced by the strength of the opponent, the weapon
	  class of the hitting weapon, the dexterity of the player, and
	  the armour class of the player's armour. The loss of HP by
	  magic depends on the kind of magic and may be affected by
	  various properties.
	- HP are lost when a player becomes hungry or thirsty. A player
	  will become hungry/thirsty when the properties "FoodStuff" and
	  "FoodSoak" contain values below zero. When typing "score" the
	  player can guess the values by the following messages:

		value	    FoodStuff		 FoodSoak
		> 50	    "You are satiated."	 "You are not thirsty."
		10 - 50
		-500 - 10   "You feel hungry."	 "You feel thirsty."
		< -500	    "You faint."	 "You are drying out."

	  If a player is hungry/thirsty, he/she will be notified of this
	  in regular intervals.

	  If the property values are > -500, automatical self-healing
	  (see above) is disabled. If the values are <= -500, the player
	  will lose 1 HP every 101th heart beat until he/she stays at
	  10 HP. This will render him/her rather vulnerable to monster
	  attack. It is not possible to die from hunger or thirst alone,
	  though. If a player is hungry AND thirsty, he will lose HP
	  twice as fast.

	  In opposition to reality hunger and thirst have the same
	  importance.

	- SP are lost when a player tells (5 SP per tell), shouts (20 SP
	  per shout) or uses magic (depending on the power of the spell).

	- HP and SP can be lost through the action of viruses (see
	  /doc/concepts/viruses for details).

	The value of food and drinks is affected by weight, the amount of
	soaked or stuffed units, the alcohol content and the immediately
	restored hit and spell points. A minimum value is calculated
	automatically as long as you use the provided /std/ files. The
	minimal value is coded by a #define in /sys/health.h:
	
	#define MIN_FOOD_COST(soak, stuff, alc, heal, weight)
	
	FOODSTUFF THAT IS CHEAPER THAN THIS MINIMAL VALUE WILL BE DISABLED.
	(Exceptions may be possible, but need the approval of the AW of
	 Health.)

SOURCES
	The healing stuff is coded into /std/living/life.c
	Pubs, drinks and foodstuff are found in /std/pub.c, /std/drink.c
	and /std/food.c, respectively. The /std/food can also be used
	to code drinks. The main difference to /std/drink is that
	/std/drink encodes a bottled, drink, whereas a drink coded
	with /std/food has no vessel.
	The value formula for food and drinks is defined as macro in
	/sys/health.h.
	Example files can be found in /d/archwiz/common/health:
		exroom1.c  -- Room showing the refill features for /std/drink
		exroom2.c  -- A very simple example pub
		exroom3.c  -- Another example pub, a bit more tricky
		exfood.c   -- Example food
		exdrink1.c -- Example drink coded with /std/food
		exdrink2.c -- Example drink coded with /std/drink

SEE ALSO
	viruses(C), pub(S), drink(S), food(S)