Difference between revisions of "Manual:DIL Manual/endurance"

From DikuMUD Wiki
Jump to navigation Jump to search
(checked against the compiler and the interpreter; example compiles)
 
(corrected from the DIL keyword tests (T029-T043))
 
Line 7: Line 7:
  
 
== Notes ==
 
== Notes ==
 +
* An NPC is loaded with full hit points, mana and endurance: the regeneration program every NPC gets (<code>regenerate@update</code>) sets them to their maximum, so the values in the zone file aren't what a program reads.
 
* Players and NPCs. On an object, a room or null the field fails.
 
* Players and NPCs. On an object, a room or null the field fails.
 
* Assignment is not checked against <code>max_endurance</code>: a program can set more than the maximum, and less than 0. Clamp it yourself.
 
* Assignment is not checked against <code>max_endurance</code>: a program can set more than the maximum, and less than 0. Clamp it yourself.

Latest revision as of 07:20, 15 November 2026

endurance

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

ch.endurance : integer

A character's current endurance: the points that moving, fighting and some skills use up. The most it regains to is max_endurance. Players regain endurance in regen_pc@update, a DIL program, which stops at max_endurance and never goes below 0. In basemove.zon, climb takes 6 endurance a try and refuses a character with less than 10.

Notes

  • An NPC is loaded with full hit points, mana and endurance: the regeneration program every NPC gets (regenerate@update) sets them to their maximum, so the values in the zone file aren't what a program reads.
  • Players and NPCs. On an object, a room or null the field fails.
  • Assignment is not checked against max_endurance: a program can set more than the maximum, and less than 0. Clamp it yourself.
  • Stored as a 16-bit signed number: values outside -32768 to 32767 wrap around.

Example

dilbegin integer tire(ch : unitptr, amount : integer);
code
{
   if (ch.endurance < amount)
   {
      act("You are too exhausted.", A_ALWAYS, ch, null, null, TO_CHAR);
      return (FALSE);
   }
   ch.endurance := ch.endurance - amount;
   return (TRUE);
}
dilend

Takes endurance for an effort, or refuses when the character is too tired, as climb does in basemove.zon.

See also