From: Christian Heller Date: Sun, 8 Feb 2015 04:47:30 +0000 (+0100) Subject: Server: Use thing's .consumable as what's pushing up its .satiation. X-Git-Tag: tce~540 X-Git-Url: https://plomlompom.com/repos/task?a=commitdiff_plain;h=8d5a9e9d57cf004d04cb9916141797b9c3a6aae6;p=plomrogue Server: Use thing's .consumable as what's pushing up its .satiation. --- diff --git a/README b/README index 49cf3a8..ac0e0a3 100644 --- a/README +++ b/README @@ -6,11 +6,11 @@ plomlompom has insanely ambitious long-term plans). You can move around a player on an island and meet different enemies. You have 5 hitpoints to lose before death. Enemies start with different amounts of -hitpoints, depending on their species. Dead enemies become dirt, skeletons or -"magic meat" -- such objects can be collected, and "magic meat" can be consumed -to gain hitpoints (if allowed to lie on the ground for a while it may even -multiply ...). Note that different kinds of movements/actions take different -numbers of turns to finish. +hitpoints, depending on their species. Dead enemies become dirt, skeletons, or +food to consume (each turn reduces one's "satiation", and the lower it is, the +stronger the chance of suffering from hunger and thereby losing hitpoints). Note +that different kinds of movements/actions take different numbers of turns to +finish. Enemies' AI is very dumb so far: Each turn, they look out for actors of different species to flee from (if their type starts out with more hitpoints diff --git a/SERVER_COMMANDS b/SERVER_COMMANDS index a5a83a2..ef52922 100644 --- a/SERVER_COMMANDS +++ b/SERVER_COMMANDS @@ -190,9 +190,9 @@ change it to the lowest unused thing type ID. If thing type of ID does not exist yet, create it with default name "(none)", corpse ID equal to the new thing type's ID, and remaining thing type attributes to 0. -TT_CONSUMABLE [0-255] +TT_CONSUMABLE [0-65535] Set selected thing type's consumability value to argument – the number of -lifepoints earned by consuming/using things of that type. +.satiation score points earned by consuming/using things of that type. TT_START_NUMBER [0-255] Set selected thing type's number of things of type to spawn on successful diff --git a/confserver/world b/confserver/world index d0a20ef..e8cb6a4 100644 --- a/confserver/world +++ b/confserver/world @@ -72,7 +72,7 @@ TT_START_NUMBER 1 TT_LIFEPOINTS 0 TT_SYMBOL m TT_NAME 'MAGIC MEAT' -TT_CONSUMABLE 3 +TT_CONSUMABLE 512 TT_PROLIFERATE 255 TT_ID 0 diff --git a/src/server/god_commands.c b/src/server/god_commands.c index d785d8c..f03dcf1 100644 --- a/src/server/god_commands.c +++ b/src/server/god_commands.c @@ -95,7 +95,7 @@ static uint8_t parse_thingtype_manipulation(char * tok0, char * tok1) return err_line(1, "No thing type defined to manipulate yet."); } int16_t id; - if ( parse_val(tok0,tok1,s[S_CMD_TT_CONSUM],'8',(char *) &tt->consumable) + if ( parse_val(tok0,tok1,s[S_CMD_TT_CONSUM],'u',(char *) &tt->consumable) || parse_val(tok0,tok1,s[S_CMD_TT_HP],'8',(char *) &tt->lifepoints) || 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) diff --git a/src/server/thing_actions.c b/src/server/thing_actions.c index 839a6e3..a5c78ba 100644 --- a/src/server/thing_actions.c +++ b/src/server/thing_actions.c @@ -317,6 +317,8 @@ extern void actor_use(struct Thing * t) { t->owns = next; } + t->satiation = t->satiation + tt->consumable > INT16_MAX ? + INT16_MAX : t->satiation + tt->consumable; t->lifepoints = t->lifepoints + tt->consumable; } } diff --git a/src/server/things.h b/src/server/things.h index 494d1a5..62ef908 100644 --- a/src/server/things.h +++ b/src/server/things.h @@ -48,9 +48,9 @@ struct ThingType 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 */ - uint8_t consumable; /* can be eaten if !0, for so much hitpoint win */ uint8_t start_n; /* how many of these does the map start with? */ uint8_t proliferate; /* if >0: inverse of chance to proliferate */ };