OSDN Git Service

Merge remote-tracking branch 'remotes/hengbandosx/english-mind-edits' into feature...
[hengband/hengband.git] / src / mutation / mutation-techniques.c
1 /*!
2  * @brief 突然変異でのみ得ることができる特殊能力処理
3  * @date 2020/07/04
4  * @author Hourier
5  */
6
7 #include "mutation/mutation-techniques.h"
8 #include "cmd-action/cmd-attack.h"
9 #include "grid/feature.h"
10 #include "grid/grid.h"
11 #include "monster/monster-info.h"
12 #include "player/digestion-processor.h"
13 #include "player/player-move.h"
14 #include "system/floor-type-definition.h"
15 #include "target/target-getter.h"
16 #include "util/bit-flags-calculator.h"
17 #include "view/display-messages.h"
18
19 /*!
20  * 岩石食い
21  * @param caster_ptr プレーヤーへの参照ポインタ
22  * @return コマンドの入力方向に地形があればTRUE
23  */
24 bool eat_rock(player_type *caster_ptr)
25 {
26     DIRECTION dir;
27     if (!get_direction(caster_ptr, &dir, FALSE, FALSE))
28         return FALSE;
29
30     POSITION y = caster_ptr->y + ddy[dir];
31     POSITION x = caster_ptr->x + ddx[dir];
32     grid_type *g_ptr;
33     g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
34     feature_type *f_ptr, *mimic_f_ptr;
35     f_ptr = &f_info[g_ptr->feat];
36     mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
37
38     stop_mouth(caster_ptr);
39     if (!has_flag(mimic_f_ptr->flags, FF_HURT_ROCK)) {
40         msg_print(_("この地形は食べられない。", "You cannot eat this feature."));
41     } else if (has_flag(f_ptr->flags, FF_PERMANENT)) {
42         msg_format(_("いてっ!この%sはあなたの歯より硬い!", "Ouch!  This %s is harder than your teeth!"), f_name + mimic_f_ptr->name);
43     } else if (g_ptr->m_idx) {
44         monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
45         msg_print(_("何かが邪魔しています!", "There's something in the way!"));
46
47         if (!m_ptr->ml || !is_pet(m_ptr))
48             do_cmd_attack(caster_ptr, y, x, 0);
49     } else if (has_flag(f_ptr->flags, FF_TREE)) {
50         msg_print(_("木の味は好きじゃない!", "You don't like the woody taste!"));
51     } else if (has_flag(f_ptr->flags, FF_GLASS)) {
52         msg_print(_("ガラスの味は好きじゃない!", "You don't like the glassy taste!"));
53     } else if (has_flag(f_ptr->flags, FF_DOOR) || has_flag(f_ptr->flags, FF_CAN_DIG)) {
54         (void)set_food(caster_ptr, caster_ptr->food + 3000);
55     } else if (has_flag(f_ptr->flags, FF_MAY_HAVE_GOLD) || has_flag(f_ptr->flags, FF_HAS_GOLD)) {
56         (void)set_food(caster_ptr, caster_ptr->food + 5000);
57     } else {
58         msg_format(_("この%sはとてもおいしい!", "This %s is very filling!"), f_name + mimic_f_ptr->name);
59         (void)set_food(caster_ptr, caster_ptr->food + 10000);
60     }
61
62     cave_alter_feat(caster_ptr, y, x, FF_HURT_ROCK);
63     (void)move_player_effect(caster_ptr, y, x, MPE_DONT_PICKUP);
64     return TRUE;
65 }