OSDN Git Service

[Refactor] enum classの型名変更 DF -> DungeonFeatureType
[hengbandforosx/hengbandosx.git] / src / racial / racial-vampire.cpp
1 #include "racial/racial-vampire.h"
2 #include "dungeon/dungeon-flag-types.h"
3 #include "dungeon/dungeon.h"
4 #include "floor/geometry.h"
5 #include "hpmp/hp-mp-processor.h"
6 #include "player/digestion-processor.h"
7 #include "player/player-status.h"
8 #include "spell-kind/spells-specific-bolt.h"
9 #include "system/floor-type-definition.h"
10 #include "system/grid-type-definition.h"
11 #include "system/player-type-definition.h"
12 #include "target/target-getter.h"
13 #include "view/display-messages.h"
14
15 bool vampirism(player_type *player_ptr)
16 {
17     if (d_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::NO_MELEE)) {
18         msg_print(_("なぜか攻撃することができない。", "Something prevents you from attacking."));
19         return false;
20     }
21
22     DIRECTION dir;
23     if (!get_direction(player_ptr, &dir, false, false))
24         return false;
25
26     POSITION y = player_ptr->y + ddy[dir];
27     POSITION x = player_ptr->x + ddx[dir];
28     grid_type *g_ptr;
29     g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
30     stop_mouth(player_ptr);
31     if (!(g_ptr->m_idx)) {
32         msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
33         return false;
34     }
35
36     msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
37
38     int dummy = player_ptr->lev * 2;
39     if (!hypodynamic_bolt(player_ptr, dir, dummy)) {
40         msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
41         return true;
42     }
43
44     if (player_ptr->food < PY_FOOD_FULL)
45         (void)hp_player(player_ptr, dummy);
46     else
47         msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
48
49     /* Gain nutritional sustenance: 150/hp drained */
50     /* A Food ration gives 5000 food points (by contrast) */
51     /* Don't ever get more than "Full" this way */
52     /* But if we ARE Gorged,  it won't cure us */
53     dummy = player_ptr->food + std::min(5000, 100 * dummy);
54     if (player_ptr->food < PY_FOOD_MAX) /* Not gorged already */
55         (void)set_food(player_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
56
57     return true;
58 }