2 * @brief 突然変異でのみ得ることができる特殊能力処理
7 #include "mutation/mutation-techniques.h"
8 #include "cmd-action/cmd-attack.h"
9 #include "floor/geometry.h"
10 #include "grid/grid.h"
11 #include "monster/monster-info.h"
12 #include "monster/monster-util.h"
13 #include "player/digestion-processor.h"
14 #include "player/player-move.h"
15 #include "player/player-status.h"
16 #include "system/floor-type-definition.h"
17 #include "system/grid-type-definition.h"
18 #include "system/monster-entity.h"
19 #include "system/player-type-definition.h"
20 #include "system/terrain-type-definition.h"
21 #include "target/target-getter.h"
22 #include "util/bit-flags-calculator.h"
23 #include "view/display-messages.h"
27 * @param player_ptr プレイヤーへの参照ポインタ
28 * @return コマンドの入力方向に地形があればTRUE
30 bool eat_rock(PlayerType *player_ptr)
33 if (!get_direction(player_ptr, &dir)) {
37 const Pos2D pos(player_ptr->y + ddy[dir], player_ptr->x + ddx[dir]);
38 const auto &grid = player_ptr->current_floor_ptr->get_grid(pos);
39 const auto &terrain = grid.get_terrain();
40 const auto &terrain_mimic = grid.get_terrain_mimic();
42 stop_mouth(player_ptr);
43 if (terrain_mimic.flags.has_not(TerrainCharacteristics::HURT_ROCK)) {
44 msg_print(_("この地形は食べられない。", "You cannot eat this feature."));
45 } else if (terrain.flags.has(TerrainCharacteristics::PERMANENT)) {
46 msg_format(_("いてっ!この%sはあなたの歯より硬い!", "Ouch! This %s is harder than your teeth!"), terrain_mimic.name.data());
47 } else if (is_monster(grid.m_idx)) {
48 const auto &monster = player_ptr->current_floor_ptr->m_list[grid.m_idx];
49 msg_print(_("何かが邪魔しています!", "There's something in the way!"));
50 if (!monster.ml || !monster.is_pet()) {
51 do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
53 } else if (terrain.flags.has(TerrainCharacteristics::TREE)) {
54 msg_print(_("木の味は好きじゃない!", "You don't like the woody taste!"));
55 } else if (terrain.flags.has(TerrainCharacteristics::GLASS)) {
56 msg_print(_("ガラスの味は好きじゃない!", "You don't like the glassy taste!"));
57 } else if (terrain.flags.has(TerrainCharacteristics::DOOR) || terrain.flags.has(TerrainCharacteristics::CAN_DIG)) {
58 (void)set_food(player_ptr, player_ptr->food + 3000);
59 } else if (terrain.flags.has(TerrainCharacteristics::MAY_HAVE_GOLD) || terrain.flags.has(TerrainCharacteristics::HAS_GOLD)) {
60 (void)set_food(player_ptr, player_ptr->food + 5000);
62 msg_format(_("この%sはとてもおいしい!", "This %s is very filling!"), terrain_mimic.name.data());
63 (void)set_food(player_ptr, player_ptr->food + 10000);
66 cave_alter_feat(player_ptr, pos.y, pos.x, TerrainCharacteristics::HURT_ROCK);
67 (void)move_player_effect(player_ptr, pos.y, pos.x, MPE_DONT_PICKUP);