combat

concepts
CONCEPT
	combat

LAST UPDATE
	Pepel, Wed Dec  22 18:15:39 MET DST 1992


DESCRIPTION
	This document describes how combat is handled in the OSB
	mudlib. Each living creature inherits the living/combat module
	for fighting capabilities. 

	The basics: Once a living has been attacked, it will fight back
	automatically. There are several possibilities to start a
	fight:

	- You attack someone with a weapon ("kill"),
	- You cast an attack spell on someone,
	- A monster is aggressive and attacks when you enter the room,
	- You flee and come back to the monster later.

	The actual fighting is done in the heart_beat function. Each
	combattant gets one attack for each weapon or free hand he
	has. If a spell is cast, that spell prevents any attack by
	hand.

	--> To reduce battle noise, this will change in near future.
	--> In each round, a living does one hit with the first of
	--> all wielded weapons, or if none, with the first free hand.

	A weapon (hand) attack will look like this:

	heart_beat() calls Attack();

	Attack() tries to find out whom we might attack. The attacked
	might have fled or died (be no longer here) and that should
	stop the fight.

	Attack() calls QueryDamage() and QueryDamageType() in the
	weapon with which the living attacks, or it uses the hand's
	damage and damage type, if there is no weapon but only a hand,
	or claws, or the mouth of a beast. The weapon is free to put
	things in there, but standard weapons somehow use attributes
	of the living to determine the damage it wants to inflict.
	Attack() also determines where the hit will go (randomly).

	Attack() calls Defend() in the attacked object, with the
	arguments damage, damage type.
	
	Defend() in the attacked living object calls QueryDefend() in
	the armour(s) which protect the attacked body part. QueryDefend()
	returns a protection number which is subtracted from the damage
	done.

	Defend() then calls DoDamage() to reduce the hitpoints from the

	DoDamage() may find out that critical things happened, i.e.
	the living died and the routine die() is called.

	Magic attacks are handled slightly different.

	Magic attacks last one heart beat. In this heart beat no weapon
	attack can be done (the mage must concentrate on the spell).
	Spells determine their damage through its spell ability object.


SEE ALSO	  
   wc(C), ac(C)