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