mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-21 01:30:12 +01:00
Fixed do_set formatting and removed the magic numbers for setting DRUNK/HUNGER/THIRST. Renamed FULL to HUNGER. --Rumble
This commit is contained in:
parent
1d9cff608c
commit
1f72880ce7
7 changed files with 54 additions and 28 deletions
|
|
@ -839,7 +839,7 @@ ACMD(do_score)
|
|||
if (GET_COND(ch, DRUNK) > 10)
|
||||
send_to_char(ch, "You are intoxicated.\r\n");
|
||||
|
||||
if (GET_COND(ch, FULL) == 0)
|
||||
if (GET_COND(ch, HUNGER) == 0)
|
||||
send_to_char(ch, "You are hungry.\r\n");
|
||||
|
||||
if (GET_COND(ch, THIRST) == 0)
|
||||
|
|
|
|||
|
|
@ -887,7 +887,7 @@ ACMD(do_drink)
|
|||
act("$n tries to drink but misses $s mouth!", TRUE, ch, 0, 0, TO_ROOM);
|
||||
return;
|
||||
}
|
||||
if ((GET_COND(ch, FULL) > 20) && (GET_COND(ch, THIRST) > 0)) {
|
||||
if ((GET_COND(ch, HUNGER) > 20) && (GET_COND(ch, THIRST) > 0)) {
|
||||
send_to_char(ch, "Your stomach can't contain anymore!\r\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -926,7 +926,7 @@ ACMD(do_drink)
|
|||
weight_change_object(temp, -weight); /* Subtract amount */
|
||||
|
||||
gain_condition(ch, DRUNK, drink_aff[GET_OBJ_VAL(temp, 2)][DRUNK] * amount / 4);
|
||||
gain_condition(ch, FULL, drink_aff[GET_OBJ_VAL(temp, 2)][FULL] * amount / 4);
|
||||
gain_condition(ch, HUNGER, drink_aff[GET_OBJ_VAL(temp, 2)][HUNGER] * amount / 4);
|
||||
gain_condition(ch, THIRST, drink_aff[GET_OBJ_VAL(temp, 2)][THIRST] * amount / 4);
|
||||
|
||||
if (GET_COND(ch, DRUNK) > 10)
|
||||
|
|
@ -935,7 +935,7 @@ ACMD(do_drink)
|
|||
if (GET_COND(ch, THIRST) > 20)
|
||||
send_to_char(ch, "You don't feel thirsty any more.\r\n");
|
||||
|
||||
if (GET_COND(ch, FULL) > 20)
|
||||
if (GET_COND(ch, HUNGER) > 20)
|
||||
send_to_char(ch, "You are full.\r\n");
|
||||
|
||||
if (GET_OBJ_VAL(temp, 3)) { /* The crap was poisoned ! */
|
||||
|
|
@ -990,7 +990,7 @@ ACMD(do_eat)
|
|||
send_to_char(ch, "You can't eat THAT!\r\n");
|
||||
return;
|
||||
}
|
||||
if (GET_COND(ch, FULL) > 20) {/* Stomach full */
|
||||
if (GET_COND(ch, HUNGER) > 20) {/* Stomach full */
|
||||
send_to_char(ch, "You are too full to eat more!\r\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -1008,9 +1008,9 @@ ACMD(do_eat)
|
|||
|
||||
amount = (subcmd == SCMD_EAT ? GET_OBJ_VAL(food, 0) : 1);
|
||||
|
||||
gain_condition(ch, FULL, amount);
|
||||
gain_condition(ch, HUNGER, amount);
|
||||
|
||||
if (GET_COND(ch, FULL) > 20)
|
||||
if (GET_COND(ch, HUNGER) > 20)
|
||||
send_to_char(ch, "You are full.\r\n");
|
||||
|
||||
if (GET_OBJ_VAL(food, 3) && (GET_LEVEL(ch) < LVL_IMMORT)) {
|
||||
|
|
|
|||
|
|
@ -905,7 +905,7 @@ void do_stat_character(struct char_data *ch, struct char_data *k)
|
|||
send_to_char(ch, "eq: %d\r\n", i2);
|
||||
|
||||
if (!IS_NPC(k))
|
||||
send_to_char(ch, "Hunger: %d, Thirst: %d, Drunk: %d\r\n", GET_COND(k, FULL), GET_COND(k, THIRST), GET_COND(k, DRUNK));
|
||||
send_to_char(ch, "Hunger: %d, Thirst: %d, Drunk: %d\r\n", GET_COND(k, HUNGER), GET_COND(k, THIRST), GET_COND(k, DRUNK));
|
||||
|
||||
column = send_to_char(ch, "Master is: %s, Followers are:", k->master ? GET_NAME(k->master) : "<none>");
|
||||
if (!k->followers)
|
||||
|
|
@ -2881,16 +2881,14 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va
|
|||
affect_total(vict);
|
||||
break;
|
||||
case 13: /* drunk */
|
||||
case 20: /* hunger */
|
||||
case 49: /* thirst */
|
||||
if (!str_cmp(val_arg, "off")) {
|
||||
GET_COND(vict, (mode - 29)) = -1; /* warning: magic number here */
|
||||
send_to_char(ch, "%s's %s now off.\r\n", GET_NAME(vict), set_fields[mode].cmd);
|
||||
GET_COND(vict, DRUNK) = -1;
|
||||
send_to_char(ch, "%s's drunkenness is now off.\r\n", GET_NAME(vict));
|
||||
} else if (is_number(val_arg)) {
|
||||
value = atoi(val_arg);
|
||||
RANGE(0, 24);
|
||||
GET_COND(vict, (mode - 29)) = value; /* and here too */
|
||||
send_to_char(ch, "%s's %s set to %d.\r\n", GET_NAME(vict), set_fields[mode].cmd, value);
|
||||
GET_COND(vict, DRUNK) = value;
|
||||
send_to_char(ch, "%s's drunkenness set to %d.\r\n", GET_NAME(vict), value);
|
||||
} else {
|
||||
send_to_char(ch, "Must be 'off' or a value from 0 to 24.\r\n");
|
||||
return (0);
|
||||
|
|
@ -2921,7 +2919,21 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va
|
|||
vict->points.hitroll = RANGE(-20, 20);
|
||||
affect_total(vict);
|
||||
break;
|
||||
case 21: /* int */
|
||||
case 20: /* hunger */
|
||||
if (!str_cmp(val_arg, "off")) {
|
||||
GET_COND(vict, HUNGER) = -1;
|
||||
send_to_char(ch, "%s's hunger is now off.\r\n", GET_NAME(vict));
|
||||
} else if (is_number(val_arg)) {
|
||||
value = atoi(val_arg);
|
||||
RANGE(0, 24);
|
||||
GET_COND(vict, HUNGER) = value;
|
||||
send_to_char(ch, "%s's hunger set to %d.\r\n", GET_NAME(vict), value);
|
||||
} else {
|
||||
send_to_char(ch, "Must be 'off' or a value from 0 to 24.\r\n");
|
||||
return (0);
|
||||
}
|
||||
break;
|
||||
case 21: /* int */
|
||||
if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD)
|
||||
RANGE(3, 25);
|
||||
else
|
||||
|
|
@ -3091,7 +3103,21 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va
|
|||
case 48: /* thief */
|
||||
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_THIEF);
|
||||
break;
|
||||
case 50: /* title */
|
||||
case 49: /* thirst */
|
||||
if (!str_cmp(val_arg, "off")) {
|
||||
GET_COND(vict, THIRST) = -1;
|
||||
send_to_char(ch, "%s's thirst is now off.\r\n", GET_NAME(vict));
|
||||
} else if (is_number(val_arg)) {
|
||||
value = atoi(val_arg);
|
||||
RANGE(0, 24);
|
||||
GET_COND(vict, THIRST) = value;
|
||||
send_to_char(ch, "%s's thirst set to %d.\r\n", GET_NAME(vict), value);
|
||||
} else {
|
||||
send_to_char(ch, "Must be 'off' or a value from 0 to 24.\r\n");
|
||||
return (0);
|
||||
}
|
||||
break;
|
||||
case 50: /* title */
|
||||
set_title(vict, val_arg);
|
||||
send_to_char(ch, "%s's title is now: %s\r\n", GET_NAME(vict), GET_TITLE(vict));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1501,7 +1501,7 @@ void do_start(struct char_data *ch)
|
|||
GET_MOVE(ch) = GET_MAX_MOVE(ch);
|
||||
|
||||
GET_COND(ch, THIRST) = 24;
|
||||
GET_COND(ch, FULL) = 24;
|
||||
GET_COND(ch, HUNGER) = 24;
|
||||
GET_COND(ch, DRUNK) = 0;
|
||||
|
||||
if (CONFIG_SITEOK_ALL)
|
||||
|
|
|
|||
10
src/limits.c
10
src/limits.c
|
|
@ -95,7 +95,7 @@ int mana_gain(struct char_data *ch)
|
|||
if (IS_MAGIC_USER(ch) || IS_CLERIC(ch))
|
||||
gain *= 2;
|
||||
|
||||
if ((GET_COND(ch, FULL) == 0) || (GET_COND(ch, THIRST) == 0))
|
||||
if ((GET_COND(ch, HUNGER) == 0) || (GET_COND(ch, THIRST) == 0))
|
||||
gain /= 4;
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ int hit_gain(struct char_data *ch)
|
|||
if (IS_MAGIC_USER(ch) || IS_CLERIC(ch))
|
||||
gain /= 2; /* Ouch. */
|
||||
|
||||
if ((GET_COND(ch, FULL) == 0) || (GET_COND(ch, THIRST) == 0))
|
||||
if ((GET_COND(ch, HUNGER) == 0) || (GET_COND(ch, THIRST) == 0))
|
||||
gain /= 4;
|
||||
}
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ int move_gain(struct char_data *ch)
|
|||
break;
|
||||
}
|
||||
|
||||
if ((GET_COND(ch, FULL) == 0) || (GET_COND(ch, THIRST) == 0))
|
||||
if ((GET_COND(ch, HUNGER) == 0) || (GET_COND(ch, THIRST) == 0))
|
||||
gain /= 4;
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ void gain_condition(struct char_data *ch, int condition, int value)
|
|||
return;
|
||||
|
||||
switch (condition) {
|
||||
case FULL:
|
||||
case HUNGER:
|
||||
send_to_char(ch, "You are hungry.\r\n");
|
||||
break;
|
||||
case THIRST:
|
||||
|
|
@ -401,7 +401,7 @@ void point_update(void)
|
|||
for (i = character_list; i; i = next_char) {
|
||||
next_char = i->next;
|
||||
|
||||
gain_condition(i, FULL, -1);
|
||||
gain_condition(i, HUNGER, -1);
|
||||
gain_condition(i, DRUNK, -1);
|
||||
gain_condition(i, THIRST, -1);
|
||||
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ int load_char(const char *name, struct char_data *ch)
|
|||
GET_INVIS_LEV(ch) = PFDEF_INVISLEV;
|
||||
GET_FREEZE_LEV(ch) = PFDEF_FREEZELEV;
|
||||
GET_WIMP_LEV(ch) = PFDEF_WIMPLEV;
|
||||
GET_COND(ch, FULL) = PFDEF_HUNGER;
|
||||
GET_COND(ch, HUNGER) = PFDEF_HUNGER;
|
||||
GET_COND(ch, THIRST) = PFDEF_THIRST;
|
||||
GET_COND(ch, DRUNK) = PFDEF_DRUNK;
|
||||
GET_BAD_PWS(ch) = PFDEF_BADPWS;
|
||||
|
|
@ -346,7 +346,7 @@ int load_char(const char *name, struct char_data *ch)
|
|||
else if (!strcmp(tag, "Home")) GET_HOME(ch) = atoi(line);
|
||||
else if (!strcmp(tag, "Host")) GET_HOST(ch) = strdup(line);
|
||||
else if (!strcmp(tag, "Hrol")) GET_HITROLL(ch) = atoi(line);
|
||||
else if (!strcmp(tag, "Hung")) GET_COND(ch, FULL) = atoi(line);
|
||||
else if (!strcmp(tag, "Hung")) GET_COND(ch, HUNGER) = atoi(line);
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
|
|
@ -426,7 +426,7 @@ int load_char(const char *name, struct char_data *ch)
|
|||
if (GET_LEVEL(ch) >= LVL_IMMORT) {
|
||||
for (i = 1; i <= MAX_SKILLS; i++)
|
||||
GET_SKILL(ch, i) = 100;
|
||||
GET_COND(ch, FULL) = -1;
|
||||
GET_COND(ch, HUNGER) = -1;
|
||||
GET_COND(ch, THIRST) = -1;
|
||||
GET_COND(ch, DRUNK) = -1;
|
||||
}
|
||||
|
|
@ -577,7 +577,7 @@ void save_char(struct char_data * ch)
|
|||
if (GET_BAD_PWS(ch) != PFDEF_BADPWS) fprintf(fl, "Badp: %d\n", GET_BAD_PWS(ch));
|
||||
if (GET_PRACTICES(ch) != PFDEF_PRACTICES) fprintf(fl, "Lern: %d\n", GET_PRACTICES(ch));
|
||||
|
||||
if (GET_COND(ch, FULL) != PFDEF_HUNGER && GET_LEVEL(ch) < LVL_IMMORT) fprintf(fl, "Hung: %d\n", GET_COND(ch, FULL));
|
||||
if (GET_COND(ch, HUNGER) != PFDEF_HUNGER && GET_LEVEL(ch) < LVL_IMMORT) fprintf(fl, "Hung: %d\n", GET_COND(ch, HUNGER));
|
||||
if (GET_COND(ch, THIRST) != PFDEF_THIRST && GET_LEVEL(ch) < LVL_IMMORT) fprintf(fl, "Thir: %d\n", GET_COND(ch, THIRST));
|
||||
if (GET_COND(ch, DRUNK) != PFDEF_DRUNK && GET_LEVEL(ch) < LVL_IMMORT) fprintf(fl, "Drnk: %d\n", GET_COND(ch, DRUNK));
|
||||
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@
|
|||
|
||||
/* Player conditions */
|
||||
#define DRUNK 0
|
||||
#define FULL 1
|
||||
#define HUNGER 1
|
||||
#define THIRST 2
|
||||
|
||||
|
||||
|
|
@ -840,7 +840,7 @@ struct player_special_data_saved {
|
|||
room_vnum load_room; /* Which room to place char in */
|
||||
long /*bitvector_t*/ pref; /* preference flags for PC's. */
|
||||
ubyte bad_pws; /* number of bad password attemps */
|
||||
sbyte conditions[3]; /* Drunk, full, thirsty */
|
||||
sbyte conditions[3]; /* Drunk, hunger, thirst */
|
||||
|
||||
ubyte page_length;
|
||||
int spells_to_learn; /* How many can you learn yet this level*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue