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
17 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
24 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
26 * This involves resetting various things to their "default" state.\n
28 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
29 * "user pref file" based on the current setting of the "use_graphics"\n
30 * flag. This is useful for switching "graphics" on/off.\n
32 * The features, objects, and monsters, should all be encoded in the\n
33 * relevant "font.pref" and/or "graf.prf" files. \n
35 * The "prefs" parameter is no longer meaningful. \n
37 void reset_visuals(void)
41 /* Extract some info about terrain features */
42 for (i = 0; i < max_f_idx; i++)
44 feature_type *f_ptr = &f_info[i];
46 /* Assume we will use the underlying values */
47 for (j = 0; j < F_LIT_MAX; j++)
49 f_ptr->x_attr[j] = f_ptr->d_attr[j];
50 f_ptr->x_char[j] = f_ptr->d_char[j];
54 /* Extract default attr/char code for objects */
55 for (i = 0; i < max_k_idx; i++)
57 object_kind *k_ptr = &k_info[i];
59 /* Default attr/char */
60 k_ptr->x_attr = k_ptr->d_attr;
61 k_ptr->x_char = k_ptr->d_char;
64 /* Extract default attr/char code for monsters */
65 for (i = 0; i < max_r_idx; i++)
67 monster_race *r_ptr = &r_info[i];
69 /* Default attr/char */
70 r_ptr->x_attr = r_ptr->d_attr;
71 r_ptr->x_char = r_ptr->d_char;
78 /* Process "graf.prf" */
79 process_pref_file("graf.prf");
81 /* Access the "character" pref file */
82 sprintf(buf, "graf-%s.prf", player_base);
84 /* Process "graf-<playername>.prf" */
85 process_pref_file(buf);
93 /* Process "font.prf" */
94 process_pref_file("font.prf");
96 /* Access the "character" pref file */
97 sprintf(buf, "font-%s.prf", player_base);
99 /* Process "font-<playername>.prf" */
100 process_pref_file(buf);
105 * @brief オブジェクトのフラグ類を配列に与える
106 * Obtain the "flags" for an item
107 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
108 * @param flgs フラグ情報を受け取る配列
111 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
113 object_kind *k_ptr = &k_info[o_ptr->k_idx];
117 for (i = 0; i < TR_FLAG_SIZE; i++)
118 flgs[i] = k_ptr->flags[i];
121 if (object_is_fixed_artifact(o_ptr))
123 artifact_type *a_ptr = &a_info[o_ptr->name1];
125 for (i = 0; i < TR_FLAG_SIZE; i++)
126 flgs[i] = a_ptr->flags[i];
130 if (object_is_ego(o_ptr))
132 ego_item_type *e_ptr = &e_info[o_ptr->name2];
134 for (i = 0; i < TR_FLAG_SIZE; i++)
135 flgs[i] |= e_ptr->flags[i];
137 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
139 remove_flag(flgs, TR_SH_FIRE);
141 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
143 remove_flag(flgs, TR_INFRA);
145 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
147 remove_flag(flgs, TR_RES_BLIND);
148 remove_flag(flgs, TR_SEE_INVIS);
152 /* Random artifact ! */
153 for (i = 0; i < TR_FLAG_SIZE; i++)
154 flgs[i] |= o_ptr->art_flags[i];
156 if (object_is_smith(o_ptr))
158 int add = o_ptr->xtra3 - 1;
160 if (add < TR_FLAG_MAX)
164 else if (add == ESSENCE_TMP_RES_ACID)
166 add_flag(flgs, TR_RES_ACID);
167 add_flag(flgs, TR_ACTIVATE);
169 else if (add == ESSENCE_TMP_RES_ELEC)
171 add_flag(flgs, TR_RES_ELEC);
172 add_flag(flgs, TR_ACTIVATE);
174 else if (add == ESSENCE_TMP_RES_FIRE)
176 add_flag(flgs, TR_RES_FIRE);
177 add_flag(flgs, TR_ACTIVATE);
179 else if (add == ESSENCE_TMP_RES_COLD)
181 add_flag(flgs, TR_RES_COLD);
182 add_flag(flgs, TR_ACTIVATE);
184 else if (add == ESSENCE_SH_FIRE)
186 add_flag(flgs, TR_RES_FIRE);
187 add_flag(flgs, TR_SH_FIRE);
189 else if (add == ESSENCE_SH_ELEC)
191 add_flag(flgs, TR_RES_ELEC);
192 add_flag(flgs, TR_SH_ELEC);
194 else if (add == ESSENCE_SH_COLD)
196 add_flag(flgs, TR_RES_COLD);
197 add_flag(flgs, TR_SH_COLD);
199 else if (add == ESSENCE_RESISTANCE)
201 add_flag(flgs, TR_RES_ACID);
202 add_flag(flgs, TR_RES_ELEC);
203 add_flag(flgs, TR_RES_FIRE);
204 add_flag(flgs, TR_RES_COLD);
206 else if (add == TR_IMPACT)
208 add_flag(flgs, TR_ACTIVATE);
214 * @brief オブジェクトの明示されているフラグ類を取得する
215 * Obtain the "flags" for an item which are known to the player
216 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
217 * @param flgs フラグ情報を受け取る配列
220 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
225 object_kind *k_ptr = &k_info[o_ptr->k_idx];
228 for (i = 0; i < TR_FLAG_SIZE; i++)
231 if (!object_is_aware(o_ptr)) return;
234 for (i = 0; i < TR_FLAG_SIZE; i++)
235 flgs[i] = k_ptr->flags[i];
237 /* Must be identified */
238 if (!object_is_known(o_ptr)) return;
240 /* Ego-item (known basic flags) */
241 if (object_is_ego(o_ptr))
243 ego_item_type *e_ptr = &e_info[o_ptr->name2];
245 for (i = 0; i < TR_FLAG_SIZE; i++)
246 flgs[i] |= e_ptr->flags[i];
248 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
250 remove_flag(flgs, TR_SH_FIRE);
252 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
254 remove_flag(flgs, TR_INFRA);
256 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
258 remove_flag(flgs, TR_RES_BLIND);
259 remove_flag(flgs, TR_SEE_INVIS);
264 #ifdef SPOIL_ARTIFACTS
265 /* Full knowledge for some artifacts */
266 if (object_is_artifact(o_ptr)) spoil = TRUE;
267 #endif /* SPOIL_ARTIFACTS */
269 #ifdef SPOIL_EGO_ITEMS
270 /* Full knowledge for some ego-items */
271 if (object_is_ego(o_ptr)) spoil = TRUE;
272 #endif /* SPOIL_EGO_ITEMS */
274 /* Need full knowledge or spoilers */
275 if (spoil || (o_ptr->ident & IDENT_MENTAL))
278 if (object_is_fixed_artifact(o_ptr))
280 artifact_type *a_ptr = &a_info[o_ptr->name1];
282 for (i = 0; i < TR_FLAG_SIZE; i++)
283 flgs[i] = a_ptr->flags[i];
286 /* Random artifact ! */
287 for (i = 0; i < TR_FLAG_SIZE; i++)
288 flgs[i] |= o_ptr->art_flags[i];
291 if (object_is_smith(o_ptr))
293 int add = o_ptr->xtra3 - 1;
295 if (add < TR_FLAG_MAX)
299 else if (add == ESSENCE_TMP_RES_ACID)
301 add_flag(flgs, TR_RES_ACID);
303 else if (add == ESSENCE_TMP_RES_ELEC)
305 add_flag(flgs, TR_RES_ELEC);
307 else if (add == ESSENCE_TMP_RES_FIRE)
309 add_flag(flgs, TR_RES_FIRE);
311 else if (add == ESSENCE_TMP_RES_COLD)
313 add_flag(flgs, TR_RES_COLD);
315 else if (add == ESSENCE_SH_FIRE)
317 add_flag(flgs, TR_RES_FIRE);
318 add_flag(flgs, TR_SH_FIRE);
320 else if (add == ESSENCE_SH_ELEC)
322 add_flag(flgs, TR_RES_ELEC);
323 add_flag(flgs, TR_SH_ELEC);
325 else if (add == ESSENCE_SH_COLD)
327 add_flag(flgs, TR_RES_COLD);
328 add_flag(flgs, TR_SH_COLD);
330 else if (add == ESSENCE_RESISTANCE)
332 add_flag(flgs, TR_RES_ACID);
333 add_flag(flgs, TR_RES_ELEC);
334 add_flag(flgs, TR_RES_FIRE);
335 add_flag(flgs, TR_RES_COLD);
341 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
342 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
343 * @return concptr 発動名称を返す文字列ポインタ
345 static concptr item_activation_dragon_breath(object_type *o_ptr)
347 static char desc[256];
348 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
351 object_flags(o_ptr, flgs);
352 strcpy(desc, _("", "breath "));
354 for (i = 0; dragonbreath_info[i].flag != 0; i++)
356 if (have_flag(flgs, dragonbreath_info[i].flag))
358 if (n > 0) strcat(desc, _("、", ", "));
359 strcat(desc, dragonbreath_info[i].name);
364 strcat(desc, _("のブレス(250)", ""));
370 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
371 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
372 * @return concptr 発動名称を返す文字列ポインタ
374 static concptr item_activation_aux(object_type *o_ptr)
376 static char activation_detail[256];
380 const activation_type* const act_ptr = find_activation_info(o_ptr);
382 if (!act_ptr) return _("未定義", "something undefined");
384 desc = act_ptr->desc;
386 /* Overwrite description if it is special */
387 switch (act_ptr->index) {
389 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
390 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
393 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
394 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
397 desc = item_activation_dragon_breath(o_ptr);
400 if (o_ptr->name1 == ART_HYOUSIGI)
401 desc = _("拍子木を打ちならす", "beat wooden clappers");
403 case ACT_RESIST_ACID:
404 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
405 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
407 case ACT_RESIST_FIRE:
408 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
409 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
411 case ACT_RESIST_COLD:
412 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
413 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
415 case ACT_RESIST_ELEC:
416 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
417 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
419 case ACT_RESIST_POIS:
420 if (o_ptr->name2 == EGO_BRAND_POIS)
421 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
425 /* Timeout description */
426 constant = act_ptr->timeout.constant;
427 dice = act_ptr->timeout.dice;
428 if (constant == 0 && dice == 0) {
429 /* We can activate it every turn */
430 strcpy(timeout, _("いつでも", "every turn"));
431 } else if (constant < 0) {
432 /* Activations that have special timeout */
433 switch (act_ptr->index) {
435 sprintf(timeout, _("%d ターン毎", "every %d turns"),
436 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
439 sprintf(timeout, _("%d ターン毎", "every %d turns"),
440 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
443 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
446 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
449 strcpy(timeout, "undefined");
453 /* Normal timeout activations */
454 char constant_str[16], dice_str[16];
455 sprintf(constant_str, "%d", constant);
456 sprintf(dice_str, "d%d", dice);
457 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
458 (constant > 0) ? constant_str : "",
459 (constant > 0 && dice > 0) ? "+" : "",
460 (dice > 0) ? dice_str : "");
463 /* Build detail activate description */
464 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
466 return activation_detail;
470 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
471 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
472 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
473 * @return concptr 発動名称を返す文字列ポインタ
475 concptr item_activation(object_type *o_ptr)
477 BIT_FLAGS flgs[TR_FLAG_SIZE];
478 object_flags(o_ptr, flgs);
480 /* Require activation ability */
481 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
483 /* Get an explain of an activation */
484 if (activation_index(o_ptr))
486 return item_activation_aux(o_ptr);
490 if (o_ptr->tval == TV_WHISTLE)
492 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
495 if (o_ptr->tval == TV_CAPTURE)
497 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
500 return _("何も起きない", "Nothing");
505 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
506 * Describe a "fully identified" item
507 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
508 * @param mode 表示オプション
509 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
511 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
515 BIT_FLAGS flgs[TR_FLAG_SIZE];
519 GAME_TEXT o_name[MAX_NLEN];
524 int trivial_info = 0;
525 object_flags(o_ptr, flgs);
527 /* Extract the description */
529 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
530 (k_text + k_info[o_ptr->k_idx].text),
531 77 - 15, temp, sizeof(temp));
532 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
533 { info[i] = &temp[j]; i++;}
536 if (object_is_equipment(o_ptr))
538 /* Descriptions of a basic equipment is just a flavor */
542 /* Mega-Hack -- describe activation */
543 if (have_flag(flgs, TR_ACTIVATE))
545 info[i++] = _("始動したときの効果...", "It can be activated for...");
546 info[i++] = item_activation(o_ptr);
547 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
550 /* Figurines, a hack */
551 if (o_ptr->tval == TV_FIGURINE)
553 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
556 /* Figurines, a hack */
557 if (o_ptr->name1 == ART_STONEMASK)
559 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you turn into a vampire permanently.");
562 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
564 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
567 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
569 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
570 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
573 if (o_ptr->name2 == EGO_2WEAPON)
575 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
578 if (have_flag(flgs, TR_EASY_SPELL))
580 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
583 if (o_ptr->name2 == EGO_AMU_FOOL)
585 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
588 if (o_ptr->name2 == EGO_RING_THROW)
590 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
593 if (o_ptr->name2 == EGO_AMU_NAIVETY)
595 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
598 if (o_ptr->tval == TV_STATUE)
600 monster_race *r_ptr = &r_info[o_ptr->pval];
602 if (o_ptr->pval == MON_BULLGATES)
603 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
604 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
605 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
607 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
610 /* Hack -- describe lite's */
612 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
615 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
616 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
617 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
618 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
619 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
620 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
622 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
624 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
626 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
630 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
631 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
634 if(rad != 0) info[i++] = desc;
637 if (o_ptr->name2 == EGO_LITE_LONG)
639 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
642 /* And then describe it fully */
644 if (have_flag(flgs, TR_RIDING))
646 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
647 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
650 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
651 /* This information is not important enough */
655 if (have_flag(flgs, TR_STR))
657 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
659 if (have_flag(flgs, TR_INT))
661 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
663 if (have_flag(flgs, TR_WIS))
665 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
667 if (have_flag(flgs, TR_DEX))
669 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
671 if (have_flag(flgs, TR_CON))
673 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
675 if (have_flag(flgs, TR_CHR))
677 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
680 if (have_flag(flgs, TR_MAGIC_MASTERY))
682 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
685 if (have_flag(flgs, TR_STEALTH))
687 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
689 if (have_flag(flgs, TR_SEARCH))
691 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
693 if (have_flag(flgs, TR_INFRA))
695 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
697 if (have_flag(flgs, TR_TUNNEL))
699 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
701 if (have_flag(flgs, TR_SPEED))
703 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
705 if (have_flag(flgs, TR_BLOWS))
707 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
710 if (have_flag(flgs, TR_BRAND_ACID))
712 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
714 if (have_flag(flgs, TR_BRAND_ELEC))
716 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
718 if (have_flag(flgs, TR_BRAND_FIRE))
720 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
722 if (have_flag(flgs, TR_BRAND_COLD))
724 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
727 if (have_flag(flgs, TR_BRAND_POIS))
729 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
732 if (have_flag(flgs, TR_CHAOTIC))
734 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
737 if (have_flag(flgs, TR_VAMPIRIC))
739 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
742 if (have_flag(flgs, TR_IMPACT))
744 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
747 if (have_flag(flgs, TR_VORPAL))
749 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
752 if (have_flag(flgs, TR_KILL_DRAGON))
754 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
756 else if (have_flag(flgs, TR_SLAY_DRAGON))
758 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
761 if (have_flag(flgs, TR_KILL_ORC))
763 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
765 if (have_flag(flgs, TR_SLAY_ORC))
767 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
770 if (have_flag(flgs, TR_KILL_TROLL))
772 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
774 if (have_flag(flgs, TR_SLAY_TROLL))
776 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
779 if (have_flag(flgs, TR_KILL_GIANT))
781 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
783 else if (have_flag(flgs, TR_SLAY_GIANT))
785 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
788 if (have_flag(flgs, TR_KILL_DEMON))
790 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
792 if (have_flag(flgs, TR_SLAY_DEMON))
794 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
797 if (have_flag(flgs, TR_KILL_UNDEAD))
799 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
801 if (have_flag(flgs, TR_SLAY_UNDEAD))
803 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
806 if (have_flag(flgs, TR_KILL_EVIL))
808 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
810 if (have_flag(flgs, TR_SLAY_EVIL))
812 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
815 if (have_flag(flgs, TR_KILL_ANIMAL))
817 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
819 if (have_flag(flgs, TR_SLAY_ANIMAL))
821 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
824 if (have_flag(flgs, TR_KILL_HUMAN))
826 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
828 if (have_flag(flgs, TR_SLAY_HUMAN))
830 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
833 if (have_flag(flgs, TR_FORCE_WEAPON))
835 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
837 if (have_flag(flgs, TR_DEC_MANA))
839 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
841 if (have_flag(flgs, TR_SUST_STR))
843 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
845 if (have_flag(flgs, TR_SUST_INT))
847 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
849 if (have_flag(flgs, TR_SUST_WIS))
851 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
853 if (have_flag(flgs, TR_SUST_DEX))
855 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
857 if (have_flag(flgs, TR_SUST_CON))
859 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
861 if (have_flag(flgs, TR_SUST_CHR))
863 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
866 if (have_flag(flgs, TR_IM_ACID))
868 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
870 if (have_flag(flgs, TR_IM_ELEC))
872 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
874 if (have_flag(flgs, TR_IM_FIRE))
876 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
878 if (have_flag(flgs, TR_IM_COLD))
880 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
883 if (have_flag(flgs, TR_THROW))
885 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
888 if (have_flag(flgs, TR_FREE_ACT))
890 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
892 if (have_flag(flgs, TR_HOLD_EXP))
894 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
896 if (have_flag(flgs, TR_RES_FEAR))
898 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
900 if (have_flag(flgs, TR_RES_ACID))
902 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
904 if (have_flag(flgs, TR_RES_ELEC))
906 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
908 if (have_flag(flgs, TR_RES_FIRE))
910 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
912 if (have_flag(flgs, TR_RES_COLD))
914 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
916 if (have_flag(flgs, TR_RES_POIS))
918 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
921 if (have_flag(flgs, TR_RES_LITE))
923 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
925 if (have_flag(flgs, TR_RES_DARK))
927 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
930 if (have_flag(flgs, TR_RES_BLIND))
932 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
934 if (have_flag(flgs, TR_RES_CONF))
936 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
938 if (have_flag(flgs, TR_RES_SOUND))
940 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
942 if (have_flag(flgs, TR_RES_SHARDS))
944 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
947 if (have_flag(flgs, TR_RES_NETHER))
949 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
951 if (have_flag(flgs, TR_RES_NEXUS))
953 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
955 if (have_flag(flgs, TR_RES_CHAOS))
957 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
959 if (have_flag(flgs, TR_RES_DISEN))
961 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
964 if (have_flag(flgs, TR_LEVITATION))
966 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
969 if (have_flag(flgs, TR_SEE_INVIS))
971 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
973 if (have_flag(flgs, TR_TELEPATHY))
975 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
977 if (have_flag(flgs, TR_ESP_ANIMAL))
979 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
981 if (have_flag(flgs, TR_ESP_UNDEAD))
983 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
985 if (have_flag(flgs, TR_ESP_DEMON))
987 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
989 if (have_flag(flgs, TR_ESP_ORC))
991 info[i++] = _("それはオークを感知する。", "It senses orcs.");
993 if (have_flag(flgs, TR_ESP_TROLL))
995 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
997 if (have_flag(flgs, TR_ESP_GIANT))
999 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1001 if (have_flag(flgs, TR_ESP_DRAGON))
1003 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1005 if (have_flag(flgs, TR_ESP_HUMAN))
1007 info[i++] = _("それは人間を感知する。", "It senses humans.");
1009 if (have_flag(flgs, TR_ESP_EVIL))
1011 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1013 if (have_flag(flgs, TR_ESP_GOOD))
1015 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1017 if (have_flag(flgs, TR_ESP_NONLIVING))
1019 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1021 if (have_flag(flgs, TR_ESP_UNIQUE))
1023 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1025 if (have_flag(flgs, TR_SLOW_DIGEST))
1027 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1029 if (have_flag(flgs, TR_REGEN))
1031 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1033 if (have_flag(flgs, TR_WARNING))
1035 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1037 if (have_flag(flgs, TR_REFLECT))
1039 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1041 if (have_flag(flgs, TR_SH_FIRE))
1043 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1045 if (have_flag(flgs, TR_SH_ELEC))
1047 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1049 if (have_flag(flgs, TR_SH_COLD))
1051 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1053 if (have_flag(flgs, TR_NO_MAGIC))
1055 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1057 if (have_flag(flgs, TR_NO_TELE))
1059 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1061 if (have_flag(flgs, TR_XTRA_MIGHT))
1063 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1065 if (have_flag(flgs, TR_XTRA_SHOTS))
1067 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1070 if (have_flag(flgs, TR_BLESSED))
1072 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1075 if (object_is_cursed(o_ptr))
1077 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1079 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1081 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1083 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1087 info[i++] = _("それは呪われている。", "It is cursed.");
1090 * It's a trivial infomation since there is
1091 * fake inscription {cursed}
1097 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1099 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1101 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1103 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1105 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1107 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1109 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1111 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1113 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1115 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1117 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1119 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1121 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1123 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1125 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1127 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1129 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1131 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1133 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1135 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1137 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1139 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1141 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1143 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1145 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1147 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1149 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1151 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1153 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1155 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1157 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1159 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1161 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1163 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1165 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1167 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1170 /* Describe about this kind of object instead of THIS fake object */
1171 if (mode & SCROBJ_FAKE_OBJECT)
1173 switch (o_ptr->tval)
1176 switch (o_ptr->sval)
1178 case SV_RING_LORDLY:
1179 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1181 case SV_RING_WARNING:
1182 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1188 switch (o_ptr->sval)
1190 case SV_AMULET_RESISTANCE:
1191 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1192 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1194 case SV_AMULET_THE_MAGI:
1195 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1202 if (have_flag(flgs, TR_IGNORE_ACID) &&
1203 have_flag(flgs, TR_IGNORE_ELEC) &&
1204 have_flag(flgs, TR_IGNORE_FIRE) &&
1205 have_flag(flgs, TR_IGNORE_COLD))
1207 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1211 if (have_flag(flgs, TR_IGNORE_ACID))
1213 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1215 if (have_flag(flgs, TR_IGNORE_ELEC))
1217 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1219 if (have_flag(flgs, TR_IGNORE_FIRE))
1221 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1223 if (have_flag(flgs, TR_IGNORE_COLD))
1225 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1229 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1231 /* No relevant informations */
1232 if (i <= trivial_info) return (FALSE);
1235 Term_get_size(&wid, &hgt);
1237 /* Display Item name */
1238 if (!(mode & SCROBJ_FAKE_OBJECT))
1239 object_desc(o_name, o_ptr, 0);
1241 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1245 /* Erase the screen */
1246 for (k = 1; k < hgt; k++) prt("", k, 13);
1248 /* Label the information */
1249 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1251 monster_race *r_ptr = &r_info[o_ptr->pval];
1252 int namelen = strlen(r_name + r_ptr->name);
1253 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1254 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1255 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1259 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1262 /* We will print on top of the map (column 13) */
1263 for (k = 2, j = 0; j < i; j++)
1266 prt(info[j], k++, 15);
1268 /* Every 20 entries (lines 2 to 21), start over */
1269 if ((k == hgt - 2) && (j+1 < i))
1271 prt(_("-- 続く --", "-- more --"), k, 15);
1273 for (; k > 2; k--) prt("", k, 15);
1278 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1283 /* Gave knowledge */
1290 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1291 * Convert an inventory index into a one character label
1292 * @param i プレイヤーの所持/装備オブジェクトID
1293 * @return 対応するアルファベット
1294 * @details Note that the label does NOT distinguish inven/equip.
1296 char index_to_label(int i)
1298 /* Indexes for "inven" are easy */
1299 if (i < INVEN_RARM) return (I2A(i));
1301 /* Indexes for "equip" are offset */
1302 return (I2A(i - INVEN_RARM));
1306 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1307 * Convert a label into the index of an item in the "inven"
1308 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1309 * @details Note that the label does NOT distinguish inven/equip.
1311 INVENTORY_IDX label_to_inven(int c)
1316 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1318 /* Verify the index */
1319 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1321 /* Empty slots can never be chosen */
1322 if (!inventory[i].k_idx) return (-1);
1324 /* Return the index */
1330 extern bool select_ring_slot;
1334 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1335 * @param i プレイヤーの所持/装備オブジェクトID
1336 * @return 指輪枠ならばTRUEを返す。
1338 static bool is_ring_slot(int i)
1340 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1345 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1346 * Convert a label into the index of a item in the "equip"
1347 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1349 INVENTORY_IDX label_to_equip(int c)
1354 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1356 /* Verify the index */
1357 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1359 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1361 /* Empty slots can never be chosen */
1362 if (!inventory[i].k_idx) return (-1);
1364 /* Return the index */
1371 * @brief オブジェクトの該当装備部位IDを返す /
1372 * Determine which equipment slot (if any) an item likes
1373 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1374 * @return 対応する装備部位ID
1376 s16b wield_slot(object_type *o_ptr)
1378 /* Slot for equipment */
1379 switch (o_ptr->tval)
1386 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1387 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1388 return (INVEN_LARM);
1395 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1396 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1397 return (INVEN_RARM);
1407 /* Use the right hand first */
1408 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1410 /* Use the left hand for swapping (by default) */
1411 return (INVEN_LEFT);
1417 return (INVEN_NECK);
1422 return (INVEN_LITE);
1429 return (INVEN_BODY);
1434 return (INVEN_OUTER);
1440 return (INVEN_HEAD);
1445 return (INVEN_HANDS);
1450 return (INVEN_FEET);
1454 /* No slot available */
1459 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1460 * Return a string mentioning how a given item is carried
1461 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1462 * @return 部位表現の文字列ポインタ
1464 concptr mention_use(int i)
1468 /* Examine the location */
1472 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1474 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1478 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1480 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1483 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1484 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1485 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1486 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1487 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1488 case INVEN_BODY: p = _(" 体", "On body"); break;
1489 case INVEN_OUTER: p = _("体の上", "About body"); break;
1490 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1491 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1492 case INVEN_FEET: p = _(" 足", "On feet"); break;
1493 default: p = _("ザック", "In pack"); break;
1496 /* Return the result */
1502 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1503 * Return a string describing how a given item is being worn.
1504 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1505 * @return 状態表現内容の文字列ポインタ
1507 * Currently, only used for items in the equipment, not inventory.
1509 concptr describe_use(int i)
1516 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1518 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1522 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1524 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1527 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1528 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1529 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1530 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1531 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1532 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1533 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1534 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1535 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1536 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1537 default: p = _("ザックに入っている", "carrying in your pack"); break;
1540 /* Return the result */
1546 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1547 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1548 * @param book_tval ベースアイテムのtval
1549 * @param book_sval ベースアイテムのsval
1550 * @return 使用可能な魔法書ならばTRUEを返す。
1553 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1555 if (book_tval < TV_LIFE_BOOK) return FALSE;
1556 if (p_ptr->pclass == CLASS_SORCERER)
1558 return is_magic(tval2realm(book_tval));
1560 else if (p_ptr->pclass == CLASS_RED_MAGE)
1562 if (is_magic(tval2realm(book_tval)))
1563 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1565 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1569 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1570 * Check an item against the item tester info
1571 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1572 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1574 bool item_tester_okay(object_type *o_ptr)
1576 /* Hack -- allow listing empty slots */
1577 // if (item_tester_full) return (TRUE); // TODO:DELETE
1579 /* Require an item */
1580 if (!o_ptr->k_idx) return (FALSE);
1582 /* Hack -- ignore "gold" */
1583 if (o_ptr->tval == TV_GOLD)
1586 extern bool show_gold_on_floor;
1588 if (!show_gold_on_floor) return (FALSE);
1591 /* Check the tval */
1592 if (item_tester_tval)
1594 /* Is it a spellbook? If so, we need a hack -- TY */
1595 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1596 (item_tester_tval >= TV_LIFE_BOOK))
1597 return check_book_realm(o_ptr->tval, o_ptr->sval);
1599 if (item_tester_tval != o_ptr->tval) return (FALSE);
1602 /* Check the hook */
1603 if (item_tester_hook)
1605 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1614 * @brief 所持アイテム一覧を表示する /
1615 * Choice window "shadow" of the "show_inven()" function
1618 void display_inven(void)
1620 register int i, n, z = 0;
1622 TERM_COLOR attr = TERM_WHITE;
1624 GAME_TEXT o_name[MAX_NLEN];
1627 Term_get_size(&wid, &hgt);
1629 /* Find the "final" slot */
1630 for (i = 0; i < INVEN_PACK; i++)
1632 o_ptr = &inventory[i];
1634 /* Skip non-objects */
1635 if (!o_ptr->k_idx) continue;
1641 /* Display the pack */
1642 for (i = 0; i < z; i++)
1644 /* Examine the item */
1645 o_ptr = &inventory[i];
1647 /* Start with an empty "index" */
1648 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1650 /* Is this item "acceptable"? */
1651 if (item_tester_okay(o_ptr))
1653 /* Prepare an "index" */
1654 tmp_val[0] = index_to_label(i);
1656 /* Bracket the "index" --(-- */
1660 /* Display the index (or blank space) */
1661 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1663 /* Obtain an item description */
1664 object_desc(o_name, o_ptr, 0);
1666 /* Obtain the length of the description */
1670 attr = tval_to_attr[o_ptr->tval % 128];
1672 /* Grey out charging items */
1678 /* Display the entry itself */
1679 Term_putstr(3, i, n, attr, o_name);
1681 /* Erase the rest of the line */
1682 Term_erase(3+n, i, 255);
1684 /* Display the weight if needed */
1687 int wgt = o_ptr->weight * o_ptr->number;
1689 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1691 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1694 prt(tmp_val, i, wid - 9);
1698 /* Erase the rest of the window */
1699 for (i = z; i < hgt; i++)
1701 /* Erase the line */
1702 Term_erase(0, i, 255);
1709 * @brief 装備アイテム一覧を表示する /
1710 * Choice window "shadow" of the "show_equip()" function
1713 void display_equip(void)
1717 TERM_COLOR attr = TERM_WHITE;
1719 GAME_TEXT o_name[MAX_NLEN];
1722 Term_get_size(&wid, &hgt);
1724 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1726 /* Examine the item */
1727 o_ptr = &inventory[i];
1729 /* Start with an empty "index" */
1730 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1732 /* Is this item "acceptable"? */
1733 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1735 /* Prepare an "index" */
1736 tmp_val[0] = index_to_label(i);
1738 /* Bracket the "index" --(-- */
1742 /* Display the index (or blank space) */
1743 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1745 /* Obtain an item description */
1746 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1748 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1753 object_desc(o_name, o_ptr, 0);
1754 attr = tval_to_attr[o_ptr->tval % 128];
1757 /* Obtain the length of the description */
1760 /* Grey out charging items */
1766 /* Display the entry itself */
1767 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1769 /* Erase the rest of the line */
1770 Term_erase(3+n, i - INVEN_RARM, 255);
1772 /* Display the weight (if needed) */
1775 int wgt = o_ptr->weight * o_ptr->number;
1777 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1779 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1782 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1785 /* Display the slot description (if needed) */
1788 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1789 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1793 /* Erase the rest of the window */
1794 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1796 /* Clear that line */
1797 Term_erase(0, i, 255);
1803 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1804 * Find the "first" inventory object with the given "tag".
1805 * @param cp 対応するタグIDを与える参照ポインタ
1806 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1807 * @param mode 所持、装備の切り替え
1808 * @return タグに該当するオブジェクトがあるならTRUEを返す
1810 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1811 * inscription of an object. Alphabetical characters don't work as a\n
1812 * tag in this form.\n
1814 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1815 * and "x" is the "current" command_cmd code.\n
1817 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1820 COMMAND_CODE start, end;
1823 /* Extract index from mode */
1828 end = INVEN_TOTAL - 1;
1833 end = INVEN_PACK - 1;
1840 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1842 /* Check every inventory object */
1843 for (i = start; i <= end; i++)
1845 object_type *o_ptr = &inventory[i];
1847 /* Skip non-objects */
1848 if (!o_ptr->k_idx) continue;
1850 /* Skip empty inscriptions */
1851 if (!o_ptr->inscription) continue;
1853 /* Skip non-choice */
1854 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1857 s = my_strchr(quark_str(o_ptr->inscription), '@');
1859 /* Process all tags */
1862 /* Check the special tags */
1863 if ((s[1] == command_cmd) && (s[2] == tag))
1865 /* Save the actual inventory ID */
1872 /* Find another '@' */
1873 s = my_strchr(s + 1, '@');
1878 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1880 /* Don't allow {@#} with '#' being alphabet */
1881 if (tag < '0' || '9' < tag)
1887 /* Check every object */
1888 for (i = start; i <= end; i++)
1890 object_type *o_ptr = &inventory[i];
1892 /* Skip non-objects */
1893 if (!o_ptr->k_idx) continue;
1895 /* Skip empty inscriptions */
1896 if (!o_ptr->inscription) continue;
1898 /* Skip non-choice */
1899 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1902 s = my_strchr(quark_str(o_ptr->inscription), '@');
1904 /* Process all tags */
1907 /* Check the normal tags */
1910 /* Save the actual inventory ID */
1917 /* Find another '@' */
1918 s = my_strchr(s + 1, '@');
1928 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1929 * Find the "first" inventory object with the given "tag".
1930 * @param cp 対応するタグIDを与える参照ポインタ
1931 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1932 * @param floor_list 床上アイテムの配列
1933 * @param floor_num 床上アイテムの配列ID
1934 * @return タグに該当するオブジェクトがあるならTRUEを返す
1936 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1937 * inscription of an object. Alphabetical characters don't work as a\n
1938 * tag in this form.\n
1940 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1941 * and "x" is the "current" command_cmd code.\n
1943 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1948 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1950 /* Check every object in the grid */
1951 for (i = 0; i < floor_num && i < 23; i++)
1953 object_type *o_ptr = &o_list[floor_list[i]];
1955 /* Skip empty inscriptions */
1956 if (!o_ptr->inscription) continue;
1959 s = my_strchr(quark_str(o_ptr->inscription), '@');
1961 /* Process all tags */
1964 /* Check the special tags */
1965 if ((s[1] == command_cmd) && (s[2] == tag))
1967 /* Save the actual floor object ID */
1974 /* Find another '@' */
1975 s = my_strchr(s + 1, '@');
1980 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1982 /* Don't allow {@#} with '#' being alphabet */
1983 if (tag < '0' || '9' < tag)
1989 /* Check every object in the grid */
1990 for (i = 0; i < floor_num && i < 23; i++)
1992 object_type *o_ptr = &o_list[floor_list[i]];
1994 /* Skip empty inscriptions */
1995 if (!o_ptr->inscription) continue;
1998 s = my_strchr(quark_str(o_ptr->inscription), '@');
2000 /* Process all tags */
2003 /* Check the normal tags */
2006 /* Save the floor object ID */
2013 /* Find another '@' */
2014 s = my_strchr(s + 1, '@');
2024 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2025 * Move around label characters with correspond tags
2026 * @param label ラベルリストを取得する文字列参照ポインタ
2027 * @param mode 所持品リストか装備品リストかの切り替え
2030 static void prepare_label_string(char *label, BIT_FLAGS mode)
2032 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2033 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2036 /* Prepare normal labels */
2037 strcpy(label, alphabet_chars);
2039 /* Move each label */
2040 for (i = 0; i < 52; i++)
2043 SYMBOL_CODE c = alphabet_chars[i];
2045 /* Find a tag with this label */
2046 if (get_tag(&index, c, mode))
2048 /* Delete the overwritten label */
2049 if (label[i] == c) label[i] = ' ';
2051 /* Move the label to the place of corresponding tag */
2052 label[index - offset] = c;
2059 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2060 * Move around label characters with correspond tags (floor version)
2061 * @param label ラベルリストを取得する文字列参照ポインタ
2062 * @param floor_list 床上アイテムの配列
2063 * @param floor_num 床上アイテムの配列ID
2068 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2070 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2073 /* Prepare normal labels */
2074 strcpy(label, alphabet_chars);
2076 /* Move each label */
2077 for (i = 0; i < 52; i++)
2080 SYMBOL_CODE c = alphabet_chars[i];
2082 /* Find a tag with this label */
2083 if (get_tag_floor(&index, c, floor_list, floor_num))
2085 /* Delete the overwritten label */
2086 if (label[i] == c) label[i] = ' ';
2088 /* Move the label to the place of corresponding tag */
2096 * @brief 所持アイテムの表示を行う /
2097 * Display the inventory.
2098 * @param target_item アイテムの選択処理を行うか否か。
2099 * @return 選択したアイテムのタグ
2101 * Hack -- do not display "trailing" empty slots
2103 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2107 int col, cur_col, len;
2109 GAME_TEXT o_name[MAX_NLEN];
2111 COMMAND_CODE out_index[23];
2112 TERM_COLOR out_color[23];
2113 char out_desc[23][MAX_NLEN];
2114 COMMAND_CODE target_item_label = 0;
2116 char inven_label[52 + 1];
2118 /* Starting column */
2121 Term_get_size(&wid, &hgt);
2123 /* Default "max-length" */
2124 len = wid - col - 1;
2127 /* Find the "final" slot */
2128 for (i = 0; i < INVEN_PACK; i++)
2130 o_ptr = &inventory[i];
2132 /* Skip non-objects */
2133 if (!o_ptr->k_idx) continue;
2139 prepare_label_string(inven_label, USE_INVEN);
2141 /* Display the inventory */
2142 for (k = 0, i = 0; i < z; i++)
2144 o_ptr = &inventory[i];
2146 /* Is this item acceptable? */
2147 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2149 object_desc(o_name, o_ptr, 0);
2151 /* Save the object index, color, and description */
2153 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2155 /* Grey out charging items */
2158 out_color[k] = TERM_L_DARK;
2161 (void)strcpy(out_desc[k], o_name);
2163 /* Find the predicted "line length" */
2164 l = strlen(out_desc[k]) + 5;
2166 /* Be sure to account for the weight */
2167 if (show_weights) l += 9;
2169 /* Account for icon if displayed */
2170 if (show_item_graph)
2173 if (use_bigtile) l++;
2176 /* Maintain the maximum length */
2177 if (l > len) len = l;
2179 /* Advance to next "line" */
2183 /* Find the column to start in */
2184 col = (len > wid - 4) ? 0 : (wid - len - 1);
2186 /* Output each entry */
2187 for (j = 0; j < k; j++)
2192 o_ptr = &inventory[i];
2194 /* Clear the line */
2195 prt("", j + 1, col ? col - 2 : col);
2197 if (use_menu && target_item)
2199 if (j == (target_item-1))
2201 strcpy(tmp_val, _("》", "> "));
2202 target_item_label = i;
2204 else strcpy(tmp_val, " ");
2206 else if (i <= INVEN_PACK)
2208 /* Prepare an index --(-- */
2209 sprintf(tmp_val, "%c)", inven_label[i]);
2213 /* Prepare an index --(-- */
2214 sprintf(tmp_val, "%c)", index_to_label(i));
2217 /* Clear the line with the (possibly indented) index */
2218 put_str(tmp_val, j + 1, col);
2222 /* Display graphics for object, if desired */
2223 if (show_item_graph)
2225 TERM_COLOR a = object_attr(o_ptr);
2226 SYMBOL_CODE c = object_char(o_ptr);
2227 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2228 if (use_bigtile) cur_col++;
2234 /* Display the entry itself */
2235 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2237 /* Display the weight if needed */
2240 int wgt = o_ptr->weight * o_ptr->number;
2242 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2244 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2247 prt(tmp_val, j + 1, wid - 9);
2251 /* Make a "shadow" below the list (only if needed) */
2252 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2254 /* Save the new column */
2257 return target_item_label;
2262 * @brief 装備アイテムの表示を行う /
2263 * Display the equipment.
2264 * @param target_item アイテムの選択処理を行うか否か。
2265 * @return 選択したアイテムのタグ
2267 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2271 int col, cur_col, len;
2274 GAME_TEXT o_name[MAX_NLEN];
2275 COMMAND_CODE out_index[23];
2276 TERM_COLOR out_color[23];
2277 char out_desc[23][MAX_NLEN];
2278 COMMAND_CODE target_item_label = 0;
2280 char equip_label[52 + 1];
2282 /* Starting column */
2285 Term_get_size(&wid, &hgt);
2287 /* Maximal length */
2288 len = wid - col - 1;
2291 /* Scan the equipment list */
2292 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2294 o_ptr = &inventory[i];
2296 /* Is this item acceptable? */
2297 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2298 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2299 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2301 object_desc(o_name, o_ptr, 0);
2303 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2305 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2306 out_color[k] = TERM_WHITE;
2310 (void)strcpy(out_desc[k], o_name);
2311 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2315 /* Grey out charging items */
2318 out_color[k] = TERM_L_DARK;
2321 /* Extract the maximal length (see below) */
2323 l = strlen(out_desc[k]) + (2 + 1);
2325 l = strlen(out_desc[k]) + (2 + 3);
2329 /* Increase length for labels (if needed) */
2331 if (show_labels) l += (7 + 2);
2333 if (show_labels) l += (14 + 2);
2337 /* Increase length for weight (if needed) */
2338 if (show_weights) l += 9;
2340 if (show_item_graph) l += 2;
2342 /* Maintain the max-length */
2343 if (l > len) len = l;
2345 /* Advance the entry */
2349 /* Hack -- Find a column to start in */
2351 col = (len > wid - 6) ? 0 : (wid - len - 1);
2353 col = (len > wid - 4) ? 0 : (wid - len - 1);
2356 prepare_label_string(equip_label, USE_EQUIP);
2358 /* Output each entry */
2359 for (j = 0; j < k; j++)
2364 o_ptr = &inventory[i];
2366 /* Clear the line */
2367 prt("", j + 1, col ? col - 2 : col);
2369 if (use_menu && target_item)
2371 if (j == (target_item-1))
2373 strcpy(tmp_val, _("》", "> "));
2374 target_item_label = i;
2376 else strcpy(tmp_val, " ");
2378 else if (i >= INVEN_RARM)
2380 /* Prepare an index --(-- */
2381 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2385 /* Prepare an index --(-- */
2386 sprintf(tmp_val, "%c)", index_to_label(i));
2389 /* Clear the line with the (possibly indented) index */
2390 put_str(tmp_val, j+1, col);
2394 /* Display graphics for object, if desired */
2395 if (show_item_graph)
2397 TERM_COLOR a = object_attr(o_ptr);
2398 SYMBOL_CODE c = object_char(o_ptr);
2399 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2400 if (use_bigtile) cur_col++;
2408 /* Mention the use */
2409 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2411 put_str(tmp_val, j+1, cur_col);
2413 /* Display the entry itself */
2414 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2420 /* Display the entry itself */
2421 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2424 /* Display the weight if needed */
2427 int wgt = o_ptr->weight * o_ptr->number;
2429 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2431 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2434 prt(tmp_val, j + 1, wid - 9);
2438 /* Make a "shadow" below the list (only if needed) */
2439 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2441 /* Save the new column */
2444 return target_item_label;
2448 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2449 * Flip "inven" and "equip" in any sub-windows
2452 void toggle_inven_equip(void)
2457 for (j = 0; j < 8; j++)
2460 if (!angband_term[j]) continue;
2462 /* Flip inven to equip */
2463 if (window_flag[j] & (PW_INVEN))
2466 window_flag[j] &= ~(PW_INVEN);
2467 window_flag[j] |= (PW_EQUIP);
2469 p_ptr->window |= (PW_EQUIP);
2472 /* Flip inven to equip */
2473 else if (window_flag[j] & (PW_EQUIP))
2476 window_flag[j] &= ~(PW_EQUIP);
2477 window_flag[j] |= (PW_INVEN);
2479 p_ptr->window |= (PW_INVEN);
2485 * @brief 選択したアイテムの確認処理の補助 /
2486 * Verify the choice of an item.
2487 * @param prompt メッセージ表示の一部
2488 * @param item 選択アイテムID
2489 * @return 確認がYesならTRUEを返す。
2490 * @details The item can be negative to mean "item on floor".
2492 static bool verify(concptr prompt, INVENTORY_IDX item)
2494 GAME_TEXT o_name[MAX_NLEN];
2495 char out_val[MAX_NLEN+20];
2502 o_ptr = &inventory[item];
2508 o_ptr = &o_list[0 - item];
2510 object_desc(o_name, o_ptr, 0);
2513 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2516 return (get_check(out_val));
2521 * @brief 選択したアイテムの確認処理のメインルーチン /
2522 * @param item 選択アイテムID
2523 * @return 確認がYesならTRUEを返す。
2524 * @details The item can be negative to mean "item on floor".
2525 * Hack -- allow user to "prevent" certain choices
2527 static bool get_item_allow(INVENTORY_IDX item)
2531 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2536 o_ptr = &inventory[item];
2542 o_ptr = &o_list[0 - item];
2545 /* No inscription */
2546 if (!o_ptr->inscription) return (TRUE);
2549 s = my_strchr(quark_str(o_ptr->inscription), '!');
2551 /* Process preventions */
2554 /* Check the "restriction" */
2555 if ((s[1] == command_cmd) || (s[1] == '*'))
2557 /* Verify the choice */
2558 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2561 /* Find another '!' */
2562 s = my_strchr(s + 1, '!');
2571 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2572 * Auxiliary function for "get_item()" -- test an index
2574 * @return 正規のIDならばTRUEを返す。
2576 static bool get_item_okay(OBJECT_IDX i)
2579 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2581 if (select_ring_slot) return is_ring_slot(i);
2583 /* Verify the item */
2584 if (!item_tester_okay(&inventory[i])) return (FALSE);
2591 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2592 * Determine whether get_item() can get some item or not
2593 * @return アイテムを拾えるならばTRUEを返す。
2594 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2596 bool can_get_item(void)
2599 OBJECT_IDX floor_list[23];
2600 ITEM_NUMBER floor_num = 0;
2602 for (j = 0; j < INVEN_TOTAL; j++)
2603 if (item_tester_okay(&inventory[j]))
2606 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2614 * @brief オブジェクト選択の汎用関数 /
2615 * Let the user select an item, save its "index"
2616 * @param cp 選択したオブジェクトのIDを返す。
2617 * @param pmt 選択目的のメッセージ
2618 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2619 * @param mode オプションフラグ
2620 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2621 * Return TRUE only if an acceptable item was chosen by the user.\n
2623 * The selected item must satisfy the "item_tester_hook()" function,\n
2624 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2626 * All "item_tester" restrictions are cleared before this function returns.\n
2628 * The user is allowed to choose acceptable items from the equipment,\n
2629 * inventory, or floor, respectively, if the proper flag was given,\n
2630 * and there are any acceptable items in that location.\n
2632 * The equipment or inventory are displayed (even if no acceptable\n
2633 * items are in that location) if the proper flag was given.\n
2635 * If there are no acceptable items available anywhere, and "str" is\n
2636 * not NULL, then it will be used as the text of a warning message\n
2637 * before the function returns.\n
2639 * Note that the user must press "-" to specify the item on the floor,\n
2640 * and there is no way to "examine" the item on the floor, while the\n
2641 * use of "capital" letters will "examine" an inventory/equipment item,\n
2642 * and prompt for its use.\n
2644 * If a legal item is selected from the inventory, we save it in "cp"\n
2645 * directly (0 to 35), and return TRUE.\n
2647 * If a legal item is selected from the floor, we save it in "cp" as\n
2648 * a negative (-1 to -511), and return TRUE.\n
2650 * If no item is available, we do nothing to "cp", and we display a\n
2651 * warning message, using "str" if available, and return FALSE.\n
2653 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2655 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2656 * to allow the user to enter a command while viewing those screens, and\n
2657 * also to induce "auto-enter" of stores, and other such stuff.\n
2659 * Global "p_ptr->command_see" may be set before calling this function to start\n
2660 * out in "browse" mode. It is cleared before this function returns.\n
2662 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2663 * If it is TRUE then we are viewing inventory, else equipment.\n
2665 * We always erase the prompt when we are done, leaving a blank line,\n
2666 * or a warning message, if appropriate, if no items are available.\n
2668 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2670 OBJECT_IDX this_o_idx, next_o_idx = 0;
2687 bool allow_floor = FALSE;
2689 bool toggle = FALSE;
2694 int menu_line = (use_menu ? 1 : 0);
2698 static char prev_tag = '\0';
2699 char cur_tag = '\0';
2701 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2704 if (mode & USE_EQUIP) equip = TRUE;
2705 if (mode & USE_INVEN) inven = TRUE;
2706 if (mode & USE_FLOOR) floor = TRUE;
2708 /* Get the item index */
2709 if (repeat_pull(cp))
2712 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2714 item_tester_tval = 0;
2715 item_tester_hook = NULL;
2716 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2721 else if (floor && (*cp < 0))
2729 /* Validate the item */
2730 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2732 /* Forget restrictions */
2733 item_tester_tval = 0;
2734 item_tester_hook = NULL;
2735 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2742 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2743 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2745 if (prev_tag && command_cmd)
2747 /* Look up the tag and validate the item */
2748 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2749 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2750 else if (!get_item_okay(k)) /* Reject */;
2753 /* Accept that choice */
2756 /* Forget restrictions */
2757 item_tester_tval = 0;
2758 item_tester_hook = NULL;
2759 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2765 prev_tag = '\0'; /* prev_tag is no longer effective */
2768 /* Verify the item */
2769 else if (get_item_okay(*cp))
2771 /* Forget restrictions */
2772 item_tester_tval = 0;
2773 item_tester_hook = NULL;
2774 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2788 /* No item selected */
2792 /* Full inventory */
2794 i2 = INVEN_PACK - 1;
2796 /* Forbid inventory */
2797 if (!inven) i2 = -1;
2800 for (j = 0; j < INVEN_PACK; j++)
2801 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
2804 /* Restrict inventory indexes */
2805 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2806 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2809 /* Full equipment */
2811 e2 = INVEN_TOTAL - 1;
2813 /* Forbid equipment */
2814 if (!equip) e2 = -1;
2817 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2818 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
2819 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2822 /* Restrict equipment indexes */
2823 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2824 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2826 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2830 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2832 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2836 /* Restrict floor usage */
2839 /* Scan all objects in the grid */
2840 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2843 o_ptr = &o_list[this_o_idx];
2845 /* Acquire next object */
2846 next_o_idx = o_ptr->next_o_idx;
2848 /* Accept the item on the floor if legal */
2849 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2853 /* Require at least one legal choice */
2854 if (!allow_floor && (i1 > i2) && (e1 > e2))
2856 /* Cancel p_ptr->command_see */
2857 command_see = FALSE;
2861 if (mode & USE_FORCE) {
2867 /* Analyze choices */
2870 /* Hack -- Start on equipment if requested */
2871 if (command_see && command_wrk && equip)
2876 /* Use inventory if allowed */
2879 command_wrk = FALSE;
2882 /* Use equipment if allowed */
2888 /* Use inventory for floor */
2891 command_wrk = FALSE;
2897 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2899 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2901 /* Hack -- start out in "display" mode */
2908 /* Repeat until done */
2911 COMMAND_CODE get_item_label = 0;
2918 for (j = 0; j < 8; j++)
2921 if (!angband_term[j]) continue;
2923 /* Count windows displaying inven */
2924 if (window_flag[j] & (PW_INVEN)) ni++;
2926 /* Count windows displaying equip */
2927 if (window_flag[j] & (PW_EQUIP)) ne++;
2930 /* Toggle if needed */
2931 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2934 toggle_inven_equip();
2940 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2943 /* Inventory screen */
2946 /* Redraw if needed */
2947 if (command_see) get_item_label = show_inven(menu_line, mode);
2950 /* Equipment screen */
2953 /* Redraw if needed */
2954 if (command_see) get_item_label = show_equip(menu_line, mode);
2957 /* Viewing inventory */
2960 /* Begin the prompt */
2961 sprintf(out_val, _("持ち物:", "Inven:"));
2963 /* Some legal items */
2964 if ((i1 <= i2) && !use_menu)
2966 /* Build the prompt */
2967 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2968 index_to_label(i1), index_to_label(i2));
2971 strcat(out_val, tmp_val);
2974 /* Indicate ability to "view" */
2975 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2978 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2981 /* Viewing equipment */
2984 /* Begin the prompt */
2985 sprintf(out_val, _("装備品:", "Equip:"));
2987 /* Some legal items */
2988 if ((e1 <= e2) && !use_menu)
2990 /* Build the prompt */
2991 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2992 index_to_label(e1), index_to_label(e2));
2995 strcat(out_val, tmp_val);
2998 /* Indicate ability to "view" */
2999 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3002 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
3005 /* Indicate legality of the "floor" item */
3006 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3007 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3009 /* Finish the prompt */
3010 strcat(out_val, " ESC");
3012 /* Build the prompt */
3013 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3015 /* Show the prompt */
3023 int max_line = (command_wrk ? max_equip : max_inven);
3039 menu_line += (max_line - 1);
3058 /* Verify legality */
3059 if (!inven || !equip)
3065 /* Hack -- Fix screen */
3072 /* Switch inven/equip */
3073 command_wrk = !command_wrk;
3074 max_line = (command_wrk ? max_equip : max_inven);
3075 if (menu_line > max_line) menu_line = max_line;
3077 /* Need to redraw */
3086 if (command_wrk == USE_FLOOR)
3089 (*cp) = -get_item_label;
3093 /* Validate the item */
3094 if (!get_item_okay(get_item_label))
3100 /* Allow player to "refuse" certain actions */
3101 if (!get_item_allow(get_item_label))
3107 /* Accept that choice */
3108 (*cp) = get_item_label;
3117 if (mode & USE_FORCE) {
3125 if (menu_line > max_line) menu_line -= max_line;
3146 command_see = FALSE;
3163 /* Verify legality */
3164 if (!inven || !equip)
3170 /* Hack -- Fix screen */
3177 /* Switch inven/equip */
3178 command_wrk = !command_wrk;
3180 /* Need to redraw */
3186 /* Use floor item */
3189 /* Scan all objects in the grid */
3190 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3193 o_ptr = &o_list[this_o_idx];
3195 /* Acquire next object */
3196 next_o_idx = o_ptr->next_o_idx;
3198 /* Validate the item */
3199 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3204 /* Verify the item (if required) */
3205 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3207 /* Allow player to "refuse" certain actions */
3208 if (!get_item_allow(k)) continue;
3210 /* Accept that choice */
3226 case '1': case '2': case '3':
3227 case '4': case '5': case '6':
3228 case '7': case '8': case '9':
3230 /* Look up the tag */
3231 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3237 /* Hack -- Validate the item */
3238 if ((k < INVEN_RARM) ? !inven : !equip)
3244 /* Validate the item */
3245 if (!get_item_okay(k))
3251 /* Allow player to "refuse" certain actions */
3252 if (!get_item_allow(k))
3258 /* Accept that choice */
3270 /* Choose "default" inventory item */
3273 k = ((i1 == i2) ? i1 : -1);
3276 /* Choose "default" equipment item */
3279 k = ((e1 == e2) ? e1 : -1);
3282 /* Validate the item */
3283 if (!get_item_okay(k))
3289 /* Allow player to "refuse" certain actions */
3290 if (!get_item_allow(k))
3296 /* Accept that choice */
3306 if (mode & USE_FORCE) {
3319 bool not_found = FALSE;
3321 /* Look up the alphabetical tag */
3322 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3327 /* Hack -- Validate the item */
3328 else if ((k < INVEN_RARM) ? !inven : !equip)
3333 /* Validate the item */
3334 else if (!get_item_okay(k))
3341 /* Accept that choice */
3349 /* Extract "query" setting */
3350 ver = isupper(which);
3351 which = (char)tolower(which);
3353 /* Convert letter to inventory index */
3356 if (which == '(') k = i1;
3357 else if (which == ')') k = i2;
3358 else k = label_to_inven(which);
3361 /* Convert letter to equipment index */
3364 if (which == '(') k = e1;
3365 else if (which == ')') k = e2;
3366 else k = label_to_equip(which);
3369 /* Validate the item */
3370 if (!get_item_okay(k))
3376 /* Verify the item */
3377 if (ver && !verify(_("本当に", "Try"), k))
3383 /* Allow player to "refuse" certain actions */
3384 if (!get_item_allow(k))
3390 /* Accept that choice */
3401 /* Fix the screen if necessary */
3406 /* Hack -- Cancel "display" */
3407 command_see = FALSE;
3411 /* Forget the item_tester_tval restriction */
3412 item_tester_tval = 0;
3414 /* Forget the item_tester_hook restriction */
3415 item_tester_hook = NULL;
3418 /* Clean up 'show choices' */
3419 /* Toggle again if needed */
3420 if (toggle) toggle_inven_equip();
3422 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3425 /* Clear the prompt line */
3428 /* Warning if needed */
3429 if (oops && str) msg_print(str);
3434 if (command_cmd) prev_tag = cur_tag;
3435 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3441 * Choose an item and get auto-picker entry from it.
3443 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3446 if (!get_item(&item, q, s, option)) return NULL;
3447 if (idx) *idx = item;
3449 if (item == INVEN_FORCE) return NULL;
3451 /* Get the item (in the pack) */
3452 else if (item >= 0) return &inventory[item];
3454 /* Get the item (on the floor) */
3455 else return &o_list[0 - item];
3460 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3461 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3462 * @param y 走査するフロアのY座標
3463 * @param x 走査するフロアのX座標
3464 * @param mode オプションフラグ
3465 * @return 対象のマスに落ちているアイテム数
3467 * Return a list of o_list[] indexes of items at the given cave
3468 * location. Valid flags are:
3470 * mode & 0x01 -- Item tester
3471 * mode & 0x02 -- Marked items only
3472 * mode & 0x04 -- Stop after first
3474 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3476 OBJECT_IDX this_o_idx, next_o_idx;
3478 ITEM_NUMBER num = 0;
3481 if (!in_bounds(y, x)) return 0;
3483 /* Scan all objects in the grid */
3484 for (this_o_idx = cave[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3487 o_ptr = &o_list[this_o_idx];
3489 /* Acquire next object */
3490 next_o_idx = o_ptr->next_o_idx;
3493 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3496 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3498 /* Accept this item */
3499 /* XXX Hack -- Enforce limit */
3501 items[num] = this_o_idx;
3506 if (mode & 0x04) break;
3513 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3514 * @param target_item カーソルの初期値
3515 * @param y 走査するフロアのY座標
3516 * @param x 走査するフロアのX座標
3517 * @param min_width 表示の長さ
3518 * @return 選択したアイテムの添え字
3521 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3529 GAME_TEXT o_name[MAX_NLEN];
3532 COMMAND_CODE out_index[23];
3533 TERM_COLOR out_color[23];
3534 char out_desc[23][MAX_NLEN];
3535 COMMAND_CODE target_item_label = 0;
3537 OBJECT_IDX floor_list[23];
3538 ITEM_NUMBER floor_num;
3540 char floor_label[52 + 1];
3542 bool dont_need_to_show_weights = TRUE;
3544 Term_get_size(&wid, &hgt);
3546 /* Default length */
3547 len = MAX((*min_width), 20);
3549 /* Scan for objects in the grid, using item_tester_okay() */
3550 floor_num = scan_floor(floor_list, y, x, 0x03);
3552 /* Display the floor objects */
3553 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3555 o_ptr = &o_list[floor_list[i]];
3557 object_desc(o_name, o_ptr, 0);
3559 /* Save the index */
3562 /* Acquire inventory color */
3563 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3565 /* Save the object description */
3566 strcpy(out_desc[k], o_name);
3568 /* Find the predicted "line length" */
3569 l = strlen(out_desc[k]) + 5;
3571 /* Be sure to account for the weight */
3572 if (show_weights) l += 9;
3574 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3576 /* Maintain the maximum length */
3577 if (l > len) len = l;
3579 /* Advance to next "line" */
3583 if (show_weights && dont_need_to_show_weights) len -= 9;
3588 /* Find the column to start in */
3589 col = (len > wid - 4) ? 0 : (wid - len - 1);
3591 prepare_label_string_floor(floor_label, floor_list, floor_num);
3593 /* Output each entry */
3594 for (j = 0; j < k; j++)
3597 m = floor_list[out_index[j]];
3601 /* Clear the line */
3602 prt("", j + 1, col ? col - 2 : col);
3604 if (use_menu && target_item)
3606 if (j == (target_item-1))
3608 strcpy(tmp_val, _("》", "> "));
3609 target_item_label = m;
3611 else strcpy(tmp_val, " ");
3615 /* Prepare an index --(-- */
3616 sprintf(tmp_val, "%c)", floor_label[j]);
3619 /* Clear the line with the (possibly indented) index */
3620 put_str(tmp_val, j + 1, col);
3622 /* Display the entry itself */
3623 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3625 /* Display the weight if needed */
3626 if (show_weights && (o_ptr->tval != TV_GOLD))
3628 int wgt = o_ptr->weight * o_ptr->number;
3630 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3632 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3635 prt(tmp_val, j + 1, wid - 9);
3639 /* Make a "shadow" below the list (only if needed) */
3640 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3642 return target_item_label;
3646 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3647 * Let the user select an item, save its "index"
3648 * @param cp 選択したオブジェクトのIDを返す。
3649 * @param pmt 選択目的のメッセージ
3650 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3651 * @param mode オプションフラグ
3652 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3654 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3656 char n1 = ' ', n2 = ' ', which = ' ';
3659 COMMAND_CODE i1, i2;
3660 COMMAND_CODE e1, e2;
3668 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3669 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3670 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3671 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3673 bool allow_equip = FALSE;
3674 bool allow_inven = FALSE;
3675 bool allow_floor = FALSE;
3677 bool toggle = FALSE;
3682 ITEM_NUMBER floor_num;
3683 OBJECT_IDX floor_list[23];
3685 TERM_LEN min_width = 0;
3687 int menu_line = (use_menu ? 1 : 0);
3691 static char prev_tag = '\0';
3692 char cur_tag = '\0';
3694 /* Get the item index */
3695 if (repeat_pull(cp))
3698 if (force && (*cp == INVEN_FORCE))
3700 item_tester_tval = 0;
3701 item_tester_hook = NULL;
3702 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3707 else if (floor && (*cp < 0))
3709 if (prev_tag && command_cmd)
3711 /* Scan all objects in the grid */
3712 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3714 /* Look up the tag */
3715 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3717 /* Accept that choice */
3718 (*cp) = 0 - floor_list[k];
3720 /* Forget restrictions */
3721 item_tester_tval = 0;
3722 item_tester_hook = NULL;
3723 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3729 prev_tag = '\0'; /* prev_tag is no longer effective */
3732 /* Validate the item */
3733 else if (item_tester_okay(&o_list[0 - (*cp)]) || (mode & USE_FULL))
3735 /* Forget restrictions */
3736 item_tester_tval = 0;
3737 item_tester_hook = NULL;
3738 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3745 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3746 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3748 if (prev_tag && command_cmd)
3750 /* Look up the tag and validate the item */
3751 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3752 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3753 else if (!get_item_okay(k)) /* Reject */;
3756 /* Accept that choice */
3759 /* Forget restrictions */
3760 item_tester_tval = 0;
3761 item_tester_hook = NULL;
3762 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3768 prev_tag = '\0'; /* prev_tag is no longer effective */
3771 /* Verify the item */
3772 else if (get_item_okay(*cp))
3774 /* Forget restrictions */
3775 item_tester_tval = 0;
3776 item_tester_hook = NULL;
3777 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3793 /* No item selected */
3797 /* Full inventory */
3799 i2 = INVEN_PACK - 1;
3801 /* Forbid inventory */
3802 if (!inven) i2 = -1;
3805 for (j = 0; j < INVEN_PACK; j++)
3806 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
3809 /* Restrict inventory indexes */
3810 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3811 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3814 /* Full equipment */
3816 e2 = INVEN_TOTAL - 1;
3818 /* Forbid equipment */
3819 if (!equip) e2 = -1;
3822 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3823 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
3824 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3827 /* Restrict equipment indexes */
3828 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3829 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3831 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3835 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3837 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3841 /* Count "okay" floor items */
3844 /* Restrict floor usage */
3847 /* Scan all objects in the grid */
3848 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3851 /* Accept inventory */
3852 if (i1 <= i2) allow_inven = TRUE;
3854 /* Accept equipment */
3855 if (e1 <= e2) allow_equip = TRUE;
3858 if (floor_num) allow_floor = TRUE;
3860 /* Require at least one legal choice */
3861 if (!allow_inven && !allow_equip && !allow_floor)
3863 /* Cancel p_ptr->command_see */
3864 command_see = FALSE;
3874 /* Analyze choices */
3877 /* Hack -- Start on equipment if requested */
3878 if (command_see && (command_wrk == (USE_EQUIP))
3881 command_wrk = (USE_EQUIP);
3884 /* Use inventory if allowed */
3885 else if (allow_inven)
3887 command_wrk = (USE_INVEN);
3890 /* Use equipment if allowed */
3891 else if (allow_equip)
3893 command_wrk = (USE_EQUIP);
3896 /* Use floor if allowed */
3897 else if (allow_floor)
3899 command_wrk = (USE_FLOOR);
3904 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3906 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3908 /* Hack -- start out in "display" mode */
3914 /* Repeat until done */
3917 COMMAND_CODE get_item_label = 0;
3924 for (j = 0; j < 8; j++)
3927 if (!angband_term[j]) continue;
3929 /* Count windows displaying inven */
3930 if (window_flag[j] & (PW_INVEN)) ni++;
3932 /* Count windows displaying equip */
3933 if (window_flag[j] & (PW_EQUIP)) ne++;
3936 /* Toggle if needed */
3937 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3938 (command_wrk == (USE_INVEN) && !ni && ne))
3941 toggle_inven_equip();
3947 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3950 /* Inventory screen */
3951 if (command_wrk == (USE_INVEN))
3953 /* Extract the legal requests */
3957 /* Redraw if needed */
3958 if (command_see) get_item_label = show_inven(menu_line, mode);
3961 /* Equipment screen */
3962 else if (command_wrk == (USE_EQUIP))
3964 /* Extract the legal requests */
3965 n1 = I2A(e1 - INVEN_RARM);
3966 n2 = I2A(e2 - INVEN_RARM);
3968 /* Redraw if needed */
3969 if (command_see) get_item_label = show_equip(menu_line, mode);
3973 else if (command_wrk == (USE_FLOOR))
3976 k = MIN(floor_top + 23, floor_num) - 1;
3978 /* Extract the legal requests */
3979 n1 = I2A(j - floor_top);
3980 n2 = I2A(k - floor_top);
3982 /* Redraw if needed */
3983 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3986 /* Viewing inventory */
3987 if (command_wrk == (USE_INVEN))
3989 /* Begin the prompt */
3990 sprintf(out_val, _("持ち物:", "Inven:"));
3994 /* Build the prompt */
3995 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3996 index_to_label(i1), index_to_label(i2));
3999 strcat(out_val, tmp_val);
4002 /* Indicate ability to "view" */
4003 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4009 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
4010 else if (allow_floor)
4011 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
4013 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4020 strcat(out_val, _(" '-'床上,", " - for floor,"));
4021 else if (allow_equip)
4022 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
4024 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4028 /* Viewing equipment */
4029 else if (command_wrk == (USE_EQUIP))
4031 /* Begin the prompt */
4032 sprintf(out_val, _("装備品:", "Equip:"));
4036 /* Build the prompt */
4037 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4038 index_to_label(e1), index_to_label(e2));
4041 strcat(out_val, tmp_val);
4044 /* Indicate ability to "view" */
4045 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4051 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4052 else if (allow_floor)
4053 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
4055 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4062 strcat(out_val, _(" '-'床上,", " - for floor,"));
4063 else if (allow_inven)
4064 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4066 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4071 else if (command_wrk == (USE_FLOOR))
4073 /* Begin the prompt */
4074 sprintf(out_val, _("床上:", "Floor:"));
4078 /* Build the prompt */
4079 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4082 strcat(out_val, tmp_val);
4085 /* Indicate ability to "view" */
4086 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4090 if (allow_inven && allow_equip)
4092 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4094 else if (allow_inven)
4096 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4098 else if (allow_equip)
4100 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4104 else if (allow_inven)
4106 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4108 else if (allow_equip)
4110 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4114 if (command_see && !use_menu)
4116 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4121 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4123 /* Finish the prompt */
4124 strcat(out_val, " ESC");
4126 /* Build the prompt */
4127 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4129 /* Show the prompt */
4138 if (command_wrk == USE_INVEN) max_line = max_inven;
4139 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4140 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4156 menu_line += (max_line - 1);
4172 /* Verify legality */
4173 if (command_wrk == (USE_INVEN))
4175 if (allow_floor) command_wrk = USE_FLOOR;
4176 else if (allow_equip) command_wrk = USE_EQUIP;
4183 else if (command_wrk == (USE_EQUIP))
4185 if (allow_inven) command_wrk = USE_INVEN;
4186 else if (allow_floor) command_wrk = USE_FLOOR;
4193 else if (command_wrk == (USE_FLOOR))
4195 if (allow_equip) command_wrk = USE_EQUIP;
4196 else if (allow_inven) command_wrk = USE_INVEN;
4209 /* Hack -- Fix screen */
4216 /* Switch inven/equip */
4217 if (command_wrk == USE_INVEN) max_line = max_inven;
4218 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4219 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4220 if (menu_line > max_line) menu_line = max_line;
4222 /* Need to redraw */
4230 /* Verify legality */
4231 if (command_wrk == (USE_INVEN))
4233 if (allow_equip) command_wrk = USE_EQUIP;
4234 else if (allow_floor) command_wrk = USE_FLOOR;
4241 else if (command_wrk == (USE_EQUIP))
4243 if (allow_floor) command_wrk = USE_FLOOR;
4244 else if (allow_inven) command_wrk = USE_INVEN;
4251 else if (command_wrk == (USE_FLOOR))
4253 if (allow_inven) command_wrk = USE_INVEN;
4254 else if (allow_equip) command_wrk = USE_EQUIP;
4267 /* Hack -- Fix screen */
4274 /* Switch inven/equip */
4275 if (command_wrk == USE_INVEN) max_line = max_inven;
4276 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4277 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4278 if (menu_line > max_line) menu_line = max_line;
4280 /* Need to redraw */
4289 if (command_wrk == USE_FLOOR)
4292 (*cp) = -get_item_label;
4296 /* Validate the item */
4297 if (!get_item_okay(get_item_label))
4303 /* Allow player to "refuse" certain actions */
4304 if (!get_item_allow(get_item_label))
4310 /* Accept that choice */
4311 (*cp) = get_item_label;
4328 if (menu_line > max_line) menu_line -= max_line;
4349 command_see = FALSE;
4370 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
4372 if (command_wrk != (USE_FLOOR)) break;
4374 /* Get the object being moved. */
4375 o_idx = c_ptr->o_idx;
4377 /* Only rotate a pile of two or more objects. */
4378 if (!(o_idx && o_list[o_idx].next_o_idx)) break;
4380 /* Remove the first object from the list. */
4381 excise_object_idx(o_idx);
4383 /* Find end of the list. */
4385 while (o_list[i].next_o_idx)
4386 i = o_list[i].next_o_idx;
4388 /* Add after the last object. */
4389 o_list[i].next_o_idx = o_idx;
4391 /* Re-scan floor list */
4392 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4394 /* Hack -- Fix screen */
4406 if (command_wrk == (USE_INVEN))
4413 command_wrk = (USE_EQUIP);
4415 else if (command_wrk == (USE_EQUIP))
4422 command_wrk = (USE_INVEN);
4424 else if (command_wrk == (USE_FLOOR))
4428 command_wrk = (USE_INVEN);
4430 else if (allow_equip)
4432 command_wrk = (USE_EQUIP);
4441 /* Hack -- Fix screen */
4448 /* Need to redraw */
4461 * If we are already examining the floor, and there
4462 * is only one item, we will always select it.
4463 * If we aren't examining the floor and there is only
4464 * one item, we will select it if floor_query_flag
4469 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4472 k = 0 - floor_list[0];
4474 /* Allow player to "refuse" certain actions */
4475 if (!get_item_allow(k))
4481 /* Accept that choice */
4490 /* Hack -- Fix screen */
4497 command_wrk = (USE_FLOOR);
4503 case '1': case '2': case '3':
4504 case '4': case '5': case '6':
4505 case '7': case '8': case '9':
4507 if (command_wrk != USE_FLOOR)
4509 /* Look up the tag */
4510 if (!get_tag(&k, which, command_wrk))
4516 /* Hack -- Validate the item */
4517 if ((k < INVEN_RARM) ? !inven : !equip)
4523 /* Validate the item */
4524 if (!get_item_okay(k))
4532 /* Look up the alphabetical tag */
4533 if (get_tag_floor(&k, which, floor_list, floor_num))
4536 k = 0 - floor_list[k];
4545 /* Allow player to "refuse" certain actions */
4546 if (!get_item_allow(k))
4552 /* Accept that choice */
4564 /* Choose "default" inventory item */
4565 if (command_wrk == (USE_INVEN))
4567 k = ((i1 == i2) ? i1 : -1);
4570 /* Choose "default" equipment item */
4571 else if (command_wrk == (USE_EQUIP))
4573 k = ((e1 == e2) ? e1 : -1);
4576 /* Choose "default" floor item */
4577 else if (command_wrk == (USE_FLOOR))
4582 k = 0 - floor_list[0];
4584 /* Allow player to "refuse" certain actions */
4585 if (!get_item_allow(k))
4591 /* Accept that choice */
4599 /* Validate the item */
4600 if (!get_item_okay(k))
4606 /* Allow player to "refuse" certain actions */
4607 if (!get_item_allow(k))
4613 /* Accept that choice */
4637 if (command_wrk != USE_FLOOR)
4639 bool not_found = FALSE;
4641 /* Look up the alphabetical tag */
4642 if (!get_tag(&k, which, command_wrk))
4647 /* Hack -- Validate the item */
4648 else if ((k < INVEN_RARM) ? !inven : !equip)
4653 /* Validate the item */
4654 else if (!get_item_okay(k))
4661 /* Accept that choice */
4671 /* Look up the alphabetical tag */
4672 if (get_tag_floor(&k, which, floor_list, floor_num))
4675 k = 0 - floor_list[k];
4677 /* Accept that choice */
4686 /* Extract "query" setting */
4687 ver = isupper(which);
4688 which = (char)tolower(which);
4690 /* Convert letter to inventory index */
4691 if (command_wrk == (USE_INVEN))
4693 if (which == '(') k = i1;
4694 else if (which == ')') k = i2;
4695 else k = label_to_inven(which);
4698 /* Convert letter to equipment index */
4699 else if (command_wrk == (USE_EQUIP))
4701 if (which == '(') k = e1;
4702 else if (which == ')') k = e2;
4703 else k = label_to_equip(which);
4706 /* Convert letter to floor index */
4707 else if (command_wrk == USE_FLOOR)
4709 if (which == '(') k = 0;
4710 else if (which == ')') k = floor_num - 1;
4711 else k = islower(which) ? A2I(which) : -1;
4712 if (k < 0 || k >= floor_num || k >= 23)
4719 k = 0 - floor_list[k];
4722 /* Validate the item */
4723 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4729 /* Verify the item */
4730 if (ver && !verify(_("本当に", "Try"), k))
4736 /* Allow player to "refuse" certain actions */
4737 if (!get_item_allow(k))
4743 /* Accept that choice */
4753 /* Fix the screen if necessary */
4758 /* Hack -- Cancel "display" */
4759 command_see = FALSE;
4763 /* Forget the item_tester_tval restriction */
4764 item_tester_tval = 0;
4766 /* Forget the item_tester_hook restriction */
4767 item_tester_hook = NULL;
4770 /* Clean up 'show choices' */
4771 /* Toggle again if needed */
4772 if (toggle) toggle_inven_equip();
4774 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4777 /* Clear the prompt line */
4780 /* Warning if needed */
4781 if (oops && str) msg_print(str);
4786 if (command_cmd) prev_tag = cur_tag;
4787 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4793 * @brief 床上のアイテムを拾う選択用サブルーチン
4794 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4796 static bool py_pickup_floor_aux(void)
4798 OBJECT_IDX this_o_idx;
4802 /* Restrict the choices */
4803 item_tester_hook = inven_carry_okay;
4806 q = _("どれを拾いますか?", "Get which item? ");
4807 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4809 if (choose_object(&item, q, s, (USE_FLOOR)))
4811 this_o_idx = 0 - item;
4818 /* Pick up the object */
4819 py_pickup_aux(this_o_idx);
4825 * @brief 床上のアイテムを拾うメイン処理
4826 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4829 * This is called by py_pickup() when easy_floor is TRUE.
4831 void py_pickup_floor(bool pickup)
4833 OBJECT_IDX this_o_idx, next_o_idx = 0;
4835 GAME_TEXT o_name[MAX_NLEN];
4839 OBJECT_IDX floor_o_idx = 0;
4843 /* Scan the pile of objects */
4844 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
4846 /* Access the object */
4847 o_ptr = &o_list[this_o_idx];
4849 object_desc(o_name, o_ptr, 0);
4851 /* Access the next object */
4852 next_o_idx = o_ptr->next_o_idx;
4854 /* Hack -- disturb */
4855 disturb(FALSE, FALSE);
4858 if (o_ptr->tval == TV_GOLD)
4861 msg_format(" $%ld の価値がある%sを見つけた。",
4862 (long)o_ptr->pval, o_name);
4864 msg_format("You have found %ld gold pieces worth of %s.",
4865 (long)o_ptr->pval, o_name);
4868 /* Collect the gold */
4869 p_ptr->au += o_ptr->pval;
4872 p_ptr->redraw |= (PR_GOLD);
4874 p_ptr->window |= (PW_PLAYER);
4876 /* Delete the gold */
4877 delete_object_idx(this_o_idx);
4879 /* Check the next object */
4882 else if (o_ptr->marked & OM_NOMSG)
4884 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4885 * ignored. Otherwise, they are included in the prompt. */
4886 o_ptr->marked &= ~(OM_NOMSG);
4890 /* Count non-gold objects that can be picked up. */
4891 if (inven_carry_okay(o_ptr))
4896 /* Count non-gold objects */
4899 /* Remember this index */
4900 floor_o_idx = this_o_idx;
4903 /* There are no non-gold objects */
4907 /* Mention the number of objects */
4913 /* Access the object */
4914 o_ptr = &o_list[floor_o_idx];
4916 #ifdef ALLOW_EASY_SENSE
4918 /* Option: Make object sensing easy */
4921 /* Sense the object */
4922 (void) sense_object(o_ptr);
4925 #endif /* ALLOW_EASY_SENSE */
4927 object_desc(o_name, o_ptr, 0);
4929 msg_format(_("%sがある。", "You see %s."), o_name);
4932 /* Multiple objects */
4935 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4941 /* The player has no room for anything on the floor. */
4947 /* Access the object */
4948 o_ptr = &o_list[floor_o_idx];
4950 #ifdef ALLOW_EASY_SENSE
4952 /* Option: Make object sensing easy */
4955 /* Sense the object */
4956 (void) sense_object(o_ptr);
4959 #endif /* ALLOW_EASY_SENSE */
4961 object_desc(o_name, o_ptr, 0);
4963 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4966 /* Multiple objects */
4969 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4979 /* Hack -- query every object */
4980 if (carry_query_flag)
4982 char out_val[MAX_NLEN+20];
4984 /* Access the object */
4985 o_ptr = &o_list[floor_o_idx];
4987 #ifdef ALLOW_EASY_SENSE
4989 /* Option: Make object sensing easy */
4992 /* Sense the object */
4993 (void) sense_object(o_ptr);
4996 #endif /* ALLOW_EASY_SENSE */
4998 object_desc(o_name, o_ptr, 0);
5000 /* Build a prompt */
5001 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
5003 /* Ask the user to confirm */
5004 if (!get_check(out_val))
5010 /* Access the object */
5011 o_ptr = &o_list[floor_o_idx];
5013 #ifdef ALLOW_EASY_SENSE
5015 /* Option: Make object sensing easy */
5018 /* Sense the object */
5019 (void) sense_object(o_ptr);
5022 #endif /* ALLOW_EASY_SENSE */
5024 /* Pick up the object */
5025 py_pickup_aux(floor_o_idx);
5028 /* Allow the user to choose an object */
5031 while (can_pickup--)
5033 if (!py_pickup_floor_aux()) break;
5040 * @brief 矢弾を射撃した場合の破損確率を返す /
5041 * Determines the odds of an object breaking when thrown at a monster
5042 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
5045 * Note that artifacts never break, see the "drop_near()" function.
5047 PERCENTAGE breakage_chance(object_type *o_ptr)
5049 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
5051 /* Examine the snipe type */
5054 if (snipe_type == SP_KILL_WALL) return (100);
5055 if (snipe_type == SP_EXPLODE) return (100);
5056 if (snipe_type == SP_PIERCE) return (100);
5057 if (snipe_type == SP_FINAL) return (100);
5058 if (snipe_type == SP_NEEDLE) return (100);
5059 if (snipe_type == SP_EVILNESS) return (40);
5060 if (snipe_type == SP_HOLYNESS) return (40);
5063 /* Examine the item type */
5064 switch (o_ptr->tval)
5080 /* Sometimes break */
5085 return (20 - archer_bonus * 2);
5090 return (10 - archer_bonus);