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
19 #include "cmd-activate.h"
20 #include "objectkind.h"
21 #include "object-ego.h"
22 #include "object-flavor.h"
23 #include "object-hook.h"
24 #include "player-move.h"
29 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
36 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
38 * This involves resetting various things to their "default" state.\n
40 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
41 * "user pref file" based on the current setting of the "use_graphics"\n
42 * flag. This is useful for switching "graphics" on/off.\n
44 * The features, objects, and monsters, should all be encoded in the\n
45 * relevant "font.pref" and/or "graf.prf" files. \n
47 * The "prefs" parameter is no longer meaningful. \n
49 void reset_visuals(void)
53 /* Extract some info about terrain features */
54 for (i = 0; i < max_f_idx; i++)
56 feature_type *f_ptr = &f_info[i];
58 /* Assume we will use the underlying values */
59 for (j = 0; j < F_LIT_MAX; j++)
61 f_ptr->x_attr[j] = f_ptr->d_attr[j];
62 f_ptr->x_char[j] = f_ptr->d_char[j];
66 /* Extract default attr/char code for objects */
67 for (i = 0; i < max_k_idx; i++)
69 object_kind *k_ptr = &k_info[i];
71 /* Default attr/char */
72 k_ptr->x_attr = k_ptr->d_attr;
73 k_ptr->x_char = k_ptr->d_char;
76 /* Extract default attr/char code for monsters */
77 for (i = 0; i < max_r_idx; i++)
79 monster_race *r_ptr = &r_info[i];
81 /* Default attr/char */
82 r_ptr->x_attr = r_ptr->d_attr;
83 r_ptr->x_char = r_ptr->d_char;
90 /* Process "graf.prf" */
91 process_pref_file("graf.prf");
93 /* Access the "character" pref file */
94 sprintf(buf, "graf-%s.prf", player_base);
96 /* Process "graf-<playername>.prf" */
97 process_pref_file(buf);
105 /* Process "font.prf" */
106 process_pref_file("font.prf");
108 /* Access the "character" pref file */
109 sprintf(buf, "font-%s.prf", player_base);
111 /* Process "font-<playername>.prf" */
112 process_pref_file(buf);
117 * @brief オブジェクトのフラグ類を配列に与える
118 * Obtain the "flags" for an item
119 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
120 * @param flgs フラグ情報を受け取る配列
123 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
125 object_kind *k_ptr = &k_info[o_ptr->k_idx];
129 for (i = 0; i < TR_FLAG_SIZE; i++)
130 flgs[i] = k_ptr->flags[i];
133 if (object_is_fixed_artifact(o_ptr))
135 artifact_type *a_ptr = &a_info[o_ptr->name1];
137 for (i = 0; i < TR_FLAG_SIZE; i++)
138 flgs[i] = a_ptr->flags[i];
142 if (object_is_ego(o_ptr))
144 ego_item_type *e_ptr = &e_info[o_ptr->name2];
146 for (i = 0; i < TR_FLAG_SIZE; i++)
147 flgs[i] |= e_ptr->flags[i];
149 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
151 remove_flag(flgs, TR_SH_FIRE);
153 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
155 remove_flag(flgs, TR_INFRA);
157 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
159 remove_flag(flgs, TR_RES_BLIND);
160 remove_flag(flgs, TR_SEE_INVIS);
164 /* Random artifact ! */
165 for (i = 0; i < TR_FLAG_SIZE; i++)
166 flgs[i] |= o_ptr->art_flags[i];
168 if (object_is_smith(o_ptr))
170 int add = o_ptr->xtra3 - 1;
172 if (add < TR_FLAG_MAX)
176 else if (add == ESSENCE_TMP_RES_ACID)
178 add_flag(flgs, TR_RES_ACID);
179 add_flag(flgs, TR_ACTIVATE);
181 else if (add == ESSENCE_TMP_RES_ELEC)
183 add_flag(flgs, TR_RES_ELEC);
184 add_flag(flgs, TR_ACTIVATE);
186 else if (add == ESSENCE_TMP_RES_FIRE)
188 add_flag(flgs, TR_RES_FIRE);
189 add_flag(flgs, TR_ACTIVATE);
191 else if (add == ESSENCE_TMP_RES_COLD)
193 add_flag(flgs, TR_RES_COLD);
194 add_flag(flgs, TR_ACTIVATE);
196 else if (add == ESSENCE_SH_FIRE)
198 add_flag(flgs, TR_RES_FIRE);
199 add_flag(flgs, TR_SH_FIRE);
201 else if (add == ESSENCE_SH_ELEC)
203 add_flag(flgs, TR_RES_ELEC);
204 add_flag(flgs, TR_SH_ELEC);
206 else if (add == ESSENCE_SH_COLD)
208 add_flag(flgs, TR_RES_COLD);
209 add_flag(flgs, TR_SH_COLD);
211 else if (add == ESSENCE_RESISTANCE)
213 add_flag(flgs, TR_RES_ACID);
214 add_flag(flgs, TR_RES_ELEC);
215 add_flag(flgs, TR_RES_FIRE);
216 add_flag(flgs, TR_RES_COLD);
218 else if (add == TR_IMPACT)
220 add_flag(flgs, TR_ACTIVATE);
226 * @brief オブジェクトの明示されているフラグ類を取得する
227 * Obtain the "flags" for an item which are known to the player
228 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
229 * @param flgs フラグ情報を受け取る配列
232 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
237 object_kind *k_ptr = &k_info[o_ptr->k_idx];
240 for (i = 0; i < TR_FLAG_SIZE; i++)
243 if (!object_is_aware(o_ptr)) return;
246 for (i = 0; i < TR_FLAG_SIZE; i++)
247 flgs[i] = k_ptr->flags[i];
249 /* Must be identified */
250 if (!object_is_known(o_ptr)) return;
252 /* Ego-item (known basic flags) */
253 if (object_is_ego(o_ptr))
255 ego_item_type *e_ptr = &e_info[o_ptr->name2];
257 for (i = 0; i < TR_FLAG_SIZE; i++)
258 flgs[i] |= e_ptr->flags[i];
260 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
262 remove_flag(flgs, TR_SH_FIRE);
264 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
266 remove_flag(flgs, TR_INFRA);
268 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
270 remove_flag(flgs, TR_RES_BLIND);
271 remove_flag(flgs, TR_SEE_INVIS);
276 #ifdef SPOIL_ARTIFACTS
277 /* Full knowledge for some artifacts */
278 if (object_is_artifact(o_ptr)) spoil = TRUE;
279 #endif /* SPOIL_ARTIFACTS */
281 #ifdef SPOIL_EGO_ITEMS
282 /* Full knowledge for some ego-items */
283 if (object_is_ego(o_ptr)) spoil = TRUE;
284 #endif /* SPOIL_EGO_ITEMS */
286 /* Need full knowledge or spoilers */
287 if (spoil || (o_ptr->ident & IDENT_MENTAL))
290 if (object_is_fixed_artifact(o_ptr))
292 artifact_type *a_ptr = &a_info[o_ptr->name1];
294 for (i = 0; i < TR_FLAG_SIZE; i++)
295 flgs[i] = a_ptr->flags[i];
298 /* Random artifact ! */
299 for (i = 0; i < TR_FLAG_SIZE; i++)
300 flgs[i] |= o_ptr->art_flags[i];
303 if (object_is_smith(o_ptr))
305 int add = o_ptr->xtra3 - 1;
307 if (add < TR_FLAG_MAX)
311 else if (add == ESSENCE_TMP_RES_ACID)
313 add_flag(flgs, TR_RES_ACID);
315 else if (add == ESSENCE_TMP_RES_ELEC)
317 add_flag(flgs, TR_RES_ELEC);
319 else if (add == ESSENCE_TMP_RES_FIRE)
321 add_flag(flgs, TR_RES_FIRE);
323 else if (add == ESSENCE_TMP_RES_COLD)
325 add_flag(flgs, TR_RES_COLD);
327 else if (add == ESSENCE_SH_FIRE)
329 add_flag(flgs, TR_RES_FIRE);
330 add_flag(flgs, TR_SH_FIRE);
332 else if (add == ESSENCE_SH_ELEC)
334 add_flag(flgs, TR_RES_ELEC);
335 add_flag(flgs, TR_SH_ELEC);
337 else if (add == ESSENCE_SH_COLD)
339 add_flag(flgs, TR_RES_COLD);
340 add_flag(flgs, TR_SH_COLD);
342 else if (add == ESSENCE_RESISTANCE)
344 add_flag(flgs, TR_RES_ACID);
345 add_flag(flgs, TR_RES_ELEC);
346 add_flag(flgs, TR_RES_FIRE);
347 add_flag(flgs, TR_RES_COLD);
353 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
354 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
355 * @return concptr 発動名称を返す文字列ポインタ
357 static concptr item_activation_dragon_breath(object_type *o_ptr)
359 static char desc[256];
360 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
363 object_flags(o_ptr, flgs);
364 strcpy(desc, _("", "breath "));
366 for (i = 0; dragonbreath_info[i].flag != 0; i++)
368 if (have_flag(flgs, dragonbreath_info[i].flag))
370 if (n > 0) strcat(desc, _("、", ", "));
371 strcat(desc, dragonbreath_info[i].name);
376 strcat(desc, _("のブレス(250)", ""));
382 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
383 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
384 * @return concptr 発動名称を返す文字列ポインタ
386 static concptr item_activation_aux(object_type *o_ptr)
388 static char activation_detail[256];
392 const activation_type* const act_ptr = find_activation_info(o_ptr);
394 if (!act_ptr) return _("未定義", "something undefined");
396 desc = act_ptr->desc;
398 /* Overwrite description if it is special */
399 switch (act_ptr->index) {
401 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
402 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
405 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
406 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
409 desc = item_activation_dragon_breath(o_ptr);
412 if (o_ptr->name1 == ART_HYOUSIGI)
413 desc = _("拍子木を打ちならす", "beat wooden clappers");
415 case ACT_RESIST_ACID:
416 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
417 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
419 case ACT_RESIST_FIRE:
420 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
421 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
423 case ACT_RESIST_COLD:
424 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
425 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
427 case ACT_RESIST_ELEC:
428 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
429 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
431 case ACT_RESIST_POIS:
432 if (o_ptr->name2 == EGO_BRAND_POIS)
433 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
437 /* Timeout description */
438 constant = act_ptr->timeout.constant;
439 dice = act_ptr->timeout.dice;
440 if (constant == 0 && dice == 0) {
441 /* We can activate it every current_world_ptr->game_turn */
442 strcpy(timeout, _("いつでも", "every current_world_ptr->game_turn"));
443 } else if (constant < 0) {
444 /* Activations that have special timeout */
445 switch (act_ptr->index) {
447 sprintf(timeout, _("%d ターン毎", "every %d turns"),
448 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
451 sprintf(timeout, _("%d ターン毎", "every %d turns"),
452 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
455 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
458 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
461 strcpy(timeout, "undefined");
465 /* Normal timeout activations */
466 char constant_str[16], dice_str[16];
467 sprintf(constant_str, "%d", constant);
468 sprintf(dice_str, "d%d", dice);
469 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
470 (constant > 0) ? constant_str : "",
471 (constant > 0 && dice > 0) ? "+" : "",
472 (dice > 0) ? dice_str : "");
475 /* Build detail activate description */
476 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
478 return activation_detail;
482 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
483 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
484 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
485 * @return concptr 発動名称を返す文字列ポインタ
487 concptr item_activation(object_type *o_ptr)
489 BIT_FLAGS flgs[TR_FLAG_SIZE];
490 object_flags(o_ptr, flgs);
492 /* Require activation ability */
493 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
495 /* Get an explain of an activation */
496 if (activation_index(o_ptr))
498 return item_activation_aux(o_ptr);
502 if (o_ptr->tval == TV_WHISTLE)
504 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
507 if (o_ptr->tval == TV_CAPTURE)
509 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
512 return _("何も起きない", "Nothing");
517 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
518 * Describe a "fully identified" item
519 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
520 * @param mode 表示オプション
521 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
523 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
527 BIT_FLAGS flgs[TR_FLAG_SIZE];
531 GAME_TEXT o_name[MAX_NLEN];
536 int trivial_info = 0;
537 object_flags(o_ptr, flgs);
539 /* Extract the description */
541 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
542 (k_text + k_info[o_ptr->k_idx].text),
543 77 - 15, temp, sizeof(temp));
544 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
545 { info[i] = &temp[j]; i++;}
548 if (object_is_equipment(o_ptr))
550 /* Descriptions of a basic equipment is just a flavor */
554 /* Mega-Hack -- describe activation */
555 if (have_flag(flgs, TR_ACTIVATE))
557 info[i++] = _("始動したときの効果...", "It can be activated for...");
558 info[i++] = item_activation(o_ptr);
559 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
562 /* Figurines, a hack */
563 if (o_ptr->tval == TV_FIGURINE)
565 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
568 /* Figurines, a hack */
569 if (o_ptr->name1 == ART_STONEMASK)
571 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you current_world_ptr->game_turn into a vampire permanently.");
574 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
576 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
579 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
581 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
582 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
585 if (o_ptr->name2 == EGO_2WEAPON)
587 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
590 if (have_flag(flgs, TR_EASY_SPELL))
592 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
595 if (o_ptr->name2 == EGO_AMU_FOOL)
597 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
600 if (o_ptr->name2 == EGO_RING_THROW)
602 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
605 if (o_ptr->name2 == EGO_AMU_NAIVETY)
607 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
610 if (o_ptr->tval == TV_STATUE)
612 monster_race *r_ptr = &r_info[o_ptr->pval];
614 if (o_ptr->pval == MON_BULLGATES)
615 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
616 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
617 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
619 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
622 /* Hack -- describe lite's */
624 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
627 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
628 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
629 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
630 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
631 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
632 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
634 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
636 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
638 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
642 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
643 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
646 if(rad != 0) info[i++] = desc;
649 if (o_ptr->name2 == EGO_LITE_LONG)
651 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
654 /* And then describe it fully */
656 if (have_flag(flgs, TR_RIDING))
658 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
659 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
662 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
663 /* This information is not important enough */
667 if (have_flag(flgs, TR_STR))
669 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
671 if (have_flag(flgs, TR_INT))
673 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
675 if (have_flag(flgs, TR_WIS))
677 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
679 if (have_flag(flgs, TR_DEX))
681 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
683 if (have_flag(flgs, TR_CON))
685 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
687 if (have_flag(flgs, TR_CHR))
689 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
692 if (have_flag(flgs, TR_MAGIC_MASTERY))
694 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
697 if (have_flag(flgs, TR_STEALTH))
699 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
701 if (have_flag(flgs, TR_SEARCH))
703 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
705 if (have_flag(flgs, TR_INFRA))
707 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
709 if (have_flag(flgs, TR_TUNNEL))
711 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
713 if (have_flag(flgs, TR_SPEED))
715 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
717 if (have_flag(flgs, TR_BLOWS))
719 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
722 if (have_flag(flgs, TR_BRAND_ACID))
724 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
726 if (have_flag(flgs, TR_BRAND_ELEC))
728 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
730 if (have_flag(flgs, TR_BRAND_FIRE))
732 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
734 if (have_flag(flgs, TR_BRAND_COLD))
736 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
739 if (have_flag(flgs, TR_BRAND_POIS))
741 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
744 if (have_flag(flgs, TR_CHAOTIC))
746 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
749 if (have_flag(flgs, TR_VAMPIRIC))
751 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
754 if (have_flag(flgs, TR_IMPACT))
756 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
759 if (have_flag(flgs, TR_VORPAL))
761 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
764 if (have_flag(flgs, TR_KILL_DRAGON))
766 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
768 else if (have_flag(flgs, TR_SLAY_DRAGON))
770 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
773 if (have_flag(flgs, TR_KILL_ORC))
775 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
777 if (have_flag(flgs, TR_SLAY_ORC))
779 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
782 if (have_flag(flgs, TR_KILL_TROLL))
784 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
786 if (have_flag(flgs, TR_SLAY_TROLL))
788 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
791 if (have_flag(flgs, TR_KILL_GIANT))
793 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
795 else if (have_flag(flgs, TR_SLAY_GIANT))
797 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
800 if (have_flag(flgs, TR_KILL_DEMON))
802 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
804 if (have_flag(flgs, TR_SLAY_DEMON))
806 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
809 if (have_flag(flgs, TR_KILL_UNDEAD))
811 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
813 if (have_flag(flgs, TR_SLAY_UNDEAD))
815 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
818 if (have_flag(flgs, TR_KILL_EVIL))
820 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
822 if (have_flag(flgs, TR_SLAY_EVIL))
824 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
827 if (have_flag(flgs, TR_KILL_ANIMAL))
829 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
831 if (have_flag(flgs, TR_SLAY_ANIMAL))
833 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
836 if (have_flag(flgs, TR_KILL_HUMAN))
838 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
840 if (have_flag(flgs, TR_SLAY_HUMAN))
842 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
845 if (have_flag(flgs, TR_FORCE_WEAPON))
847 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
849 if (have_flag(flgs, TR_DEC_MANA))
851 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
853 if (have_flag(flgs, TR_SUST_STR))
855 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
857 if (have_flag(flgs, TR_SUST_INT))
859 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
861 if (have_flag(flgs, TR_SUST_WIS))
863 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
865 if (have_flag(flgs, TR_SUST_DEX))
867 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
869 if (have_flag(flgs, TR_SUST_CON))
871 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
873 if (have_flag(flgs, TR_SUST_CHR))
875 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
878 if (have_flag(flgs, TR_IM_ACID))
880 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
882 if (have_flag(flgs, TR_IM_ELEC))
884 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
886 if (have_flag(flgs, TR_IM_FIRE))
888 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
890 if (have_flag(flgs, TR_IM_COLD))
892 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
895 if (have_flag(flgs, TR_THROW))
897 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
900 if (have_flag(flgs, TR_FREE_ACT))
902 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
904 if (have_flag(flgs, TR_HOLD_EXP))
906 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
908 if (have_flag(flgs, TR_RES_FEAR))
910 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
912 if (have_flag(flgs, TR_RES_ACID))
914 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
916 if (have_flag(flgs, TR_RES_ELEC))
918 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
920 if (have_flag(flgs, TR_RES_FIRE))
922 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
924 if (have_flag(flgs, TR_RES_COLD))
926 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
928 if (have_flag(flgs, TR_RES_POIS))
930 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
933 if (have_flag(flgs, TR_RES_LITE))
935 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
937 if (have_flag(flgs, TR_RES_DARK))
939 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
942 if (have_flag(flgs, TR_RES_BLIND))
944 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
946 if (have_flag(flgs, TR_RES_CONF))
948 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
950 if (have_flag(flgs, TR_RES_SOUND))
952 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
954 if (have_flag(flgs, TR_RES_SHARDS))
956 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
959 if (have_flag(flgs, TR_RES_NETHER))
961 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
963 if (have_flag(flgs, TR_RES_NEXUS))
965 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
967 if (have_flag(flgs, TR_RES_CHAOS))
969 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
971 if (have_flag(flgs, TR_RES_DISEN))
973 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
976 if (have_flag(flgs, TR_LEVITATION))
978 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
981 if (have_flag(flgs, TR_SEE_INVIS))
983 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
985 if (have_flag(flgs, TR_TELEPATHY))
987 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
989 if (have_flag(flgs, TR_ESP_ANIMAL))
991 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
993 if (have_flag(flgs, TR_ESP_UNDEAD))
995 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
997 if (have_flag(flgs, TR_ESP_DEMON))
999 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
1001 if (have_flag(flgs, TR_ESP_ORC))
1003 info[i++] = _("それはオークを感知する。", "It senses orcs.");
1005 if (have_flag(flgs, TR_ESP_TROLL))
1007 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1009 if (have_flag(flgs, TR_ESP_GIANT))
1011 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1013 if (have_flag(flgs, TR_ESP_DRAGON))
1015 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1017 if (have_flag(flgs, TR_ESP_HUMAN))
1019 info[i++] = _("それは人間を感知する。", "It senses humans.");
1021 if (have_flag(flgs, TR_ESP_EVIL))
1023 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1025 if (have_flag(flgs, TR_ESP_GOOD))
1027 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1029 if (have_flag(flgs, TR_ESP_NONLIVING))
1031 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1033 if (have_flag(flgs, TR_ESP_UNIQUE))
1035 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1037 if (have_flag(flgs, TR_SLOW_DIGEST))
1039 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1041 if (have_flag(flgs, TR_REGEN))
1043 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1045 if (have_flag(flgs, TR_WARNING))
1047 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1049 if (have_flag(flgs, TR_REFLECT))
1051 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1053 if (have_flag(flgs, TR_SH_FIRE))
1055 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1057 if (have_flag(flgs, TR_SH_ELEC))
1059 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1061 if (have_flag(flgs, TR_SH_COLD))
1063 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1065 if (have_flag(flgs, TR_NO_MAGIC))
1067 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1069 if (have_flag(flgs, TR_NO_TELE))
1071 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1073 if (have_flag(flgs, TR_XTRA_MIGHT))
1075 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1077 if (have_flag(flgs, TR_XTRA_SHOTS))
1079 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1082 if (have_flag(flgs, TR_BLESSED))
1084 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1087 if (object_is_cursed(o_ptr))
1089 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1091 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1093 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1095 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1099 info[i++] = _("それは呪われている。", "It is cursed.");
1102 * It's a trivial infomation since there is
1103 * fake inscription {cursed}
1109 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1111 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1113 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1115 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1117 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1119 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1121 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1123 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1125 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1127 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1129 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1131 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1133 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1135 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1137 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1139 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1141 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1143 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1145 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1147 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1149 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1151 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1153 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1155 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1157 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1159 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1161 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1163 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1165 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1167 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1169 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1171 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1173 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1175 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1177 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1179 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1182 /* Describe about this kind of object instead of THIS fake object */
1183 if (mode & SCROBJ_FAKE_OBJECT)
1185 switch (o_ptr->tval)
1188 switch (o_ptr->sval)
1190 case SV_RING_LORDLY:
1191 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1193 case SV_RING_WARNING:
1194 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1200 switch (o_ptr->sval)
1202 case SV_AMULET_RESISTANCE:
1203 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1204 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1206 case SV_AMULET_THE_MAGI:
1207 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1214 if (have_flag(flgs, TR_IGNORE_ACID) &&
1215 have_flag(flgs, TR_IGNORE_ELEC) &&
1216 have_flag(flgs, TR_IGNORE_FIRE) &&
1217 have_flag(flgs, TR_IGNORE_COLD))
1219 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1223 if (have_flag(flgs, TR_IGNORE_ACID))
1225 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1227 if (have_flag(flgs, TR_IGNORE_ELEC))
1229 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1231 if (have_flag(flgs, TR_IGNORE_FIRE))
1233 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1235 if (have_flag(flgs, TR_IGNORE_COLD))
1237 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1241 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1243 /* No relevant informations */
1244 if (i <= trivial_info) return (FALSE);
1247 Term_get_size(&wid, &hgt);
1249 /* Display Item name */
1250 if (!(mode & SCROBJ_FAKE_OBJECT))
1251 object_desc(o_name, o_ptr, 0);
1253 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1257 /* Erase the screen */
1258 for (k = 1; k < hgt; k++) prt("", k, 13);
1260 /* Label the information */
1261 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1263 monster_race *r_ptr = &r_info[o_ptr->pval];
1264 int namelen = strlen(r_name + r_ptr->name);
1265 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1266 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1267 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1271 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1274 /* We will print on top of the map (column 13) */
1275 for (k = 2, j = 0; j < i; j++)
1278 prt(info[j], k++, 15);
1280 /* Every 20 entries (lines 2 to 21), start over */
1281 if ((k == hgt - 2) && (j+1 < i))
1283 prt(_("-- 続く --", "-- more --"), k, 15);
1285 for (; k > 2; k--) prt("", k, 15);
1290 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1295 /* Gave knowledge */
1302 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1303 * Convert an p_ptr->inventory_list index into a one character label
1304 * @param i プレイヤーの所持/装備オブジェクトID
1305 * @return 対応するアルファベット
1306 * @details Note that the label does NOT distinguish inven/equip.
1308 char index_to_label(int i)
1310 /* Indexes for "inven" are easy */
1311 if (i < INVEN_RARM) return (I2A(i));
1313 /* Indexes for "equip" are offset */
1314 return (I2A(i - INVEN_RARM));
1318 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1319 * Convert a label into the index of an item in the "inven"
1320 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1321 * @details Note that the label does NOT distinguish inven/equip.
1323 INVENTORY_IDX label_to_inven(int c)
1328 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1330 /* Verify the index */
1331 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1333 /* Empty slots can never be chosen */
1334 if (!p_ptr->inventory_list[i].k_idx) return (-1);
1336 /* Return the index */
1342 extern bool select_ring_slot;
1346 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1347 * @param i プレイヤーの所持/装備オブジェクトID
1348 * @return 指輪枠ならばTRUEを返す。
1350 static bool is_ring_slot(int i)
1352 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1357 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1358 * Convert a label into the index of a item in the "equip"
1359 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1361 INVENTORY_IDX label_to_equip(int c)
1366 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1368 /* Verify the index */
1369 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1371 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1373 /* Empty slots can never be chosen */
1374 if (!p_ptr->inventory_list[i].k_idx) return (-1);
1376 /* Return the index */
1383 * @brief オブジェクトの該当装備部位IDを返す /
1384 * Determine which equipment slot (if any) an item likes
1385 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1386 * @return 対応する装備部位ID
1388 s16b wield_slot(object_type *o_ptr)
1390 /* Slot for equipment */
1391 switch (o_ptr->tval)
1398 if (!p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_RARM);
1399 if (p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_RARM);
1400 return (INVEN_LARM);
1407 if (!p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_LARM);
1408 if (p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_LARM);
1409 return (INVEN_RARM);
1419 /* Use the right hand first */
1420 if (!p_ptr->inventory_list[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1422 /* Use the left hand for swapping (by default) */
1423 return (INVEN_LEFT);
1429 return (INVEN_NECK);
1434 return (INVEN_LITE);
1441 return (INVEN_BODY);
1446 return (INVEN_OUTER);
1452 return (INVEN_HEAD);
1457 return (INVEN_HANDS);
1462 return (INVEN_FEET);
1466 /* No slot available */
1471 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1472 * Return a string mentioning how a given item is carried
1473 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1474 * @return 部位表現の文字列ポインタ
1476 concptr mention_use(int i)
1480 /* Examine the location */
1484 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1486 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1490 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1492 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1495 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1496 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1497 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1498 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1499 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1500 case INVEN_BODY: p = _(" 体", "On body"); break;
1501 case INVEN_OUTER: p = _("体の上", "About body"); break;
1502 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1503 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1504 case INVEN_FEET: p = _(" 足", "On feet"); break;
1505 default: p = _("ザック", "In pack"); break;
1508 /* Return the result */
1514 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1515 * Return a string describing how a given item is being worn.
1516 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1517 * @return 状態表現内容の文字列ポインタ
1519 * Currently, only used for items in the equipment, not p_ptr->inventory_list.
1521 concptr describe_use(int i)
1528 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1530 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1534 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1536 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1539 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;
1540 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1541 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1542 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1543 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1544 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1545 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1546 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1547 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1548 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1549 default: p = _("ザックに入っている", "carrying in your pack"); break;
1552 /* Return the result */
1558 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1559 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1560 * @param book_tval ベースアイテムのtval
1561 * @param book_sval ベースアイテムのsval
1562 * @return 使用可能な魔法書ならばTRUEを返す。
1565 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1567 if (book_tval < TV_LIFE_BOOK) return FALSE;
1568 if (p_ptr->pclass == CLASS_SORCERER)
1570 return is_magic(tval2realm(book_tval));
1572 else if (p_ptr->pclass == CLASS_RED_MAGE)
1574 if (is_magic(tval2realm(book_tval)))
1575 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1577 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1581 * Here is a "hook" used during calls to "get_item()" and
1582 * "show_inven()" and "show_equip()", and the choice window routines.
1584 bool(*item_tester_hook)(object_type*);
1587 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1588 * Check an item against the item tester info
1589 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1590 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1592 bool item_tester_okay(object_type *o_ptr)
1594 /* Hack -- allow listing empty slots */
1595 // if (item_tester_full) return (TRUE); // TODO:DELETE
1597 /* Require an item */
1598 if (!o_ptr->k_idx) return (FALSE);
1600 /* Hack -- ignore "gold" */
1601 if (o_ptr->tval == TV_GOLD)
1604 extern bool show_gold_on_floor;
1606 if (!show_gold_on_floor) return (FALSE);
1609 /* Check the tval */
1610 if (item_tester_tval)
1612 /* Is it a spellbook? If so, we need a hack -- TY */
1613 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1614 (item_tester_tval >= TV_LIFE_BOOK))
1615 return check_book_realm(o_ptr->tval, o_ptr->sval);
1617 if (item_tester_tval != o_ptr->tval) return (FALSE);
1620 /* Check the hook */
1621 if (item_tester_hook)
1623 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1632 * @brief 所持アイテム一覧を表示する /
1633 * Choice window "shadow" of the "show_inven()" function
1636 void display_inven(void)
1638 register int i, n, z = 0;
1640 TERM_COLOR attr = TERM_WHITE;
1642 GAME_TEXT o_name[MAX_NLEN];
1645 Term_get_size(&wid, &hgt);
1647 for (i = 0; i < INVEN_PACK; i++)
1649 o_ptr = &p_ptr->inventory_list[i];
1650 if (!o_ptr->k_idx) continue;
1654 for (i = 0; i < z; i++)
1656 o_ptr = &p_ptr->inventory_list[i];
1657 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1658 if (item_tester_okay(o_ptr))
1660 tmp_val[0] = index_to_label(i);
1664 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1665 object_desc(o_name, o_ptr, 0);
1667 attr = tval_to_attr[o_ptr->tval % 128];
1673 Term_putstr(3, i, n, attr, o_name);
1674 Term_erase(3+n, i, 255);
1678 int wgt = o_ptr->weight * o_ptr->number;
1680 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1682 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1684 prt(tmp_val, i, wid - 9);
1688 for (i = z; i < hgt; i++)
1690 Term_erase(0, i, 255);
1697 * @brief 装備アイテム一覧を表示する /
1698 * Choice window "shadow" of the "show_equip()" function
1701 void display_equip(void)
1705 TERM_COLOR attr = TERM_WHITE;
1707 GAME_TEXT o_name[MAX_NLEN];
1710 Term_get_size(&wid, &hgt);
1712 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1714 o_ptr = &p_ptr->inventory_list[i];
1715 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1716 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1718 tmp_val[0] = index_to_label(i);
1722 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1723 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1725 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1730 object_desc(o_name, o_ptr, 0);
1731 attr = tval_to_attr[o_ptr->tval % 128];
1739 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1741 Term_erase(3 + n, i - INVEN_RARM, 255);
1745 int wgt = o_ptr->weight * o_ptr->number;
1747 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1749 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1752 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1757 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1758 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1762 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1764 Term_erase(0, i, 255);
1770 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1771 * Find the "first" p_ptr->inventory_list object with the given "tag".
1772 * @param cp 対応するタグIDを与える参照ポインタ
1773 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1774 * @param mode 所持、装備の切り替え
1775 * @return タグに該当するオブジェクトがあるならTRUEを返す
1777 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1778 * inscription of an object. Alphabetical characters don't work as a\n
1779 * tag in this form.\n
1781 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1782 * and "x" is the "current" command_cmd code.\n
1784 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1787 COMMAND_CODE start, end;
1790 /* Extract index from mode */
1795 end = INVEN_TOTAL - 1;
1800 end = INVEN_PACK - 1;
1807 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1809 /* Check every p_ptr->inventory_list object */
1810 for (i = start; i <= end; i++)
1812 object_type *o_ptr = &p_ptr->inventory_list[i];
1813 if (!o_ptr->k_idx) continue;
1815 /* Skip empty inscriptions */
1816 if (!o_ptr->inscription) continue;
1818 /* Skip non-choice */
1819 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1822 s = my_strchr(quark_str(o_ptr->inscription), '@');
1824 /* Process all tags */
1827 /* Check the special tags */
1828 if ((s[1] == command_cmd) && (s[2] == tag))
1830 /* Save the actual p_ptr->inventory_list ID */
1837 /* Find another '@' */
1838 s = my_strchr(s + 1, '@');
1843 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1845 /* Don't allow {@#} with '#' being alphabet */
1846 if (tag < '0' || '9' < tag)
1852 /* Check every object */
1853 for (i = start; i <= end; i++)
1855 object_type *o_ptr = &p_ptr->inventory_list[i];
1856 if (!o_ptr->k_idx) continue;
1858 /* Skip empty inscriptions */
1859 if (!o_ptr->inscription) continue;
1861 /* Skip non-choice */
1862 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1865 s = my_strchr(quark_str(o_ptr->inscription), '@');
1867 /* Process all tags */
1870 /* Check the normal tags */
1873 /* Save the actual p_ptr->inventory_list ID */
1880 /* Find another '@' */
1881 s = my_strchr(s + 1, '@');
1891 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1892 * Find the "first" p_ptr->inventory_list object with the given "tag".
1893 * @param cp 対応するタグIDを与える参照ポインタ
1894 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1895 * @param floor_list 床上アイテムの配列
1896 * @param floor_num 床上アイテムの配列ID
1897 * @return タグに該当するオブジェクトがあるならTRUEを返す
1899 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1900 * inscription of an object. Alphabetical characters don't work as a\n
1901 * tag in this form.\n
1903 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1904 * and "x" is the "current" command_cmd code.\n
1906 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1911 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1913 /* Check every object in the grid */
1914 for (i = 0; i < floor_num && i < 23; i++)
1916 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1918 /* Skip empty inscriptions */
1919 if (!o_ptr->inscription) continue;
1922 s = my_strchr(quark_str(o_ptr->inscription), '@');
1924 /* Process all tags */
1927 /* Check the special tags */
1928 if ((s[1] == command_cmd) && (s[2] == tag))
1930 /* Save the actual floor object ID */
1937 /* Find another '@' */
1938 s = my_strchr(s + 1, '@');
1943 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1945 /* Don't allow {@#} with '#' being alphabet */
1946 if (tag < '0' || '9' < tag)
1952 /* Check every object in the grid */
1953 for (i = 0; i < floor_num && i < 23; i++)
1955 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1957 /* Skip empty inscriptions */
1958 if (!o_ptr->inscription) continue;
1961 s = my_strchr(quark_str(o_ptr->inscription), '@');
1963 /* Process all tags */
1966 /* Check the normal tags */
1969 /* Save the floor object ID */
1976 /* Find another '@' */
1977 s = my_strchr(s + 1, '@');
1987 * @brief タグIDにあわせてタグアルファベットのリストを返す /
1988 * Move around label characters with correspond tags
1989 * @param label ラベルリストを取得する文字列参照ポインタ
1990 * @param mode 所持品リストか装備品リストかの切り替え
1993 static void prepare_label_string(char *label, BIT_FLAGS mode)
1995 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
1996 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
1999 /* Prepare normal labels */
2000 strcpy(label, alphabet_chars);
2002 /* Move each label */
2003 for (i = 0; i < 52; i++)
2006 SYMBOL_CODE c = alphabet_chars[i];
2008 /* Find a tag with this label */
2009 if (get_tag(&index, c, mode))
2011 /* Delete the overwritten label */
2012 if (label[i] == c) label[i] = ' ';
2014 /* Move the label to the place of corresponding tag */
2015 label[index - offset] = c;
2022 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2023 * Move around label characters with correspond tags (floor version)
2024 * @param label ラベルリストを取得する文字列参照ポインタ
2025 * @param floor_list 床上アイテムの配列
2026 * @param floor_num 床上アイテムの配列ID
2031 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2033 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2036 /* Prepare normal labels */
2037 strcpy(label, alphabet_chars);
2039 /* Move each label */
2040 for (i = 0; i < 52; i++)
2043 SYMBOL_CODE c = alphabet_chars[i];
2045 /* Find a tag with this label */
2046 if (get_tag_floor(&index, c, floor_list, floor_num))
2048 /* Delete the overwritten label */
2049 if (label[i] == c) label[i] = ' ';
2051 /* Move the label to the place of corresponding tag */
2059 * @brief 所持アイテムの表示を行う /
2060 * Display the p_ptr->inventory_list.
2061 * @param target_item アイテムの選択処理を行うか否か。
2062 * @return 選択したアイテムのタグ
2064 * Hack -- do not display "trailing" empty slots
2066 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2070 int col, cur_col, len;
2072 GAME_TEXT o_name[MAX_NLEN];
2074 COMMAND_CODE out_index[23];
2075 TERM_COLOR out_color[23];
2076 char out_desc[23][MAX_NLEN];
2077 COMMAND_CODE target_item_label = 0;
2079 char inven_label[52 + 1];
2081 /* Starting column */
2084 Term_get_size(&wid, &hgt);
2086 /* Default "max-length" */
2087 len = wid - col - 1;
2090 /* Find the "final" slot */
2091 for (i = 0; i < INVEN_PACK; i++)
2093 o_ptr = &p_ptr->inventory_list[i];
2094 if (!o_ptr->k_idx) continue;
2100 prepare_label_string(inven_label, USE_INVEN);
2102 /* Display the p_ptr->inventory_list */
2103 for (k = 0, i = 0; i < z; i++)
2105 o_ptr = &p_ptr->inventory_list[i];
2107 /* Is this item acceptable? */
2108 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2110 object_desc(o_name, o_ptr, 0);
2112 /* Save the object index, color, and description */
2114 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2116 /* Grey out charging items */
2119 out_color[k] = TERM_L_DARK;
2122 (void)strcpy(out_desc[k], o_name);
2124 /* Find the predicted "line length" */
2125 l = strlen(out_desc[k]) + 5;
2127 /* Be sure to account for the weight */
2128 if (show_weights) l += 9;
2130 /* Account for icon if displayed */
2131 if (show_item_graph)
2134 if (use_bigtile) l++;
2137 /* Maintain the maximum length */
2138 if (l > len) len = l;
2140 /* Advance to next "line" */
2144 /* Find the column to start in */
2145 col = (len > wid - 4) ? 0 : (wid - len - 1);
2147 /* Output each entry */
2148 for (j = 0; j < k; j++)
2151 o_ptr = &p_ptr->inventory_list[i];
2153 /* Clear the line */
2154 prt("", j + 1, col ? col - 2 : col);
2156 if (use_menu && target_item)
2158 if (j == (target_item-1))
2160 strcpy(tmp_val, _("》", "> "));
2161 target_item_label = i;
2163 else strcpy(tmp_val, " ");
2165 else if (i <= INVEN_PACK)
2167 /* Prepare an index --(-- */
2168 sprintf(tmp_val, "%c)", inven_label[i]);
2172 /* Prepare an index --(-- */
2173 sprintf(tmp_val, "%c)", index_to_label(i));
2176 /* Clear the line with the (possibly indented) index */
2177 put_str(tmp_val, j + 1, col);
2181 /* Display graphics for object, if desired */
2182 if (show_item_graph)
2184 TERM_COLOR a = object_attr(o_ptr);
2185 SYMBOL_CODE c = object_char(o_ptr);
2186 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2187 if (use_bigtile) cur_col++;
2193 /* Display the entry itself */
2194 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2196 /* Display the weight if needed */
2199 int wgt = o_ptr->weight * o_ptr->number;
2201 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2203 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2206 prt(tmp_val, j + 1, wid - 9);
2210 /* Make a "shadow" below the list (only if needed) */
2211 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2213 /* Save the new column */
2216 return target_item_label;
2221 * @brief 装備アイテムの表示を行う /
2222 * Display the equipment.
2223 * @param target_item アイテムの選択処理を行うか否か。
2224 * @return 選択したアイテムのタグ
2226 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2230 int col, cur_col, len;
2233 GAME_TEXT o_name[MAX_NLEN];
2234 COMMAND_CODE out_index[23];
2235 TERM_COLOR out_color[23];
2236 char out_desc[23][MAX_NLEN];
2237 COMMAND_CODE target_item_label = 0;
2239 char equip_label[52 + 1];
2241 /* Starting column */
2244 Term_get_size(&wid, &hgt);
2246 /* Maximal length */
2247 len = wid - col - 1;
2250 /* Scan the equipment list */
2251 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2253 o_ptr = &p_ptr->inventory_list[i];
2255 /* Is this item acceptable? */
2256 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2257 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2258 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2260 object_desc(o_name, o_ptr, 0);
2262 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2264 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2265 out_color[k] = TERM_WHITE;
2269 (void)strcpy(out_desc[k], o_name);
2270 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2274 /* Grey out charging items */
2277 out_color[k] = TERM_L_DARK;
2280 /* Extract the maximal length (see below) */
2282 l = strlen(out_desc[k]) + (2 + 1);
2284 l = strlen(out_desc[k]) + (2 + 3);
2288 /* Increase length for labels (if needed) */
2290 if (show_labels) l += (7 + 2);
2292 if (show_labels) l += (14 + 2);
2296 /* Increase length for weight (if needed) */
2297 if (show_weights) l += 9;
2299 if (show_item_graph) l += 2;
2301 /* Maintain the max-length */
2302 if (l > len) len = l;
2304 /* Advance the entry */
2308 /* Hack -- Find a column to start in */
2310 col = (len > wid - 6) ? 0 : (wid - len - 1);
2312 col = (len > wid - 4) ? 0 : (wid - len - 1);
2315 prepare_label_string(equip_label, USE_EQUIP);
2317 /* Output each entry */
2318 for (j = 0; j < k; j++)
2321 o_ptr = &p_ptr->inventory_list[i];
2323 /* Clear the line */
2324 prt("", j + 1, col ? col - 2 : col);
2326 if (use_menu && target_item)
2328 if (j == (target_item-1))
2330 strcpy(tmp_val, _("》", "> "));
2331 target_item_label = i;
2333 else strcpy(tmp_val, " ");
2335 else if (i >= INVEN_RARM)
2337 /* Prepare an index --(-- */
2338 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2342 /* Prepare an index --(-- */
2343 sprintf(tmp_val, "%c)", index_to_label(i));
2346 /* Clear the line with the (possibly indented) index */
2347 put_str(tmp_val, j+1, col);
2351 /* Display graphics for object, if desired */
2352 if (show_item_graph)
2354 TERM_COLOR a = object_attr(o_ptr);
2355 SYMBOL_CODE c = object_char(o_ptr);
2356 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2357 if (use_bigtile) cur_col++;
2365 /* Mention the use */
2366 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2368 put_str(tmp_val, j+1, cur_col);
2370 /* Display the entry itself */
2371 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2377 /* Display the entry itself */
2378 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2381 /* Display the weight if needed */
2384 int wgt = o_ptr->weight * o_ptr->number;
2386 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2388 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2391 prt(tmp_val, j + 1, wid - 9);
2395 /* Make a "shadow" below the list (only if needed) */
2396 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2398 /* Save the new column */
2401 return target_item_label;
2405 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2406 * Flip "inven" and "equip" in any sub-windows
2409 void toggle_inven_equip(void)
2414 for (j = 0; j < 8; j++)
2417 if (!angband_term[j]) continue;
2419 /* Flip inven to equip */
2420 if (window_flag[j] & (PW_INVEN))
2423 window_flag[j] &= ~(PW_INVEN);
2424 window_flag[j] |= (PW_EQUIP);
2426 p_ptr->window |= (PW_EQUIP);
2429 /* Flip inven to equip */
2430 else if (window_flag[j] & (PW_EQUIP))
2433 window_flag[j] &= ~(PW_EQUIP);
2434 window_flag[j] |= (PW_INVEN);
2436 p_ptr->window |= (PW_INVEN);
2442 * @brief 選択したアイテムの確認処理の補助 /
2443 * Verify the choice of an item.
2444 * @param prompt メッセージ表示の一部
2445 * @param item 選択アイテムID
2446 * @return 確認がYesならTRUEを返す。
2447 * @details The item can be negative to mean "item on floor".
2449 static bool verify(concptr prompt, INVENTORY_IDX item)
2451 GAME_TEXT o_name[MAX_NLEN];
2452 char out_val[MAX_NLEN+20];
2459 o_ptr = &p_ptr->inventory_list[item];
2465 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2467 object_desc(o_name, o_ptr, 0);
2470 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2473 return (get_check(out_val));
2478 * @brief 選択したアイテムの確認処理のメインルーチン /
2479 * @param item 選択アイテムID
2480 * @return 確認がYesならTRUEを返す。
2481 * @details The item can be negative to mean "item on floor".
2482 * Hack -- allow user to "prevent" certain choices
2484 static bool get_item_allow(INVENTORY_IDX item)
2488 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2493 o_ptr = &p_ptr->inventory_list[item];
2499 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2502 /* No inscription */
2503 if (!o_ptr->inscription) return (TRUE);
2506 s = my_strchr(quark_str(o_ptr->inscription), '!');
2508 /* Process preventions */
2511 /* Check the "restriction" */
2512 if ((s[1] == command_cmd) || (s[1] == '*'))
2514 /* Verify the choice */
2515 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2518 /* Find another '!' */
2519 s = my_strchr(s + 1, '!');
2528 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2529 * Auxiliary function for "get_item()" -- test an index
2531 * @return 正規のIDならばTRUEを返す。
2533 static bool get_item_okay(OBJECT_IDX i)
2536 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2538 if (select_ring_slot) return is_ring_slot(i);
2540 /* Verify the item */
2541 if (!item_tester_okay(&p_ptr->inventory_list[i])) return (FALSE);
2548 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2549 * Determine whether get_item() can get some item or not
2550 * @return アイテムを拾えるならばTRUEを返す。
2551 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2553 bool can_get_item(void)
2556 OBJECT_IDX floor_list[23];
2557 ITEM_NUMBER floor_num = 0;
2559 for (j = 0; j < INVEN_TOTAL; j++)
2560 if (item_tester_okay(&p_ptr->inventory_list[j]))
2563 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2571 * @brief オブジェクト選択の汎用関数 /
2572 * Let the user select an item, save its "index"
2573 * @param cp 選択したオブジェクトのIDを返す。
2574 * @param pmt 選択目的のメッセージ
2575 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2576 * @param mode オプションフラグ
2577 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2578 * Return TRUE only if an acceptable item was chosen by the user.\n
2580 * The selected item must satisfy the "item_tester_hook()" function,\n
2581 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2583 * All "item_tester" restrictions are cleared before this function returns.\n
2585 * The user is allowed to choose acceptable items from the equipment,\n
2586 * p_ptr->inventory_list, or floor, respectively, if the proper flag was given,\n
2587 * and there are any acceptable items in that location.\n
2589 * The equipment or p_ptr->inventory_list are displayed (even if no acceptable\n
2590 * items are in that location) if the proper flag was given.\n
2592 * If there are no acceptable items available anywhere, and "str" is\n
2593 * not NULL, then it will be used as the text of a warning message\n
2594 * before the function returns.\n
2596 * Note that the user must press "-" to specify the item on the floor,\n
2597 * and there is no way to "examine" the item on the floor, while the\n
2598 * use of "capital" letters will "examine" an p_ptr->inventory_list/equipment item,\n
2599 * and prompt for its use.\n
2601 * If a legal item is selected from the p_ptr->inventory_list, we save it in "cp"\n
2602 * directly (0 to 35), and return TRUE.\n
2604 * If a legal item is selected from the floor, we save it in "cp" as\n
2605 * a negative (-1 to -511), and return TRUE.\n
2607 * If no item is available, we do nothing to "cp", and we display a\n
2608 * warning message, using "str" if available, and return FALSE.\n
2610 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2612 * Global "p_ptr->command_new" is used when viewing the p_ptr->inventory_list or equipment\n
2613 * to allow the user to enter a command while viewing those screens, and\n
2614 * also to induce "auto-enter" of stores, and other such stuff.\n
2616 * Global "p_ptr->command_see" may be set before calling this function to start\n
2617 * out in "browse" mode. It is cleared before this function returns.\n
2619 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2620 * If it is TRUE then we are viewing p_ptr->inventory_list, else equipment.\n
2622 * We always erase the prompt when we are done, leaving a blank line,\n
2623 * or a warning message, if appropriate, if no items are available.\n
2625 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2627 OBJECT_IDX this_o_idx, next_o_idx = 0;
2644 bool allow_floor = FALSE;
2646 bool toggle = FALSE;
2651 int menu_line = (use_menu ? 1 : 0);
2655 static char prev_tag = '\0';
2656 char cur_tag = '\0';
2658 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2661 if (mode & USE_EQUIP) equip = TRUE;
2662 if (mode & USE_INVEN) inven = TRUE;
2663 if (mode & USE_FLOOR) floor = TRUE;
2665 /* Get the item index */
2666 if (repeat_pull(cp))
2669 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2671 item_tester_tval = 0;
2672 item_tester_hook = NULL;
2673 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2678 else if (floor && (*cp < 0))
2684 o_ptr = ¤t_floor_ptr->o_list[k];
2686 /* Validate the item */
2687 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2689 /* Forget restrictions */
2690 item_tester_tval = 0;
2691 item_tester_hook = NULL;
2692 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2699 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2700 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2702 if (prev_tag && command_cmd)
2704 /* Look up the tag and validate the item */
2705 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2706 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2707 else if (!get_item_okay(k)) /* Reject */;
2710 /* Accept that choice */
2713 /* Forget restrictions */
2714 item_tester_tval = 0;
2715 item_tester_hook = NULL;
2716 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2722 prev_tag = '\0'; /* prev_tag is no longer effective */
2725 /* Verify the item */
2726 else if (get_item_okay(*cp))
2728 /* Forget restrictions */
2729 item_tester_tval = 0;
2730 item_tester_hook = NULL;
2731 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2743 /* No item selected */
2747 /* Full p_ptr->inventory_list */
2749 i2 = INVEN_PACK - 1;
2751 /* Forbid p_ptr->inventory_list */
2752 if (!inven) i2 = -1;
2755 for (j = 0; j < INVEN_PACK; j++)
2756 if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
2759 /* Restrict p_ptr->inventory_list indexes */
2760 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2761 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2764 /* Full equipment */
2766 e2 = INVEN_TOTAL - 1;
2768 /* Forbid equipment */
2769 if (!equip) e2 = -1;
2772 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2773 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
2774 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2777 /* Restrict equipment indexes */
2778 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2779 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2781 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2785 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2787 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2791 /* Restrict floor usage */
2794 /* Scan all objects in the grid */
2795 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)
2798 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
2799 next_o_idx = o_ptr->next_o_idx;
2801 /* Accept the item on the floor if legal */
2802 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2806 /* Require at least one legal choice */
2807 if (!allow_floor && (i1 > i2) && (e1 > e2))
2809 /* Cancel p_ptr->command_see */
2810 command_see = FALSE;
2814 if (mode & USE_FORCE) {
2820 /* Analyze choices */
2823 /* Hack -- Start on equipment if requested */
2824 if (command_see && command_wrk && equip)
2829 /* Use p_ptr->inventory_list if allowed */
2832 command_wrk = FALSE;
2835 /* Use equipment if allowed */
2841 /* Use p_ptr->inventory_list for floor */
2844 command_wrk = FALSE;
2850 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2852 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2854 /* Hack -- start out in "display" mode */
2861 /* Repeat until done */
2864 COMMAND_CODE get_item_label = 0;
2871 for (j = 0; j < 8; j++)
2874 if (!angband_term[j]) continue;
2876 /* Count windows displaying inven */
2877 if (window_flag[j] & (PW_INVEN)) ni++;
2879 /* Count windows displaying equip */
2880 if (window_flag[j] & (PW_EQUIP)) ne++;
2883 /* Toggle if needed */
2884 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2887 toggle_inven_equip();
2893 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2896 /* Inventory screen */
2899 /* Redraw if needed */
2900 if (command_see) get_item_label = show_inven(menu_line, mode);
2903 /* Equipment screen */
2906 /* Redraw if needed */
2907 if (command_see) get_item_label = show_equip(menu_line, mode);
2910 /* Viewing p_ptr->inventory_list */
2913 /* Begin the prompt */
2914 sprintf(out_val, _("持ち物:", "Inven:"));
2916 /* Some legal items */
2917 if ((i1 <= i2) && !use_menu)
2919 /* Build the prompt */
2920 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2921 index_to_label(i1), index_to_label(i2));
2924 strcat(out_val, tmp_val);
2927 /* Indicate ability to "view" */
2928 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2931 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2934 /* Viewing equipment */
2937 /* Begin the prompt */
2938 sprintf(out_val, _("装備品:", "Equip:"));
2940 /* Some legal items */
2941 if ((e1 <= e2) && !use_menu)
2943 /* Build the prompt */
2944 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2945 index_to_label(e1), index_to_label(e2));
2948 strcat(out_val, tmp_val);
2951 /* Indicate ability to "view" */
2952 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2955 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
2958 /* Indicate legality of the "floor" item */
2959 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
2960 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
2962 /* Finish the prompt */
2963 strcat(out_val, " ESC");
2965 /* Build the prompt */
2966 sprintf(tmp_val, "(%s) %s", out_val, pmt);
2968 /* Show the prompt */
2976 int max_line = (command_wrk ? max_equip : max_inven);
2992 menu_line += (max_line - 1);
3011 /* Verify legality */
3012 if (!inven || !equip)
3018 /* Hack -- Fix screen */
3025 /* Switch inven/equip */
3026 command_wrk = !command_wrk;
3027 max_line = (command_wrk ? max_equip : max_inven);
3028 if (menu_line > max_line) menu_line = max_line;
3030 /* Need to redraw */
3039 if (command_wrk == USE_FLOOR)
3042 (*cp) = -get_item_label;
3046 /* Validate the item */
3047 if (!get_item_okay(get_item_label))
3053 /* Allow player to "refuse" certain actions */
3054 if (!get_item_allow(get_item_label))
3060 /* Accept that choice */
3061 (*cp) = get_item_label;
3070 if (mode & USE_FORCE) {
3078 if (menu_line > max_line) menu_line -= max_line;
3099 command_see = FALSE;
3116 /* Verify legality */
3117 if (!inven || !equip)
3123 /* Hack -- Fix screen */
3130 /* Switch inven/equip */
3131 command_wrk = !command_wrk;
3133 /* Need to redraw */
3139 /* Use floor item */
3142 /* Scan all objects in the grid */
3143 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)
3146 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3147 next_o_idx = o_ptr->next_o_idx;
3149 /* Validate the item */
3150 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3155 /* Verify the item (if required) */
3156 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3158 /* Allow player to "refuse" certain actions */
3159 if (!get_item_allow(k)) continue;
3161 /* Accept that choice */
3177 case '1': case '2': case '3':
3178 case '4': case '5': case '6':
3179 case '7': case '8': case '9':
3181 /* Look up the tag */
3182 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3188 /* Hack -- Validate the item */
3189 if ((k < INVEN_RARM) ? !inven : !equip)
3195 /* Validate the item */
3196 if (!get_item_okay(k))
3202 /* Allow player to "refuse" certain actions */
3203 if (!get_item_allow(k))
3209 /* Accept that choice */
3221 /* Choose "default" p_ptr->inventory_list item */
3224 k = ((i1 == i2) ? i1 : -1);
3227 /* Choose "default" equipment item */
3230 k = ((e1 == e2) ? e1 : -1);
3233 /* Validate the item */
3234 if (!get_item_okay(k))
3240 /* Allow player to "refuse" certain actions */
3241 if (!get_item_allow(k))
3247 /* Accept that choice */
3257 if (mode & USE_FORCE) {
3270 bool not_found = FALSE;
3272 /* Look up the alphabetical tag */
3273 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3278 /* Hack -- Validate the item */
3279 else if ((k < INVEN_RARM) ? !inven : !equip)
3284 /* Validate the item */
3285 else if (!get_item_okay(k))
3292 /* Accept that choice */
3300 /* Extract "query" setting */
3301 ver = isupper(which);
3302 which = (char)tolower(which);
3304 /* Convert letter to p_ptr->inventory_list index */
3307 if (which == '(') k = i1;
3308 else if (which == ')') k = i2;
3309 else k = label_to_inven(which);
3312 /* Convert letter to equipment index */
3315 if (which == '(') k = e1;
3316 else if (which == ')') k = e2;
3317 else k = label_to_equip(which);
3320 /* Validate the item */
3321 if (!get_item_okay(k))
3327 /* Verify the item */
3328 if (ver && !verify(_("本当に", "Try"), k))
3334 /* Allow player to "refuse" certain actions */
3335 if (!get_item_allow(k))
3341 /* Accept that choice */
3352 /* Fix the screen if necessary */
3357 /* Hack -- Cancel "display" */
3358 command_see = FALSE;
3362 /* Forget the item_tester_tval restriction */
3363 item_tester_tval = 0;
3365 /* Forget the item_tester_hook restriction */
3366 item_tester_hook = NULL;
3369 /* Clean up 'show choices' */
3370 /* Toggle again if needed */
3371 if (toggle) toggle_inven_equip();
3373 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3376 /* Clear the prompt line */
3379 /* Warning if needed */
3380 if (oops && str) msg_print(str);
3385 if (command_cmd) prev_tag = cur_tag;
3386 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3392 * Choose an item and get auto-picker entry from it.
3394 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3397 if (!get_item(&item, q, s, option)) return NULL;
3398 if (idx) *idx = item;
3400 if (item == INVEN_FORCE) return NULL;
3402 /* Get the item (in the pack) */
3403 else if (item >= 0) return &p_ptr->inventory_list[item];
3405 /* Get the item (on the floor) */
3406 else return ¤t_floor_ptr->o_list[0 - item];
3411 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3412 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3413 * @param y 走査するフロアのY座標
3414 * @param x 走査するフロアのX座標
3415 * @param mode オプションフラグ
3416 * @return 対象のマスに落ちているアイテム数
3418 * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
3419 * location. Valid flags are:
3421 * mode & 0x01 -- Item tester
3422 * mode & 0x02 -- Marked items only
3423 * mode & 0x04 -- Stop after first
3425 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3427 OBJECT_IDX this_o_idx, next_o_idx;
3429 ITEM_NUMBER num = 0;
3432 if (!in_bounds(y, x)) return 0;
3434 /* Scan all objects in the grid */
3435 for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3438 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3439 next_o_idx = o_ptr->next_o_idx;
3442 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3445 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3447 /* Accept this item */
3448 /* XXX Hack -- Enforce limit */
3450 items[num] = this_o_idx;
3455 if (mode & 0x04) break;
3462 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3463 * @param target_item カーソルの初期値
3464 * @param y 走査するフロアのY座標
3465 * @param x 走査するフロアのX座標
3466 * @param min_width 表示の長さ
3467 * @return 選択したアイテムの添え字
3470 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3478 GAME_TEXT o_name[MAX_NLEN];
3481 COMMAND_CODE out_index[23];
3482 TERM_COLOR out_color[23];
3483 char out_desc[23][MAX_NLEN];
3484 COMMAND_CODE target_item_label = 0;
3486 OBJECT_IDX floor_list[23];
3487 ITEM_NUMBER floor_num;
3489 char floor_label[52 + 1];
3491 bool dont_need_to_show_weights = TRUE;
3493 Term_get_size(&wid, &hgt);
3495 /* Default length */
3496 len = MAX((*min_width), 20);
3498 /* Scan for objects in the grid, using item_tester_okay() */
3499 floor_num = scan_floor(floor_list, y, x, 0x03);
3501 /* Display the floor objects */
3502 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3504 o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
3506 object_desc(o_name, o_ptr, 0);
3508 /* Save the index */
3511 /* Acquire p_ptr->inventory_list color */
3512 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3514 /* Save the object description */
3515 strcpy(out_desc[k], o_name);
3517 /* Find the predicted "line length" */
3518 l = strlen(out_desc[k]) + 5;
3520 /* Be sure to account for the weight */
3521 if (show_weights) l += 9;
3523 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3525 /* Maintain the maximum length */
3526 if (l > len) len = l;
3528 /* Advance to next "line" */
3532 if (show_weights && dont_need_to_show_weights) len -= 9;
3537 /* Find the column to start in */
3538 col = (len > wid - 4) ? 0 : (wid - len - 1);
3540 prepare_label_string_floor(floor_label, floor_list, floor_num);
3542 /* Output each entry */
3543 for (j = 0; j < k; j++)
3545 m = floor_list[out_index[j]];
3546 o_ptr = ¤t_floor_ptr->o_list[m];
3548 /* Clear the line */
3549 prt("", j + 1, col ? col - 2 : col);
3551 if (use_menu && target_item)
3553 if (j == (target_item-1))
3555 strcpy(tmp_val, _("》", "> "));
3556 target_item_label = m;
3558 else strcpy(tmp_val, " ");
3562 /* Prepare an index --(-- */
3563 sprintf(tmp_val, "%c)", floor_label[j]);
3566 /* Clear the line with the (possibly indented) index */
3567 put_str(tmp_val, j + 1, col);
3569 /* Display the entry itself */
3570 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3572 /* Display the weight if needed */
3573 if (show_weights && (o_ptr->tval != TV_GOLD))
3575 int wgt = o_ptr->weight * o_ptr->number;
3577 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3579 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3582 prt(tmp_val, j + 1, wid - 9);
3586 /* Make a "shadow" below the list (only if needed) */
3587 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3589 return target_item_label;
3593 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3594 * Let the user select an item, save its "index"
3595 * @param cp 選択したオブジェクトのIDを返す。
3596 * @param pmt 選択目的のメッセージ
3597 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3598 * @param mode オプションフラグ
3599 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3601 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3603 char n1 = ' ', n2 = ' ', which = ' ';
3606 COMMAND_CODE i1, i2;
3607 COMMAND_CODE e1, e2;
3615 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3616 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3617 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3618 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3620 bool allow_equip = FALSE;
3621 bool allow_inven = FALSE;
3622 bool allow_floor = FALSE;
3624 bool toggle = FALSE;
3629 ITEM_NUMBER floor_num;
3630 OBJECT_IDX floor_list[23];
3632 TERM_LEN min_width = 0;
3634 int menu_line = (use_menu ? 1 : 0);
3638 static char prev_tag = '\0';
3639 char cur_tag = '\0';
3641 /* Get the item index */
3642 if (repeat_pull(cp))
3645 if (force && (*cp == INVEN_FORCE))
3647 item_tester_tval = 0;
3648 item_tester_hook = NULL;
3649 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3654 else if (floor && (*cp < 0))
3656 if (prev_tag && command_cmd)
3658 /* Scan all objects in the grid */
3659 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3661 /* Look up the tag */
3662 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3664 /* Accept that choice */
3665 (*cp) = 0 - floor_list[k];
3667 /* Forget restrictions */
3668 item_tester_tval = 0;
3669 item_tester_hook = NULL;
3670 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3676 prev_tag = '\0'; /* prev_tag is no longer effective */
3679 /* Validate the item */
3680 else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
3682 /* Forget restrictions */
3683 item_tester_tval = 0;
3684 item_tester_hook = NULL;
3685 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3692 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3693 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3695 if (prev_tag && command_cmd)
3697 /* Look up the tag and validate the item */
3698 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3699 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3700 else if (!get_item_okay(k)) /* Reject */;
3703 /* Accept that choice */
3706 /* Forget restrictions */
3707 item_tester_tval = 0;
3708 item_tester_hook = NULL;
3709 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3715 prev_tag = '\0'; /* prev_tag is no longer effective */
3718 /* Verify the item */
3719 else if (get_item_okay(*cp))
3721 /* Forget restrictions */
3722 item_tester_tval = 0;
3723 item_tester_hook = NULL;
3724 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3738 /* No item selected */
3742 /* Full p_ptr->inventory_list */
3744 i2 = INVEN_PACK - 1;
3746 /* Forbid p_ptr->inventory_list */
3747 if (!inven) i2 = -1;
3750 for (j = 0; j < INVEN_PACK; j++)
3751 if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
3754 /* Restrict p_ptr->inventory_list indexes */
3755 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3756 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3759 /* Full equipment */
3761 e2 = INVEN_TOTAL - 1;
3763 /* Forbid equipment */
3764 if (!equip) e2 = -1;
3767 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3768 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
3769 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3772 /* Restrict equipment indexes */
3773 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3774 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3776 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3780 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3782 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3786 /* Count "okay" floor items */
3789 /* Restrict floor usage */
3792 /* Scan all objects in the grid */
3793 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3796 /* Accept p_ptr->inventory_list */
3797 if (i1 <= i2) allow_inven = TRUE;
3799 /* Accept equipment */
3800 if (e1 <= e2) allow_equip = TRUE;
3803 if (floor_num) allow_floor = TRUE;
3805 /* Require at least one legal choice */
3806 if (!allow_inven && !allow_equip && !allow_floor)
3808 /* Cancel p_ptr->command_see */
3809 command_see = FALSE;
3819 /* Analyze choices */
3822 /* Hack -- Start on equipment if requested */
3823 if (command_see && (command_wrk == (USE_EQUIP))
3826 command_wrk = (USE_EQUIP);
3829 /* Use p_ptr->inventory_list if allowed */
3830 else if (allow_inven)
3832 command_wrk = (USE_INVEN);
3835 /* Use equipment if allowed */
3836 else if (allow_equip)
3838 command_wrk = (USE_EQUIP);
3841 /* Use floor if allowed */
3842 else if (allow_floor)
3844 command_wrk = (USE_FLOOR);
3849 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3851 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3853 /* Hack -- start out in "display" mode */
3859 /* Repeat until done */
3862 COMMAND_CODE get_item_label = 0;
3869 for (j = 0; j < 8; j++)
3872 if (!angband_term[j]) continue;
3874 /* Count windows displaying inven */
3875 if (window_flag[j] & (PW_INVEN)) ni++;
3877 /* Count windows displaying equip */
3878 if (window_flag[j] & (PW_EQUIP)) ne++;
3881 /* Toggle if needed */
3882 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3883 (command_wrk == (USE_INVEN) && !ni && ne))
3886 toggle_inven_equip();
3892 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3895 /* Inventory screen */
3896 if (command_wrk == (USE_INVEN))
3898 /* Extract the legal requests */
3902 /* Redraw if needed */
3903 if (command_see) get_item_label = show_inven(menu_line, mode);
3906 /* Equipment screen */
3907 else if (command_wrk == (USE_EQUIP))
3909 /* Extract the legal requests */
3910 n1 = I2A(e1 - INVEN_RARM);
3911 n2 = I2A(e2 - INVEN_RARM);
3913 /* Redraw if needed */
3914 if (command_see) get_item_label = show_equip(menu_line, mode);
3918 else if (command_wrk == (USE_FLOOR))
3921 k = MIN(floor_top + 23, floor_num) - 1;
3923 /* Extract the legal requests */
3924 n1 = I2A(j - floor_top);
3925 n2 = I2A(k - floor_top);
3927 /* Redraw if needed */
3928 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3931 /* Viewing p_ptr->inventory_list */
3932 if (command_wrk == (USE_INVEN))
3934 /* Begin the prompt */
3935 sprintf(out_val, _("持ち物:", "Inven:"));
3939 /* Build the prompt */
3940 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3941 index_to_label(i1), index_to_label(i2));
3944 strcat(out_val, tmp_val);
3947 /* Indicate ability to "view" */
3948 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3954 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
3955 else if (allow_floor)
3956 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
3958 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
3965 strcat(out_val, _(" '-'床上,", " - for floor,"));
3966 else if (allow_equip)
3967 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
3969 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
3973 /* Viewing equipment */
3974 else if (command_wrk == (USE_EQUIP))
3976 /* Begin the prompt */
3977 sprintf(out_val, _("装備品:", "Equip:"));
3981 /* Build the prompt */
3982 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3983 index_to_label(e1), index_to_label(e2));
3986 strcat(out_val, tmp_val);
3989 /* Indicate ability to "view" */
3990 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3996 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
3997 else if (allow_floor)
3998 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
4000 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4007 strcat(out_val, _(" '-'床上,", " - for floor,"));
4008 else if (allow_inven)
4009 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4011 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4016 else if (command_wrk == (USE_FLOOR))
4018 /* Begin the prompt */
4019 sprintf(out_val, _("床上:", "Floor:"));
4023 /* Build the prompt */
4024 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4027 strcat(out_val, tmp_val);
4030 /* Indicate ability to "view" */
4031 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4035 if (allow_inven && allow_equip)
4037 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4039 else if (allow_inven)
4041 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4043 else if (allow_equip)
4045 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4049 else if (allow_inven)
4051 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4053 else if (allow_equip)
4055 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4059 if (command_see && !use_menu)
4061 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4066 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4068 /* Finish the prompt */
4069 strcat(out_val, " ESC");
4071 /* Build the prompt */
4072 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4074 /* Show the prompt */
4083 if (command_wrk == USE_INVEN) max_line = max_inven;
4084 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4085 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4101 menu_line += (max_line - 1);
4117 /* Verify legality */
4118 if (command_wrk == (USE_INVEN))
4120 if (allow_floor) command_wrk = USE_FLOOR;
4121 else if (allow_equip) command_wrk = USE_EQUIP;
4128 else if (command_wrk == (USE_EQUIP))
4130 if (allow_inven) command_wrk = USE_INVEN;
4131 else if (allow_floor) command_wrk = USE_FLOOR;
4138 else if (command_wrk == (USE_FLOOR))
4140 if (allow_equip) command_wrk = USE_EQUIP;
4141 else if (allow_inven) command_wrk = USE_INVEN;
4154 /* Hack -- Fix screen */
4161 /* Switch inven/equip */
4162 if (command_wrk == USE_INVEN) max_line = max_inven;
4163 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4164 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4165 if (menu_line > max_line) menu_line = max_line;
4167 /* Need to redraw */
4175 /* Verify legality */
4176 if (command_wrk == (USE_INVEN))
4178 if (allow_equip) command_wrk = USE_EQUIP;
4179 else if (allow_floor) command_wrk = USE_FLOOR;
4186 else if (command_wrk == (USE_EQUIP))
4188 if (allow_floor) command_wrk = USE_FLOOR;
4189 else if (allow_inven) command_wrk = USE_INVEN;
4196 else if (command_wrk == (USE_FLOOR))
4198 if (allow_inven) command_wrk = USE_INVEN;
4199 else if (allow_equip) command_wrk = USE_EQUIP;
4212 /* Hack -- Fix screen */
4219 /* Switch inven/equip */
4220 if (command_wrk == USE_INVEN) max_line = max_inven;
4221 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4222 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4223 if (menu_line > max_line) menu_line = max_line;
4225 /* Need to redraw */
4234 if (command_wrk == USE_FLOOR)
4237 (*cp) = -get_item_label;
4241 /* Validate the item */
4242 if (!get_item_okay(get_item_label))
4248 /* Allow player to "refuse" certain actions */
4249 if (!get_item_allow(get_item_label))
4255 /* Accept that choice */
4256 (*cp) = get_item_label;
4273 if (menu_line > max_line) menu_line -= max_line;
4294 command_see = FALSE;
4315 grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
4317 if (command_wrk != (USE_FLOOR)) break;
4319 /* Get the object being moved. */
4320 o_idx = g_ptr->o_idx;
4322 /* Only rotate a pile of two or more objects. */
4323 if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
4325 /* Remove the first object from the list. */
4326 excise_object_idx(o_idx);
4328 /* Find end of the list. */
4330 while (current_floor_ptr->o_list[i].next_o_idx)
4331 i = current_floor_ptr->o_list[i].next_o_idx;
4333 /* Add after the last object. */
4334 current_floor_ptr->o_list[i].next_o_idx = o_idx;
4336 /* Re-scan floor list */
4337 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4339 /* Hack -- Fix screen */
4351 if (command_wrk == (USE_INVEN))
4358 command_wrk = (USE_EQUIP);
4360 else if (command_wrk == (USE_EQUIP))
4367 command_wrk = (USE_INVEN);
4369 else if (command_wrk == (USE_FLOOR))
4373 command_wrk = (USE_INVEN);
4375 else if (allow_equip)
4377 command_wrk = (USE_EQUIP);
4386 /* Hack -- Fix screen */
4393 /* Need to redraw */
4406 * If we are already examining the floor, and there
4407 * is only one item, we will always select it.
4408 * If we aren't examining the floor and there is only
4409 * one item, we will select it if floor_query_flag
4414 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4417 k = 0 - floor_list[0];
4419 /* Allow player to "refuse" certain actions */
4420 if (!get_item_allow(k))
4426 /* Accept that choice */
4435 /* Hack -- Fix screen */
4442 command_wrk = (USE_FLOOR);
4448 case '1': case '2': case '3':
4449 case '4': case '5': case '6':
4450 case '7': case '8': case '9':
4452 if (command_wrk != USE_FLOOR)
4454 /* Look up the tag */
4455 if (!get_tag(&k, which, command_wrk))
4461 /* Hack -- Validate the item */
4462 if ((k < INVEN_RARM) ? !inven : !equip)
4468 /* Validate the item */
4469 if (!get_item_okay(k))
4477 /* Look up the alphabetical tag */
4478 if (get_tag_floor(&k, which, floor_list, floor_num))
4481 k = 0 - floor_list[k];
4490 /* Allow player to "refuse" certain actions */
4491 if (!get_item_allow(k))
4497 /* Accept that choice */
4509 /* Choose "default" p_ptr->inventory_list item */
4510 if (command_wrk == (USE_INVEN))
4512 k = ((i1 == i2) ? i1 : -1);
4515 /* Choose "default" equipment item */
4516 else if (command_wrk == (USE_EQUIP))
4518 k = ((e1 == e2) ? e1 : -1);
4521 /* Choose "default" floor item */
4522 else if (command_wrk == (USE_FLOOR))
4527 k = 0 - floor_list[0];
4529 /* Allow player to "refuse" certain actions */
4530 if (!get_item_allow(k))
4536 /* Accept that choice */
4544 /* Validate the item */
4545 if (!get_item_okay(k))
4551 /* Allow player to "refuse" certain actions */
4552 if (!get_item_allow(k))
4558 /* Accept that choice */
4582 if (command_wrk != USE_FLOOR)
4584 bool not_found = FALSE;
4586 /* Look up the alphabetical tag */
4587 if (!get_tag(&k, which, command_wrk))
4592 /* Hack -- Validate the item */
4593 else if ((k < INVEN_RARM) ? !inven : !equip)
4598 /* Validate the item */
4599 else if (!get_item_okay(k))
4606 /* Accept that choice */
4616 /* Look up the alphabetical tag */
4617 if (get_tag_floor(&k, which, floor_list, floor_num))
4620 k = 0 - floor_list[k];
4622 /* Accept that choice */
4631 /* Extract "query" setting */
4632 ver = isupper(which);
4633 which = (char)tolower(which);
4635 /* Convert letter to p_ptr->inventory_list index */
4636 if (command_wrk == (USE_INVEN))
4638 if (which == '(') k = i1;
4639 else if (which == ')') k = i2;
4640 else k = label_to_inven(which);
4643 /* Convert letter to equipment index */
4644 else if (command_wrk == (USE_EQUIP))
4646 if (which == '(') k = e1;
4647 else if (which == ')') k = e2;
4648 else k = label_to_equip(which);
4651 /* Convert letter to floor index */
4652 else if (command_wrk == USE_FLOOR)
4654 if (which == '(') k = 0;
4655 else if (which == ')') k = floor_num - 1;
4656 else k = islower(which) ? A2I(which) : -1;
4657 if (k < 0 || k >= floor_num || k >= 23)
4664 k = 0 - floor_list[k];
4667 /* Validate the item */
4668 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4674 /* Verify the item */
4675 if (ver && !verify(_("本当に", "Try"), k))
4681 /* Allow player to "refuse" certain actions */
4682 if (!get_item_allow(k))
4688 /* Accept that choice */
4698 /* Fix the screen if necessary */
4703 /* Hack -- Cancel "display" */
4704 command_see = FALSE;
4708 /* Forget the item_tester_tval restriction */
4709 item_tester_tval = 0;
4711 /* Forget the item_tester_hook restriction */
4712 item_tester_hook = NULL;
4715 /* Clean up 'show choices' */
4716 /* Toggle again if needed */
4717 if (toggle) toggle_inven_equip();
4719 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4722 /* Clear the prompt line */
4725 /* Warning if needed */
4726 if (oops && str) msg_print(str);
4731 if (command_cmd) prev_tag = cur_tag;
4732 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4738 * @brief 床上のアイテムを拾う選択用サブルーチン
4739 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4741 static bool py_pickup_floor_aux(void)
4743 OBJECT_IDX this_o_idx;
4747 /* Restrict the choices */
4748 item_tester_hook = inven_carry_okay;
4751 q = _("どれを拾いますか?", "Get which item? ");
4752 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4754 if (choose_object(&item, q, s, (USE_FLOOR)))
4756 this_o_idx = 0 - item;
4763 /* Pick up the object */
4764 py_pickup_aux(this_o_idx);
4770 * @brief 床上のアイテムを拾うメイン処理
4771 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4774 * This is called by py_pickup() when easy_floor is TRUE.
4776 void py_pickup_floor(bool pickup)
4778 OBJECT_IDX this_o_idx, next_o_idx = 0;
4780 GAME_TEXT o_name[MAX_NLEN];
4784 OBJECT_IDX floor_o_idx = 0;
4788 /* Scan the pile of objects */
4789 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)
4791 /* Access the object */
4792 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
4794 object_desc(o_name, o_ptr, 0);
4796 /* Access the next object */
4797 next_o_idx = o_ptr->next_o_idx;
4799 disturb(FALSE, FALSE);
4802 if (o_ptr->tval == TV_GOLD)
4805 msg_format(" $%ld の価値がある%sを見つけた。",
4806 (long)o_ptr->pval, o_name);
4808 msg_format("You have found %ld gold pieces worth of %s.",
4809 (long)o_ptr->pval, o_name);
4812 /* Collect the gold */
4813 p_ptr->au += o_ptr->pval;
4816 p_ptr->redraw |= (PR_GOLD);
4818 p_ptr->window |= (PW_PLAYER);
4820 /* Delete the gold */
4821 delete_object_idx(this_o_idx);
4823 /* Check the next object */
4826 else if (o_ptr->marked & OM_NOMSG)
4828 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4829 * ignored. Otherwise, they are included in the prompt. */
4830 o_ptr->marked &= ~(OM_NOMSG);
4834 /* Count non-gold objects that can be picked up. */
4835 if (inven_carry_okay(o_ptr))
4840 /* Count non-gold objects */
4843 /* Remember this index */
4844 floor_o_idx = this_o_idx;
4847 /* There are no non-gold objects */
4851 /* Mention the number of objects */
4857 /* Access the object */
4858 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4860 #ifdef ALLOW_EASY_SENSE
4862 /* Option: Make object sensing easy */
4865 /* Sense the object */
4866 (void) sense_object(o_ptr);
4869 #endif /* ALLOW_EASY_SENSE */
4871 object_desc(o_name, o_ptr, 0);
4873 msg_format(_("%sがある。", "You see %s."), o_name);
4876 /* Multiple objects */
4879 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4885 /* The player has no room for anything on the floor. */
4891 /* Access the object */
4892 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4894 #ifdef ALLOW_EASY_SENSE
4896 /* Option: Make object sensing easy */
4899 /* Sense the object */
4900 (void) sense_object(o_ptr);
4903 #endif /* ALLOW_EASY_SENSE */
4905 object_desc(o_name, o_ptr, 0);
4907 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4910 /* Multiple objects */
4913 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4923 /* Hack -- query every object */
4924 if (carry_query_flag)
4926 char out_val[MAX_NLEN+20];
4928 /* Access the object */
4929 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4931 #ifdef ALLOW_EASY_SENSE
4933 /* Option: Make object sensing easy */
4936 /* Sense the object */
4937 (void) sense_object(o_ptr);
4940 #endif /* ALLOW_EASY_SENSE */
4942 object_desc(o_name, o_ptr, 0);
4944 /* Build a prompt */
4945 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
4947 /* Ask the user to confirm */
4948 if (!get_check(out_val))
4954 /* Access the object */
4955 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4957 #ifdef ALLOW_EASY_SENSE
4959 /* Option: Make object sensing easy */
4962 /* Sense the object */
4963 (void) sense_object(o_ptr);
4966 #endif /* ALLOW_EASY_SENSE */
4968 /* Pick up the object */
4969 py_pickup_aux(floor_o_idx);
4972 /* Allow the user to choose an object */
4975 while (can_pickup--)
4977 if (!py_pickup_floor_aux()) break;
4984 * @brief 矢弾を射撃した場合の破損確率を返す /
4985 * Determines the odds of an object breaking when thrown at a monster
4986 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
4989 * Note that artifacts never break, see the "drop_near()" function.
4991 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
4993 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
4995 /* Examine the snipe type */
4998 if (snipe_type == SP_KILL_WALL) return (100);
4999 if (snipe_type == SP_EXPLODE) return (100);
5000 if (snipe_type == SP_PIERCE) return (100);
5001 if (snipe_type == SP_FINAL) return (100);
5002 if (snipe_type == SP_NEEDLE) return (100);
5003 if (snipe_type == SP_EVILNESS) return (40);
5004 if (snipe_type == SP_HOLYNESS) return (40);
5007 /* Examine the item type */
5008 switch (o_ptr->tval)
5024 /* Sometimes break */
5029 return (20 - archer_bonus * 2);
5034 return (10 - archer_bonus);