OSDN Git Service

72ae782fca35161b16a5cd466634fe62ae0b45a1
[hengbandforosx/hengbandosx.git] / src / spell-realm / spells-arcane.cpp
1 #include "spell-realm/spells-arcane.h"
2 #include "core/player-update-types.h"
3 #include "inventory/inventory-slot-types.h"
4 #include "sv-definition/sv-lite-types.h"
5 #include "system/object-type-definition.h"
6 #include "system/player-type-definition.h"
7 #include "view/display-messages.h"
8
9 /*!
10  * @brief 寿命つき光源の燃素追加処理 /
11  * Charge a lite (torch or latern)
12  */
13 void phlogiston(player_type *player_ptr)
14 {
15     GAME_TURN max_flog = 0;
16     object_type *o_ptr = &player_ptr->inventory_list[INVEN_LITE];
17     if ((o_ptr->tval == ItemKindType::LITE) && (o_ptr->sval == SV_LITE_LANTERN))
18         max_flog = FUEL_LAMP;
19     else if ((o_ptr->tval == ItemKindType::LITE) && (o_ptr->sval == SV_LITE_TORCH))
20         max_flog = FUEL_TORCH;
21     else {
22         msg_print(_("燃素を消費するアイテムを装備していません。", "You are not wielding anything which uses phlogiston."));
23         return;
24     }
25
26     if (o_ptr->xtra4 >= max_flog) {
27         msg_print(_("このアイテムにはこれ以上燃素を補充できません。", "No more phlogiston can be put in this item."));
28         return;
29     }
30
31     o_ptr->xtra4 += (XTRA16)(max_flog / 2);
32     msg_print(_("照明用アイテムに燃素を補充した。", "You add phlogiston to your light."));
33     if (o_ptr->xtra4 >= max_flog) {
34         o_ptr->xtra4 = (XTRA16)max_flog;
35         msg_print(_("照明用アイテムは満タンになった。", "Your light is full."));
36     }
37
38     player_ptr->update |= PU_TORCH;
39 }