OSDN Git Service

Merge remote-tracking branch 'remotes/origin/feature/Fix-Term-Fresh' into develop
[hengband/hengband.git] / src / mind / mind-warrior.c
1 #include "mind/mind-warrior.h"
2 #include "cmd-action/cmd-attack.h"
3 #include "spell-kind/spells-teleport.h"
4 #include "system/floor-type-definition.h"
5 #include "target/target-getter.h"
6 #include "view/display-messages.h"
7
8 /*!
9  * 戦士と盗賊における、ヒット&アウェイのレイシャルパワー/突然変異
10  * @param caster_ptr プレーヤーへの参照ポインタ
11  * @return コマンドの入力先にモンスターがいたらTRUE
12  */
13 bool hit_and_away(player_type *caster_ptr)
14 {
15     DIRECTION dir;
16     if (!get_direction(caster_ptr, &dir, FALSE, FALSE))
17         return FALSE;
18     POSITION y = caster_ptr->y + ddy[dir];
19     POSITION x = caster_ptr->x + ddx[dir];
20     if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
21         do_cmd_attack(caster_ptr, y, x, 0);
22         if (randint0(caster_ptr->skill_dis) < 7)
23             msg_print(_("うまく逃げられなかった。", "You failed to run away."));
24         else
25             teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS);
26         return TRUE;
27     }
28
29     msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
30     msg_print(NULL);
31     return FALSE;
32 }
33
34 /*!
35  * 剣の舞い
36  * @param creature_ptr プレーヤーへの参照ポインタ
37  * @return 常にTRUE
38  */
39 bool sword_dancing(player_type *creature_ptr)
40 {
41     DIRECTION dir;
42     POSITION y = 0, x = 0;
43     grid_type *g_ptr;
44     for (int i = 0; i < 6; i++) {
45         dir = randint0(8);
46         y = creature_ptr->y + ddy_ddd[dir];
47         x = creature_ptr->x + ddx_ddd[dir];
48         g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
49
50         /* Hack -- attack monsters */
51         if (g_ptr->m_idx)
52             do_cmd_attack(creature_ptr, y, x, 0);
53         else {
54             msg_print(_("攻撃が空をきった。", "You attack the empty air."));
55         }
56     }
57
58     return TRUE;
59 }