OSDN Git Service

Revert "Revert "Merge branch 'master' of git.osdn.net:/gitroot/hengband/hengband""
[hengband/hengband.git] / src / cmd-item / cmd-quaff.c
1 /*!
2  * @brief プレイヤーの飲むコマンド実装
3  * @date 2018/09/07
4  * @author deskull
5  */
6
7 #include "cmd-item/cmd-quaff.h"
8 #include "action/action-limited.h"
9 #include "floor/floor-object.h"
10 #include "object-hook/hook-expendable.h"
11 #include "object-use/quaff-execution.h"
12 #include "object/item-tester-hooker.h"
13 #include "object/item-use-flags.h"
14 #include "player/attack-defense-types.h"
15 #include "player/special-defense-types.h"
16 #include "status/action-setter.h"
17
18 /*!
19  * @brief 薬を飲むコマンドのメインルーチン /
20  * Quaff some potion (from the pack or floor)
21  * @return なし
22  */
23 void do_cmd_quaff_potion(player_type *creature_ptr)
24 {
25     if (creature_ptr->wild_mode)
26         return;
27
28     if (cmd_limit_arena(creature_ptr))
29         return;
30
31     if (creature_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
32         set_action(creature_ptr, ACTION_NONE);
33
34     item_tester_hook = item_tester_hook_quaff;
35     concptr q = _("どの薬を飲みますか? ", "Quaff which potion? ");
36     concptr s = _("飲める薬がない。", "You have no potions to quaff.");
37
38     OBJECT_IDX item;
39     if (!choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0))
40         return;
41
42     exe_quaff_potion(creature_ptr, item);
43 }