3 * @brief オブジェクトの実装 / Object code, part 1
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2014 Deskull rearranged comment for Doxygen.\n
17 #include "cmd-activate.h"
18 #include "object-flavor.h"
19 #include "object-hook.h"
20 #include "player-move.h"
23 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
30 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
32 * This involves resetting various things to their "default" state.\n
34 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
35 * "user pref file" based on the current setting of the "use_graphics"\n
36 * flag. This is useful for switching "graphics" on/off.\n
38 * The features, objects, and monsters, should all be encoded in the\n
39 * relevant "font.pref" and/or "graf.prf" files. \n
41 * The "prefs" parameter is no longer meaningful. \n
43 void reset_visuals(void)
47 /* Extract some info about terrain features */
48 for (i = 0; i < max_f_idx; i++)
50 feature_type *f_ptr = &f_info[i];
52 /* Assume we will use the underlying values */
53 for (j = 0; j < F_LIT_MAX; j++)
55 f_ptr->x_attr[j] = f_ptr->d_attr[j];
56 f_ptr->x_char[j] = f_ptr->d_char[j];
60 /* Extract default attr/char code for objects */
61 for (i = 0; i < max_k_idx; i++)
63 object_kind *k_ptr = &k_info[i];
65 /* Default attr/char */
66 k_ptr->x_attr = k_ptr->d_attr;
67 k_ptr->x_char = k_ptr->d_char;
70 /* Extract default attr/char code for monsters */
71 for (i = 0; i < max_r_idx; i++)
73 monster_race *r_ptr = &r_info[i];
75 /* Default attr/char */
76 r_ptr->x_attr = r_ptr->d_attr;
77 r_ptr->x_char = r_ptr->d_char;
84 /* Process "graf.prf" */
85 process_pref_file("graf.prf");
87 /* Access the "character" pref file */
88 sprintf(buf, "graf-%s.prf", player_base);
90 /* Process "graf-<playername>.prf" */
91 process_pref_file(buf);
99 /* Process "font.prf" */
100 process_pref_file("font.prf");
102 /* Access the "character" pref file */
103 sprintf(buf, "font-%s.prf", player_base);
105 /* Process "font-<playername>.prf" */
106 process_pref_file(buf);
111 * @brief オブジェクトのフラグ類を配列に与える
112 * Obtain the "flags" for an item
113 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
114 * @param flgs フラグ情報を受け取る配列
117 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
119 object_kind *k_ptr = &k_info[o_ptr->k_idx];
123 for (i = 0; i < TR_FLAG_SIZE; i++)
124 flgs[i] = k_ptr->flags[i];
127 if (object_is_fixed_artifact(o_ptr))
129 artifact_type *a_ptr = &a_info[o_ptr->name1];
131 for (i = 0; i < TR_FLAG_SIZE; i++)
132 flgs[i] = a_ptr->flags[i];
136 if (object_is_ego(o_ptr))
138 ego_item_type *e_ptr = &e_info[o_ptr->name2];
140 for (i = 0; i < TR_FLAG_SIZE; i++)
141 flgs[i] |= e_ptr->flags[i];
143 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
145 remove_flag(flgs, TR_SH_FIRE);
147 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
149 remove_flag(flgs, TR_INFRA);
151 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
153 remove_flag(flgs, TR_RES_BLIND);
154 remove_flag(flgs, TR_SEE_INVIS);
158 /* Random artifact ! */
159 for (i = 0; i < TR_FLAG_SIZE; i++)
160 flgs[i] |= o_ptr->art_flags[i];
162 if (object_is_smith(o_ptr))
164 int add = o_ptr->xtra3 - 1;
166 if (add < TR_FLAG_MAX)
170 else if (add == ESSENCE_TMP_RES_ACID)
172 add_flag(flgs, TR_RES_ACID);
173 add_flag(flgs, TR_ACTIVATE);
175 else if (add == ESSENCE_TMP_RES_ELEC)
177 add_flag(flgs, TR_RES_ELEC);
178 add_flag(flgs, TR_ACTIVATE);
180 else if (add == ESSENCE_TMP_RES_FIRE)
182 add_flag(flgs, TR_RES_FIRE);
183 add_flag(flgs, TR_ACTIVATE);
185 else if (add == ESSENCE_TMP_RES_COLD)
187 add_flag(flgs, TR_RES_COLD);
188 add_flag(flgs, TR_ACTIVATE);
190 else if (add == ESSENCE_SH_FIRE)
192 add_flag(flgs, TR_RES_FIRE);
193 add_flag(flgs, TR_SH_FIRE);
195 else if (add == ESSENCE_SH_ELEC)
197 add_flag(flgs, TR_RES_ELEC);
198 add_flag(flgs, TR_SH_ELEC);
200 else if (add == ESSENCE_SH_COLD)
202 add_flag(flgs, TR_RES_COLD);
203 add_flag(flgs, TR_SH_COLD);
205 else if (add == ESSENCE_RESISTANCE)
207 add_flag(flgs, TR_RES_ACID);
208 add_flag(flgs, TR_RES_ELEC);
209 add_flag(flgs, TR_RES_FIRE);
210 add_flag(flgs, TR_RES_COLD);
212 else if (add == TR_IMPACT)
214 add_flag(flgs, TR_ACTIVATE);
220 * @brief オブジェクトの明示されているフラグ類を取得する
221 * Obtain the "flags" for an item which are known to the player
222 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
223 * @param flgs フラグ情報を受け取る配列
226 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
231 object_kind *k_ptr = &k_info[o_ptr->k_idx];
234 for (i = 0; i < TR_FLAG_SIZE; i++)
237 if (!object_is_aware(o_ptr)) return;
240 for (i = 0; i < TR_FLAG_SIZE; i++)
241 flgs[i] = k_ptr->flags[i];
243 /* Must be identified */
244 if (!object_is_known(o_ptr)) return;
246 /* Ego-item (known basic flags) */
247 if (object_is_ego(o_ptr))
249 ego_item_type *e_ptr = &e_info[o_ptr->name2];
251 for (i = 0; i < TR_FLAG_SIZE; i++)
252 flgs[i] |= e_ptr->flags[i];
254 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
256 remove_flag(flgs, TR_SH_FIRE);
258 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
260 remove_flag(flgs, TR_INFRA);
262 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
264 remove_flag(flgs, TR_RES_BLIND);
265 remove_flag(flgs, TR_SEE_INVIS);
270 #ifdef SPOIL_ARTIFACTS
271 /* Full knowledge for some artifacts */
272 if (object_is_artifact(o_ptr)) spoil = TRUE;
273 #endif /* SPOIL_ARTIFACTS */
275 #ifdef SPOIL_EGO_ITEMS
276 /* Full knowledge for some ego-items */
277 if (object_is_ego(o_ptr)) spoil = TRUE;
278 #endif /* SPOIL_EGO_ITEMS */
280 /* Need full knowledge or spoilers */
281 if (spoil || (o_ptr->ident & IDENT_MENTAL))
284 if (object_is_fixed_artifact(o_ptr))
286 artifact_type *a_ptr = &a_info[o_ptr->name1];
288 for (i = 0; i < TR_FLAG_SIZE; i++)
289 flgs[i] = a_ptr->flags[i];
292 /* Random artifact ! */
293 for (i = 0; i < TR_FLAG_SIZE; i++)
294 flgs[i] |= o_ptr->art_flags[i];
297 if (object_is_smith(o_ptr))
299 int add = o_ptr->xtra3 - 1;
301 if (add < TR_FLAG_MAX)
305 else if (add == ESSENCE_TMP_RES_ACID)
307 add_flag(flgs, TR_RES_ACID);
309 else if (add == ESSENCE_TMP_RES_ELEC)
311 add_flag(flgs, TR_RES_ELEC);
313 else if (add == ESSENCE_TMP_RES_FIRE)
315 add_flag(flgs, TR_RES_FIRE);
317 else if (add == ESSENCE_TMP_RES_COLD)
319 add_flag(flgs, TR_RES_COLD);
321 else if (add == ESSENCE_SH_FIRE)
323 add_flag(flgs, TR_RES_FIRE);
324 add_flag(flgs, TR_SH_FIRE);
326 else if (add == ESSENCE_SH_ELEC)
328 add_flag(flgs, TR_RES_ELEC);
329 add_flag(flgs, TR_SH_ELEC);
331 else if (add == ESSENCE_SH_COLD)
333 add_flag(flgs, TR_RES_COLD);
334 add_flag(flgs, TR_SH_COLD);
336 else if (add == ESSENCE_RESISTANCE)
338 add_flag(flgs, TR_RES_ACID);
339 add_flag(flgs, TR_RES_ELEC);
340 add_flag(flgs, TR_RES_FIRE);
341 add_flag(flgs, TR_RES_COLD);
347 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
348 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
349 * @return concptr 発動名称を返す文字列ポインタ
351 static concptr item_activation_dragon_breath(object_type *o_ptr)
353 static char desc[256];
354 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
357 object_flags(o_ptr, flgs);
358 strcpy(desc, _("", "breath "));
360 for (i = 0; dragonbreath_info[i].flag != 0; i++)
362 if (have_flag(flgs, dragonbreath_info[i].flag))
364 if (n > 0) strcat(desc, _("、", ", "));
365 strcat(desc, dragonbreath_info[i].name);
370 strcat(desc, _("のブレス(250)", ""));
376 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
377 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
378 * @return concptr 発動名称を返す文字列ポインタ
380 static concptr item_activation_aux(object_type *o_ptr)
382 static char activation_detail[256];
386 const activation_type* const act_ptr = find_activation_info(o_ptr);
388 if (!act_ptr) return _("未定義", "something undefined");
390 desc = act_ptr->desc;
392 /* Overwrite description if it is special */
393 switch (act_ptr->index) {
395 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
396 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
399 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
400 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
403 desc = item_activation_dragon_breath(o_ptr);
406 if (o_ptr->name1 == ART_HYOUSIGI)
407 desc = _("拍子木を打ちならす", "beat wooden clappers");
409 case ACT_RESIST_ACID:
410 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
411 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
413 case ACT_RESIST_FIRE:
414 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
415 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
417 case ACT_RESIST_COLD:
418 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
419 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
421 case ACT_RESIST_ELEC:
422 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
423 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
425 case ACT_RESIST_POIS:
426 if (o_ptr->name2 == EGO_BRAND_POIS)
427 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
431 /* Timeout description */
432 constant = act_ptr->timeout.constant;
433 dice = act_ptr->timeout.dice;
434 if (constant == 0 && dice == 0) {
435 /* We can activate it every current_world_ptr->game_turn */
436 strcpy(timeout, _("いつでも", "every current_world_ptr->game_turn"));
437 } else if (constant < 0) {
438 /* Activations that have special timeout */
439 switch (act_ptr->index) {
441 sprintf(timeout, _("%d ターン毎", "every %d turns"),
442 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
445 sprintf(timeout, _("%d ターン毎", "every %d turns"),
446 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
449 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
452 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
455 strcpy(timeout, "undefined");
459 /* Normal timeout activations */
460 char constant_str[16], dice_str[16];
461 sprintf(constant_str, "%d", constant);
462 sprintf(dice_str, "d%d", dice);
463 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
464 (constant > 0) ? constant_str : "",
465 (constant > 0 && dice > 0) ? "+" : "",
466 (dice > 0) ? dice_str : "");
469 /* Build detail activate description */
470 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
472 return activation_detail;
476 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
477 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
478 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
479 * @return concptr 発動名称を返す文字列ポインタ
481 concptr item_activation(object_type *o_ptr)
483 BIT_FLAGS flgs[TR_FLAG_SIZE];
484 object_flags(o_ptr, flgs);
486 /* Require activation ability */
487 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
489 /* Get an explain of an activation */
490 if (activation_index(o_ptr))
492 return item_activation_aux(o_ptr);
496 if (o_ptr->tval == TV_WHISTLE)
498 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
501 if (o_ptr->tval == TV_CAPTURE)
503 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
506 return _("何も起きない", "Nothing");
511 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
512 * Describe a "fully identified" item
513 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
514 * @param mode 表示オプション
515 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
517 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
521 BIT_FLAGS flgs[TR_FLAG_SIZE];
525 GAME_TEXT o_name[MAX_NLEN];
530 int trivial_info = 0;
531 object_flags(o_ptr, flgs);
533 /* Extract the description */
535 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
536 (k_text + k_info[o_ptr->k_idx].text),
537 77 - 15, temp, sizeof(temp));
538 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
539 { info[i] = &temp[j]; i++;}
542 if (object_is_equipment(o_ptr))
544 /* Descriptions of a basic equipment is just a flavor */
548 /* Mega-Hack -- describe activation */
549 if (have_flag(flgs, TR_ACTIVATE))
551 info[i++] = _("始動したときの効果...", "It can be activated for...");
552 info[i++] = item_activation(o_ptr);
553 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
556 /* Figurines, a hack */
557 if (o_ptr->tval == TV_FIGURINE)
559 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
562 /* Figurines, a hack */
563 if (o_ptr->name1 == ART_STONEMASK)
565 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you current_world_ptr->game_turn into a vampire permanently.");
568 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
570 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
573 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
575 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
576 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
579 if (o_ptr->name2 == EGO_2WEAPON)
581 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
584 if (have_flag(flgs, TR_EASY_SPELL))
586 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
589 if (o_ptr->name2 == EGO_AMU_FOOL)
591 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
594 if (o_ptr->name2 == EGO_RING_THROW)
596 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
599 if (o_ptr->name2 == EGO_AMU_NAIVETY)
601 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
604 if (o_ptr->tval == TV_STATUE)
606 monster_race *r_ptr = &r_info[o_ptr->pval];
608 if (o_ptr->pval == MON_BULLGATES)
609 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
610 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
611 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
613 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
616 /* Hack -- describe lite's */
618 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
621 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
622 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
623 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
624 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
625 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
626 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
628 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
630 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
632 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
636 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
637 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
640 if(rad != 0) info[i++] = desc;
643 if (o_ptr->name2 == EGO_LITE_LONG)
645 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
648 /* And then describe it fully */
650 if (have_flag(flgs, TR_RIDING))
652 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
653 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
656 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
657 /* This information is not important enough */
661 if (have_flag(flgs, TR_STR))
663 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
665 if (have_flag(flgs, TR_INT))
667 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
669 if (have_flag(flgs, TR_WIS))
671 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
673 if (have_flag(flgs, TR_DEX))
675 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
677 if (have_flag(flgs, TR_CON))
679 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
681 if (have_flag(flgs, TR_CHR))
683 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
686 if (have_flag(flgs, TR_MAGIC_MASTERY))
688 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
691 if (have_flag(flgs, TR_STEALTH))
693 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
695 if (have_flag(flgs, TR_SEARCH))
697 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
699 if (have_flag(flgs, TR_INFRA))
701 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
703 if (have_flag(flgs, TR_TUNNEL))
705 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
707 if (have_flag(flgs, TR_SPEED))
709 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
711 if (have_flag(flgs, TR_BLOWS))
713 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
716 if (have_flag(flgs, TR_BRAND_ACID))
718 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
720 if (have_flag(flgs, TR_BRAND_ELEC))
722 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
724 if (have_flag(flgs, TR_BRAND_FIRE))
726 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
728 if (have_flag(flgs, TR_BRAND_COLD))
730 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
733 if (have_flag(flgs, TR_BRAND_POIS))
735 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
738 if (have_flag(flgs, TR_CHAOTIC))
740 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
743 if (have_flag(flgs, TR_VAMPIRIC))
745 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
748 if (have_flag(flgs, TR_IMPACT))
750 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
753 if (have_flag(flgs, TR_VORPAL))
755 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
758 if (have_flag(flgs, TR_KILL_DRAGON))
760 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
762 else if (have_flag(flgs, TR_SLAY_DRAGON))
764 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
767 if (have_flag(flgs, TR_KILL_ORC))
769 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
771 if (have_flag(flgs, TR_SLAY_ORC))
773 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
776 if (have_flag(flgs, TR_KILL_TROLL))
778 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
780 if (have_flag(flgs, TR_SLAY_TROLL))
782 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
785 if (have_flag(flgs, TR_KILL_GIANT))
787 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
789 else if (have_flag(flgs, TR_SLAY_GIANT))
791 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
794 if (have_flag(flgs, TR_KILL_DEMON))
796 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
798 if (have_flag(flgs, TR_SLAY_DEMON))
800 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
803 if (have_flag(flgs, TR_KILL_UNDEAD))
805 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
807 if (have_flag(flgs, TR_SLAY_UNDEAD))
809 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
812 if (have_flag(flgs, TR_KILL_EVIL))
814 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
816 if (have_flag(flgs, TR_SLAY_EVIL))
818 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
821 if (have_flag(flgs, TR_KILL_ANIMAL))
823 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
825 if (have_flag(flgs, TR_SLAY_ANIMAL))
827 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
830 if (have_flag(flgs, TR_KILL_HUMAN))
832 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
834 if (have_flag(flgs, TR_SLAY_HUMAN))
836 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
839 if (have_flag(flgs, TR_FORCE_WEAPON))
841 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
843 if (have_flag(flgs, TR_DEC_MANA))
845 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
847 if (have_flag(flgs, TR_SUST_STR))
849 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
851 if (have_flag(flgs, TR_SUST_INT))
853 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
855 if (have_flag(flgs, TR_SUST_WIS))
857 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
859 if (have_flag(flgs, TR_SUST_DEX))
861 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
863 if (have_flag(flgs, TR_SUST_CON))
865 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
867 if (have_flag(flgs, TR_SUST_CHR))
869 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
872 if (have_flag(flgs, TR_IM_ACID))
874 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
876 if (have_flag(flgs, TR_IM_ELEC))
878 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
880 if (have_flag(flgs, TR_IM_FIRE))
882 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
884 if (have_flag(flgs, TR_IM_COLD))
886 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
889 if (have_flag(flgs, TR_THROW))
891 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
894 if (have_flag(flgs, TR_FREE_ACT))
896 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
898 if (have_flag(flgs, TR_HOLD_EXP))
900 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
902 if (have_flag(flgs, TR_RES_FEAR))
904 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
906 if (have_flag(flgs, TR_RES_ACID))
908 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
910 if (have_flag(flgs, TR_RES_ELEC))
912 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
914 if (have_flag(flgs, TR_RES_FIRE))
916 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
918 if (have_flag(flgs, TR_RES_COLD))
920 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
922 if (have_flag(flgs, TR_RES_POIS))
924 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
927 if (have_flag(flgs, TR_RES_LITE))
929 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
931 if (have_flag(flgs, TR_RES_DARK))
933 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
936 if (have_flag(flgs, TR_RES_BLIND))
938 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
940 if (have_flag(flgs, TR_RES_CONF))
942 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
944 if (have_flag(flgs, TR_RES_SOUND))
946 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
948 if (have_flag(flgs, TR_RES_SHARDS))
950 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
953 if (have_flag(flgs, TR_RES_NETHER))
955 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
957 if (have_flag(flgs, TR_RES_NEXUS))
959 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
961 if (have_flag(flgs, TR_RES_CHAOS))
963 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
965 if (have_flag(flgs, TR_RES_DISEN))
967 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
970 if (have_flag(flgs, TR_LEVITATION))
972 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
975 if (have_flag(flgs, TR_SEE_INVIS))
977 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
979 if (have_flag(flgs, TR_TELEPATHY))
981 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
983 if (have_flag(flgs, TR_ESP_ANIMAL))
985 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
987 if (have_flag(flgs, TR_ESP_UNDEAD))
989 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
991 if (have_flag(flgs, TR_ESP_DEMON))
993 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
995 if (have_flag(flgs, TR_ESP_ORC))
997 info[i++] = _("それはオークを感知する。", "It senses orcs.");
999 if (have_flag(flgs, TR_ESP_TROLL))
1001 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1003 if (have_flag(flgs, TR_ESP_GIANT))
1005 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1007 if (have_flag(flgs, TR_ESP_DRAGON))
1009 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1011 if (have_flag(flgs, TR_ESP_HUMAN))
1013 info[i++] = _("それは人間を感知する。", "It senses humans.");
1015 if (have_flag(flgs, TR_ESP_EVIL))
1017 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1019 if (have_flag(flgs, TR_ESP_GOOD))
1021 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1023 if (have_flag(flgs, TR_ESP_NONLIVING))
1025 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1027 if (have_flag(flgs, TR_ESP_UNIQUE))
1029 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1031 if (have_flag(flgs, TR_SLOW_DIGEST))
1033 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1035 if (have_flag(flgs, TR_REGEN))
1037 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1039 if (have_flag(flgs, TR_WARNING))
1041 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1043 if (have_flag(flgs, TR_REFLECT))
1045 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1047 if (have_flag(flgs, TR_SH_FIRE))
1049 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1051 if (have_flag(flgs, TR_SH_ELEC))
1053 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1055 if (have_flag(flgs, TR_SH_COLD))
1057 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1059 if (have_flag(flgs, TR_NO_MAGIC))
1061 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1063 if (have_flag(flgs, TR_NO_TELE))
1065 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1067 if (have_flag(flgs, TR_XTRA_MIGHT))
1069 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1071 if (have_flag(flgs, TR_XTRA_SHOTS))
1073 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1076 if (have_flag(flgs, TR_BLESSED))
1078 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1081 if (object_is_cursed(o_ptr))
1083 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1085 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1087 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1089 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1093 info[i++] = _("それは呪われている。", "It is cursed.");
1096 * It's a trivial infomation since there is
1097 * fake inscription {cursed}
1103 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1105 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1107 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1109 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1111 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1113 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1115 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1117 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1119 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1121 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1123 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1125 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1127 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1129 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1131 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1133 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1135 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1137 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1139 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1141 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1143 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1145 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1147 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1149 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1151 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1153 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1155 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1157 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1159 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1161 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1163 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1165 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1167 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1169 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1171 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1173 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1176 /* Describe about this kind of object instead of THIS fake object */
1177 if (mode & SCROBJ_FAKE_OBJECT)
1179 switch (o_ptr->tval)
1182 switch (o_ptr->sval)
1184 case SV_RING_LORDLY:
1185 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1187 case SV_RING_WARNING:
1188 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1194 switch (o_ptr->sval)
1196 case SV_AMULET_RESISTANCE:
1197 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1198 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1200 case SV_AMULET_THE_MAGI:
1201 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1208 if (have_flag(flgs, TR_IGNORE_ACID) &&
1209 have_flag(flgs, TR_IGNORE_ELEC) &&
1210 have_flag(flgs, TR_IGNORE_FIRE) &&
1211 have_flag(flgs, TR_IGNORE_COLD))
1213 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1217 if (have_flag(flgs, TR_IGNORE_ACID))
1219 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1221 if (have_flag(flgs, TR_IGNORE_ELEC))
1223 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1225 if (have_flag(flgs, TR_IGNORE_FIRE))
1227 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1229 if (have_flag(flgs, TR_IGNORE_COLD))
1231 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1235 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1237 /* No relevant informations */
1238 if (i <= trivial_info) return (FALSE);
1241 Term_get_size(&wid, &hgt);
1243 /* Display Item name */
1244 if (!(mode & SCROBJ_FAKE_OBJECT))
1245 object_desc(o_name, o_ptr, 0);
1247 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1251 /* Erase the screen */
1252 for (k = 1; k < hgt; k++) prt("", k, 13);
1254 /* Label the information */
1255 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1257 monster_race *r_ptr = &r_info[o_ptr->pval];
1258 int namelen = strlen(r_name + r_ptr->name);
1259 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1260 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1261 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1265 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1268 /* We will print on top of the map (column 13) */
1269 for (k = 2, j = 0; j < i; j++)
1272 prt(info[j], k++, 15);
1274 /* Every 20 entries (lines 2 to 21), start over */
1275 if ((k == hgt - 2) && (j+1 < i))
1277 prt(_("-- 続く --", "-- more --"), k, 15);
1279 for (; k > 2; k--) prt("", k, 15);
1284 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1289 /* Gave knowledge */
1296 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1297 * Convert an inventory index into a one character label
1298 * @param i プレイヤーの所持/装備オブジェクトID
1299 * @return 対応するアルファベット
1300 * @details Note that the label does NOT distinguish inven/equip.
1302 char index_to_label(int i)
1304 /* Indexes for "inven" are easy */
1305 if (i < INVEN_RARM) return (I2A(i));
1307 /* Indexes for "equip" are offset */
1308 return (I2A(i - INVEN_RARM));
1312 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1313 * Convert a label into the index of an item in the "inven"
1314 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1315 * @details Note that the label does NOT distinguish inven/equip.
1317 INVENTORY_IDX label_to_inven(int c)
1322 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1324 /* Verify the index */
1325 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1327 /* Empty slots can never be chosen */
1328 if (!inventory[i].k_idx) return (-1);
1330 /* Return the index */
1336 extern bool select_ring_slot;
1340 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1341 * @param i プレイヤーの所持/装備オブジェクトID
1342 * @return 指輪枠ならばTRUEを返す。
1344 static bool is_ring_slot(int i)
1346 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1351 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1352 * Convert a label into the index of a item in the "equip"
1353 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1355 INVENTORY_IDX label_to_equip(int c)
1360 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1362 /* Verify the index */
1363 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1365 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1367 /* Empty slots can never be chosen */
1368 if (!inventory[i].k_idx) return (-1);
1370 /* Return the index */
1377 * @brief オブジェクトの該当装備部位IDを返す /
1378 * Determine which equipment slot (if any) an item likes
1379 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1380 * @return 対応する装備部位ID
1382 s16b wield_slot(object_type *o_ptr)
1384 /* Slot for equipment */
1385 switch (o_ptr->tval)
1392 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1393 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1394 return (INVEN_LARM);
1401 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1402 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1403 return (INVEN_RARM);
1413 /* Use the right hand first */
1414 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1416 /* Use the left hand for swapping (by default) */
1417 return (INVEN_LEFT);
1423 return (INVEN_NECK);
1428 return (INVEN_LITE);
1435 return (INVEN_BODY);
1440 return (INVEN_OUTER);
1446 return (INVEN_HEAD);
1451 return (INVEN_HANDS);
1456 return (INVEN_FEET);
1460 /* No slot available */
1465 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1466 * Return a string mentioning how a given item is carried
1467 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1468 * @return 部位表現の文字列ポインタ
1470 concptr mention_use(int i)
1474 /* Examine the location */
1478 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1480 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1484 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1486 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1489 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1490 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1491 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1492 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1493 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1494 case INVEN_BODY: p = _(" 体", "On body"); break;
1495 case INVEN_OUTER: p = _("体の上", "About body"); break;
1496 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1497 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1498 case INVEN_FEET: p = _(" 足", "On feet"); break;
1499 default: p = _("ザック", "In pack"); break;
1502 /* Return the result */
1508 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1509 * Return a string describing how a given item is being worn.
1510 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1511 * @return 状態表現内容の文字列ポインタ
1513 * Currently, only used for items in the equipment, not inventory.
1515 concptr describe_use(int i)
1522 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1524 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1528 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1530 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1533 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1534 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1535 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1536 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1537 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1538 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1539 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1540 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1541 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1542 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1543 default: p = _("ザックに入っている", "carrying in your pack"); break;
1546 /* Return the result */
1552 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1553 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1554 * @param book_tval ベースアイテムのtval
1555 * @param book_sval ベースアイテムのsval
1556 * @return 使用可能な魔法書ならばTRUEを返す。
1559 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1561 if (book_tval < TV_LIFE_BOOK) return FALSE;
1562 if (p_ptr->pclass == CLASS_SORCERER)
1564 return is_magic(tval2realm(book_tval));
1566 else if (p_ptr->pclass == CLASS_RED_MAGE)
1568 if (is_magic(tval2realm(book_tval)))
1569 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1571 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1575 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1576 * Check an item against the item tester info
1577 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1578 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1580 bool item_tester_okay(object_type *o_ptr)
1582 /* Hack -- allow listing empty slots */
1583 // if (item_tester_full) return (TRUE); // TODO:DELETE
1585 /* Require an item */
1586 if (!o_ptr->k_idx) return (FALSE);
1588 /* Hack -- ignore "gold" */
1589 if (o_ptr->tval == TV_GOLD)
1592 extern bool show_gold_on_floor;
1594 if (!show_gold_on_floor) return (FALSE);
1597 /* Check the tval */
1598 if (item_tester_tval)
1600 /* Is it a spellbook? If so, we need a hack -- TY */
1601 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1602 (item_tester_tval >= TV_LIFE_BOOK))
1603 return check_book_realm(o_ptr->tval, o_ptr->sval);
1605 if (item_tester_tval != o_ptr->tval) return (FALSE);
1608 /* Check the hook */
1609 if (item_tester_hook)
1611 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1620 * @brief 所持アイテム一覧を表示する /
1621 * Choice window "shadow" of the "show_inven()" function
1624 void display_inven(void)
1626 register int i, n, z = 0;
1628 TERM_COLOR attr = TERM_WHITE;
1630 GAME_TEXT o_name[MAX_NLEN];
1633 Term_get_size(&wid, &hgt);
1635 /* Find the "final" slot */
1636 for (i = 0; i < INVEN_PACK; i++)
1638 o_ptr = &inventory[i];
1640 /* Skip non-objects */
1641 if (!o_ptr->k_idx) continue;
1647 /* Display the pack */
1648 for (i = 0; i < z; i++)
1650 /* Examine the item */
1651 o_ptr = &inventory[i];
1653 /* Start with an empty "index" */
1654 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1656 /* Is this item "acceptable"? */
1657 if (item_tester_okay(o_ptr))
1659 /* Prepare an "index" */
1660 tmp_val[0] = index_to_label(i);
1662 /* Bracket the "index" --(-- */
1666 /* Display the index (or blank space) */
1667 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1669 /* Obtain an item description */
1670 object_desc(o_name, o_ptr, 0);
1672 /* Obtain the length of the description */
1676 attr = tval_to_attr[o_ptr->tval % 128];
1678 /* Grey out charging items */
1684 /* Display the entry itself */
1685 Term_putstr(3, i, n, attr, o_name);
1687 /* Erase the rest of the line */
1688 Term_erase(3+n, i, 255);
1690 /* Display the weight if needed */
1693 int wgt = o_ptr->weight * o_ptr->number;
1695 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1697 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1700 prt(tmp_val, i, wid - 9);
1704 /* Erase the rest of the window */
1705 for (i = z; i < hgt; i++)
1707 /* Erase the line */
1708 Term_erase(0, i, 255);
1715 * @brief 装備アイテム一覧を表示する /
1716 * Choice window "shadow" of the "show_equip()" function
1719 void display_equip(void)
1723 TERM_COLOR attr = TERM_WHITE;
1725 GAME_TEXT o_name[MAX_NLEN];
1728 Term_get_size(&wid, &hgt);
1730 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1732 /* Examine the item */
1733 o_ptr = &inventory[i];
1735 /* Start with an empty "index" */
1736 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1738 /* Is this item "acceptable"? */
1739 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1741 /* Prepare an "index" */
1742 tmp_val[0] = index_to_label(i);
1744 /* Bracket the "index" --(-- */
1748 /* Display the index (or blank space) */
1749 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1751 /* Obtain an item description */
1752 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1754 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1759 object_desc(o_name, o_ptr, 0);
1760 attr = tval_to_attr[o_ptr->tval % 128];
1763 /* Obtain the length of the description */
1766 /* Grey out charging items */
1772 /* Display the entry itself */
1773 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1775 /* Erase the rest of the line */
1776 Term_erase(3+n, i - INVEN_RARM, 255);
1778 /* Display the weight (if needed) */
1781 int wgt = o_ptr->weight * o_ptr->number;
1783 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1785 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1788 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1791 /* Display the slot description (if needed) */
1794 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1795 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1799 /* Erase the rest of the window */
1800 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1802 /* Clear that line */
1803 Term_erase(0, i, 255);
1809 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1810 * Find the "first" inventory object with the given "tag".
1811 * @param cp 対応するタグIDを与える参照ポインタ
1812 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1813 * @param mode 所持、装備の切り替え
1814 * @return タグに該当するオブジェクトがあるならTRUEを返す
1816 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1817 * inscription of an object. Alphabetical characters don't work as a\n
1818 * tag in this form.\n
1820 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1821 * and "x" is the "current" command_cmd code.\n
1823 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1826 COMMAND_CODE start, end;
1829 /* Extract index from mode */
1834 end = INVEN_TOTAL - 1;
1839 end = INVEN_PACK - 1;
1846 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1848 /* Check every inventory object */
1849 for (i = start; i <= end; i++)
1851 object_type *o_ptr = &inventory[i];
1853 /* Skip non-objects */
1854 if (!o_ptr->k_idx) continue;
1856 /* Skip empty inscriptions */
1857 if (!o_ptr->inscription) continue;
1859 /* Skip non-choice */
1860 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1863 s = my_strchr(quark_str(o_ptr->inscription), '@');
1865 /* Process all tags */
1868 /* Check the special tags */
1869 if ((s[1] == command_cmd) && (s[2] == tag))
1871 /* Save the actual inventory ID */
1878 /* Find another '@' */
1879 s = my_strchr(s + 1, '@');
1884 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1886 /* Don't allow {@#} with '#' being alphabet */
1887 if (tag < '0' || '9' < tag)
1893 /* Check every object */
1894 for (i = start; i <= end; i++)
1896 object_type *o_ptr = &inventory[i];
1898 /* Skip non-objects */
1899 if (!o_ptr->k_idx) continue;
1901 /* Skip empty inscriptions */
1902 if (!o_ptr->inscription) continue;
1904 /* Skip non-choice */
1905 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1908 s = my_strchr(quark_str(o_ptr->inscription), '@');
1910 /* Process all tags */
1913 /* Check the normal tags */
1916 /* Save the actual inventory ID */
1923 /* Find another '@' */
1924 s = my_strchr(s + 1, '@');
1934 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1935 * Find the "first" inventory object with the given "tag".
1936 * @param cp 対応するタグIDを与える参照ポインタ
1937 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1938 * @param floor_list 床上アイテムの配列
1939 * @param floor_num 床上アイテムの配列ID
1940 * @return タグに該当するオブジェクトがあるならTRUEを返す
1942 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1943 * inscription of an object. Alphabetical characters don't work as a\n
1944 * tag in this form.\n
1946 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1947 * and "x" is the "current" command_cmd code.\n
1949 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1954 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1956 /* Check every object in the grid */
1957 for (i = 0; i < floor_num && i < 23; i++)
1959 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1961 /* Skip empty inscriptions */
1962 if (!o_ptr->inscription) continue;
1965 s = my_strchr(quark_str(o_ptr->inscription), '@');
1967 /* Process all tags */
1970 /* Check the special tags */
1971 if ((s[1] == command_cmd) && (s[2] == tag))
1973 /* Save the actual floor object ID */
1980 /* Find another '@' */
1981 s = my_strchr(s + 1, '@');
1986 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1988 /* Don't allow {@#} with '#' being alphabet */
1989 if (tag < '0' || '9' < tag)
1995 /* Check every object in the grid */
1996 for (i = 0; i < floor_num && i < 23; i++)
1998 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
2000 /* Skip empty inscriptions */
2001 if (!o_ptr->inscription) continue;
2004 s = my_strchr(quark_str(o_ptr->inscription), '@');
2006 /* Process all tags */
2009 /* Check the normal tags */
2012 /* Save the floor object ID */
2019 /* Find another '@' */
2020 s = my_strchr(s + 1, '@');
2030 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2031 * Move around label characters with correspond tags
2032 * @param label ラベルリストを取得する文字列参照ポインタ
2033 * @param mode 所持品リストか装備品リストかの切り替え
2036 static void prepare_label_string(char *label, BIT_FLAGS mode)
2038 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2039 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2042 /* Prepare normal labels */
2043 strcpy(label, alphabet_chars);
2045 /* Move each label */
2046 for (i = 0; i < 52; i++)
2049 SYMBOL_CODE c = alphabet_chars[i];
2051 /* Find a tag with this label */
2052 if (get_tag(&index, c, mode))
2054 /* Delete the overwritten label */
2055 if (label[i] == c) label[i] = ' ';
2057 /* Move the label to the place of corresponding tag */
2058 label[index - offset] = c;
2065 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2066 * Move around label characters with correspond tags (floor version)
2067 * @param label ラベルリストを取得する文字列参照ポインタ
2068 * @param floor_list 床上アイテムの配列
2069 * @param floor_num 床上アイテムの配列ID
2074 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2076 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2079 /* Prepare normal labels */
2080 strcpy(label, alphabet_chars);
2082 /* Move each label */
2083 for (i = 0; i < 52; i++)
2086 SYMBOL_CODE c = alphabet_chars[i];
2088 /* Find a tag with this label */
2089 if (get_tag_floor(&index, c, floor_list, floor_num))
2091 /* Delete the overwritten label */
2092 if (label[i] == c) label[i] = ' ';
2094 /* Move the label to the place of corresponding tag */
2102 * @brief 所持アイテムの表示を行う /
2103 * Display the inventory.
2104 * @param target_item アイテムの選択処理を行うか否か。
2105 * @return 選択したアイテムのタグ
2107 * Hack -- do not display "trailing" empty slots
2109 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2113 int col, cur_col, len;
2115 GAME_TEXT o_name[MAX_NLEN];
2117 COMMAND_CODE out_index[23];
2118 TERM_COLOR out_color[23];
2119 char out_desc[23][MAX_NLEN];
2120 COMMAND_CODE target_item_label = 0;
2122 char inven_label[52 + 1];
2124 /* Starting column */
2127 Term_get_size(&wid, &hgt);
2129 /* Default "max-length" */
2130 len = wid - col - 1;
2133 /* Find the "final" slot */
2134 for (i = 0; i < INVEN_PACK; i++)
2136 o_ptr = &inventory[i];
2138 /* Skip non-objects */
2139 if (!o_ptr->k_idx) continue;
2145 prepare_label_string(inven_label, USE_INVEN);
2147 /* Display the inventory */
2148 for (k = 0, i = 0; i < z; i++)
2150 o_ptr = &inventory[i];
2152 /* Is this item acceptable? */
2153 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2155 object_desc(o_name, o_ptr, 0);
2157 /* Save the object index, color, and description */
2159 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2161 /* Grey out charging items */
2164 out_color[k] = TERM_L_DARK;
2167 (void)strcpy(out_desc[k], o_name);
2169 /* Find the predicted "line length" */
2170 l = strlen(out_desc[k]) + 5;
2172 /* Be sure to account for the weight */
2173 if (show_weights) l += 9;
2175 /* Account for icon if displayed */
2176 if (show_item_graph)
2179 if (use_bigtile) l++;
2182 /* Maintain the maximum length */
2183 if (l > len) len = l;
2185 /* Advance to next "line" */
2189 /* Find the column to start in */
2190 col = (len > wid - 4) ? 0 : (wid - len - 1);
2192 /* Output each entry */
2193 for (j = 0; j < k; j++)
2196 o_ptr = &inventory[i];
2198 /* Clear the line */
2199 prt("", j + 1, col ? col - 2 : col);
2201 if (use_menu && target_item)
2203 if (j == (target_item-1))
2205 strcpy(tmp_val, _("》", "> "));
2206 target_item_label = i;
2208 else strcpy(tmp_val, " ");
2210 else if (i <= INVEN_PACK)
2212 /* Prepare an index --(-- */
2213 sprintf(tmp_val, "%c)", inven_label[i]);
2217 /* Prepare an index --(-- */
2218 sprintf(tmp_val, "%c)", index_to_label(i));
2221 /* Clear the line with the (possibly indented) index */
2222 put_str(tmp_val, j + 1, col);
2226 /* Display graphics for object, if desired */
2227 if (show_item_graph)
2229 TERM_COLOR a = object_attr(o_ptr);
2230 SYMBOL_CODE c = object_char(o_ptr);
2231 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2232 if (use_bigtile) cur_col++;
2238 /* Display the entry itself */
2239 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2241 /* Display the weight if needed */
2244 int wgt = o_ptr->weight * o_ptr->number;
2246 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2248 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2251 prt(tmp_val, j + 1, wid - 9);
2255 /* Make a "shadow" below the list (only if needed) */
2256 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2258 /* Save the new column */
2261 return target_item_label;
2266 * @brief 装備アイテムの表示を行う /
2267 * Display the equipment.
2268 * @param target_item アイテムの選択処理を行うか否か。
2269 * @return 選択したアイテムのタグ
2271 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2275 int col, cur_col, len;
2278 GAME_TEXT o_name[MAX_NLEN];
2279 COMMAND_CODE out_index[23];
2280 TERM_COLOR out_color[23];
2281 char out_desc[23][MAX_NLEN];
2282 COMMAND_CODE target_item_label = 0;
2284 char equip_label[52 + 1];
2286 /* Starting column */
2289 Term_get_size(&wid, &hgt);
2291 /* Maximal length */
2292 len = wid - col - 1;
2295 /* Scan the equipment list */
2296 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2298 o_ptr = &inventory[i];
2300 /* Is this item acceptable? */
2301 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2302 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2303 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2305 object_desc(o_name, o_ptr, 0);
2307 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2309 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2310 out_color[k] = TERM_WHITE;
2314 (void)strcpy(out_desc[k], o_name);
2315 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2319 /* Grey out charging items */
2322 out_color[k] = TERM_L_DARK;
2325 /* Extract the maximal length (see below) */
2327 l = strlen(out_desc[k]) + (2 + 1);
2329 l = strlen(out_desc[k]) + (2 + 3);
2333 /* Increase length for labels (if needed) */
2335 if (show_labels) l += (7 + 2);
2337 if (show_labels) l += (14 + 2);
2341 /* Increase length for weight (if needed) */
2342 if (show_weights) l += 9;
2344 if (show_item_graph) l += 2;
2346 /* Maintain the max-length */
2347 if (l > len) len = l;
2349 /* Advance the entry */
2353 /* Hack -- Find a column to start in */
2355 col = (len > wid - 6) ? 0 : (wid - len - 1);
2357 col = (len > wid - 4) ? 0 : (wid - len - 1);
2360 prepare_label_string(equip_label, USE_EQUIP);
2362 /* Output each entry */
2363 for (j = 0; j < k; j++)
2366 o_ptr = &inventory[i];
2368 /* Clear the line */
2369 prt("", j + 1, col ? col - 2 : col);
2371 if (use_menu && target_item)
2373 if (j == (target_item-1))
2375 strcpy(tmp_val, _("》", "> "));
2376 target_item_label = i;
2378 else strcpy(tmp_val, " ");
2380 else if (i >= INVEN_RARM)
2382 /* Prepare an index --(-- */
2383 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2387 /* Prepare an index --(-- */
2388 sprintf(tmp_val, "%c)", index_to_label(i));
2391 /* Clear the line with the (possibly indented) index */
2392 put_str(tmp_val, j+1, col);
2396 /* Display graphics for object, if desired */
2397 if (show_item_graph)
2399 TERM_COLOR a = object_attr(o_ptr);
2400 SYMBOL_CODE c = object_char(o_ptr);
2401 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2402 if (use_bigtile) cur_col++;
2410 /* Mention the use */
2411 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2413 put_str(tmp_val, j+1, cur_col);
2415 /* Display the entry itself */
2416 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2422 /* Display the entry itself */
2423 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2426 /* Display the weight if needed */
2429 int wgt = o_ptr->weight * o_ptr->number;
2431 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2433 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2436 prt(tmp_val, j + 1, wid - 9);
2440 /* Make a "shadow" below the list (only if needed) */
2441 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2443 /* Save the new column */
2446 return target_item_label;
2450 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2451 * Flip "inven" and "equip" in any sub-windows
2454 void toggle_inven_equip(void)
2459 for (j = 0; j < 8; j++)
2462 if (!angband_term[j]) continue;
2464 /* Flip inven to equip */
2465 if (window_flag[j] & (PW_INVEN))
2468 window_flag[j] &= ~(PW_INVEN);
2469 window_flag[j] |= (PW_EQUIP);
2471 p_ptr->window |= (PW_EQUIP);
2474 /* Flip inven to equip */
2475 else if (window_flag[j] & (PW_EQUIP))
2478 window_flag[j] &= ~(PW_EQUIP);
2479 window_flag[j] |= (PW_INVEN);
2481 p_ptr->window |= (PW_INVEN);
2487 * @brief 選択したアイテムの確認処理の補助 /
2488 * Verify the choice of an item.
2489 * @param prompt メッセージ表示の一部
2490 * @param item 選択アイテムID
2491 * @return 確認がYesならTRUEを返す。
2492 * @details The item can be negative to mean "item on floor".
2494 static bool verify(concptr prompt, INVENTORY_IDX item)
2496 GAME_TEXT o_name[MAX_NLEN];
2497 char out_val[MAX_NLEN+20];
2504 o_ptr = &inventory[item];
2510 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2512 object_desc(o_name, o_ptr, 0);
2515 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2518 return (get_check(out_val));
2523 * @brief 選択したアイテムの確認処理のメインルーチン /
2524 * @param item 選択アイテムID
2525 * @return 確認がYesならTRUEを返す。
2526 * @details The item can be negative to mean "item on floor".
2527 * Hack -- allow user to "prevent" certain choices
2529 static bool get_item_allow(INVENTORY_IDX item)
2533 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2538 o_ptr = &inventory[item];
2544 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2547 /* No inscription */
2548 if (!o_ptr->inscription) return (TRUE);
2551 s = my_strchr(quark_str(o_ptr->inscription), '!');
2553 /* Process preventions */
2556 /* Check the "restriction" */
2557 if ((s[1] == command_cmd) || (s[1] == '*'))
2559 /* Verify the choice */
2560 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2563 /* Find another '!' */
2564 s = my_strchr(s + 1, '!');
2573 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2574 * Auxiliary function for "get_item()" -- test an index
2576 * @return 正規のIDならばTRUEを返す。
2578 static bool get_item_okay(OBJECT_IDX i)
2581 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2583 if (select_ring_slot) return is_ring_slot(i);
2585 /* Verify the item */
2586 if (!item_tester_okay(&inventory[i])) return (FALSE);
2593 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2594 * Determine whether get_item() can get some item or not
2595 * @return アイテムを拾えるならばTRUEを返す。
2596 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2598 bool can_get_item(void)
2601 OBJECT_IDX floor_list[23];
2602 ITEM_NUMBER floor_num = 0;
2604 for (j = 0; j < INVEN_TOTAL; j++)
2605 if (item_tester_okay(&inventory[j]))
2608 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2616 * @brief オブジェクト選択の汎用関数 /
2617 * Let the user select an item, save its "index"
2618 * @param cp 選択したオブジェクトのIDを返す。
2619 * @param pmt 選択目的のメッセージ
2620 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2621 * @param mode オプションフラグ
2622 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2623 * Return TRUE only if an acceptable item was chosen by the user.\n
2625 * The selected item must satisfy the "item_tester_hook()" function,\n
2626 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2628 * All "item_tester" restrictions are cleared before this function returns.\n
2630 * The user is allowed to choose acceptable items from the equipment,\n
2631 * inventory, or floor, respectively, if the proper flag was given,\n
2632 * and there are any acceptable items in that location.\n
2634 * The equipment or inventory are displayed (even if no acceptable\n
2635 * items are in that location) if the proper flag was given.\n
2637 * If there are no acceptable items available anywhere, and "str" is\n
2638 * not NULL, then it will be used as the text of a warning message\n
2639 * before the function returns.\n
2641 * Note that the user must press "-" to specify the item on the floor,\n
2642 * and there is no way to "examine" the item on the floor, while the\n
2643 * use of "capital" letters will "examine" an inventory/equipment item,\n
2644 * and prompt for its use.\n
2646 * If a legal item is selected from the inventory, we save it in "cp"\n
2647 * directly (0 to 35), and return TRUE.\n
2649 * If a legal item is selected from the floor, we save it in "cp" as\n
2650 * a negative (-1 to -511), and return TRUE.\n
2652 * If no item is available, we do nothing to "cp", and we display a\n
2653 * warning message, using "str" if available, and return FALSE.\n
2655 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2657 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2658 * to allow the user to enter a command while viewing those screens, and\n
2659 * also to induce "auto-enter" of stores, and other such stuff.\n
2661 * Global "p_ptr->command_see" may be set before calling this function to start\n
2662 * out in "browse" mode. It is cleared before this function returns.\n
2664 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2665 * If it is TRUE then we are viewing inventory, else equipment.\n
2667 * We always erase the prompt when we are done, leaving a blank line,\n
2668 * or a warning message, if appropriate, if no items are available.\n
2670 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2672 OBJECT_IDX this_o_idx, next_o_idx = 0;
2689 bool allow_floor = FALSE;
2691 bool toggle = FALSE;
2696 int menu_line = (use_menu ? 1 : 0);
2700 static char prev_tag = '\0';
2701 char cur_tag = '\0';
2703 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2706 if (mode & USE_EQUIP) equip = TRUE;
2707 if (mode & USE_INVEN) inven = TRUE;
2708 if (mode & USE_FLOOR) floor = TRUE;
2710 /* Get the item index */
2711 if (repeat_pull(cp))
2714 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2716 item_tester_tval = 0;
2717 item_tester_hook = NULL;
2718 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2723 else if (floor && (*cp < 0))
2729 o_ptr = ¤t_floor_ptr->o_list[k];
2731 /* Validate the item */
2732 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2734 /* Forget restrictions */
2735 item_tester_tval = 0;
2736 item_tester_hook = NULL;
2737 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2744 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2745 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2747 if (prev_tag && command_cmd)
2749 /* Look up the tag and validate the item */
2750 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2751 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2752 else if (!get_item_okay(k)) /* Reject */;
2755 /* Accept that choice */
2758 /* Forget restrictions */
2759 item_tester_tval = 0;
2760 item_tester_hook = NULL;
2761 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2767 prev_tag = '\0'; /* prev_tag is no longer effective */
2770 /* Verify the item */
2771 else if (get_item_okay(*cp))
2773 /* Forget restrictions */
2774 item_tester_tval = 0;
2775 item_tester_hook = NULL;
2776 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2788 /* No item selected */
2792 /* Full inventory */
2794 i2 = INVEN_PACK - 1;
2796 /* Forbid inventory */
2797 if (!inven) i2 = -1;
2800 for (j = 0; j < INVEN_PACK; j++)
2801 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
2804 /* Restrict inventory indexes */
2805 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2806 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2809 /* Full equipment */
2811 e2 = INVEN_TOTAL - 1;
2813 /* Forbid equipment */
2814 if (!equip) e2 = -1;
2817 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2818 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
2819 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2822 /* Restrict equipment indexes */
2823 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2824 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2826 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2830 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2832 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2836 /* Restrict floor usage */
2839 /* Scan all objects in the grid */
2840 for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2843 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
2844 next_o_idx = o_ptr->next_o_idx;
2846 /* Accept the item on the floor if legal */
2847 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2851 /* Require at least one legal choice */
2852 if (!allow_floor && (i1 > i2) && (e1 > e2))
2854 /* Cancel p_ptr->command_see */
2855 command_see = FALSE;
2859 if (mode & USE_FORCE) {
2865 /* Analyze choices */
2868 /* Hack -- Start on equipment if requested */
2869 if (command_see && command_wrk && equip)
2874 /* Use inventory if allowed */
2877 command_wrk = FALSE;
2880 /* Use equipment if allowed */
2886 /* Use inventory for floor */
2889 command_wrk = FALSE;
2895 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2897 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2899 /* Hack -- start out in "display" mode */
2906 /* Repeat until done */
2909 COMMAND_CODE get_item_label = 0;
2916 for (j = 0; j < 8; j++)
2919 if (!angband_term[j]) continue;
2921 /* Count windows displaying inven */
2922 if (window_flag[j] & (PW_INVEN)) ni++;
2924 /* Count windows displaying equip */
2925 if (window_flag[j] & (PW_EQUIP)) ne++;
2928 /* Toggle if needed */
2929 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2932 toggle_inven_equip();
2938 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2941 /* Inventory screen */
2944 /* Redraw if needed */
2945 if (command_see) get_item_label = show_inven(menu_line, mode);
2948 /* Equipment screen */
2951 /* Redraw if needed */
2952 if (command_see) get_item_label = show_equip(menu_line, mode);
2955 /* Viewing inventory */
2958 /* Begin the prompt */
2959 sprintf(out_val, _("持ち物:", "Inven:"));
2961 /* Some legal items */
2962 if ((i1 <= i2) && !use_menu)
2964 /* Build the prompt */
2965 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2966 index_to_label(i1), index_to_label(i2));
2969 strcat(out_val, tmp_val);
2972 /* Indicate ability to "view" */
2973 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2976 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2979 /* Viewing equipment */
2982 /* Begin the prompt */
2983 sprintf(out_val, _("装備品:", "Equip:"));
2985 /* Some legal items */
2986 if ((e1 <= e2) && !use_menu)
2988 /* Build the prompt */
2989 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2990 index_to_label(e1), index_to_label(e2));
2993 strcat(out_val, tmp_val);
2996 /* Indicate ability to "view" */
2997 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3000 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
3003 /* Indicate legality of the "floor" item */
3004 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3005 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3007 /* Finish the prompt */
3008 strcat(out_val, " ESC");
3010 /* Build the prompt */
3011 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3013 /* Show the prompt */
3021 int max_line = (command_wrk ? max_equip : max_inven);
3037 menu_line += (max_line - 1);
3056 /* Verify legality */
3057 if (!inven || !equip)
3063 /* Hack -- Fix screen */
3070 /* Switch inven/equip */
3071 command_wrk = !command_wrk;
3072 max_line = (command_wrk ? max_equip : max_inven);
3073 if (menu_line > max_line) menu_line = max_line;
3075 /* Need to redraw */
3084 if (command_wrk == USE_FLOOR)
3087 (*cp) = -get_item_label;
3091 /* Validate the item */
3092 if (!get_item_okay(get_item_label))
3098 /* Allow player to "refuse" certain actions */
3099 if (!get_item_allow(get_item_label))
3105 /* Accept that choice */
3106 (*cp) = get_item_label;
3115 if (mode & USE_FORCE) {
3123 if (menu_line > max_line) menu_line -= max_line;
3144 command_see = FALSE;
3161 /* Verify legality */
3162 if (!inven || !equip)
3168 /* Hack -- Fix screen */
3175 /* Switch inven/equip */
3176 command_wrk = !command_wrk;
3178 /* Need to redraw */
3184 /* Use floor item */
3187 /* Scan all objects in the grid */
3188 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)
3191 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3192 next_o_idx = o_ptr->next_o_idx;
3194 /* Validate the item */
3195 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3200 /* Verify the item (if required) */
3201 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3203 /* Allow player to "refuse" certain actions */
3204 if (!get_item_allow(k)) continue;
3206 /* Accept that choice */
3222 case '1': case '2': case '3':
3223 case '4': case '5': case '6':
3224 case '7': case '8': case '9':
3226 /* Look up the tag */
3227 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3233 /* Hack -- Validate the item */
3234 if ((k < INVEN_RARM) ? !inven : !equip)
3240 /* Validate the item */
3241 if (!get_item_okay(k))
3247 /* Allow player to "refuse" certain actions */
3248 if (!get_item_allow(k))
3254 /* Accept that choice */
3266 /* Choose "default" inventory item */
3269 k = ((i1 == i2) ? i1 : -1);
3272 /* Choose "default" equipment item */
3275 k = ((e1 == e2) ? e1 : -1);
3278 /* Validate the item */
3279 if (!get_item_okay(k))
3285 /* Allow player to "refuse" certain actions */
3286 if (!get_item_allow(k))
3292 /* Accept that choice */
3302 if (mode & USE_FORCE) {
3315 bool not_found = FALSE;
3317 /* Look up the alphabetical tag */
3318 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3323 /* Hack -- Validate the item */
3324 else if ((k < INVEN_RARM) ? !inven : !equip)
3329 /* Validate the item */
3330 else if (!get_item_okay(k))
3337 /* Accept that choice */
3345 /* Extract "query" setting */
3346 ver = isupper(which);
3347 which = (char)tolower(which);
3349 /* Convert letter to inventory index */
3352 if (which == '(') k = i1;
3353 else if (which == ')') k = i2;
3354 else k = label_to_inven(which);
3357 /* Convert letter to equipment index */
3360 if (which == '(') k = e1;
3361 else if (which == ')') k = e2;
3362 else k = label_to_equip(which);
3365 /* Validate the item */
3366 if (!get_item_okay(k))
3372 /* Verify the item */
3373 if (ver && !verify(_("本当に", "Try"), k))
3379 /* Allow player to "refuse" certain actions */
3380 if (!get_item_allow(k))
3386 /* Accept that choice */
3397 /* Fix the screen if necessary */
3402 /* Hack -- Cancel "display" */
3403 command_see = FALSE;
3407 /* Forget the item_tester_tval restriction */
3408 item_tester_tval = 0;
3410 /* Forget the item_tester_hook restriction */
3411 item_tester_hook = NULL;
3414 /* Clean up 'show choices' */
3415 /* Toggle again if needed */
3416 if (toggle) toggle_inven_equip();
3418 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3421 /* Clear the prompt line */
3424 /* Warning if needed */
3425 if (oops && str) msg_print(str);
3430 if (command_cmd) prev_tag = cur_tag;
3431 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3437 * Choose an item and get auto-picker entry from it.
3439 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3442 if (!get_item(&item, q, s, option)) return NULL;
3443 if (idx) *idx = item;
3445 if (item == INVEN_FORCE) return NULL;
3447 /* Get the item (in the pack) */
3448 else if (item >= 0) return &inventory[item];
3450 /* Get the item (on the floor) */
3451 else return ¤t_floor_ptr->o_list[0 - item];
3456 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3457 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3458 * @param y 走査するフロアのY座標
3459 * @param x 走査するフロアのX座標
3460 * @param mode オプションフラグ
3461 * @return 対象のマスに落ちているアイテム数
3463 * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
3464 * location. Valid flags are:
3466 * mode & 0x01 -- Item tester
3467 * mode & 0x02 -- Marked items only
3468 * mode & 0x04 -- Stop after first
3470 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3472 OBJECT_IDX this_o_idx, next_o_idx;
3474 ITEM_NUMBER num = 0;
3477 if (!in_bounds(y, x)) return 0;
3479 /* Scan all objects in the grid */
3480 for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3483 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3484 next_o_idx = o_ptr->next_o_idx;
3487 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3490 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3492 /* Accept this item */
3493 /* XXX Hack -- Enforce limit */
3495 items[num] = this_o_idx;
3500 if (mode & 0x04) break;
3507 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3508 * @param target_item カーソルの初期値
3509 * @param y 走査するフロアのY座標
3510 * @param x 走査するフロアのX座標
3511 * @param min_width 表示の長さ
3512 * @return 選択したアイテムの添え字
3515 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3523 GAME_TEXT o_name[MAX_NLEN];
3526 COMMAND_CODE out_index[23];
3527 TERM_COLOR out_color[23];
3528 char out_desc[23][MAX_NLEN];
3529 COMMAND_CODE target_item_label = 0;
3531 OBJECT_IDX floor_list[23];
3532 ITEM_NUMBER floor_num;
3534 char floor_label[52 + 1];
3536 bool dont_need_to_show_weights = TRUE;
3538 Term_get_size(&wid, &hgt);
3540 /* Default length */
3541 len = MAX((*min_width), 20);
3543 /* Scan for objects in the grid, using item_tester_okay() */
3544 floor_num = scan_floor(floor_list, y, x, 0x03);
3546 /* Display the floor objects */
3547 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3549 o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
3551 object_desc(o_name, o_ptr, 0);
3553 /* Save the index */
3556 /* Acquire inventory color */
3557 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3559 /* Save the object description */
3560 strcpy(out_desc[k], o_name);
3562 /* Find the predicted "line length" */
3563 l = strlen(out_desc[k]) + 5;
3565 /* Be sure to account for the weight */
3566 if (show_weights) l += 9;
3568 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3570 /* Maintain the maximum length */
3571 if (l > len) len = l;
3573 /* Advance to next "line" */
3577 if (show_weights && dont_need_to_show_weights) len -= 9;
3582 /* Find the column to start in */
3583 col = (len > wid - 4) ? 0 : (wid - len - 1);
3585 prepare_label_string_floor(floor_label, floor_list, floor_num);
3587 /* Output each entry */
3588 for (j = 0; j < k; j++)
3590 m = floor_list[out_index[j]];
3591 o_ptr = ¤t_floor_ptr->o_list[m];
3593 /* Clear the line */
3594 prt("", j + 1, col ? col - 2 : col);
3596 if (use_menu && target_item)
3598 if (j == (target_item-1))
3600 strcpy(tmp_val, _("》", "> "));
3601 target_item_label = m;
3603 else strcpy(tmp_val, " ");
3607 /* Prepare an index --(-- */
3608 sprintf(tmp_val, "%c)", floor_label[j]);
3611 /* Clear the line with the (possibly indented) index */
3612 put_str(tmp_val, j + 1, col);
3614 /* Display the entry itself */
3615 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3617 /* Display the weight if needed */
3618 if (show_weights && (o_ptr->tval != TV_GOLD))
3620 int wgt = o_ptr->weight * o_ptr->number;
3622 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3624 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3627 prt(tmp_val, j + 1, wid - 9);
3631 /* Make a "shadow" below the list (only if needed) */
3632 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3634 return target_item_label;
3638 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3639 * Let the user select an item, save its "index"
3640 * @param cp 選択したオブジェクトのIDを返す。
3641 * @param pmt 選択目的のメッセージ
3642 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3643 * @param mode オプションフラグ
3644 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3646 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3648 char n1 = ' ', n2 = ' ', which = ' ';
3651 COMMAND_CODE i1, i2;
3652 COMMAND_CODE e1, e2;
3660 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3661 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3662 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3663 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3665 bool allow_equip = FALSE;
3666 bool allow_inven = FALSE;
3667 bool allow_floor = FALSE;
3669 bool toggle = FALSE;
3674 ITEM_NUMBER floor_num;
3675 OBJECT_IDX floor_list[23];
3677 TERM_LEN min_width = 0;
3679 int menu_line = (use_menu ? 1 : 0);
3683 static char prev_tag = '\0';
3684 char cur_tag = '\0';
3686 /* Get the item index */
3687 if (repeat_pull(cp))
3690 if (force && (*cp == INVEN_FORCE))
3692 item_tester_tval = 0;
3693 item_tester_hook = NULL;
3694 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3699 else if (floor && (*cp < 0))
3701 if (prev_tag && command_cmd)
3703 /* Scan all objects in the grid */
3704 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3706 /* Look up the tag */
3707 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3709 /* Accept that choice */
3710 (*cp) = 0 - floor_list[k];
3712 /* Forget restrictions */
3713 item_tester_tval = 0;
3714 item_tester_hook = NULL;
3715 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3721 prev_tag = '\0'; /* prev_tag is no longer effective */
3724 /* Validate the item */
3725 else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
3727 /* Forget restrictions */
3728 item_tester_tval = 0;
3729 item_tester_hook = NULL;
3730 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3737 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3738 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3740 if (prev_tag && command_cmd)
3742 /* Look up the tag and validate the item */
3743 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3744 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3745 else if (!get_item_okay(k)) /* Reject */;
3748 /* Accept that choice */
3751 /* Forget restrictions */
3752 item_tester_tval = 0;
3753 item_tester_hook = NULL;
3754 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3760 prev_tag = '\0'; /* prev_tag is no longer effective */
3763 /* Verify the item */
3764 else if (get_item_okay(*cp))
3766 /* Forget restrictions */
3767 item_tester_tval = 0;
3768 item_tester_hook = NULL;
3769 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3783 /* No item selected */
3787 /* Full inventory */
3789 i2 = INVEN_PACK - 1;
3791 /* Forbid inventory */
3792 if (!inven) i2 = -1;
3795 for (j = 0; j < INVEN_PACK; j++)
3796 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
3799 /* Restrict inventory indexes */
3800 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3801 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3804 /* Full equipment */
3806 e2 = INVEN_TOTAL - 1;
3808 /* Forbid equipment */
3809 if (!equip) e2 = -1;
3812 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3813 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
3814 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3817 /* Restrict equipment indexes */
3818 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3819 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3821 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3825 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3827 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3831 /* Count "okay" floor items */
3834 /* Restrict floor usage */
3837 /* Scan all objects in the grid */
3838 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3841 /* Accept inventory */
3842 if (i1 <= i2) allow_inven = TRUE;
3844 /* Accept equipment */
3845 if (e1 <= e2) allow_equip = TRUE;
3848 if (floor_num) allow_floor = TRUE;
3850 /* Require at least one legal choice */
3851 if (!allow_inven && !allow_equip && !allow_floor)
3853 /* Cancel p_ptr->command_see */
3854 command_see = FALSE;
3864 /* Analyze choices */
3867 /* Hack -- Start on equipment if requested */
3868 if (command_see && (command_wrk == (USE_EQUIP))
3871 command_wrk = (USE_EQUIP);
3874 /* Use inventory if allowed */
3875 else if (allow_inven)
3877 command_wrk = (USE_INVEN);
3880 /* Use equipment if allowed */
3881 else if (allow_equip)
3883 command_wrk = (USE_EQUIP);
3886 /* Use floor if allowed */
3887 else if (allow_floor)
3889 command_wrk = (USE_FLOOR);
3894 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3896 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3898 /* Hack -- start out in "display" mode */
3904 /* Repeat until done */
3907 COMMAND_CODE get_item_label = 0;
3914 for (j = 0; j < 8; j++)
3917 if (!angband_term[j]) continue;
3919 /* Count windows displaying inven */
3920 if (window_flag[j] & (PW_INVEN)) ni++;
3922 /* Count windows displaying equip */
3923 if (window_flag[j] & (PW_EQUIP)) ne++;
3926 /* Toggle if needed */
3927 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3928 (command_wrk == (USE_INVEN) && !ni && ne))
3931 toggle_inven_equip();
3937 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3940 /* Inventory screen */
3941 if (command_wrk == (USE_INVEN))
3943 /* Extract the legal requests */
3947 /* Redraw if needed */
3948 if (command_see) get_item_label = show_inven(menu_line, mode);
3951 /* Equipment screen */
3952 else if (command_wrk == (USE_EQUIP))
3954 /* Extract the legal requests */
3955 n1 = I2A(e1 - INVEN_RARM);
3956 n2 = I2A(e2 - INVEN_RARM);
3958 /* Redraw if needed */
3959 if (command_see) get_item_label = show_equip(menu_line, mode);
3963 else if (command_wrk == (USE_FLOOR))
3966 k = MIN(floor_top + 23, floor_num) - 1;
3968 /* Extract the legal requests */
3969 n1 = I2A(j - floor_top);
3970 n2 = I2A(k - floor_top);
3972 /* Redraw if needed */
3973 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3976 /* Viewing inventory */
3977 if (command_wrk == (USE_INVEN))
3979 /* Begin the prompt */
3980 sprintf(out_val, _("持ち物:", "Inven:"));
3984 /* Build the prompt */
3985 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3986 index_to_label(i1), index_to_label(i2));
3989 strcat(out_val, tmp_val);
3992 /* Indicate ability to "view" */
3993 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3999 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
4000 else if (allow_floor)
4001 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
4003 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4010 strcat(out_val, _(" '-'床上,", " - for floor,"));
4011 else if (allow_equip)
4012 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
4014 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4018 /* Viewing equipment */
4019 else if (command_wrk == (USE_EQUIP))
4021 /* Begin the prompt */
4022 sprintf(out_val, _("装備品:", "Equip:"));
4026 /* Build the prompt */
4027 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4028 index_to_label(e1), index_to_label(e2));
4031 strcat(out_val, tmp_val);
4034 /* Indicate ability to "view" */
4035 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4041 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4042 else if (allow_floor)
4043 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
4045 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4052 strcat(out_val, _(" '-'床上,", " - for floor,"));
4053 else if (allow_inven)
4054 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4056 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4061 else if (command_wrk == (USE_FLOOR))
4063 /* Begin the prompt */
4064 sprintf(out_val, _("床上:", "Floor:"));
4068 /* Build the prompt */
4069 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4072 strcat(out_val, tmp_val);
4075 /* Indicate ability to "view" */
4076 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4080 if (allow_inven && allow_equip)
4082 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4084 else if (allow_inven)
4086 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4088 else if (allow_equip)
4090 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4094 else if (allow_inven)
4096 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4098 else if (allow_equip)
4100 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4104 if (command_see && !use_menu)
4106 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4111 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4113 /* Finish the prompt */
4114 strcat(out_val, " ESC");
4116 /* Build the prompt */
4117 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4119 /* Show the prompt */
4128 if (command_wrk == USE_INVEN) max_line = max_inven;
4129 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4130 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4146 menu_line += (max_line - 1);
4162 /* Verify legality */
4163 if (command_wrk == (USE_INVEN))
4165 if (allow_floor) command_wrk = USE_FLOOR;
4166 else if (allow_equip) command_wrk = USE_EQUIP;
4173 else if (command_wrk == (USE_EQUIP))
4175 if (allow_inven) command_wrk = USE_INVEN;
4176 else if (allow_floor) command_wrk = USE_FLOOR;
4183 else if (command_wrk == (USE_FLOOR))
4185 if (allow_equip) command_wrk = USE_EQUIP;
4186 else if (allow_inven) command_wrk = USE_INVEN;
4199 /* Hack -- Fix screen */
4206 /* Switch inven/equip */
4207 if (command_wrk == USE_INVEN) max_line = max_inven;
4208 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4209 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4210 if (menu_line > max_line) menu_line = max_line;
4212 /* Need to redraw */
4220 /* Verify legality */
4221 if (command_wrk == (USE_INVEN))
4223 if (allow_equip) command_wrk = USE_EQUIP;
4224 else if (allow_floor) command_wrk = USE_FLOOR;
4231 else if (command_wrk == (USE_EQUIP))
4233 if (allow_floor) command_wrk = USE_FLOOR;
4234 else if (allow_inven) command_wrk = USE_INVEN;
4241 else if (command_wrk == (USE_FLOOR))
4243 if (allow_inven) command_wrk = USE_INVEN;
4244 else if (allow_equip) command_wrk = USE_EQUIP;
4257 /* Hack -- Fix screen */
4264 /* Switch inven/equip */
4265 if (command_wrk == USE_INVEN) max_line = max_inven;
4266 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4267 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4268 if (menu_line > max_line) menu_line = max_line;
4270 /* Need to redraw */
4279 if (command_wrk == USE_FLOOR)
4282 (*cp) = -get_item_label;
4286 /* Validate the item */
4287 if (!get_item_okay(get_item_label))
4293 /* Allow player to "refuse" certain actions */
4294 if (!get_item_allow(get_item_label))
4300 /* Accept that choice */
4301 (*cp) = get_item_label;
4318 if (menu_line > max_line) menu_line -= max_line;
4339 command_see = FALSE;
4360 grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
4362 if (command_wrk != (USE_FLOOR)) break;
4364 /* Get the object being moved. */
4365 o_idx = g_ptr->o_idx;
4367 /* Only rotate a pile of two or more objects. */
4368 if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
4370 /* Remove the first object from the list. */
4371 excise_object_idx(o_idx);
4373 /* Find end of the list. */
4375 while (current_floor_ptr->o_list[i].next_o_idx)
4376 i = current_floor_ptr->o_list[i].next_o_idx;
4378 /* Add after the last object. */
4379 current_floor_ptr->o_list[i].next_o_idx = o_idx;
4381 /* Re-scan floor list */
4382 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4384 /* Hack -- Fix screen */
4396 if (command_wrk == (USE_INVEN))
4403 command_wrk = (USE_EQUIP);
4405 else if (command_wrk == (USE_EQUIP))
4412 command_wrk = (USE_INVEN);
4414 else if (command_wrk == (USE_FLOOR))
4418 command_wrk = (USE_INVEN);
4420 else if (allow_equip)
4422 command_wrk = (USE_EQUIP);
4431 /* Hack -- Fix screen */
4438 /* Need to redraw */
4451 * If we are already examining the floor, and there
4452 * is only one item, we will always select it.
4453 * If we aren't examining the floor and there is only
4454 * one item, we will select it if floor_query_flag
4459 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4462 k = 0 - floor_list[0];
4464 /* Allow player to "refuse" certain actions */
4465 if (!get_item_allow(k))
4471 /* Accept that choice */
4480 /* Hack -- Fix screen */
4487 command_wrk = (USE_FLOOR);
4493 case '1': case '2': case '3':
4494 case '4': case '5': case '6':
4495 case '7': case '8': case '9':
4497 if (command_wrk != USE_FLOOR)
4499 /* Look up the tag */
4500 if (!get_tag(&k, which, command_wrk))
4506 /* Hack -- Validate the item */
4507 if ((k < INVEN_RARM) ? !inven : !equip)
4513 /* Validate the item */
4514 if (!get_item_okay(k))
4522 /* Look up the alphabetical tag */
4523 if (get_tag_floor(&k, which, floor_list, floor_num))
4526 k = 0 - floor_list[k];
4535 /* Allow player to "refuse" certain actions */
4536 if (!get_item_allow(k))
4542 /* Accept that choice */
4554 /* Choose "default" inventory item */
4555 if (command_wrk == (USE_INVEN))
4557 k = ((i1 == i2) ? i1 : -1);
4560 /* Choose "default" equipment item */
4561 else if (command_wrk == (USE_EQUIP))
4563 k = ((e1 == e2) ? e1 : -1);
4566 /* Choose "default" floor item */
4567 else if (command_wrk == (USE_FLOOR))
4572 k = 0 - floor_list[0];
4574 /* Allow player to "refuse" certain actions */
4575 if (!get_item_allow(k))
4581 /* Accept that choice */
4589 /* Validate the item */
4590 if (!get_item_okay(k))
4596 /* Allow player to "refuse" certain actions */
4597 if (!get_item_allow(k))
4603 /* Accept that choice */
4627 if (command_wrk != USE_FLOOR)
4629 bool not_found = FALSE;
4631 /* Look up the alphabetical tag */
4632 if (!get_tag(&k, which, command_wrk))
4637 /* Hack -- Validate the item */
4638 else if ((k < INVEN_RARM) ? !inven : !equip)
4643 /* Validate the item */
4644 else if (!get_item_okay(k))
4651 /* Accept that choice */
4661 /* Look up the alphabetical tag */
4662 if (get_tag_floor(&k, which, floor_list, floor_num))
4665 k = 0 - floor_list[k];
4667 /* Accept that choice */
4676 /* Extract "query" setting */
4677 ver = isupper(which);
4678 which = (char)tolower(which);
4680 /* Convert letter to inventory index */
4681 if (command_wrk == (USE_INVEN))
4683 if (which == '(') k = i1;
4684 else if (which == ')') k = i2;
4685 else k = label_to_inven(which);
4688 /* Convert letter to equipment index */
4689 else if (command_wrk == (USE_EQUIP))
4691 if (which == '(') k = e1;
4692 else if (which == ')') k = e2;
4693 else k = label_to_equip(which);
4696 /* Convert letter to floor index */
4697 else if (command_wrk == USE_FLOOR)
4699 if (which == '(') k = 0;
4700 else if (which == ')') k = floor_num - 1;
4701 else k = islower(which) ? A2I(which) : -1;
4702 if (k < 0 || k >= floor_num || k >= 23)
4709 k = 0 - floor_list[k];
4712 /* Validate the item */
4713 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4719 /* Verify the item */
4720 if (ver && !verify(_("本当に", "Try"), k))
4726 /* Allow player to "refuse" certain actions */
4727 if (!get_item_allow(k))
4733 /* Accept that choice */
4743 /* Fix the screen if necessary */
4748 /* Hack -- Cancel "display" */
4749 command_see = FALSE;
4753 /* Forget the item_tester_tval restriction */
4754 item_tester_tval = 0;
4756 /* Forget the item_tester_hook restriction */
4757 item_tester_hook = NULL;
4760 /* Clean up 'show choices' */
4761 /* Toggle again if needed */
4762 if (toggle) toggle_inven_equip();
4764 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4767 /* Clear the prompt line */
4770 /* Warning if needed */
4771 if (oops && str) msg_print(str);
4776 if (command_cmd) prev_tag = cur_tag;
4777 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4783 * @brief 床上のアイテムを拾う選択用サブルーチン
4784 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4786 static bool py_pickup_floor_aux(void)
4788 OBJECT_IDX this_o_idx;
4792 /* Restrict the choices */
4793 item_tester_hook = inven_carry_okay;
4796 q = _("どれを拾いますか?", "Get which item? ");
4797 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4799 if (choose_object(&item, q, s, (USE_FLOOR)))
4801 this_o_idx = 0 - item;
4808 /* Pick up the object */
4809 py_pickup_aux(this_o_idx);
4815 * @brief 床上のアイテムを拾うメイン処理
4816 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4819 * This is called by py_pickup() when easy_floor is TRUE.
4821 void py_pickup_floor(bool pickup)
4823 OBJECT_IDX this_o_idx, next_o_idx = 0;
4825 GAME_TEXT o_name[MAX_NLEN];
4829 OBJECT_IDX floor_o_idx = 0;
4833 /* Scan the pile of objects */
4834 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)
4836 /* Access the object */
4837 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
4839 object_desc(o_name, o_ptr, 0);
4841 /* Access the next object */
4842 next_o_idx = o_ptr->next_o_idx;
4844 disturb(FALSE, FALSE);
4847 if (o_ptr->tval == TV_GOLD)
4850 msg_format(" $%ld の価値がある%sを見つけた。",
4851 (long)o_ptr->pval, o_name);
4853 msg_format("You have found %ld gold pieces worth of %s.",
4854 (long)o_ptr->pval, o_name);
4857 /* Collect the gold */
4858 p_ptr->au += o_ptr->pval;
4861 p_ptr->redraw |= (PR_GOLD);
4863 p_ptr->window |= (PW_PLAYER);
4865 /* Delete the gold */
4866 delete_object_idx(this_o_idx);
4868 /* Check the next object */
4871 else if (o_ptr->marked & OM_NOMSG)
4873 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4874 * ignored. Otherwise, they are included in the prompt. */
4875 o_ptr->marked &= ~(OM_NOMSG);
4879 /* Count non-gold objects that can be picked up. */
4880 if (inven_carry_okay(o_ptr))
4885 /* Count non-gold objects */
4888 /* Remember this index */
4889 floor_o_idx = this_o_idx;
4892 /* There are no non-gold objects */
4896 /* Mention the number of objects */
4902 /* Access the object */
4903 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4905 #ifdef ALLOW_EASY_SENSE
4907 /* Option: Make object sensing easy */
4910 /* Sense the object */
4911 (void) sense_object(o_ptr);
4914 #endif /* ALLOW_EASY_SENSE */
4916 object_desc(o_name, o_ptr, 0);
4918 msg_format(_("%sがある。", "You see %s."), o_name);
4921 /* Multiple objects */
4924 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4930 /* The player has no room for anything on the floor. */
4936 /* Access the object */
4937 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4939 #ifdef ALLOW_EASY_SENSE
4941 /* Option: Make object sensing easy */
4944 /* Sense the object */
4945 (void) sense_object(o_ptr);
4948 #endif /* ALLOW_EASY_SENSE */
4950 object_desc(o_name, o_ptr, 0);
4952 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4955 /* Multiple objects */
4958 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4968 /* Hack -- query every object */
4969 if (carry_query_flag)
4971 char out_val[MAX_NLEN+20];
4973 /* Access the object */
4974 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4976 #ifdef ALLOW_EASY_SENSE
4978 /* Option: Make object sensing easy */
4981 /* Sense the object */
4982 (void) sense_object(o_ptr);
4985 #endif /* ALLOW_EASY_SENSE */
4987 object_desc(o_name, o_ptr, 0);
4989 /* Build a prompt */
4990 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
4992 /* Ask the user to confirm */
4993 if (!get_check(out_val))
4999 /* Access the object */
5000 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
5002 #ifdef ALLOW_EASY_SENSE
5004 /* Option: Make object sensing easy */
5007 /* Sense the object */
5008 (void) sense_object(o_ptr);
5011 #endif /* ALLOW_EASY_SENSE */
5013 /* Pick up the object */
5014 py_pickup_aux(floor_o_idx);
5017 /* Allow the user to choose an object */
5020 while (can_pickup--)
5022 if (!py_pickup_floor_aux()) break;
5029 * @brief 矢弾を射撃した場合の破損確率を返す /
5030 * Determines the odds of an object breaking when thrown at a monster
5031 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
5034 * Note that artifacts never break, see the "drop_near()" function.
5036 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
5038 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
5040 /* Examine the snipe type */
5043 if (snipe_type == SP_KILL_WALL) return (100);
5044 if (snipe_type == SP_EXPLODE) return (100);
5045 if (snipe_type == SP_PIERCE) return (100);
5046 if (snipe_type == SP_FINAL) return (100);
5047 if (snipe_type == SP_NEEDLE) return (100);
5048 if (snipe_type == SP_EVILNESS) return (40);
5049 if (snipe_type == SP_HOLYNESS) return (40);
5052 /* Examine the item type */
5053 switch (o_ptr->tval)
5069 /* Sometimes break */
5074 return (20 - archer_bonus * 2);
5079 return (10 - archer_bonus);