Anonymous
×
Create a new article
Write your page title here:
We currently have 7 articles on wiki.jedimud.net. Type your article name above or click on one of the titles below and start writing!



wiki.jedimud.net

JediMUD "Heartbeat" Regen Code Snippet

Between 1996 and 1997, JediMUD abandoned the original "tick"-based player and npc hp/mana/move regeneration methodology in favor of "heartbeat"-based regen.  

Currently, a player has a random chance of re-gaining a small amount of resources (hp, mana, moves) on any heartbeat. If you're sleeping you have a 100% chance of gaining your min regen per heart beat. Resting 50%, sitting 33%, standing 25% and fighting 20%.

If you occupy a Focal Point room, you receive an additional 100% bonus to the amount of hit points, mana, and moves you gain per heartbeat. These rooms basically double your gains per heartbeat.

(see code snippet below).

A "tick" is a unit of time on a mud, linked to real-time.  At JediMUD, a tick is 75 seconds. A "heartbeat" is approximately one second in real-time.

if ((GET_POS(i) == POSITION_SLEEPING) || 
   ((GET_POS(i) == POSITION_RESTING) && (number(1,2) == 1)) || 
   ((GET_POS(i) == POSITION_SITTING) && (number(1,3) == 1)) ||
   ((GET_POS(i) == POSITION_STANDING) && (number(1,4) == 1)) || 
   ((GET_POS(i) == POSITION_FIGHTING) && (number(1,5) == 1)) )
{ for (y = 0; y < number(6,9); y++)

          GET_HIT(i) += hmv_gain(i, HIT);

for (y = 0; y < number(4,6); y++)

          GET_MANA(i) += hmv_gain(i, MANA);

for (y = 0; y < number(4,6); y++)

          GET_MOVE(i) += hmv_gain(i, MOVE);