OSDN Git Service

Merge branch 'master' of git.osdn.net:/gitroot/hengband/hengband
[hengband/hengband.git] / src / status / action-setter.c
1 /*!
2  * @brief プレイヤーの継続行動処理
3  * @date 2014/01/01
4  * @author
5  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6  *
7  * This software may be copied and distributed for educational, research,
8  * and not for profit purposes provided that this copyright and statement
9  * are included in all such copies.  Other copyrights may also apply.
10  *
11  * 2013 Deskull rearranged comment for Doxygen.
12  */
13
14 #include "status/action-setter.h"
15 #include "core/player-redraw-types.h"
16 #include "core/player-update-types.h"
17 #include "player/attack-defense-types.h"
18 #include "player/special-defense-types.h"
19 #include "spell-realm/spells-hex.h"
20 #include "view/display-messages.h"
21
22 /*!
23  * @brief プレイヤーの継続行動を設定する。
24  * @param typ 継続行動のID\n
25  * #ACTION_NONE / #ACTION_SEARCH / #ACTION_REST / #ACTION_LEARN / #ACTION_FISH / #ACTION_KAMAE / #ACTION_KATA / #ACTION_SING / #ACTION_HAYAGAKE / #ACTION_SPELL
26  * から選択。
27  * @return なし
28  */
29 void set_action(player_type *creature_ptr, ACTION_IDX typ)
30 {
31     int prev_typ = creature_ptr->action;
32     if (typ == prev_typ) {
33         return;
34     }
35
36     switch (prev_typ) {
37     case ACTION_SEARCH: {
38         msg_print(_("探索をやめた。", "You no longer walk carefully."));
39         creature_ptr->redraw |= (PR_SPEED);
40         break;
41     }
42     case ACTION_REST: {
43         creature_ptr->resting = 0;
44         break;
45     }
46     case ACTION_LEARN: {
47         msg_print(_("学習をやめた。", "You stop learning."));
48         creature_ptr->new_mane = FALSE;
49         break;
50     }
51     case ACTION_KAMAE: {
52         msg_print(_("構えをといた。", "You stop assuming the special stance."));
53         creature_ptr->special_defense &= ~(KAMAE_MASK);
54         break;
55     }
56     case ACTION_KATA: {
57         msg_print(_("型を崩した。", "You stop assuming the special stance."));
58         creature_ptr->special_defense &= ~(KATA_MASK);
59         creature_ptr->update |= (PU_MONSTERS);
60         creature_ptr->redraw |= (PR_STATUS);
61         break;
62     }
63     case ACTION_SING: {
64         msg_print(_("歌うのをやめた。", "You stop singing."));
65         break;
66     }
67     case ACTION_HAYAGAKE: {
68         msg_print(_("足が重くなった。", "You are no longer walking extremely fast."));
69         take_turn(creature_ptr, 100);
70         break;
71     }
72     case ACTION_SPELL: {
73         msg_print(_("呪文の詠唱を中断した。", "You stopped casting."));
74         break;
75     }
76     }
77
78     creature_ptr->action = typ;
79
80     /* If we are requested other action, stop singing */
81     if (prev_typ == ACTION_SING)
82         stop_singing(creature_ptr);
83
84     if (prev_typ == ACTION_SPELL)
85         stop_hex_spell(creature_ptr);
86
87     switch (creature_ptr->action) {
88     case ACTION_SEARCH: {
89         msg_print(_("注意深く歩き始めた。", "You begin to walk carefully."));
90         creature_ptr->redraw |= (PR_SPEED);
91         break;
92     }
93     case ACTION_LEARN: {
94         msg_print(_("学習を始めた。", "You begin learning"));
95         break;
96     }
97     case ACTION_FISH: {
98         msg_print(_("水面に糸を垂らした...", "You begin fishing..."));
99         break;
100     }
101     case ACTION_HAYAGAKE: {
102         msg_print(_("足が羽のように軽くなった。", "You begin to walk extremely fast."));
103         break;
104     }
105     default: {
106         break;
107     }
108     }
109
110     creature_ptr->update |= (PU_BONUS);
111     creature_ptr->redraw |= (PR_STATE);
112 }