3 * @brief オブジェクトの実装 / Object code, part 1
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2014 Deskull rearranged comment for Doxygen.\n
20 #include "cmd-activate.h"
21 #include "objectkind.h"
22 #include "object-ego.h"
23 #include "object-flavor.h"
24 #include "object-hook.h"
25 #include "player-move.h"
29 #include "cmd-smith.h"
31 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
38 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
40 * This involves resetting various things to their "default" state.\n
42 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
43 * "user pref file" based on the current setting of the "use_graphics"\n
44 * flag. This is useful for switching "graphics" on/off.\n
46 * The features, objects, and monsters, should all be encoded in the\n
47 * relevant "font.pref" and/or "graf.prf" files. \n
49 * The "prefs" parameter is no longer meaningful. \n
51 void reset_visuals(void)
55 /* Extract some info about terrain features */
56 for (i = 0; i < max_f_idx; i++)
58 feature_type *f_ptr = &f_info[i];
60 /* Assume we will use the underlying values */
61 for (j = 0; j < F_LIT_MAX; j++)
63 f_ptr->x_attr[j] = f_ptr->d_attr[j];
64 f_ptr->x_char[j] = f_ptr->d_char[j];
68 /* Extract default attr/char code for objects */
69 for (i = 0; i < max_k_idx; i++)
71 object_kind *k_ptr = &k_info[i];
73 /* Default attr/char */
74 k_ptr->x_attr = k_ptr->d_attr;
75 k_ptr->x_char = k_ptr->d_char;
78 /* Extract default attr/char code for monsters */
79 for (i = 0; i < max_r_idx; i++)
81 monster_race *r_ptr = &r_info[i];
83 /* Default attr/char */
84 r_ptr->x_attr = r_ptr->d_attr;
85 r_ptr->x_char = r_ptr->d_char;
92 /* Process "graf.prf" */
93 process_pref_file("graf.prf");
95 /* Access the "character" pref file */
96 sprintf(buf, "graf-%s.prf", p_ptr->base_name);
98 /* Process "graf-<playername>.prf" */
99 process_pref_file(buf);
107 /* Process "font.prf" */
108 process_pref_file("font.prf");
110 /* Access the "character" pref file */
111 sprintf(buf, "font-%s.prf", p_ptr->base_name);
113 /* Process "font-<playername>.prf" */
114 process_pref_file(buf);
119 * @brief オブジェクトのフラグ類を配列に与える
120 * Obtain the "flags" for an item
121 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
122 * @param flgs フラグ情報を受け取る配列
125 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
127 object_kind *k_ptr = &k_info[o_ptr->k_idx];
131 for (i = 0; i < TR_FLAG_SIZE; i++)
132 flgs[i] = k_ptr->flags[i];
135 if (object_is_fixed_artifact(o_ptr))
137 artifact_type *a_ptr = &a_info[o_ptr->name1];
139 for (i = 0; i < TR_FLAG_SIZE; i++)
140 flgs[i] = a_ptr->flags[i];
144 if (object_is_ego(o_ptr))
146 ego_item_type *e_ptr = &e_info[o_ptr->name2];
148 for (i = 0; i < TR_FLAG_SIZE; i++)
149 flgs[i] |= e_ptr->flags[i];
151 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
153 remove_flag(flgs, TR_SH_FIRE);
155 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
157 remove_flag(flgs, TR_INFRA);
159 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
161 remove_flag(flgs, TR_RES_BLIND);
162 remove_flag(flgs, TR_SEE_INVIS);
166 /* Random artifact ! */
167 for (i = 0; i < TR_FLAG_SIZE; i++)
168 flgs[i] |= o_ptr->art_flags[i];
170 if (object_is_smith(o_ptr))
172 int add = o_ptr->xtra3 - 1;
174 if (add < TR_FLAG_MAX)
178 else if (add == ESSENCE_TMP_RES_ACID)
180 add_flag(flgs, TR_RES_ACID);
181 add_flag(flgs, TR_ACTIVATE);
183 else if (add == ESSENCE_TMP_RES_ELEC)
185 add_flag(flgs, TR_RES_ELEC);
186 add_flag(flgs, TR_ACTIVATE);
188 else if (add == ESSENCE_TMP_RES_FIRE)
190 add_flag(flgs, TR_RES_FIRE);
191 add_flag(flgs, TR_ACTIVATE);
193 else if (add == ESSENCE_TMP_RES_COLD)
195 add_flag(flgs, TR_RES_COLD);
196 add_flag(flgs, TR_ACTIVATE);
198 else if (add == ESSENCE_SH_FIRE)
200 add_flag(flgs, TR_RES_FIRE);
201 add_flag(flgs, TR_SH_FIRE);
203 else if (add == ESSENCE_SH_ELEC)
205 add_flag(flgs, TR_RES_ELEC);
206 add_flag(flgs, TR_SH_ELEC);
208 else if (add == ESSENCE_SH_COLD)
210 add_flag(flgs, TR_RES_COLD);
211 add_flag(flgs, TR_SH_COLD);
213 else if (add == ESSENCE_RESISTANCE)
215 add_flag(flgs, TR_RES_ACID);
216 add_flag(flgs, TR_RES_ELEC);
217 add_flag(flgs, TR_RES_FIRE);
218 add_flag(flgs, TR_RES_COLD);
220 else if (add == TR_IMPACT)
222 add_flag(flgs, TR_ACTIVATE);
228 * @brief オブジェクトの明示されているフラグ類を取得する
229 * Obtain the "flags" for an item which are known to the player
230 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
231 * @param flgs フラグ情報を受け取る配列
234 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
239 object_kind *k_ptr = &k_info[o_ptr->k_idx];
242 for (i = 0; i < TR_FLAG_SIZE; i++)
245 if (!object_is_aware(o_ptr)) return;
248 for (i = 0; i < TR_FLAG_SIZE; i++)
249 flgs[i] = k_ptr->flags[i];
251 /* Must be identified */
252 if (!object_is_known(o_ptr)) return;
254 /* Ego-item (known basic flags) */
255 if (object_is_ego(o_ptr))
257 ego_item_type *e_ptr = &e_info[o_ptr->name2];
259 for (i = 0; i < TR_FLAG_SIZE; i++)
260 flgs[i] |= e_ptr->flags[i];
262 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
264 remove_flag(flgs, TR_SH_FIRE);
266 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
268 remove_flag(flgs, TR_INFRA);
270 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
272 remove_flag(flgs, TR_RES_BLIND);
273 remove_flag(flgs, TR_SEE_INVIS);
278 #ifdef SPOIL_ARTIFACTS
279 /* Full knowledge for some artifacts */
280 if (object_is_artifact(o_ptr)) spoil = TRUE;
281 #endif /* SPOIL_ARTIFACTS */
283 #ifdef SPOIL_EGO_ITEMS
284 /* Full knowledge for some ego-items */
285 if (object_is_ego(o_ptr)) spoil = TRUE;
286 #endif /* SPOIL_EGO_ITEMS */
288 /* Need full knowledge or spoilers */
289 if (spoil || (o_ptr->ident & IDENT_MENTAL))
292 if (object_is_fixed_artifact(o_ptr))
294 artifact_type *a_ptr = &a_info[o_ptr->name1];
296 for (i = 0; i < TR_FLAG_SIZE; i++)
297 flgs[i] = a_ptr->flags[i];
300 /* Random artifact ! */
301 for (i = 0; i < TR_FLAG_SIZE; i++)
302 flgs[i] |= o_ptr->art_flags[i];
305 if (object_is_smith(o_ptr))
307 int add = o_ptr->xtra3 - 1;
309 if (add < TR_FLAG_MAX)
313 else if (add == ESSENCE_TMP_RES_ACID)
315 add_flag(flgs, TR_RES_ACID);
317 else if (add == ESSENCE_TMP_RES_ELEC)
319 add_flag(flgs, TR_RES_ELEC);
321 else if (add == ESSENCE_TMP_RES_FIRE)
323 add_flag(flgs, TR_RES_FIRE);
325 else if (add == ESSENCE_TMP_RES_COLD)
327 add_flag(flgs, TR_RES_COLD);
329 else if (add == ESSENCE_SH_FIRE)
331 add_flag(flgs, TR_RES_FIRE);
332 add_flag(flgs, TR_SH_FIRE);
334 else if (add == ESSENCE_SH_ELEC)
336 add_flag(flgs, TR_RES_ELEC);
337 add_flag(flgs, TR_SH_ELEC);
339 else if (add == ESSENCE_SH_COLD)
341 add_flag(flgs, TR_RES_COLD);
342 add_flag(flgs, TR_SH_COLD);
344 else if (add == ESSENCE_RESISTANCE)
346 add_flag(flgs, TR_RES_ACID);
347 add_flag(flgs, TR_RES_ELEC);
348 add_flag(flgs, TR_RES_FIRE);
349 add_flag(flgs, TR_RES_COLD);
355 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
356 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
357 * @return concptr 発動名称を返す文字列ポインタ
359 static concptr item_activation_dragon_breath(object_type *o_ptr)
361 static char desc[256];
362 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
365 object_flags(o_ptr, flgs);
366 strcpy(desc, _("", "breath "));
368 for (i = 0; dragonbreath_info[i].flag != 0; i++)
370 if (have_flag(flgs, dragonbreath_info[i].flag))
372 if (n > 0) strcat(desc, _("、", ", "));
373 strcat(desc, dragonbreath_info[i].name);
378 strcat(desc, _("のブレス(250)", ""));
384 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
385 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
386 * @return concptr 発動名称を返す文字列ポインタ
388 static concptr item_activation_aux(object_type *o_ptr)
390 static char activation_detail[256];
394 const activation_type* const act_ptr = find_activation_info(o_ptr);
396 if (!act_ptr) return _("未定義", "something undefined");
398 desc = act_ptr->desc;
400 /* Overwrite description if it is special */
401 switch (act_ptr->index) {
403 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
404 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
407 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
408 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
411 desc = item_activation_dragon_breath(o_ptr);
414 if (o_ptr->name1 == ART_HYOUSIGI)
415 desc = _("拍子木を打ちならす", "beat wooden clappers");
417 case ACT_RESIST_ACID:
418 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
419 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
421 case ACT_RESIST_FIRE:
422 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
423 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
425 case ACT_RESIST_COLD:
426 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
427 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
429 case ACT_RESIST_ELEC:
430 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
431 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
433 case ACT_RESIST_POIS:
434 if (o_ptr->name2 == EGO_BRAND_POIS)
435 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
439 /* Timeout description */
440 constant = act_ptr->timeout.constant;
441 dice = act_ptr->timeout.dice;
442 if (constant == 0 && dice == 0) {
443 /* We can activate it every current_world_ptr->game_turn */
444 strcpy(timeout, _("いつでも", "every current_world_ptr->game_turn"));
445 } else if (constant < 0) {
446 /* Activations that have special timeout */
447 switch (act_ptr->index) {
449 sprintf(timeout, _("%d ターン毎", "every %d turns"),
450 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
453 sprintf(timeout, _("%d ターン毎", "every %d turns"),
454 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
457 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
460 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
463 strcpy(timeout, "undefined");
467 /* Normal timeout activations */
468 char constant_str[16], dice_str[16];
469 sprintf(constant_str, "%d", constant);
470 sprintf(dice_str, "d%d", dice);
471 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
472 (constant > 0) ? constant_str : "",
473 (constant > 0 && dice > 0) ? "+" : "",
474 (dice > 0) ? dice_str : "");
477 /* Build detail activate description */
478 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
480 return activation_detail;
484 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
485 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
486 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
487 * @return concptr 発動名称を返す文字列ポインタ
489 concptr item_activation(object_type *o_ptr)
491 BIT_FLAGS flgs[TR_FLAG_SIZE];
492 object_flags(o_ptr, flgs);
494 /* Require activation ability */
495 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
497 /* Get an explain of an activation */
498 if (activation_index(o_ptr))
500 return item_activation_aux(o_ptr);
504 if (o_ptr->tval == TV_WHISTLE)
506 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
509 if (o_ptr->tval == TV_CAPTURE)
511 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
514 return _("何も起きない", "Nothing");
519 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
520 * Describe a "fully identified" item
521 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
522 * @param mode 表示オプション
523 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
525 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
529 BIT_FLAGS flgs[TR_FLAG_SIZE];
533 GAME_TEXT o_name[MAX_NLEN];
538 int trivial_info = 0;
539 object_flags(o_ptr, flgs);
541 /* Extract the description */
543 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
544 (k_text + k_info[o_ptr->k_idx].text),
545 77 - 15, temp, sizeof(temp));
546 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
547 { info[i] = &temp[j]; i++;}
550 if (object_is_equipment(o_ptr))
552 /* Descriptions of a basic equipment is just a flavor */
556 /* Mega-Hack -- describe activation */
557 if (have_flag(flgs, TR_ACTIVATE))
559 info[i++] = _("始動したときの効果...", "It can be activated for...");
560 info[i++] = item_activation(o_ptr);
561 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
564 /* Figurines, a hack */
565 if (o_ptr->tval == TV_FIGURINE)
567 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
570 /* Figurines, a hack */
571 if (o_ptr->name1 == ART_STONEMASK)
573 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you current_world_ptr->game_turn into a vampire permanently.");
576 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
578 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
581 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
583 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
584 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
587 if (o_ptr->name2 == EGO_2WEAPON)
589 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
592 if (have_flag(flgs, TR_EASY_SPELL))
594 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
597 if (o_ptr->name2 == EGO_AMU_FOOL)
599 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
602 if (o_ptr->name2 == EGO_RING_THROW)
604 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
607 if (o_ptr->name2 == EGO_AMU_NAIVETY)
609 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
612 if (o_ptr->tval == TV_STATUE)
614 monster_race *r_ptr = &r_info[o_ptr->pval];
616 if (o_ptr->pval == MON_BULLGATES)
617 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
618 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
619 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
621 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
624 /* Hack -- describe lite's */
626 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
629 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
630 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
631 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
632 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
633 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
634 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
636 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
638 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
640 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
644 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
645 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
648 if(rad != 0) info[i++] = desc;
651 if (o_ptr->name2 == EGO_LITE_LONG)
653 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
656 /* And then describe it fully */
658 if (have_flag(flgs, TR_RIDING))
660 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
661 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
664 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
665 /* This information is not important enough */
669 if (have_flag(flgs, TR_STR))
671 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
673 if (have_flag(flgs, TR_INT))
675 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
677 if (have_flag(flgs, TR_WIS))
679 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
681 if (have_flag(flgs, TR_DEX))
683 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
685 if (have_flag(flgs, TR_CON))
687 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
689 if (have_flag(flgs, TR_CHR))
691 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
694 if (have_flag(flgs, TR_MAGIC_MASTERY))
696 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
699 if (have_flag(flgs, TR_STEALTH))
701 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
703 if (have_flag(flgs, TR_SEARCH))
705 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
707 if (have_flag(flgs, TR_INFRA))
709 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
711 if (have_flag(flgs, TR_TUNNEL))
713 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
715 if (have_flag(flgs, TR_SPEED))
717 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
719 if (have_flag(flgs, TR_BLOWS))
721 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
724 if (have_flag(flgs, TR_BRAND_ACID))
726 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
728 if (have_flag(flgs, TR_BRAND_ELEC))
730 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
732 if (have_flag(flgs, TR_BRAND_FIRE))
734 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
736 if (have_flag(flgs, TR_BRAND_COLD))
738 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
741 if (have_flag(flgs, TR_BRAND_POIS))
743 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
746 if (have_flag(flgs, TR_CHAOTIC))
748 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
751 if (have_flag(flgs, TR_VAMPIRIC))
753 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
756 if (have_flag(flgs, TR_IMPACT))
758 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
761 if (have_flag(flgs, TR_VORPAL))
763 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
766 if (have_flag(flgs, TR_KILL_DRAGON))
768 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
770 else if (have_flag(flgs, TR_SLAY_DRAGON))
772 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
775 if (have_flag(flgs, TR_KILL_ORC))
777 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
779 if (have_flag(flgs, TR_SLAY_ORC))
781 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
784 if (have_flag(flgs, TR_KILL_TROLL))
786 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
788 if (have_flag(flgs, TR_SLAY_TROLL))
790 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
793 if (have_flag(flgs, TR_KILL_GIANT))
795 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
797 else if (have_flag(flgs, TR_SLAY_GIANT))
799 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
802 if (have_flag(flgs, TR_KILL_DEMON))
804 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
806 if (have_flag(flgs, TR_SLAY_DEMON))
808 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
811 if (have_flag(flgs, TR_KILL_UNDEAD))
813 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
815 if (have_flag(flgs, TR_SLAY_UNDEAD))
817 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
820 if (have_flag(flgs, TR_KILL_EVIL))
822 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
824 if (have_flag(flgs, TR_SLAY_EVIL))
826 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
829 if (have_flag(flgs, TR_KILL_ANIMAL))
831 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
833 if (have_flag(flgs, TR_SLAY_ANIMAL))
835 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
838 if (have_flag(flgs, TR_KILL_HUMAN))
840 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
842 if (have_flag(flgs, TR_SLAY_HUMAN))
844 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
847 if (have_flag(flgs, TR_FORCE_WEAPON))
849 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
851 if (have_flag(flgs, TR_DEC_MANA))
853 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
855 if (have_flag(flgs, TR_SUST_STR))
857 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
859 if (have_flag(flgs, TR_SUST_INT))
861 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
863 if (have_flag(flgs, TR_SUST_WIS))
865 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
867 if (have_flag(flgs, TR_SUST_DEX))
869 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
871 if (have_flag(flgs, TR_SUST_CON))
873 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
875 if (have_flag(flgs, TR_SUST_CHR))
877 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
880 if (have_flag(flgs, TR_IM_ACID))
882 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
884 if (have_flag(flgs, TR_IM_ELEC))
886 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
888 if (have_flag(flgs, TR_IM_FIRE))
890 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
892 if (have_flag(flgs, TR_IM_COLD))
894 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
897 if (have_flag(flgs, TR_THROW))
899 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
902 if (have_flag(flgs, TR_FREE_ACT))
904 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
906 if (have_flag(flgs, TR_HOLD_EXP))
908 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
910 if (have_flag(flgs, TR_RES_FEAR))
912 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
914 if (have_flag(flgs, TR_RES_ACID))
916 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
918 if (have_flag(flgs, TR_RES_ELEC))
920 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
922 if (have_flag(flgs, TR_RES_FIRE))
924 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
926 if (have_flag(flgs, TR_RES_COLD))
928 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
930 if (have_flag(flgs, TR_RES_POIS))
932 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
935 if (have_flag(flgs, TR_RES_LITE))
937 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
939 if (have_flag(flgs, TR_RES_DARK))
941 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
944 if (have_flag(flgs, TR_RES_BLIND))
946 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
948 if (have_flag(flgs, TR_RES_CONF))
950 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
952 if (have_flag(flgs, TR_RES_SOUND))
954 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
956 if (have_flag(flgs, TR_RES_SHARDS))
958 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
961 if (have_flag(flgs, TR_RES_NETHER))
963 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
965 if (have_flag(flgs, TR_RES_NEXUS))
967 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
969 if (have_flag(flgs, TR_RES_CHAOS))
971 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
973 if (have_flag(flgs, TR_RES_DISEN))
975 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
978 if (have_flag(flgs, TR_LEVITATION))
980 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
983 if (have_flag(flgs, TR_SEE_INVIS))
985 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
987 if (have_flag(flgs, TR_TELEPATHY))
989 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
991 if (have_flag(flgs, TR_ESP_ANIMAL))
993 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
995 if (have_flag(flgs, TR_ESP_UNDEAD))
997 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
999 if (have_flag(flgs, TR_ESP_DEMON))
1001 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
1003 if (have_flag(flgs, TR_ESP_ORC))
1005 info[i++] = _("それはオークを感知する。", "It senses orcs.");
1007 if (have_flag(flgs, TR_ESP_TROLL))
1009 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1011 if (have_flag(flgs, TR_ESP_GIANT))
1013 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1015 if (have_flag(flgs, TR_ESP_DRAGON))
1017 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1019 if (have_flag(flgs, TR_ESP_HUMAN))
1021 info[i++] = _("それは人間を感知する。", "It senses humans.");
1023 if (have_flag(flgs, TR_ESP_EVIL))
1025 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1027 if (have_flag(flgs, TR_ESP_GOOD))
1029 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1031 if (have_flag(flgs, TR_ESP_NONLIVING))
1033 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1035 if (have_flag(flgs, TR_ESP_UNIQUE))
1037 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1039 if (have_flag(flgs, TR_SLOW_DIGEST))
1041 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1043 if (have_flag(flgs, TR_REGEN))
1045 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1047 if (have_flag(flgs, TR_WARNING))
1049 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1051 if (have_flag(flgs, TR_REFLECT))
1053 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1055 if (have_flag(flgs, TR_SH_FIRE))
1057 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1059 if (have_flag(flgs, TR_SH_ELEC))
1061 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1063 if (have_flag(flgs, TR_SH_COLD))
1065 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1067 if (have_flag(flgs, TR_NO_MAGIC))
1069 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1071 if (have_flag(flgs, TR_NO_TELE))
1073 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1075 if (have_flag(flgs, TR_XTRA_MIGHT))
1077 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1079 if (have_flag(flgs, TR_XTRA_SHOTS))
1081 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1084 if (have_flag(flgs, TR_BLESSED))
1086 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1089 if (object_is_cursed(o_ptr))
1091 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1093 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1095 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1097 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1101 info[i++] = _("それは呪われている。", "It is cursed.");
1104 * It's a trivial infomation since there is
1105 * fake inscription {cursed}
1111 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1113 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1115 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1117 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1119 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1121 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1123 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1125 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1127 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1129 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1131 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1133 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1135 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1137 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1139 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1141 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1143 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1145 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1147 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1149 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1151 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1153 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1155 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1157 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1159 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1161 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1163 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1165 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1167 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1169 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1171 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1173 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1175 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1177 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1179 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1181 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1184 /* Describe about this kind of object instead of THIS fake object */
1185 if (mode & SCROBJ_FAKE_OBJECT)
1187 switch (o_ptr->tval)
1190 switch (o_ptr->sval)
1192 case SV_RING_LORDLY:
1193 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1195 case SV_RING_WARNING:
1196 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1202 switch (o_ptr->sval)
1204 case SV_AMULET_RESISTANCE:
1205 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1206 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1208 case SV_AMULET_THE_MAGI:
1209 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1216 if (have_flag(flgs, TR_IGNORE_ACID) &&
1217 have_flag(flgs, TR_IGNORE_ELEC) &&
1218 have_flag(flgs, TR_IGNORE_FIRE) &&
1219 have_flag(flgs, TR_IGNORE_COLD))
1221 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1225 if (have_flag(flgs, TR_IGNORE_ACID))
1227 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1229 if (have_flag(flgs, TR_IGNORE_ELEC))
1231 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1233 if (have_flag(flgs, TR_IGNORE_FIRE))
1235 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1237 if (have_flag(flgs, TR_IGNORE_COLD))
1239 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1243 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1245 /* No relevant informations */
1246 if (i <= trivial_info) return (FALSE);
1249 Term_get_size(&wid, &hgt);
1251 /* Display Item name */
1252 if (!(mode & SCROBJ_FAKE_OBJECT))
1253 object_desc(o_name, o_ptr, 0);
1255 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1259 /* Erase the screen */
1260 for (k = 1; k < hgt; k++) prt("", k, 13);
1262 /* Label the information */
1263 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1265 monster_race *r_ptr = &r_info[o_ptr->pval];
1266 int namelen = strlen(r_name + r_ptr->name);
1267 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1268 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1269 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1273 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1276 /* We will print on top of the map (column 13) */
1277 for (k = 2, j = 0; j < i; j++)
1280 prt(info[j], k++, 15);
1282 /* Every 20 entries (lines 2 to 21), start over */
1283 if ((k == hgt - 2) && (j+1 < i))
1285 prt(_("-- 続く --", "-- more --"), k, 15);
1287 for (; k > 2; k--) prt("", k, 15);
1292 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1297 /* Gave knowledge */
1304 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1305 * Convert an p_ptr->inventory_list index into a one character label
1306 * @param i プレイヤーの所持/装備オブジェクトID
1307 * @return 対応するアルファベット
1308 * @details Note that the label does NOT distinguish inven/equip.
1310 char index_to_label(int i)
1312 /* Indexes for "inven" are easy */
1313 if (i < INVEN_RARM) return (I2A(i));
1315 /* Indexes for "equip" are offset */
1316 return (I2A(i - INVEN_RARM));
1320 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1321 * Convert a label into the index of an item in the "inven"
1322 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1323 * @details Note that the label does NOT distinguish inven/equip.
1325 INVENTORY_IDX label_to_inven(int c)
1330 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1332 /* Verify the index */
1333 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1335 /* Empty slots can never be chosen */
1336 if (!p_ptr->inventory_list[i].k_idx) return (-1);
1338 /* Return the index */
1344 extern bool select_ring_slot;
1348 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1349 * @param i プレイヤーの所持/装備オブジェクトID
1350 * @return 指輪枠ならばTRUEを返す。
1352 static bool is_ring_slot(int i)
1354 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1359 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1360 * Convert a label into the index of a item in the "equip"
1361 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1363 INVENTORY_IDX label_to_equip(int c)
1368 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1370 /* Verify the index */
1371 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1373 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1375 /* Empty slots can never be chosen */
1376 if (!p_ptr->inventory_list[i].k_idx) return (-1);
1378 /* Return the index */
1385 * @brief オブジェクトの該当装備部位IDを返す /
1386 * Determine which equipment slot (if any) an item likes
1387 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1388 * @return 対応する装備部位ID
1390 s16b wield_slot(object_type *o_ptr)
1392 /* Slot for equipment */
1393 switch (o_ptr->tval)
1400 if (!p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_RARM);
1401 if (p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_RARM);
1402 return (INVEN_LARM);
1409 if (!p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_LARM);
1410 if (p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_LARM);
1411 return (INVEN_RARM);
1421 /* Use the right hand first */
1422 if (!p_ptr->inventory_list[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1424 /* Use the left hand for swapping (by default) */
1425 return (INVEN_LEFT);
1431 return (INVEN_NECK);
1436 return (INVEN_LITE);
1443 return (INVEN_BODY);
1448 return (INVEN_OUTER);
1454 return (INVEN_HEAD);
1459 return (INVEN_HANDS);
1464 return (INVEN_FEET);
1468 /* No slot available */
1473 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1474 * Return a string mentioning how a given item is carried
1475 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1476 * @return 部位表現の文字列ポインタ
1478 concptr mention_use(int i)
1482 /* Examine the location */
1486 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1488 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1492 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1494 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1497 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1498 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1499 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1500 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1501 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1502 case INVEN_BODY: p = _(" 体", "On body"); break;
1503 case INVEN_OUTER: p = _("体の上", "About body"); break;
1504 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1505 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1506 case INVEN_FEET: p = _(" 足", "On feet"); break;
1507 default: p = _("ザック", "In pack"); break;
1510 /* Return the result */
1516 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1517 * Return a string describing how a given item is being worn.
1518 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1519 * @return 状態表現内容の文字列ポインタ
1521 * Currently, only used for items in the equipment, not p_ptr->inventory_list.
1523 concptr describe_use(int i)
1530 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1532 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1536 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1538 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1541 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1542 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1543 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1544 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1545 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1546 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1547 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1548 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1549 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1550 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1551 default: p = _("ザックに入っている", "carrying in your pack"); break;
1554 /* Return the result */
1560 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1561 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1562 * @param book_tval ベースアイテムのtval
1563 * @param book_sval ベースアイテムのsval
1564 * @return 使用可能な魔法書ならばTRUEを返す。
1567 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1569 if (book_tval < TV_LIFE_BOOK) return FALSE;
1570 if (p_ptr->pclass == CLASS_SORCERER)
1572 return is_magic(tval2realm(book_tval));
1574 else if (p_ptr->pclass == CLASS_RED_MAGE)
1576 if (is_magic(tval2realm(book_tval)))
1577 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1579 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1583 * Here is a "hook" used during calls to "get_item()" and
1584 * "show_inven()" and "show_equip()", and the choice window routines.
1586 bool(*item_tester_hook)(object_type*);
1589 * Here is a "pseudo-hook" used during calls to "get_item()" and
1590 * "show_inven()" and "show_equip()", and the choice window routines.
1592 OBJECT_TYPE_VALUE item_tester_tval;
1595 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1596 * Check an item against the item tester info
1597 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1598 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1600 bool item_tester_okay(object_type *o_ptr)
1602 /* Hack -- allow listing empty slots */
1603 // if (item_tester_full) return (TRUE); // TODO:DELETE
1605 /* Require an item */
1606 if (!o_ptr->k_idx) return (FALSE);
1608 /* Hack -- ignore "gold" */
1609 if (o_ptr->tval == TV_GOLD)
1612 extern bool show_gold_on_floor;
1614 if (!show_gold_on_floor) return (FALSE);
1617 /* Check the tval */
1618 if (item_tester_tval)
1620 /* Is it a spellbook? If so, we need a hack -- TY */
1621 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1622 (item_tester_tval >= TV_LIFE_BOOK))
1623 return check_book_realm(o_ptr->tval, o_ptr->sval);
1625 if (item_tester_tval != o_ptr->tval) return (FALSE);
1628 /* Check the hook */
1629 if (item_tester_hook)
1631 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1640 * @brief 所持アイテム一覧を表示する /
1641 * Choice window "shadow" of the "show_inven()" function
1644 void display_inven(void)
1646 register int i, n, z = 0;
1648 TERM_COLOR attr = TERM_WHITE;
1650 GAME_TEXT o_name[MAX_NLEN];
1653 Term_get_size(&wid, &hgt);
1655 for (i = 0; i < INVEN_PACK; i++)
1657 o_ptr = &p_ptr->inventory_list[i];
1658 if (!o_ptr->k_idx) continue;
1662 for (i = 0; i < z; i++)
1664 o_ptr = &p_ptr->inventory_list[i];
1665 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1666 if (item_tester_okay(o_ptr))
1668 tmp_val[0] = index_to_label(i);
1672 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1673 object_desc(o_name, o_ptr, 0);
1675 attr = tval_to_attr[o_ptr->tval % 128];
1681 Term_putstr(3, i, n, attr, o_name);
1682 Term_erase(3+n, i, 255);
1686 int wgt = o_ptr->weight * o_ptr->number;
1688 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1690 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1692 prt(tmp_val, i, wid - 9);
1696 for (i = z; i < hgt; i++)
1698 Term_erase(0, i, 255);
1705 * @brief 装備アイテム一覧を表示する /
1706 * Choice window "shadow" of the "show_equip()" function
1709 void display_equip(void)
1713 TERM_COLOR attr = TERM_WHITE;
1715 GAME_TEXT o_name[MAX_NLEN];
1718 Term_get_size(&wid, &hgt);
1720 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1722 o_ptr = &p_ptr->inventory_list[i];
1723 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1724 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1726 tmp_val[0] = index_to_label(i);
1730 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1731 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1733 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1738 object_desc(o_name, o_ptr, 0);
1739 attr = tval_to_attr[o_ptr->tval % 128];
1747 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1749 Term_erase(3 + n, i - INVEN_RARM, 255);
1753 int wgt = o_ptr->weight * o_ptr->number;
1755 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1757 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1760 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1765 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1766 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1770 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1772 Term_erase(0, i, 255);
1778 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1779 * Find the "first" p_ptr->inventory_list object with the given "tag".
1780 * @param cp 対応するタグIDを与える参照ポインタ
1781 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1782 * @param mode 所持、装備の切り替え
1783 * @return タグに該当するオブジェクトがあるならTRUEを返す
1785 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1786 * inscription of an object. Alphabetical characters don't work as a\n
1787 * tag in this form.\n
1789 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1790 * and "x" is the "current" command_cmd code.\n
1792 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1795 COMMAND_CODE start, end;
1798 /* Extract index from mode */
1803 end = INVEN_TOTAL - 1;
1808 end = INVEN_PACK - 1;
1815 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1817 /* Check every p_ptr->inventory_list object */
1818 for (i = start; i <= end; i++)
1820 object_type *o_ptr = &p_ptr->inventory_list[i];
1821 if (!o_ptr->k_idx) continue;
1823 /* Skip empty inscriptions */
1824 if (!o_ptr->inscription) continue;
1826 /* Skip non-choice */
1827 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1830 s = my_strchr(quark_str(o_ptr->inscription), '@');
1832 /* Process all tags */
1835 /* Check the special tags */
1836 if ((s[1] == command_cmd) && (s[2] == tag))
1838 /* Save the actual p_ptr->inventory_list ID */
1845 /* Find another '@' */
1846 s = my_strchr(s + 1, '@');
1851 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1853 /* Don't allow {@#} with '#' being alphabet */
1854 if (tag < '0' || '9' < tag)
1860 /* Check every object */
1861 for (i = start; i <= end; i++)
1863 object_type *o_ptr = &p_ptr->inventory_list[i];
1864 if (!o_ptr->k_idx) continue;
1866 /* Skip empty inscriptions */
1867 if (!o_ptr->inscription) continue;
1869 /* Skip non-choice */
1870 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1873 s = my_strchr(quark_str(o_ptr->inscription), '@');
1875 /* Process all tags */
1878 /* Check the normal tags */
1881 /* Save the actual p_ptr->inventory_list ID */
1888 /* Find another '@' */
1889 s = my_strchr(s + 1, '@');
1899 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1900 * Find the "first" p_ptr->inventory_list object with the given "tag".
1901 * @param cp 対応するタグIDを与える参照ポインタ
1902 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1903 * @param floor_list 床上アイテムの配列
1904 * @param floor_num 床上アイテムの配列ID
1905 * @return タグに該当するオブジェクトがあるならTRUEを返す
1907 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1908 * inscription of an object. Alphabetical characters don't work as a\n
1909 * tag in this form.\n
1911 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1912 * and "x" is the "current" command_cmd code.\n
1914 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1919 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1921 /* Check every object in the grid */
1922 for (i = 0; i < floor_num && i < 23; i++)
1924 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1926 /* Skip empty inscriptions */
1927 if (!o_ptr->inscription) continue;
1930 s = my_strchr(quark_str(o_ptr->inscription), '@');
1932 /* Process all tags */
1935 /* Check the special tags */
1936 if ((s[1] == command_cmd) && (s[2] == tag))
1938 /* Save the actual floor object ID */
1945 /* Find another '@' */
1946 s = my_strchr(s + 1, '@');
1951 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1953 /* Don't allow {@#} with '#' being alphabet */
1954 if (tag < '0' || '9' < tag)
1960 /* Check every object in the grid */
1961 for (i = 0; i < floor_num && i < 23; i++)
1963 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1965 /* Skip empty inscriptions */
1966 if (!o_ptr->inscription) continue;
1969 s = my_strchr(quark_str(o_ptr->inscription), '@');
1971 /* Process all tags */
1974 /* Check the normal tags */
1977 /* Save the floor object ID */
1984 /* Find another '@' */
1985 s = my_strchr(s + 1, '@');
1995 * @brief タグIDにあわせてタグアルファベットのリストを返す /
1996 * Move around label characters with correspond tags
1997 * @param label ラベルリストを取得する文字列参照ポインタ
1998 * @param mode 所持品リストか装備品リストかの切り替え
2001 static void prepare_label_string(char *label, BIT_FLAGS mode)
2003 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2004 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2007 /* Prepare normal labels */
2008 strcpy(label, alphabet_chars);
2010 /* Move each label */
2011 for (i = 0; i < 52; i++)
2014 SYMBOL_CODE c = alphabet_chars[i];
2016 /* Find a tag with this label */
2017 if (get_tag(&index, c, mode))
2019 /* Delete the overwritten label */
2020 if (label[i] == c) label[i] = ' ';
2022 /* Move the label to the place of corresponding tag */
2023 label[index - offset] = c;
2030 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2031 * Move around label characters with correspond tags (floor version)
2032 * @param label ラベルリストを取得する文字列参照ポインタ
2033 * @param floor_list 床上アイテムの配列
2034 * @param floor_num 床上アイテムの配列ID
2039 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2041 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2044 /* Prepare normal labels */
2045 strcpy(label, alphabet_chars);
2047 /* Move each label */
2048 for (i = 0; i < 52; i++)
2051 SYMBOL_CODE c = alphabet_chars[i];
2053 /* Find a tag with this label */
2054 if (get_tag_floor(&index, c, floor_list, floor_num))
2056 /* Delete the overwritten label */
2057 if (label[i] == c) label[i] = ' ';
2059 /* Move the label to the place of corresponding tag */
2067 * @brief 所持アイテムの表示を行う /
2068 * Display the p_ptr->inventory_list.
2069 * @param target_item アイテムの選択処理を行うか否か。
2070 * @return 選択したアイテムのタグ
2072 * Hack -- do not display "trailing" empty slots
2074 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2078 int col, cur_col, len;
2080 GAME_TEXT o_name[MAX_NLEN];
2082 COMMAND_CODE out_index[23];
2083 TERM_COLOR out_color[23];
2084 char out_desc[23][MAX_NLEN];
2085 COMMAND_CODE target_item_label = 0;
2087 char inven_label[52 + 1];
2089 /* Starting column */
2092 Term_get_size(&wid, &hgt);
2094 /* Default "max-length" */
2095 len = wid - col - 1;
2098 /* Find the "final" slot */
2099 for (i = 0; i < INVEN_PACK; i++)
2101 o_ptr = &p_ptr->inventory_list[i];
2102 if (!o_ptr->k_idx) continue;
2108 prepare_label_string(inven_label, USE_INVEN);
2110 /* Display the p_ptr->inventory_list */
2111 for (k = 0, i = 0; i < z; i++)
2113 o_ptr = &p_ptr->inventory_list[i];
2115 /* Is this item acceptable? */
2116 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2118 object_desc(o_name, o_ptr, 0);
2120 /* Save the object index, color, and description */
2122 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2124 /* Grey out charging items */
2127 out_color[k] = TERM_L_DARK;
2130 (void)strcpy(out_desc[k], o_name);
2132 /* Find the predicted "line length" */
2133 l = strlen(out_desc[k]) + 5;
2135 /* Be sure to account for the weight */
2136 if (show_weights) l += 9;
2138 /* Account for icon if displayed */
2139 if (show_item_graph)
2142 if (use_bigtile) l++;
2145 /* Maintain the maximum length */
2146 if (l > len) len = l;
2148 /* Advance to next "line" */
2152 /* Find the column to start in */
2153 col = (len > wid - 4) ? 0 : (wid - len - 1);
2155 /* Output each entry */
2156 for (j = 0; j < k; j++)
2159 o_ptr = &p_ptr->inventory_list[i];
2161 /* Clear the line */
2162 prt("", j + 1, col ? col - 2 : col);
2164 if (use_menu && target_item)
2166 if (j == (target_item-1))
2168 strcpy(tmp_val, _("》", "> "));
2169 target_item_label = i;
2171 else strcpy(tmp_val, " ");
2173 else if (i <= INVEN_PACK)
2175 /* Prepare an index --(-- */
2176 sprintf(tmp_val, "%c)", inven_label[i]);
2180 /* Prepare an index --(-- */
2181 sprintf(tmp_val, "%c)", index_to_label(i));
2184 /* Clear the line with the (possibly indented) index */
2185 put_str(tmp_val, j + 1, col);
2189 /* Display graphics for object, if desired */
2190 if (show_item_graph)
2192 TERM_COLOR a = object_attr(o_ptr);
2193 SYMBOL_CODE c = object_char(o_ptr);
2194 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2195 if (use_bigtile) cur_col++;
2201 /* Display the entry itself */
2202 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2204 /* Display the weight if needed */
2207 int wgt = o_ptr->weight * o_ptr->number;
2209 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2211 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2214 prt(tmp_val, j + 1, wid - 9);
2218 /* Make a "shadow" below the list (only if needed) */
2219 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2221 /* Save the new column */
2224 return target_item_label;
2229 * @brief 装備アイテムの表示を行う /
2230 * Display the equipment.
2231 * @param target_item アイテムの選択処理を行うか否か。
2232 * @return 選択したアイテムのタグ
2234 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2238 int col, cur_col, len;
2241 GAME_TEXT o_name[MAX_NLEN];
2242 COMMAND_CODE out_index[23];
2243 TERM_COLOR out_color[23];
2244 char out_desc[23][MAX_NLEN];
2245 COMMAND_CODE target_item_label = 0;
2247 char equip_label[52 + 1];
2249 /* Starting column */
2252 Term_get_size(&wid, &hgt);
2254 /* Maximal length */
2255 len = wid - col - 1;
2258 /* Scan the equipment list */
2259 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2261 o_ptr = &p_ptr->inventory_list[i];
2263 /* Is this item acceptable? */
2264 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2265 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2266 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2268 object_desc(o_name, o_ptr, 0);
2270 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2272 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2273 out_color[k] = TERM_WHITE;
2277 (void)strcpy(out_desc[k], o_name);
2278 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2282 /* Grey out charging items */
2285 out_color[k] = TERM_L_DARK;
2288 /* Extract the maximal length (see below) */
2290 l = strlen(out_desc[k]) + (2 + 1);
2292 l = strlen(out_desc[k]) + (2 + 3);
2296 /* Increase length for labels (if needed) */
2298 if (show_labels) l += (7 + 2);
2300 if (show_labels) l += (14 + 2);
2304 /* Increase length for weight (if needed) */
2305 if (show_weights) l += 9;
2307 if (show_item_graph) l += 2;
2309 /* Maintain the max-length */
2310 if (l > len) len = l;
2312 /* Advance the entry */
2316 /* Hack -- Find a column to start in */
2318 col = (len > wid - 6) ? 0 : (wid - len - 1);
2320 col = (len > wid - 4) ? 0 : (wid - len - 1);
2323 prepare_label_string(equip_label, USE_EQUIP);
2325 /* Output each entry */
2326 for (j = 0; j < k; j++)
2329 o_ptr = &p_ptr->inventory_list[i];
2331 /* Clear the line */
2332 prt("", j + 1, col ? col - 2 : col);
2334 if (use_menu && target_item)
2336 if (j == (target_item-1))
2338 strcpy(tmp_val, _("》", "> "));
2339 target_item_label = i;
2341 else strcpy(tmp_val, " ");
2343 else if (i >= INVEN_RARM)
2345 /* Prepare an index --(-- */
2346 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2350 /* Prepare an index --(-- */
2351 sprintf(tmp_val, "%c)", index_to_label(i));
2354 /* Clear the line with the (possibly indented) index */
2355 put_str(tmp_val, j+1, col);
2359 /* Display graphics for object, if desired */
2360 if (show_item_graph)
2362 TERM_COLOR a = object_attr(o_ptr);
2363 SYMBOL_CODE c = object_char(o_ptr);
2364 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2365 if (use_bigtile) cur_col++;
2373 /* Mention the use */
2374 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2376 put_str(tmp_val, j+1, cur_col);
2378 /* Display the entry itself */
2379 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2385 /* Display the entry itself */
2386 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2389 /* Display the weight if needed */
2392 int wgt = o_ptr->weight * o_ptr->number;
2394 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2396 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2399 prt(tmp_val, j + 1, wid - 9);
2403 /* Make a "shadow" below the list (only if needed) */
2404 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2406 /* Save the new column */
2409 return target_item_label;
2413 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2414 * Flip "inven" and "equip" in any sub-windows
2417 void toggle_inven_equip(void)
2422 for (j = 0; j < 8; j++)
2425 if (!angband_term[j]) continue;
2427 /* Flip inven to equip */
2428 if (window_flag[j] & (PW_INVEN))
2431 window_flag[j] &= ~(PW_INVEN);
2432 window_flag[j] |= (PW_EQUIP);
2434 p_ptr->window |= (PW_EQUIP);
2437 /* Flip inven to equip */
2438 else if (window_flag[j] & (PW_EQUIP))
2441 window_flag[j] &= ~(PW_EQUIP);
2442 window_flag[j] |= (PW_INVEN);
2444 p_ptr->window |= (PW_INVEN);
2450 * @brief 選択したアイテムの確認処理の補助 /
2451 * Verify the choice of an item.
2452 * @param prompt メッセージ表示の一部
2453 * @param item 選択アイテムID
2454 * @return 確認がYesならTRUEを返す。
2455 * @details The item can be negative to mean "item on floor".
2457 static bool verify(concptr prompt, INVENTORY_IDX item)
2459 GAME_TEXT o_name[MAX_NLEN];
2460 char out_val[MAX_NLEN+20];
2467 o_ptr = &p_ptr->inventory_list[item];
2473 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2475 object_desc(o_name, o_ptr, 0);
2478 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2481 return (get_check(out_val));
2486 * @brief 選択したアイテムの確認処理のメインルーチン /
2487 * @param item 選択アイテムID
2488 * @return 確認がYesならTRUEを返す。
2489 * @details The item can be negative to mean "item on floor".
2490 * Hack -- allow user to "prevent" certain choices
2492 static bool get_item_allow(INVENTORY_IDX item)
2496 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2501 o_ptr = &p_ptr->inventory_list[item];
2507 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2510 /* No inscription */
2511 if (!o_ptr->inscription) return (TRUE);
2514 s = my_strchr(quark_str(o_ptr->inscription), '!');
2516 /* Process preventions */
2519 /* Check the "restriction" */
2520 if ((s[1] == command_cmd) || (s[1] == '*'))
2522 /* Verify the choice */
2523 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2526 /* Find another '!' */
2527 s = my_strchr(s + 1, '!');
2536 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2537 * Auxiliary function for "get_item()" -- test an index
2539 * @return 正規のIDならばTRUEを返す。
2541 static bool get_item_okay(OBJECT_IDX i)
2544 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2546 if (select_ring_slot) return is_ring_slot(i);
2548 /* Verify the item */
2549 if (!item_tester_okay(&p_ptr->inventory_list[i])) return (FALSE);
2556 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2557 * Determine whether get_item() can get some item or not
2558 * @return アイテムを拾えるならばTRUEを返す。
2559 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2561 bool can_get_item(void)
2564 OBJECT_IDX floor_list[23];
2565 ITEM_NUMBER floor_num = 0;
2567 for (j = 0; j < INVEN_TOTAL; j++)
2568 if (item_tester_okay(&p_ptr->inventory_list[j]))
2571 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2579 * @brief オブジェクト選択の汎用関数 /
2580 * Let the user select an item, save its "index"
2581 * @param cp 選択したオブジェクトのIDを返す。
2582 * @param pmt 選択目的のメッセージ
2583 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2584 * @param mode オプションフラグ
2585 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2586 * Return TRUE only if an acceptable item was chosen by the user.\n
2588 * The selected item must satisfy the "item_tester_hook()" function,\n
2589 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2591 * All "item_tester" restrictions are cleared before this function returns.\n
2593 * The user is allowed to choose acceptable items from the equipment,\n
2594 * p_ptr->inventory_list, or floor, respectively, if the proper flag was given,\n
2595 * and there are any acceptable items in that location.\n
2597 * The equipment or p_ptr->inventory_list are displayed (even if no acceptable\n
2598 * items are in that location) if the proper flag was given.\n
2600 * If there are no acceptable items available anywhere, and "str" is\n
2601 * not NULL, then it will be used as the text of a warning message\n
2602 * before the function returns.\n
2604 * Note that the user must press "-" to specify the item on the floor,\n
2605 * and there is no way to "examine" the item on the floor, while the\n
2606 * use of "capital" letters will "examine" an p_ptr->inventory_list/equipment item,\n
2607 * and prompt for its use.\n
2609 * If a legal item is selected from the p_ptr->inventory_list, we save it in "cp"\n
2610 * directly (0 to 35), and return TRUE.\n
2612 * If a legal item is selected from the floor, we save it in "cp" as\n
2613 * a negative (-1 to -511), and return TRUE.\n
2615 * If no item is available, we do nothing to "cp", and we display a\n
2616 * warning message, using "str" if available, and return FALSE.\n
2618 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2620 * Global "p_ptr->command_new" is used when viewing the p_ptr->inventory_list or equipment\n
2621 * to allow the user to enter a command while viewing those screens, and\n
2622 * also to induce "auto-enter" of stores, and other such stuff.\n
2624 * Global "p_ptr->command_see" may be set before calling this function to start\n
2625 * out in "browse" mode. It is cleared before this function returns.\n
2627 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2628 * If it is TRUE then we are viewing p_ptr->inventory_list, else equipment.\n
2630 * We always erase the prompt when we are done, leaving a blank line,\n
2631 * or a warning message, if appropriate, if no items are available.\n
2633 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2635 OBJECT_IDX this_o_idx, next_o_idx = 0;
2652 bool allow_floor = FALSE;
2654 bool toggle = FALSE;
2659 int menu_line = (use_menu ? 1 : 0);
2663 static char prev_tag = '\0';
2664 char cur_tag = '\0';
2666 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2669 if (mode & USE_EQUIP) equip = TRUE;
2670 if (mode & USE_INVEN) inven = TRUE;
2671 if (mode & USE_FLOOR) floor = TRUE;
2673 /* Get the item index */
2674 if (repeat_pull(cp))
2677 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2679 item_tester_tval = 0;
2680 item_tester_hook = NULL;
2681 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2686 else if (floor && (*cp < 0))
2692 o_ptr = ¤t_floor_ptr->o_list[k];
2694 /* Validate the item */
2695 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2697 /* Forget restrictions */
2698 item_tester_tval = 0;
2699 item_tester_hook = NULL;
2700 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2707 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2708 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2710 if (prev_tag && command_cmd)
2712 /* Look up the tag and validate the item */
2713 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2714 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2715 else if (!get_item_okay(k)) /* Reject */;
2718 /* Accept that choice */
2721 /* Forget restrictions */
2722 item_tester_tval = 0;
2723 item_tester_hook = NULL;
2724 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2730 prev_tag = '\0'; /* prev_tag is no longer effective */
2733 /* Verify the item */
2734 else if (get_item_okay(*cp))
2736 /* Forget restrictions */
2737 item_tester_tval = 0;
2738 item_tester_hook = NULL;
2739 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2751 /* No item selected */
2755 /* Full p_ptr->inventory_list */
2757 i2 = INVEN_PACK - 1;
2759 /* Forbid p_ptr->inventory_list */
2760 if (!inven) i2 = -1;
2763 for (j = 0; j < INVEN_PACK; j++)
2764 if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
2767 /* Restrict p_ptr->inventory_list indexes */
2768 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2769 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2772 /* Full equipment */
2774 e2 = INVEN_TOTAL - 1;
2776 /* Forbid equipment */
2777 if (!equip) e2 = -1;
2780 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2781 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
2782 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2785 /* Restrict equipment indexes */
2786 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2787 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2789 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2793 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2795 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2799 /* Restrict floor usage */
2802 /* Scan all objects in the grid */
2803 for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2806 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
2807 next_o_idx = o_ptr->next_o_idx;
2809 /* Accept the item on the floor if legal */
2810 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2814 /* Require at least one legal choice */
2815 if (!allow_floor && (i1 > i2) && (e1 > e2))
2817 /* Cancel p_ptr->command_see */
2818 command_see = FALSE;
2822 if (mode & USE_FORCE) {
2828 /* Analyze choices */
2831 /* Hack -- Start on equipment if requested */
2832 if (command_see && command_wrk && equip)
2837 /* Use p_ptr->inventory_list if allowed */
2840 command_wrk = FALSE;
2843 /* Use equipment if allowed */
2849 /* Use p_ptr->inventory_list for floor */
2852 command_wrk = FALSE;
2858 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2860 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2862 /* Hack -- start out in "display" mode */
2869 /* Repeat until done */
2872 COMMAND_CODE get_item_label = 0;
2879 for (j = 0; j < 8; j++)
2882 if (!angband_term[j]) continue;
2884 /* Count windows displaying inven */
2885 if (window_flag[j] & (PW_INVEN)) ni++;
2887 /* Count windows displaying equip */
2888 if (window_flag[j] & (PW_EQUIP)) ne++;
2891 /* Toggle if needed */
2892 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2895 toggle_inven_equip();
2901 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2904 /* Inventory screen */
2907 /* Redraw if needed */
2908 if (command_see) get_item_label = show_inven(menu_line, mode);
2911 /* Equipment screen */
2914 /* Redraw if needed */
2915 if (command_see) get_item_label = show_equip(menu_line, mode);
2918 /* Viewing p_ptr->inventory_list */
2921 /* Begin the prompt */
2922 sprintf(out_val, _("持ち物:", "Inven:"));
2924 /* Some legal items */
2925 if ((i1 <= i2) && !use_menu)
2927 /* Build the prompt */
2928 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2929 index_to_label(i1), index_to_label(i2));
2932 strcat(out_val, tmp_val);
2935 /* Indicate ability to "view" */
2936 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2939 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2942 /* Viewing equipment */
2945 /* Begin the prompt */
2946 sprintf(out_val, _("装備品:", "Equip:"));
2948 /* Some legal items */
2949 if ((e1 <= e2) && !use_menu)
2951 /* Build the prompt */
2952 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2953 index_to_label(e1), index_to_label(e2));
2956 strcat(out_val, tmp_val);
2959 /* Indicate ability to "view" */
2960 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2963 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
2966 /* Indicate legality of the "floor" item */
2967 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
2968 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
2970 /* Finish the prompt */
2971 strcat(out_val, " ESC");
2973 /* Build the prompt */
2974 sprintf(tmp_val, "(%s) %s", out_val, pmt);
2976 /* Show the prompt */
2984 int max_line = (command_wrk ? max_equip : max_inven);
3000 menu_line += (max_line - 1);
3019 /* Verify legality */
3020 if (!inven || !equip)
3026 /* Hack -- Fix screen */
3033 /* Switch inven/equip */
3034 command_wrk = !command_wrk;
3035 max_line = (command_wrk ? max_equip : max_inven);
3036 if (menu_line > max_line) menu_line = max_line;
3038 /* Need to redraw */
3047 if (command_wrk == USE_FLOOR)
3050 (*cp) = -get_item_label;
3054 /* Validate the item */
3055 if (!get_item_okay(get_item_label))
3061 /* Allow player to "refuse" certain actions */
3062 if (!get_item_allow(get_item_label))
3068 /* Accept that choice */
3069 (*cp) = get_item_label;
3078 if (mode & USE_FORCE) {
3086 if (menu_line > max_line) menu_line -= max_line;
3107 command_see = FALSE;
3124 /* Verify legality */
3125 if (!inven || !equip)
3131 /* Hack -- Fix screen */
3138 /* Switch inven/equip */
3139 command_wrk = !command_wrk;
3141 /* Need to redraw */
3147 /* Use floor item */
3150 /* Scan all objects in the grid */
3151 for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3154 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3155 next_o_idx = o_ptr->next_o_idx;
3157 /* Validate the item */
3158 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3163 /* Verify the item (if required) */
3164 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3166 /* Allow player to "refuse" certain actions */
3167 if (!get_item_allow(k)) continue;
3169 /* Accept that choice */
3185 case '1': case '2': case '3':
3186 case '4': case '5': case '6':
3187 case '7': case '8': case '9':
3189 /* Look up the tag */
3190 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3196 /* Hack -- Validate the item */
3197 if ((k < INVEN_RARM) ? !inven : !equip)
3203 /* Validate the item */
3204 if (!get_item_okay(k))
3210 /* Allow player to "refuse" certain actions */
3211 if (!get_item_allow(k))
3217 /* Accept that choice */
3229 /* Choose "default" p_ptr->inventory_list item */
3232 k = ((i1 == i2) ? i1 : -1);
3235 /* Choose "default" equipment item */
3238 k = ((e1 == e2) ? e1 : -1);
3241 /* Validate the item */
3242 if (!get_item_okay(k))
3248 /* Allow player to "refuse" certain actions */
3249 if (!get_item_allow(k))
3255 /* Accept that choice */
3265 if (mode & USE_FORCE) {
3278 bool not_found = FALSE;
3280 /* Look up the alphabetical tag */
3281 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3286 /* Hack -- Validate the item */
3287 else if ((k < INVEN_RARM) ? !inven : !equip)
3292 /* Validate the item */
3293 else if (!get_item_okay(k))
3300 /* Accept that choice */
3308 /* Extract "query" setting */
3309 ver = isupper(which);
3310 which = (char)tolower(which);
3312 /* Convert letter to p_ptr->inventory_list index */
3315 if (which == '(') k = i1;
3316 else if (which == ')') k = i2;
3317 else k = label_to_inven(which);
3320 /* Convert letter to equipment index */
3323 if (which == '(') k = e1;
3324 else if (which == ')') k = e2;
3325 else k = label_to_equip(which);
3328 /* Validate the item */
3329 if (!get_item_okay(k))
3335 /* Verify the item */
3336 if (ver && !verify(_("本当に", "Try"), k))
3342 /* Allow player to "refuse" certain actions */
3343 if (!get_item_allow(k))
3349 /* Accept that choice */
3360 /* Fix the screen if necessary */
3365 /* Hack -- Cancel "display" */
3366 command_see = FALSE;
3370 /* Forget the item_tester_tval restriction */
3371 item_tester_tval = 0;
3373 /* Forget the item_tester_hook restriction */
3374 item_tester_hook = NULL;
3377 /* Clean up 'show choices' */
3378 /* Toggle again if needed */
3379 if (toggle) toggle_inven_equip();
3381 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3384 /* Clear the prompt line */
3387 /* Warning if needed */
3388 if (oops && str) msg_print(str);
3393 if (command_cmd) prev_tag = cur_tag;
3394 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3400 * Choose an item and get auto-picker entry from it.
3402 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3405 if (!get_item(&item, q, s, option)) return NULL;
3406 if (idx) *idx = item;
3408 if (item == INVEN_FORCE) return NULL;
3410 /* Get the item (in the pack) */
3411 else if (item >= 0) return &p_ptr->inventory_list[item];
3413 /* Get the item (on the floor) */
3414 else return ¤t_floor_ptr->o_list[0 - item];
3419 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3420 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3421 * @param y 走査するフロアのY座標
3422 * @param x 走査するフロアのX座標
3423 * @param mode オプションフラグ
3424 * @return 対象のマスに落ちているアイテム数
3426 * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
3427 * location. Valid flags are:
3429 * mode & 0x01 -- Item tester
3430 * mode & 0x02 -- Marked items only
3431 * mode & 0x04 -- Stop after first
3433 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3435 OBJECT_IDX this_o_idx, next_o_idx;
3437 ITEM_NUMBER num = 0;
3440 if (!in_bounds(y, x)) return 0;
3442 /* Scan all objects in the grid */
3443 for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3446 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3447 next_o_idx = o_ptr->next_o_idx;
3450 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3453 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3455 /* Accept this item */
3456 /* XXX Hack -- Enforce limit */
3458 items[num] = this_o_idx;
3463 if (mode & 0x04) break;
3470 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3471 * @param target_item カーソルの初期値
3472 * @param y 走査するフロアのY座標
3473 * @param x 走査するフロアのX座標
3474 * @param min_width 表示の長さ
3475 * @return 選択したアイテムの添え字
3478 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3486 GAME_TEXT o_name[MAX_NLEN];
3489 COMMAND_CODE out_index[23];
3490 TERM_COLOR out_color[23];
3491 char out_desc[23][MAX_NLEN];
3492 COMMAND_CODE target_item_label = 0;
3494 OBJECT_IDX floor_list[23];
3495 ITEM_NUMBER floor_num;
3497 char floor_label[52 + 1];
3499 bool dont_need_to_show_weights = TRUE;
3501 Term_get_size(&wid, &hgt);
3503 /* Default length */
3504 len = MAX((*min_width), 20);
3506 /* Scan for objects in the grid, using item_tester_okay() */
3507 floor_num = scan_floor(floor_list, y, x, 0x03);
3509 /* Display the floor objects */
3510 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3512 o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
3514 object_desc(o_name, o_ptr, 0);
3516 /* Save the index */
3519 /* Acquire p_ptr->inventory_list color */
3520 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3522 /* Save the object description */
3523 strcpy(out_desc[k], o_name);
3525 /* Find the predicted "line length" */
3526 l = strlen(out_desc[k]) + 5;
3528 /* Be sure to account for the weight */
3529 if (show_weights) l += 9;
3531 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3533 /* Maintain the maximum length */
3534 if (l > len) len = l;
3536 /* Advance to next "line" */
3540 if (show_weights && dont_need_to_show_weights) len -= 9;
3545 /* Find the column to start in */
3546 col = (len > wid - 4) ? 0 : (wid - len - 1);
3548 prepare_label_string_floor(floor_label, floor_list, floor_num);
3550 /* Output each entry */
3551 for (j = 0; j < k; j++)
3553 m = floor_list[out_index[j]];
3554 o_ptr = ¤t_floor_ptr->o_list[m];
3556 /* Clear the line */
3557 prt("", j + 1, col ? col - 2 : col);
3559 if (use_menu && target_item)
3561 if (j == (target_item-1))
3563 strcpy(tmp_val, _("》", "> "));
3564 target_item_label = m;
3566 else strcpy(tmp_val, " ");
3570 /* Prepare an index --(-- */
3571 sprintf(tmp_val, "%c)", floor_label[j]);
3574 /* Clear the line with the (possibly indented) index */
3575 put_str(tmp_val, j + 1, col);
3577 /* Display the entry itself */
3578 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3580 /* Display the weight if needed */
3581 if (show_weights && (o_ptr->tval != TV_GOLD))
3583 int wgt = o_ptr->weight * o_ptr->number;
3585 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3587 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3590 prt(tmp_val, j + 1, wid - 9);
3594 /* Make a "shadow" below the list (only if needed) */
3595 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3597 return target_item_label;
3601 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3602 * Let the user select an item, save its "index"
3603 * @param cp 選択したオブジェクトのIDを返す。
3604 * @param pmt 選択目的のメッセージ
3605 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3606 * @param mode オプションフラグ
3607 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3609 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3611 char n1 = ' ', n2 = ' ', which = ' ';
3614 COMMAND_CODE i1, i2;
3615 COMMAND_CODE e1, e2;
3623 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3624 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3625 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3626 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3628 bool allow_equip = FALSE;
3629 bool allow_inven = FALSE;
3630 bool allow_floor = FALSE;
3632 bool toggle = FALSE;
3637 ITEM_NUMBER floor_num;
3638 OBJECT_IDX floor_list[23];
3640 TERM_LEN min_width = 0;
3642 int menu_line = (use_menu ? 1 : 0);
3646 static char prev_tag = '\0';
3647 char cur_tag = '\0';
3649 /* Get the item index */
3650 if (repeat_pull(cp))
3653 if (force && (*cp == INVEN_FORCE))
3655 item_tester_tval = 0;
3656 item_tester_hook = NULL;
3657 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3662 else if (floor && (*cp < 0))
3664 if (prev_tag && command_cmd)
3666 /* Scan all objects in the grid */
3667 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3669 /* Look up the tag */
3670 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3672 /* Accept that choice */
3673 (*cp) = 0 - floor_list[k];
3675 /* Forget restrictions */
3676 item_tester_tval = 0;
3677 item_tester_hook = NULL;
3678 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3684 prev_tag = '\0'; /* prev_tag is no longer effective */
3687 /* Validate the item */
3688 else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
3690 /* Forget restrictions */
3691 item_tester_tval = 0;
3692 item_tester_hook = NULL;
3693 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3700 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3701 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3703 if (prev_tag && command_cmd)
3705 /* Look up the tag and validate the item */
3706 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3707 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3708 else if (!get_item_okay(k)) /* Reject */;
3711 /* Accept that choice */
3714 /* Forget restrictions */
3715 item_tester_tval = 0;
3716 item_tester_hook = NULL;
3717 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3723 prev_tag = '\0'; /* prev_tag is no longer effective */
3726 /* Verify the item */
3727 else if (get_item_okay(*cp))
3729 /* Forget restrictions */
3730 item_tester_tval = 0;
3731 item_tester_hook = NULL;
3732 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3746 /* No item selected */
3750 /* Full p_ptr->inventory_list */
3752 i2 = INVEN_PACK - 1;
3754 /* Forbid p_ptr->inventory_list */
3755 if (!inven) i2 = -1;
3758 for (j = 0; j < INVEN_PACK; j++)
3759 if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
3762 /* Restrict p_ptr->inventory_list indexes */
3763 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3764 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3767 /* Full equipment */
3769 e2 = INVEN_TOTAL - 1;
3771 /* Forbid equipment */
3772 if (!equip) e2 = -1;
3775 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3776 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
3777 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3780 /* Restrict equipment indexes */
3781 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3782 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3784 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3788 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3790 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3794 /* Count "okay" floor items */
3797 /* Restrict floor usage */
3800 /* Scan all objects in the grid */
3801 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3804 /* Accept p_ptr->inventory_list */
3805 if (i1 <= i2) allow_inven = TRUE;
3807 /* Accept equipment */
3808 if (e1 <= e2) allow_equip = TRUE;
3811 if (floor_num) allow_floor = TRUE;
3813 /* Require at least one legal choice */
3814 if (!allow_inven && !allow_equip && !allow_floor)
3816 /* Cancel p_ptr->command_see */
3817 command_see = FALSE;
3827 /* Analyze choices */
3830 /* Hack -- Start on equipment if requested */
3831 if (command_see && (command_wrk == (USE_EQUIP))
3834 command_wrk = (USE_EQUIP);
3837 /* Use p_ptr->inventory_list if allowed */
3838 else if (allow_inven)
3840 command_wrk = (USE_INVEN);
3843 /* Use equipment if allowed */
3844 else if (allow_equip)
3846 command_wrk = (USE_EQUIP);
3849 /* Use floor if allowed */
3850 else if (allow_floor)
3852 command_wrk = (USE_FLOOR);
3857 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3859 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3861 /* Hack -- start out in "display" mode */
3867 /* Repeat until done */
3870 COMMAND_CODE get_item_label = 0;
3877 for (j = 0; j < 8; j++)
3880 if (!angband_term[j]) continue;
3882 /* Count windows displaying inven */
3883 if (window_flag[j] & (PW_INVEN)) ni++;
3885 /* Count windows displaying equip */
3886 if (window_flag[j] & (PW_EQUIP)) ne++;
3889 /* Toggle if needed */
3890 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3891 (command_wrk == (USE_INVEN) && !ni && ne))
3894 toggle_inven_equip();
3900 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3903 /* Inventory screen */
3904 if (command_wrk == (USE_INVEN))
3906 /* Extract the legal requests */
3910 /* Redraw if needed */
3911 if (command_see) get_item_label = show_inven(menu_line, mode);
3914 /* Equipment screen */
3915 else if (command_wrk == (USE_EQUIP))
3917 /* Extract the legal requests */
3918 n1 = I2A(e1 - INVEN_RARM);
3919 n2 = I2A(e2 - INVEN_RARM);
3921 /* Redraw if needed */
3922 if (command_see) get_item_label = show_equip(menu_line, mode);
3926 else if (command_wrk == (USE_FLOOR))
3929 k = MIN(floor_top + 23, floor_num) - 1;
3931 /* Extract the legal requests */
3932 n1 = I2A(j - floor_top);
3933 n2 = I2A(k - floor_top);
3935 /* Redraw if needed */
3936 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3939 /* Viewing p_ptr->inventory_list */
3940 if (command_wrk == (USE_INVEN))
3942 /* Begin the prompt */
3943 sprintf(out_val, _("持ち物:", "Inven:"));
3947 /* Build the prompt */
3948 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3949 index_to_label(i1), index_to_label(i2));
3952 strcat(out_val, tmp_val);
3955 /* Indicate ability to "view" */
3956 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3962 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
3963 else if (allow_floor)
3964 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
3966 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
3973 strcat(out_val, _(" '-'床上,", " - for floor,"));
3974 else if (allow_equip)
3975 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
3977 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
3981 /* Viewing equipment */
3982 else if (command_wrk == (USE_EQUIP))
3984 /* Begin the prompt */
3985 sprintf(out_val, _("装備品:", "Equip:"));
3989 /* Build the prompt */
3990 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3991 index_to_label(e1), index_to_label(e2));
3994 strcat(out_val, tmp_val);
3997 /* Indicate ability to "view" */
3998 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4004 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4005 else if (allow_floor)
4006 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
4008 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4015 strcat(out_val, _(" '-'床上,", " - for floor,"));
4016 else if (allow_inven)
4017 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4019 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4024 else if (command_wrk == (USE_FLOOR))
4026 /* Begin the prompt */
4027 sprintf(out_val, _("床上:", "Floor:"));
4031 /* Build the prompt */
4032 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4035 strcat(out_val, tmp_val);
4038 /* Indicate ability to "view" */
4039 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4043 if (allow_inven && allow_equip)
4045 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4047 else if (allow_inven)
4049 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4051 else if (allow_equip)
4053 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4057 else if (allow_inven)
4059 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4061 else if (allow_equip)
4063 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4067 if (command_see && !use_menu)
4069 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4074 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4076 /* Finish the prompt */
4077 strcat(out_val, " ESC");
4079 /* Build the prompt */
4080 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4082 /* Show the prompt */
4091 if (command_wrk == USE_INVEN) max_line = max_inven;
4092 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4093 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4109 menu_line += (max_line - 1);
4125 /* Verify legality */
4126 if (command_wrk == (USE_INVEN))
4128 if (allow_floor) command_wrk = USE_FLOOR;
4129 else if (allow_equip) command_wrk = USE_EQUIP;
4136 else if (command_wrk == (USE_EQUIP))
4138 if (allow_inven) command_wrk = USE_INVEN;
4139 else if (allow_floor) command_wrk = USE_FLOOR;
4146 else if (command_wrk == (USE_FLOOR))
4148 if (allow_equip) command_wrk = USE_EQUIP;
4149 else if (allow_inven) command_wrk = USE_INVEN;
4162 /* Hack -- Fix screen */
4169 /* Switch inven/equip */
4170 if (command_wrk == USE_INVEN) max_line = max_inven;
4171 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4172 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4173 if (menu_line > max_line) menu_line = max_line;
4175 /* Need to redraw */
4183 /* Verify legality */
4184 if (command_wrk == (USE_INVEN))
4186 if (allow_equip) command_wrk = USE_EQUIP;
4187 else if (allow_floor) command_wrk = USE_FLOOR;
4194 else if (command_wrk == (USE_EQUIP))
4196 if (allow_floor) command_wrk = USE_FLOOR;
4197 else if (allow_inven) command_wrk = USE_INVEN;
4204 else if (command_wrk == (USE_FLOOR))
4206 if (allow_inven) command_wrk = USE_INVEN;
4207 else if (allow_equip) command_wrk = USE_EQUIP;
4220 /* Hack -- Fix screen */
4227 /* Switch inven/equip */
4228 if (command_wrk == USE_INVEN) max_line = max_inven;
4229 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4230 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4231 if (menu_line > max_line) menu_line = max_line;
4233 /* Need to redraw */
4242 if (command_wrk == USE_FLOOR)
4245 (*cp) = -get_item_label;
4249 /* Validate the item */
4250 if (!get_item_okay(get_item_label))
4256 /* Allow player to "refuse" certain actions */
4257 if (!get_item_allow(get_item_label))
4263 /* Accept that choice */
4264 (*cp) = get_item_label;
4281 if (menu_line > max_line) menu_line -= max_line;
4302 command_see = FALSE;
4323 grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
4325 if (command_wrk != (USE_FLOOR)) break;
4327 /* Get the object being moved. */
4328 o_idx = g_ptr->o_idx;
4330 /* Only rotate a pile of two or more objects. */
4331 if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
4333 /* Remove the first object from the list. */
4334 excise_object_idx(o_idx);
4336 /* Find end of the list. */
4338 while (current_floor_ptr->o_list[i].next_o_idx)
4339 i = current_floor_ptr->o_list[i].next_o_idx;
4341 /* Add after the last object. */
4342 current_floor_ptr->o_list[i].next_o_idx = o_idx;
4344 /* Re-scan floor list */
4345 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4347 /* Hack -- Fix screen */
4359 if (command_wrk == (USE_INVEN))
4366 command_wrk = (USE_EQUIP);
4368 else if (command_wrk == (USE_EQUIP))
4375 command_wrk = (USE_INVEN);
4377 else if (command_wrk == (USE_FLOOR))
4381 command_wrk = (USE_INVEN);
4383 else if (allow_equip)
4385 command_wrk = (USE_EQUIP);
4394 /* Hack -- Fix screen */
4401 /* Need to redraw */
4414 * If we are already examining the floor, and there
4415 * is only one item, we will always select it.
4416 * If we aren't examining the floor and there is only
4417 * one item, we will select it if floor_query_flag
4422 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4425 k = 0 - floor_list[0];
4427 /* Allow player to "refuse" certain actions */
4428 if (!get_item_allow(k))
4434 /* Accept that choice */
4443 /* Hack -- Fix screen */
4450 command_wrk = (USE_FLOOR);
4456 case '1': case '2': case '3':
4457 case '4': case '5': case '6':
4458 case '7': case '8': case '9':
4460 if (command_wrk != USE_FLOOR)
4462 /* Look up the tag */
4463 if (!get_tag(&k, which, command_wrk))
4469 /* Hack -- Validate the item */
4470 if ((k < INVEN_RARM) ? !inven : !equip)
4476 /* Validate the item */
4477 if (!get_item_okay(k))
4485 /* Look up the alphabetical tag */
4486 if (get_tag_floor(&k, which, floor_list, floor_num))
4489 k = 0 - floor_list[k];
4498 /* Allow player to "refuse" certain actions */
4499 if (!get_item_allow(k))
4505 /* Accept that choice */
4517 /* Choose "default" p_ptr->inventory_list item */
4518 if (command_wrk == (USE_INVEN))
4520 k = ((i1 == i2) ? i1 : -1);
4523 /* Choose "default" equipment item */
4524 else if (command_wrk == (USE_EQUIP))
4526 k = ((e1 == e2) ? e1 : -1);
4529 /* Choose "default" floor item */
4530 else if (command_wrk == (USE_FLOOR))
4535 k = 0 - floor_list[0];
4537 /* Allow player to "refuse" certain actions */
4538 if (!get_item_allow(k))
4544 /* Accept that choice */
4552 /* Validate the item */
4553 if (!get_item_okay(k))
4559 /* Allow player to "refuse" certain actions */
4560 if (!get_item_allow(k))
4566 /* Accept that choice */
4590 if (command_wrk != USE_FLOOR)
4592 bool not_found = FALSE;
4594 /* Look up the alphabetical tag */
4595 if (!get_tag(&k, which, command_wrk))
4600 /* Hack -- Validate the item */
4601 else if ((k < INVEN_RARM) ? !inven : !equip)
4606 /* Validate the item */
4607 else if (!get_item_okay(k))
4614 /* Accept that choice */
4624 /* Look up the alphabetical tag */
4625 if (get_tag_floor(&k, which, floor_list, floor_num))
4628 k = 0 - floor_list[k];
4630 /* Accept that choice */
4639 /* Extract "query" setting */
4640 ver = isupper(which);
4641 which = (char)tolower(which);
4643 /* Convert letter to p_ptr->inventory_list index */
4644 if (command_wrk == (USE_INVEN))
4646 if (which == '(') k = i1;
4647 else if (which == ')') k = i2;
4648 else k = label_to_inven(which);
4651 /* Convert letter to equipment index */
4652 else if (command_wrk == (USE_EQUIP))
4654 if (which == '(') k = e1;
4655 else if (which == ')') k = e2;
4656 else k = label_to_equip(which);
4659 /* Convert letter to floor index */
4660 else if (command_wrk == USE_FLOOR)
4662 if (which == '(') k = 0;
4663 else if (which == ')') k = floor_num - 1;
4664 else k = islower(which) ? A2I(which) : -1;
4665 if (k < 0 || k >= floor_num || k >= 23)
4672 k = 0 - floor_list[k];
4675 /* Validate the item */
4676 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4682 /* Verify the item */
4683 if (ver && !verify(_("本当に", "Try"), k))
4689 /* Allow player to "refuse" certain actions */
4690 if (!get_item_allow(k))
4696 /* Accept that choice */
4706 /* Fix the screen if necessary */
4711 /* Hack -- Cancel "display" */
4712 command_see = FALSE;
4716 /* Forget the item_tester_tval restriction */
4717 item_tester_tval = 0;
4719 /* Forget the item_tester_hook restriction */
4720 item_tester_hook = NULL;
4723 /* Clean up 'show choices' */
4724 /* Toggle again if needed */
4725 if (toggle) toggle_inven_equip();
4727 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4730 /* Clear the prompt line */
4733 /* Warning if needed */
4734 if (oops && str) msg_print(str);
4739 if (command_cmd) prev_tag = cur_tag;
4740 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4746 * @brief 床上のアイテムを拾う選択用サブルーチン
4747 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4749 static bool py_pickup_floor_aux(void)
4751 OBJECT_IDX this_o_idx;
4755 /* Restrict the choices */
4756 item_tester_hook = inven_carry_okay;
4759 q = _("どれを拾いますか?", "Get which item? ");
4760 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4762 if (choose_object(&item, q, s, (USE_FLOOR)))
4764 this_o_idx = 0 - item;
4771 /* Pick up the object */
4772 py_pickup_aux(this_o_idx);
4778 * @brief 床上のアイテムを拾うメイン処理
4779 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4782 * This is called by py_pickup() when easy_floor is TRUE.
4784 void py_pickup_floor(bool pickup)
4786 OBJECT_IDX this_o_idx, next_o_idx = 0;
4788 GAME_TEXT o_name[MAX_NLEN];
4792 OBJECT_IDX floor_o_idx = 0;
4796 /* Scan the pile of objects */
4797 for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
4799 /* Access the object */
4800 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
4802 object_desc(o_name, o_ptr, 0);
4804 /* Access the next object */
4805 next_o_idx = o_ptr->next_o_idx;
4807 disturb(FALSE, FALSE);
4810 if (o_ptr->tval == TV_GOLD)
4813 msg_format(" $%ld の価値がある%sを見つけた。",
4814 (long)o_ptr->pval, o_name);
4816 msg_format("You have found %ld gold pieces worth of %s.",
4817 (long)o_ptr->pval, o_name);
4820 /* Collect the gold */
4821 p_ptr->au += o_ptr->pval;
4824 p_ptr->redraw |= (PR_GOLD);
4826 p_ptr->window |= (PW_PLAYER);
4828 /* Delete the gold */
4829 delete_object_idx(this_o_idx);
4831 /* Check the next object */
4834 else if (o_ptr->marked & OM_NOMSG)
4836 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4837 * ignored. Otherwise, they are included in the prompt. */
4838 o_ptr->marked &= ~(OM_NOMSG);
4842 /* Count non-gold objects that can be picked up. */
4843 if (inven_carry_okay(o_ptr))
4848 /* Count non-gold objects */
4851 /* Remember this index */
4852 floor_o_idx = this_o_idx;
4855 /* There are no non-gold objects */
4859 /* Mention the number of objects */
4865 /* Access the object */
4866 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4868 #ifdef ALLOW_EASY_SENSE
4870 /* Option: Make object sensing easy */
4873 /* Sense the object */
4874 (void) sense_object(o_ptr);
4877 #endif /* ALLOW_EASY_SENSE */
4879 object_desc(o_name, o_ptr, 0);
4881 msg_format(_("%sがある。", "You see %s."), o_name);
4884 /* Multiple objects */
4887 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4893 /* The player has no room for anything on the floor. */
4899 /* Access the object */
4900 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4902 #ifdef ALLOW_EASY_SENSE
4904 /* Option: Make object sensing easy */
4907 /* Sense the object */
4908 (void) sense_object(o_ptr);
4911 #endif /* ALLOW_EASY_SENSE */
4913 object_desc(o_name, o_ptr, 0);
4915 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4918 /* Multiple objects */
4921 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4931 /* Hack -- query every object */
4932 if (carry_query_flag)
4934 char out_val[MAX_NLEN+20];
4936 /* Access the object */
4937 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4939 #ifdef ALLOW_EASY_SENSE
4941 /* Option: Make object sensing easy */
4944 /* Sense the object */
4945 (void) sense_object(o_ptr);
4948 #endif /* ALLOW_EASY_SENSE */
4950 object_desc(o_name, o_ptr, 0);
4952 /* Build a prompt */
4953 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
4955 /* Ask the user to confirm */
4956 if (!get_check(out_val))
4962 /* Access the object */
4963 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4965 #ifdef ALLOW_EASY_SENSE
4967 /* Option: Make object sensing easy */
4970 /* Sense the object */
4971 (void) sense_object(o_ptr);
4974 #endif /* ALLOW_EASY_SENSE */
4976 /* Pick up the object */
4977 py_pickup_aux(floor_o_idx);
4980 /* Allow the user to choose an object */
4983 while (can_pickup--)
4985 if (!py_pickup_floor_aux()) break;
4992 * @brief 矢弾を射撃した場合の破損確率を返す /
4993 * Determines the odds of an object breaking when thrown at a monster
4994 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
4997 * Note that artifacts never break, see the "drop_near()" function.
4999 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
5001 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
5003 /* Examine the snipe type */
5006 if (snipe_type == SP_KILL_WALL) return (100);
5007 if (snipe_type == SP_EXPLODE) return (100);
5008 if (snipe_type == SP_PIERCE) return (100);
5009 if (snipe_type == SP_FINAL) return (100);
5010 if (snipe_type == SP_NEEDLE) return (100);
5011 if (snipe_type == SP_EVILNESS) return (40);
5012 if (snipe_type == SP_HOLYNESS) return (40);
5015 /* Examine the item type */
5016 switch (o_ptr->tval)
5032 /* Sometimes break */
5037 return (20 - archer_bonus * 2);
5042 return (10 - archer_bonus);