/* hp_regen_object & sp_regen_object code by verte */

static autoheal() {
    int x;
    object r;
    if (headache) {
        headache -= 1;
        if (headache == 0)
            tell_object(myself, "You no longer have a head ache.\n");
    }
    x=1;
    if(r=present("hp_regen_object", this_object()))
      x=(int)r->query_hp_regen();
    if (hit_point < max_hp) {
        hit_point += intoxicated ? (3*x) : x; 
        if (hit_point > max_hp)
            hit_point = max_hp;
    }
    x=1;
    if(r=present("sp_regen_object", this_object()))
      x=(int)r->query_sp_regen();
    if (spell_points < max_spell) {
        spell_points += intoxicated ? (3*x) : x;
        if (spell_points > max_spell)
            spell_points = max_spell;
    }
    if (intoxicated) {
        if ((intoxicated -= 1) == 0) {
            headache = max_headache;
            max_headache = 0;
            tell_object(myself,
               "You suddenly without reason get a bad head ache.\n");
            if ((hit_point -= 3) < 0)
                hit_point = 0;
        }
    }
   if (interactive(this_object()))
    call_out("autoheal", INTERVAL_BETWEEN_HEALING);
}
