1 #include "player/digestion-processor.h"
2 #include "core/disturbance.h"
3 #include "core/player-redraw-types.h"
4 #include "core/player-update-types.h"
5 #include "core/speed-table.h"
6 #include "core/stuff-handler.h"
7 #include "floor/wild.h"
8 #include "game-option/disturbance-options.h"
9 #include "object-enchant/trc-types.h"
10 #include "player-info/avatar.h"
11 #include "player/player-damage.h"
12 #include "player/player-status.h"
13 #include "player/special-defense-types.h"
14 #include "status/bad-status-setter.h"
15 #include "system/player-type-definition.h"
16 #include "view/display-messages.h"
17 #include "world/world.h"
20 * @brief 10ゲームターンが進行するごとにプレイヤーの腹を減らす
21 * @param creature_ptr プレーヤーへの参照ポインタ
23 void starve_player(player_type *creature_ptr)
25 if (creature_ptr->phase_out)
28 if (creature_ptr->food >= PY_FOOD_MAX) {
29 (void)set_food(creature_ptr, creature_ptr->food - 100);
30 } else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5))) {
31 int digestion = SPEED_TO_ENERGY(creature_ptr->pspeed);
32 if (creature_ptr->regenerate)
34 if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
36 if (creature_ptr->cursed.has(TRC::FAST_DIGEST))
39 if (creature_ptr->slow_digest)
47 (void)set_food(creature_ptr, creature_ptr->food - digestion);
50 if ((creature_ptr->food >= PY_FOOD_FAINT))
53 if (!creature_ptr->paralyzed && (randint0(100) < 10)) {
54 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
55 disturb(creature_ptr, TRUE, TRUE);
56 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 1 + randint0(5));
59 if (creature_ptr->food < PY_FOOD_STARVE) {
60 HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
61 if (!is_invuln(creature_ptr))
62 take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"));
67 * @brief 空腹状態をセットする / Set "food", notice observable changes
69 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す
71 * Set "", notice observable changes\n
73 * The "food" variable can get as large as 20000, allowing the
74 * addition of the most "filling" item, Elvish Waybread, which adds
75 * 7500 food units, without overflowing the 32767 maximum limit.\n
77 * Perhaps we should disturb the player with various messages,
78 * especially messages about hunger status changes. \n
80 * Digestion of food is handled in "dungeon.c", in which, normally,
81 * the player digests about 20 food units per 100 game turns, more
82 * when "fast", more when "regenerating", less with "slow digestion",
83 * but when the player is "gorged", he digests 100 food units per 10
84 * game turns, or a full 1000 food units per 100 game turns.\n
86 * Note that the player's speed is reduced by 10 units while gorged,
87 * so if the player eats a single food ration (5000 food units) when
88 * full (15000 food units), he will be gorged for (5000/100)*10 = 500
89 * game turns, or 500/(100/5) = 25 player turns (if nothing else is
90 * affecting the player speed).\n
92 bool set_food(player_type *creature_ptr, TIME_EFFECT v)
97 v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
98 if (creature_ptr->food < PY_FOOD_FAINT) {
100 } else if (creature_ptr->food < PY_FOOD_WEAK) {
102 } else if (creature_ptr->food < PY_FOOD_ALERT) {
104 } else if (creature_ptr->food < PY_FOOD_FULL) {
106 } else if (creature_ptr->food < PY_FOOD_MAX) {
112 if (v < PY_FOOD_FAINT) {
114 } else if (v < PY_FOOD_WEAK) {
116 } else if (v < PY_FOOD_ALERT) {
118 } else if (v < PY_FOOD_FULL) {
120 } else if (v < PY_FOOD_MAX) {
126 if (old_aux < 1 && new_aux > 0)
127 chg_virtue(creature_ptr, V_PATIENCE, 2);
128 else if (old_aux < 3 && (old_aux != new_aux))
129 chg_virtue(creature_ptr, V_PATIENCE, 1);
131 chg_virtue(creature_ptr, V_TEMPERANCE, 1);
133 chg_virtue(creature_ptr, V_TEMPERANCE, -1);
135 if (new_aux > old_aux) {
138 msg_print(_("まだ空腹で倒れそうだ。", "You are still weak."));
141 msg_print(_("まだ空腹だ。", "You are still hungry."));
144 msg_print(_("空腹感がおさまった。", "You are no longer hungry."));
147 msg_print(_("満腹だ!", "You are full!"));
151 msg_print(_("食べ過ぎだ!", "You have gorged yourself!"));
152 chg_virtue(creature_ptr, V_HARMONY, -1);
153 chg_virtue(creature_ptr, V_PATIENCE, -1);
154 chg_virtue(creature_ptr, V_TEMPERANCE, -2);
159 } else if (new_aux < old_aux) {
162 msg_print(_("あまりにも空腹で気を失ってしまった!", "You are getting faint from hunger!"));
165 msg_print(_("お腹が空いて倒れそうだ。", "You are getting weak from hunger!"));
168 msg_print(_("お腹が空いてきた。", "You are getting hungry."));
171 msg_print(_("満腹感がなくなった。", "You are no longer full."));
174 msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged."));
178 if (creature_ptr->wild_mode && (new_aux < 2)) {
179 change_wild_mode(creature_ptr, FALSE);
185 creature_ptr->food = v;
190 disturb(creature_ptr, FALSE, FALSE);
191 creature_ptr->update |= (PU_BONUS);
192 creature_ptr->redraw |= (PR_HUNGER);
193 handle_stuff(creature_ptr);