[Code] Hunger/Thirst Damage

From: Brandon Brown (ViperBrd@AOL.COM)
Date: 10/04/98


Alright, sorry for the spam - but it's me again...
So with help from somebody who saw my last message, I basically fixed up this
code so that people take damage when hungry/thirsty.

Now... my players aren't regenerating... or rather, they do - until they rest
or sleep.  Then, even if they get up/quit, etc... they still don't regen.

The code is attached below...
Any help is appreciated,
Thanks,
Viper (ICQ 10883068)

void point_update(void)
{
  struct char_data *i, *next_char;
  struct obj_data *j, *next_thing, *jj, *next_thing2;

  /* characters */
  for (i = character_list; i; i = next_char) {
    next_char = i->next;

    gain_condition(i, FULL, -1);
    gain_condition(i, DRUNK, -1);
    gain_condition(i, THIRST, -1);



    if (GET_POS(i) >= POS_STUNNED) {
      GET_HIT(i) = MIN(GET_HIT(i) + hit_gain(i), GET_MAX_HIT(i));
      GET_MANA(i) = MIN(GET_MANA(i) + mana_gain(i), GET_MAX_MANA(i));
      GET_MOVE(i) = MIN(GET_MOVE(i) + move_gain(i), GET_MAX_MOVE(i));
      if (AFF_FLAGGED(i, AFF_POISON))
        damage(i, i, 2, SPELL_POISON);
      if (GET_POS(i) <= POS_STUNNED)
        update_pos(i);
    } else if (GET_POS(i) == POS_INCAP)
      damage(i, i, 1, TYPE_SUFFERING);
    else if (GET_POS(i) == POS_MORTALLYW)
      damage(i, i, 2, TYPE_SUFFERING);
    if (!IS_NPC(i)) {
      update_char_objects(i);
      if (GET_LEVEL(i) < idle_max_level)
        check_idling(i);
    }

/* Hunger damage */
if (IS_NPC(i)) {    /* No NPC damage */
return;
}

if (GET_LEVEL(i) < 10) {  /* No newbie (lvl 9 and below) damage */
return;
}

if (GET_HIT(i) < 20) {   /* No killing people */
send_to_char("Aarrrgh... you're starving - go eat something! \r\n", i);
sprintf(buf, "%s is below 20 hp (abusing hunger/thirst stop).", GET_NAME(i));
mudlog(buf, BRF, LVL_GRGOD, TRUE);
return;
}

switch (GET_COND(i, FULL)){
    case 0:
    GET_HIT(i) -= 15;
    send_to_char("You feel a pain in your chest as you realize how hungry you
are. \r\n", i);
    break;

    case 1:
    GET_HIT(i) -= 12;
    send_to_char("You feel a pain in your chest as you realize how hungry you
are. \r\n", i);
    break;

    case 2:
    GET_HIT(i) -= 9;
    send_to_char("Your hunger seems to hurt. \r\n", i);
    break;

    case 3:
    GET_HIT(i) -= 6;
    send_to_char("Your stomach growls hungrily. \r\n", i);
    break;

    case 4:
    GET_HIT(i) -= 4;
    send_to_char("Your stomach rumbles hungrily. \r\n", i);
    break;

    case 5:
    GET_HIT(i) -= 2;
    send_to_char("Maybe you ought to find something to eat.\r\n", i);
    break;

    default:
    break;

}

/* Thirst Damage */
switch (GET_COND(i, THIRST)){
    case 0:
    GET_HIT(i) -= 15;
    send_to_char("Your throat cracks with pain at your lack of water. \r\n",
i);
    return;

    case 1:
    GET_HIT(i) -= 12;
    send_to_char("Your throat &rhurts&n you greatily because of your lack of
water. \r\n", i);
    return;

    case 2:
    GET_HIT(i) -= 7;
    send_to_char("You thirst seems to &rhurt&n you.\r\n", i);
    return;

    case 3:
    GET_HIT(i) -= 6;
    send_to_char("You feel your mouth dry up due to lack of liquids. \r\n",
i);
    return;

    case 4:
    GET_HIT(i) -= 4;
    send_to_char("You feel your mouth begin to dry up due to lack of liquids.
\r\n", i);
    return;

    case 5:
    GET_HIT(i) -= 2;
    send_to_char("Maybe you ought to find something to drink.\r\n", i);
    return;

    default:
    break;
  }
}


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST