1 #include "cmd-item/cmd-refill.h"
2 #include "core/player-redraw-types.h"
3 #include "core/player-update-types.h"
4 #include "floor/floor-object.h"
5 #include "inventory/inventory-object.h"
6 #include "inventory/inventory-slot-types.h"
7 #include "object-enchant/object-ego.h"
8 #include "object-hook/hook-expendable.h"
9 #include "object/item-tester-hooker.h"
10 #include "object/item-use-flags.h"
11 #include "player/attack-defense-types.h"
12 #include "player/special-defense-types.h"
13 #include "status/action-setter.h"
14 #include "sv-definition/sv-lite-types.h"
15 #include "view/display-messages.h"
16 #include "object-enchant/tr-types.h"
17 #include "object/object-flags.h"
18 #include "util/bit-flags-calculator.h"
21 * @brief
\83\89\83\93\83^
\83\93\82É
\94R
\97¿
\82ð
\89Á
\82¦
\82é
\83R
\83}
\83\93\83h
\82Ì
\83\81\83C
\83\93\83\8b\81[
\83`
\83\93
22 * Refill the players lamp (from the pack or floor)
25 static void do_cmd_refill_lamp(player_type *user_ptr)
30 item_tester_hook = item_tester_refill_lantern;
31 concptr q = _("
\82Ç
\82Ì
\96û
\82Â
\82Ú
\82©
\82ç
\92\8d\82¬
\82Ü
\82·
\82©? ", "Refill with which flask? ");
32 concptr s = _("
\96û
\82Â
\82Ú
\82ª
\82È
\82¢
\81B", "You have no flasks of oil.");
33 o_ptr = choose_object(user_ptr, &item, q, s, USE_INVEN | USE_FLOOR, 0);
37 BIT_FLAGS flgs[TR_FLAG_SIZE], flgs2[TR_FLAG_SIZE];
38 object_flags(user_ptr, o_ptr, flgs);
40 take_turn(user_ptr, 50);
41 j_ptr = &user_ptr->inventory_list[INVEN_LITE];
42 object_flags(user_ptr, j_ptr, flgs2);
43 j_ptr->xtra4 += o_ptr->xtra4;
44 msg_print(_("
\83\89\83\93\83v
\82É
\96û
\82ð
\92\8d\82¢
\82¾
\81B", "You fuel your lamp."));
45 if (has_flag(flgs, TR_DARK_SOURCE) && (j_ptr->xtra4 > 0)) {
47 msg_print(_("
\83\89\83\93\83v
\82ª
\8fÁ
\82¦
\82Ä
\82µ
\82Ü
\82Á
\82½
\81I", "Your lamp has gone out!"));
48 } else if (has_flag(flgs, TR_DARK_SOURCE) || has_flag(flgs2, TR_DARK_SOURCE)) {
50 msg_print(_("
\82µ
\82©
\82µ
\83\89\83\93\83v
\82Í
\91S
\82
\8cõ
\82ç
\82È
\82¢
\81B", "Curiously, your lamp doesn't light."));
51 } else if (j_ptr->xtra4 >= FUEL_LAMP) {
52 j_ptr->xtra4 = FUEL_LAMP;
53 msg_print(_("
\83\89\83\93\83v
\82Ì
\96û
\82Í
\88ê
\94t
\82¾
\81B", "Your lamp is full."));
56 vary_item(user_ptr, item, -1);
57 user_ptr->update |= PU_TORCH;
61 * @brief
\8f¼
\96¾
\82ð
\91©
\82Ë
\82é
\83R
\83}
\83\93\83h
\82Ì
\83\81\83C
\83\93\83\8b\81[
\83`
\83\93
62 * Refuel the players torch (from the pack or floor)
65 static void do_cmd_refill_torch(player_type *creature_ptr)
70 item_tester_hook = object_can_refill_torch;
71 concptr q = _("
\82Ç
\82Ì
\8f¼
\96¾
\82Å
\96¾
\82©
\82è
\82ð
\8b
\82ß
\82Ü
\82·
\82©? ", "Refuel with which torch? ");
72 concptr s = _("
\91¼
\82É
\8f¼
\96¾
\82ª
\82È
\82¢
\81B", "You have no extra torches.");
73 o_ptr = choose_object(creature_ptr, &item, q, s, USE_INVEN | USE_FLOOR, 0);
77 BIT_FLAGS flgs[TR_FLAG_SIZE], flgs2[TR_FLAG_SIZE];
78 object_flags(creature_ptr, o_ptr, flgs);
80 take_turn(creature_ptr, 50);
81 j_ptr = &creature_ptr->inventory_list[INVEN_LITE];
82 object_flags(creature_ptr, j_ptr, flgs2);
83 j_ptr->xtra4 += o_ptr->xtra4 + 5;
84 msg_print(_("
\8f¼
\96¾
\82ð
\8c\8b\8d\87\82µ
\82½
\81B", "You combine the torches."));
85 if (has_flag(flgs, TR_DARK_SOURCE) && (j_ptr->xtra4 > 0)) {
87 msg_print(_("
\8f¼
\96¾
\82ª
\8fÁ
\82¦
\82Ä
\82µ
\82Ü
\82Á
\82½
\81I", "Your torch has gone out!"));
88 } else if (has_flag(flgs, TR_DARK_SOURCE) || has_flag(flgs2, TR_DARK_SOURCE)) {
90 msg_print(_("
\82µ
\82©
\82µ
\8f¼
\96¾
\82Í
\91S
\82
\8cõ
\82ç
\82È
\82¢
\81B", "Curiously, your torch doesn't light."));
91 } else if (j_ptr->xtra4 >= FUEL_TORCH) {
92 j_ptr->xtra4 = FUEL_TORCH;
93 msg_print(_("
\8f¼
\96¾
\82Ì
\8eõ
\96½
\82Í
\8f\
\95ª
\82¾
\81B", "Your torch is fully fueled."));
95 msg_print(_("
\8f¼
\96¾
\82Í
\82¢
\82Á
\82»
\82¤
\96¾
\82é
\82
\8bP
\82¢
\82½
\81B", "Your torch glows more brightly."));
97 vary_item(creature_ptr, item, -1);
98 creature_ptr->update |= PU_TORCH;
102 * @brief
\94R
\97¿
\82ð
\95â
\8f[
\82·
\82é
\83R
\83}
\83\93\83h
\82Ì
\83\81\83C
\83\93\83\8b\81[
\83`
\83\93
103 * Refill the players lamp, or restock his torches
106 void do_cmd_refill(player_type *creature_ptr)
109 o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
110 if (creature_ptr->special_defense & KATA_MUSOU)
111 set_action(creature_ptr, ACTION_NONE);
113 if (o_ptr->tval != TV_LITE)
114 msg_print(_("
\8cõ
\8c¹
\82ð
\91\95\94õ
\82µ
\82Ä
\82¢
\82È
\82¢
\81B", "You are not wielding a light."));
115 else if (o_ptr->sval == SV_LITE_LANTERN)
116 do_cmd_refill_lamp(creature_ptr);
117 else if (o_ptr->sval == SV_LITE_TORCH)
118 do_cmd_refill_torch(creature_ptr);
120 msg_print(_("
\82±
\82Ì
\8cõ
\8c¹
\82Í
\8eõ
\96½
\82ð
\89\84\82Î
\82¹
\82È
\82¢
\81B", "Your light cannot be refilled."));