3 * @brief オブジェクトの実装 / Object code, part 1
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2014 Deskull rearranged comment for Doxygen.\n
19 #include "cmd-activate.h"
20 #include "objectkind.h"
21 #include "object-flavor.h"
22 #include "object-hook.h"
23 #include "player-move.h"
27 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
34 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
36 * This involves resetting various things to their "default" state.\n
38 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
39 * "user pref file" based on the current setting of the "use_graphics"\n
40 * flag. This is useful for switching "graphics" on/off.\n
42 * The features, objects, and monsters, should all be encoded in the\n
43 * relevant "font.pref" and/or "graf.prf" files. \n
45 * The "prefs" parameter is no longer meaningful. \n
47 void reset_visuals(void)
51 /* Extract some info about terrain features */
52 for (i = 0; i < max_f_idx; i++)
54 feature_type *f_ptr = &f_info[i];
56 /* Assume we will use the underlying values */
57 for (j = 0; j < F_LIT_MAX; j++)
59 f_ptr->x_attr[j] = f_ptr->d_attr[j];
60 f_ptr->x_char[j] = f_ptr->d_char[j];
64 /* Extract default attr/char code for objects */
65 for (i = 0; i < max_k_idx; i++)
67 object_kind *k_ptr = &k_info[i];
69 /* Default attr/char */
70 k_ptr->x_attr = k_ptr->d_attr;
71 k_ptr->x_char = k_ptr->d_char;
74 /* Extract default attr/char code for monsters */
75 for (i = 0; i < max_r_idx; i++)
77 monster_race *r_ptr = &r_info[i];
79 /* Default attr/char */
80 r_ptr->x_attr = r_ptr->d_attr;
81 r_ptr->x_char = r_ptr->d_char;
88 /* Process "graf.prf" */
89 process_pref_file("graf.prf");
91 /* Access the "character" pref file */
92 sprintf(buf, "graf-%s.prf", player_base);
94 /* Process "graf-<playername>.prf" */
95 process_pref_file(buf);
103 /* Process "font.prf" */
104 process_pref_file("font.prf");
106 /* Access the "character" pref file */
107 sprintf(buf, "font-%s.prf", player_base);
109 /* Process "font-<playername>.prf" */
110 process_pref_file(buf);
115 * @brief オブジェクトのフラグ類を配列に与える
116 * Obtain the "flags" for an item
117 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
118 * @param flgs フラグ情報を受け取る配列
121 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
123 object_kind *k_ptr = &k_info[o_ptr->k_idx];
127 for (i = 0; i < TR_FLAG_SIZE; i++)
128 flgs[i] = k_ptr->flags[i];
131 if (object_is_fixed_artifact(o_ptr))
133 artifact_type *a_ptr = &a_info[o_ptr->name1];
135 for (i = 0; i < TR_FLAG_SIZE; i++)
136 flgs[i] = a_ptr->flags[i];
140 if (object_is_ego(o_ptr))
142 ego_item_type *e_ptr = &e_info[o_ptr->name2];
144 for (i = 0; i < TR_FLAG_SIZE; i++)
145 flgs[i] |= e_ptr->flags[i];
147 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
149 remove_flag(flgs, TR_SH_FIRE);
151 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
153 remove_flag(flgs, TR_INFRA);
155 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
157 remove_flag(flgs, TR_RES_BLIND);
158 remove_flag(flgs, TR_SEE_INVIS);
162 /* Random artifact ! */
163 for (i = 0; i < TR_FLAG_SIZE; i++)
164 flgs[i] |= o_ptr->art_flags[i];
166 if (object_is_smith(o_ptr))
168 int add = o_ptr->xtra3 - 1;
170 if (add < TR_FLAG_MAX)
174 else if (add == ESSENCE_TMP_RES_ACID)
176 add_flag(flgs, TR_RES_ACID);
177 add_flag(flgs, TR_ACTIVATE);
179 else if (add == ESSENCE_TMP_RES_ELEC)
181 add_flag(flgs, TR_RES_ELEC);
182 add_flag(flgs, TR_ACTIVATE);
184 else if (add == ESSENCE_TMP_RES_FIRE)
186 add_flag(flgs, TR_RES_FIRE);
187 add_flag(flgs, TR_ACTIVATE);
189 else if (add == ESSENCE_TMP_RES_COLD)
191 add_flag(flgs, TR_RES_COLD);
192 add_flag(flgs, TR_ACTIVATE);
194 else if (add == ESSENCE_SH_FIRE)
196 add_flag(flgs, TR_RES_FIRE);
197 add_flag(flgs, TR_SH_FIRE);
199 else if (add == ESSENCE_SH_ELEC)
201 add_flag(flgs, TR_RES_ELEC);
202 add_flag(flgs, TR_SH_ELEC);
204 else if (add == ESSENCE_SH_COLD)
206 add_flag(flgs, TR_RES_COLD);
207 add_flag(flgs, TR_SH_COLD);
209 else if (add == ESSENCE_RESISTANCE)
211 add_flag(flgs, TR_RES_ACID);
212 add_flag(flgs, TR_RES_ELEC);
213 add_flag(flgs, TR_RES_FIRE);
214 add_flag(flgs, TR_RES_COLD);
216 else if (add == TR_IMPACT)
218 add_flag(flgs, TR_ACTIVATE);
224 * @brief オブジェクトの明示されているフラグ類を取得する
225 * Obtain the "flags" for an item which are known to the player
226 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
227 * @param flgs フラグ情報を受け取る配列
230 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
235 object_kind *k_ptr = &k_info[o_ptr->k_idx];
238 for (i = 0; i < TR_FLAG_SIZE; i++)
241 if (!object_is_aware(o_ptr)) return;
244 for (i = 0; i < TR_FLAG_SIZE; i++)
245 flgs[i] = k_ptr->flags[i];
247 /* Must be identified */
248 if (!object_is_known(o_ptr)) return;
250 /* Ego-item (known basic flags) */
251 if (object_is_ego(o_ptr))
253 ego_item_type *e_ptr = &e_info[o_ptr->name2];
255 for (i = 0; i < TR_FLAG_SIZE; i++)
256 flgs[i] |= e_ptr->flags[i];
258 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
260 remove_flag(flgs, TR_SH_FIRE);
262 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
264 remove_flag(flgs, TR_INFRA);
266 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
268 remove_flag(flgs, TR_RES_BLIND);
269 remove_flag(flgs, TR_SEE_INVIS);
274 #ifdef SPOIL_ARTIFACTS
275 /* Full knowledge for some artifacts */
276 if (object_is_artifact(o_ptr)) spoil = TRUE;
277 #endif /* SPOIL_ARTIFACTS */
279 #ifdef SPOIL_EGO_ITEMS
280 /* Full knowledge for some ego-items */
281 if (object_is_ego(o_ptr)) spoil = TRUE;
282 #endif /* SPOIL_EGO_ITEMS */
284 /* Need full knowledge or spoilers */
285 if (spoil || (o_ptr->ident & IDENT_MENTAL))
288 if (object_is_fixed_artifact(o_ptr))
290 artifact_type *a_ptr = &a_info[o_ptr->name1];
292 for (i = 0; i < TR_FLAG_SIZE; i++)
293 flgs[i] = a_ptr->flags[i];
296 /* Random artifact ! */
297 for (i = 0; i < TR_FLAG_SIZE; i++)
298 flgs[i] |= o_ptr->art_flags[i];
301 if (object_is_smith(o_ptr))
303 int add = o_ptr->xtra3 - 1;
305 if (add < TR_FLAG_MAX)
309 else if (add == ESSENCE_TMP_RES_ACID)
311 add_flag(flgs, TR_RES_ACID);
313 else if (add == ESSENCE_TMP_RES_ELEC)
315 add_flag(flgs, TR_RES_ELEC);
317 else if (add == ESSENCE_TMP_RES_FIRE)
319 add_flag(flgs, TR_RES_FIRE);
321 else if (add == ESSENCE_TMP_RES_COLD)
323 add_flag(flgs, TR_RES_COLD);
325 else if (add == ESSENCE_SH_FIRE)
327 add_flag(flgs, TR_RES_FIRE);
328 add_flag(flgs, TR_SH_FIRE);
330 else if (add == ESSENCE_SH_ELEC)
332 add_flag(flgs, TR_RES_ELEC);
333 add_flag(flgs, TR_SH_ELEC);
335 else if (add == ESSENCE_SH_COLD)
337 add_flag(flgs, TR_RES_COLD);
338 add_flag(flgs, TR_SH_COLD);
340 else if (add == ESSENCE_RESISTANCE)
342 add_flag(flgs, TR_RES_ACID);
343 add_flag(flgs, TR_RES_ELEC);
344 add_flag(flgs, TR_RES_FIRE);
345 add_flag(flgs, TR_RES_COLD);
351 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
352 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
353 * @return concptr 発動名称を返す文字列ポインタ
355 static concptr item_activation_dragon_breath(object_type *o_ptr)
357 static char desc[256];
358 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
361 object_flags(o_ptr, flgs);
362 strcpy(desc, _("", "breath "));
364 for (i = 0; dragonbreath_info[i].flag != 0; i++)
366 if (have_flag(flgs, dragonbreath_info[i].flag))
368 if (n > 0) strcat(desc, _("、", ", "));
369 strcat(desc, dragonbreath_info[i].name);
374 strcat(desc, _("のブレス(250)", ""));
380 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
381 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
382 * @return concptr 発動名称を返す文字列ポインタ
384 static concptr item_activation_aux(object_type *o_ptr)
386 static char activation_detail[256];
390 const activation_type* const act_ptr = find_activation_info(o_ptr);
392 if (!act_ptr) return _("未定義", "something undefined");
394 desc = act_ptr->desc;
396 /* Overwrite description if it is special */
397 switch (act_ptr->index) {
399 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
400 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
403 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
404 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
407 desc = item_activation_dragon_breath(o_ptr);
410 if (o_ptr->name1 == ART_HYOUSIGI)
411 desc = _("拍子木を打ちならす", "beat wooden clappers");
413 case ACT_RESIST_ACID:
414 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
415 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
417 case ACT_RESIST_FIRE:
418 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
419 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
421 case ACT_RESIST_COLD:
422 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
423 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
425 case ACT_RESIST_ELEC:
426 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
427 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
429 case ACT_RESIST_POIS:
430 if (o_ptr->name2 == EGO_BRAND_POIS)
431 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
435 /* Timeout description */
436 constant = act_ptr->timeout.constant;
437 dice = act_ptr->timeout.dice;
438 if (constant == 0 && dice == 0) {
439 /* We can activate it every current_world_ptr->game_turn */
440 strcpy(timeout, _("いつでも", "every current_world_ptr->game_turn"));
441 } else if (constant < 0) {
442 /* Activations that have special timeout */
443 switch (act_ptr->index) {
445 sprintf(timeout, _("%d ターン毎", "every %d turns"),
446 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
449 sprintf(timeout, _("%d ターン毎", "every %d turns"),
450 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
453 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
456 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
459 strcpy(timeout, "undefined");
463 /* Normal timeout activations */
464 char constant_str[16], dice_str[16];
465 sprintf(constant_str, "%d", constant);
466 sprintf(dice_str, "d%d", dice);
467 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
468 (constant > 0) ? constant_str : "",
469 (constant > 0 && dice > 0) ? "+" : "",
470 (dice > 0) ? dice_str : "");
473 /* Build detail activate description */
474 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
476 return activation_detail;
480 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
481 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
482 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
483 * @return concptr 発動名称を返す文字列ポインタ
485 concptr item_activation(object_type *o_ptr)
487 BIT_FLAGS flgs[TR_FLAG_SIZE];
488 object_flags(o_ptr, flgs);
490 /* Require activation ability */
491 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
493 /* Get an explain of an activation */
494 if (activation_index(o_ptr))
496 return item_activation_aux(o_ptr);
500 if (o_ptr->tval == TV_WHISTLE)
502 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
505 if (o_ptr->tval == TV_CAPTURE)
507 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
510 return _("何も起きない", "Nothing");
515 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
516 * Describe a "fully identified" item
517 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
518 * @param mode 表示オプション
519 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
521 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
525 BIT_FLAGS flgs[TR_FLAG_SIZE];
529 GAME_TEXT o_name[MAX_NLEN];
534 int trivial_info = 0;
535 object_flags(o_ptr, flgs);
537 /* Extract the description */
539 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
540 (k_text + k_info[o_ptr->k_idx].text),
541 77 - 15, temp, sizeof(temp));
542 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
543 { info[i] = &temp[j]; i++;}
546 if (object_is_equipment(o_ptr))
548 /* Descriptions of a basic equipment is just a flavor */
552 /* Mega-Hack -- describe activation */
553 if (have_flag(flgs, TR_ACTIVATE))
555 info[i++] = _("始動したときの効果...", "It can be activated for...");
556 info[i++] = item_activation(o_ptr);
557 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
560 /* Figurines, a hack */
561 if (o_ptr->tval == TV_FIGURINE)
563 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
566 /* Figurines, a hack */
567 if (o_ptr->name1 == ART_STONEMASK)
569 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you current_world_ptr->game_turn into a vampire permanently.");
572 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
574 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
577 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
579 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
580 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
583 if (o_ptr->name2 == EGO_2WEAPON)
585 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
588 if (have_flag(flgs, TR_EASY_SPELL))
590 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
593 if (o_ptr->name2 == EGO_AMU_FOOL)
595 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
598 if (o_ptr->name2 == EGO_RING_THROW)
600 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
603 if (o_ptr->name2 == EGO_AMU_NAIVETY)
605 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
608 if (o_ptr->tval == TV_STATUE)
610 monster_race *r_ptr = &r_info[o_ptr->pval];
612 if (o_ptr->pval == MON_BULLGATES)
613 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
614 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
615 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
617 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
620 /* Hack -- describe lite's */
622 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
625 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
626 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
627 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
628 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
629 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
630 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
632 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
634 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
636 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
640 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
641 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
644 if(rad != 0) info[i++] = desc;
647 if (o_ptr->name2 == EGO_LITE_LONG)
649 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
652 /* And then describe it fully */
654 if (have_flag(flgs, TR_RIDING))
656 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
657 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
660 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
661 /* This information is not important enough */
665 if (have_flag(flgs, TR_STR))
667 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
669 if (have_flag(flgs, TR_INT))
671 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
673 if (have_flag(flgs, TR_WIS))
675 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
677 if (have_flag(flgs, TR_DEX))
679 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
681 if (have_flag(flgs, TR_CON))
683 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
685 if (have_flag(flgs, TR_CHR))
687 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
690 if (have_flag(flgs, TR_MAGIC_MASTERY))
692 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
695 if (have_flag(flgs, TR_STEALTH))
697 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
699 if (have_flag(flgs, TR_SEARCH))
701 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
703 if (have_flag(flgs, TR_INFRA))
705 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
707 if (have_flag(flgs, TR_TUNNEL))
709 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
711 if (have_flag(flgs, TR_SPEED))
713 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
715 if (have_flag(flgs, TR_BLOWS))
717 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
720 if (have_flag(flgs, TR_BRAND_ACID))
722 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
724 if (have_flag(flgs, TR_BRAND_ELEC))
726 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
728 if (have_flag(flgs, TR_BRAND_FIRE))
730 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
732 if (have_flag(flgs, TR_BRAND_COLD))
734 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
737 if (have_flag(flgs, TR_BRAND_POIS))
739 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
742 if (have_flag(flgs, TR_CHAOTIC))
744 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
747 if (have_flag(flgs, TR_VAMPIRIC))
749 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
752 if (have_flag(flgs, TR_IMPACT))
754 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
757 if (have_flag(flgs, TR_VORPAL))
759 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
762 if (have_flag(flgs, TR_KILL_DRAGON))
764 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
766 else if (have_flag(flgs, TR_SLAY_DRAGON))
768 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
771 if (have_flag(flgs, TR_KILL_ORC))
773 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
775 if (have_flag(flgs, TR_SLAY_ORC))
777 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
780 if (have_flag(flgs, TR_KILL_TROLL))
782 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
784 if (have_flag(flgs, TR_SLAY_TROLL))
786 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
789 if (have_flag(flgs, TR_KILL_GIANT))
791 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
793 else if (have_flag(flgs, TR_SLAY_GIANT))
795 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
798 if (have_flag(flgs, TR_KILL_DEMON))
800 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
802 if (have_flag(flgs, TR_SLAY_DEMON))
804 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
807 if (have_flag(flgs, TR_KILL_UNDEAD))
809 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
811 if (have_flag(flgs, TR_SLAY_UNDEAD))
813 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
816 if (have_flag(flgs, TR_KILL_EVIL))
818 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
820 if (have_flag(flgs, TR_SLAY_EVIL))
822 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
825 if (have_flag(flgs, TR_KILL_ANIMAL))
827 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
829 if (have_flag(flgs, TR_SLAY_ANIMAL))
831 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
834 if (have_flag(flgs, TR_KILL_HUMAN))
836 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
838 if (have_flag(flgs, TR_SLAY_HUMAN))
840 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
843 if (have_flag(flgs, TR_FORCE_WEAPON))
845 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
847 if (have_flag(flgs, TR_DEC_MANA))
849 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
851 if (have_flag(flgs, TR_SUST_STR))
853 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
855 if (have_flag(flgs, TR_SUST_INT))
857 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
859 if (have_flag(flgs, TR_SUST_WIS))
861 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
863 if (have_flag(flgs, TR_SUST_DEX))
865 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
867 if (have_flag(flgs, TR_SUST_CON))
869 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
871 if (have_flag(flgs, TR_SUST_CHR))
873 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
876 if (have_flag(flgs, TR_IM_ACID))
878 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
880 if (have_flag(flgs, TR_IM_ELEC))
882 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
884 if (have_flag(flgs, TR_IM_FIRE))
886 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
888 if (have_flag(flgs, TR_IM_COLD))
890 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
893 if (have_flag(flgs, TR_THROW))
895 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
898 if (have_flag(flgs, TR_FREE_ACT))
900 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
902 if (have_flag(flgs, TR_HOLD_EXP))
904 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
906 if (have_flag(flgs, TR_RES_FEAR))
908 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
910 if (have_flag(flgs, TR_RES_ACID))
912 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
914 if (have_flag(flgs, TR_RES_ELEC))
916 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
918 if (have_flag(flgs, TR_RES_FIRE))
920 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
922 if (have_flag(flgs, TR_RES_COLD))
924 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
926 if (have_flag(flgs, TR_RES_POIS))
928 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
931 if (have_flag(flgs, TR_RES_LITE))
933 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
935 if (have_flag(flgs, TR_RES_DARK))
937 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
940 if (have_flag(flgs, TR_RES_BLIND))
942 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
944 if (have_flag(flgs, TR_RES_CONF))
946 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
948 if (have_flag(flgs, TR_RES_SOUND))
950 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
952 if (have_flag(flgs, TR_RES_SHARDS))
954 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
957 if (have_flag(flgs, TR_RES_NETHER))
959 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
961 if (have_flag(flgs, TR_RES_NEXUS))
963 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
965 if (have_flag(flgs, TR_RES_CHAOS))
967 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
969 if (have_flag(flgs, TR_RES_DISEN))
971 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
974 if (have_flag(flgs, TR_LEVITATION))
976 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
979 if (have_flag(flgs, TR_SEE_INVIS))
981 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
983 if (have_flag(flgs, TR_TELEPATHY))
985 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
987 if (have_flag(flgs, TR_ESP_ANIMAL))
989 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
991 if (have_flag(flgs, TR_ESP_UNDEAD))
993 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
995 if (have_flag(flgs, TR_ESP_DEMON))
997 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
999 if (have_flag(flgs, TR_ESP_ORC))
1001 info[i++] = _("それはオークを感知する。", "It senses orcs.");
1003 if (have_flag(flgs, TR_ESP_TROLL))
1005 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1007 if (have_flag(flgs, TR_ESP_GIANT))
1009 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1011 if (have_flag(flgs, TR_ESP_DRAGON))
1013 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1015 if (have_flag(flgs, TR_ESP_HUMAN))
1017 info[i++] = _("それは人間を感知する。", "It senses humans.");
1019 if (have_flag(flgs, TR_ESP_EVIL))
1021 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1023 if (have_flag(flgs, TR_ESP_GOOD))
1025 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1027 if (have_flag(flgs, TR_ESP_NONLIVING))
1029 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1031 if (have_flag(flgs, TR_ESP_UNIQUE))
1033 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1035 if (have_flag(flgs, TR_SLOW_DIGEST))
1037 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1039 if (have_flag(flgs, TR_REGEN))
1041 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1043 if (have_flag(flgs, TR_WARNING))
1045 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1047 if (have_flag(flgs, TR_REFLECT))
1049 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1051 if (have_flag(flgs, TR_SH_FIRE))
1053 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1055 if (have_flag(flgs, TR_SH_ELEC))
1057 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1059 if (have_flag(flgs, TR_SH_COLD))
1061 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1063 if (have_flag(flgs, TR_NO_MAGIC))
1065 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1067 if (have_flag(flgs, TR_NO_TELE))
1069 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1071 if (have_flag(flgs, TR_XTRA_MIGHT))
1073 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1075 if (have_flag(flgs, TR_XTRA_SHOTS))
1077 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1080 if (have_flag(flgs, TR_BLESSED))
1082 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1085 if (object_is_cursed(o_ptr))
1087 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1089 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1091 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1093 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1097 info[i++] = _("それは呪われている。", "It is cursed.");
1100 * It's a trivial infomation since there is
1101 * fake inscription {cursed}
1107 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1109 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1111 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1113 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1115 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1117 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1119 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1121 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1123 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1125 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1127 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1129 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1131 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1133 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1135 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1137 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1139 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1141 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1143 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1145 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1147 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1149 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1151 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1153 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1155 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1157 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1159 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1161 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1163 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1165 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1167 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1169 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1171 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1173 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1175 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1177 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1180 /* Describe about this kind of object instead of THIS fake object */
1181 if (mode & SCROBJ_FAKE_OBJECT)
1183 switch (o_ptr->tval)
1186 switch (o_ptr->sval)
1188 case SV_RING_LORDLY:
1189 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1191 case SV_RING_WARNING:
1192 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1198 switch (o_ptr->sval)
1200 case SV_AMULET_RESISTANCE:
1201 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1202 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1204 case SV_AMULET_THE_MAGI:
1205 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1212 if (have_flag(flgs, TR_IGNORE_ACID) &&
1213 have_flag(flgs, TR_IGNORE_ELEC) &&
1214 have_flag(flgs, TR_IGNORE_FIRE) &&
1215 have_flag(flgs, TR_IGNORE_COLD))
1217 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1221 if (have_flag(flgs, TR_IGNORE_ACID))
1223 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1225 if (have_flag(flgs, TR_IGNORE_ELEC))
1227 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1229 if (have_flag(flgs, TR_IGNORE_FIRE))
1231 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1233 if (have_flag(flgs, TR_IGNORE_COLD))
1235 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1239 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1241 /* No relevant informations */
1242 if (i <= trivial_info) return (FALSE);
1245 Term_get_size(&wid, &hgt);
1247 /* Display Item name */
1248 if (!(mode & SCROBJ_FAKE_OBJECT))
1249 object_desc(o_name, o_ptr, 0);
1251 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1255 /* Erase the screen */
1256 for (k = 1; k < hgt; k++) prt("", k, 13);
1258 /* Label the information */
1259 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1261 monster_race *r_ptr = &r_info[o_ptr->pval];
1262 int namelen = strlen(r_name + r_ptr->name);
1263 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1264 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1265 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1269 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1272 /* We will print on top of the map (column 13) */
1273 for (k = 2, j = 0; j < i; j++)
1276 prt(info[j], k++, 15);
1278 /* Every 20 entries (lines 2 to 21), start over */
1279 if ((k == hgt - 2) && (j+1 < i))
1281 prt(_("-- 続く --", "-- more --"), k, 15);
1283 for (; k > 2; k--) prt("", k, 15);
1288 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1293 /* Gave knowledge */
1300 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1301 * Convert an p_ptr->inventory_list index into a one character label
1302 * @param i プレイヤーの所持/装備オブジェクトID
1303 * @return 対応するアルファベット
1304 * @details Note that the label does NOT distinguish inven/equip.
1306 char index_to_label(int i)
1308 /* Indexes for "inven" are easy */
1309 if (i < INVEN_RARM) return (I2A(i));
1311 /* Indexes for "equip" are offset */
1312 return (I2A(i - INVEN_RARM));
1316 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1317 * Convert a label into the index of an item in the "inven"
1318 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1319 * @details Note that the label does NOT distinguish inven/equip.
1321 INVENTORY_IDX label_to_inven(int c)
1326 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1328 /* Verify the index */
1329 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1331 /* Empty slots can never be chosen */
1332 if (!p_ptr->inventory_list[i].k_idx) return (-1);
1334 /* Return the index */
1340 extern bool select_ring_slot;
1344 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1345 * @param i プレイヤーの所持/装備オブジェクトID
1346 * @return 指輪枠ならばTRUEを返す。
1348 static bool is_ring_slot(int i)
1350 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1355 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1356 * Convert a label into the index of a item in the "equip"
1357 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1359 INVENTORY_IDX label_to_equip(int c)
1364 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1366 /* Verify the index */
1367 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1369 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1371 /* Empty slots can never be chosen */
1372 if (!p_ptr->inventory_list[i].k_idx) return (-1);
1374 /* Return the index */
1381 * @brief オブジェクトの該当装備部位IDを返す /
1382 * Determine which equipment slot (if any) an item likes
1383 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1384 * @return 対応する装備部位ID
1386 s16b wield_slot(object_type *o_ptr)
1388 /* Slot for equipment */
1389 switch (o_ptr->tval)
1396 if (!p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_RARM);
1397 if (p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_RARM);
1398 return (INVEN_LARM);
1405 if (!p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_LARM);
1406 if (p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_LARM);
1407 return (INVEN_RARM);
1417 /* Use the right hand first */
1418 if (!p_ptr->inventory_list[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1420 /* Use the left hand for swapping (by default) */
1421 return (INVEN_LEFT);
1427 return (INVEN_NECK);
1432 return (INVEN_LITE);
1439 return (INVEN_BODY);
1444 return (INVEN_OUTER);
1450 return (INVEN_HEAD);
1455 return (INVEN_HANDS);
1460 return (INVEN_FEET);
1464 /* No slot available */
1469 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1470 * Return a string mentioning how a given item is carried
1471 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1472 * @return 部位表現の文字列ポインタ
1474 concptr mention_use(int i)
1478 /* Examine the location */
1482 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1484 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1488 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1490 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1493 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1494 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1495 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1496 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1497 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1498 case INVEN_BODY: p = _(" 体", "On body"); break;
1499 case INVEN_OUTER: p = _("体の上", "About body"); break;
1500 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1501 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1502 case INVEN_FEET: p = _(" 足", "On feet"); break;
1503 default: p = _("ザック", "In pack"); break;
1506 /* Return the result */
1512 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1513 * Return a string describing how a given item is being worn.
1514 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1515 * @return 状態表現内容の文字列ポインタ
1517 * Currently, only used for items in the equipment, not p_ptr->inventory_list.
1519 concptr describe_use(int i)
1526 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1528 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1532 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1534 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1537 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1538 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1539 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1540 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1541 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1542 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1543 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1544 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1545 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1546 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1547 default: p = _("ザックに入っている", "carrying in your pack"); break;
1550 /* Return the result */
1556 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1557 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1558 * @param book_tval ベースアイテムのtval
1559 * @param book_sval ベースアイテムのsval
1560 * @return 使用可能な魔法書ならばTRUEを返す。
1563 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1565 if (book_tval < TV_LIFE_BOOK) return FALSE;
1566 if (p_ptr->pclass == CLASS_SORCERER)
1568 return is_magic(tval2realm(book_tval));
1570 else if (p_ptr->pclass == CLASS_RED_MAGE)
1572 if (is_magic(tval2realm(book_tval)))
1573 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1575 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1579 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1580 * Check an item against the item tester info
1581 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1582 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1584 bool item_tester_okay(object_type *o_ptr)
1586 /* Hack -- allow listing empty slots */
1587 // if (item_tester_full) return (TRUE); // TODO:DELETE
1589 /* Require an item */
1590 if (!o_ptr->k_idx) return (FALSE);
1592 /* Hack -- ignore "gold" */
1593 if (o_ptr->tval == TV_GOLD)
1596 extern bool show_gold_on_floor;
1598 if (!show_gold_on_floor) return (FALSE);
1601 /* Check the tval */
1602 if (item_tester_tval)
1604 /* Is it a spellbook? If so, we need a hack -- TY */
1605 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1606 (item_tester_tval >= TV_LIFE_BOOK))
1607 return check_book_realm(o_ptr->tval, o_ptr->sval);
1609 if (item_tester_tval != o_ptr->tval) return (FALSE);
1612 /* Check the hook */
1613 if (item_tester_hook)
1615 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1624 * @brief 所持アイテム一覧を表示する /
1625 * Choice window "shadow" of the "show_inven()" function
1628 void display_inven(void)
1630 register int i, n, z = 0;
1632 TERM_COLOR attr = TERM_WHITE;
1634 GAME_TEXT o_name[MAX_NLEN];
1637 Term_get_size(&wid, &hgt);
1639 for (i = 0; i < INVEN_PACK; i++)
1641 o_ptr = &p_ptr->inventory_list[i];
1642 if (!o_ptr->k_idx) continue;
1646 for (i = 0; i < z; i++)
1648 o_ptr = &p_ptr->inventory_list[i];
1649 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1650 if (item_tester_okay(o_ptr))
1652 tmp_val[0] = index_to_label(i);
1656 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1657 object_desc(o_name, o_ptr, 0);
1659 attr = tval_to_attr[o_ptr->tval % 128];
1665 Term_putstr(3, i, n, attr, o_name);
1666 Term_erase(3+n, i, 255);
1670 int wgt = o_ptr->weight * o_ptr->number;
1672 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1674 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1676 prt(tmp_val, i, wid - 9);
1680 for (i = z; i < hgt; i++)
1682 Term_erase(0, i, 255);
1689 * @brief 装備アイテム一覧を表示する /
1690 * Choice window "shadow" of the "show_equip()" function
1693 void display_equip(void)
1697 TERM_COLOR attr = TERM_WHITE;
1699 GAME_TEXT o_name[MAX_NLEN];
1702 Term_get_size(&wid, &hgt);
1704 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1706 o_ptr = &p_ptr->inventory_list[i];
1707 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1708 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1710 tmp_val[0] = index_to_label(i);
1714 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1715 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1717 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1722 object_desc(o_name, o_ptr, 0);
1723 attr = tval_to_attr[o_ptr->tval % 128];
1731 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1733 Term_erase(3 + n, i - INVEN_RARM, 255);
1737 int wgt = o_ptr->weight * o_ptr->number;
1739 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1741 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1744 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1749 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1750 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1754 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1756 Term_erase(0, i, 255);
1762 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1763 * Find the "first" p_ptr->inventory_list object with the given "tag".
1764 * @param cp 対応するタグIDを与える参照ポインタ
1765 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1766 * @param mode 所持、装備の切り替え
1767 * @return タグに該当するオブジェクトがあるならTRUEを返す
1769 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1770 * inscription of an object. Alphabetical characters don't work as a\n
1771 * tag in this form.\n
1773 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1774 * and "x" is the "current" command_cmd code.\n
1776 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1779 COMMAND_CODE start, end;
1782 /* Extract index from mode */
1787 end = INVEN_TOTAL - 1;
1792 end = INVEN_PACK - 1;
1799 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1801 /* Check every p_ptr->inventory_list object */
1802 for (i = start; i <= end; i++)
1804 object_type *o_ptr = &p_ptr->inventory_list[i];
1805 if (!o_ptr->k_idx) continue;
1807 /* Skip empty inscriptions */
1808 if (!o_ptr->inscription) continue;
1810 /* Skip non-choice */
1811 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1814 s = my_strchr(quark_str(o_ptr->inscription), '@');
1816 /* Process all tags */
1819 /* Check the special tags */
1820 if ((s[1] == command_cmd) && (s[2] == tag))
1822 /* Save the actual p_ptr->inventory_list ID */
1829 /* Find another '@' */
1830 s = my_strchr(s + 1, '@');
1835 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1837 /* Don't allow {@#} with '#' being alphabet */
1838 if (tag < '0' || '9' < tag)
1844 /* Check every object */
1845 for (i = start; i <= end; i++)
1847 object_type *o_ptr = &p_ptr->inventory_list[i];
1848 if (!o_ptr->k_idx) continue;
1850 /* Skip empty inscriptions */
1851 if (!o_ptr->inscription) continue;
1853 /* Skip non-choice */
1854 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1857 s = my_strchr(quark_str(o_ptr->inscription), '@');
1859 /* Process all tags */
1862 /* Check the normal tags */
1865 /* Save the actual p_ptr->inventory_list ID */
1872 /* Find another '@' */
1873 s = my_strchr(s + 1, '@');
1883 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1884 * Find the "first" p_ptr->inventory_list object with the given "tag".
1885 * @param cp 対応するタグIDを与える参照ポインタ
1886 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1887 * @param floor_list 床上アイテムの配列
1888 * @param floor_num 床上アイテムの配列ID
1889 * @return タグに該当するオブジェクトがあるならTRUEを返す
1891 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1892 * inscription of an object. Alphabetical characters don't work as a\n
1893 * tag in this form.\n
1895 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1896 * and "x" is the "current" command_cmd code.\n
1898 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1903 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1905 /* Check every object in the grid */
1906 for (i = 0; i < floor_num && i < 23; i++)
1908 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1910 /* Skip empty inscriptions */
1911 if (!o_ptr->inscription) continue;
1914 s = my_strchr(quark_str(o_ptr->inscription), '@');
1916 /* Process all tags */
1919 /* Check the special tags */
1920 if ((s[1] == command_cmd) && (s[2] == tag))
1922 /* Save the actual floor object ID */
1929 /* Find another '@' */
1930 s = my_strchr(s + 1, '@');
1935 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1937 /* Don't allow {@#} with '#' being alphabet */
1938 if (tag < '0' || '9' < tag)
1944 /* Check every object in the grid */
1945 for (i = 0; i < floor_num && i < 23; i++)
1947 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1949 /* Skip empty inscriptions */
1950 if (!o_ptr->inscription) continue;
1953 s = my_strchr(quark_str(o_ptr->inscription), '@');
1955 /* Process all tags */
1958 /* Check the normal tags */
1961 /* Save the floor object ID */
1968 /* Find another '@' */
1969 s = my_strchr(s + 1, '@');
1979 * @brief タグIDにあわせてタグアルファベットのリストを返す /
1980 * Move around label characters with correspond tags
1981 * @param label ラベルリストを取得する文字列参照ポインタ
1982 * @param mode 所持品リストか装備品リストかの切り替え
1985 static void prepare_label_string(char *label, BIT_FLAGS mode)
1987 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
1988 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
1991 /* Prepare normal labels */
1992 strcpy(label, alphabet_chars);
1994 /* Move each label */
1995 for (i = 0; i < 52; i++)
1998 SYMBOL_CODE c = alphabet_chars[i];
2000 /* Find a tag with this label */
2001 if (get_tag(&index, c, mode))
2003 /* Delete the overwritten label */
2004 if (label[i] == c) label[i] = ' ';
2006 /* Move the label to the place of corresponding tag */
2007 label[index - offset] = c;
2014 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2015 * Move around label characters with correspond tags (floor version)
2016 * @param label ラベルリストを取得する文字列参照ポインタ
2017 * @param floor_list 床上アイテムの配列
2018 * @param floor_num 床上アイテムの配列ID
2023 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2025 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2028 /* Prepare normal labels */
2029 strcpy(label, alphabet_chars);
2031 /* Move each label */
2032 for (i = 0; i < 52; i++)
2035 SYMBOL_CODE c = alphabet_chars[i];
2037 /* Find a tag with this label */
2038 if (get_tag_floor(&index, c, floor_list, floor_num))
2040 /* Delete the overwritten label */
2041 if (label[i] == c) label[i] = ' ';
2043 /* Move the label to the place of corresponding tag */
2051 * @brief 所持アイテムの表示を行う /
2052 * Display the p_ptr->inventory_list.
2053 * @param target_item アイテムの選択処理を行うか否か。
2054 * @return 選択したアイテムのタグ
2056 * Hack -- do not display "trailing" empty slots
2058 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2062 int col, cur_col, len;
2064 GAME_TEXT o_name[MAX_NLEN];
2066 COMMAND_CODE out_index[23];
2067 TERM_COLOR out_color[23];
2068 char out_desc[23][MAX_NLEN];
2069 COMMAND_CODE target_item_label = 0;
2071 char inven_label[52 + 1];
2073 /* Starting column */
2076 Term_get_size(&wid, &hgt);
2078 /* Default "max-length" */
2079 len = wid - col - 1;
2082 /* Find the "final" slot */
2083 for (i = 0; i < INVEN_PACK; i++)
2085 o_ptr = &p_ptr->inventory_list[i];
2086 if (!o_ptr->k_idx) continue;
2092 prepare_label_string(inven_label, USE_INVEN);
2094 /* Display the p_ptr->inventory_list */
2095 for (k = 0, i = 0; i < z; i++)
2097 o_ptr = &p_ptr->inventory_list[i];
2099 /* Is this item acceptable? */
2100 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2102 object_desc(o_name, o_ptr, 0);
2104 /* Save the object index, color, and description */
2106 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2108 /* Grey out charging items */
2111 out_color[k] = TERM_L_DARK;
2114 (void)strcpy(out_desc[k], o_name);
2116 /* Find the predicted "line length" */
2117 l = strlen(out_desc[k]) + 5;
2119 /* Be sure to account for the weight */
2120 if (show_weights) l += 9;
2122 /* Account for icon if displayed */
2123 if (show_item_graph)
2126 if (use_bigtile) l++;
2129 /* Maintain the maximum length */
2130 if (l > len) len = l;
2132 /* Advance to next "line" */
2136 /* Find the column to start in */
2137 col = (len > wid - 4) ? 0 : (wid - len - 1);
2139 /* Output each entry */
2140 for (j = 0; j < k; j++)
2143 o_ptr = &p_ptr->inventory_list[i];
2145 /* Clear the line */
2146 prt("", j + 1, col ? col - 2 : col);
2148 if (use_menu && target_item)
2150 if (j == (target_item-1))
2152 strcpy(tmp_val, _("》", "> "));
2153 target_item_label = i;
2155 else strcpy(tmp_val, " ");
2157 else if (i <= INVEN_PACK)
2159 /* Prepare an index --(-- */
2160 sprintf(tmp_val, "%c)", inven_label[i]);
2164 /* Prepare an index --(-- */
2165 sprintf(tmp_val, "%c)", index_to_label(i));
2168 /* Clear the line with the (possibly indented) index */
2169 put_str(tmp_val, j + 1, col);
2173 /* Display graphics for object, if desired */
2174 if (show_item_graph)
2176 TERM_COLOR a = object_attr(o_ptr);
2177 SYMBOL_CODE c = object_char(o_ptr);
2178 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2179 if (use_bigtile) cur_col++;
2185 /* Display the entry itself */
2186 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2188 /* Display the weight if needed */
2191 int wgt = o_ptr->weight * o_ptr->number;
2193 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2195 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2198 prt(tmp_val, j + 1, wid - 9);
2202 /* Make a "shadow" below the list (only if needed) */
2203 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2205 /* Save the new column */
2208 return target_item_label;
2213 * @brief 装備アイテムの表示を行う /
2214 * Display the equipment.
2215 * @param target_item アイテムの選択処理を行うか否か。
2216 * @return 選択したアイテムのタグ
2218 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2222 int col, cur_col, len;
2225 GAME_TEXT o_name[MAX_NLEN];
2226 COMMAND_CODE out_index[23];
2227 TERM_COLOR out_color[23];
2228 char out_desc[23][MAX_NLEN];
2229 COMMAND_CODE target_item_label = 0;
2231 char equip_label[52 + 1];
2233 /* Starting column */
2236 Term_get_size(&wid, &hgt);
2238 /* Maximal length */
2239 len = wid - col - 1;
2242 /* Scan the equipment list */
2243 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2245 o_ptr = &p_ptr->inventory_list[i];
2247 /* Is this item acceptable? */
2248 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2249 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2250 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2252 object_desc(o_name, o_ptr, 0);
2254 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2256 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2257 out_color[k] = TERM_WHITE;
2261 (void)strcpy(out_desc[k], o_name);
2262 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2266 /* Grey out charging items */
2269 out_color[k] = TERM_L_DARK;
2272 /* Extract the maximal length (see below) */
2274 l = strlen(out_desc[k]) + (2 + 1);
2276 l = strlen(out_desc[k]) + (2 + 3);
2280 /* Increase length for labels (if needed) */
2282 if (show_labels) l += (7 + 2);
2284 if (show_labels) l += (14 + 2);
2288 /* Increase length for weight (if needed) */
2289 if (show_weights) l += 9;
2291 if (show_item_graph) l += 2;
2293 /* Maintain the max-length */
2294 if (l > len) len = l;
2296 /* Advance the entry */
2300 /* Hack -- Find a column to start in */
2302 col = (len > wid - 6) ? 0 : (wid - len - 1);
2304 col = (len > wid - 4) ? 0 : (wid - len - 1);
2307 prepare_label_string(equip_label, USE_EQUIP);
2309 /* Output each entry */
2310 for (j = 0; j < k; j++)
2313 o_ptr = &p_ptr->inventory_list[i];
2315 /* Clear the line */
2316 prt("", j + 1, col ? col - 2 : col);
2318 if (use_menu && target_item)
2320 if (j == (target_item-1))
2322 strcpy(tmp_val, _("》", "> "));
2323 target_item_label = i;
2325 else strcpy(tmp_val, " ");
2327 else if (i >= INVEN_RARM)
2329 /* Prepare an index --(-- */
2330 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2334 /* Prepare an index --(-- */
2335 sprintf(tmp_val, "%c)", index_to_label(i));
2338 /* Clear the line with the (possibly indented) index */
2339 put_str(tmp_val, j+1, col);
2343 /* Display graphics for object, if desired */
2344 if (show_item_graph)
2346 TERM_COLOR a = object_attr(o_ptr);
2347 SYMBOL_CODE c = object_char(o_ptr);
2348 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2349 if (use_bigtile) cur_col++;
2357 /* Mention the use */
2358 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2360 put_str(tmp_val, j+1, cur_col);
2362 /* Display the entry itself */
2363 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2369 /* Display the entry itself */
2370 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2373 /* Display the weight if needed */
2376 int wgt = o_ptr->weight * o_ptr->number;
2378 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2380 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2383 prt(tmp_val, j + 1, wid - 9);
2387 /* Make a "shadow" below the list (only if needed) */
2388 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2390 /* Save the new column */
2393 return target_item_label;
2397 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2398 * Flip "inven" and "equip" in any sub-windows
2401 void toggle_inven_equip(void)
2406 for (j = 0; j < 8; j++)
2409 if (!angband_term[j]) continue;
2411 /* Flip inven to equip */
2412 if (window_flag[j] & (PW_INVEN))
2415 window_flag[j] &= ~(PW_INVEN);
2416 window_flag[j] |= (PW_EQUIP);
2418 p_ptr->window |= (PW_EQUIP);
2421 /* Flip inven to equip */
2422 else if (window_flag[j] & (PW_EQUIP))
2425 window_flag[j] &= ~(PW_EQUIP);
2426 window_flag[j] |= (PW_INVEN);
2428 p_ptr->window |= (PW_INVEN);
2434 * @brief 選択したアイテムの確認処理の補助 /
2435 * Verify the choice of an item.
2436 * @param prompt メッセージ表示の一部
2437 * @param item 選択アイテムID
2438 * @return 確認がYesならTRUEを返す。
2439 * @details The item can be negative to mean "item on floor".
2441 static bool verify(concptr prompt, INVENTORY_IDX item)
2443 GAME_TEXT o_name[MAX_NLEN];
2444 char out_val[MAX_NLEN+20];
2451 o_ptr = &p_ptr->inventory_list[item];
2457 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2459 object_desc(o_name, o_ptr, 0);
2462 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2465 return (get_check(out_val));
2470 * @brief 選択したアイテムの確認処理のメインルーチン /
2471 * @param item 選択アイテムID
2472 * @return 確認がYesならTRUEを返す。
2473 * @details The item can be negative to mean "item on floor".
2474 * Hack -- allow user to "prevent" certain choices
2476 static bool get_item_allow(INVENTORY_IDX item)
2480 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2485 o_ptr = &p_ptr->inventory_list[item];
2491 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2494 /* No inscription */
2495 if (!o_ptr->inscription) return (TRUE);
2498 s = my_strchr(quark_str(o_ptr->inscription), '!');
2500 /* Process preventions */
2503 /* Check the "restriction" */
2504 if ((s[1] == command_cmd) || (s[1] == '*'))
2506 /* Verify the choice */
2507 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2510 /* Find another '!' */
2511 s = my_strchr(s + 1, '!');
2520 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2521 * Auxiliary function for "get_item()" -- test an index
2523 * @return 正規のIDならばTRUEを返す。
2525 static bool get_item_okay(OBJECT_IDX i)
2528 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2530 if (select_ring_slot) return is_ring_slot(i);
2532 /* Verify the item */
2533 if (!item_tester_okay(&p_ptr->inventory_list[i])) return (FALSE);
2540 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2541 * Determine whether get_item() can get some item or not
2542 * @return アイテムを拾えるならばTRUEを返す。
2543 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2545 bool can_get_item(void)
2548 OBJECT_IDX floor_list[23];
2549 ITEM_NUMBER floor_num = 0;
2551 for (j = 0; j < INVEN_TOTAL; j++)
2552 if (item_tester_okay(&p_ptr->inventory_list[j]))
2555 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2563 * @brief オブジェクト選択の汎用関数 /
2564 * Let the user select an item, save its "index"
2565 * @param cp 選択したオブジェクトのIDを返す。
2566 * @param pmt 選択目的のメッセージ
2567 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2568 * @param mode オプションフラグ
2569 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2570 * Return TRUE only if an acceptable item was chosen by the user.\n
2572 * The selected item must satisfy the "item_tester_hook()" function,\n
2573 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2575 * All "item_tester" restrictions are cleared before this function returns.\n
2577 * The user is allowed to choose acceptable items from the equipment,\n
2578 * p_ptr->inventory_list, or floor, respectively, if the proper flag was given,\n
2579 * and there are any acceptable items in that location.\n
2581 * The equipment or p_ptr->inventory_list are displayed (even if no acceptable\n
2582 * items are in that location) if the proper flag was given.\n
2584 * If there are no acceptable items available anywhere, and "str" is\n
2585 * not NULL, then it will be used as the text of a warning message\n
2586 * before the function returns.\n
2588 * Note that the user must press "-" to specify the item on the floor,\n
2589 * and there is no way to "examine" the item on the floor, while the\n
2590 * use of "capital" letters will "examine" an p_ptr->inventory_list/equipment item,\n
2591 * and prompt for its use.\n
2593 * If a legal item is selected from the p_ptr->inventory_list, we save it in "cp"\n
2594 * directly (0 to 35), and return TRUE.\n
2596 * If a legal item is selected from the floor, we save it in "cp" as\n
2597 * a negative (-1 to -511), and return TRUE.\n
2599 * If no item is available, we do nothing to "cp", and we display a\n
2600 * warning message, using "str" if available, and return FALSE.\n
2602 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2604 * Global "p_ptr->command_new" is used when viewing the p_ptr->inventory_list or equipment\n
2605 * to allow the user to enter a command while viewing those screens, and\n
2606 * also to induce "auto-enter" of stores, and other such stuff.\n
2608 * Global "p_ptr->command_see" may be set before calling this function to start\n
2609 * out in "browse" mode. It is cleared before this function returns.\n
2611 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2612 * If it is TRUE then we are viewing p_ptr->inventory_list, else equipment.\n
2614 * We always erase the prompt when we are done, leaving a blank line,\n
2615 * or a warning message, if appropriate, if no items are available.\n
2617 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2619 OBJECT_IDX this_o_idx, next_o_idx = 0;
2636 bool allow_floor = FALSE;
2638 bool toggle = FALSE;
2643 int menu_line = (use_menu ? 1 : 0);
2647 static char prev_tag = '\0';
2648 char cur_tag = '\0';
2650 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2653 if (mode & USE_EQUIP) equip = TRUE;
2654 if (mode & USE_INVEN) inven = TRUE;
2655 if (mode & USE_FLOOR) floor = TRUE;
2657 /* Get the item index */
2658 if (repeat_pull(cp))
2661 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2663 item_tester_tval = 0;
2664 item_tester_hook = NULL;
2665 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2670 else if (floor && (*cp < 0))
2676 o_ptr = ¤t_floor_ptr->o_list[k];
2678 /* Validate the item */
2679 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2681 /* Forget restrictions */
2682 item_tester_tval = 0;
2683 item_tester_hook = NULL;
2684 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2691 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2692 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2694 if (prev_tag && command_cmd)
2696 /* Look up the tag and validate the item */
2697 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2698 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2699 else if (!get_item_okay(k)) /* Reject */;
2702 /* Accept that choice */
2705 /* Forget restrictions */
2706 item_tester_tval = 0;
2707 item_tester_hook = NULL;
2708 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2714 prev_tag = '\0'; /* prev_tag is no longer effective */
2717 /* Verify the item */
2718 else if (get_item_okay(*cp))
2720 /* Forget restrictions */
2721 item_tester_tval = 0;
2722 item_tester_hook = NULL;
2723 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2735 /* No item selected */
2739 /* Full p_ptr->inventory_list */
2741 i2 = INVEN_PACK - 1;
2743 /* Forbid p_ptr->inventory_list */
2744 if (!inven) i2 = -1;
2747 for (j = 0; j < INVEN_PACK; j++)
2748 if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
2751 /* Restrict p_ptr->inventory_list indexes */
2752 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2753 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2756 /* Full equipment */
2758 e2 = INVEN_TOTAL - 1;
2760 /* Forbid equipment */
2761 if (!equip) e2 = -1;
2764 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2765 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
2766 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2769 /* Restrict equipment indexes */
2770 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2771 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2773 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2777 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2779 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2783 /* Restrict floor usage */
2786 /* Scan all objects in the grid */
2787 for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2790 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
2791 next_o_idx = o_ptr->next_o_idx;
2793 /* Accept the item on the floor if legal */
2794 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2798 /* Require at least one legal choice */
2799 if (!allow_floor && (i1 > i2) && (e1 > e2))
2801 /* Cancel p_ptr->command_see */
2802 command_see = FALSE;
2806 if (mode & USE_FORCE) {
2812 /* Analyze choices */
2815 /* Hack -- Start on equipment if requested */
2816 if (command_see && command_wrk && equip)
2821 /* Use p_ptr->inventory_list if allowed */
2824 command_wrk = FALSE;
2827 /* Use equipment if allowed */
2833 /* Use p_ptr->inventory_list for floor */
2836 command_wrk = FALSE;
2842 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2844 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2846 /* Hack -- start out in "display" mode */
2853 /* Repeat until done */
2856 COMMAND_CODE get_item_label = 0;
2863 for (j = 0; j < 8; j++)
2866 if (!angband_term[j]) continue;
2868 /* Count windows displaying inven */
2869 if (window_flag[j] & (PW_INVEN)) ni++;
2871 /* Count windows displaying equip */
2872 if (window_flag[j] & (PW_EQUIP)) ne++;
2875 /* Toggle if needed */
2876 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2879 toggle_inven_equip();
2885 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2888 /* Inventory screen */
2891 /* Redraw if needed */
2892 if (command_see) get_item_label = show_inven(menu_line, mode);
2895 /* Equipment screen */
2898 /* Redraw if needed */
2899 if (command_see) get_item_label = show_equip(menu_line, mode);
2902 /* Viewing p_ptr->inventory_list */
2905 /* Begin the prompt */
2906 sprintf(out_val, _("持ち物:", "Inven:"));
2908 /* Some legal items */
2909 if ((i1 <= i2) && !use_menu)
2911 /* Build the prompt */
2912 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2913 index_to_label(i1), index_to_label(i2));
2916 strcat(out_val, tmp_val);
2919 /* Indicate ability to "view" */
2920 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2923 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2926 /* Viewing equipment */
2929 /* Begin the prompt */
2930 sprintf(out_val, _("装備品:", "Equip:"));
2932 /* Some legal items */
2933 if ((e1 <= e2) && !use_menu)
2935 /* Build the prompt */
2936 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2937 index_to_label(e1), index_to_label(e2));
2940 strcat(out_val, tmp_val);
2943 /* Indicate ability to "view" */
2944 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2947 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
2950 /* Indicate legality of the "floor" item */
2951 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
2952 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
2954 /* Finish the prompt */
2955 strcat(out_val, " ESC");
2957 /* Build the prompt */
2958 sprintf(tmp_val, "(%s) %s", out_val, pmt);
2960 /* Show the prompt */
2968 int max_line = (command_wrk ? max_equip : max_inven);
2984 menu_line += (max_line - 1);
3003 /* Verify legality */
3004 if (!inven || !equip)
3010 /* Hack -- Fix screen */
3017 /* Switch inven/equip */
3018 command_wrk = !command_wrk;
3019 max_line = (command_wrk ? max_equip : max_inven);
3020 if (menu_line > max_line) menu_line = max_line;
3022 /* Need to redraw */
3031 if (command_wrk == USE_FLOOR)
3034 (*cp) = -get_item_label;
3038 /* Validate the item */
3039 if (!get_item_okay(get_item_label))
3045 /* Allow player to "refuse" certain actions */
3046 if (!get_item_allow(get_item_label))
3052 /* Accept that choice */
3053 (*cp) = get_item_label;
3062 if (mode & USE_FORCE) {
3070 if (menu_line > max_line) menu_line -= max_line;
3091 command_see = FALSE;
3108 /* Verify legality */
3109 if (!inven || !equip)
3115 /* Hack -- Fix screen */
3122 /* Switch inven/equip */
3123 command_wrk = !command_wrk;
3125 /* Need to redraw */
3131 /* Use floor item */
3134 /* Scan all objects in the grid */
3135 for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3138 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3139 next_o_idx = o_ptr->next_o_idx;
3141 /* Validate the item */
3142 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3147 /* Verify the item (if required) */
3148 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3150 /* Allow player to "refuse" certain actions */
3151 if (!get_item_allow(k)) continue;
3153 /* Accept that choice */
3169 case '1': case '2': case '3':
3170 case '4': case '5': case '6':
3171 case '7': case '8': case '9':
3173 /* Look up the tag */
3174 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3180 /* Hack -- Validate the item */
3181 if ((k < INVEN_RARM) ? !inven : !equip)
3187 /* Validate the item */
3188 if (!get_item_okay(k))
3194 /* Allow player to "refuse" certain actions */
3195 if (!get_item_allow(k))
3201 /* Accept that choice */
3213 /* Choose "default" p_ptr->inventory_list item */
3216 k = ((i1 == i2) ? i1 : -1);
3219 /* Choose "default" equipment item */
3222 k = ((e1 == e2) ? e1 : -1);
3225 /* Validate the item */
3226 if (!get_item_okay(k))
3232 /* Allow player to "refuse" certain actions */
3233 if (!get_item_allow(k))
3239 /* Accept that choice */
3249 if (mode & USE_FORCE) {
3262 bool not_found = FALSE;
3264 /* Look up the alphabetical tag */
3265 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3270 /* Hack -- Validate the item */
3271 else if ((k < INVEN_RARM) ? !inven : !equip)
3276 /* Validate the item */
3277 else if (!get_item_okay(k))
3284 /* Accept that choice */
3292 /* Extract "query" setting */
3293 ver = isupper(which);
3294 which = (char)tolower(which);
3296 /* Convert letter to p_ptr->inventory_list index */
3299 if (which == '(') k = i1;
3300 else if (which == ')') k = i2;
3301 else k = label_to_inven(which);
3304 /* Convert letter to equipment index */
3307 if (which == '(') k = e1;
3308 else if (which == ')') k = e2;
3309 else k = label_to_equip(which);
3312 /* Validate the item */
3313 if (!get_item_okay(k))
3319 /* Verify the item */
3320 if (ver && !verify(_("本当に", "Try"), k))
3326 /* Allow player to "refuse" certain actions */
3327 if (!get_item_allow(k))
3333 /* Accept that choice */
3344 /* Fix the screen if necessary */
3349 /* Hack -- Cancel "display" */
3350 command_see = FALSE;
3354 /* Forget the item_tester_tval restriction */
3355 item_tester_tval = 0;
3357 /* Forget the item_tester_hook restriction */
3358 item_tester_hook = NULL;
3361 /* Clean up 'show choices' */
3362 /* Toggle again if needed */
3363 if (toggle) toggle_inven_equip();
3365 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3368 /* Clear the prompt line */
3371 /* Warning if needed */
3372 if (oops && str) msg_print(str);
3377 if (command_cmd) prev_tag = cur_tag;
3378 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3384 * Choose an item and get auto-picker entry from it.
3386 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3389 if (!get_item(&item, q, s, option)) return NULL;
3390 if (idx) *idx = item;
3392 if (item == INVEN_FORCE) return NULL;
3394 /* Get the item (in the pack) */
3395 else if (item >= 0) return &p_ptr->inventory_list[item];
3397 /* Get the item (on the floor) */
3398 else return ¤t_floor_ptr->o_list[0 - item];
3403 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3404 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3405 * @param y 走査するフロアのY座標
3406 * @param x 走査するフロアのX座標
3407 * @param mode オプションフラグ
3408 * @return 対象のマスに落ちているアイテム数
3410 * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
3411 * location. Valid flags are:
3413 * mode & 0x01 -- Item tester
3414 * mode & 0x02 -- Marked items only
3415 * mode & 0x04 -- Stop after first
3417 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3419 OBJECT_IDX this_o_idx, next_o_idx;
3421 ITEM_NUMBER num = 0;
3424 if (!in_bounds(y, x)) return 0;
3426 /* Scan all objects in the grid */
3427 for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3430 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3431 next_o_idx = o_ptr->next_o_idx;
3434 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3437 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3439 /* Accept this item */
3440 /* XXX Hack -- Enforce limit */
3442 items[num] = this_o_idx;
3447 if (mode & 0x04) break;
3454 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3455 * @param target_item カーソルの初期値
3456 * @param y 走査するフロアのY座標
3457 * @param x 走査するフロアのX座標
3458 * @param min_width 表示の長さ
3459 * @return 選択したアイテムの添え字
3462 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3470 GAME_TEXT o_name[MAX_NLEN];
3473 COMMAND_CODE out_index[23];
3474 TERM_COLOR out_color[23];
3475 char out_desc[23][MAX_NLEN];
3476 COMMAND_CODE target_item_label = 0;
3478 OBJECT_IDX floor_list[23];
3479 ITEM_NUMBER floor_num;
3481 char floor_label[52 + 1];
3483 bool dont_need_to_show_weights = TRUE;
3485 Term_get_size(&wid, &hgt);
3487 /* Default length */
3488 len = MAX((*min_width), 20);
3490 /* Scan for objects in the grid, using item_tester_okay() */
3491 floor_num = scan_floor(floor_list, y, x, 0x03);
3493 /* Display the floor objects */
3494 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3496 o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
3498 object_desc(o_name, o_ptr, 0);
3500 /* Save the index */
3503 /* Acquire p_ptr->inventory_list color */
3504 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3506 /* Save the object description */
3507 strcpy(out_desc[k], o_name);
3509 /* Find the predicted "line length" */
3510 l = strlen(out_desc[k]) + 5;
3512 /* Be sure to account for the weight */
3513 if (show_weights) l += 9;
3515 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3517 /* Maintain the maximum length */
3518 if (l > len) len = l;
3520 /* Advance to next "line" */
3524 if (show_weights && dont_need_to_show_weights) len -= 9;
3529 /* Find the column to start in */
3530 col = (len > wid - 4) ? 0 : (wid - len - 1);
3532 prepare_label_string_floor(floor_label, floor_list, floor_num);
3534 /* Output each entry */
3535 for (j = 0; j < k; j++)
3537 m = floor_list[out_index[j]];
3538 o_ptr = ¤t_floor_ptr->o_list[m];
3540 /* Clear the line */
3541 prt("", j + 1, col ? col - 2 : col);
3543 if (use_menu && target_item)
3545 if (j == (target_item-1))
3547 strcpy(tmp_val, _("》", "> "));
3548 target_item_label = m;
3550 else strcpy(tmp_val, " ");
3554 /* Prepare an index --(-- */
3555 sprintf(tmp_val, "%c)", floor_label[j]);
3558 /* Clear the line with the (possibly indented) index */
3559 put_str(tmp_val, j + 1, col);
3561 /* Display the entry itself */
3562 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3564 /* Display the weight if needed */
3565 if (show_weights && (o_ptr->tval != TV_GOLD))
3567 int wgt = o_ptr->weight * o_ptr->number;
3569 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3571 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3574 prt(tmp_val, j + 1, wid - 9);
3578 /* Make a "shadow" below the list (only if needed) */
3579 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3581 return target_item_label;
3585 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3586 * Let the user select an item, save its "index"
3587 * @param cp 選択したオブジェクトのIDを返す。
3588 * @param pmt 選択目的のメッセージ
3589 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3590 * @param mode オプションフラグ
3591 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3593 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3595 char n1 = ' ', n2 = ' ', which = ' ';
3598 COMMAND_CODE i1, i2;
3599 COMMAND_CODE e1, e2;
3607 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3608 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3609 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3610 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3612 bool allow_equip = FALSE;
3613 bool allow_inven = FALSE;
3614 bool allow_floor = FALSE;
3616 bool toggle = FALSE;
3621 ITEM_NUMBER floor_num;
3622 OBJECT_IDX floor_list[23];
3624 TERM_LEN min_width = 0;
3626 int menu_line = (use_menu ? 1 : 0);
3630 static char prev_tag = '\0';
3631 char cur_tag = '\0';
3633 /* Get the item index */
3634 if (repeat_pull(cp))
3637 if (force && (*cp == INVEN_FORCE))
3639 item_tester_tval = 0;
3640 item_tester_hook = NULL;
3641 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3646 else if (floor && (*cp < 0))
3648 if (prev_tag && command_cmd)
3650 /* Scan all objects in the grid */
3651 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3653 /* Look up the tag */
3654 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3656 /* Accept that choice */
3657 (*cp) = 0 - floor_list[k];
3659 /* Forget restrictions */
3660 item_tester_tval = 0;
3661 item_tester_hook = NULL;
3662 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3668 prev_tag = '\0'; /* prev_tag is no longer effective */
3671 /* Validate the item */
3672 else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
3674 /* Forget restrictions */
3675 item_tester_tval = 0;
3676 item_tester_hook = NULL;
3677 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3684 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3685 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3687 if (prev_tag && command_cmd)
3689 /* Look up the tag and validate the item */
3690 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3691 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3692 else if (!get_item_okay(k)) /* Reject */;
3695 /* Accept that choice */
3698 /* Forget restrictions */
3699 item_tester_tval = 0;
3700 item_tester_hook = NULL;
3701 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3707 prev_tag = '\0'; /* prev_tag is no longer effective */
3710 /* Verify the item */
3711 else if (get_item_okay(*cp))
3713 /* Forget restrictions */
3714 item_tester_tval = 0;
3715 item_tester_hook = NULL;
3716 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3730 /* No item selected */
3734 /* Full p_ptr->inventory_list */
3736 i2 = INVEN_PACK - 1;
3738 /* Forbid p_ptr->inventory_list */
3739 if (!inven) i2 = -1;
3742 for (j = 0; j < INVEN_PACK; j++)
3743 if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
3746 /* Restrict p_ptr->inventory_list indexes */
3747 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3748 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3751 /* Full equipment */
3753 e2 = INVEN_TOTAL - 1;
3755 /* Forbid equipment */
3756 if (!equip) e2 = -1;
3759 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3760 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
3761 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3764 /* Restrict equipment indexes */
3765 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3766 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3768 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3772 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3774 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3778 /* Count "okay" floor items */
3781 /* Restrict floor usage */
3784 /* Scan all objects in the grid */
3785 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3788 /* Accept p_ptr->inventory_list */
3789 if (i1 <= i2) allow_inven = TRUE;
3791 /* Accept equipment */
3792 if (e1 <= e2) allow_equip = TRUE;
3795 if (floor_num) allow_floor = TRUE;
3797 /* Require at least one legal choice */
3798 if (!allow_inven && !allow_equip && !allow_floor)
3800 /* Cancel p_ptr->command_see */
3801 command_see = FALSE;
3811 /* Analyze choices */
3814 /* Hack -- Start on equipment if requested */
3815 if (command_see && (command_wrk == (USE_EQUIP))
3818 command_wrk = (USE_EQUIP);
3821 /* Use p_ptr->inventory_list if allowed */
3822 else if (allow_inven)
3824 command_wrk = (USE_INVEN);
3827 /* Use equipment if allowed */
3828 else if (allow_equip)
3830 command_wrk = (USE_EQUIP);
3833 /* Use floor if allowed */
3834 else if (allow_floor)
3836 command_wrk = (USE_FLOOR);
3841 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3843 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3845 /* Hack -- start out in "display" mode */
3851 /* Repeat until done */
3854 COMMAND_CODE get_item_label = 0;
3861 for (j = 0; j < 8; j++)
3864 if (!angband_term[j]) continue;
3866 /* Count windows displaying inven */
3867 if (window_flag[j] & (PW_INVEN)) ni++;
3869 /* Count windows displaying equip */
3870 if (window_flag[j] & (PW_EQUIP)) ne++;
3873 /* Toggle if needed */
3874 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3875 (command_wrk == (USE_INVEN) && !ni && ne))
3878 toggle_inven_equip();
3884 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3887 /* Inventory screen */
3888 if (command_wrk == (USE_INVEN))
3890 /* Extract the legal requests */
3894 /* Redraw if needed */
3895 if (command_see) get_item_label = show_inven(menu_line, mode);
3898 /* Equipment screen */
3899 else if (command_wrk == (USE_EQUIP))
3901 /* Extract the legal requests */
3902 n1 = I2A(e1 - INVEN_RARM);
3903 n2 = I2A(e2 - INVEN_RARM);
3905 /* Redraw if needed */
3906 if (command_see) get_item_label = show_equip(menu_line, mode);
3910 else if (command_wrk == (USE_FLOOR))
3913 k = MIN(floor_top + 23, floor_num) - 1;
3915 /* Extract the legal requests */
3916 n1 = I2A(j - floor_top);
3917 n2 = I2A(k - floor_top);
3919 /* Redraw if needed */
3920 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3923 /* Viewing p_ptr->inventory_list */
3924 if (command_wrk == (USE_INVEN))
3926 /* Begin the prompt */
3927 sprintf(out_val, _("持ち物:", "Inven:"));
3931 /* Build the prompt */
3932 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3933 index_to_label(i1), index_to_label(i2));
3936 strcat(out_val, tmp_val);
3939 /* Indicate ability to "view" */
3940 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3946 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
3947 else if (allow_floor)
3948 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
3950 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
3957 strcat(out_val, _(" '-'床上,", " - for floor,"));
3958 else if (allow_equip)
3959 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
3961 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
3965 /* Viewing equipment */
3966 else if (command_wrk == (USE_EQUIP))
3968 /* Begin the prompt */
3969 sprintf(out_val, _("装備品:", "Equip:"));
3973 /* Build the prompt */
3974 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3975 index_to_label(e1), index_to_label(e2));
3978 strcat(out_val, tmp_val);
3981 /* Indicate ability to "view" */
3982 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3988 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
3989 else if (allow_floor)
3990 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
3992 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
3999 strcat(out_val, _(" '-'床上,", " - for floor,"));
4000 else if (allow_inven)
4001 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4003 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4008 else if (command_wrk == (USE_FLOOR))
4010 /* Begin the prompt */
4011 sprintf(out_val, _("床上:", "Floor:"));
4015 /* Build the prompt */
4016 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4019 strcat(out_val, tmp_val);
4022 /* Indicate ability to "view" */
4023 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4027 if (allow_inven && allow_equip)
4029 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4031 else if (allow_inven)
4033 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4035 else if (allow_equip)
4037 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4041 else if (allow_inven)
4043 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4045 else if (allow_equip)
4047 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4051 if (command_see && !use_menu)
4053 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4058 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4060 /* Finish the prompt */
4061 strcat(out_val, " ESC");
4063 /* Build the prompt */
4064 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4066 /* Show the prompt */
4075 if (command_wrk == USE_INVEN) max_line = max_inven;
4076 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4077 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4093 menu_line += (max_line - 1);
4109 /* Verify legality */
4110 if (command_wrk == (USE_INVEN))
4112 if (allow_floor) command_wrk = USE_FLOOR;
4113 else if (allow_equip) command_wrk = USE_EQUIP;
4120 else if (command_wrk == (USE_EQUIP))
4122 if (allow_inven) command_wrk = USE_INVEN;
4123 else if (allow_floor) command_wrk = USE_FLOOR;
4130 else if (command_wrk == (USE_FLOOR))
4132 if (allow_equip) command_wrk = USE_EQUIP;
4133 else if (allow_inven) command_wrk = USE_INVEN;
4146 /* Hack -- Fix screen */
4153 /* Switch inven/equip */
4154 if (command_wrk == USE_INVEN) max_line = max_inven;
4155 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4156 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4157 if (menu_line > max_line) menu_line = max_line;
4159 /* Need to redraw */
4167 /* Verify legality */
4168 if (command_wrk == (USE_INVEN))
4170 if (allow_equip) command_wrk = USE_EQUIP;
4171 else if (allow_floor) command_wrk = USE_FLOOR;
4178 else if (command_wrk == (USE_EQUIP))
4180 if (allow_floor) command_wrk = USE_FLOOR;
4181 else if (allow_inven) command_wrk = USE_INVEN;
4188 else if (command_wrk == (USE_FLOOR))
4190 if (allow_inven) command_wrk = USE_INVEN;
4191 else if (allow_equip) command_wrk = USE_EQUIP;
4204 /* Hack -- Fix screen */
4211 /* Switch inven/equip */
4212 if (command_wrk == USE_INVEN) max_line = max_inven;
4213 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4214 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4215 if (menu_line > max_line) menu_line = max_line;
4217 /* Need to redraw */
4226 if (command_wrk == USE_FLOOR)
4229 (*cp) = -get_item_label;
4233 /* Validate the item */
4234 if (!get_item_okay(get_item_label))
4240 /* Allow player to "refuse" certain actions */
4241 if (!get_item_allow(get_item_label))
4247 /* Accept that choice */
4248 (*cp) = get_item_label;
4265 if (menu_line > max_line) menu_line -= max_line;
4286 command_see = FALSE;
4307 grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
4309 if (command_wrk != (USE_FLOOR)) break;
4311 /* Get the object being moved. */
4312 o_idx = g_ptr->o_idx;
4314 /* Only rotate a pile of two or more objects. */
4315 if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
4317 /* Remove the first object from the list. */
4318 excise_object_idx(o_idx);
4320 /* Find end of the list. */
4322 while (current_floor_ptr->o_list[i].next_o_idx)
4323 i = current_floor_ptr->o_list[i].next_o_idx;
4325 /* Add after the last object. */
4326 current_floor_ptr->o_list[i].next_o_idx = o_idx;
4328 /* Re-scan floor list */
4329 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4331 /* Hack -- Fix screen */
4343 if (command_wrk == (USE_INVEN))
4350 command_wrk = (USE_EQUIP);
4352 else if (command_wrk == (USE_EQUIP))
4359 command_wrk = (USE_INVEN);
4361 else if (command_wrk == (USE_FLOOR))
4365 command_wrk = (USE_INVEN);
4367 else if (allow_equip)
4369 command_wrk = (USE_EQUIP);
4378 /* Hack -- Fix screen */
4385 /* Need to redraw */
4398 * If we are already examining the floor, and there
4399 * is only one item, we will always select it.
4400 * If we aren't examining the floor and there is only
4401 * one item, we will select it if floor_query_flag
4406 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4409 k = 0 - floor_list[0];
4411 /* Allow player to "refuse" certain actions */
4412 if (!get_item_allow(k))
4418 /* Accept that choice */
4427 /* Hack -- Fix screen */
4434 command_wrk = (USE_FLOOR);
4440 case '1': case '2': case '3':
4441 case '4': case '5': case '6':
4442 case '7': case '8': case '9':
4444 if (command_wrk != USE_FLOOR)
4446 /* Look up the tag */
4447 if (!get_tag(&k, which, command_wrk))
4453 /* Hack -- Validate the item */
4454 if ((k < INVEN_RARM) ? !inven : !equip)
4460 /* Validate the item */
4461 if (!get_item_okay(k))
4469 /* Look up the alphabetical tag */
4470 if (get_tag_floor(&k, which, floor_list, floor_num))
4473 k = 0 - floor_list[k];
4482 /* Allow player to "refuse" certain actions */
4483 if (!get_item_allow(k))
4489 /* Accept that choice */
4501 /* Choose "default" p_ptr->inventory_list item */
4502 if (command_wrk == (USE_INVEN))
4504 k = ((i1 == i2) ? i1 : -1);
4507 /* Choose "default" equipment item */
4508 else if (command_wrk == (USE_EQUIP))
4510 k = ((e1 == e2) ? e1 : -1);
4513 /* Choose "default" floor item */
4514 else if (command_wrk == (USE_FLOOR))
4519 k = 0 - floor_list[0];
4521 /* Allow player to "refuse" certain actions */
4522 if (!get_item_allow(k))
4528 /* Accept that choice */
4536 /* Validate the item */
4537 if (!get_item_okay(k))
4543 /* Allow player to "refuse" certain actions */
4544 if (!get_item_allow(k))
4550 /* Accept that choice */
4574 if (command_wrk != USE_FLOOR)
4576 bool not_found = FALSE;
4578 /* Look up the alphabetical tag */
4579 if (!get_tag(&k, which, command_wrk))
4584 /* Hack -- Validate the item */
4585 else if ((k < INVEN_RARM) ? !inven : !equip)
4590 /* Validate the item */
4591 else if (!get_item_okay(k))
4598 /* Accept that choice */
4608 /* Look up the alphabetical tag */
4609 if (get_tag_floor(&k, which, floor_list, floor_num))
4612 k = 0 - floor_list[k];
4614 /* Accept that choice */
4623 /* Extract "query" setting */
4624 ver = isupper(which);
4625 which = (char)tolower(which);
4627 /* Convert letter to p_ptr->inventory_list index */
4628 if (command_wrk == (USE_INVEN))
4630 if (which == '(') k = i1;
4631 else if (which == ')') k = i2;
4632 else k = label_to_inven(which);
4635 /* Convert letter to equipment index */
4636 else if (command_wrk == (USE_EQUIP))
4638 if (which == '(') k = e1;
4639 else if (which == ')') k = e2;
4640 else k = label_to_equip(which);
4643 /* Convert letter to floor index */
4644 else if (command_wrk == USE_FLOOR)
4646 if (which == '(') k = 0;
4647 else if (which == ')') k = floor_num - 1;
4648 else k = islower(which) ? A2I(which) : -1;
4649 if (k < 0 || k >= floor_num || k >= 23)
4656 k = 0 - floor_list[k];
4659 /* Validate the item */
4660 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4666 /* Verify the item */
4667 if (ver && !verify(_("本当に", "Try"), k))
4673 /* Allow player to "refuse" certain actions */
4674 if (!get_item_allow(k))
4680 /* Accept that choice */
4690 /* Fix the screen if necessary */
4695 /* Hack -- Cancel "display" */
4696 command_see = FALSE;
4700 /* Forget the item_tester_tval restriction */
4701 item_tester_tval = 0;
4703 /* Forget the item_tester_hook restriction */
4704 item_tester_hook = NULL;
4707 /* Clean up 'show choices' */
4708 /* Toggle again if needed */
4709 if (toggle) toggle_inven_equip();
4711 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4714 /* Clear the prompt line */
4717 /* Warning if needed */
4718 if (oops && str) msg_print(str);
4723 if (command_cmd) prev_tag = cur_tag;
4724 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4730 * @brief 床上のアイテムを拾う選択用サブルーチン
4731 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4733 static bool py_pickup_floor_aux(void)
4735 OBJECT_IDX this_o_idx;
4739 /* Restrict the choices */
4740 item_tester_hook = inven_carry_okay;
4743 q = _("どれを拾いますか?", "Get which item? ");
4744 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4746 if (choose_object(&item, q, s, (USE_FLOOR)))
4748 this_o_idx = 0 - item;
4755 /* Pick up the object */
4756 py_pickup_aux(this_o_idx);
4762 * @brief 床上のアイテムを拾うメイン処理
4763 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4766 * This is called by py_pickup() when easy_floor is TRUE.
4768 void py_pickup_floor(bool pickup)
4770 OBJECT_IDX this_o_idx, next_o_idx = 0;
4772 GAME_TEXT o_name[MAX_NLEN];
4776 OBJECT_IDX floor_o_idx = 0;
4780 /* Scan the pile of objects */
4781 for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
4783 /* Access the object */
4784 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
4786 object_desc(o_name, o_ptr, 0);
4788 /* Access the next object */
4789 next_o_idx = o_ptr->next_o_idx;
4791 disturb(FALSE, FALSE);
4794 if (o_ptr->tval == TV_GOLD)
4797 msg_format(" $%ld の価値がある%sを見つけた。",
4798 (long)o_ptr->pval, o_name);
4800 msg_format("You have found %ld gold pieces worth of %s.",
4801 (long)o_ptr->pval, o_name);
4804 /* Collect the gold */
4805 p_ptr->au += o_ptr->pval;
4808 p_ptr->redraw |= (PR_GOLD);
4810 p_ptr->window |= (PW_PLAYER);
4812 /* Delete the gold */
4813 delete_object_idx(this_o_idx);
4815 /* Check the next object */
4818 else if (o_ptr->marked & OM_NOMSG)
4820 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4821 * ignored. Otherwise, they are included in the prompt. */
4822 o_ptr->marked &= ~(OM_NOMSG);
4826 /* Count non-gold objects that can be picked up. */
4827 if (inven_carry_okay(o_ptr))
4832 /* Count non-gold objects */
4835 /* Remember this index */
4836 floor_o_idx = this_o_idx;
4839 /* There are no non-gold objects */
4843 /* Mention the number of objects */
4849 /* Access the object */
4850 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4852 #ifdef ALLOW_EASY_SENSE
4854 /* Option: Make object sensing easy */
4857 /* Sense the object */
4858 (void) sense_object(o_ptr);
4861 #endif /* ALLOW_EASY_SENSE */
4863 object_desc(o_name, o_ptr, 0);
4865 msg_format(_("%sがある。", "You see %s."), o_name);
4868 /* Multiple objects */
4871 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4877 /* The player has no room for anything on the floor. */
4883 /* Access the object */
4884 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4886 #ifdef ALLOW_EASY_SENSE
4888 /* Option: Make object sensing easy */
4891 /* Sense the object */
4892 (void) sense_object(o_ptr);
4895 #endif /* ALLOW_EASY_SENSE */
4897 object_desc(o_name, o_ptr, 0);
4899 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4902 /* Multiple objects */
4905 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4915 /* Hack -- query every object */
4916 if (carry_query_flag)
4918 char out_val[MAX_NLEN+20];
4920 /* Access the object */
4921 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4923 #ifdef ALLOW_EASY_SENSE
4925 /* Option: Make object sensing easy */
4928 /* Sense the object */
4929 (void) sense_object(o_ptr);
4932 #endif /* ALLOW_EASY_SENSE */
4934 object_desc(o_name, o_ptr, 0);
4936 /* Build a prompt */
4937 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
4939 /* Ask the user to confirm */
4940 if (!get_check(out_val))
4946 /* Access the object */
4947 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4949 #ifdef ALLOW_EASY_SENSE
4951 /* Option: Make object sensing easy */
4954 /* Sense the object */
4955 (void) sense_object(o_ptr);
4958 #endif /* ALLOW_EASY_SENSE */
4960 /* Pick up the object */
4961 py_pickup_aux(floor_o_idx);
4964 /* Allow the user to choose an object */
4967 while (can_pickup--)
4969 if (!py_pickup_floor_aux()) break;
4976 * @brief 矢弾を射撃した場合の破損確率を返す /
4977 * Determines the odds of an object breaking when thrown at a monster
4978 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
4981 * Note that artifacts never break, see the "drop_near()" function.
4983 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
4985 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
4987 /* Examine the snipe type */
4990 if (snipe_type == SP_KILL_WALL) return (100);
4991 if (snipe_type == SP_EXPLODE) return (100);
4992 if (snipe_type == SP_PIERCE) return (100);
4993 if (snipe_type == SP_FINAL) return (100);
4994 if (snipe_type == SP_NEEDLE) return (100);
4995 if (snipe_type == SP_EVILNESS) return (40);
4996 if (snipe_type == SP_HOLYNESS) return (40);
4999 /* Examine the item type */
5000 switch (o_ptr->tval)
5016 /* Sometimes break */
5021 return (20 - archer_bonus * 2);
5026 return (10 - archer_bonus);