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
16 #include "cmd-activate.h"
17 #include "object-hook.h"
19 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
26 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
28 * This involves resetting various things to their "default" state.\n
30 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
31 * "user pref file" based on the current setting of the "use_graphics"\n
32 * flag. This is useful for switching "graphics" on/off.\n
34 * The features, objects, and monsters, should all be encoded in the\n
35 * relevant "font.pref" and/or "graf.prf" files. \n
37 * The "prefs" parameter is no longer meaningful. \n
39 void reset_visuals(void)
43 /* Extract some info about terrain features */
44 for (i = 0; i < max_f_idx; i++)
46 feature_type *f_ptr = &f_info[i];
48 /* Assume we will use the underlying values */
49 for (j = 0; j < F_LIT_MAX; j++)
51 f_ptr->x_attr[j] = f_ptr->d_attr[j];
52 f_ptr->x_char[j] = f_ptr->d_char[j];
56 /* Extract default attr/char code for objects */
57 for (i = 0; i < max_k_idx; i++)
59 object_kind *k_ptr = &k_info[i];
61 /* Default attr/char */
62 k_ptr->x_attr = k_ptr->d_attr;
63 k_ptr->x_char = k_ptr->d_char;
66 /* Extract default attr/char code for monsters */
67 for (i = 0; i < max_r_idx; i++)
69 monster_race *r_ptr = &r_info[i];
71 /* Default attr/char */
72 r_ptr->x_attr = r_ptr->d_attr;
73 r_ptr->x_char = r_ptr->d_char;
80 /* Process "graf.prf" */
81 process_pref_file("graf.prf");
83 /* Access the "character" pref file */
84 sprintf(buf, "graf-%s.prf", player_base);
86 /* Process "graf-<playername>.prf" */
87 process_pref_file(buf);
95 /* Process "font.prf" */
96 process_pref_file("font.prf");
98 /* Access the "character" pref file */
99 sprintf(buf, "font-%s.prf", player_base);
101 /* Process "font-<playername>.prf" */
102 process_pref_file(buf);
107 * @brief オブジェクトのフラグ類を配列に与える
108 * Obtain the "flags" for an item
109 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
110 * @param flgs フラグ情報を受け取る配列
113 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
115 object_kind *k_ptr = &k_info[o_ptr->k_idx];
119 for (i = 0; i < TR_FLAG_SIZE; i++)
120 flgs[i] = k_ptr->flags[i];
123 if (object_is_fixed_artifact(o_ptr))
125 artifact_type *a_ptr = &a_info[o_ptr->name1];
127 for (i = 0; i < TR_FLAG_SIZE; i++)
128 flgs[i] = a_ptr->flags[i];
132 if (object_is_ego(o_ptr))
134 ego_item_type *e_ptr = &e_info[o_ptr->name2];
136 for (i = 0; i < TR_FLAG_SIZE; i++)
137 flgs[i] |= e_ptr->flags[i];
139 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
141 remove_flag(flgs, TR_SH_FIRE);
143 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
145 remove_flag(flgs, TR_INFRA);
147 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
149 remove_flag(flgs, TR_RES_BLIND);
150 remove_flag(flgs, TR_SEE_INVIS);
154 /* Random artifact ! */
155 for (i = 0; i < TR_FLAG_SIZE; i++)
156 flgs[i] |= o_ptr->art_flags[i];
158 if (object_is_smith(o_ptr))
160 int add = o_ptr->xtra3 - 1;
162 if (add < TR_FLAG_MAX)
166 else if (add == ESSENCE_TMP_RES_ACID)
168 add_flag(flgs, TR_RES_ACID);
169 add_flag(flgs, TR_ACTIVATE);
171 else if (add == ESSENCE_TMP_RES_ELEC)
173 add_flag(flgs, TR_RES_ELEC);
174 add_flag(flgs, TR_ACTIVATE);
176 else if (add == ESSENCE_TMP_RES_FIRE)
178 add_flag(flgs, TR_RES_FIRE);
179 add_flag(flgs, TR_ACTIVATE);
181 else if (add == ESSENCE_TMP_RES_COLD)
183 add_flag(flgs, TR_RES_COLD);
184 add_flag(flgs, TR_ACTIVATE);
186 else if (add == ESSENCE_SH_FIRE)
188 add_flag(flgs, TR_RES_FIRE);
189 add_flag(flgs, TR_SH_FIRE);
191 else if (add == ESSENCE_SH_ELEC)
193 add_flag(flgs, TR_RES_ELEC);
194 add_flag(flgs, TR_SH_ELEC);
196 else if (add == ESSENCE_SH_COLD)
198 add_flag(flgs, TR_RES_COLD);
199 add_flag(flgs, TR_SH_COLD);
201 else if (add == ESSENCE_RESISTANCE)
203 add_flag(flgs, TR_RES_ACID);
204 add_flag(flgs, TR_RES_ELEC);
205 add_flag(flgs, TR_RES_FIRE);
206 add_flag(flgs, TR_RES_COLD);
208 else if (add == TR_IMPACT)
210 add_flag(flgs, TR_ACTIVATE);
216 * @brief オブジェクトの明示されているフラグ類を取得する
217 * Obtain the "flags" for an item which are known to the player
218 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
219 * @param flgs フラグ情報を受け取る配列
222 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
227 object_kind *k_ptr = &k_info[o_ptr->k_idx];
230 for (i = 0; i < TR_FLAG_SIZE; i++)
233 if (!object_is_aware(o_ptr)) return;
236 for (i = 0; i < TR_FLAG_SIZE; i++)
237 flgs[i] = k_ptr->flags[i];
239 /* Must be identified */
240 if (!object_is_known(o_ptr)) return;
242 /* Ego-item (known basic flags) */
243 if (object_is_ego(o_ptr))
245 ego_item_type *e_ptr = &e_info[o_ptr->name2];
247 for (i = 0; i < TR_FLAG_SIZE; i++)
248 flgs[i] |= e_ptr->flags[i];
250 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
252 remove_flag(flgs, TR_SH_FIRE);
254 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
256 remove_flag(flgs, TR_INFRA);
258 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
260 remove_flag(flgs, TR_RES_BLIND);
261 remove_flag(flgs, TR_SEE_INVIS);
266 #ifdef SPOIL_ARTIFACTS
267 /* Full knowledge for some artifacts */
268 if (object_is_artifact(o_ptr)) spoil = TRUE;
269 #endif /* SPOIL_ARTIFACTS */
271 #ifdef SPOIL_EGO_ITEMS
272 /* Full knowledge for some ego-items */
273 if (object_is_ego(o_ptr)) spoil = TRUE;
274 #endif /* SPOIL_EGO_ITEMS */
276 /* Need full knowledge or spoilers */
277 if (spoil || (o_ptr->ident & IDENT_MENTAL))
280 if (object_is_fixed_artifact(o_ptr))
282 artifact_type *a_ptr = &a_info[o_ptr->name1];
284 for (i = 0; i < TR_FLAG_SIZE; i++)
285 flgs[i] = a_ptr->flags[i];
288 /* Random artifact ! */
289 for (i = 0; i < TR_FLAG_SIZE; i++)
290 flgs[i] |= o_ptr->art_flags[i];
293 if (object_is_smith(o_ptr))
295 int add = o_ptr->xtra3 - 1;
297 if (add < TR_FLAG_MAX)
301 else if (add == ESSENCE_TMP_RES_ACID)
303 add_flag(flgs, TR_RES_ACID);
305 else if (add == ESSENCE_TMP_RES_ELEC)
307 add_flag(flgs, TR_RES_ELEC);
309 else if (add == ESSENCE_TMP_RES_FIRE)
311 add_flag(flgs, TR_RES_FIRE);
313 else if (add == ESSENCE_TMP_RES_COLD)
315 add_flag(flgs, TR_RES_COLD);
317 else if (add == ESSENCE_SH_FIRE)
319 add_flag(flgs, TR_RES_FIRE);
320 add_flag(flgs, TR_SH_FIRE);
322 else if (add == ESSENCE_SH_ELEC)
324 add_flag(flgs, TR_RES_ELEC);
325 add_flag(flgs, TR_SH_ELEC);
327 else if (add == ESSENCE_SH_COLD)
329 add_flag(flgs, TR_RES_COLD);
330 add_flag(flgs, TR_SH_COLD);
332 else if (add == ESSENCE_RESISTANCE)
334 add_flag(flgs, TR_RES_ACID);
335 add_flag(flgs, TR_RES_ELEC);
336 add_flag(flgs, TR_RES_FIRE);
337 add_flag(flgs, TR_RES_COLD);
343 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
344 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
345 * @return concptr 発動名称を返す文字列ポインタ
347 static concptr item_activation_dragon_breath(object_type *o_ptr)
349 static char desc[256];
350 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
353 object_flags(o_ptr, flgs);
354 strcpy(desc, _("", "breath "));
356 for (i = 0; dragonbreath_info[i].flag != 0; i++)
358 if (have_flag(flgs, dragonbreath_info[i].flag))
360 if (n > 0) strcat(desc, _("、", ", "));
361 strcat(desc, dragonbreath_info[i].name);
366 strcat(desc, _("のブレス(250)", ""));
372 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
373 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
374 * @return concptr 発動名称を返す文字列ポインタ
376 static concptr item_activation_aux(object_type *o_ptr)
378 static char activation_detail[256];
382 const activation_type* const act_ptr = find_activation_info(o_ptr);
384 if (!act_ptr) return _("未定義", "something undefined");
386 desc = act_ptr->desc;
388 /* Overwrite description if it is special */
389 switch (act_ptr->index) {
391 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
392 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
395 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
396 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
399 desc = item_activation_dragon_breath(o_ptr);
402 if (o_ptr->name1 == ART_HYOUSIGI)
403 desc = _("拍子木を打ちならす", "beat wooden clappers");
405 case ACT_RESIST_ACID:
406 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
407 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
409 case ACT_RESIST_FIRE:
410 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
411 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
413 case ACT_RESIST_COLD:
414 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
415 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
417 case ACT_RESIST_ELEC:
418 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
419 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
421 case ACT_RESIST_POIS:
422 if (o_ptr->name2 == EGO_BRAND_POIS)
423 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
427 /* Timeout description */
428 constant = act_ptr->timeout.constant;
429 dice = act_ptr->timeout.dice;
430 if (constant == 0 && dice == 0) {
431 /* We can activate it every turn */
432 strcpy(timeout, _("いつでも", "every turn"));
433 } else if (constant < 0) {
434 /* Activations that have special timeout */
435 switch (act_ptr->index) {
437 sprintf(timeout, _("%d ターン毎", "every %d turns"),
438 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
441 sprintf(timeout, _("%d ターン毎", "every %d turns"),
442 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
445 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
448 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
451 strcpy(timeout, "undefined");
455 /* Normal timeout activations */
456 char constant_str[16], dice_str[16];
457 sprintf(constant_str, "%d", constant);
458 sprintf(dice_str, "d%d", dice);
459 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
460 (constant > 0) ? constant_str : "",
461 (constant > 0 && dice > 0) ? "+" : "",
462 (dice > 0) ? dice_str : "");
465 /* Build detail activate description */
466 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
468 return activation_detail;
472 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
473 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
474 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
475 * @return concptr 発動名称を返す文字列ポインタ
477 concptr item_activation(object_type *o_ptr)
479 BIT_FLAGS flgs[TR_FLAG_SIZE];
480 object_flags(o_ptr, flgs);
482 /* Require activation ability */
483 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
485 /* Get an explain of an activation */
486 if (activation_index(o_ptr))
488 return item_activation_aux(o_ptr);
492 if (o_ptr->tval == TV_WHISTLE)
494 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
497 if (o_ptr->tval == TV_CAPTURE)
499 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
502 return _("何も起きない", "Nothing");
507 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
508 * Describe a "fully identified" item
509 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
510 * @param mode 表示オプション
511 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
513 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
517 BIT_FLAGS flgs[TR_FLAG_SIZE];
521 GAME_TEXT o_name[MAX_NLEN];
526 int trivial_info = 0;
527 object_flags(o_ptr, flgs);
529 /* Extract the description */
531 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
532 (k_text + k_info[o_ptr->k_idx].text),
533 77 - 15, temp, sizeof(temp));
534 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
535 { info[i] = &temp[j]; i++;}
538 if (object_is_equipment(o_ptr))
540 /* Descriptions of a basic equipment is just a flavor */
544 /* Mega-Hack -- describe activation */
545 if (have_flag(flgs, TR_ACTIVATE))
547 info[i++] = _("始動したときの効果...", "It can be activated for...");
548 info[i++] = item_activation(o_ptr);
549 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
552 /* Figurines, a hack */
553 if (o_ptr->tval == TV_FIGURINE)
555 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
558 /* Figurines, a hack */
559 if (o_ptr->name1 == ART_STONEMASK)
561 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you turn into a vampire permanently.");
564 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
566 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
569 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
571 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
572 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
575 if (o_ptr->name2 == EGO_2WEAPON)
577 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
580 if (have_flag(flgs, TR_EASY_SPELL))
582 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
585 if (o_ptr->name2 == EGO_AMU_FOOL)
587 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
590 if (o_ptr->name2 == EGO_RING_THROW)
592 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
595 if (o_ptr->name2 == EGO_AMU_NAIVETY)
597 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
600 if (o_ptr->tval == TV_STATUE)
602 monster_race *r_ptr = &r_info[o_ptr->pval];
604 if (o_ptr->pval == MON_BULLGATES)
605 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
606 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
607 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
609 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
612 /* Hack -- describe lite's */
614 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
617 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
618 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
619 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
620 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
621 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
622 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
624 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
626 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
628 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
632 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
633 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
636 if(rad != 0) info[i++] = desc;
639 if (o_ptr->name2 == EGO_LITE_LONG)
641 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
644 /* And then describe it fully */
646 if (have_flag(flgs, TR_RIDING))
648 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
649 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
652 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
653 /* This information is not important enough */
657 if (have_flag(flgs, TR_STR))
659 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
661 if (have_flag(flgs, TR_INT))
663 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
665 if (have_flag(flgs, TR_WIS))
667 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
669 if (have_flag(flgs, TR_DEX))
671 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
673 if (have_flag(flgs, TR_CON))
675 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
677 if (have_flag(flgs, TR_CHR))
679 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
682 if (have_flag(flgs, TR_MAGIC_MASTERY))
684 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
687 if (have_flag(flgs, TR_STEALTH))
689 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
691 if (have_flag(flgs, TR_SEARCH))
693 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
695 if (have_flag(flgs, TR_INFRA))
697 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
699 if (have_flag(flgs, TR_TUNNEL))
701 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
703 if (have_flag(flgs, TR_SPEED))
705 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
707 if (have_flag(flgs, TR_BLOWS))
709 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
712 if (have_flag(flgs, TR_BRAND_ACID))
714 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
716 if (have_flag(flgs, TR_BRAND_ELEC))
718 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
720 if (have_flag(flgs, TR_BRAND_FIRE))
722 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
724 if (have_flag(flgs, TR_BRAND_COLD))
726 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
729 if (have_flag(flgs, TR_BRAND_POIS))
731 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
734 if (have_flag(flgs, TR_CHAOTIC))
736 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
739 if (have_flag(flgs, TR_VAMPIRIC))
741 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
744 if (have_flag(flgs, TR_IMPACT))
746 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
749 if (have_flag(flgs, TR_VORPAL))
751 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
754 if (have_flag(flgs, TR_KILL_DRAGON))
756 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
758 else if (have_flag(flgs, TR_SLAY_DRAGON))
760 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
763 if (have_flag(flgs, TR_KILL_ORC))
765 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
767 if (have_flag(flgs, TR_SLAY_ORC))
769 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
772 if (have_flag(flgs, TR_KILL_TROLL))
774 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
776 if (have_flag(flgs, TR_SLAY_TROLL))
778 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
781 if (have_flag(flgs, TR_KILL_GIANT))
783 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
785 else if (have_flag(flgs, TR_SLAY_GIANT))
787 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
790 if (have_flag(flgs, TR_KILL_DEMON))
792 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
794 if (have_flag(flgs, TR_SLAY_DEMON))
796 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
799 if (have_flag(flgs, TR_KILL_UNDEAD))
801 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
803 if (have_flag(flgs, TR_SLAY_UNDEAD))
805 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
808 if (have_flag(flgs, TR_KILL_EVIL))
810 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
812 if (have_flag(flgs, TR_SLAY_EVIL))
814 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
817 if (have_flag(flgs, TR_KILL_ANIMAL))
819 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
821 if (have_flag(flgs, TR_SLAY_ANIMAL))
823 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
826 if (have_flag(flgs, TR_KILL_HUMAN))
828 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
830 if (have_flag(flgs, TR_SLAY_HUMAN))
832 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
835 if (have_flag(flgs, TR_FORCE_WEAPON))
837 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
839 if (have_flag(flgs, TR_DEC_MANA))
841 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
843 if (have_flag(flgs, TR_SUST_STR))
845 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
847 if (have_flag(flgs, TR_SUST_INT))
849 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
851 if (have_flag(flgs, TR_SUST_WIS))
853 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
855 if (have_flag(flgs, TR_SUST_DEX))
857 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
859 if (have_flag(flgs, TR_SUST_CON))
861 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
863 if (have_flag(flgs, TR_SUST_CHR))
865 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
868 if (have_flag(flgs, TR_IM_ACID))
870 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
872 if (have_flag(flgs, TR_IM_ELEC))
874 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
876 if (have_flag(flgs, TR_IM_FIRE))
878 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
880 if (have_flag(flgs, TR_IM_COLD))
882 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
885 if (have_flag(flgs, TR_THROW))
887 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
890 if (have_flag(flgs, TR_FREE_ACT))
892 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
894 if (have_flag(flgs, TR_HOLD_EXP))
896 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
898 if (have_flag(flgs, TR_RES_FEAR))
900 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
902 if (have_flag(flgs, TR_RES_ACID))
904 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
906 if (have_flag(flgs, TR_RES_ELEC))
908 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
910 if (have_flag(flgs, TR_RES_FIRE))
912 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
914 if (have_flag(flgs, TR_RES_COLD))
916 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
918 if (have_flag(flgs, TR_RES_POIS))
920 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
923 if (have_flag(flgs, TR_RES_LITE))
925 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
927 if (have_flag(flgs, TR_RES_DARK))
929 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
932 if (have_flag(flgs, TR_RES_BLIND))
934 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
936 if (have_flag(flgs, TR_RES_CONF))
938 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
940 if (have_flag(flgs, TR_RES_SOUND))
942 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
944 if (have_flag(flgs, TR_RES_SHARDS))
946 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
949 if (have_flag(flgs, TR_RES_NETHER))
951 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
953 if (have_flag(flgs, TR_RES_NEXUS))
955 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
957 if (have_flag(flgs, TR_RES_CHAOS))
959 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
961 if (have_flag(flgs, TR_RES_DISEN))
963 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
966 if (have_flag(flgs, TR_LEVITATION))
968 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
971 if (have_flag(flgs, TR_SEE_INVIS))
973 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
975 if (have_flag(flgs, TR_TELEPATHY))
977 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
979 if (have_flag(flgs, TR_ESP_ANIMAL))
981 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
983 if (have_flag(flgs, TR_ESP_UNDEAD))
985 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
987 if (have_flag(flgs, TR_ESP_DEMON))
989 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
991 if (have_flag(flgs, TR_ESP_ORC))
993 info[i++] = _("それはオークを感知する。", "It senses orcs.");
995 if (have_flag(flgs, TR_ESP_TROLL))
997 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
999 if (have_flag(flgs, TR_ESP_GIANT))
1001 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1003 if (have_flag(flgs, TR_ESP_DRAGON))
1005 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1007 if (have_flag(flgs, TR_ESP_HUMAN))
1009 info[i++] = _("それは人間を感知する。", "It senses humans.");
1011 if (have_flag(flgs, TR_ESP_EVIL))
1013 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1015 if (have_flag(flgs, TR_ESP_GOOD))
1017 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1019 if (have_flag(flgs, TR_ESP_NONLIVING))
1021 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1023 if (have_flag(flgs, TR_ESP_UNIQUE))
1025 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1027 if (have_flag(flgs, TR_SLOW_DIGEST))
1029 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1031 if (have_flag(flgs, TR_REGEN))
1033 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1035 if (have_flag(flgs, TR_WARNING))
1037 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1039 if (have_flag(flgs, TR_REFLECT))
1041 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1043 if (have_flag(flgs, TR_SH_FIRE))
1045 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1047 if (have_flag(flgs, TR_SH_ELEC))
1049 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1051 if (have_flag(flgs, TR_SH_COLD))
1053 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1055 if (have_flag(flgs, TR_NO_MAGIC))
1057 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1059 if (have_flag(flgs, TR_NO_TELE))
1061 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1063 if (have_flag(flgs, TR_XTRA_MIGHT))
1065 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1067 if (have_flag(flgs, TR_XTRA_SHOTS))
1069 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1072 if (have_flag(flgs, TR_BLESSED))
1074 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1077 if (object_is_cursed(o_ptr))
1079 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1081 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1083 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1085 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1089 info[i++] = _("それは呪われている。", "It is cursed.");
1092 * It's a trivial infomation since there is
1093 * fake inscription {cursed}
1099 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1101 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1103 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1105 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1107 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1109 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1111 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1113 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1115 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1117 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1119 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1121 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1123 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1125 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1127 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1129 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1131 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1133 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1135 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1137 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1139 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1141 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1143 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1145 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1147 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1149 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1151 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1153 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1155 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1157 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1159 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1161 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1163 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1165 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1167 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1169 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1172 /* Describe about this kind of object instead of THIS fake object */
1173 if (mode & SCROBJ_FAKE_OBJECT)
1175 switch (o_ptr->tval)
1178 switch (o_ptr->sval)
1180 case SV_RING_LORDLY:
1181 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1183 case SV_RING_WARNING:
1184 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1190 switch (o_ptr->sval)
1192 case SV_AMULET_RESISTANCE:
1193 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1194 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1196 case SV_AMULET_THE_MAGI:
1197 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1204 if (have_flag(flgs, TR_IGNORE_ACID) &&
1205 have_flag(flgs, TR_IGNORE_ELEC) &&
1206 have_flag(flgs, TR_IGNORE_FIRE) &&
1207 have_flag(flgs, TR_IGNORE_COLD))
1209 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1213 if (have_flag(flgs, TR_IGNORE_ACID))
1215 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1217 if (have_flag(flgs, TR_IGNORE_ELEC))
1219 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1221 if (have_flag(flgs, TR_IGNORE_FIRE))
1223 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1225 if (have_flag(flgs, TR_IGNORE_COLD))
1227 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1231 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1233 /* No relevant informations */
1234 if (i <= trivial_info) return (FALSE);
1237 Term_get_size(&wid, &hgt);
1239 /* Display Item name */
1240 if (!(mode & SCROBJ_FAKE_OBJECT))
1241 object_desc(o_name, o_ptr, 0);
1243 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1247 /* Erase the screen */
1248 for (k = 1; k < hgt; k++) prt("", k, 13);
1250 /* Label the information */
1251 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1253 monster_race *r_ptr = &r_info[o_ptr->pval];
1254 int namelen = strlen(r_name + r_ptr->name);
1255 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1256 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1257 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1261 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1264 /* We will print on top of the map (column 13) */
1265 for (k = 2, j = 0; j < i; j++)
1268 prt(info[j], k++, 15);
1270 /* Every 20 entries (lines 2 to 21), start over */
1271 if ((k == hgt - 2) && (j+1 < i))
1273 prt(_("-- 続く --", "-- more --"), k, 15);
1275 for (; k > 2; k--) prt("", k, 15);
1280 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1285 /* Gave knowledge */
1292 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1293 * Convert an inventory index into a one character label
1294 * @param i プレイヤーの所持/装備オブジェクトID
1295 * @return 対応するアルファベット
1296 * @details Note that the label does NOT distinguish inven/equip.
1298 char index_to_label(int i)
1300 /* Indexes for "inven" are easy */
1301 if (i < INVEN_RARM) return (I2A(i));
1303 /* Indexes for "equip" are offset */
1304 return (I2A(i - INVEN_RARM));
1308 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1309 * Convert a label into the index of an item in the "inven"
1310 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1311 * @details Note that the label does NOT distinguish inven/equip.
1313 INVENTORY_IDX label_to_inven(int c)
1318 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1320 /* Verify the index */
1321 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1323 /* Empty slots can never be chosen */
1324 if (!inventory[i].k_idx) return (-1);
1326 /* Return the index */
1332 extern bool select_ring_slot;
1336 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1337 * @param i プレイヤーの所持/装備オブジェクトID
1338 * @return 指輪枠ならばTRUEを返す。
1340 static bool is_ring_slot(int i)
1342 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1347 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1348 * Convert a label into the index of a item in the "equip"
1349 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1351 INVENTORY_IDX label_to_equip(int c)
1356 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1358 /* Verify the index */
1359 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1361 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1363 /* Empty slots can never be chosen */
1364 if (!inventory[i].k_idx) return (-1);
1366 /* Return the index */
1373 * @brief オブジェクトの該当装備部位IDを返す /
1374 * Determine which equipment slot (if any) an item likes
1375 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1376 * @return 対応する装備部位ID
1378 s16b wield_slot(object_type *o_ptr)
1380 /* Slot for equipment */
1381 switch (o_ptr->tval)
1388 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1389 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1390 return (INVEN_LARM);
1397 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1398 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1399 return (INVEN_RARM);
1409 /* Use the right hand first */
1410 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1412 /* Use the left hand for swapping (by default) */
1413 return (INVEN_LEFT);
1419 return (INVEN_NECK);
1424 return (INVEN_LITE);
1431 return (INVEN_BODY);
1436 return (INVEN_OUTER);
1442 return (INVEN_HEAD);
1447 return (INVEN_HANDS);
1452 return (INVEN_FEET);
1456 /* No slot available */
1461 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1462 * Return a string mentioning how a given item is carried
1463 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1464 * @return 部位表現の文字列ポインタ
1466 concptr mention_use(int i)
1470 /* Examine the location */
1474 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1476 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1480 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1482 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1485 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1486 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1487 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1488 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1489 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1490 case INVEN_BODY: p = _(" 体", "On body"); break;
1491 case INVEN_OUTER: p = _("体の上", "About body"); break;
1492 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1493 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1494 case INVEN_FEET: p = _(" 足", "On feet"); break;
1495 default: p = _("ザック", "In pack"); break;
1498 /* Return the result */
1504 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1505 * Return a string describing how a given item is being worn.
1506 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1507 * @return 状態表現内容の文字列ポインタ
1509 * Currently, only used for items in the equipment, not inventory.
1511 concptr describe_use(int i)
1518 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1520 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1524 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1526 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1529 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1530 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1531 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1532 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1533 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1534 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1535 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1536 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1537 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1538 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1539 default: p = _("ザックに入っている", "carrying in your pack"); break;
1542 /* Return the result */
1548 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1549 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1550 * @param book_tval ベースアイテムのtval
1551 * @param book_sval ベースアイテムのsval
1552 * @return 使用可能な魔法書ならばTRUEを返す。
1555 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1557 if (book_tval < TV_LIFE_BOOK) return FALSE;
1558 if (p_ptr->pclass == CLASS_SORCERER)
1560 return is_magic(tval2realm(book_tval));
1562 else if (p_ptr->pclass == CLASS_RED_MAGE)
1564 if (is_magic(tval2realm(book_tval)))
1565 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1567 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1571 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1572 * Check an item against the item tester info
1573 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1574 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1576 bool item_tester_okay(object_type *o_ptr)
1578 /* Hack -- allow listing empty slots */
1579 // if (item_tester_full) return (TRUE); // TODO:DELETE
1581 /* Require an item */
1582 if (!o_ptr->k_idx) return (FALSE);
1584 /* Hack -- ignore "gold" */
1585 if (o_ptr->tval == TV_GOLD)
1588 extern bool show_gold_on_floor;
1590 if (!show_gold_on_floor) return (FALSE);
1593 /* Check the tval */
1594 if (item_tester_tval)
1596 /* Is it a spellbook? If so, we need a hack -- TY */
1597 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1598 (item_tester_tval >= TV_LIFE_BOOK))
1599 return check_book_realm(o_ptr->tval, o_ptr->sval);
1601 if (item_tester_tval != o_ptr->tval) return (FALSE);
1604 /* Check the hook */
1605 if (item_tester_hook)
1607 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1616 * @brief 所持アイテム一覧を表示する /
1617 * Choice window "shadow" of the "show_inven()" function
1620 void display_inven(void)
1622 register int i, n, z = 0;
1624 TERM_COLOR attr = TERM_WHITE;
1626 GAME_TEXT o_name[MAX_NLEN];
1629 Term_get_size(&wid, &hgt);
1631 /* Find the "final" slot */
1632 for (i = 0; i < INVEN_PACK; i++)
1634 o_ptr = &inventory[i];
1636 /* Skip non-objects */
1637 if (!o_ptr->k_idx) continue;
1643 /* Display the pack */
1644 for (i = 0; i < z; i++)
1646 /* Examine the item */
1647 o_ptr = &inventory[i];
1649 /* Start with an empty "index" */
1650 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1652 /* Is this item "acceptable"? */
1653 if (item_tester_okay(o_ptr))
1655 /* Prepare an "index" */
1656 tmp_val[0] = index_to_label(i);
1658 /* Bracket the "index" --(-- */
1662 /* Display the index (or blank space) */
1663 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1665 /* Obtain an item description */
1666 object_desc(o_name, o_ptr, 0);
1668 /* Obtain the length of the description */
1672 attr = tval_to_attr[o_ptr->tval % 128];
1674 /* Grey out charging items */
1680 /* Display the entry itself */
1681 Term_putstr(3, i, n, attr, o_name);
1683 /* Erase the rest of the line */
1684 Term_erase(3+n, i, 255);
1686 /* Display the weight if needed */
1689 int wgt = o_ptr->weight * o_ptr->number;
1691 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1693 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1696 prt(tmp_val, i, wid - 9);
1700 /* Erase the rest of the window */
1701 for (i = z; i < hgt; i++)
1703 /* Erase the line */
1704 Term_erase(0, i, 255);
1711 * @brief 装備アイテム一覧を表示する /
1712 * Choice window "shadow" of the "show_equip()" function
1715 void display_equip(void)
1719 TERM_COLOR attr = TERM_WHITE;
1721 GAME_TEXT o_name[MAX_NLEN];
1724 Term_get_size(&wid, &hgt);
1726 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1728 /* Examine the item */
1729 o_ptr = &inventory[i];
1731 /* Start with an empty "index" */
1732 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1734 /* Is this item "acceptable"? */
1735 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1737 /* Prepare an "index" */
1738 tmp_val[0] = index_to_label(i);
1740 /* Bracket the "index" --(-- */
1744 /* Display the index (or blank space) */
1745 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1747 /* Obtain an item description */
1748 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1750 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1755 object_desc(o_name, o_ptr, 0);
1756 attr = tval_to_attr[o_ptr->tval % 128];
1759 /* Obtain the length of the description */
1762 /* Grey out charging items */
1768 /* Display the entry itself */
1769 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1771 /* Erase the rest of the line */
1772 Term_erase(3+n, i - INVEN_RARM, 255);
1774 /* Display the weight (if needed) */
1777 int wgt = o_ptr->weight * o_ptr->number;
1779 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1781 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1784 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1787 /* Display the slot description (if needed) */
1790 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1791 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1795 /* Erase the rest of the window */
1796 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1798 /* Clear that line */
1799 Term_erase(0, i, 255);
1805 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1806 * Find the "first" inventory object with the given "tag".
1807 * @param cp 対応するタグIDを与える参照ポインタ
1808 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1809 * @param mode 所持、装備の切り替え
1810 * @return タグに該当するオブジェクトがあるならTRUEを返す
1812 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1813 * inscription of an object. Alphabetical characters don't work as a\n
1814 * tag in this form.\n
1816 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1817 * and "x" is the "current" command_cmd code.\n
1819 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1822 COMMAND_CODE start, end;
1825 /* Extract index from mode */
1830 end = INVEN_TOTAL - 1;
1835 end = INVEN_PACK - 1;
1842 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1844 /* Check every inventory object */
1845 for (i = start; i <= end; i++)
1847 object_type *o_ptr = &inventory[i];
1849 /* Skip non-objects */
1850 if (!o_ptr->k_idx) continue;
1852 /* Skip empty inscriptions */
1853 if (!o_ptr->inscription) continue;
1855 /* Skip non-choice */
1856 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1859 s = my_strchr(quark_str(o_ptr->inscription), '@');
1861 /* Process all tags */
1864 /* Check the special tags */
1865 if ((s[1] == command_cmd) && (s[2] == tag))
1867 /* Save the actual inventory ID */
1874 /* Find another '@' */
1875 s = my_strchr(s + 1, '@');
1880 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1882 /* Don't allow {@#} with '#' being alphabet */
1883 if (tag < '0' || '9' < tag)
1889 /* Check every object */
1890 for (i = start; i <= end; i++)
1892 object_type *o_ptr = &inventory[i];
1894 /* Skip non-objects */
1895 if (!o_ptr->k_idx) continue;
1897 /* Skip empty inscriptions */
1898 if (!o_ptr->inscription) continue;
1900 /* Skip non-choice */
1901 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1904 s = my_strchr(quark_str(o_ptr->inscription), '@');
1906 /* Process all tags */
1909 /* Check the normal tags */
1912 /* Save the actual inventory ID */
1919 /* Find another '@' */
1920 s = my_strchr(s + 1, '@');
1930 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1931 * Find the "first" inventory object with the given "tag".
1932 * @param cp 対応するタグIDを与える参照ポインタ
1933 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1934 * @param floor_list 床上アイテムの配列
1935 * @param floor_num 床上アイテムの配列ID
1936 * @return タグに該当するオブジェクトがあるならTRUEを返す
1938 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1939 * inscription of an object. Alphabetical characters don't work as a\n
1940 * tag in this form.\n
1942 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1943 * and "x" is the "current" command_cmd code.\n
1945 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1950 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1952 /* Check every object in the grid */
1953 for (i = 0; i < floor_num && i < 23; i++)
1955 object_type *o_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 special tags */
1967 if ((s[1] == command_cmd) && (s[2] == tag))
1969 /* Save the actual floor object ID */
1976 /* Find another '@' */
1977 s = my_strchr(s + 1, '@');
1982 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1984 /* Don't allow {@#} with '#' being alphabet */
1985 if (tag < '0' || '9' < tag)
1991 /* Check every object in the grid */
1992 for (i = 0; i < floor_num && i < 23; i++)
1994 object_type *o_ptr = &o_list[floor_list[i]];
1996 /* Skip empty inscriptions */
1997 if (!o_ptr->inscription) continue;
2000 s = my_strchr(quark_str(o_ptr->inscription), '@');
2002 /* Process all tags */
2005 /* Check the normal tags */
2008 /* Save the floor object ID */
2015 /* Find another '@' */
2016 s = my_strchr(s + 1, '@');
2026 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2027 * Move around label characters with correspond tags
2028 * @param label ラベルリストを取得する文字列参照ポインタ
2029 * @param mode 所持品リストか装備品リストかの切り替え
2032 static void prepare_label_string(char *label, BIT_FLAGS mode)
2034 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2035 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2038 /* Prepare normal labels */
2039 strcpy(label, alphabet_chars);
2041 /* Move each label */
2042 for (i = 0; i < 52; i++)
2045 SYMBOL_CODE c = alphabet_chars[i];
2047 /* Find a tag with this label */
2048 if (get_tag(&index, c, mode))
2050 /* Delete the overwritten label */
2051 if (label[i] == c) label[i] = ' ';
2053 /* Move the label to the place of corresponding tag */
2054 label[index - offset] = c;
2061 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2062 * Move around label characters with correspond tags (floor version)
2063 * @param label ラベルリストを取得する文字列参照ポインタ
2064 * @param floor_list 床上アイテムの配列
2065 * @param floor_num 床上アイテムの配列ID
2070 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2072 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2075 /* Prepare normal labels */
2076 strcpy(label, alphabet_chars);
2078 /* Move each label */
2079 for (i = 0; i < 52; i++)
2082 SYMBOL_CODE c = alphabet_chars[i];
2084 /* Find a tag with this label */
2085 if (get_tag_floor(&index, c, floor_list, floor_num))
2087 /* Delete the overwritten label */
2088 if (label[i] == c) label[i] = ' ';
2090 /* Move the label to the place of corresponding tag */
2098 * @brief 所持アイテムの表示を行う /
2099 * Display the inventory.
2100 * @param target_item アイテムの選択処理を行うか否か。
2101 * @return 選択したアイテムのタグ
2103 * Hack -- do not display "trailing" empty slots
2105 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2109 int col, cur_col, len;
2111 GAME_TEXT o_name[MAX_NLEN];
2113 COMMAND_CODE out_index[23];
2114 TERM_COLOR out_color[23];
2115 char out_desc[23][MAX_NLEN];
2116 COMMAND_CODE target_item_label = 0;
2118 char inven_label[52 + 1];
2120 /* Starting column */
2123 Term_get_size(&wid, &hgt);
2125 /* Default "max-length" */
2126 len = wid - col - 1;
2129 /* Find the "final" slot */
2130 for (i = 0; i < INVEN_PACK; i++)
2132 o_ptr = &inventory[i];
2134 /* Skip non-objects */
2135 if (!o_ptr->k_idx) continue;
2141 prepare_label_string(inven_label, USE_INVEN);
2143 /* Display the inventory */
2144 for (k = 0, i = 0; i < z; i++)
2146 o_ptr = &inventory[i];
2148 /* Is this item acceptable? */
2149 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2151 object_desc(o_name, o_ptr, 0);
2153 /* Save the object index, color, and description */
2155 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2157 /* Grey out charging items */
2160 out_color[k] = TERM_L_DARK;
2163 (void)strcpy(out_desc[k], o_name);
2165 /* Find the predicted "line length" */
2166 l = strlen(out_desc[k]) + 5;
2168 /* Be sure to account for the weight */
2169 if (show_weights) l += 9;
2171 /* Account for icon if displayed */
2172 if (show_item_graph)
2175 if (use_bigtile) l++;
2178 /* Maintain the maximum length */
2179 if (l > len) len = l;
2181 /* Advance to next "line" */
2185 /* Find the column to start in */
2186 col = (len > wid - 4) ? 0 : (wid - len - 1);
2188 /* Output each entry */
2189 for (j = 0; j < k; j++)
2194 o_ptr = &inventory[i];
2196 /* Clear the line */
2197 prt("", j + 1, col ? col - 2 : col);
2199 if (use_menu && target_item)
2201 if (j == (target_item-1))
2203 strcpy(tmp_val, _("》", "> "));
2204 target_item_label = i;
2206 else strcpy(tmp_val, " ");
2208 else if (i <= INVEN_PACK)
2210 /* Prepare an index --(-- */
2211 sprintf(tmp_val, "%c)", inven_label[i]);
2215 /* Prepare an index --(-- */
2216 sprintf(tmp_val, "%c)", index_to_label(i));
2219 /* Clear the line with the (possibly indented) index */
2220 put_str(tmp_val, j + 1, col);
2224 /* Display graphics for object, if desired */
2225 if (show_item_graph)
2227 TERM_COLOR a = object_attr(o_ptr);
2228 SYMBOL_CODE c = object_char(o_ptr);
2229 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2230 if (use_bigtile) cur_col++;
2236 /* Display the entry itself */
2237 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2239 /* Display the weight if needed */
2242 int wgt = o_ptr->weight * o_ptr->number;
2244 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2246 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2249 prt(tmp_val, j + 1, wid - 9);
2253 /* Make a "shadow" below the list (only if needed) */
2254 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2256 /* Save the new column */
2259 return target_item_label;
2264 * @brief 装備アイテムの表示を行う /
2265 * Display the equipment.
2266 * @param target_item アイテムの選択処理を行うか否か。
2267 * @return 選択したアイテムのタグ
2269 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2273 int col, cur_col, len;
2276 GAME_TEXT o_name[MAX_NLEN];
2277 COMMAND_CODE out_index[23];
2278 TERM_COLOR out_color[23];
2279 char out_desc[23][MAX_NLEN];
2280 COMMAND_CODE target_item_label = 0;
2282 char equip_label[52 + 1];
2284 /* Starting column */
2287 Term_get_size(&wid, &hgt);
2289 /* Maximal length */
2290 len = wid - col - 1;
2293 /* Scan the equipment list */
2294 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2296 o_ptr = &inventory[i];
2298 /* Is this item acceptable? */
2299 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2300 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2301 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2303 object_desc(o_name, o_ptr, 0);
2305 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2307 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2308 out_color[k] = TERM_WHITE;
2312 (void)strcpy(out_desc[k], o_name);
2313 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2317 /* Grey out charging items */
2320 out_color[k] = TERM_L_DARK;
2323 /* Extract the maximal length (see below) */
2325 l = strlen(out_desc[k]) + (2 + 1);
2327 l = strlen(out_desc[k]) + (2 + 3);
2331 /* Increase length for labels (if needed) */
2333 if (show_labels) l += (7 + 2);
2335 if (show_labels) l += (14 + 2);
2339 /* Increase length for weight (if needed) */
2340 if (show_weights) l += 9;
2342 if (show_item_graph) l += 2;
2344 /* Maintain the max-length */
2345 if (l > len) len = l;
2347 /* Advance the entry */
2351 /* Hack -- Find a column to start in */
2353 col = (len > wid - 6) ? 0 : (wid - len - 1);
2355 col = (len > wid - 4) ? 0 : (wid - len - 1);
2358 prepare_label_string(equip_label, USE_EQUIP);
2360 /* Output each entry */
2361 for (j = 0; j < k; j++)
2366 o_ptr = &inventory[i];
2368 /* Clear the line */
2369 prt("", j + 1, col ? col - 2 : col);
2371 if (use_menu && target_item)
2373 if (j == (target_item-1))
2375 strcpy(tmp_val, _("》", "> "));
2376 target_item_label = i;
2378 else strcpy(tmp_val, " ");
2380 else if (i >= INVEN_RARM)
2382 /* Prepare an index --(-- */
2383 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2387 /* Prepare an index --(-- */
2388 sprintf(tmp_val, "%c)", index_to_label(i));
2391 /* Clear the line with the (possibly indented) index */
2392 put_str(tmp_val, j+1, col);
2396 /* Display graphics for object, if desired */
2397 if (show_item_graph)
2399 TERM_COLOR a = object_attr(o_ptr);
2400 SYMBOL_CODE c = object_char(o_ptr);
2401 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2402 if (use_bigtile) cur_col++;
2410 /* Mention the use */
2411 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2413 put_str(tmp_val, j+1, cur_col);
2415 /* Display the entry itself */
2416 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2422 /* Display the entry itself */
2423 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2426 /* Display the weight if needed */
2429 int wgt = o_ptr->weight * o_ptr->number;
2431 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2433 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2436 prt(tmp_val, j + 1, wid - 9);
2440 /* Make a "shadow" below the list (only if needed) */
2441 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2443 /* Save the new column */
2446 return target_item_label;
2450 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2451 * Flip "inven" and "equip" in any sub-windows
2454 void toggle_inven_equip(void)
2459 for (j = 0; j < 8; j++)
2462 if (!angband_term[j]) continue;
2464 /* Flip inven to equip */
2465 if (window_flag[j] & (PW_INVEN))
2468 window_flag[j] &= ~(PW_INVEN);
2469 window_flag[j] |= (PW_EQUIP);
2471 p_ptr->window |= (PW_EQUIP);
2474 /* Flip inven to equip */
2475 else if (window_flag[j] & (PW_EQUIP))
2478 window_flag[j] &= ~(PW_EQUIP);
2479 window_flag[j] |= (PW_INVEN);
2481 p_ptr->window |= (PW_INVEN);
2487 * @brief 選択したアイテムの確認処理の補助 /
2488 * Verify the choice of an item.
2489 * @param prompt メッセージ表示の一部
2490 * @param item 選択アイテムID
2491 * @return 確認がYesならTRUEを返す。
2492 * @details The item can be negative to mean "item on floor".
2494 static bool verify(concptr prompt, INVENTORY_IDX item)
2496 GAME_TEXT o_name[MAX_NLEN];
2497 char out_val[MAX_NLEN+20];
2504 o_ptr = &inventory[item];
2510 o_ptr = &o_list[0 - item];
2512 object_desc(o_name, o_ptr, 0);
2515 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2518 return (get_check(out_val));
2523 * @brief 選択したアイテムの確認処理のメインルーチン /
2524 * @param item 選択アイテムID
2525 * @return 確認がYesならTRUEを返す。
2526 * @details The item can be negative to mean "item on floor".
2527 * Hack -- allow user to "prevent" certain choices
2529 static bool get_item_allow(INVENTORY_IDX item)
2533 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2538 o_ptr = &inventory[item];
2544 o_ptr = &o_list[0 - item];
2547 /* No inscription */
2548 if (!o_ptr->inscription) return (TRUE);
2551 s = my_strchr(quark_str(o_ptr->inscription), '!');
2553 /* Process preventions */
2556 /* Check the "restriction" */
2557 if ((s[1] == command_cmd) || (s[1] == '*'))
2559 /* Verify the choice */
2560 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2563 /* Find another '!' */
2564 s = my_strchr(s + 1, '!');
2573 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2574 * Auxiliary function for "get_item()" -- test an index
2576 * @return 正規のIDならばTRUEを返す。
2578 static bool get_item_okay(OBJECT_IDX i)
2581 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2583 if (select_ring_slot) return is_ring_slot(i);
2585 /* Verify the item */
2586 if (!item_tester_okay(&inventory[i])) return (FALSE);
2593 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2594 * Determine whether get_item() can get some item or not
2595 * @return アイテムを拾えるならばTRUEを返す。
2596 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2598 bool can_get_item(void)
2601 OBJECT_IDX floor_list[23];
2602 ITEM_NUMBER floor_num = 0;
2604 for (j = 0; j < INVEN_TOTAL; j++)
2605 if (item_tester_okay(&inventory[j]))
2608 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2616 * @brief オブジェクト選択の汎用関数 /
2617 * Let the user select an item, save its "index"
2618 * @param cp 選択したオブジェクトのIDを返す。
2619 * @param pmt 選択目的のメッセージ
2620 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2621 * @param mode オプションフラグ
2622 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2623 * Return TRUE only if an acceptable item was chosen by the user.\n
2625 * The selected item must satisfy the "item_tester_hook()" function,\n
2626 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2628 * All "item_tester" restrictions are cleared before this function returns.\n
2630 * The user is allowed to choose acceptable items from the equipment,\n
2631 * inventory, or floor, respectively, if the proper flag was given,\n
2632 * and there are any acceptable items in that location.\n
2634 * The equipment or inventory are displayed (even if no acceptable\n
2635 * items are in that location) if the proper flag was given.\n
2637 * If there are no acceptable items available anywhere, and "str" is\n
2638 * not NULL, then it will be used as the text of a warning message\n
2639 * before the function returns.\n
2641 * Note that the user must press "-" to specify the item on the floor,\n
2642 * and there is no way to "examine" the item on the floor, while the\n
2643 * use of "capital" letters will "examine" an inventory/equipment item,\n
2644 * and prompt for its use.\n
2646 * If a legal item is selected from the inventory, we save it in "cp"\n
2647 * directly (0 to 35), and return TRUE.\n
2649 * If a legal item is selected from the floor, we save it in "cp" as\n
2650 * a negative (-1 to -511), and return TRUE.\n
2652 * If no item is available, we do nothing to "cp", and we display a\n
2653 * warning message, using "str" if available, and return FALSE.\n
2655 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2657 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2658 * to allow the user to enter a command while viewing those screens, and\n
2659 * also to induce "auto-enter" of stores, and other such stuff.\n
2661 * Global "p_ptr->command_see" may be set before calling this function to start\n
2662 * out in "browse" mode. It is cleared before this function returns.\n
2664 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2665 * If it is TRUE then we are viewing inventory, else equipment.\n
2667 * We always erase the prompt when we are done, leaving a blank line,\n
2668 * or a warning message, if appropriate, if no items are available.\n
2670 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2672 OBJECT_IDX this_o_idx, next_o_idx = 0;
2689 bool allow_floor = FALSE;
2691 bool toggle = FALSE;
2696 int menu_line = (use_menu ? 1 : 0);
2700 static char prev_tag = '\0';
2701 char cur_tag = '\0';
2703 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2706 if (mode & USE_EQUIP) equip = TRUE;
2707 if (mode & USE_INVEN) inven = TRUE;
2708 if (mode & USE_FLOOR) floor = TRUE;
2710 /* Get the item index */
2711 if (repeat_pull(cp))
2714 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2716 item_tester_tval = 0;
2717 item_tester_hook = NULL;
2718 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2723 else if (floor && (*cp < 0))
2731 /* Validate the item */
2732 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2734 /* Forget restrictions */
2735 item_tester_tval = 0;
2736 item_tester_hook = NULL;
2737 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2744 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2745 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2747 if (prev_tag && command_cmd)
2749 /* Look up the tag and validate the item */
2750 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2751 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2752 else if (!get_item_okay(k)) /* Reject */;
2755 /* Accept that choice */
2758 /* Forget restrictions */
2759 item_tester_tval = 0;
2760 item_tester_hook = NULL;
2761 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2767 prev_tag = '\0'; /* prev_tag is no longer effective */
2770 /* Verify the item */
2771 else if (get_item_okay(*cp))
2773 /* Forget restrictions */
2774 item_tester_tval = 0;
2775 item_tester_hook = NULL;
2776 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2790 /* No item selected */
2794 /* Full inventory */
2796 i2 = INVEN_PACK - 1;
2798 /* Forbid inventory */
2799 if (!inven) i2 = -1;
2802 for (j = 0; j < INVEN_PACK; j++)
2803 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
2806 /* Restrict inventory indexes */
2807 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2808 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2811 /* Full equipment */
2813 e2 = INVEN_TOTAL - 1;
2815 /* Forbid equipment */
2816 if (!equip) e2 = -1;
2819 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2820 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
2821 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2824 /* Restrict equipment indexes */
2825 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2826 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2828 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2832 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2834 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2838 /* Restrict floor usage */
2841 /* Scan all objects in the grid */
2842 for (this_o_idx = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2845 o_ptr = &o_list[this_o_idx];
2847 /* Acquire next object */
2848 next_o_idx = o_ptr->next_o_idx;
2850 /* Accept the item on the floor if legal */
2851 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2855 /* Require at least one legal choice */
2856 if (!allow_floor && (i1 > i2) && (e1 > e2))
2858 /* Cancel p_ptr->command_see */
2859 command_see = FALSE;
2863 if (mode & USE_FORCE) {
2869 /* Analyze choices */
2872 /* Hack -- Start on equipment if requested */
2873 if (command_see && command_wrk && equip)
2878 /* Use inventory if allowed */
2881 command_wrk = FALSE;
2884 /* Use equipment if allowed */
2890 /* Use inventory for floor */
2893 command_wrk = FALSE;
2899 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2901 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2903 /* Hack -- start out in "display" mode */
2910 /* Repeat until done */
2913 COMMAND_CODE get_item_label = 0;
2920 for (j = 0; j < 8; j++)
2923 if (!angband_term[j]) continue;
2925 /* Count windows displaying inven */
2926 if (window_flag[j] & (PW_INVEN)) ni++;
2928 /* Count windows displaying equip */
2929 if (window_flag[j] & (PW_EQUIP)) ne++;
2932 /* Toggle if needed */
2933 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2936 toggle_inven_equip();
2942 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2945 /* Inventory screen */
2948 /* Redraw if needed */
2949 if (command_see) get_item_label = show_inven(menu_line, mode);
2952 /* Equipment screen */
2955 /* Redraw if needed */
2956 if (command_see) get_item_label = show_equip(menu_line, mode);
2959 /* Viewing inventory */
2962 /* Begin the prompt */
2963 sprintf(out_val, _("持ち物:", "Inven:"));
2965 /* Some legal items */
2966 if ((i1 <= i2) && !use_menu)
2968 /* Build the prompt */
2969 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2970 index_to_label(i1), index_to_label(i2));
2973 strcat(out_val, tmp_val);
2976 /* Indicate ability to "view" */
2977 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2980 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2983 /* Viewing equipment */
2986 /* Begin the prompt */
2987 sprintf(out_val, _("装備品:", "Equip:"));
2989 /* Some legal items */
2990 if ((e1 <= e2) && !use_menu)
2992 /* Build the prompt */
2993 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2994 index_to_label(e1), index_to_label(e2));
2997 strcat(out_val, tmp_val);
3000 /* Indicate ability to "view" */
3001 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3004 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
3007 /* Indicate legality of the "floor" item */
3008 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3009 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3011 /* Finish the prompt */
3012 strcat(out_val, " ESC");
3014 /* Build the prompt */
3015 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3017 /* Show the prompt */
3025 int max_line = (command_wrk ? max_equip : max_inven);
3041 menu_line += (max_line - 1);
3060 /* Verify legality */
3061 if (!inven || !equip)
3067 /* Hack -- Fix screen */
3074 /* Switch inven/equip */
3075 command_wrk = !command_wrk;
3076 max_line = (command_wrk ? max_equip : max_inven);
3077 if (menu_line > max_line) menu_line = max_line;
3079 /* Need to redraw */
3088 if (command_wrk == USE_FLOOR)
3091 (*cp) = -get_item_label;
3095 /* Validate the item */
3096 if (!get_item_okay(get_item_label))
3102 /* Allow player to "refuse" certain actions */
3103 if (!get_item_allow(get_item_label))
3109 /* Accept that choice */
3110 (*cp) = get_item_label;
3119 if (mode & USE_FORCE) {
3127 if (menu_line > max_line) menu_line -= max_line;
3148 command_see = FALSE;
3165 /* Verify legality */
3166 if (!inven || !equip)
3172 /* Hack -- Fix screen */
3179 /* Switch inven/equip */
3180 command_wrk = !command_wrk;
3182 /* Need to redraw */
3188 /* Use floor item */
3191 /* Scan all objects in the grid */
3192 for (this_o_idx = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3195 o_ptr = &o_list[this_o_idx];
3197 /* Acquire next object */
3198 next_o_idx = o_ptr->next_o_idx;
3200 /* Validate the item */
3201 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3206 /* Verify the item (if required) */
3207 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3209 /* Allow player to "refuse" certain actions */
3210 if (!get_item_allow(k)) continue;
3212 /* Accept that choice */
3228 case '1': case '2': case '3':
3229 case '4': case '5': case '6':
3230 case '7': case '8': case '9':
3232 /* Look up the tag */
3233 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3239 /* Hack -- Validate the item */
3240 if ((k < INVEN_RARM) ? !inven : !equip)
3246 /* Validate the item */
3247 if (!get_item_okay(k))
3253 /* Allow player to "refuse" certain actions */
3254 if (!get_item_allow(k))
3260 /* Accept that choice */
3272 /* Choose "default" inventory item */
3275 k = ((i1 == i2) ? i1 : -1);
3278 /* Choose "default" equipment item */
3281 k = ((e1 == e2) ? e1 : -1);
3284 /* Validate the item */
3285 if (!get_item_okay(k))
3291 /* Allow player to "refuse" certain actions */
3292 if (!get_item_allow(k))
3298 /* Accept that choice */
3308 if (mode & USE_FORCE) {
3321 bool not_found = FALSE;
3323 /* Look up the alphabetical tag */
3324 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3329 /* Hack -- Validate the item */
3330 else if ((k < INVEN_RARM) ? !inven : !equip)
3335 /* Validate the item */
3336 else if (!get_item_okay(k))
3343 /* Accept that choice */
3351 /* Extract "query" setting */
3352 ver = isupper(which);
3353 which = (char)tolower(which);
3355 /* Convert letter to inventory index */
3358 if (which == '(') k = i1;
3359 else if (which == ')') k = i2;
3360 else k = label_to_inven(which);
3363 /* Convert letter to equipment index */
3366 if (which == '(') k = e1;
3367 else if (which == ')') k = e2;
3368 else k = label_to_equip(which);
3371 /* Validate the item */
3372 if (!get_item_okay(k))
3378 /* Verify the item */
3379 if (ver && !verify(_("本当に", "Try"), k))
3385 /* Allow player to "refuse" certain actions */
3386 if (!get_item_allow(k))
3392 /* Accept that choice */
3403 /* Fix the screen if necessary */
3408 /* Hack -- Cancel "display" */
3409 command_see = FALSE;
3413 /* Forget the item_tester_tval restriction */
3414 item_tester_tval = 0;
3416 /* Forget the item_tester_hook restriction */
3417 item_tester_hook = NULL;
3420 /* Clean up 'show choices' */
3421 /* Toggle again if needed */
3422 if (toggle) toggle_inven_equip();
3424 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3427 /* Clear the prompt line */
3430 /* Warning if needed */
3431 if (oops && str) msg_print(str);
3436 if (command_cmd) prev_tag = cur_tag;
3437 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3443 * Choose an item and get auto-picker entry from it.
3445 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3448 if (!get_item(&item, q, s, option)) return NULL;
3449 if (idx) *idx = item;
3451 if (item == INVEN_FORCE) return NULL;
3453 /* Get the item (in the pack) */
3454 else if (item >= 0) return &inventory[item];
3456 /* Get the item (on the floor) */
3457 else return &o_list[0 - item];
3462 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3463 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3464 * @param y 走査するフロアのY座標
3465 * @param x 走査するフロアのX座標
3466 * @param mode オプションフラグ
3467 * @return 対象のマスに落ちているアイテム数
3469 * Return a list of o_list[] indexes of items at the given current_floor->grid_array
3470 * location. Valid flags are:
3472 * mode & 0x01 -- Item tester
3473 * mode & 0x02 -- Marked items only
3474 * mode & 0x04 -- Stop after first
3476 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3478 OBJECT_IDX this_o_idx, next_o_idx;
3480 ITEM_NUMBER num = 0;
3483 if (!in_bounds(y, x)) return 0;
3485 /* Scan all objects in the grid */
3486 for (this_o_idx = current_floor->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3489 o_ptr = &o_list[this_o_idx];
3491 /* Acquire next object */
3492 next_o_idx = o_ptr->next_o_idx;
3495 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3498 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3500 /* Accept this item */
3501 /* XXX Hack -- Enforce limit */
3503 items[num] = this_o_idx;
3508 if (mode & 0x04) break;
3515 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3516 * @param target_item カーソルの初期値
3517 * @param y 走査するフロアのY座標
3518 * @param x 走査するフロアのX座標
3519 * @param min_width 表示の長さ
3520 * @return 選択したアイテムの添え字
3523 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3531 GAME_TEXT o_name[MAX_NLEN];
3534 COMMAND_CODE out_index[23];
3535 TERM_COLOR out_color[23];
3536 char out_desc[23][MAX_NLEN];
3537 COMMAND_CODE target_item_label = 0;
3539 OBJECT_IDX floor_list[23];
3540 ITEM_NUMBER floor_num;
3542 char floor_label[52 + 1];
3544 bool dont_need_to_show_weights = TRUE;
3546 Term_get_size(&wid, &hgt);
3548 /* Default length */
3549 len = MAX((*min_width), 20);
3551 /* Scan for objects in the grid, using item_tester_okay() */
3552 floor_num = scan_floor(floor_list, y, x, 0x03);
3554 /* Display the floor objects */
3555 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3557 o_ptr = &o_list[floor_list[i]];
3559 object_desc(o_name, o_ptr, 0);
3561 /* Save the index */
3564 /* Acquire inventory color */
3565 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3567 /* Save the object description */
3568 strcpy(out_desc[k], o_name);
3570 /* Find the predicted "line length" */
3571 l = strlen(out_desc[k]) + 5;
3573 /* Be sure to account for the weight */
3574 if (show_weights) l += 9;
3576 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3578 /* Maintain the maximum length */
3579 if (l > len) len = l;
3581 /* Advance to next "line" */
3585 if (show_weights && dont_need_to_show_weights) len -= 9;
3590 /* Find the column to start in */
3591 col = (len > wid - 4) ? 0 : (wid - len - 1);
3593 prepare_label_string_floor(floor_label, floor_list, floor_num);
3595 /* Output each entry */
3596 for (j = 0; j < k; j++)
3599 m = floor_list[out_index[j]];
3603 /* Clear the line */
3604 prt("", j + 1, col ? col - 2 : col);
3606 if (use_menu && target_item)
3608 if (j == (target_item-1))
3610 strcpy(tmp_val, _("》", "> "));
3611 target_item_label = m;
3613 else strcpy(tmp_val, " ");
3617 /* Prepare an index --(-- */
3618 sprintf(tmp_val, "%c)", floor_label[j]);
3621 /* Clear the line with the (possibly indented) index */
3622 put_str(tmp_val, j + 1, col);
3624 /* Display the entry itself */
3625 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3627 /* Display the weight if needed */
3628 if (show_weights && (o_ptr->tval != TV_GOLD))
3630 int wgt = o_ptr->weight * o_ptr->number;
3632 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3634 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3637 prt(tmp_val, j + 1, wid - 9);
3641 /* Make a "shadow" below the list (only if needed) */
3642 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3644 return target_item_label;
3648 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3649 * Let the user select an item, save its "index"
3650 * @param cp 選択したオブジェクトのIDを返す。
3651 * @param pmt 選択目的のメッセージ
3652 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3653 * @param mode オプションフラグ
3654 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3656 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3658 char n1 = ' ', n2 = ' ', which = ' ';
3661 COMMAND_CODE i1, i2;
3662 COMMAND_CODE e1, e2;
3670 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3671 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3672 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3673 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3675 bool allow_equip = FALSE;
3676 bool allow_inven = FALSE;
3677 bool allow_floor = FALSE;
3679 bool toggle = FALSE;
3684 ITEM_NUMBER floor_num;
3685 OBJECT_IDX floor_list[23];
3687 TERM_LEN min_width = 0;
3689 int menu_line = (use_menu ? 1 : 0);
3693 static char prev_tag = '\0';
3694 char cur_tag = '\0';
3696 /* Get the item index */
3697 if (repeat_pull(cp))
3700 if (force && (*cp == INVEN_FORCE))
3702 item_tester_tval = 0;
3703 item_tester_hook = NULL;
3704 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3709 else if (floor && (*cp < 0))
3711 if (prev_tag && command_cmd)
3713 /* Scan all objects in the grid */
3714 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3716 /* Look up the tag */
3717 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3719 /* Accept that choice */
3720 (*cp) = 0 - floor_list[k];
3722 /* Forget restrictions */
3723 item_tester_tval = 0;
3724 item_tester_hook = NULL;
3725 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3731 prev_tag = '\0'; /* prev_tag is no longer effective */
3734 /* Validate the item */
3735 else if (item_tester_okay(&o_list[0 - (*cp)]) || (mode & USE_FULL))
3737 /* Forget restrictions */
3738 item_tester_tval = 0;
3739 item_tester_hook = NULL;
3740 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3747 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3748 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3750 if (prev_tag && command_cmd)
3752 /* Look up the tag and validate the item */
3753 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3754 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3755 else if (!get_item_okay(k)) /* Reject */;
3758 /* Accept that choice */
3761 /* Forget restrictions */
3762 item_tester_tval = 0;
3763 item_tester_hook = NULL;
3764 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3770 prev_tag = '\0'; /* prev_tag is no longer effective */
3773 /* Verify the item */
3774 else if (get_item_okay(*cp))
3776 /* Forget restrictions */
3777 item_tester_tval = 0;
3778 item_tester_hook = NULL;
3779 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3795 /* No item selected */
3799 /* Full inventory */
3801 i2 = INVEN_PACK - 1;
3803 /* Forbid inventory */
3804 if (!inven) i2 = -1;
3807 for (j = 0; j < INVEN_PACK; j++)
3808 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
3811 /* Restrict inventory indexes */
3812 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3813 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3816 /* Full equipment */
3818 e2 = INVEN_TOTAL - 1;
3820 /* Forbid equipment */
3821 if (!equip) e2 = -1;
3824 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3825 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
3826 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3829 /* Restrict equipment indexes */
3830 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3831 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3833 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3837 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3839 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3843 /* Count "okay" floor items */
3846 /* Restrict floor usage */
3849 /* Scan all objects in the grid */
3850 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3853 /* Accept inventory */
3854 if (i1 <= i2) allow_inven = TRUE;
3856 /* Accept equipment */
3857 if (e1 <= e2) allow_equip = TRUE;
3860 if (floor_num) allow_floor = TRUE;
3862 /* Require at least one legal choice */
3863 if (!allow_inven && !allow_equip && !allow_floor)
3865 /* Cancel p_ptr->command_see */
3866 command_see = FALSE;
3876 /* Analyze choices */
3879 /* Hack -- Start on equipment if requested */
3880 if (command_see && (command_wrk == (USE_EQUIP))
3883 command_wrk = (USE_EQUIP);
3886 /* Use inventory if allowed */
3887 else if (allow_inven)
3889 command_wrk = (USE_INVEN);
3892 /* Use equipment if allowed */
3893 else if (allow_equip)
3895 command_wrk = (USE_EQUIP);
3898 /* Use floor if allowed */
3899 else if (allow_floor)
3901 command_wrk = (USE_FLOOR);
3906 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3908 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3910 /* Hack -- start out in "display" mode */
3916 /* Repeat until done */
3919 COMMAND_CODE get_item_label = 0;
3926 for (j = 0; j < 8; j++)
3929 if (!angband_term[j]) continue;
3931 /* Count windows displaying inven */
3932 if (window_flag[j] & (PW_INVEN)) ni++;
3934 /* Count windows displaying equip */
3935 if (window_flag[j] & (PW_EQUIP)) ne++;
3938 /* Toggle if needed */
3939 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3940 (command_wrk == (USE_INVEN) && !ni && ne))
3943 toggle_inven_equip();
3949 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3952 /* Inventory screen */
3953 if (command_wrk == (USE_INVEN))
3955 /* Extract the legal requests */
3959 /* Redraw if needed */
3960 if (command_see) get_item_label = show_inven(menu_line, mode);
3963 /* Equipment screen */
3964 else if (command_wrk == (USE_EQUIP))
3966 /* Extract the legal requests */
3967 n1 = I2A(e1 - INVEN_RARM);
3968 n2 = I2A(e2 - INVEN_RARM);
3970 /* Redraw if needed */
3971 if (command_see) get_item_label = show_equip(menu_line, mode);
3975 else if (command_wrk == (USE_FLOOR))
3978 k = MIN(floor_top + 23, floor_num) - 1;
3980 /* Extract the legal requests */
3981 n1 = I2A(j - floor_top);
3982 n2 = I2A(k - floor_top);
3984 /* Redraw if needed */
3985 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3988 /* Viewing inventory */
3989 if (command_wrk == (USE_INVEN))
3991 /* Begin the prompt */
3992 sprintf(out_val, _("持ち物:", "Inven:"));
3996 /* Build the prompt */
3997 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3998 index_to_label(i1), index_to_label(i2));
4001 strcat(out_val, tmp_val);
4004 /* Indicate ability to "view" */
4005 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4011 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
4012 else if (allow_floor)
4013 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
4015 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4022 strcat(out_val, _(" '-'床上,", " - for floor,"));
4023 else if (allow_equip)
4024 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
4026 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4030 /* Viewing equipment */
4031 else if (command_wrk == (USE_EQUIP))
4033 /* Begin the prompt */
4034 sprintf(out_val, _("装備品:", "Equip:"));
4038 /* Build the prompt */
4039 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4040 index_to_label(e1), index_to_label(e2));
4043 strcat(out_val, tmp_val);
4046 /* Indicate ability to "view" */
4047 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4053 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4054 else if (allow_floor)
4055 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
4057 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4064 strcat(out_val, _(" '-'床上,", " - for floor,"));
4065 else if (allow_inven)
4066 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4068 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4073 else if (command_wrk == (USE_FLOOR))
4075 /* Begin the prompt */
4076 sprintf(out_val, _("床上:", "Floor:"));
4080 /* Build the prompt */
4081 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4084 strcat(out_val, tmp_val);
4087 /* Indicate ability to "view" */
4088 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4092 if (allow_inven && allow_equip)
4094 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4096 else if (allow_inven)
4098 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4100 else if (allow_equip)
4102 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4106 else if (allow_inven)
4108 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4110 else if (allow_equip)
4112 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4116 if (command_see && !use_menu)
4118 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4123 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4125 /* Finish the prompt */
4126 strcat(out_val, " ESC");
4128 /* Build the prompt */
4129 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4131 /* Show the prompt */
4140 if (command_wrk == USE_INVEN) max_line = max_inven;
4141 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4142 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4158 menu_line += (max_line - 1);
4174 /* Verify legality */
4175 if (command_wrk == (USE_INVEN))
4177 if (allow_floor) command_wrk = USE_FLOOR;
4178 else if (allow_equip) command_wrk = USE_EQUIP;
4185 else if (command_wrk == (USE_EQUIP))
4187 if (allow_inven) command_wrk = USE_INVEN;
4188 else if (allow_floor) command_wrk = USE_FLOOR;
4195 else if (command_wrk == (USE_FLOOR))
4197 if (allow_equip) command_wrk = USE_EQUIP;
4198 else if (allow_inven) command_wrk = USE_INVEN;
4211 /* Hack -- Fix screen */
4218 /* Switch inven/equip */
4219 if (command_wrk == USE_INVEN) max_line = max_inven;
4220 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4221 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4222 if (menu_line > max_line) menu_line = max_line;
4224 /* Need to redraw */
4232 /* Verify legality */
4233 if (command_wrk == (USE_INVEN))
4235 if (allow_equip) command_wrk = USE_EQUIP;
4236 else if (allow_floor) command_wrk = USE_FLOOR;
4243 else if (command_wrk == (USE_EQUIP))
4245 if (allow_floor) command_wrk = USE_FLOOR;
4246 else if (allow_inven) command_wrk = USE_INVEN;
4253 else if (command_wrk == (USE_FLOOR))
4255 if (allow_inven) command_wrk = USE_INVEN;
4256 else if (allow_equip) command_wrk = USE_EQUIP;
4269 /* Hack -- Fix screen */
4276 /* Switch inven/equip */
4277 if (command_wrk == USE_INVEN) max_line = max_inven;
4278 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4279 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4280 if (menu_line > max_line) menu_line = max_line;
4282 /* Need to redraw */
4291 if (command_wrk == USE_FLOOR)
4294 (*cp) = -get_item_label;
4298 /* Validate the item */
4299 if (!get_item_okay(get_item_label))
4305 /* Allow player to "refuse" certain actions */
4306 if (!get_item_allow(get_item_label))
4312 /* Accept that choice */
4313 (*cp) = get_item_label;
4330 if (menu_line > max_line) menu_line -= max_line;
4351 command_see = FALSE;
4372 grid_type *g_ptr = ¤t_floor->grid_array[p_ptr->y][p_ptr->x];
4374 if (command_wrk != (USE_FLOOR)) break;
4376 /* Get the object being moved. */
4377 o_idx = g_ptr->o_idx;
4379 /* Only rotate a pile of two or more objects. */
4380 if (!(o_idx && o_list[o_idx].next_o_idx)) break;
4382 /* Remove the first object from the list. */
4383 excise_object_idx(o_idx);
4385 /* Find end of the list. */
4387 while (o_list[i].next_o_idx)
4388 i = o_list[i].next_o_idx;
4390 /* Add after the last object. */
4391 o_list[i].next_o_idx = o_idx;
4393 /* Re-scan floor list */
4394 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4396 /* Hack -- Fix screen */
4408 if (command_wrk == (USE_INVEN))
4415 command_wrk = (USE_EQUIP);
4417 else if (command_wrk == (USE_EQUIP))
4424 command_wrk = (USE_INVEN);
4426 else if (command_wrk == (USE_FLOOR))
4430 command_wrk = (USE_INVEN);
4432 else if (allow_equip)
4434 command_wrk = (USE_EQUIP);
4443 /* Hack -- Fix screen */
4450 /* Need to redraw */
4463 * If we are already examining the floor, and there
4464 * is only one item, we will always select it.
4465 * If we aren't examining the floor and there is only
4466 * one item, we will select it if floor_query_flag
4471 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4474 k = 0 - floor_list[0];
4476 /* Allow player to "refuse" certain actions */
4477 if (!get_item_allow(k))
4483 /* Accept that choice */
4492 /* Hack -- Fix screen */
4499 command_wrk = (USE_FLOOR);
4505 case '1': case '2': case '3':
4506 case '4': case '5': case '6':
4507 case '7': case '8': case '9':
4509 if (command_wrk != USE_FLOOR)
4511 /* Look up the tag */
4512 if (!get_tag(&k, which, command_wrk))
4518 /* Hack -- Validate the item */
4519 if ((k < INVEN_RARM) ? !inven : !equip)
4525 /* Validate the item */
4526 if (!get_item_okay(k))
4534 /* Look up the alphabetical tag */
4535 if (get_tag_floor(&k, which, floor_list, floor_num))
4538 k = 0 - floor_list[k];
4547 /* Allow player to "refuse" certain actions */
4548 if (!get_item_allow(k))
4554 /* Accept that choice */
4566 /* Choose "default" inventory item */
4567 if (command_wrk == (USE_INVEN))
4569 k = ((i1 == i2) ? i1 : -1);
4572 /* Choose "default" equipment item */
4573 else if (command_wrk == (USE_EQUIP))
4575 k = ((e1 == e2) ? e1 : -1);
4578 /* Choose "default" floor item */
4579 else if (command_wrk == (USE_FLOOR))
4584 k = 0 - floor_list[0];
4586 /* Allow player to "refuse" certain actions */
4587 if (!get_item_allow(k))
4593 /* Accept that choice */
4601 /* Validate the item */
4602 if (!get_item_okay(k))
4608 /* Allow player to "refuse" certain actions */
4609 if (!get_item_allow(k))
4615 /* Accept that choice */
4639 if (command_wrk != USE_FLOOR)
4641 bool not_found = FALSE;
4643 /* Look up the alphabetical tag */
4644 if (!get_tag(&k, which, command_wrk))
4649 /* Hack -- Validate the item */
4650 else if ((k < INVEN_RARM) ? !inven : !equip)
4655 /* Validate the item */
4656 else if (!get_item_okay(k))
4663 /* Accept that choice */
4673 /* Look up the alphabetical tag */
4674 if (get_tag_floor(&k, which, floor_list, floor_num))
4677 k = 0 - floor_list[k];
4679 /* Accept that choice */
4688 /* Extract "query" setting */
4689 ver = isupper(which);
4690 which = (char)tolower(which);
4692 /* Convert letter to inventory index */
4693 if (command_wrk == (USE_INVEN))
4695 if (which == '(') k = i1;
4696 else if (which == ')') k = i2;
4697 else k = label_to_inven(which);
4700 /* Convert letter to equipment index */
4701 else if (command_wrk == (USE_EQUIP))
4703 if (which == '(') k = e1;
4704 else if (which == ')') k = e2;
4705 else k = label_to_equip(which);
4708 /* Convert letter to floor index */
4709 else if (command_wrk == USE_FLOOR)
4711 if (which == '(') k = 0;
4712 else if (which == ')') k = floor_num - 1;
4713 else k = islower(which) ? A2I(which) : -1;
4714 if (k < 0 || k >= floor_num || k >= 23)
4721 k = 0 - floor_list[k];
4724 /* Validate the item */
4725 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4731 /* Verify the item */
4732 if (ver && !verify(_("本当に", "Try"), k))
4738 /* Allow player to "refuse" certain actions */
4739 if (!get_item_allow(k))
4745 /* Accept that choice */
4755 /* Fix the screen if necessary */
4760 /* Hack -- Cancel "display" */
4761 command_see = FALSE;
4765 /* Forget the item_tester_tval restriction */
4766 item_tester_tval = 0;
4768 /* Forget the item_tester_hook restriction */
4769 item_tester_hook = NULL;
4772 /* Clean up 'show choices' */
4773 /* Toggle again if needed */
4774 if (toggle) toggle_inven_equip();
4776 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4779 /* Clear the prompt line */
4782 /* Warning if needed */
4783 if (oops && str) msg_print(str);
4788 if (command_cmd) prev_tag = cur_tag;
4789 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4795 * @brief 床上のアイテムを拾う選択用サブルーチン
4796 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4798 static bool py_pickup_floor_aux(void)
4800 OBJECT_IDX this_o_idx;
4804 /* Restrict the choices */
4805 item_tester_hook = inven_carry_okay;
4808 q = _("どれを拾いますか?", "Get which item? ");
4809 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4811 if (choose_object(&item, q, s, (USE_FLOOR)))
4813 this_o_idx = 0 - item;
4820 /* Pick up the object */
4821 py_pickup_aux(this_o_idx);
4827 * @brief 床上のアイテムを拾うメイン処理
4828 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4831 * This is called by py_pickup() when easy_floor is TRUE.
4833 void py_pickup_floor(bool pickup)
4835 OBJECT_IDX this_o_idx, next_o_idx = 0;
4837 GAME_TEXT o_name[MAX_NLEN];
4841 OBJECT_IDX floor_o_idx = 0;
4845 /* Scan the pile of objects */
4846 for (this_o_idx = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
4848 /* Access the object */
4849 o_ptr = &o_list[this_o_idx];
4851 object_desc(o_name, o_ptr, 0);
4853 /* Access the next object */
4854 next_o_idx = o_ptr->next_o_idx;
4856 /* Hack -- disturb */
4857 disturb(FALSE, FALSE);
4860 if (o_ptr->tval == TV_GOLD)
4863 msg_format(" $%ld の価値がある%sを見つけた。",
4864 (long)o_ptr->pval, o_name);
4866 msg_format("You have found %ld gold pieces worth of %s.",
4867 (long)o_ptr->pval, o_name);
4870 /* Collect the gold */
4871 p_ptr->au += o_ptr->pval;
4874 p_ptr->redraw |= (PR_GOLD);
4876 p_ptr->window |= (PW_PLAYER);
4878 /* Delete the gold */
4879 delete_object_idx(this_o_idx);
4881 /* Check the next object */
4884 else if (o_ptr->marked & OM_NOMSG)
4886 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4887 * ignored. Otherwise, they are included in the prompt. */
4888 o_ptr->marked &= ~(OM_NOMSG);
4892 /* Count non-gold objects that can be picked up. */
4893 if (inven_carry_okay(o_ptr))
4898 /* Count non-gold objects */
4901 /* Remember this index */
4902 floor_o_idx = this_o_idx;
4905 /* There are no non-gold objects */
4909 /* Mention the number of objects */
4915 /* Access the object */
4916 o_ptr = &o_list[floor_o_idx];
4918 #ifdef ALLOW_EASY_SENSE
4920 /* Option: Make object sensing easy */
4923 /* Sense the object */
4924 (void) sense_object(o_ptr);
4927 #endif /* ALLOW_EASY_SENSE */
4929 object_desc(o_name, o_ptr, 0);
4931 msg_format(_("%sがある。", "You see %s."), o_name);
4934 /* Multiple objects */
4937 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4943 /* The player has no room for anything on the floor. */
4949 /* Access the object */
4950 o_ptr = &o_list[floor_o_idx];
4952 #ifdef ALLOW_EASY_SENSE
4954 /* Option: Make object sensing easy */
4957 /* Sense the object */
4958 (void) sense_object(o_ptr);
4961 #endif /* ALLOW_EASY_SENSE */
4963 object_desc(o_name, o_ptr, 0);
4965 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4968 /* Multiple objects */
4971 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4981 /* Hack -- query every object */
4982 if (carry_query_flag)
4984 char out_val[MAX_NLEN+20];
4986 /* Access the object */
4987 o_ptr = &o_list[floor_o_idx];
4989 #ifdef ALLOW_EASY_SENSE
4991 /* Option: Make object sensing easy */
4994 /* Sense the object */
4995 (void) sense_object(o_ptr);
4998 #endif /* ALLOW_EASY_SENSE */
5000 object_desc(o_name, o_ptr, 0);
5002 /* Build a prompt */
5003 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
5005 /* Ask the user to confirm */
5006 if (!get_check(out_val))
5012 /* Access the object */
5013 o_ptr = &o_list[floor_o_idx];
5015 #ifdef ALLOW_EASY_SENSE
5017 /* Option: Make object sensing easy */
5020 /* Sense the object */
5021 (void) sense_object(o_ptr);
5024 #endif /* ALLOW_EASY_SENSE */
5026 /* Pick up the object */
5027 py_pickup_aux(floor_o_idx);
5030 /* Allow the user to choose an object */
5033 while (can_pickup--)
5035 if (!py_pickup_floor_aux()) break;
5042 * @brief 矢弾を射撃した場合の破損確率を返す /
5043 * Determines the odds of an object breaking when thrown at a monster
5044 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
5047 * Note that artifacts never break, see the "drop_near()" function.
5049 PERCENTAGE breakage_chance(object_type *o_ptr)
5051 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
5053 /* Examine the snipe type */
5056 if (snipe_type == SP_KILL_WALL) return (100);
5057 if (snipe_type == SP_EXPLODE) return (100);
5058 if (snipe_type == SP_PIERCE) return (100);
5059 if (snipe_type == SP_FINAL) return (100);
5060 if (snipe_type == SP_NEEDLE) return (100);
5061 if (snipe_type == SP_EVILNESS) return (40);
5062 if (snipe_type == SP_HOLYNESS) return (40);
5065 /* Examine the item type */
5066 switch (o_ptr->tval)
5082 /* Sometimes break */
5087 return (20 - archer_bonus * 2);
5092 return (10 - archer_bonus);