OSDN Git Service

Merge pull request #1929 from habu1010/feature/fix-smith-object-stack
[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-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     if (!SpellHex(player_ptr).is_spelling_specific(HEX_INHALE) && cmd_limit_arena(player_ptr))
33         return;
34
35     PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU, SamuraiStanceType::KOUKIJIN });
36
37     concptr q = _("どの薬を飲みますか? ", "Quaff which potion? ");
38     concptr s = _("飲める薬がない。", "You have no potions to quaff.");
39
40     OBJECT_IDX item;
41     if (!choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), FuncItemTester(item_tester_hook_quaff, player_ptr)))
42         return;
43
44     ObjectQuaffEntity(player_ptr).execute(item);
45 }