Manual:DIL Manual/max mana

From DikuMUD Wiki
Jump to navigation Jump to search

max mana

Field (integer, read-only; units: characters).

ch.max_mana : integer

The character's maximum mana; mana holds the current amount. The game works it out each time it is read: 100 + (BRA + CHA) / 2, at most 200, from the character's brain and charisma abilities. For a mortal player it is then scaled by age.

Notes

  • It can't be assigned (vmc: "Illegal lvalue"). Raise it by raising the abilities, for example with an affect (APF_ABILITY).
  • mana isn't capped by it when assigned in DIL: pc.mana := pc.mana + 50; can go above the maximum. Compare first, as halfzon.zon does.
  • On an object, a room or null it fails.

Example

dilbegin restore_mana(pc : unitptr);
code
{
   if ((pc.type != UNIT_ST_PC) and (pc.type != UNIT_ST_NPC))
      return;
   pc.mana := pc.mana + 50;
   if (pc.mana > pc.max_mana)
      pc.mana := pc.max_mana;
   return;
}
dilend

Gives a character 50 mana, but not above the maximum.

See also