resistance

concepts
CONCEPT
	magic attributes, magic resistance 

LAST UPDATE
	Softbyte 19.08.1995

DESCRIPTION
The following is a list of possibilities how to make an player
or NPC resistant against magic (spells).  Setting a magic
resistance via 'MagicDefence' or via 'Resistance' means that
spell may be repulsed the higher these resistances are. A repulsed
spell may backfire at the caster and hit the caster with a reduced
strength, though.
The backfire probability and the amount of reduction are
defined in /obj/scroll.
Setting a defence will not cause a spell to backfire. The spell
will always hit, but the damage done will be reduced.

Values above 100 always means complete protection or resistance.

The recommendation is to make NPCs selective resistant against
spells, i.e. a fire elemental will be fully resistant against
ST_FIRE but probably not against ST_COLD.
Players should be able to protect against various types of magic
to allow for protection form backfireing or failed spells.
Also setting single resistances should be prefered comapred to
MagicDefence.



Attribute/Prop 	Range	Description
(set via)

MagicDefence	0-100	This is a general resistance against all kinds
(ModifyAttribute)	of magic. Some races may have this naturally.
			It is the chance that the owner will not
			be effected by magic (spells).
			A value of 100 makes it completly immune
			against magic.
			A commonly available object should not raise
			this Attribute in a player. Instead it should set
			some kind of protection via Defences or Resistance.

			MagicDefense (with an 's') is currently supported.
			But this is only for compatibility. Please don't
			use it !
                        MagicDefence is equal to a resistance against
                        all magic. It will not protect against conventional
                        damage though.


Resistance	0-100 	This property makes someone completely resistant
AddResistance           against a certain spell or a certain class of
               		magic (spells).
			Resistance against a spell is made via adding the
			spell name set by (Query/SetCastName).
			Resistance against a class of magic (spells)
			can be achieved by putting the spell class
			ST_XXXX as defined in magic.h into this Property.
                        The structure of this property is a mapping
                        [TYPE:value,...]
			For the types available refer to the spell types
			in <magic.h> (e.g. ST_FIRE,ST_PSYCHO) and the
                        castnames of the spells.
		
			
			
Defences	open 	This is the defence capability of someone against
(AddDefence)		all kinds off attacks. For magic attacks there are 
			following defences defined in <combat.h>:
			DT_COLD    Damage done by something cold or coldness 
				   (e.g. frostforce spell)
			DT_WATER   Damage done by the presence of water,
				   i.e. hot water, it is NOT due to the lack 
				   of air UNDER water (e.g. holywater spell)
			DT_FIRE    Damage done by a fire (e.g. arcfire spell)
 			DT_NOAIR   Damage done when you cannot breath
				   (e.g. diving under water)
			DT_ACID    Damage done by acid 
				   (e.g. you are walking in acid)
			DT_GAS     Damage done by poison gas 
				   (e.g. quicksilver cloud)
			DT_ZAP     Destruct a living

			DT_PSYCHO  Influence on the mind, i.e. all kinds of 
				   confusion (e.g. blind spell)
			DT_DISEASE Damage done by virus or illness
			DT_POISON  Damage done by eating or injecting poison

			Usually, the value of the appropriate defences are
			subtracted from the damage that would be done without
			Defences. The damage types DT_COLD - DT_ZAP are approximately
			ordered according how dangerous they are for a living.
			The Defences can be set by rings, cloaks, spells, ...


EXAMPLES 

         TP->AddDefence(DT_FIRE,50);             // 50 HP damage protection
         TP->ModifyAttribute("MagicDefence",25); // 25% magic resistance
         TP->AddResistance(DT_COLD,100);         // full protection against
                                                    cold spells. Spells may
                                                    backfire. 
         TP->AddResistance("arcfire",100);       // full protection against
                                                    a spell named arcfire


KNOWN BUGS


SEE ALSO
	magic, spells, scrolls, combat, attributes
        /d/woodland/common/doc/magic/defender.doc   
        /d/woodland/common/doc/magic/increaser.doc