From: Christian Heller Date: Sat, 14 Mar 2015 01:47:06 +0000 (+0100) Subject: Greatly simplify hungering / over-eating. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards?a=commitdiff_plain;h=2fcc592d683e89a24d69db391c8ccd842be0d542;p=plomrogue Greatly simplify hungering / over-eating. --- diff --git a/SERVER_COMMANDS b/SERVER_COMMANDS index 5762ea4..8d2df96 100644 --- a/SERVER_COMMANDS +++ b/SERVER_COMMANDS @@ -169,8 +169,10 @@ Set selected thing's lifepoints to argument. T_SATIATION [-32768 to 32767] Set selected thing's satiation score. If above zero, and thing's lifepoints are below its thing type's initial lifepoints, there is a 1/32 chance each turn of -waiting action that the thing's lifepoints will rise. For values affecting the -thing's lifepoints negatively, see note on TT_LIFEPOINTS. +waiting action that the thing's lifepoints will rise. Each turn, there is a +chance of hitpoint loss that grows with the satiation score's absolute value. +Each turn, T_SATIATION lessens by the square root of the thing's type's start +hitpoints (see TT_LIFEPOINTS). T_CARRIES [0 to 255] Add thing of ID in argument to inventory of selected thing, if said thing is @@ -209,14 +211,8 @@ MAKE_WORLD command to argument. TT_LIFEPOINTS [0-255] Set selected thing type's initial lifepoints value to argument. Things of 0 -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 type may then suffer a lifepoint decrement to the -chance 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.) +lifepoints are considered inanimate, otherwise animate. The square root of this +is the amount things of the type suffer satiation score loss each turn. TT_SYMBOL [char] Set to argument symbol by which things of the selected type are represented on diff --git a/roguelike-server b/roguelike-server index 41506c0..21aef5a 100755 --- a/roguelike-server +++ b/roguelike-server @@ -1091,12 +1091,9 @@ def try_healing(t): def hunger(t): """Decrement t's satiation,dependent on it trigger lifepoint dec chance.""" if t["T_SATIATION"] > -32768: - t["T_SATIATION"] -= 1 - if not world_db["ThingTypes"][t["T_TYPE"]]["TT_LIFEPOINTS"]: - raise RuntimeError("A thing that should not hunger is hungering.") - stomach = int(32767 / world_db["ThingTypes"][t["T_TYPE"]]["TT_LIFEPOINTS"]) - if int(int(abs(t["T_SATIATION"]) / stomach) - / ((rand.next() % stomach) + 1)): + max_hp = world_db["ThingTypes"][t["T_TYPE"]]["TT_LIFEPOINTS"] + t["T_SATIATION"] -= int(math.sqrt(max_hp)) + if 0 != t["T_SATIATION"] and 0 == int(rand.next() / abs(t["T_SATIATION"])): if t == world_db["Things"][0]: if t["T_SATIATION"] < 0: strong_write(io_db["file_out"], "LOG You suffer from hunger.\n")