%damage()

Aliases%damage( )
Parametersmixed @source, entity @victim, integer @damage [, array @damageFlags [, mixed @attackType [, array @messages]]]

    This function is used to have the @source entity inflict damage upon the
@victim. The @source may be null. The @victim may be either an object
or a character pointer. The @damageFlags array is used to determine the
type of damage which can then be blocked, increased, or decreased
depending on the target's immunity, susceptibility, and resistance
respectively. The following flags are recognized:

hit electric plus 2
bludgeon negative energy plus 3
pierce positive energy plus 4
slash mental weapon
fire deadly poison light weapon
cold non-magical physical
acid magical non-physical
poison plus 1 all

Additionally the following special damage flags also exist:

skipStartFight - do not initiate combat when damage is dealt
skipMessages - do not output damage messages as is usual
skipMinimum - deal damage to object regardless of threshold

The @attackType is used to determine the source of the damage (not to be
confused with @source which is more specifically the initiator). This can
be used to auotmatically produce any special affects normally associated
with the attack type (such as damage messages). The following attack types
are recognized.

acid drain life positive energy
bite electric slash
bludgeon fire smash
breath hit sting
claw mental suffering
cold negative energy whip
crush pierce skill
deadly poison poison spell

Finally the @messages parameter is used to override any damage messages
that may or may not be associated with the given @attackType. This
parameter requires that the following fields be set (as they would be in
the web editor for a skill or spell).

godAttacker hitAttacker
godVictim hitVictim
godObservers hitObservers
deathAttacker missAttacker
deathVictim missVictim
deathObservers missObservers

Now for a big fat example. Even though some of this function's parameters
are optional, this example will use them anyways, just so you can see how
they are set.

Example:
--------------------------------------------------------------------------

@damageFlags->1 = magic
@damageFlags->2 = acid
@damageFlags->3 = "negative energy"

@messages->godAttacker =
\ "$N wonders who the hell you think you are!"

@messages->godVictim =
\ "$n tries to dissolve you with acid. What a joker!"

@messages->godObservers =
\ "$n, in an almost laughable attempt to hurt $N, casts acid splash."

@messages->deathAttacker =
\ "$N's skin begins to bubble and then slowly melts off $S bones."

@messages->deathVictim =
\ "Your skin begins to boil then melts off your bones. OUCH! You die."

@messages->deathObservers =
\ "$N's skin begins to bubble and then slowly melts off $S bones."

@messages->hitAttacker =
\ "The acid begins to boil $N's skin and dissolve $S armor."

@messages->hitVictim =
\ "$n's acid burns your skin and dissolves your armor."

@messages->hitObservers =
\ "$N's armor and skin boil from $n's acid splash."

@messages->missAttacker =
\ "You miss! The acid begins to boil the ground behind $N."

@messages->missVictim =
\ "$n misses you with $s acid splash. Whew!"

@messages->missObservers =
\ "$N nimbly evades $n's acid splash which boils the ground behind $M."

@damage = 10 + 1d20

%damage(
\ @actor, @target, @damage, @damageFlags,
\ "spell acid splash", @messages )