healer

obj
OBJECT
	/obj/healer


LAST UPDATE
	Thragor, 12-Jul-95, 12:00 MET


SYNOPSIS
	inherit "/obj/healer";

	#include <health.h>


DESCRIPTION
	The healer offers healing without getting stuffed or drunk to
	the players and he may remove poisons, viruses and curses. To
	allow the healer to remove a poison, virus or a curse you just
	have to give one of the ids in <health.h> to it:
	  D_POISON "poison-object" // To avoid collisions with e. g.
	                           // a bottle filled with poison it's
	                           // not just "poison"
	  D_CURSE "curse"
	  D_DISEASE "virus" // Compat., might change to "disease"
	                    // anytime
	Then the healer calls remove() in this object. If the object
	is not removed after this call, the healer assumes, that he
	can't remove this curse or whatever. The frog-curse will be
	removed	by the healer, too. If P_POISON is set, and the player
	wants to cure poison, it's value is set to 0.
	At night the price to get treated or cured is much higher than
	an daytime.
	If configuring your own healer, you should add a reference to
	a sign somewhere in the room. Per default there's a sign at
	the entrance described in the long-description and you may
	read or examine the sign. Just say somewhere in the
	long-description that there's a sign. That's enough.
	The healer offers the following functions ('(protected)' below
	the function means that the function can only be called by
	objects inheriting /obj/healer):

	--- /lib/money ---

	string* P_VALUTA "Valuta"
	  The cointypes the healer deals with. If not given, the
	  default domain-depending settings will be taken. Anyway the
	  player might decide to pay in any valuta by give 'really' as
	  argument. A small fee will be taken for this.

	string AddValuta(string coin_id)
	  Add one type of coins.

	--- /obj/lib/communication ---

	This handles the chats of the healer. See the doc of
	lib/communication for further details.

	string Name(mixed|void cap)
	  This function is needed for the communication. It evaluates
	  the name of the healer. If cap!=0 the name returned has to
	  be capitalized. By default "the healer" is returned.
	  This function might be essential for healers using an NPC!
	  If this function returns 0 /obj/healer assumes that there's
	  no healer present.

	--- /obj/healer ---

	void Message(string|string *|closure message)
	    Print a message.
	    The message might be a simple string, which will be
	    displayed only to this_player() or an array of strings
	    where the size says what to do with its contents:
	      1: is handled as if it is just a simple string;
	      2: the first message is printed to the player and the
	         second one to her/his environment;
	      3: the first message is printed to the player, the
                 second one to all persons in the environment who can
	         see and the third one to all who can't;
	      4: the first message is printed to the player if (s)he
	         can see, the second one if (s)he can't, the third one
	         to the environment who can see and the last one to
	         the environment who can't.
	    If an array-content is 0, it will be ignored (not printed
	    at all).

	string *QueryFValuta(void|int force)
	(protected)
	  This function is used instead of QueryValuta() to get the
	  coins the healer deals with. It's to allow the player to
	  force to pay in any valuta.

	string get_min_coin(void|int force)
	(protected)
	  For further calculation, e. g. the description of the sign
	  or to round values the healer has to evaluate the minimal
	  coin he's dealing with. Default is "copper".

	int convert_value(int copper)
	(protected)
	  Returns the amount of minimal coins equal to the value given
	  in copper coins.

	int round_value(int copper)
	(protected)
	  Same as convert_value, but it returns the value of the
	  calculated coins in copper.

	int ModifyCost(int cost)
	  Works like ModifyPrice() in /std/shop. The default purpose
	  is to calculate the costs for healing at night. You may
	  append some race-dependent calculations.

	int calc_cost(int cost)
	(protected)
	  Calculate the cost (in copper) the player finally has to pay
	  (calling e. g. ModifyCost).

	status pay_service(int cost,status force,string str)
	(protected)
	  Checks if the player can pay the service and gives messages
	  depending on the result. If 0 is returned the player can't
	  pay the service otherwise (s)he can.

	int allow_enter(int method,mixed extra)
	  Modified to stop players to enter a closed healer (e. g. at
	  night). Wizards may enter the healer anytime.

	The following functions are needed to configure the healer:

	void CloseNight() (default)
	  The healer will be closed at night.
	void OpenNight()
	  The healer will be opened at night.
	status QueryNight()
	  Return the current status.

	void CloseDay()
	  The healer will be closed at daytime.
	void OpenDay() (default)
	  The healer will be opened at daytime.
	status QueryDay()
	  Return the current status.

	void AllowTreat() (default)
	  The healer will treat wounds.
	void ForbidTreat()
	  The healer won't treat wounds.
	status QueryTreat()
	  Return the current status.

	The following functions work in the same manner for poison,
	diseases (viruses) and curses:

	void AllowPoison() (default)
	void ForbidPoison()
	status QueryPoison()

	void AllowVirus() (default)
	void ForbidVirus()
	status QueryVirus()

	void AllowCurse()
	void ForbidCurse() (default)
	status QueryCurse()
	  As only a magician should be able to remove curses, this is
	  not enabled by default.

	Further functions to configure the healer:

	mixed P_TREAT_MSG "TreatMsg"
	  This message will be parsed through Message() (see above)
	  when the healer treats the wounds of someone.
	  Default is that the healer tends to the players wounds
	  (message given to player and the environment).

	mixed P_POISON_MSG "PoisonMsg"
	  Just as P_TREAT_MSG for curing poisons. Messages
	  defined/given by the poison itself will be displayed
	  afterwards. Default message is that the healer cures the
	  poisoned body of the player.

	mixed P_VIRUS_MSG "VirusMsg"
	  Just as P_POISON_MSG when the player asks the healer to
	  remove viruses/diseases. Default message is that the healer
	  cures the player's disease.

	mixed P_CURSE_MSG "CurseMsg"
	  Just as P_POISON_MSG when the player asks the healer to
	  remove a curse. Default message is that the healer makes a
	  magical gesture and stares at the player.

	string format_sign(string what,int value)
	(protected)
	  This is used to format the output on the sign.

	string P_SIGN_DESC "SignDesc"
	  The description of the sign. It will be queried when reading
	  or examining the sign. To give a changing sign-description
	  write your own QuerySignDesc().

	int cmd_treat(string what)
	  Called when the player types 'treat' as command. This will
	  cure the players wounds.

	void inform_health()
	(protected)
	  This will be called when the player wants to get informed
	  about her/his health and will print the money the player has
	  to pay for the service.

	mapping get_diseases()
	(protected)
	  Returns a mapping looking like this:
	    ([D_POISON:({<poisons>}),
	      D_CURSE:({<curses>}),
	      D_DISEASE:({<diseases})])
	  where poisons, curses and diseases hold the objects which
	  identified as those.

	int cost_poison(object *poisons,int poison)
	(protected)
	  Returns the amount the player has to pay to get rid of
	  her/his poisons. <poisons> contains the poison-objects,
	  <poison> the value of P_POISON.

	int cure_poison(mapping diseases)
	(protected)
	  Handles removing poisons, setting P_POISON to 0 and gives
	  appropriate messages. If the treatment has been unsuccessful
	  0 is returned else 1.

	void inform_poison(object *poisons)
	(protected)
	  Same as inform_health() but showing the poisons and if a
	  poison-object has P_INFO set, it will be printed.

	int cost_disease(object *diseases)
	(protected)
	  Same as cost_poison() for diseases.

	int cure_disease(mapping diseases)
	(protected)
	  Same as cure_poison() but for diseases.

	void inform_disease(object *diseases)
	(protected)
	  Same as inform_poison() for diseases.

	int cmd_cure(string what)
	  Called when the player types 'cure' and wants to be cured
	  from either poison or diseases. This function will call
	  functions like cure_poison().

	int cost_curse(object *curses,int frog)
	(protected)
	  Same as cost_poison() for curses.

	int remove_curse(object *curses)
	(protected)
	  Same as cure_poisons() for curses.

	int cmd_remove(string what)
	  Called when the player types 'remove' to remove a curse.

	void inform_curse(object *curses)
	  Same as inform_poison() for curses.

	int cmd_inform(string what)
	  Called when the player types 'inform'. This will allow the
	  player to get informations about her/his health and how much
	  to pay to get cured.

	void create()
	  Do the default settings, adding details, etc. and register
	  the healer.
	  The details refer to the default-description of the healer.
	  You may remove them anytime with:
	    RemoveDetail(({"sign","hut","entrance","healer",
	      "old man","man"}));

INHERITANCE TREE
	healer
	  |-std/room
	  |-lib/money
	  `-obj/lib/communication


SEE ALSO
	obj/disease