OSDN Git Service

Merge pull request #3532 from sikabane-works/release/3.0.0.87-alpha
[hengbandforosx/hengbandosx.git] / src / cmd-item / cmd-quaff.cpp
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/quaff-execution.h"
12 #include "object/item-tester-hooker.h"
13 #include "object/item-use-flags.h"
14 #include "player-base/player-class.h"
15 #include "player-info/samurai-data-type.h"
16 #include "player/attack-defense-types.h"
17 #include "player/special-defense-types.h"
18 #include "realm/realm-hex-numbers.h"
19 #include "spell-realm/spells-hex.h"
20 #include "status/action-setter.h"
21 #include "system/player-type-definition.h"
22
23 /*!
24  * @brief 薬を飲むコマンドのメインルーチン /
25  * Quaff some potion (from the pack or floor)
26  */
27 void do_cmd_quaff_potion(PlayerType *player_ptr)
28 {
29     if (player_ptr->wild_mode) {
30         return;
31     }
32
33     if (!SpellHex(player_ptr).is_spelling_specific(HEX_INHALE) && cmd_limit_arena(player_ptr)) {
34         return;
35     }
36
37     PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU, SamuraiStanceType::KOUKIJIN });
38
39     concptr q = _("どの薬を飲みますか? ", "Quaff which potion? ");
40     concptr s = _("飲める薬がない。", "You have no potions to quaff.");
41
42     OBJECT_IDX item;
43     if (!choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), FuncItemTester(item_tester_hook_quaff, player_ptr))) {
44         return;
45     }
46
47     ObjectQuaffEntity(player_ptr).execute(item);
48 }