CONCEPT
	actions

UPDATE
	Mateese, 28-Jan-1994 19:30 MET

DESCRIPTION
	One important parameter for combat, magic, and other tasks
	performed under time critic situations.

	A simple but effective model is that every step of a task
	needs a specific amount of 'actions', whereas each living has
	a certain amount of 'actions' to spend per round (heartbeat).
	The physical comabt of livings is a builtin user of actions,
	but other objects may register to use the actions for their
	own, e.g. casting spells.

	Each living has certain amount of actions per round to avail:

	  int P_ACTIONS  "Actions"
	    Number of actions available per heartbeat.

	The value is set according to the living's race (at least 
	to 1), and may be modified by magic items.

	To consume actions, one needs an object for the task.
	The object registers itself with the living:

	  int AddAction ( void|string|closure fun
                        , void|string|object  obj
                        , void|int pri
                        )
	    This adds a function to the list of actions to be carried
	    out each heartbeat. <pri> roughly determines at which
	    position of all functions the new function will be placed:
	    the higher, the better. Default is 0.
	    The function to call can be specified either as closure,
	    or by name as a string. Default is "DoAction".
	    The object in which the function is to call is per default
	    the object doing the AddAction() call, but can be
	    specified else by giving the object (or its filename).


	Now, with every heartbeat the living scans the list of
	registered objects and calls in each one the specified
	function to carry out the tasks. The function must be
	specified as this:

	  int DoAction (int actions, int actionround)
	    The called object has the opportunity to perform actions
	    for this_player()'s combat round.
	    <actions> is the number of actions the object may spend,
	    <actionround> is a number, increasing with each call. The
	    object may use it to trigger delayed actions.
	    Upon return, the function has to assign the number of
	    remaining actions to <actions> (!), and has to return
	    non-zero if it wants to stay registered with the living.

	The living will in each heartbeat scan through the list of
	registered objects, calling DoAction() in each until there are
	no actions left to spend.
	If there are actions left, they will be used for 'normal'
	physical combat.

	The heartbeat will be active as long as there are objects
	registered and/or actions are used up.
	This fact can be used by objects to delay effects for a
	certain amount of heartbeats: they just have to count how
	often they have been called.


CAVEAT
	Normal /std/livings can just do physical combat.
	Its not possible for objects to register with them.


BUGS
	Doc is not complete yet.


SEE ALSO
	combat(C), living(S), npc(S), player(S)
