1 #include "view/object-describer.h"
2 #include "cmd-action/cmd-spell.h"
3 #include "flavor/flavor-describer.h"
4 #include "flavor/object-flavor-types.h"
5 #include "object-enchant/special-object-flags.h"
6 #include "object/tval-types.h"
7 #include "perception/object-perception.h"
8 #include "player-base/player-class.h"
9 #include "realm/realm-names-table.h"
10 #include "spell/spell-info.h"
11 #include "system/object-type-definition.h"
12 #include "system/player-type-definition.h"
13 #include "term/term-color-types.h"
14 #include "view/display-messages.h"
17 * @brief 魔道具の使用回数の残量を示すメッセージを表示する /
18 * Describe the charges on an item in the inventory.
19 * @param player_ptr プレイヤーへの参照ポインタ
20 * @param item 残量を表示したいプレイヤーのアイテム所持スロット
22 void inven_item_charges(PlayerType *player_ptr, INVENTORY_IDX item)
24 auto *o_ptr = &player_ptr->inventory_list[item];
25 if ((o_ptr->tval != ItemKindType::STAFF) && (o_ptr->tval != ItemKindType::WAND))
27 if (!o_ptr->is_known())
31 if (o_ptr->pval <= 0) {
32 msg_print("もう魔力が残っていない。");
34 msg_format("あと %d 回分の魔力が残っている。", o_ptr->pval);
37 if (o_ptr->pval != 1) {
38 msg_format("You have %d charges remaining.", o_ptr->pval);
42 msg_format("You have %d charge remaining.", o_ptr->pval);
48 * @brief アイテムの残り所持数メッセージを表示する /
49 * Describe an item in the inventory.
50 * @param player_ptr プレイヤーへの参照ポインタ
51 * @param item 残量を表示したいプレイヤーのアイテム所持スロット
53 void inven_item_describe(PlayerType *player_ptr, INVENTORY_IDX item)
55 auto *o_ptr = &player_ptr->inventory_list[item];
56 GAME_TEXT o_name[MAX_NLEN];
57 describe_flavor(player_ptr, o_name, o_ptr, 0);
59 if (o_ptr->number <= 0) {
60 msg_format("もう%sを持っていない。", o_name);
62 msg_format("まだ %sを持っている。", o_name);
65 msg_format("You have %s.", o_name);
70 * @brief 現在アクティブになっているウィンドウにオブジェクトの詳細を表示する /
71 * Hack -- display an object kind in the current window
72 * @param player_ptr プレイヤーへの参照ポインタ
73 * @param k_idx ベースアイテムの参照ID
75 * Include list of usable spells for readible books
77 void display_koff(PlayerType *player_ptr, KIND_OBJECT_IDX k_idx)
83 GAME_TEXT o_name[MAX_NLEN];
84 for (int y = 0; y < game_term->hgt; y++) {
85 term_erase(0, y, 255);
93 describe_flavor(player_ptr, o_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY | OD_STORE));
95 term_putstr(0, 0, -1, TERM_WHITE, o_name);
97 use_realm = tval2realm(q_ptr->tval);
99 if (player_ptr->realm1 || player_ptr->realm2) {
100 if ((use_realm != player_ptr->realm1) && (use_realm != player_ptr->realm2))
103 PlayerClass pc(player_ptr);
104 if (!pc.is_every_magic())
106 if (!is_magic(use_realm))
108 if (pc.equals(PlayerClassType::RED_MAGE) && (use_realm != REALM_ARCANE) && (sval > 1))
113 SPELL_IDX spells[64];
115 for (int spell = 0; spell < 32; spell++) {
116 if (fake_spell_flags[sval] & (1UL << spell)) {
117 spells[num++] = spell;
121 print_spells(player_ptr, 0, spells, num, 2, 0, use_realm);