TT_LIFEPOINTS [0-255]
Set selected thing type's initial lifepoints value to argument. Things of 0
-lifepoints are considered inanimate, otherwise animate.
+lifepoints are considered inanimate, otherwise animate. This value also sets the
+degree to which the selected type's things suffer from under- or over-satiation:
+If 0, not at all. Else, it defines a stomach size value of 32767 divided by it.
+Each turn a thing of the given tpe may then suffer a lifepoint decrement to the
+change of the rounded down quotient of its satiation score's absolute value by
+its stomach size value, then again divided by the latter. (This means that the
+change is always zero when the absolute value of the satiation score is lower
+than the stomach size value.)
TT_SYMBOL [char]
Set to argument symbol by which things of the selected type are represented on
thing of the selected type to emit an offspring to a random neighbor cell if one
is available that is passable and not inhabited by a thing of the same same type
or, if the proliferating thing is animate, any other animate thing.
-
-TT_STOMACH [0-32767]
-Set degree to which things of the selected type suffer from hunger or
-over-satiation: If 0, not at all. Else, each turn a thing of the given type may
-suffer a lifepoint decrement to the chance of the rounded down quotient of the
-satiation score's absolute value by the given value, then again divided by the
-latter. This means that the chance is always zero when the absolute value of the
-satiation score is lower than the given value.
TT_ID 0
TT_START_NUMBER 1
-TT_LIFEPOINTS 5
+TT_LIFEPOINTS 30
TT_SYMBOL @
TT_NAME HUMAN
TT_CONSUMABLE 0
-TT_STOMACH 2048
TT_ID 1
TT_START_NUMBER 27
-TT_LIFEPOINTS 1
+TT_LIFEPOINTS 6
TT_SYMBOL a
TT_NAME ANT
TT_CONSUMABLE 0
-TT_STOMACH 4096
TT_ID 2
TT_START_NUMBER 9
-TT_LIFEPOINTS 3
+TT_LIFEPOINTS 18
TT_SYMBOL z
TT_NAME ZOMBIE
TT_CONSUMABLE 0
-TT_STOMACH 1024
TT_ID 3
TT_START_NUMBER 3
-TT_LIFEPOINTS 9
+TT_LIFEPOINTS 54
TT_SYMBOL S
TT_NAME SHOGGOTH
TT_CONSUMABLE 0
-TT_STOMACH 512
TT_ID 4
TT_START_NUMBER 9
|| parse_val(tok0,tok1,s[S_CMD_TT_STARTN],'8',(char *) &tt->start_n)
|| parse_val(tok0,tok1,s[S_CMD_TT_SYMB],'c',(char *) &tt->char_on_map)
|| parse_val(tok0,tok1,s[S_CMD_TT_PROL],'8',(char *) &tt->proliferate)
- || parse_val(tok0,tok1,s[S_CMD_TT_STOMACH], 'u', (char *) &tt->stomach)
|| parse_val(tok0,tok1,s[S_CMD_TT_NAME],'s',(char *) &tt->name))
{
;
-char * s[45];
+char * s[44];
s[S_CMD_TT_NAME] = "TT_NAME";
s[S_CMD_TT_CORPS] = "TT_CORPSE_ID";
s[S_CMD_TT_PROL] = "TT_PROLIFERATE";
- s[S_CMD_TT_STOMACH] = "TT_STOMACH";
s[S_CMD_T_ID] = "T_ID";
s[S_CMD_T_TYPE] = "T_TYPE";
s[S_CMD_T_POSY] = "T_POSY";
S_CMD_TT_NAME,
S_CMD_TT_CORPS,
S_CMD_TT_PROL,
- S_CMD_TT_STOMACH,
S_CMD_T_ID,
S_CMD_T_TYPE,
S_CMD_T_POSY,
extern void init_strings();
-extern char * s[45];
+extern char * s[44];
write_key_space_string(file, s[S_CMD_TT_NAME], tt->name);
write_key_space_uvalue(file, s[S_CMD_TT_CONSUM], tt->consumable);
write_key_space_uvalue(file, s[S_CMD_TT_PROL], tt->proliferate);
- write_key_space_uvalue(file, s[S_CMD_TT_STOMACH], tt->stomach);
try_fputc('\n', file, __func__);
}
for (tt = world.thing_types; tt; tt = tt->next)
#include "thing_actions.h"
#include <stddef.h> /* NULL */
-#include <stdint.h> /* uint8_t, INT16_MIN */
+#include <stdint.h> /* uint8_t, INT16_MIN, INT16_MAX */
#include <stdio.h> /* sprintf() */
#include <stdlib.h> /* free() */
#include <string.h> /* strlen() */
-#include "../common/rexit.h" /* exit_trouble() */
+#include "../common/rexit.h" /* exit_err(), exit_trouble() */
#include "../common/try_malloc.h" /* try_malloc() */
#include "../common/yx_uint8.h" /* yx_uint8 */
#include "field_of_view.h" /* build_fov_map() */
extern void hunger(struct Thing * t)
{
- struct ThingType * tt = get_thing_type(t->type);
- if (!(tt->stomach))
- {
- return;
- }
if (t->satiation > INT16_MIN)
{
t->satiation--;
}
+ struct ThingType * tt = get_thing_type(t->type);
uint16_t testbase = t->satiation < 0 ? -(t->satiation) : t->satiation;
- uint16_t endurance = tt->stomach;
+ exit_err(!(tt->lifepoints), "A thing that should not hunger is hungering.");
+ uint16_t endurance = INT16_MAX / tt->lifepoints;
if ((testbase / endurance) / ((rrand() % endurance) + 1))
{
if (get_player() == t)
extern void actor_use(struct Thing * t);
/* Decrement "t"'s satiation and trigger a chance (dependent on over-/under-
- * satiation value) of lifepoint decrement, when its type's .stomach is >0.
+ * satiation value) of lifepoint decrement.
*/
extern void hunger(struct Thing * t);
uint8_t id; /* thing type identifier / sets .type */
char char_on_map; /* thing symbol to appear on map */
char * name; /* string to describe thing in game log */
- uint16_t stomach; /* if >0, defines onset & chance of hunger suffering */
uint16_t consumable; /* can be eaten if !0, for so much .satiation win */
uint8_t corpse_id; /* type to change thing into upon destruction */
uint8_t lifepoints; /* default start value for thing's .lifepoints */