/*This snippet is one approach to instituting smaller hp, mana, and movement recovery times, while trying to regain about the same amount over a tick as would've been gained on a single check */ /* into update.c */ Proto(int mingain1, (CharData *)); Proto(int mingain2, (CharData *)); Proto(int mingain3, (CharData *)); /* These variables I had to define to compare them to the hit gain calculated later, as I can't directly compare an int with CharData */ int mingain1(CharData * ch) { return 10; } int mingain2(CharData * ch) { return 4; } int mingain3(CharData * ch) { return 2; } /* This is the function that calls for recovery every 10th of a tick */ void micro_tenth(void) { CharData *ch; CharData *ch_next; for (ch = char_first; ch != NULL; ch = ch_next) { AffectData *paf; AffectData *paf_next; ch_next = ch->next; if (ch->hit < ch->max_hit) ch->hit += (hit_gain(ch) / 10); else ch->hit = ch->max_hit; if (ch->mana < ch->max_mana) ch->mana += (mana_gain(ch) / 10); else ch->mana = ch->max_mana; if (ch->move < ch->max_move) ch->move += (move_gain(ch) / 10); else ch->move = ch->max_move; if (IsAffected(ch, AFF_POISON) && ch != NULL) { AffectData *poison; poison = affect_find(ch->affect_first, gsn_poison); if (poison != NULL) { act("$n shivers and suffers.", ch, NULL, NULL, TO_ROOM); chprintln(ch, "You shiver and suffer."); damage(ch, ch, poison->level / 100 + 1, gsn_poison, DAM_POISON, false); } } } } /* This is called in the update handler void at the end of update.c */ if (--pulse_tenth <= 0) { pulse_tenth = PULSE_TENTH; micro_tenth(); } /* To work, PULSE_TENTH and PULSE_FOURTH had to be defined in defines.h like so */ #define PULSE_TENTH (4 * PULSE_PER_SECOND) #define PULSE_FOURTH (11 * PULSE_PER_SECOND) /* I set up similar checks to micro_tenth at one fourth and one half of a tick, with one difference */ void micro_fourth(void) { AffectData *paf; AffectData *paf_next; CharData *ch; CharData *ch_next; for (ch = char_first; ch != NULL; ch = ch_next) { ch_next = ch->next; /* Here, micro_fourth only recovers hit points IF the calculated hit_gain is less than 10 (mingain1's value), so as to not recover experience once every tenth of a tick AND every fourth */ if (ch->hit < ch->max_hit && hit_gain(ch) < mingain1(ch)) ch->hit = Min(ch->hit + (hit_gain(ch) / 4), ch->max_hit); /* The same check is made on mana and movement points */ if (ch->mana < ch->max_mana && mana_gain(ch) < mingain1(ch)) ch->mana = Min(ch->mana + (mana_gain(ch) / 4), ch->max_mana); if (ch->move < ch->max_move && move_gain(ch) < mingain1(ch)) ch->move = Min(ch->move + (move_gain(ch) / 4), ch->max_move); if (IsAffected(ch, AFF_POISON) && ch != NULL) { AffectData *poison; poison = affect_find(ch->affect_first, gsn_poison); if (poison != NULL) { act("$n shivers and suffers.", ch, NULL, NULL, TO_ROOM); chprintln(ch, "You shiver and suffer."); damage(ch, ch, poison->level / 25 + 1, gsn_poison, DAM_POISON, false); } } } } /* The hit point, mana, and movement recovery calls were removed from void char_update */