3 * @brief オブジェクトの実装 / Object code, part 1
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2014 Deskull rearranged comment for Doxygen.\n
16 #include "cmd-activate.h"
18 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
25 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
27 * This involves resetting various things to their "default" state.\n
29 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
30 * "user pref file" based on the current setting of the "use_graphics"\n
31 * flag. This is useful for switching "graphics" on/off.\n
33 * The features, objects, and monsters, should all be encoded in the\n
34 * relevant "font.pref" and/or "graf.prf" files. \n
36 * The "prefs" parameter is no longer meaningful. \n
38 void reset_visuals(void)
42 /* Extract some info about terrain features */
43 for (i = 0; i < max_f_idx; i++)
45 feature_type *f_ptr = &f_info[i];
47 /* Assume we will use the underlying values */
48 for (j = 0; j < F_LIT_MAX; j++)
50 f_ptr->x_attr[j] = f_ptr->d_attr[j];
51 f_ptr->x_char[j] = f_ptr->d_char[j];
55 /* Extract default attr/char code for objects */
56 for (i = 0; i < max_k_idx; i++)
58 object_kind *k_ptr = &k_info[i];
60 /* Default attr/char */
61 k_ptr->x_attr = k_ptr->d_attr;
62 k_ptr->x_char = k_ptr->d_char;
65 /* Extract default attr/char code for monsters */
66 for (i = 0; i < max_r_idx; i++)
68 monster_race *r_ptr = &r_info[i];
70 /* Default attr/char */
71 r_ptr->x_attr = r_ptr->d_attr;
72 r_ptr->x_char = r_ptr->d_char;
79 /* Process "graf.prf" */
80 process_pref_file("graf.prf");
82 /* Access the "character" pref file */
83 sprintf(buf, "graf-%s.prf", player_base);
85 /* Process "graf-<playername>.prf" */
86 process_pref_file(buf);
94 /* Process "font.prf" */
95 process_pref_file("font.prf");
97 /* Access the "character" pref file */
98 sprintf(buf, "font-%s.prf", player_base);
100 /* Process "font-<playername>.prf" */
101 process_pref_file(buf);
106 * @brief オブジェクトのフラグ類を配列に与える
107 * Obtain the "flags" for an item
108 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
109 * @param flgs フラグ情報を受け取る配列
112 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
114 object_kind *k_ptr = &k_info[o_ptr->k_idx];
118 for (i = 0; i < TR_FLAG_SIZE; i++)
119 flgs[i] = k_ptr->flags[i];
122 if (object_is_fixed_artifact(o_ptr))
124 artifact_type *a_ptr = &a_info[o_ptr->name1];
126 for (i = 0; i < TR_FLAG_SIZE; i++)
127 flgs[i] = a_ptr->flags[i];
131 if (object_is_ego(o_ptr))
133 ego_item_type *e_ptr = &e_info[o_ptr->name2];
135 for (i = 0; i < TR_FLAG_SIZE; i++)
136 flgs[i] |= e_ptr->flags[i];
138 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
140 remove_flag(flgs, TR_SH_FIRE);
142 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
144 remove_flag(flgs, TR_INFRA);
146 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
148 remove_flag(flgs, TR_RES_BLIND);
149 remove_flag(flgs, TR_SEE_INVIS);
153 /* Random artifact ! */
154 for (i = 0; i < TR_FLAG_SIZE; i++)
155 flgs[i] |= o_ptr->art_flags[i];
157 if (object_is_smith(o_ptr))
159 int add = o_ptr->xtra3 - 1;
161 if (add < TR_FLAG_MAX)
165 else if (add == ESSENCE_TMP_RES_ACID)
167 add_flag(flgs, TR_RES_ACID);
168 add_flag(flgs, TR_ACTIVATE);
170 else if (add == ESSENCE_TMP_RES_ELEC)
172 add_flag(flgs, TR_RES_ELEC);
173 add_flag(flgs, TR_ACTIVATE);
175 else if (add == ESSENCE_TMP_RES_FIRE)
177 add_flag(flgs, TR_RES_FIRE);
178 add_flag(flgs, TR_ACTIVATE);
180 else if (add == ESSENCE_TMP_RES_COLD)
182 add_flag(flgs, TR_RES_COLD);
183 add_flag(flgs, TR_ACTIVATE);
185 else if (add == ESSENCE_SH_FIRE)
187 add_flag(flgs, TR_RES_FIRE);
188 add_flag(flgs, TR_SH_FIRE);
190 else if (add == ESSENCE_SH_ELEC)
192 add_flag(flgs, TR_RES_ELEC);
193 add_flag(flgs, TR_SH_ELEC);
195 else if (add == ESSENCE_SH_COLD)
197 add_flag(flgs, TR_RES_COLD);
198 add_flag(flgs, TR_SH_COLD);
200 else if (add == ESSENCE_RESISTANCE)
202 add_flag(flgs, TR_RES_ACID);
203 add_flag(flgs, TR_RES_ELEC);
204 add_flag(flgs, TR_RES_FIRE);
205 add_flag(flgs, TR_RES_COLD);
207 else if (add == TR_IMPACT)
209 add_flag(flgs, TR_ACTIVATE);
215 * @brief オブジェクトの明示されているフラグ類を取得する
216 * Obtain the "flags" for an item which are known to the player
217 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
218 * @param flgs フラグ情報を受け取る配列
221 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
226 object_kind *k_ptr = &k_info[o_ptr->k_idx];
229 for (i = 0; i < TR_FLAG_SIZE; i++)
232 if (!object_is_aware(o_ptr)) return;
235 for (i = 0; i < TR_FLAG_SIZE; i++)
236 flgs[i] = k_ptr->flags[i];
238 /* Must be identified */
239 if (!object_is_known(o_ptr)) return;
241 /* Ego-item (known basic flags) */
242 if (object_is_ego(o_ptr))
244 ego_item_type *e_ptr = &e_info[o_ptr->name2];
246 for (i = 0; i < TR_FLAG_SIZE; i++)
247 flgs[i] |= e_ptr->flags[i];
249 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
251 remove_flag(flgs, TR_SH_FIRE);
253 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
255 remove_flag(flgs, TR_INFRA);
257 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
259 remove_flag(flgs, TR_RES_BLIND);
260 remove_flag(flgs, TR_SEE_INVIS);
265 #ifdef SPOIL_ARTIFACTS
266 /* Full knowledge for some artifacts */
267 if (object_is_artifact(o_ptr)) spoil = TRUE;
268 #endif /* SPOIL_ARTIFACTS */
270 #ifdef SPOIL_EGO_ITEMS
271 /* Full knowledge for some ego-items */
272 if (object_is_ego(o_ptr)) spoil = TRUE;
273 #endif /* SPOIL_EGO_ITEMS */
275 /* Need full knowledge or spoilers */
276 if (spoil || (o_ptr->ident & IDENT_MENTAL))
279 if (object_is_fixed_artifact(o_ptr))
281 artifact_type *a_ptr = &a_info[o_ptr->name1];
283 for (i = 0; i < TR_FLAG_SIZE; i++)
284 flgs[i] = a_ptr->flags[i];
287 /* Random artifact ! */
288 for (i = 0; i < TR_FLAG_SIZE; i++)
289 flgs[i] |= o_ptr->art_flags[i];
292 if (object_is_smith(o_ptr))
294 int add = o_ptr->xtra3 - 1;
296 if (add < TR_FLAG_MAX)
300 else if (add == ESSENCE_TMP_RES_ACID)
302 add_flag(flgs, TR_RES_ACID);
304 else if (add == ESSENCE_TMP_RES_ELEC)
306 add_flag(flgs, TR_RES_ELEC);
308 else if (add == ESSENCE_TMP_RES_FIRE)
310 add_flag(flgs, TR_RES_FIRE);
312 else if (add == ESSENCE_TMP_RES_COLD)
314 add_flag(flgs, TR_RES_COLD);
316 else if (add == ESSENCE_SH_FIRE)
318 add_flag(flgs, TR_RES_FIRE);
319 add_flag(flgs, TR_SH_FIRE);
321 else if (add == ESSENCE_SH_ELEC)
323 add_flag(flgs, TR_RES_ELEC);
324 add_flag(flgs, TR_SH_ELEC);
326 else if (add == ESSENCE_SH_COLD)
328 add_flag(flgs, TR_RES_COLD);
329 add_flag(flgs, TR_SH_COLD);
331 else if (add == ESSENCE_RESISTANCE)
333 add_flag(flgs, TR_RES_ACID);
334 add_flag(flgs, TR_RES_ELEC);
335 add_flag(flgs, TR_RES_FIRE);
336 add_flag(flgs, TR_RES_COLD);
342 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
343 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
344 * @return concptr 発動名称を返す文字列ポインタ
346 static concptr item_activation_dragon_breath(object_type *o_ptr)
348 static char desc[256];
349 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
352 object_flags(o_ptr, flgs);
353 strcpy(desc, _("", "breath "));
355 for (i = 0; dragonbreath_info[i].flag != 0; i++)
357 if (have_flag(flgs, dragonbreath_info[i].flag))
359 if (n > 0) strcat(desc, _("、", ", "));
360 strcat(desc, dragonbreath_info[i].name);
365 strcat(desc, _("のブレス(250)", ""));
371 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
372 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
373 * @return concptr 発動名称を返す文字列ポインタ
375 static concptr item_activation_aux(object_type *o_ptr)
377 static char activation_detail[256];
381 const activation_type* const act_ptr = find_activation_info(o_ptr);
383 if (!act_ptr) return _("未定義", "something undefined");
385 desc = act_ptr->desc;
387 /* Overwrite description if it is special */
388 switch (act_ptr->index) {
390 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
391 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
394 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
395 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
398 desc = item_activation_dragon_breath(o_ptr);
401 if (o_ptr->name1 == ART_HYOUSIGI)
402 desc = _("拍子木を打ちならす", "beat wooden clappers");
404 case ACT_RESIST_ACID:
405 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
406 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
408 case ACT_RESIST_FIRE:
409 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
410 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
412 case ACT_RESIST_COLD:
413 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
414 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
416 case ACT_RESIST_ELEC:
417 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
418 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
420 case ACT_RESIST_POIS:
421 if (o_ptr->name2 == EGO_BRAND_POIS)
422 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
426 /* Timeout description */
427 constant = act_ptr->timeout.constant;
428 dice = act_ptr->timeout.dice;
429 if (constant == 0 && dice == 0) {
430 /* We can activate it every turn */
431 strcpy(timeout, _("いつでも", "every turn"));
432 } else if (constant < 0) {
433 /* Activations that have special timeout */
434 switch (act_ptr->index) {
436 sprintf(timeout, _("%d ターン毎", "every %d turns"),
437 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
440 sprintf(timeout, _("%d ターン毎", "every %d turns"),
441 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
444 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
447 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
450 strcpy(timeout, "undefined");
454 /* Normal timeout activations */
455 char constant_str[16], dice_str[16];
456 sprintf(constant_str, "%d", constant);
457 sprintf(dice_str, "d%d", dice);
458 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
459 (constant > 0) ? constant_str : "",
460 (constant > 0 && dice > 0) ? "+" : "",
461 (dice > 0) ? dice_str : "");
464 /* Build detail activate description */
465 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
467 return activation_detail;
471 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
472 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
473 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
474 * @return concptr 発動名称を返す文字列ポインタ
476 concptr item_activation(object_type *o_ptr)
478 BIT_FLAGS flgs[TR_FLAG_SIZE];
479 object_flags(o_ptr, flgs);
481 /* Require activation ability */
482 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
484 /* Get an explain of an activation */
485 if (activation_index(o_ptr))
487 return item_activation_aux(o_ptr);
491 if (o_ptr->tval == TV_WHISTLE)
493 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
496 if (o_ptr->tval == TV_CAPTURE)
498 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
501 return _("何も起きない", "Nothing");
506 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
507 * Describe a "fully identified" item
508 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
509 * @param mode 表示オプション
510 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
512 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
516 BIT_FLAGS flgs[TR_FLAG_SIZE];
520 GAME_TEXT o_name[MAX_NLEN];
525 int trivial_info = 0;
526 object_flags(o_ptr, flgs);
528 /* Extract the description */
530 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
531 (k_text + k_info[o_ptr->k_idx].text),
532 77 - 15, temp, sizeof(temp));
533 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
534 { info[i] = &temp[j]; i++;}
537 if (object_is_equipment(o_ptr))
539 /* Descriptions of a basic equipment is just a flavor */
543 /* Mega-Hack -- describe activation */
544 if (have_flag(flgs, TR_ACTIVATE))
546 info[i++] = _("始動したときの効果...", "It can be activated for...");
547 info[i++] = item_activation(o_ptr);
548 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
551 /* Figurines, a hack */
552 if (o_ptr->tval == TV_FIGURINE)
554 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
557 /* Figurines, a hack */
558 if (o_ptr->name1 == ART_STONEMASK)
560 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you turn into a vampire permanently.");
563 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
565 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
568 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
570 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
571 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
574 if (o_ptr->name2 == EGO_2WEAPON)
576 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
579 if (have_flag(flgs, TR_EASY_SPELL))
581 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
584 if (o_ptr->name2 == EGO_AMU_FOOL)
586 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
589 if (o_ptr->name2 == EGO_RING_THROW)
591 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
594 if (o_ptr->name2 == EGO_AMU_NAIVETY)
596 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
599 if (o_ptr->tval == TV_STATUE)
601 monster_race *r_ptr = &r_info[o_ptr->pval];
603 if (o_ptr->pval == MON_BULLGATES)
604 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
605 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
606 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
608 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
611 /* Hack -- describe lite's */
613 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
616 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
617 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
618 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
619 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
620 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
621 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
623 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
625 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
627 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
631 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
632 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
635 if(rad != 0) info[i++] = desc;
638 if (o_ptr->name2 == EGO_LITE_LONG)
640 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
643 /* And then describe it fully */
645 if (have_flag(flgs, TR_RIDING))
647 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
648 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
651 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
652 /* This information is not important enough */
656 if (have_flag(flgs, TR_STR))
658 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
660 if (have_flag(flgs, TR_INT))
662 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
664 if (have_flag(flgs, TR_WIS))
666 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
668 if (have_flag(flgs, TR_DEX))
670 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
672 if (have_flag(flgs, TR_CON))
674 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
676 if (have_flag(flgs, TR_CHR))
678 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
681 if (have_flag(flgs, TR_MAGIC_MASTERY))
683 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
686 if (have_flag(flgs, TR_STEALTH))
688 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
690 if (have_flag(flgs, TR_SEARCH))
692 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
694 if (have_flag(flgs, TR_INFRA))
696 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
698 if (have_flag(flgs, TR_TUNNEL))
700 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
702 if (have_flag(flgs, TR_SPEED))
704 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
706 if (have_flag(flgs, TR_BLOWS))
708 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
711 if (have_flag(flgs, TR_BRAND_ACID))
713 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
715 if (have_flag(flgs, TR_BRAND_ELEC))
717 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
719 if (have_flag(flgs, TR_BRAND_FIRE))
721 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
723 if (have_flag(flgs, TR_BRAND_COLD))
725 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
728 if (have_flag(flgs, TR_BRAND_POIS))
730 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
733 if (have_flag(flgs, TR_CHAOTIC))
735 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
738 if (have_flag(flgs, TR_VAMPIRIC))
740 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
743 if (have_flag(flgs, TR_IMPACT))
745 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
748 if (have_flag(flgs, TR_VORPAL))
750 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
753 if (have_flag(flgs, TR_KILL_DRAGON))
755 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
757 else if (have_flag(flgs, TR_SLAY_DRAGON))
759 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
762 if (have_flag(flgs, TR_KILL_ORC))
764 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
766 if (have_flag(flgs, TR_SLAY_ORC))
768 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
771 if (have_flag(flgs, TR_KILL_TROLL))
773 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
775 if (have_flag(flgs, TR_SLAY_TROLL))
777 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
780 if (have_flag(flgs, TR_KILL_GIANT))
782 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
784 else if (have_flag(flgs, TR_SLAY_GIANT))
786 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
789 if (have_flag(flgs, TR_KILL_DEMON))
791 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
793 if (have_flag(flgs, TR_SLAY_DEMON))
795 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
798 if (have_flag(flgs, TR_KILL_UNDEAD))
800 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
802 if (have_flag(flgs, TR_SLAY_UNDEAD))
804 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
807 if (have_flag(flgs, TR_KILL_EVIL))
809 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
811 if (have_flag(flgs, TR_SLAY_EVIL))
813 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
816 if (have_flag(flgs, TR_KILL_ANIMAL))
818 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
820 if (have_flag(flgs, TR_SLAY_ANIMAL))
822 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
825 if (have_flag(flgs, TR_KILL_HUMAN))
827 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
829 if (have_flag(flgs, TR_SLAY_HUMAN))
831 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
834 if (have_flag(flgs, TR_FORCE_WEAPON))
836 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
838 if (have_flag(flgs, TR_DEC_MANA))
840 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
842 if (have_flag(flgs, TR_SUST_STR))
844 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
846 if (have_flag(flgs, TR_SUST_INT))
848 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
850 if (have_flag(flgs, TR_SUST_WIS))
852 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
854 if (have_flag(flgs, TR_SUST_DEX))
856 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
858 if (have_flag(flgs, TR_SUST_CON))
860 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
862 if (have_flag(flgs, TR_SUST_CHR))
864 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
867 if (have_flag(flgs, TR_IM_ACID))
869 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
871 if (have_flag(flgs, TR_IM_ELEC))
873 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
875 if (have_flag(flgs, TR_IM_FIRE))
877 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
879 if (have_flag(flgs, TR_IM_COLD))
881 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
884 if (have_flag(flgs, TR_THROW))
886 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
889 if (have_flag(flgs, TR_FREE_ACT))
891 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
893 if (have_flag(flgs, TR_HOLD_EXP))
895 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
897 if (have_flag(flgs, TR_RES_FEAR))
899 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
901 if (have_flag(flgs, TR_RES_ACID))
903 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
905 if (have_flag(flgs, TR_RES_ELEC))
907 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
909 if (have_flag(flgs, TR_RES_FIRE))
911 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
913 if (have_flag(flgs, TR_RES_COLD))
915 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
917 if (have_flag(flgs, TR_RES_POIS))
919 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
922 if (have_flag(flgs, TR_RES_LITE))
924 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
926 if (have_flag(flgs, TR_RES_DARK))
928 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
931 if (have_flag(flgs, TR_RES_BLIND))
933 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
935 if (have_flag(flgs, TR_RES_CONF))
937 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
939 if (have_flag(flgs, TR_RES_SOUND))
941 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
943 if (have_flag(flgs, TR_RES_SHARDS))
945 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
948 if (have_flag(flgs, TR_RES_NETHER))
950 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
952 if (have_flag(flgs, TR_RES_NEXUS))
954 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
956 if (have_flag(flgs, TR_RES_CHAOS))
958 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
960 if (have_flag(flgs, TR_RES_DISEN))
962 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
965 if (have_flag(flgs, TR_LEVITATION))
967 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
970 if (have_flag(flgs, TR_SEE_INVIS))
972 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
974 if (have_flag(flgs, TR_TELEPATHY))
976 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
978 if (have_flag(flgs, TR_ESP_ANIMAL))
980 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
982 if (have_flag(flgs, TR_ESP_UNDEAD))
984 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
986 if (have_flag(flgs, TR_ESP_DEMON))
988 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
990 if (have_flag(flgs, TR_ESP_ORC))
992 info[i++] = _("それはオークを感知する。", "It senses orcs.");
994 if (have_flag(flgs, TR_ESP_TROLL))
996 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
998 if (have_flag(flgs, TR_ESP_GIANT))
1000 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1002 if (have_flag(flgs, TR_ESP_DRAGON))
1004 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1006 if (have_flag(flgs, TR_ESP_HUMAN))
1008 info[i++] = _("それは人間を感知する。", "It senses humans.");
1010 if (have_flag(flgs, TR_ESP_EVIL))
1012 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1014 if (have_flag(flgs, TR_ESP_GOOD))
1016 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1018 if (have_flag(flgs, TR_ESP_NONLIVING))
1020 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1022 if (have_flag(flgs, TR_ESP_UNIQUE))
1024 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1026 if (have_flag(flgs, TR_SLOW_DIGEST))
1028 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1030 if (have_flag(flgs, TR_REGEN))
1032 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1034 if (have_flag(flgs, TR_WARNING))
1036 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1038 if (have_flag(flgs, TR_REFLECT))
1040 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1042 if (have_flag(flgs, TR_SH_FIRE))
1044 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1046 if (have_flag(flgs, TR_SH_ELEC))
1048 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1050 if (have_flag(flgs, TR_SH_COLD))
1052 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1054 if (have_flag(flgs, TR_NO_MAGIC))
1056 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1058 if (have_flag(flgs, TR_NO_TELE))
1060 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1062 if (have_flag(flgs, TR_XTRA_MIGHT))
1064 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1066 if (have_flag(flgs, TR_XTRA_SHOTS))
1068 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1071 if (have_flag(flgs, TR_BLESSED))
1073 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1076 if (object_is_cursed(o_ptr))
1078 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1080 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1082 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1084 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1088 info[i++] = _("それは呪われている。", "It is cursed.");
1091 * It's a trivial infomation since there is
1092 * fake inscription {cursed}
1098 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1100 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1102 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1104 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1106 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1108 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1110 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1112 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1114 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1116 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1118 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1120 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1122 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1124 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1126 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1128 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1130 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1132 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1134 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1136 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1138 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1140 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1142 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1144 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1146 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1148 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1150 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1152 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1154 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1156 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1158 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1160 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1162 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1164 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1166 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1168 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1171 /* Describe about this kind of object instead of THIS fake object */
1172 if (mode & SCROBJ_FAKE_OBJECT)
1174 switch (o_ptr->tval)
1177 switch (o_ptr->sval)
1179 case SV_RING_LORDLY:
1180 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1182 case SV_RING_WARNING:
1183 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1189 switch (o_ptr->sval)
1191 case SV_AMULET_RESISTANCE:
1192 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1193 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1195 case SV_AMULET_THE_MAGI:
1196 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1203 if (have_flag(flgs, TR_IGNORE_ACID) &&
1204 have_flag(flgs, TR_IGNORE_ELEC) &&
1205 have_flag(flgs, TR_IGNORE_FIRE) &&
1206 have_flag(flgs, TR_IGNORE_COLD))
1208 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1212 if (have_flag(flgs, TR_IGNORE_ACID))
1214 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1216 if (have_flag(flgs, TR_IGNORE_ELEC))
1218 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1220 if (have_flag(flgs, TR_IGNORE_FIRE))
1222 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1224 if (have_flag(flgs, TR_IGNORE_COLD))
1226 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1230 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1232 /* No relevant informations */
1233 if (i <= trivial_info) return (FALSE);
1236 Term_get_size(&wid, &hgt);
1238 /* Display Item name */
1239 if (!(mode & SCROBJ_FAKE_OBJECT))
1240 object_desc(o_name, o_ptr, 0);
1242 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1246 /* Erase the screen */
1247 for (k = 1; k < hgt; k++) prt("", k, 13);
1249 /* Label the information */
1250 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1252 monster_race *r_ptr = &r_info[o_ptr->pval];
1253 int namelen = strlen(r_name + r_ptr->name);
1254 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1255 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1256 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1260 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1263 /* We will print on top of the map (column 13) */
1264 for (k = 2, j = 0; j < i; j++)
1267 prt(info[j], k++, 15);
1269 /* Every 20 entries (lines 2 to 21), start over */
1270 if ((k == hgt - 2) && (j+1 < i))
1272 prt(_("-- 続く --", "-- more --"), k, 15);
1274 for (; k > 2; k--) prt("", k, 15);
1279 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1284 /* Gave knowledge */
1291 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1292 * Convert an inventory index into a one character label
1293 * @param i プレイヤーの所持/装備オブジェクトID
1294 * @return 対応するアルファベット
1295 * @details Note that the label does NOT distinguish inven/equip.
1297 char index_to_label(int i)
1299 /* Indexes for "inven" are easy */
1300 if (i < INVEN_RARM) return (I2A(i));
1302 /* Indexes for "equip" are offset */
1303 return (I2A(i - INVEN_RARM));
1307 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1308 * Convert a label into the index of an item in the "inven"
1309 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1310 * @details Note that the label does NOT distinguish inven/equip.
1312 INVENTORY_IDX label_to_inven(int c)
1317 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1319 /* Verify the index */
1320 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1322 /* Empty slots can never be chosen */
1323 if (!inventory[i].k_idx) return (-1);
1325 /* Return the index */
1331 extern bool select_ring_slot;
1335 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1336 * @param i プレイヤーの所持/装備オブジェクトID
1337 * @return 指輪枠ならばTRUEを返す。
1339 static bool is_ring_slot(int i)
1341 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1346 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1347 * Convert a label into the index of a item in the "equip"
1348 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1350 INVENTORY_IDX label_to_equip(int c)
1355 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1357 /* Verify the index */
1358 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1360 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1362 /* Empty slots can never be chosen */
1363 if (!inventory[i].k_idx) return (-1);
1365 /* Return the index */
1372 * @brief オブジェクトの該当装備部位IDを返す /
1373 * Determine which equipment slot (if any) an item likes
1374 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1375 * @return 対応する装備部位ID
1377 s16b wield_slot(object_type *o_ptr)
1379 /* Slot for equipment */
1380 switch (o_ptr->tval)
1387 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1388 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1389 return (INVEN_LARM);
1396 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1397 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1398 return (INVEN_RARM);
1408 /* Use the right hand first */
1409 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1411 /* Use the left hand for swapping (by default) */
1412 return (INVEN_LEFT);
1418 return (INVEN_NECK);
1423 return (INVEN_LITE);
1430 return (INVEN_BODY);
1435 return (INVEN_OUTER);
1441 return (INVEN_HEAD);
1446 return (INVEN_HANDS);
1451 return (INVEN_FEET);
1455 /* No slot available */
1460 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1461 * Return a string mentioning how a given item is carried
1462 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1463 * @return 部位表現の文字列ポインタ
1465 concptr mention_use(int i)
1469 /* Examine the location */
1473 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1475 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1479 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1481 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1484 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1485 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1486 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1487 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1488 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1489 case INVEN_BODY: p = _(" 体", "On body"); break;
1490 case INVEN_OUTER: p = _("体の上", "About body"); break;
1491 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1492 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1493 case INVEN_FEET: p = _(" 足", "On feet"); break;
1494 default: p = _("ザック", "In pack"); break;
1497 /* Return the result */
1503 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1504 * Return a string describing how a given item is being worn.
1505 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1506 * @return 状態表現内容の文字列ポインタ
1508 * Currently, only used for items in the equipment, not inventory.
1510 concptr describe_use(int i)
1517 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1519 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1523 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1525 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1528 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1529 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1530 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1531 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1532 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1533 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1534 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1535 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1536 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1537 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1538 default: p = _("ザックに入っている", "carrying in your pack"); break;
1541 /* Return the result */
1547 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1548 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1549 * @param book_tval ベースアイテムのtval
1550 * @param book_sval ベースアイテムのsval
1551 * @return 使用可能な魔法書ならばTRUEを返す。
1554 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1556 if (book_tval < TV_LIFE_BOOK) return FALSE;
1557 if (p_ptr->pclass == CLASS_SORCERER)
1559 return is_magic(tval2realm(book_tval));
1561 else if (p_ptr->pclass == CLASS_RED_MAGE)
1563 if (is_magic(tval2realm(book_tval)))
1564 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1566 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1570 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1571 * Check an item against the item tester info
1572 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1573 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1575 bool item_tester_okay(object_type *o_ptr)
1577 /* Hack -- allow listing empty slots */
1578 // if (item_tester_full) return (TRUE); // TODO:DELETE
1580 /* Require an item */
1581 if (!o_ptr->k_idx) return (FALSE);
1583 /* Hack -- ignore "gold" */
1584 if (o_ptr->tval == TV_GOLD)
1587 extern bool show_gold_on_floor;
1589 if (!show_gold_on_floor) return (FALSE);
1592 /* Check the tval */
1593 if (item_tester_tval)
1595 /* Is it a spellbook? If so, we need a hack -- TY */
1596 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1597 (item_tester_tval >= TV_LIFE_BOOK))
1598 return check_book_realm(o_ptr->tval, o_ptr->sval);
1600 if (item_tester_tval != o_ptr->tval) return (FALSE);
1603 /* Check the hook */
1604 if (item_tester_hook)
1606 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1615 * @brief 所持アイテム一覧を表示する /
1616 * Choice window "shadow" of the "show_inven()" function
1619 void display_inven(void)
1621 register int i, n, z = 0;
1623 TERM_COLOR attr = TERM_WHITE;
1625 GAME_TEXT o_name[MAX_NLEN];
1628 Term_get_size(&wid, &hgt);
1630 /* Find the "final" slot */
1631 for (i = 0; i < INVEN_PACK; i++)
1633 o_ptr = &inventory[i];
1635 /* Skip non-objects */
1636 if (!o_ptr->k_idx) continue;
1642 /* Display the pack */
1643 for (i = 0; i < z; i++)
1645 /* Examine the item */
1646 o_ptr = &inventory[i];
1648 /* Start with an empty "index" */
1649 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1651 /* Is this item "acceptable"? */
1652 if (item_tester_okay(o_ptr))
1654 /* Prepare an "index" */
1655 tmp_val[0] = index_to_label(i);
1657 /* Bracket the "index" --(-- */
1661 /* Display the index (or blank space) */
1662 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1664 /* Obtain an item description */
1665 object_desc(o_name, o_ptr, 0);
1667 /* Obtain the length of the description */
1671 attr = tval_to_attr[o_ptr->tval % 128];
1673 /* Grey out charging items */
1679 /* Display the entry itself */
1680 Term_putstr(3, i, n, attr, o_name);
1682 /* Erase the rest of the line */
1683 Term_erase(3+n, i, 255);
1685 /* Display the weight if needed */
1688 int wgt = o_ptr->weight * o_ptr->number;
1690 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1692 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1695 prt(tmp_val, i, wid - 9);
1699 /* Erase the rest of the window */
1700 for (i = z; i < hgt; i++)
1702 /* Erase the line */
1703 Term_erase(0, i, 255);
1710 * @brief 装備アイテム一覧を表示する /
1711 * Choice window "shadow" of the "show_equip()" function
1714 void display_equip(void)
1718 TERM_COLOR attr = TERM_WHITE;
1720 GAME_TEXT o_name[MAX_NLEN];
1723 Term_get_size(&wid, &hgt);
1725 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1727 /* Examine the item */
1728 o_ptr = &inventory[i];
1730 /* Start with an empty "index" */
1731 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1733 /* Is this item "acceptable"? */
1734 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1736 /* Prepare an "index" */
1737 tmp_val[0] = index_to_label(i);
1739 /* Bracket the "index" --(-- */
1743 /* Display the index (or blank space) */
1744 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1746 /* Obtain an item description */
1747 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1749 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1754 object_desc(o_name, o_ptr, 0);
1755 attr = tval_to_attr[o_ptr->tval % 128];
1758 /* Obtain the length of the description */
1761 /* Grey out charging items */
1767 /* Display the entry itself */
1768 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1770 /* Erase the rest of the line */
1771 Term_erase(3+n, i - INVEN_RARM, 255);
1773 /* Display the weight (if needed) */
1776 int wgt = o_ptr->weight * o_ptr->number;
1778 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1780 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1783 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1786 /* Display the slot description (if needed) */
1789 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1790 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1794 /* Erase the rest of the window */
1795 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1797 /* Clear that line */
1798 Term_erase(0, i, 255);
1804 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1805 * Find the "first" inventory object with the given "tag".
1806 * @param cp 対応するタグIDを与える参照ポインタ
1807 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1808 * @param mode 所持、装備の切り替え
1809 * @return タグに該当するオブジェクトがあるならTRUEを返す
1811 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1812 * inscription of an object. Alphabetical characters don't work as a\n
1813 * tag in this form.\n
1815 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1816 * and "x" is the "current" command_cmd code.\n
1818 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1821 COMMAND_CODE start, end;
1824 /* Extract index from mode */
1829 end = INVEN_TOTAL - 1;
1834 end = INVEN_PACK - 1;
1841 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1843 /* Check every inventory object */
1844 for (i = start; i <= end; i++)
1846 object_type *o_ptr = &inventory[i];
1848 /* Skip non-objects */
1849 if (!o_ptr->k_idx) continue;
1851 /* Skip empty inscriptions */
1852 if (!o_ptr->inscription) continue;
1854 /* Skip non-choice */
1855 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1858 s = my_strchr(quark_str(o_ptr->inscription), '@');
1860 /* Process all tags */
1863 /* Check the special tags */
1864 if ((s[1] == command_cmd) && (s[2] == tag))
1866 /* Save the actual inventory ID */
1873 /* Find another '@' */
1874 s = my_strchr(s + 1, '@');
1879 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1881 /* Don't allow {@#} with '#' being alphabet */
1882 if (tag < '0' || '9' < tag)
1888 /* Check every object */
1889 for (i = start; i <= end; i++)
1891 object_type *o_ptr = &inventory[i];
1893 /* Skip non-objects */
1894 if (!o_ptr->k_idx) continue;
1896 /* Skip empty inscriptions */
1897 if (!o_ptr->inscription) continue;
1899 /* Skip non-choice */
1900 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1903 s = my_strchr(quark_str(o_ptr->inscription), '@');
1905 /* Process all tags */
1908 /* Check the normal tags */
1911 /* Save the actual inventory ID */
1918 /* Find another '@' */
1919 s = my_strchr(s + 1, '@');
1929 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1930 * Find the "first" inventory object with the given "tag".
1931 * @param cp 対応するタグIDを与える参照ポインタ
1932 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1933 * @param floor_list 床上アイテムの配列
1934 * @param floor_num 床上アイテムの配列ID
1935 * @return タグに該当するオブジェクトがあるならTRUEを返す
1937 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1938 * inscription of an object. Alphabetical characters don't work as a\n
1939 * tag in this form.\n
1941 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1942 * and "x" is the "current" command_cmd code.\n
1944 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1949 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1951 /* Check every object in the grid */
1952 for (i = 0; i < floor_num && i < 23; i++)
1954 object_type *o_ptr = &o_list[floor_list[i]];
1956 /* Skip empty inscriptions */
1957 if (!o_ptr->inscription) continue;
1960 s = my_strchr(quark_str(o_ptr->inscription), '@');
1962 /* Process all tags */
1965 /* Check the special tags */
1966 if ((s[1] == command_cmd) && (s[2] == tag))
1968 /* Save the actual floor object ID */
1975 /* Find another '@' */
1976 s = my_strchr(s + 1, '@');
1981 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1983 /* Don't allow {@#} with '#' being alphabet */
1984 if (tag < '0' || '9' < tag)
1990 /* Check every object in the grid */
1991 for (i = 0; i < floor_num && i < 23; i++)
1993 object_type *o_ptr = &o_list[floor_list[i]];
1995 /* Skip empty inscriptions */
1996 if (!o_ptr->inscription) continue;
1999 s = my_strchr(quark_str(o_ptr->inscription), '@');
2001 /* Process all tags */
2004 /* Check the normal tags */
2007 /* Save the floor object ID */
2014 /* Find another '@' */
2015 s = my_strchr(s + 1, '@');
2025 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2026 * Move around label characters with correspond tags
2027 * @param label ラベルリストを取得する文字列参照ポインタ
2028 * @param mode 所持品リストか装備品リストかの切り替え
2031 static void prepare_label_string(char *label, BIT_FLAGS mode)
2033 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2034 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2037 /* Prepare normal labels */
2038 strcpy(label, alphabet_chars);
2040 /* Move each label */
2041 for (i = 0; i < 52; i++)
2044 SYMBOL_CODE c = alphabet_chars[i];
2046 /* Find a tag with this label */
2047 if (get_tag(&index, c, mode))
2049 /* Delete the overwritten label */
2050 if (label[i] == c) label[i] = ' ';
2052 /* Move the label to the place of corresponding tag */
2053 label[index - offset] = c;
2060 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2061 * Move around label characters with correspond tags (floor version)
2062 * @param label ラベルリストを取得する文字列参照ポインタ
2063 * @param floor_list 床上アイテムの配列
2064 * @param floor_num 床上アイテムの配列ID
2069 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2071 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2074 /* Prepare normal labels */
2075 strcpy(label, alphabet_chars);
2077 /* Move each label */
2078 for (i = 0; i < 52; i++)
2081 SYMBOL_CODE c = alphabet_chars[i];
2083 /* Find a tag with this label */
2084 if (get_tag_floor(&index, c, floor_list, floor_num))
2086 /* Delete the overwritten label */
2087 if (label[i] == c) label[i] = ' ';
2089 /* Move the label to the place of corresponding tag */
2097 * @brief 所持アイテムの表示を行う /
2098 * Display the inventory.
2099 * @param target_item アイテムの選択処理を行うか否か。
2100 * @return 選択したアイテムのタグ
2102 * Hack -- do not display "trailing" empty slots
2104 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2108 int col, cur_col, len;
2110 GAME_TEXT o_name[MAX_NLEN];
2112 COMMAND_CODE out_index[23];
2113 TERM_COLOR out_color[23];
2114 char out_desc[23][MAX_NLEN];
2115 COMMAND_CODE target_item_label = 0;
2117 char inven_label[52 + 1];
2119 /* Starting column */
2122 Term_get_size(&wid, &hgt);
2124 /* Default "max-length" */
2125 len = wid - col - 1;
2128 /* Find the "final" slot */
2129 for (i = 0; i < INVEN_PACK; i++)
2131 o_ptr = &inventory[i];
2133 /* Skip non-objects */
2134 if (!o_ptr->k_idx) continue;
2140 prepare_label_string(inven_label, USE_INVEN);
2142 /* Display the inventory */
2143 for (k = 0, i = 0; i < z; i++)
2145 o_ptr = &inventory[i];
2147 /* Is this item acceptable? */
2148 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2150 object_desc(o_name, o_ptr, 0);
2152 /* Save the object index, color, and description */
2154 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2156 /* Grey out charging items */
2159 out_color[k] = TERM_L_DARK;
2162 (void)strcpy(out_desc[k], o_name);
2164 /* Find the predicted "line length" */
2165 l = strlen(out_desc[k]) + 5;
2167 /* Be sure to account for the weight */
2168 if (show_weights) l += 9;
2170 /* Account for icon if displayed */
2171 if (show_item_graph)
2174 if (use_bigtile) l++;
2177 /* Maintain the maximum length */
2178 if (l > len) len = l;
2180 /* Advance to next "line" */
2184 /* Find the column to start in */
2185 col = (len > wid - 4) ? 0 : (wid - len - 1);
2187 /* Output each entry */
2188 for (j = 0; j < k; j++)
2193 o_ptr = &inventory[i];
2195 /* Clear the line */
2196 prt("", j + 1, col ? col - 2 : col);
2198 if (use_menu && target_item)
2200 if (j == (target_item-1))
2202 strcpy(tmp_val, _("》", "> "));
2203 target_item_label = i;
2205 else strcpy(tmp_val, " ");
2207 else if (i <= INVEN_PACK)
2209 /* Prepare an index --(-- */
2210 sprintf(tmp_val, "%c)", inven_label[i]);
2214 /* Prepare an index --(-- */
2215 sprintf(tmp_val, "%c)", index_to_label(i));
2218 /* Clear the line with the (possibly indented) index */
2219 put_str(tmp_val, j + 1, col);
2223 /* Display graphics for object, if desired */
2224 if (show_item_graph)
2226 TERM_COLOR a = object_attr(o_ptr);
2227 SYMBOL_CODE c = object_char(o_ptr);
2228 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2229 if (use_bigtile) cur_col++;
2235 /* Display the entry itself */
2236 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2238 /* Display the weight if needed */
2241 int wgt = o_ptr->weight * o_ptr->number;
2243 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2245 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2248 prt(tmp_val, j + 1, wid - 9);
2252 /* Make a "shadow" below the list (only if needed) */
2253 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2255 /* Save the new column */
2258 return target_item_label;
2263 * @brief 装備アイテムの表示を行う /
2264 * Display the equipment.
2265 * @param target_item アイテムの選択処理を行うか否か。
2266 * @return 選択したアイテムのタグ
2268 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2272 int col, cur_col, len;
2275 GAME_TEXT o_name[MAX_NLEN];
2276 COMMAND_CODE out_index[23];
2277 TERM_COLOR out_color[23];
2278 char out_desc[23][MAX_NLEN];
2279 COMMAND_CODE target_item_label = 0;
2281 char equip_label[52 + 1];
2283 /* Starting column */
2286 Term_get_size(&wid, &hgt);
2288 /* Maximal length */
2289 len = wid - col - 1;
2292 /* Scan the equipment list */
2293 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2295 o_ptr = &inventory[i];
2297 /* Is this item acceptable? */
2298 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2299 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2300 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2302 object_desc(o_name, o_ptr, 0);
2304 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2306 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2307 out_color[k] = TERM_WHITE;
2311 (void)strcpy(out_desc[k], o_name);
2312 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2316 /* Grey out charging items */
2319 out_color[k] = TERM_L_DARK;
2322 /* Extract the maximal length (see below) */
2324 l = strlen(out_desc[k]) + (2 + 1);
2326 l = strlen(out_desc[k]) + (2 + 3);
2330 /* Increase length for labels (if needed) */
2332 if (show_labels) l += (7 + 2);
2334 if (show_labels) l += (14 + 2);
2338 /* Increase length for weight (if needed) */
2339 if (show_weights) l += 9;
2341 if (show_item_graph) l += 2;
2343 /* Maintain the max-length */
2344 if (l > len) len = l;
2346 /* Advance the entry */
2350 /* Hack -- Find a column to start in */
2352 col = (len > wid - 6) ? 0 : (wid - len - 1);
2354 col = (len > wid - 4) ? 0 : (wid - len - 1);
2357 prepare_label_string(equip_label, USE_EQUIP);
2359 /* Output each entry */
2360 for (j = 0; j < k; j++)
2365 o_ptr = &inventory[i];
2367 /* Clear the line */
2368 prt("", j + 1, col ? col - 2 : col);
2370 if (use_menu && target_item)
2372 if (j == (target_item-1))
2374 strcpy(tmp_val, _("》", "> "));
2375 target_item_label = i;
2377 else strcpy(tmp_val, " ");
2379 else if (i >= INVEN_RARM)
2381 /* Prepare an index --(-- */
2382 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2386 /* Prepare an index --(-- */
2387 sprintf(tmp_val, "%c)", index_to_label(i));
2390 /* Clear the line with the (possibly indented) index */
2391 put_str(tmp_val, j+1, col);
2395 /* Display graphics for object, if desired */
2396 if (show_item_graph)
2398 TERM_COLOR a = object_attr(o_ptr);
2399 SYMBOL_CODE c = object_char(o_ptr);
2400 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2401 if (use_bigtile) cur_col++;
2409 /* Mention the use */
2410 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2412 put_str(tmp_val, j+1, cur_col);
2414 /* Display the entry itself */
2415 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2421 /* Display the entry itself */
2422 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2425 /* Display the weight if needed */
2428 int wgt = o_ptr->weight * o_ptr->number;
2430 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2432 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2435 prt(tmp_val, j + 1, wid - 9);
2439 /* Make a "shadow" below the list (only if needed) */
2440 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2442 /* Save the new column */
2445 return target_item_label;
2449 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2450 * Flip "inven" and "equip" in any sub-windows
2453 void toggle_inven_equip(void)
2458 for (j = 0; j < 8; j++)
2461 if (!angband_term[j]) continue;
2463 /* Flip inven to equip */
2464 if (window_flag[j] & (PW_INVEN))
2467 window_flag[j] &= ~(PW_INVEN);
2468 window_flag[j] |= (PW_EQUIP);
2470 p_ptr->window |= (PW_EQUIP);
2473 /* Flip inven to equip */
2474 else if (window_flag[j] & (PW_EQUIP))
2477 window_flag[j] &= ~(PW_EQUIP);
2478 window_flag[j] |= (PW_INVEN);
2480 p_ptr->window |= (PW_INVEN);
2486 * @brief 選択したアイテムの確認処理の補助 /
2487 * Verify the choice of an item.
2488 * @param prompt メッセージ表示の一部
2489 * @param item 選択アイテムID
2490 * @return 確認がYesならTRUEを返す。
2491 * @details The item can be negative to mean "item on floor".
2493 static bool verify(concptr prompt, INVENTORY_IDX item)
2495 GAME_TEXT o_name[MAX_NLEN];
2496 char out_val[MAX_NLEN+20];
2503 o_ptr = &inventory[item];
2509 o_ptr = &o_list[0 - item];
2511 object_desc(o_name, o_ptr, 0);
2514 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2517 return (get_check(out_val));
2522 * @brief 選択したアイテムの確認処理のメインルーチン /
2523 * @param item 選択アイテムID
2524 * @return 確認がYesならTRUEを返す。
2525 * @details The item can be negative to mean "item on floor".
2526 * Hack -- allow user to "prevent" certain choices
2528 static bool get_item_allow(INVENTORY_IDX item)
2532 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2537 o_ptr = &inventory[item];
2543 o_ptr = &o_list[0 - item];
2546 /* No inscription */
2547 if (!o_ptr->inscription) return (TRUE);
2550 s = my_strchr(quark_str(o_ptr->inscription), '!');
2552 /* Process preventions */
2555 /* Check the "restriction" */
2556 if ((s[1] == command_cmd) || (s[1] == '*'))
2558 /* Verify the choice */
2559 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2562 /* Find another '!' */
2563 s = my_strchr(s + 1, '!');
2572 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2573 * Auxiliary function for "get_item()" -- test an index
2575 * @return 正規のIDならばTRUEを返す。
2577 static bool get_item_okay(OBJECT_IDX i)
2580 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2582 if (select_ring_slot) return is_ring_slot(i);
2584 /* Verify the item */
2585 if (!item_tester_okay(&inventory[i])) return (FALSE);
2592 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2593 * Determine whether get_item() can get some item or not
2594 * @return アイテムを拾えるならばTRUEを返す。
2595 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2597 bool can_get_item(void)
2600 OBJECT_IDX floor_list[23];
2601 ITEM_NUMBER floor_num = 0;
2603 for (j = 0; j < INVEN_TOTAL; j++)
2604 if (item_tester_okay(&inventory[j]))
2607 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2615 * @brief オブジェクト選択の汎用関数 /
2616 * Let the user select an item, save its "index"
2617 * @param cp 選択したオブジェクトのIDを返す。
2618 * @param pmt 選択目的のメッセージ
2619 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2620 * @param mode オプションフラグ
2621 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2622 * Return TRUE only if an acceptable item was chosen by the user.\n
2624 * The selected item must satisfy the "item_tester_hook()" function,\n
2625 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2627 * All "item_tester" restrictions are cleared before this function returns.\n
2629 * The user is allowed to choose acceptable items from the equipment,\n
2630 * inventory, or floor, respectively, if the proper flag was given,\n
2631 * and there are any acceptable items in that location.\n
2633 * The equipment or inventory are displayed (even if no acceptable\n
2634 * items are in that location) if the proper flag was given.\n
2636 * If there are no acceptable items available anywhere, and "str" is\n
2637 * not NULL, then it will be used as the text of a warning message\n
2638 * before the function returns.\n
2640 * Note that the user must press "-" to specify the item on the floor,\n
2641 * and there is no way to "examine" the item on the floor, while the\n
2642 * use of "capital" letters will "examine" an inventory/equipment item,\n
2643 * and prompt for its use.\n
2645 * If a legal item is selected from the inventory, we save it in "cp"\n
2646 * directly (0 to 35), and return TRUE.\n
2648 * If a legal item is selected from the floor, we save it in "cp" as\n
2649 * a negative (-1 to -511), and return TRUE.\n
2651 * If no item is available, we do nothing to "cp", and we display a\n
2652 * warning message, using "str" if available, and return FALSE.\n
2654 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2656 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2657 * to allow the user to enter a command while viewing those screens, and\n
2658 * also to induce "auto-enter" of stores, and other such stuff.\n
2660 * Global "p_ptr->command_see" may be set before calling this function to start\n
2661 * out in "browse" mode. It is cleared before this function returns.\n
2663 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2664 * If it is TRUE then we are viewing inventory, else equipment.\n
2666 * We always erase the prompt when we are done, leaving a blank line,\n
2667 * or a warning message, if appropriate, if no items are available.\n
2669 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2671 OBJECT_IDX this_o_idx, next_o_idx = 0;
2688 bool allow_floor = FALSE;
2690 bool toggle = FALSE;
2695 int menu_line = (use_menu ? 1 : 0);
2699 static char prev_tag = '\0';
2700 char cur_tag = '\0';
2702 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2705 if (mode & USE_EQUIP) equip = TRUE;
2706 if (mode & USE_INVEN) inven = TRUE;
2707 if (mode & USE_FLOOR) floor = TRUE;
2709 /* Get the item index */
2710 if (repeat_pull(cp))
2713 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2715 item_tester_tval = 0;
2716 item_tester_hook = NULL;
2717 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2722 else if (floor && (*cp < 0))
2730 /* Validate the item */
2731 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2733 /* Forget restrictions */
2734 item_tester_tval = 0;
2735 item_tester_hook = NULL;
2736 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2743 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2744 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2746 if (prev_tag && command_cmd)
2748 /* Look up the tag and validate the item */
2749 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2750 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2751 else if (!get_item_okay(k)) /* Reject */;
2754 /* Accept that choice */
2757 /* Forget restrictions */
2758 item_tester_tval = 0;
2759 item_tester_hook = NULL;
2760 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2766 prev_tag = '\0'; /* prev_tag is no longer effective */
2769 /* Verify the item */
2770 else if (get_item_okay(*cp))
2772 /* Forget restrictions */
2773 item_tester_tval = 0;
2774 item_tester_hook = NULL;
2775 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2789 /* No item selected */
2793 /* Full inventory */
2795 i2 = INVEN_PACK - 1;
2797 /* Forbid inventory */
2798 if (!inven) i2 = -1;
2801 for (j = 0; j < INVEN_PACK; j++)
2802 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
2805 /* Restrict inventory indexes */
2806 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2807 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2810 /* Full equipment */
2812 e2 = INVEN_TOTAL - 1;
2814 /* Forbid equipment */
2815 if (!equip) e2 = -1;
2818 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2819 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
2820 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2823 /* Restrict equipment indexes */
2824 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2825 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2827 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2831 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2833 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2837 /* Restrict floor usage */
2840 /* Scan all objects in the grid */
2841 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2844 o_ptr = &o_list[this_o_idx];
2846 /* Acquire next object */
2847 next_o_idx = o_ptr->next_o_idx;
2849 /* Accept the item on the floor if legal */
2850 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2854 /* Require at least one legal choice */
2855 if (!allow_floor && (i1 > i2) && (e1 > e2))
2857 /* Cancel p_ptr->command_see */
2858 command_see = FALSE;
2862 if (mode & USE_FORCE) {
2868 /* Analyze choices */
2871 /* Hack -- Start on equipment if requested */
2872 if (command_see && command_wrk && equip)
2877 /* Use inventory if allowed */
2880 command_wrk = FALSE;
2883 /* Use equipment if allowed */
2889 /* Use inventory for floor */
2892 command_wrk = FALSE;
2898 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2900 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2902 /* Hack -- start out in "display" mode */
2909 /* Repeat until done */
2912 COMMAND_CODE get_item_label = 0;
2919 for (j = 0; j < 8; j++)
2922 if (!angband_term[j]) continue;
2924 /* Count windows displaying inven */
2925 if (window_flag[j] & (PW_INVEN)) ni++;
2927 /* Count windows displaying equip */
2928 if (window_flag[j] & (PW_EQUIP)) ne++;
2931 /* Toggle if needed */
2932 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2935 toggle_inven_equip();
2941 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2944 /* Inventory screen */
2947 /* Redraw if needed */
2948 if (command_see) get_item_label = show_inven(menu_line, mode);
2951 /* Equipment screen */
2954 /* Redraw if needed */
2955 if (command_see) get_item_label = show_equip(menu_line, mode);
2958 /* Viewing inventory */
2961 /* Begin the prompt */
2962 sprintf(out_val, _("持ち物:", "Inven:"));
2964 /* Some legal items */
2965 if ((i1 <= i2) && !use_menu)
2967 /* Build the prompt */
2968 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2969 index_to_label(i1), index_to_label(i2));
2972 strcat(out_val, tmp_val);
2975 /* Indicate ability to "view" */
2976 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2979 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2982 /* Viewing equipment */
2985 /* Begin the prompt */
2986 sprintf(out_val, _("装備品:", "Equip:"));
2988 /* Some legal items */
2989 if ((e1 <= e2) && !use_menu)
2991 /* Build the prompt */
2992 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2993 index_to_label(e1), index_to_label(e2));
2996 strcat(out_val, tmp_val);
2999 /* Indicate ability to "view" */
3000 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3003 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
3006 /* Indicate legality of the "floor" item */
3007 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3008 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3010 /* Finish the prompt */
3011 strcat(out_val, " ESC");
3013 /* Build the prompt */
3014 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3016 /* Show the prompt */
3024 int max_line = (command_wrk ? max_equip : max_inven);
3040 menu_line += (max_line - 1);
3059 /* Verify legality */
3060 if (!inven || !equip)
3066 /* Hack -- Fix screen */
3073 /* Switch inven/equip */
3074 command_wrk = !command_wrk;
3075 max_line = (command_wrk ? max_equip : max_inven);
3076 if (menu_line > max_line) menu_line = max_line;
3078 /* Need to redraw */
3087 if (command_wrk == USE_FLOOR)
3090 (*cp) = -get_item_label;
3094 /* Validate the item */
3095 if (!get_item_okay(get_item_label))
3101 /* Allow player to "refuse" certain actions */
3102 if (!get_item_allow(get_item_label))
3108 /* Accept that choice */
3109 (*cp) = get_item_label;
3118 if (mode & USE_FORCE) {
3126 if (menu_line > max_line) menu_line -= max_line;
3147 command_see = FALSE;
3164 /* Verify legality */
3165 if (!inven || !equip)
3171 /* Hack -- Fix screen */
3178 /* Switch inven/equip */
3179 command_wrk = !command_wrk;
3181 /* Need to redraw */
3187 /* Use floor item */
3190 /* Scan all objects in the grid */
3191 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3194 o_ptr = &o_list[this_o_idx];
3196 /* Acquire next object */
3197 next_o_idx = o_ptr->next_o_idx;
3199 /* Validate the item */
3200 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3205 /* Verify the item (if required) */
3206 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3208 /* Allow player to "refuse" certain actions */
3209 if (!get_item_allow(k)) continue;
3211 /* Accept that choice */
3227 case '1': case '2': case '3':
3228 case '4': case '5': case '6':
3229 case '7': case '8': case '9':
3231 /* Look up the tag */
3232 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3238 /* Hack -- Validate the item */
3239 if ((k < INVEN_RARM) ? !inven : !equip)
3245 /* Validate the item */
3246 if (!get_item_okay(k))
3252 /* Allow player to "refuse" certain actions */
3253 if (!get_item_allow(k))
3259 /* Accept that choice */
3271 /* Choose "default" inventory item */
3274 k = ((i1 == i2) ? i1 : -1);
3277 /* Choose "default" equipment item */
3280 k = ((e1 == e2) ? e1 : -1);
3283 /* Validate the item */
3284 if (!get_item_okay(k))
3290 /* Allow player to "refuse" certain actions */
3291 if (!get_item_allow(k))
3297 /* Accept that choice */
3307 if (mode & USE_FORCE) {
3320 bool not_found = FALSE;
3322 /* Look up the alphabetical tag */
3323 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3328 /* Hack -- Validate the item */
3329 else if ((k < INVEN_RARM) ? !inven : !equip)
3334 /* Validate the item */
3335 else if (!get_item_okay(k))
3342 /* Accept that choice */
3350 /* Extract "query" setting */
3351 ver = isupper(which);
3352 which = (char)tolower(which);
3354 /* Convert letter to inventory index */
3357 if (which == '(') k = i1;
3358 else if (which == ')') k = i2;
3359 else k = label_to_inven(which);
3362 /* Convert letter to equipment index */
3365 if (which == '(') k = e1;
3366 else if (which == ')') k = e2;
3367 else k = label_to_equip(which);
3370 /* Validate the item */
3371 if (!get_item_okay(k))
3377 /* Verify the item */
3378 if (ver && !verify(_("本当に", "Try"), k))
3384 /* Allow player to "refuse" certain actions */
3385 if (!get_item_allow(k))
3391 /* Accept that choice */
3402 /* Fix the screen if necessary */
3407 /* Hack -- Cancel "display" */
3408 command_see = FALSE;
3412 /* Forget the item_tester_tval restriction */
3413 item_tester_tval = 0;
3415 /* Forget the item_tester_hook restriction */
3416 item_tester_hook = NULL;
3419 /* Clean up 'show choices' */
3420 /* Toggle again if needed */
3421 if (toggle) toggle_inven_equip();
3423 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3426 /* Clear the prompt line */
3429 /* Warning if needed */
3430 if (oops && str) msg_print(str);
3435 if (command_cmd) prev_tag = cur_tag;
3436 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3442 * Choose an item and get auto-picker entry from it.
3444 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3447 if (!get_item(&item, q, s, option)) return NULL;
3448 if (idx) *idx = item;
3450 if (item == INVEN_FORCE) return NULL;
3452 /* Get the item (in the pack) */
3453 else if (item >= 0) return &inventory[item];
3455 /* Get the item (on the floor) */
3456 else return &o_list[0 - item];
3461 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3462 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3463 * @param y 走査するフロアのY座標
3464 * @param x 走査するフロアのX座標
3465 * @param mode オプションフラグ
3466 * @return 対象のマスに落ちているアイテム数
3468 * Return a list of o_list[] indexes of items at the given cave
3469 * location. Valid flags are:
3471 * mode & 0x01 -- Item tester
3472 * mode & 0x02 -- Marked items only
3473 * mode & 0x04 -- Stop after first
3475 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3477 OBJECT_IDX this_o_idx, next_o_idx;
3479 ITEM_NUMBER num = 0;
3482 if (!in_bounds(y, x)) return 0;
3484 /* Scan all objects in the grid */
3485 for (this_o_idx = cave[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3488 o_ptr = &o_list[this_o_idx];
3490 /* Acquire next object */
3491 next_o_idx = o_ptr->next_o_idx;
3494 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3497 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3499 /* Accept this item */
3500 /* XXX Hack -- Enforce limit */
3502 items[num] = this_o_idx;
3507 if (mode & 0x04) break;
3514 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3515 * @param target_item カーソルの初期値
3516 * @param y 走査するフロアのY座標
3517 * @param x 走査するフロアのX座標
3518 * @param min_width 表示の長さ
3519 * @return 選択したアイテムの添え字
3522 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3530 GAME_TEXT o_name[MAX_NLEN];
3533 COMMAND_CODE out_index[23];
3534 TERM_COLOR out_color[23];
3535 char out_desc[23][MAX_NLEN];
3536 COMMAND_CODE target_item_label = 0;
3538 OBJECT_IDX floor_list[23];
3539 ITEM_NUMBER floor_num;
3541 char floor_label[52 + 1];
3543 bool dont_need_to_show_weights = TRUE;
3545 Term_get_size(&wid, &hgt);
3547 /* Default length */
3548 len = MAX((*min_width), 20);
3550 /* Scan for objects in the grid, using item_tester_okay() */
3551 floor_num = scan_floor(floor_list, y, x, 0x03);
3553 /* Display the floor objects */
3554 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3556 o_ptr = &o_list[floor_list[i]];
3558 object_desc(o_name, o_ptr, 0);
3560 /* Save the index */
3563 /* Acquire inventory color */
3564 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3566 /* Save the object description */
3567 strcpy(out_desc[k], o_name);
3569 /* Find the predicted "line length" */
3570 l = strlen(out_desc[k]) + 5;
3572 /* Be sure to account for the weight */
3573 if (show_weights) l += 9;
3575 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3577 /* Maintain the maximum length */
3578 if (l > len) len = l;
3580 /* Advance to next "line" */
3584 if (show_weights && dont_need_to_show_weights) len -= 9;
3589 /* Find the column to start in */
3590 col = (len > wid - 4) ? 0 : (wid - len - 1);
3592 prepare_label_string_floor(floor_label, floor_list, floor_num);
3594 /* Output each entry */
3595 for (j = 0; j < k; j++)
3598 m = floor_list[out_index[j]];
3602 /* Clear the line */
3603 prt("", j + 1, col ? col - 2 : col);
3605 if (use_menu && target_item)
3607 if (j == (target_item-1))
3609 strcpy(tmp_val, _("》", "> "));
3610 target_item_label = m;
3612 else strcpy(tmp_val, " ");
3616 /* Prepare an index --(-- */
3617 sprintf(tmp_val, "%c)", floor_label[j]);
3620 /* Clear the line with the (possibly indented) index */
3621 put_str(tmp_val, j + 1, col);
3623 /* Display the entry itself */
3624 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3626 /* Display the weight if needed */
3627 if (show_weights && (o_ptr->tval != TV_GOLD))
3629 int wgt = o_ptr->weight * o_ptr->number;
3631 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3633 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3636 prt(tmp_val, j + 1, wid - 9);
3640 /* Make a "shadow" below the list (only if needed) */
3641 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3643 return target_item_label;
3647 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3648 * Let the user select an item, save its "index"
3649 * @param cp 選択したオブジェクトのIDを返す。
3650 * @param pmt 選択目的のメッセージ
3651 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3652 * @param mode オプションフラグ
3653 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3655 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3657 char n1 = ' ', n2 = ' ', which = ' ';
3660 COMMAND_CODE i1, i2;
3661 COMMAND_CODE e1, e2;
3669 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3670 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3671 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3672 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3674 bool allow_equip = FALSE;
3675 bool allow_inven = FALSE;
3676 bool allow_floor = FALSE;
3678 bool toggle = FALSE;
3683 ITEM_NUMBER floor_num;
3684 OBJECT_IDX floor_list[23];
3686 TERM_LEN min_width = 0;
3688 int menu_line = (use_menu ? 1 : 0);
3692 static char prev_tag = '\0';
3693 char cur_tag = '\0';
3695 /* Get the item index */
3696 if (repeat_pull(cp))
3699 if (force && (*cp == INVEN_FORCE))
3701 item_tester_tval = 0;
3702 item_tester_hook = NULL;
3703 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3708 else if (floor && (*cp < 0))
3710 if (prev_tag && command_cmd)
3712 /* Scan all objects in the grid */
3713 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3715 /* Look up the tag */
3716 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3718 /* Accept that choice */
3719 (*cp) = 0 - floor_list[k];
3721 /* Forget restrictions */
3722 item_tester_tval = 0;
3723 item_tester_hook = NULL;
3724 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3730 prev_tag = '\0'; /* prev_tag is no longer effective */
3733 /* Validate the item */
3734 else if (item_tester_okay(&o_list[0 - (*cp)]) || (mode & USE_FULL))
3736 /* Forget restrictions */
3737 item_tester_tval = 0;
3738 item_tester_hook = NULL;
3739 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3746 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3747 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3749 if (prev_tag && command_cmd)
3751 /* Look up the tag and validate the item */
3752 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3753 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3754 else if (!get_item_okay(k)) /* Reject */;
3757 /* Accept that choice */
3760 /* Forget restrictions */
3761 item_tester_tval = 0;
3762 item_tester_hook = NULL;
3763 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3769 prev_tag = '\0'; /* prev_tag is no longer effective */
3772 /* Verify the item */
3773 else if (get_item_okay(*cp))
3775 /* Forget restrictions */
3776 item_tester_tval = 0;
3777 item_tester_hook = NULL;
3778 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3794 /* No item selected */
3798 /* Full inventory */
3800 i2 = INVEN_PACK - 1;
3802 /* Forbid inventory */
3803 if (!inven) i2 = -1;
3806 for (j = 0; j < INVEN_PACK; j++)
3807 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
3810 /* Restrict inventory indexes */
3811 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3812 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3815 /* Full equipment */
3817 e2 = INVEN_TOTAL - 1;
3819 /* Forbid equipment */
3820 if (!equip) e2 = -1;
3823 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3824 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
3825 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3828 /* Restrict equipment indexes */
3829 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3830 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3832 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3836 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3838 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3842 /* Count "okay" floor items */
3845 /* Restrict floor usage */
3848 /* Scan all objects in the grid */
3849 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3852 /* Accept inventory */
3853 if (i1 <= i2) allow_inven = TRUE;
3855 /* Accept equipment */
3856 if (e1 <= e2) allow_equip = TRUE;
3859 if (floor_num) allow_floor = TRUE;
3861 /* Require at least one legal choice */
3862 if (!allow_inven && !allow_equip && !allow_floor)
3864 /* Cancel p_ptr->command_see */
3865 command_see = FALSE;
3875 /* Analyze choices */
3878 /* Hack -- Start on equipment if requested */
3879 if (command_see && (command_wrk == (USE_EQUIP))
3882 command_wrk = (USE_EQUIP);
3885 /* Use inventory if allowed */
3886 else if (allow_inven)
3888 command_wrk = (USE_INVEN);
3891 /* Use equipment if allowed */
3892 else if (allow_equip)
3894 command_wrk = (USE_EQUIP);
3897 /* Use floor if allowed */
3898 else if (allow_floor)
3900 command_wrk = (USE_FLOOR);
3905 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3907 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3909 /* Hack -- start out in "display" mode */
3915 /* Repeat until done */
3918 COMMAND_CODE get_item_label = 0;
3925 for (j = 0; j < 8; j++)
3928 if (!angband_term[j]) continue;
3930 /* Count windows displaying inven */
3931 if (window_flag[j] & (PW_INVEN)) ni++;
3933 /* Count windows displaying equip */
3934 if (window_flag[j] & (PW_EQUIP)) ne++;
3937 /* Toggle if needed */
3938 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3939 (command_wrk == (USE_INVEN) && !ni && ne))
3942 toggle_inven_equip();
3948 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3951 /* Inventory screen */
3952 if (command_wrk == (USE_INVEN))
3954 /* Extract the legal requests */
3958 /* Redraw if needed */
3959 if (command_see) get_item_label = show_inven(menu_line, mode);
3962 /* Equipment screen */
3963 else if (command_wrk == (USE_EQUIP))
3965 /* Extract the legal requests */
3966 n1 = I2A(e1 - INVEN_RARM);
3967 n2 = I2A(e2 - INVEN_RARM);
3969 /* Redraw if needed */
3970 if (command_see) get_item_label = show_equip(menu_line, mode);
3974 else if (command_wrk == (USE_FLOOR))
3977 k = MIN(floor_top + 23, floor_num) - 1;
3979 /* Extract the legal requests */
3980 n1 = I2A(j - floor_top);
3981 n2 = I2A(k - floor_top);
3983 /* Redraw if needed */
3984 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3987 /* Viewing inventory */
3988 if (command_wrk == (USE_INVEN))
3990 /* Begin the prompt */
3991 sprintf(out_val, _("持ち物:", "Inven:"));
3995 /* Build the prompt */
3996 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3997 index_to_label(i1), index_to_label(i2));
4000 strcat(out_val, tmp_val);
4003 /* Indicate ability to "view" */
4004 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4010 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
4011 else if (allow_floor)
4012 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
4014 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4021 strcat(out_val, _(" '-'床上,", " - for floor,"));
4022 else if (allow_equip)
4023 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
4025 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4029 /* Viewing equipment */
4030 else if (command_wrk == (USE_EQUIP))
4032 /* Begin the prompt */
4033 sprintf(out_val, _("装備品:", "Equip:"));
4037 /* Build the prompt */
4038 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4039 index_to_label(e1), index_to_label(e2));
4042 strcat(out_val, tmp_val);
4045 /* Indicate ability to "view" */
4046 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4052 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4053 else if (allow_floor)
4054 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
4056 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4063 strcat(out_val, _(" '-'床上,", " - for floor,"));
4064 else if (allow_inven)
4065 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4067 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4072 else if (command_wrk == (USE_FLOOR))
4074 /* Begin the prompt */
4075 sprintf(out_val, _("床上:", "Floor:"));
4079 /* Build the prompt */
4080 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4083 strcat(out_val, tmp_val);
4086 /* Indicate ability to "view" */
4087 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4091 if (allow_inven && allow_equip)
4093 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4095 else if (allow_inven)
4097 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4099 else if (allow_equip)
4101 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4105 else if (allow_inven)
4107 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4109 else if (allow_equip)
4111 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4115 if (command_see && !use_menu)
4117 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4122 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4124 /* Finish the prompt */
4125 strcat(out_val, " ESC");
4127 /* Build the prompt */
4128 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4130 /* Show the prompt */
4139 if (command_wrk == USE_INVEN) max_line = max_inven;
4140 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4141 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4157 menu_line += (max_line - 1);
4173 /* Verify legality */
4174 if (command_wrk == (USE_INVEN))
4176 if (allow_floor) command_wrk = USE_FLOOR;
4177 else if (allow_equip) command_wrk = USE_EQUIP;
4184 else if (command_wrk == (USE_EQUIP))
4186 if (allow_inven) command_wrk = USE_INVEN;
4187 else if (allow_floor) command_wrk = USE_FLOOR;
4194 else if (command_wrk == (USE_FLOOR))
4196 if (allow_equip) command_wrk = USE_EQUIP;
4197 else if (allow_inven) command_wrk = USE_INVEN;
4210 /* Hack -- Fix screen */
4217 /* Switch inven/equip */
4218 if (command_wrk == USE_INVEN) max_line = max_inven;
4219 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4220 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4221 if (menu_line > max_line) menu_line = max_line;
4223 /* Need to redraw */
4231 /* Verify legality */
4232 if (command_wrk == (USE_INVEN))
4234 if (allow_equip) command_wrk = USE_EQUIP;
4235 else if (allow_floor) command_wrk = USE_FLOOR;
4242 else if (command_wrk == (USE_EQUIP))
4244 if (allow_floor) command_wrk = USE_FLOOR;
4245 else if (allow_inven) command_wrk = USE_INVEN;
4252 else if (command_wrk == (USE_FLOOR))
4254 if (allow_inven) command_wrk = USE_INVEN;
4255 else if (allow_equip) command_wrk = USE_EQUIP;
4268 /* Hack -- Fix screen */
4275 /* Switch inven/equip */
4276 if (command_wrk == USE_INVEN) max_line = max_inven;
4277 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4278 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4279 if (menu_line > max_line) menu_line = max_line;
4281 /* Need to redraw */
4290 if (command_wrk == USE_FLOOR)
4293 (*cp) = -get_item_label;
4297 /* Validate the item */
4298 if (!get_item_okay(get_item_label))
4304 /* Allow player to "refuse" certain actions */
4305 if (!get_item_allow(get_item_label))
4311 /* Accept that choice */
4312 (*cp) = get_item_label;
4329 if (menu_line > max_line) menu_line -= max_line;
4350 command_see = FALSE;
4371 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
4373 if (command_wrk != (USE_FLOOR)) break;
4375 /* Get the object being moved. */
4376 o_idx = c_ptr->o_idx;
4378 /* Only rotate a pile of two or more objects. */
4379 if (!(o_idx && o_list[o_idx].next_o_idx)) break;
4381 /* Remove the first object from the list. */
4382 excise_object_idx(o_idx);
4384 /* Find end of the list. */
4386 while (o_list[i].next_o_idx)
4387 i = o_list[i].next_o_idx;
4389 /* Add after the last object. */
4390 o_list[i].next_o_idx = o_idx;
4392 /* Re-scan floor list */
4393 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4395 /* Hack -- Fix screen */
4407 if (command_wrk == (USE_INVEN))
4414 command_wrk = (USE_EQUIP);
4416 else if (command_wrk == (USE_EQUIP))
4423 command_wrk = (USE_INVEN);
4425 else if (command_wrk == (USE_FLOOR))
4429 command_wrk = (USE_INVEN);
4431 else if (allow_equip)
4433 command_wrk = (USE_EQUIP);
4442 /* Hack -- Fix screen */
4449 /* Need to redraw */
4462 * If we are already examining the floor, and there
4463 * is only one item, we will always select it.
4464 * If we aren't examining the floor and there is only
4465 * one item, we will select it if floor_query_flag
4470 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4473 k = 0 - floor_list[0];
4475 /* Allow player to "refuse" certain actions */
4476 if (!get_item_allow(k))
4482 /* Accept that choice */
4491 /* Hack -- Fix screen */
4498 command_wrk = (USE_FLOOR);
4504 case '1': case '2': case '3':
4505 case '4': case '5': case '6':
4506 case '7': case '8': case '9':
4508 if (command_wrk != USE_FLOOR)
4510 /* Look up the tag */
4511 if (!get_tag(&k, which, command_wrk))
4517 /* Hack -- Validate the item */
4518 if ((k < INVEN_RARM) ? !inven : !equip)
4524 /* Validate the item */
4525 if (!get_item_okay(k))
4533 /* Look up the alphabetical tag */
4534 if (get_tag_floor(&k, which, floor_list, floor_num))
4537 k = 0 - floor_list[k];
4546 /* Allow player to "refuse" certain actions */
4547 if (!get_item_allow(k))
4553 /* Accept that choice */
4565 /* Choose "default" inventory item */
4566 if (command_wrk == (USE_INVEN))
4568 k = ((i1 == i2) ? i1 : -1);
4571 /* Choose "default" equipment item */
4572 else if (command_wrk == (USE_EQUIP))
4574 k = ((e1 == e2) ? e1 : -1);
4577 /* Choose "default" floor item */
4578 else if (command_wrk == (USE_FLOOR))
4583 k = 0 - floor_list[0];
4585 /* Allow player to "refuse" certain actions */
4586 if (!get_item_allow(k))
4592 /* Accept that choice */
4600 /* Validate the item */
4601 if (!get_item_okay(k))
4607 /* Allow player to "refuse" certain actions */
4608 if (!get_item_allow(k))
4614 /* Accept that choice */
4638 if (command_wrk != USE_FLOOR)
4640 bool not_found = FALSE;
4642 /* Look up the alphabetical tag */
4643 if (!get_tag(&k, which, command_wrk))
4648 /* Hack -- Validate the item */
4649 else if ((k < INVEN_RARM) ? !inven : !equip)
4654 /* Validate the item */
4655 else if (!get_item_okay(k))
4662 /* Accept that choice */
4672 /* Look up the alphabetical tag */
4673 if (get_tag_floor(&k, which, floor_list, floor_num))
4676 k = 0 - floor_list[k];
4678 /* Accept that choice */
4687 /* Extract "query" setting */
4688 ver = isupper(which);
4689 which = (char)tolower(which);
4691 /* Convert letter to inventory index */
4692 if (command_wrk == (USE_INVEN))
4694 if (which == '(') k = i1;
4695 else if (which == ')') k = i2;
4696 else k = label_to_inven(which);
4699 /* Convert letter to equipment index */
4700 else if (command_wrk == (USE_EQUIP))
4702 if (which == '(') k = e1;
4703 else if (which == ')') k = e2;
4704 else k = label_to_equip(which);
4707 /* Convert letter to floor index */
4708 else if (command_wrk == USE_FLOOR)
4710 if (which == '(') k = 0;
4711 else if (which == ')') k = floor_num - 1;
4712 else k = islower(which) ? A2I(which) : -1;
4713 if (k < 0 || k >= floor_num || k >= 23)
4720 k = 0 - floor_list[k];
4723 /* Validate the item */
4724 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4730 /* Verify the item */
4731 if (ver && !verify(_("本当に", "Try"), k))
4737 /* Allow player to "refuse" certain actions */
4738 if (!get_item_allow(k))
4744 /* Accept that choice */
4754 /* Fix the screen if necessary */
4759 /* Hack -- Cancel "display" */
4760 command_see = FALSE;
4764 /* Forget the item_tester_tval restriction */
4765 item_tester_tval = 0;
4767 /* Forget the item_tester_hook restriction */
4768 item_tester_hook = NULL;
4771 /* Clean up 'show choices' */
4772 /* Toggle again if needed */
4773 if (toggle) toggle_inven_equip();
4775 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4778 /* Clear the prompt line */
4781 /* Warning if needed */
4782 if (oops && str) msg_print(str);
4787 if (command_cmd) prev_tag = cur_tag;
4788 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4794 * @brief 床上のアイテムを拾う選択用サブルーチン
4795 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4797 static bool py_pickup_floor_aux(void)
4799 OBJECT_IDX this_o_idx;
4803 /* Restrict the choices */
4804 item_tester_hook = inven_carry_okay;
4807 q = _("どれを拾いますか?", "Get which item? ");
4808 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4810 if (choose_object(&item, q, s, (USE_FLOOR)))
4812 this_o_idx = 0 - item;
4819 /* Pick up the object */
4820 py_pickup_aux(this_o_idx);
4826 * @brief 床上のアイテムを拾うメイン処理
4827 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4830 * This is called by py_pickup() when easy_floor is TRUE.
4832 void py_pickup_floor(bool pickup)
4834 OBJECT_IDX this_o_idx, next_o_idx = 0;
4836 GAME_TEXT o_name[MAX_NLEN];
4840 OBJECT_IDX floor_o_idx = 0;
4844 /* Scan the pile of objects */
4845 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
4847 /* Access the object */
4848 o_ptr = &o_list[this_o_idx];
4850 object_desc(o_name, o_ptr, 0);
4852 /* Access the next object */
4853 next_o_idx = o_ptr->next_o_idx;
4855 /* Hack -- disturb */
4856 disturb(FALSE, FALSE);
4859 if (o_ptr->tval == TV_GOLD)
4862 msg_format(" $%ld の価値がある%sを見つけた。",
4863 (long)o_ptr->pval, o_name);
4865 msg_format("You have found %ld gold pieces worth of %s.",
4866 (long)o_ptr->pval, o_name);
4869 /* Collect the gold */
4870 p_ptr->au += o_ptr->pval;
4873 p_ptr->redraw |= (PR_GOLD);
4875 p_ptr->window |= (PW_PLAYER);
4877 /* Delete the gold */
4878 delete_object_idx(this_o_idx);
4880 /* Check the next object */
4883 else if (o_ptr->marked & OM_NOMSG)
4885 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4886 * ignored. Otherwise, they are included in the prompt. */
4887 o_ptr->marked &= ~(OM_NOMSG);
4891 /* Count non-gold objects that can be picked up. */
4892 if (inven_carry_okay(o_ptr))
4897 /* Count non-gold objects */
4900 /* Remember this index */
4901 floor_o_idx = this_o_idx;
4904 /* There are no non-gold objects */
4908 /* Mention the number of objects */
4914 /* Access the object */
4915 o_ptr = &o_list[floor_o_idx];
4917 #ifdef ALLOW_EASY_SENSE
4919 /* Option: Make object sensing easy */
4922 /* Sense the object */
4923 (void) sense_object(o_ptr);
4926 #endif /* ALLOW_EASY_SENSE */
4928 object_desc(o_name, o_ptr, 0);
4930 msg_format(_("%sがある。", "You see %s."), o_name);
4933 /* Multiple objects */
4936 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4942 /* The player has no room for anything on the floor. */
4948 /* Access the object */
4949 o_ptr = &o_list[floor_o_idx];
4951 #ifdef ALLOW_EASY_SENSE
4953 /* Option: Make object sensing easy */
4956 /* Sense the object */
4957 (void) sense_object(o_ptr);
4960 #endif /* ALLOW_EASY_SENSE */
4962 object_desc(o_name, o_ptr, 0);
4964 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4967 /* Multiple objects */
4970 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4980 /* Hack -- query every object */
4981 if (carry_query_flag)
4983 char out_val[MAX_NLEN+20];
4985 /* Access the object */
4986 o_ptr = &o_list[floor_o_idx];
4988 #ifdef ALLOW_EASY_SENSE
4990 /* Option: Make object sensing easy */
4993 /* Sense the object */
4994 (void) sense_object(o_ptr);
4997 #endif /* ALLOW_EASY_SENSE */
4999 object_desc(o_name, o_ptr, 0);
5001 /* Build a prompt */
5002 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
5004 /* Ask the user to confirm */
5005 if (!get_check(out_val))
5011 /* Access the object */
5012 o_ptr = &o_list[floor_o_idx];
5014 #ifdef ALLOW_EASY_SENSE
5016 /* Option: Make object sensing easy */
5019 /* Sense the object */
5020 (void) sense_object(o_ptr);
5023 #endif /* ALLOW_EASY_SENSE */
5025 /* Pick up the object */
5026 py_pickup_aux(floor_o_idx);
5029 /* Allow the user to choose an object */
5032 while (can_pickup--)
5034 if (!py_pickup_floor_aux()) break;
5041 * @brief 矢弾を射撃した場合の破損確率を返す /
5042 * Determines the odds of an object breaking when thrown at a monster
5043 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
5046 * Note that artifacts never break, see the "drop_near()" function.
5048 PERCENTAGE breakage_chance(object_type *o_ptr)
5050 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
5052 /* Examine the snipe type */
5055 if (snipe_type == SP_KILL_WALL) return (100);
5056 if (snipe_type == SP_EXPLODE) return (100);
5057 if (snipe_type == SP_PIERCE) return (100);
5058 if (snipe_type == SP_FINAL) return (100);
5059 if (snipe_type == SP_NEEDLE) return (100);
5060 if (snipe_type == SP_EVILNESS) return (40);
5061 if (snipe_type == SP_HOLYNESS) return (40);
5064 /* Examine the item type */
5065 switch (o_ptr->tval)
5081 /* Sometimes break */
5086 return (20 - archer_bonus * 2);
5091 return (10 - archer_bonus);