OSDN Git Service

Merge remote-tracking branch 'remotes/origin/For2.2.2-Fix-Hourier' into For2.2.2...
[hengband/hengband.git] / src / player / digestion-processor.c
1 #include "system/angband.h"
2 #include "player/digestion-processor.h"
3 #include "world/world.h"
4 #include "realm/realm-song.h"
5 #include "player/player-damage.h"
6 #include "player/player-effects.h"
7 #include "monster/creature.h"
8 #include "player/player-move.h"
9 #include "object-enchant/trc-types.h"
10
11 /*!
12  * @brief 10ゲームターンが進行するごとにプレイヤーの腹を減らす
13  * @param creature_ptr プレーヤーへの参照ポインタ
14  * @return なし
15  */
16 void starve_player(player_type* creature_ptr)
17 {
18     if (creature_ptr->phase_out)
19         return;
20
21     if (creature_ptr->food >= PY_FOOD_MAX) {
22         (void)set_food(creature_ptr, creature_ptr->food - 100);
23     } else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5))) {
24         int digestion = SPEED_TO_ENERGY(creature_ptr->pspeed);
25         if (creature_ptr->regenerate)
26             digestion += 20;
27         if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
28             digestion += 20;
29         if (creature_ptr->cursed & TRC_FAST_DIGEST)
30             digestion += 30;
31
32         if (creature_ptr->slow_digest)
33             digestion -= 5;
34
35         if (digestion < 1)
36             digestion = 1;
37         if (digestion > 100)
38             digestion = 100;
39
40         (void)set_food(creature_ptr, creature_ptr->food - digestion);
41     }
42
43     if ((creature_ptr->food >= PY_FOOD_FAINT))
44         return;
45
46     if (!creature_ptr->paralyzed && (randint0(100) < 10)) {
47         msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
48         disturb(creature_ptr, TRUE, TRUE);
49         (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 1 + randint0(5));
50     }
51
52     if (creature_ptr->food < PY_FOOD_STARVE) {
53         HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
54         if (!IS_INVULN(creature_ptr))
55             take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
56     }
57 }