Manual:DIL Manual/natural armour

From DikuMUD Wiki
Jump to navigation Jump to search

natural_armour

Field (integer, read/write; units: characters).

ch.natural_armour : integer

The armour type of a character's own skin, used where no worn armour covers the spot that is hit: an ARM_ constant from vme.h, ARM_CLOTHES (0), ARM_LEATHER, ARM_HLEATHER, ARM_CHAIN or ARM_PLATE (4). It picks the column of the weapon and spell damage tables. A zone file sets it with armour in an NPC (NATURAL_DEF in wmacros.h); for players the natural-armour spells (APF_NATURAL_ARMOUR) raise it while they last.

Notes

  • On an object, a room or null it fails.
  • No access level is needed to assign it.
  • Stored as an unsigned 8-bit number, and not checked: assign only 0 to 4. Melee damage logs "Illegal armour type." and uses ARM_CLOTHES for anything else, but spell damage uses the value as an index into its table and reads past the end.

Example

dilbegin harden_skin(dur : integer);
var
   old : integer;
code
{
   old := self.natural_armour;
   if (old < ARM_CHAIN)
      self.natural_armour := ARM_CHAIN;
   act("$1n's skin turns into a bone-like shell.", A_ALWAYS, self, null, null, TO_ROOM);
   heartbeat := PULSE_SEC * dur;
   pause;
   self.natural_armour := old;
   act("$1n's skin is back to normal.", A_ALWAYS, self, null, null, TO_ROOM);
   quit;
}
dilend

Gives an NPC a chain-mail hide for a while.

See also