3 * @brief オブジェクトの実装 / Object code, part 1
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2014 Deskull rearranged comment for Doxygen.\n
19 #include "cmd-activate.h"
20 #include "object-flavor.h"
21 #include "object-hook.h"
22 #include "player-move.h"
26 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
33 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
35 * This involves resetting various things to their "default" state.\n
37 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
38 * "user pref file" based on the current setting of the "use_graphics"\n
39 * flag. This is useful for switching "graphics" on/off.\n
41 * The features, objects, and monsters, should all be encoded in the\n
42 * relevant "font.pref" and/or "graf.prf" files. \n
44 * The "prefs" parameter is no longer meaningful. \n
46 void reset_visuals(void)
50 /* Extract some info about terrain features */
51 for (i = 0; i < max_f_idx; i++)
53 feature_type *f_ptr = &f_info[i];
55 /* Assume we will use the underlying values */
56 for (j = 0; j < F_LIT_MAX; j++)
58 f_ptr->x_attr[j] = f_ptr->d_attr[j];
59 f_ptr->x_char[j] = f_ptr->d_char[j];
63 /* Extract default attr/char code for objects */
64 for (i = 0; i < max_k_idx; i++)
66 object_kind *k_ptr = &k_info[i];
68 /* Default attr/char */
69 k_ptr->x_attr = k_ptr->d_attr;
70 k_ptr->x_char = k_ptr->d_char;
73 /* Extract default attr/char code for monsters */
74 for (i = 0; i < max_r_idx; i++)
76 monster_race *r_ptr = &r_info[i];
78 /* Default attr/char */
79 r_ptr->x_attr = r_ptr->d_attr;
80 r_ptr->x_char = r_ptr->d_char;
87 /* Process "graf.prf" */
88 process_pref_file("graf.prf");
90 /* Access the "character" pref file */
91 sprintf(buf, "graf-%s.prf", player_base);
93 /* Process "graf-<playername>.prf" */
94 process_pref_file(buf);
102 /* Process "font.prf" */
103 process_pref_file("font.prf");
105 /* Access the "character" pref file */
106 sprintf(buf, "font-%s.prf", player_base);
108 /* Process "font-<playername>.prf" */
109 process_pref_file(buf);
114 * @brief オブジェクトのフラグ類を配列に与える
115 * Obtain the "flags" for an item
116 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
117 * @param flgs フラグ情報を受け取る配列
120 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
122 object_kind *k_ptr = &k_info[o_ptr->k_idx];
126 for (i = 0; i < TR_FLAG_SIZE; i++)
127 flgs[i] = k_ptr->flags[i];
130 if (object_is_fixed_artifact(o_ptr))
132 artifact_type *a_ptr = &a_info[o_ptr->name1];
134 for (i = 0; i < TR_FLAG_SIZE; i++)
135 flgs[i] = a_ptr->flags[i];
139 if (object_is_ego(o_ptr))
141 ego_item_type *e_ptr = &e_info[o_ptr->name2];
143 for (i = 0; i < TR_FLAG_SIZE; i++)
144 flgs[i] |= e_ptr->flags[i];
146 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
148 remove_flag(flgs, TR_SH_FIRE);
150 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
152 remove_flag(flgs, TR_INFRA);
154 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
156 remove_flag(flgs, TR_RES_BLIND);
157 remove_flag(flgs, TR_SEE_INVIS);
161 /* Random artifact ! */
162 for (i = 0; i < TR_FLAG_SIZE; i++)
163 flgs[i] |= o_ptr->art_flags[i];
165 if (object_is_smith(o_ptr))
167 int add = o_ptr->xtra3 - 1;
169 if (add < TR_FLAG_MAX)
173 else if (add == ESSENCE_TMP_RES_ACID)
175 add_flag(flgs, TR_RES_ACID);
176 add_flag(flgs, TR_ACTIVATE);
178 else if (add == ESSENCE_TMP_RES_ELEC)
180 add_flag(flgs, TR_RES_ELEC);
181 add_flag(flgs, TR_ACTIVATE);
183 else if (add == ESSENCE_TMP_RES_FIRE)
185 add_flag(flgs, TR_RES_FIRE);
186 add_flag(flgs, TR_ACTIVATE);
188 else if (add == ESSENCE_TMP_RES_COLD)
190 add_flag(flgs, TR_RES_COLD);
191 add_flag(flgs, TR_ACTIVATE);
193 else if (add == ESSENCE_SH_FIRE)
195 add_flag(flgs, TR_RES_FIRE);
196 add_flag(flgs, TR_SH_FIRE);
198 else if (add == ESSENCE_SH_ELEC)
200 add_flag(flgs, TR_RES_ELEC);
201 add_flag(flgs, TR_SH_ELEC);
203 else if (add == ESSENCE_SH_COLD)
205 add_flag(flgs, TR_RES_COLD);
206 add_flag(flgs, TR_SH_COLD);
208 else if (add == ESSENCE_RESISTANCE)
210 add_flag(flgs, TR_RES_ACID);
211 add_flag(flgs, TR_RES_ELEC);
212 add_flag(flgs, TR_RES_FIRE);
213 add_flag(flgs, TR_RES_COLD);
215 else if (add == TR_IMPACT)
217 add_flag(flgs, TR_ACTIVATE);
223 * @brief オブジェクトの明示されているフラグ類を取得する
224 * Obtain the "flags" for an item which are known to the player
225 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
226 * @param flgs フラグ情報を受け取る配列
229 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
234 object_kind *k_ptr = &k_info[o_ptr->k_idx];
237 for (i = 0; i < TR_FLAG_SIZE; i++)
240 if (!object_is_aware(o_ptr)) return;
243 for (i = 0; i < TR_FLAG_SIZE; i++)
244 flgs[i] = k_ptr->flags[i];
246 /* Must be identified */
247 if (!object_is_known(o_ptr)) return;
249 /* Ego-item (known basic flags) */
250 if (object_is_ego(o_ptr))
252 ego_item_type *e_ptr = &e_info[o_ptr->name2];
254 for (i = 0; i < TR_FLAG_SIZE; i++)
255 flgs[i] |= e_ptr->flags[i];
257 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
259 remove_flag(flgs, TR_SH_FIRE);
261 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
263 remove_flag(flgs, TR_INFRA);
265 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
267 remove_flag(flgs, TR_RES_BLIND);
268 remove_flag(flgs, TR_SEE_INVIS);
273 #ifdef SPOIL_ARTIFACTS
274 /* Full knowledge for some artifacts */
275 if (object_is_artifact(o_ptr)) spoil = TRUE;
276 #endif /* SPOIL_ARTIFACTS */
278 #ifdef SPOIL_EGO_ITEMS
279 /* Full knowledge for some ego-items */
280 if (object_is_ego(o_ptr)) spoil = TRUE;
281 #endif /* SPOIL_EGO_ITEMS */
283 /* Need full knowledge or spoilers */
284 if (spoil || (o_ptr->ident & IDENT_MENTAL))
287 if (object_is_fixed_artifact(o_ptr))
289 artifact_type *a_ptr = &a_info[o_ptr->name1];
291 for (i = 0; i < TR_FLAG_SIZE; i++)
292 flgs[i] = a_ptr->flags[i];
295 /* Random artifact ! */
296 for (i = 0; i < TR_FLAG_SIZE; i++)
297 flgs[i] |= o_ptr->art_flags[i];
300 if (object_is_smith(o_ptr))
302 int add = o_ptr->xtra3 - 1;
304 if (add < TR_FLAG_MAX)
308 else if (add == ESSENCE_TMP_RES_ACID)
310 add_flag(flgs, TR_RES_ACID);
312 else if (add == ESSENCE_TMP_RES_ELEC)
314 add_flag(flgs, TR_RES_ELEC);
316 else if (add == ESSENCE_TMP_RES_FIRE)
318 add_flag(flgs, TR_RES_FIRE);
320 else if (add == ESSENCE_TMP_RES_COLD)
322 add_flag(flgs, TR_RES_COLD);
324 else if (add == ESSENCE_SH_FIRE)
326 add_flag(flgs, TR_RES_FIRE);
327 add_flag(flgs, TR_SH_FIRE);
329 else if (add == ESSENCE_SH_ELEC)
331 add_flag(flgs, TR_RES_ELEC);
332 add_flag(flgs, TR_SH_ELEC);
334 else if (add == ESSENCE_SH_COLD)
336 add_flag(flgs, TR_RES_COLD);
337 add_flag(flgs, TR_SH_COLD);
339 else if (add == ESSENCE_RESISTANCE)
341 add_flag(flgs, TR_RES_ACID);
342 add_flag(flgs, TR_RES_ELEC);
343 add_flag(flgs, TR_RES_FIRE);
344 add_flag(flgs, TR_RES_COLD);
350 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
351 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
352 * @return concptr 発動名称を返す文字列ポインタ
354 static concptr item_activation_dragon_breath(object_type *o_ptr)
356 static char desc[256];
357 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
360 object_flags(o_ptr, flgs);
361 strcpy(desc, _("", "breath "));
363 for (i = 0; dragonbreath_info[i].flag != 0; i++)
365 if (have_flag(flgs, dragonbreath_info[i].flag))
367 if (n > 0) strcat(desc, _("、", ", "));
368 strcat(desc, dragonbreath_info[i].name);
373 strcat(desc, _("のブレス(250)", ""));
379 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
380 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
381 * @return concptr 発動名称を返す文字列ポインタ
383 static concptr item_activation_aux(object_type *o_ptr)
385 static char activation_detail[256];
389 const activation_type* const act_ptr = find_activation_info(o_ptr);
391 if (!act_ptr) return _("未定義", "something undefined");
393 desc = act_ptr->desc;
395 /* Overwrite description if it is special */
396 switch (act_ptr->index) {
398 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
399 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
402 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
403 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
406 desc = item_activation_dragon_breath(o_ptr);
409 if (o_ptr->name1 == ART_HYOUSIGI)
410 desc = _("拍子木を打ちならす", "beat wooden clappers");
412 case ACT_RESIST_ACID:
413 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
414 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
416 case ACT_RESIST_FIRE:
417 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
418 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
420 case ACT_RESIST_COLD:
421 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
422 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
424 case ACT_RESIST_ELEC:
425 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
426 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
428 case ACT_RESIST_POIS:
429 if (o_ptr->name2 == EGO_BRAND_POIS)
430 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
434 /* Timeout description */
435 constant = act_ptr->timeout.constant;
436 dice = act_ptr->timeout.dice;
437 if (constant == 0 && dice == 0) {
438 /* We can activate it every current_world_ptr->game_turn */
439 strcpy(timeout, _("いつでも", "every current_world_ptr->game_turn"));
440 } else if (constant < 0) {
441 /* Activations that have special timeout */
442 switch (act_ptr->index) {
444 sprintf(timeout, _("%d ターン毎", "every %d turns"),
445 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
448 sprintf(timeout, _("%d ターン毎", "every %d turns"),
449 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
452 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
455 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
458 strcpy(timeout, "undefined");
462 /* Normal timeout activations */
463 char constant_str[16], dice_str[16];
464 sprintf(constant_str, "%d", constant);
465 sprintf(dice_str, "d%d", dice);
466 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
467 (constant > 0) ? constant_str : "",
468 (constant > 0 && dice > 0) ? "+" : "",
469 (dice > 0) ? dice_str : "");
472 /* Build detail activate description */
473 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
475 return activation_detail;
479 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
480 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
481 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
482 * @return concptr 発動名称を返す文字列ポインタ
484 concptr item_activation(object_type *o_ptr)
486 BIT_FLAGS flgs[TR_FLAG_SIZE];
487 object_flags(o_ptr, flgs);
489 /* Require activation ability */
490 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
492 /* Get an explain of an activation */
493 if (activation_index(o_ptr))
495 return item_activation_aux(o_ptr);
499 if (o_ptr->tval == TV_WHISTLE)
501 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
504 if (o_ptr->tval == TV_CAPTURE)
506 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
509 return _("何も起きない", "Nothing");
514 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
515 * Describe a "fully identified" item
516 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
517 * @param mode 表示オプション
518 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
520 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
524 BIT_FLAGS flgs[TR_FLAG_SIZE];
528 GAME_TEXT o_name[MAX_NLEN];
533 int trivial_info = 0;
534 object_flags(o_ptr, flgs);
536 /* Extract the description */
538 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
539 (k_text + k_info[o_ptr->k_idx].text),
540 77 - 15, temp, sizeof(temp));
541 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
542 { info[i] = &temp[j]; i++;}
545 if (object_is_equipment(o_ptr))
547 /* Descriptions of a basic equipment is just a flavor */
551 /* Mega-Hack -- describe activation */
552 if (have_flag(flgs, TR_ACTIVATE))
554 info[i++] = _("始動したときの効果...", "It can be activated for...");
555 info[i++] = item_activation(o_ptr);
556 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
559 /* Figurines, a hack */
560 if (o_ptr->tval == TV_FIGURINE)
562 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
565 /* Figurines, a hack */
566 if (o_ptr->name1 == ART_STONEMASK)
568 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you current_world_ptr->game_turn into a vampire permanently.");
571 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
573 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
576 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
578 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
579 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
582 if (o_ptr->name2 == EGO_2WEAPON)
584 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
587 if (have_flag(flgs, TR_EASY_SPELL))
589 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
592 if (o_ptr->name2 == EGO_AMU_FOOL)
594 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
597 if (o_ptr->name2 == EGO_RING_THROW)
599 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
602 if (o_ptr->name2 == EGO_AMU_NAIVETY)
604 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
607 if (o_ptr->tval == TV_STATUE)
609 monster_race *r_ptr = &r_info[o_ptr->pval];
611 if (o_ptr->pval == MON_BULLGATES)
612 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
613 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
614 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
616 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
619 /* Hack -- describe lite's */
621 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
624 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
625 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
626 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
627 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
628 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
629 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
631 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
633 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
635 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
639 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
640 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
643 if(rad != 0) info[i++] = desc;
646 if (o_ptr->name2 == EGO_LITE_LONG)
648 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
651 /* And then describe it fully */
653 if (have_flag(flgs, TR_RIDING))
655 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
656 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
659 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
660 /* This information is not important enough */
664 if (have_flag(flgs, TR_STR))
666 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
668 if (have_flag(flgs, TR_INT))
670 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
672 if (have_flag(flgs, TR_WIS))
674 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
676 if (have_flag(flgs, TR_DEX))
678 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
680 if (have_flag(flgs, TR_CON))
682 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
684 if (have_flag(flgs, TR_CHR))
686 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
689 if (have_flag(flgs, TR_MAGIC_MASTERY))
691 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
694 if (have_flag(flgs, TR_STEALTH))
696 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
698 if (have_flag(flgs, TR_SEARCH))
700 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
702 if (have_flag(flgs, TR_INFRA))
704 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
706 if (have_flag(flgs, TR_TUNNEL))
708 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
710 if (have_flag(flgs, TR_SPEED))
712 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
714 if (have_flag(flgs, TR_BLOWS))
716 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
719 if (have_flag(flgs, TR_BRAND_ACID))
721 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
723 if (have_flag(flgs, TR_BRAND_ELEC))
725 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
727 if (have_flag(flgs, TR_BRAND_FIRE))
729 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
731 if (have_flag(flgs, TR_BRAND_COLD))
733 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
736 if (have_flag(flgs, TR_BRAND_POIS))
738 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
741 if (have_flag(flgs, TR_CHAOTIC))
743 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
746 if (have_flag(flgs, TR_VAMPIRIC))
748 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
751 if (have_flag(flgs, TR_IMPACT))
753 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
756 if (have_flag(flgs, TR_VORPAL))
758 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
761 if (have_flag(flgs, TR_KILL_DRAGON))
763 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
765 else if (have_flag(flgs, TR_SLAY_DRAGON))
767 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
770 if (have_flag(flgs, TR_KILL_ORC))
772 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
774 if (have_flag(flgs, TR_SLAY_ORC))
776 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
779 if (have_flag(flgs, TR_KILL_TROLL))
781 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
783 if (have_flag(flgs, TR_SLAY_TROLL))
785 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
788 if (have_flag(flgs, TR_KILL_GIANT))
790 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
792 else if (have_flag(flgs, TR_SLAY_GIANT))
794 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
797 if (have_flag(flgs, TR_KILL_DEMON))
799 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
801 if (have_flag(flgs, TR_SLAY_DEMON))
803 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
806 if (have_flag(flgs, TR_KILL_UNDEAD))
808 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
810 if (have_flag(flgs, TR_SLAY_UNDEAD))
812 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
815 if (have_flag(flgs, TR_KILL_EVIL))
817 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
819 if (have_flag(flgs, TR_SLAY_EVIL))
821 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
824 if (have_flag(flgs, TR_KILL_ANIMAL))
826 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
828 if (have_flag(flgs, TR_SLAY_ANIMAL))
830 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
833 if (have_flag(flgs, TR_KILL_HUMAN))
835 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
837 if (have_flag(flgs, TR_SLAY_HUMAN))
839 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
842 if (have_flag(flgs, TR_FORCE_WEAPON))
844 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
846 if (have_flag(flgs, TR_DEC_MANA))
848 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
850 if (have_flag(flgs, TR_SUST_STR))
852 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
854 if (have_flag(flgs, TR_SUST_INT))
856 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
858 if (have_flag(flgs, TR_SUST_WIS))
860 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
862 if (have_flag(flgs, TR_SUST_DEX))
864 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
866 if (have_flag(flgs, TR_SUST_CON))
868 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
870 if (have_flag(flgs, TR_SUST_CHR))
872 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
875 if (have_flag(flgs, TR_IM_ACID))
877 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
879 if (have_flag(flgs, TR_IM_ELEC))
881 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
883 if (have_flag(flgs, TR_IM_FIRE))
885 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
887 if (have_flag(flgs, TR_IM_COLD))
889 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
892 if (have_flag(flgs, TR_THROW))
894 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
897 if (have_flag(flgs, TR_FREE_ACT))
899 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
901 if (have_flag(flgs, TR_HOLD_EXP))
903 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
905 if (have_flag(flgs, TR_RES_FEAR))
907 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
909 if (have_flag(flgs, TR_RES_ACID))
911 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
913 if (have_flag(flgs, TR_RES_ELEC))
915 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
917 if (have_flag(flgs, TR_RES_FIRE))
919 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
921 if (have_flag(flgs, TR_RES_COLD))
923 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
925 if (have_flag(flgs, TR_RES_POIS))
927 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
930 if (have_flag(flgs, TR_RES_LITE))
932 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
934 if (have_flag(flgs, TR_RES_DARK))
936 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
939 if (have_flag(flgs, TR_RES_BLIND))
941 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
943 if (have_flag(flgs, TR_RES_CONF))
945 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
947 if (have_flag(flgs, TR_RES_SOUND))
949 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
951 if (have_flag(flgs, TR_RES_SHARDS))
953 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
956 if (have_flag(flgs, TR_RES_NETHER))
958 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
960 if (have_flag(flgs, TR_RES_NEXUS))
962 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
964 if (have_flag(flgs, TR_RES_CHAOS))
966 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
968 if (have_flag(flgs, TR_RES_DISEN))
970 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
973 if (have_flag(flgs, TR_LEVITATION))
975 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
978 if (have_flag(flgs, TR_SEE_INVIS))
980 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
982 if (have_flag(flgs, TR_TELEPATHY))
984 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
986 if (have_flag(flgs, TR_ESP_ANIMAL))
988 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
990 if (have_flag(flgs, TR_ESP_UNDEAD))
992 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
994 if (have_flag(flgs, TR_ESP_DEMON))
996 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
998 if (have_flag(flgs, TR_ESP_ORC))
1000 info[i++] = _("それはオークを感知する。", "It senses orcs.");
1002 if (have_flag(flgs, TR_ESP_TROLL))
1004 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1006 if (have_flag(flgs, TR_ESP_GIANT))
1008 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1010 if (have_flag(flgs, TR_ESP_DRAGON))
1012 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1014 if (have_flag(flgs, TR_ESP_HUMAN))
1016 info[i++] = _("それは人間を感知する。", "It senses humans.");
1018 if (have_flag(flgs, TR_ESP_EVIL))
1020 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1022 if (have_flag(flgs, TR_ESP_GOOD))
1024 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1026 if (have_flag(flgs, TR_ESP_NONLIVING))
1028 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1030 if (have_flag(flgs, TR_ESP_UNIQUE))
1032 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1034 if (have_flag(flgs, TR_SLOW_DIGEST))
1036 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1038 if (have_flag(flgs, TR_REGEN))
1040 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1042 if (have_flag(flgs, TR_WARNING))
1044 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1046 if (have_flag(flgs, TR_REFLECT))
1048 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1050 if (have_flag(flgs, TR_SH_FIRE))
1052 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1054 if (have_flag(flgs, TR_SH_ELEC))
1056 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1058 if (have_flag(flgs, TR_SH_COLD))
1060 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1062 if (have_flag(flgs, TR_NO_MAGIC))
1064 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1066 if (have_flag(flgs, TR_NO_TELE))
1068 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1070 if (have_flag(flgs, TR_XTRA_MIGHT))
1072 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1074 if (have_flag(flgs, TR_XTRA_SHOTS))
1076 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1079 if (have_flag(flgs, TR_BLESSED))
1081 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1084 if (object_is_cursed(o_ptr))
1086 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1088 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1090 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1092 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1096 info[i++] = _("それは呪われている。", "It is cursed.");
1099 * It's a trivial infomation since there is
1100 * fake inscription {cursed}
1106 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1108 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1110 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1112 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1114 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1116 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1118 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1120 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1122 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1124 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1126 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1128 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1130 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1132 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1134 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1136 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1138 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1140 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1142 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1144 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1146 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1148 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1150 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1152 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1154 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1156 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1158 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1160 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1162 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1164 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1166 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1168 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1170 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1172 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1174 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1176 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1179 /* Describe about this kind of object instead of THIS fake object */
1180 if (mode & SCROBJ_FAKE_OBJECT)
1182 switch (o_ptr->tval)
1185 switch (o_ptr->sval)
1187 case SV_RING_LORDLY:
1188 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1190 case SV_RING_WARNING:
1191 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1197 switch (o_ptr->sval)
1199 case SV_AMULET_RESISTANCE:
1200 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1201 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1203 case SV_AMULET_THE_MAGI:
1204 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1211 if (have_flag(flgs, TR_IGNORE_ACID) &&
1212 have_flag(flgs, TR_IGNORE_ELEC) &&
1213 have_flag(flgs, TR_IGNORE_FIRE) &&
1214 have_flag(flgs, TR_IGNORE_COLD))
1216 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1220 if (have_flag(flgs, TR_IGNORE_ACID))
1222 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1224 if (have_flag(flgs, TR_IGNORE_ELEC))
1226 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1228 if (have_flag(flgs, TR_IGNORE_FIRE))
1230 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1232 if (have_flag(flgs, TR_IGNORE_COLD))
1234 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1238 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1240 /* No relevant informations */
1241 if (i <= trivial_info) return (FALSE);
1244 Term_get_size(&wid, &hgt);
1246 /* Display Item name */
1247 if (!(mode & SCROBJ_FAKE_OBJECT))
1248 object_desc(o_name, o_ptr, 0);
1250 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1254 /* Erase the screen */
1255 for (k = 1; k < hgt; k++) prt("", k, 13);
1257 /* Label the information */
1258 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1260 monster_race *r_ptr = &r_info[o_ptr->pval];
1261 int namelen = strlen(r_name + r_ptr->name);
1262 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1263 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1264 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1268 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1271 /* We will print on top of the map (column 13) */
1272 for (k = 2, j = 0; j < i; j++)
1275 prt(info[j], k++, 15);
1277 /* Every 20 entries (lines 2 to 21), start over */
1278 if ((k == hgt - 2) && (j+1 < i))
1280 prt(_("-- 続く --", "-- more --"), k, 15);
1282 for (; k > 2; k--) prt("", k, 15);
1287 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1292 /* Gave knowledge */
1299 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1300 * Convert an inventory index into a one character label
1301 * @param i プレイヤーの所持/装備オブジェクトID
1302 * @return 対応するアルファベット
1303 * @details Note that the label does NOT distinguish inven/equip.
1305 char index_to_label(int i)
1307 /* Indexes for "inven" are easy */
1308 if (i < INVEN_RARM) return (I2A(i));
1310 /* Indexes for "equip" are offset */
1311 return (I2A(i - INVEN_RARM));
1315 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1316 * Convert a label into the index of an item in the "inven"
1317 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1318 * @details Note that the label does NOT distinguish inven/equip.
1320 INVENTORY_IDX label_to_inven(int c)
1325 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1327 /* Verify the index */
1328 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1330 /* Empty slots can never be chosen */
1331 if (!inventory[i].k_idx) return (-1);
1333 /* Return the index */
1339 extern bool select_ring_slot;
1343 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1344 * @param i プレイヤーの所持/装備オブジェクトID
1345 * @return 指輪枠ならばTRUEを返す。
1347 static bool is_ring_slot(int i)
1349 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1354 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1355 * Convert a label into the index of a item in the "equip"
1356 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1358 INVENTORY_IDX label_to_equip(int c)
1363 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1365 /* Verify the index */
1366 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1368 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1370 /* Empty slots can never be chosen */
1371 if (!inventory[i].k_idx) return (-1);
1373 /* Return the index */
1380 * @brief オブジェクトの該当装備部位IDを返す /
1381 * Determine which equipment slot (if any) an item likes
1382 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1383 * @return 対応する装備部位ID
1385 s16b wield_slot(object_type *o_ptr)
1387 /* Slot for equipment */
1388 switch (o_ptr->tval)
1395 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1396 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1397 return (INVEN_LARM);
1404 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1405 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1406 return (INVEN_RARM);
1416 /* Use the right hand first */
1417 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1419 /* Use the left hand for swapping (by default) */
1420 return (INVEN_LEFT);
1426 return (INVEN_NECK);
1431 return (INVEN_LITE);
1438 return (INVEN_BODY);
1443 return (INVEN_OUTER);
1449 return (INVEN_HEAD);
1454 return (INVEN_HANDS);
1459 return (INVEN_FEET);
1463 /* No slot available */
1468 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1469 * Return a string mentioning how a given item is carried
1470 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1471 * @return 部位表現の文字列ポインタ
1473 concptr mention_use(int i)
1477 /* Examine the location */
1481 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1483 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1487 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1489 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1492 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1493 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1494 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1495 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1496 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1497 case INVEN_BODY: p = _(" 体", "On body"); break;
1498 case INVEN_OUTER: p = _("体の上", "About body"); break;
1499 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1500 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1501 case INVEN_FEET: p = _(" 足", "On feet"); break;
1502 default: p = _("ザック", "In pack"); break;
1505 /* Return the result */
1511 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1512 * Return a string describing how a given item is being worn.
1513 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1514 * @return 状態表現内容の文字列ポインタ
1516 * Currently, only used for items in the equipment, not inventory.
1518 concptr describe_use(int i)
1525 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1527 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1531 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1533 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1536 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1537 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1538 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1539 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1540 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1541 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1542 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1543 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1544 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1545 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1546 default: p = _("ザックに入っている", "carrying in your pack"); break;
1549 /* Return the result */
1555 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1556 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1557 * @param book_tval ベースアイテムのtval
1558 * @param book_sval ベースアイテムのsval
1559 * @return 使用可能な魔法書ならばTRUEを返す。
1562 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1564 if (book_tval < TV_LIFE_BOOK) return FALSE;
1565 if (p_ptr->pclass == CLASS_SORCERER)
1567 return is_magic(tval2realm(book_tval));
1569 else if (p_ptr->pclass == CLASS_RED_MAGE)
1571 if (is_magic(tval2realm(book_tval)))
1572 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1574 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1578 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1579 * Check an item against the item tester info
1580 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1581 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1583 bool item_tester_okay(object_type *o_ptr)
1585 /* Hack -- allow listing empty slots */
1586 // if (item_tester_full) return (TRUE); // TODO:DELETE
1588 /* Require an item */
1589 if (!o_ptr->k_idx) return (FALSE);
1591 /* Hack -- ignore "gold" */
1592 if (o_ptr->tval == TV_GOLD)
1595 extern bool show_gold_on_floor;
1597 if (!show_gold_on_floor) return (FALSE);
1600 /* Check the tval */
1601 if (item_tester_tval)
1603 /* Is it a spellbook? If so, we need a hack -- TY */
1604 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1605 (item_tester_tval >= TV_LIFE_BOOK))
1606 return check_book_realm(o_ptr->tval, o_ptr->sval);
1608 if (item_tester_tval != o_ptr->tval) return (FALSE);
1611 /* Check the hook */
1612 if (item_tester_hook)
1614 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1623 * @brief 所持アイテム一覧を表示する /
1624 * Choice window "shadow" of the "show_inven()" function
1627 void display_inven(void)
1629 register int i, n, z = 0;
1631 TERM_COLOR attr = TERM_WHITE;
1633 GAME_TEXT o_name[MAX_NLEN];
1636 Term_get_size(&wid, &hgt);
1638 for (i = 0; i < INVEN_PACK; i++)
1640 o_ptr = &inventory[i];
1641 if (!o_ptr->k_idx) continue;
1645 for (i = 0; i < z; i++)
1647 o_ptr = &inventory[i];
1648 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1649 if (item_tester_okay(o_ptr))
1651 tmp_val[0] = index_to_label(i);
1655 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1656 object_desc(o_name, o_ptr, 0);
1658 attr = tval_to_attr[o_ptr->tval % 128];
1664 Term_putstr(3, i, n, attr, o_name);
1665 Term_erase(3+n, i, 255);
1669 int wgt = o_ptr->weight * o_ptr->number;
1671 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1673 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1675 prt(tmp_val, i, wid - 9);
1679 for (i = z; i < hgt; i++)
1681 Term_erase(0, i, 255);
1688 * @brief 装備アイテム一覧を表示する /
1689 * Choice window "shadow" of the "show_equip()" function
1692 void display_equip(void)
1696 TERM_COLOR attr = TERM_WHITE;
1698 GAME_TEXT o_name[MAX_NLEN];
1701 Term_get_size(&wid, &hgt);
1703 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1705 o_ptr = &inventory[i];
1706 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1707 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1709 tmp_val[0] = index_to_label(i);
1713 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1714 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1716 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1721 object_desc(o_name, o_ptr, 0);
1722 attr = tval_to_attr[o_ptr->tval % 128];
1730 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1732 Term_erase(3 + n, i - INVEN_RARM, 255);
1736 int wgt = o_ptr->weight * o_ptr->number;
1738 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1740 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1743 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1748 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1749 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1753 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1755 Term_erase(0, i, 255);
1761 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1762 * Find the "first" inventory object with the given "tag".
1763 * @param cp 対応するタグIDを与える参照ポインタ
1764 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1765 * @param mode 所持、装備の切り替え
1766 * @return タグに該当するオブジェクトがあるならTRUEを返す
1768 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1769 * inscription of an object. Alphabetical characters don't work as a\n
1770 * tag in this form.\n
1772 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1773 * and "x" is the "current" command_cmd code.\n
1775 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1778 COMMAND_CODE start, end;
1781 /* Extract index from mode */
1786 end = INVEN_TOTAL - 1;
1791 end = INVEN_PACK - 1;
1798 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1800 /* Check every inventory object */
1801 for (i = start; i <= end; i++)
1803 object_type *o_ptr = &inventory[i];
1804 if (!o_ptr->k_idx) continue;
1806 /* Skip empty inscriptions */
1807 if (!o_ptr->inscription) continue;
1809 /* Skip non-choice */
1810 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1813 s = my_strchr(quark_str(o_ptr->inscription), '@');
1815 /* Process all tags */
1818 /* Check the special tags */
1819 if ((s[1] == command_cmd) && (s[2] == tag))
1821 /* Save the actual inventory ID */
1828 /* Find another '@' */
1829 s = my_strchr(s + 1, '@');
1834 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1836 /* Don't allow {@#} with '#' being alphabet */
1837 if (tag < '0' || '9' < tag)
1843 /* Check every object */
1844 for (i = start; i <= end; i++)
1846 object_type *o_ptr = &inventory[i];
1847 if (!o_ptr->k_idx) continue;
1849 /* Skip empty inscriptions */
1850 if (!o_ptr->inscription) continue;
1852 /* Skip non-choice */
1853 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1856 s = my_strchr(quark_str(o_ptr->inscription), '@');
1858 /* Process all tags */
1861 /* Check the normal tags */
1864 /* Save the actual inventory ID */
1871 /* Find another '@' */
1872 s = my_strchr(s + 1, '@');
1882 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1883 * Find the "first" inventory object with the given "tag".
1884 * @param cp 対応するタグIDを与える参照ポインタ
1885 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1886 * @param floor_list 床上アイテムの配列
1887 * @param floor_num 床上アイテムの配列ID
1888 * @return タグに該当するオブジェクトがあるならTRUEを返す
1890 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1891 * inscription of an object. Alphabetical characters don't work as a\n
1892 * tag in this form.\n
1894 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1895 * and "x" is the "current" command_cmd code.\n
1897 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1902 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1904 /* Check every object in the grid */
1905 for (i = 0; i < floor_num && i < 23; i++)
1907 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1909 /* Skip empty inscriptions */
1910 if (!o_ptr->inscription) continue;
1913 s = my_strchr(quark_str(o_ptr->inscription), '@');
1915 /* Process all tags */
1918 /* Check the special tags */
1919 if ((s[1] == command_cmd) && (s[2] == tag))
1921 /* Save the actual floor object ID */
1928 /* Find another '@' */
1929 s = my_strchr(s + 1, '@');
1934 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1936 /* Don't allow {@#} with '#' being alphabet */
1937 if (tag < '0' || '9' < tag)
1943 /* Check every object in the grid */
1944 for (i = 0; i < floor_num && i < 23; i++)
1946 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1948 /* Skip empty inscriptions */
1949 if (!o_ptr->inscription) continue;
1952 s = my_strchr(quark_str(o_ptr->inscription), '@');
1954 /* Process all tags */
1957 /* Check the normal tags */
1960 /* Save the floor object ID */
1967 /* Find another '@' */
1968 s = my_strchr(s + 1, '@');
1978 * @brief タグIDにあわせてタグアルファベットのリストを返す /
1979 * Move around label characters with correspond tags
1980 * @param label ラベルリストを取得する文字列参照ポインタ
1981 * @param mode 所持品リストか装備品リストかの切り替え
1984 static void prepare_label_string(char *label, BIT_FLAGS mode)
1986 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
1987 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
1990 /* Prepare normal labels */
1991 strcpy(label, alphabet_chars);
1993 /* Move each label */
1994 for (i = 0; i < 52; i++)
1997 SYMBOL_CODE c = alphabet_chars[i];
1999 /* Find a tag with this label */
2000 if (get_tag(&index, c, mode))
2002 /* Delete the overwritten label */
2003 if (label[i] == c) label[i] = ' ';
2005 /* Move the label to the place of corresponding tag */
2006 label[index - offset] = c;
2013 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2014 * Move around label characters with correspond tags (floor version)
2015 * @param label ラベルリストを取得する文字列参照ポインタ
2016 * @param floor_list 床上アイテムの配列
2017 * @param floor_num 床上アイテムの配列ID
2022 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2024 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2027 /* Prepare normal labels */
2028 strcpy(label, alphabet_chars);
2030 /* Move each label */
2031 for (i = 0; i < 52; i++)
2034 SYMBOL_CODE c = alphabet_chars[i];
2036 /* Find a tag with this label */
2037 if (get_tag_floor(&index, c, floor_list, floor_num))
2039 /* Delete the overwritten label */
2040 if (label[i] == c) label[i] = ' ';
2042 /* Move the label to the place of corresponding tag */
2050 * @brief 所持アイテムの表示を行う /
2051 * Display the inventory.
2052 * @param target_item アイテムの選択処理を行うか否か。
2053 * @return 選択したアイテムのタグ
2055 * Hack -- do not display "trailing" empty slots
2057 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2061 int col, cur_col, len;
2063 GAME_TEXT o_name[MAX_NLEN];
2065 COMMAND_CODE out_index[23];
2066 TERM_COLOR out_color[23];
2067 char out_desc[23][MAX_NLEN];
2068 COMMAND_CODE target_item_label = 0;
2070 char inven_label[52 + 1];
2072 /* Starting column */
2075 Term_get_size(&wid, &hgt);
2077 /* Default "max-length" */
2078 len = wid - col - 1;
2081 /* Find the "final" slot */
2082 for (i = 0; i < INVEN_PACK; i++)
2084 o_ptr = &inventory[i];
2085 if (!o_ptr->k_idx) continue;
2091 prepare_label_string(inven_label, USE_INVEN);
2093 /* Display the inventory */
2094 for (k = 0, i = 0; i < z; i++)
2096 o_ptr = &inventory[i];
2098 /* Is this item acceptable? */
2099 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2101 object_desc(o_name, o_ptr, 0);
2103 /* Save the object index, color, and description */
2105 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2107 /* Grey out charging items */
2110 out_color[k] = TERM_L_DARK;
2113 (void)strcpy(out_desc[k], o_name);
2115 /* Find the predicted "line length" */
2116 l = strlen(out_desc[k]) + 5;
2118 /* Be sure to account for the weight */
2119 if (show_weights) l += 9;
2121 /* Account for icon if displayed */
2122 if (show_item_graph)
2125 if (use_bigtile) l++;
2128 /* Maintain the maximum length */
2129 if (l > len) len = l;
2131 /* Advance to next "line" */
2135 /* Find the column to start in */
2136 col = (len > wid - 4) ? 0 : (wid - len - 1);
2138 /* Output each entry */
2139 for (j = 0; j < k; j++)
2142 o_ptr = &inventory[i];
2144 /* Clear the line */
2145 prt("", j + 1, col ? col - 2 : col);
2147 if (use_menu && target_item)
2149 if (j == (target_item-1))
2151 strcpy(tmp_val, _("》", "> "));
2152 target_item_label = i;
2154 else strcpy(tmp_val, " ");
2156 else if (i <= INVEN_PACK)
2158 /* Prepare an index --(-- */
2159 sprintf(tmp_val, "%c)", inven_label[i]);
2163 /* Prepare an index --(-- */
2164 sprintf(tmp_val, "%c)", index_to_label(i));
2167 /* Clear the line with the (possibly indented) index */
2168 put_str(tmp_val, j + 1, col);
2172 /* Display graphics for object, if desired */
2173 if (show_item_graph)
2175 TERM_COLOR a = object_attr(o_ptr);
2176 SYMBOL_CODE c = object_char(o_ptr);
2177 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2178 if (use_bigtile) cur_col++;
2184 /* Display the entry itself */
2185 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2187 /* Display the weight if needed */
2190 int wgt = o_ptr->weight * o_ptr->number;
2192 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2194 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2197 prt(tmp_val, j + 1, wid - 9);
2201 /* Make a "shadow" below the list (only if needed) */
2202 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2204 /* Save the new column */
2207 return target_item_label;
2212 * @brief 装備アイテムの表示を行う /
2213 * Display the equipment.
2214 * @param target_item アイテムの選択処理を行うか否か。
2215 * @return 選択したアイテムのタグ
2217 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2221 int col, cur_col, len;
2224 GAME_TEXT o_name[MAX_NLEN];
2225 COMMAND_CODE out_index[23];
2226 TERM_COLOR out_color[23];
2227 char out_desc[23][MAX_NLEN];
2228 COMMAND_CODE target_item_label = 0;
2230 char equip_label[52 + 1];
2232 /* Starting column */
2235 Term_get_size(&wid, &hgt);
2237 /* Maximal length */
2238 len = wid - col - 1;
2241 /* Scan the equipment list */
2242 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2244 o_ptr = &inventory[i];
2246 /* Is this item acceptable? */
2247 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2248 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2249 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2251 object_desc(o_name, o_ptr, 0);
2253 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2255 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2256 out_color[k] = TERM_WHITE;
2260 (void)strcpy(out_desc[k], o_name);
2261 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2265 /* Grey out charging items */
2268 out_color[k] = TERM_L_DARK;
2271 /* Extract the maximal length (see below) */
2273 l = strlen(out_desc[k]) + (2 + 1);
2275 l = strlen(out_desc[k]) + (2 + 3);
2279 /* Increase length for labels (if needed) */
2281 if (show_labels) l += (7 + 2);
2283 if (show_labels) l += (14 + 2);
2287 /* Increase length for weight (if needed) */
2288 if (show_weights) l += 9;
2290 if (show_item_graph) l += 2;
2292 /* Maintain the max-length */
2293 if (l > len) len = l;
2295 /* Advance the entry */
2299 /* Hack -- Find a column to start in */
2301 col = (len > wid - 6) ? 0 : (wid - len - 1);
2303 col = (len > wid - 4) ? 0 : (wid - len - 1);
2306 prepare_label_string(equip_label, USE_EQUIP);
2308 /* Output each entry */
2309 for (j = 0; j < k; j++)
2312 o_ptr = &inventory[i];
2314 /* Clear the line */
2315 prt("", j + 1, col ? col - 2 : col);
2317 if (use_menu && target_item)
2319 if (j == (target_item-1))
2321 strcpy(tmp_val, _("》", "> "));
2322 target_item_label = i;
2324 else strcpy(tmp_val, " ");
2326 else if (i >= INVEN_RARM)
2328 /* Prepare an index --(-- */
2329 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2333 /* Prepare an index --(-- */
2334 sprintf(tmp_val, "%c)", index_to_label(i));
2337 /* Clear the line with the (possibly indented) index */
2338 put_str(tmp_val, j+1, col);
2342 /* Display graphics for object, if desired */
2343 if (show_item_graph)
2345 TERM_COLOR a = object_attr(o_ptr);
2346 SYMBOL_CODE c = object_char(o_ptr);
2347 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2348 if (use_bigtile) cur_col++;
2356 /* Mention the use */
2357 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2359 put_str(tmp_val, j+1, cur_col);
2361 /* Display the entry itself */
2362 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2368 /* Display the entry itself */
2369 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2372 /* Display the weight if needed */
2375 int wgt = o_ptr->weight * o_ptr->number;
2377 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2379 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2382 prt(tmp_val, j + 1, wid - 9);
2386 /* Make a "shadow" below the list (only if needed) */
2387 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2389 /* Save the new column */
2392 return target_item_label;
2396 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2397 * Flip "inven" and "equip" in any sub-windows
2400 void toggle_inven_equip(void)
2405 for (j = 0; j < 8; j++)
2408 if (!angband_term[j]) continue;
2410 /* Flip inven to equip */
2411 if (window_flag[j] & (PW_INVEN))
2414 window_flag[j] &= ~(PW_INVEN);
2415 window_flag[j] |= (PW_EQUIP);
2417 p_ptr->window |= (PW_EQUIP);
2420 /* Flip inven to equip */
2421 else if (window_flag[j] & (PW_EQUIP))
2424 window_flag[j] &= ~(PW_EQUIP);
2425 window_flag[j] |= (PW_INVEN);
2427 p_ptr->window |= (PW_INVEN);
2433 * @brief 選択したアイテムの確認処理の補助 /
2434 * Verify the choice of an item.
2435 * @param prompt メッセージ表示の一部
2436 * @param item 選択アイテムID
2437 * @return 確認がYesならTRUEを返す。
2438 * @details The item can be negative to mean "item on floor".
2440 static bool verify(concptr prompt, INVENTORY_IDX item)
2442 GAME_TEXT o_name[MAX_NLEN];
2443 char out_val[MAX_NLEN+20];
2450 o_ptr = &inventory[item];
2456 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2458 object_desc(o_name, o_ptr, 0);
2461 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2464 return (get_check(out_val));
2469 * @brief 選択したアイテムの確認処理のメインルーチン /
2470 * @param item 選択アイテムID
2471 * @return 確認がYesならTRUEを返す。
2472 * @details The item can be negative to mean "item on floor".
2473 * Hack -- allow user to "prevent" certain choices
2475 static bool get_item_allow(INVENTORY_IDX item)
2479 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2484 o_ptr = &inventory[item];
2490 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2493 /* No inscription */
2494 if (!o_ptr->inscription) return (TRUE);
2497 s = my_strchr(quark_str(o_ptr->inscription), '!');
2499 /* Process preventions */
2502 /* Check the "restriction" */
2503 if ((s[1] == command_cmd) || (s[1] == '*'))
2505 /* Verify the choice */
2506 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2509 /* Find another '!' */
2510 s = my_strchr(s + 1, '!');
2519 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2520 * Auxiliary function for "get_item()" -- test an index
2522 * @return 正規のIDならばTRUEを返す。
2524 static bool get_item_okay(OBJECT_IDX i)
2527 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2529 if (select_ring_slot) return is_ring_slot(i);
2531 /* Verify the item */
2532 if (!item_tester_okay(&inventory[i])) return (FALSE);
2539 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2540 * Determine whether get_item() can get some item or not
2541 * @return アイテムを拾えるならばTRUEを返す。
2542 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2544 bool can_get_item(void)
2547 OBJECT_IDX floor_list[23];
2548 ITEM_NUMBER floor_num = 0;
2550 for (j = 0; j < INVEN_TOTAL; j++)
2551 if (item_tester_okay(&inventory[j]))
2554 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2562 * @brief オブジェクト選択の汎用関数 /
2563 * Let the user select an item, save its "index"
2564 * @param cp 選択したオブジェクトのIDを返す。
2565 * @param pmt 選択目的のメッセージ
2566 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2567 * @param mode オプションフラグ
2568 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2569 * Return TRUE only if an acceptable item was chosen by the user.\n
2571 * The selected item must satisfy the "item_tester_hook()" function,\n
2572 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2574 * All "item_tester" restrictions are cleared before this function returns.\n
2576 * The user is allowed to choose acceptable items from the equipment,\n
2577 * inventory, or floor, respectively, if the proper flag was given,\n
2578 * and there are any acceptable items in that location.\n
2580 * The equipment or inventory are displayed (even if no acceptable\n
2581 * items are in that location) if the proper flag was given.\n
2583 * If there are no acceptable items available anywhere, and "str" is\n
2584 * not NULL, then it will be used as the text of a warning message\n
2585 * before the function returns.\n
2587 * Note that the user must press "-" to specify the item on the floor,\n
2588 * and there is no way to "examine" the item on the floor, while the\n
2589 * use of "capital" letters will "examine" an inventory/equipment item,\n
2590 * and prompt for its use.\n
2592 * If a legal item is selected from the inventory, we save it in "cp"\n
2593 * directly (0 to 35), and return TRUE.\n
2595 * If a legal item is selected from the floor, we save it in "cp" as\n
2596 * a negative (-1 to -511), and return TRUE.\n
2598 * If no item is available, we do nothing to "cp", and we display a\n
2599 * warning message, using "str" if available, and return FALSE.\n
2601 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2603 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2604 * to allow the user to enter a command while viewing those screens, and\n
2605 * also to induce "auto-enter" of stores, and other such stuff.\n
2607 * Global "p_ptr->command_see" may be set before calling this function to start\n
2608 * out in "browse" mode. It is cleared before this function returns.\n
2610 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2611 * If it is TRUE then we are viewing inventory, else equipment.\n
2613 * We always erase the prompt when we are done, leaving a blank line,\n
2614 * or a warning message, if appropriate, if no items are available.\n
2616 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2618 OBJECT_IDX this_o_idx, next_o_idx = 0;
2635 bool allow_floor = FALSE;
2637 bool toggle = FALSE;
2642 int menu_line = (use_menu ? 1 : 0);
2646 static char prev_tag = '\0';
2647 char cur_tag = '\0';
2649 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2652 if (mode & USE_EQUIP) equip = TRUE;
2653 if (mode & USE_INVEN) inven = TRUE;
2654 if (mode & USE_FLOOR) floor = TRUE;
2656 /* Get the item index */
2657 if (repeat_pull(cp))
2660 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2662 item_tester_tval = 0;
2663 item_tester_hook = NULL;
2664 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2669 else if (floor && (*cp < 0))
2675 o_ptr = ¤t_floor_ptr->o_list[k];
2677 /* Validate the item */
2678 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2680 /* Forget restrictions */
2681 item_tester_tval = 0;
2682 item_tester_hook = NULL;
2683 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2690 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2691 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2693 if (prev_tag && command_cmd)
2695 /* Look up the tag and validate the item */
2696 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2697 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2698 else if (!get_item_okay(k)) /* Reject */;
2701 /* Accept that choice */
2704 /* Forget restrictions */
2705 item_tester_tval = 0;
2706 item_tester_hook = NULL;
2707 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2713 prev_tag = '\0'; /* prev_tag is no longer effective */
2716 /* Verify the item */
2717 else if (get_item_okay(*cp))
2719 /* Forget restrictions */
2720 item_tester_tval = 0;
2721 item_tester_hook = NULL;
2722 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2734 /* No item selected */
2738 /* Full inventory */
2740 i2 = INVEN_PACK - 1;
2742 /* Forbid inventory */
2743 if (!inven) i2 = -1;
2746 for (j = 0; j < INVEN_PACK; j++)
2747 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
2750 /* Restrict inventory indexes */
2751 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2752 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2755 /* Full equipment */
2757 e2 = INVEN_TOTAL - 1;
2759 /* Forbid equipment */
2760 if (!equip) e2 = -1;
2763 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2764 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
2765 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2768 /* Restrict equipment indexes */
2769 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2770 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2772 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2776 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2778 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2782 /* Restrict floor usage */
2785 /* Scan all objects in the grid */
2786 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)
2789 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
2790 next_o_idx = o_ptr->next_o_idx;
2792 /* Accept the item on the floor if legal */
2793 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2797 /* Require at least one legal choice */
2798 if (!allow_floor && (i1 > i2) && (e1 > e2))
2800 /* Cancel p_ptr->command_see */
2801 command_see = FALSE;
2805 if (mode & USE_FORCE) {
2811 /* Analyze choices */
2814 /* Hack -- Start on equipment if requested */
2815 if (command_see && command_wrk && equip)
2820 /* Use inventory if allowed */
2823 command_wrk = FALSE;
2826 /* Use equipment if allowed */
2832 /* Use inventory for floor */
2835 command_wrk = FALSE;
2841 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2843 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2845 /* Hack -- start out in "display" mode */
2852 /* Repeat until done */
2855 COMMAND_CODE get_item_label = 0;
2862 for (j = 0; j < 8; j++)
2865 if (!angband_term[j]) continue;
2867 /* Count windows displaying inven */
2868 if (window_flag[j] & (PW_INVEN)) ni++;
2870 /* Count windows displaying equip */
2871 if (window_flag[j] & (PW_EQUIP)) ne++;
2874 /* Toggle if needed */
2875 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2878 toggle_inven_equip();
2884 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2887 /* Inventory screen */
2890 /* Redraw if needed */
2891 if (command_see) get_item_label = show_inven(menu_line, mode);
2894 /* Equipment screen */
2897 /* Redraw if needed */
2898 if (command_see) get_item_label = show_equip(menu_line, mode);
2901 /* Viewing inventory */
2904 /* Begin the prompt */
2905 sprintf(out_val, _("持ち物:", "Inven:"));
2907 /* Some legal items */
2908 if ((i1 <= i2) && !use_menu)
2910 /* Build the prompt */
2911 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2912 index_to_label(i1), index_to_label(i2));
2915 strcat(out_val, tmp_val);
2918 /* Indicate ability to "view" */
2919 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2922 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2925 /* Viewing equipment */
2928 /* Begin the prompt */
2929 sprintf(out_val, _("装備品:", "Equip:"));
2931 /* Some legal items */
2932 if ((e1 <= e2) && !use_menu)
2934 /* Build the prompt */
2935 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2936 index_to_label(e1), index_to_label(e2));
2939 strcat(out_val, tmp_val);
2942 /* Indicate ability to "view" */
2943 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2946 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
2949 /* Indicate legality of the "floor" item */
2950 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
2951 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
2953 /* Finish the prompt */
2954 strcat(out_val, " ESC");
2956 /* Build the prompt */
2957 sprintf(tmp_val, "(%s) %s", out_val, pmt);
2959 /* Show the prompt */
2967 int max_line = (command_wrk ? max_equip : max_inven);
2983 menu_line += (max_line - 1);
3002 /* Verify legality */
3003 if (!inven || !equip)
3009 /* Hack -- Fix screen */
3016 /* Switch inven/equip */
3017 command_wrk = !command_wrk;
3018 max_line = (command_wrk ? max_equip : max_inven);
3019 if (menu_line > max_line) menu_line = max_line;
3021 /* Need to redraw */
3030 if (command_wrk == USE_FLOOR)
3033 (*cp) = -get_item_label;
3037 /* Validate the item */
3038 if (!get_item_okay(get_item_label))
3044 /* Allow player to "refuse" certain actions */
3045 if (!get_item_allow(get_item_label))
3051 /* Accept that choice */
3052 (*cp) = get_item_label;
3061 if (mode & USE_FORCE) {
3069 if (menu_line > max_line) menu_line -= max_line;
3090 command_see = FALSE;
3107 /* Verify legality */
3108 if (!inven || !equip)
3114 /* Hack -- Fix screen */
3121 /* Switch inven/equip */
3122 command_wrk = !command_wrk;
3124 /* Need to redraw */
3130 /* Use floor item */
3133 /* Scan all objects in the grid */
3134 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)
3137 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3138 next_o_idx = o_ptr->next_o_idx;
3140 /* Validate the item */
3141 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3146 /* Verify the item (if required) */
3147 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3149 /* Allow player to "refuse" certain actions */
3150 if (!get_item_allow(k)) continue;
3152 /* Accept that choice */
3168 case '1': case '2': case '3':
3169 case '4': case '5': case '6':
3170 case '7': case '8': case '9':
3172 /* Look up the tag */
3173 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3179 /* Hack -- Validate the item */
3180 if ((k < INVEN_RARM) ? !inven : !equip)
3186 /* Validate the item */
3187 if (!get_item_okay(k))
3193 /* Allow player to "refuse" certain actions */
3194 if (!get_item_allow(k))
3200 /* Accept that choice */
3212 /* Choose "default" inventory item */
3215 k = ((i1 == i2) ? i1 : -1);
3218 /* Choose "default" equipment item */
3221 k = ((e1 == e2) ? e1 : -1);
3224 /* Validate the item */
3225 if (!get_item_okay(k))
3231 /* Allow player to "refuse" certain actions */
3232 if (!get_item_allow(k))
3238 /* Accept that choice */
3248 if (mode & USE_FORCE) {
3261 bool not_found = FALSE;
3263 /* Look up the alphabetical tag */
3264 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3269 /* Hack -- Validate the item */
3270 else if ((k < INVEN_RARM) ? !inven : !equip)
3275 /* Validate the item */
3276 else if (!get_item_okay(k))
3283 /* Accept that choice */
3291 /* Extract "query" setting */
3292 ver = isupper(which);
3293 which = (char)tolower(which);
3295 /* Convert letter to inventory index */
3298 if (which == '(') k = i1;
3299 else if (which == ')') k = i2;
3300 else k = label_to_inven(which);
3303 /* Convert letter to equipment index */
3306 if (which == '(') k = e1;
3307 else if (which == ')') k = e2;
3308 else k = label_to_equip(which);
3311 /* Validate the item */
3312 if (!get_item_okay(k))
3318 /* Verify the item */
3319 if (ver && !verify(_("本当に", "Try"), k))
3325 /* Allow player to "refuse" certain actions */
3326 if (!get_item_allow(k))
3332 /* Accept that choice */
3343 /* Fix the screen if necessary */
3348 /* Hack -- Cancel "display" */
3349 command_see = FALSE;
3353 /* Forget the item_tester_tval restriction */
3354 item_tester_tval = 0;
3356 /* Forget the item_tester_hook restriction */
3357 item_tester_hook = NULL;
3360 /* Clean up 'show choices' */
3361 /* Toggle again if needed */
3362 if (toggle) toggle_inven_equip();
3364 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3367 /* Clear the prompt line */
3370 /* Warning if needed */
3371 if (oops && str) msg_print(str);
3376 if (command_cmd) prev_tag = cur_tag;
3377 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3383 * Choose an item and get auto-picker entry from it.
3385 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3388 if (!get_item(&item, q, s, option)) return NULL;
3389 if (idx) *idx = item;
3391 if (item == INVEN_FORCE) return NULL;
3393 /* Get the item (in the pack) */
3394 else if (item >= 0) return &inventory[item];
3396 /* Get the item (on the floor) */
3397 else return ¤t_floor_ptr->o_list[0 - item];
3402 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3403 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3404 * @param y 走査するフロアのY座標
3405 * @param x 走査するフロアのX座標
3406 * @param mode オプションフラグ
3407 * @return 対象のマスに落ちているアイテム数
3409 * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
3410 * location. Valid flags are:
3412 * mode & 0x01 -- Item tester
3413 * mode & 0x02 -- Marked items only
3414 * mode & 0x04 -- Stop after first
3416 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3418 OBJECT_IDX this_o_idx, next_o_idx;
3420 ITEM_NUMBER num = 0;
3423 if (!in_bounds(y, x)) return 0;
3425 /* Scan all objects in the grid */
3426 for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3429 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3430 next_o_idx = o_ptr->next_o_idx;
3433 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3436 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3438 /* Accept this item */
3439 /* XXX Hack -- Enforce limit */
3441 items[num] = this_o_idx;
3446 if (mode & 0x04) break;
3453 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3454 * @param target_item カーソルの初期値
3455 * @param y 走査するフロアのY座標
3456 * @param x 走査するフロアのX座標
3457 * @param min_width 表示の長さ
3458 * @return 選択したアイテムの添え字
3461 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3469 GAME_TEXT o_name[MAX_NLEN];
3472 COMMAND_CODE out_index[23];
3473 TERM_COLOR out_color[23];
3474 char out_desc[23][MAX_NLEN];
3475 COMMAND_CODE target_item_label = 0;
3477 OBJECT_IDX floor_list[23];
3478 ITEM_NUMBER floor_num;
3480 char floor_label[52 + 1];
3482 bool dont_need_to_show_weights = TRUE;
3484 Term_get_size(&wid, &hgt);
3486 /* Default length */
3487 len = MAX((*min_width), 20);
3489 /* Scan for objects in the grid, using item_tester_okay() */
3490 floor_num = scan_floor(floor_list, y, x, 0x03);
3492 /* Display the floor objects */
3493 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3495 o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
3497 object_desc(o_name, o_ptr, 0);
3499 /* Save the index */
3502 /* Acquire inventory color */
3503 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3505 /* Save the object description */
3506 strcpy(out_desc[k], o_name);
3508 /* Find the predicted "line length" */
3509 l = strlen(out_desc[k]) + 5;
3511 /* Be sure to account for the weight */
3512 if (show_weights) l += 9;
3514 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3516 /* Maintain the maximum length */
3517 if (l > len) len = l;
3519 /* Advance to next "line" */
3523 if (show_weights && dont_need_to_show_weights) len -= 9;
3528 /* Find the column to start in */
3529 col = (len > wid - 4) ? 0 : (wid - len - 1);
3531 prepare_label_string_floor(floor_label, floor_list, floor_num);
3533 /* Output each entry */
3534 for (j = 0; j < k; j++)
3536 m = floor_list[out_index[j]];
3537 o_ptr = ¤t_floor_ptr->o_list[m];
3539 /* Clear the line */
3540 prt("", j + 1, col ? col - 2 : col);
3542 if (use_menu && target_item)
3544 if (j == (target_item-1))
3546 strcpy(tmp_val, _("》", "> "));
3547 target_item_label = m;
3549 else strcpy(tmp_val, " ");
3553 /* Prepare an index --(-- */
3554 sprintf(tmp_val, "%c)", floor_label[j]);
3557 /* Clear the line with the (possibly indented) index */
3558 put_str(tmp_val, j + 1, col);
3560 /* Display the entry itself */
3561 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3563 /* Display the weight if needed */
3564 if (show_weights && (o_ptr->tval != TV_GOLD))
3566 int wgt = o_ptr->weight * o_ptr->number;
3568 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3570 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3573 prt(tmp_val, j + 1, wid - 9);
3577 /* Make a "shadow" below the list (only if needed) */
3578 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3580 return target_item_label;
3584 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3585 * Let the user select an item, save its "index"
3586 * @param cp 選択したオブジェクトのIDを返す。
3587 * @param pmt 選択目的のメッセージ
3588 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3589 * @param mode オプションフラグ
3590 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3592 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3594 char n1 = ' ', n2 = ' ', which = ' ';
3597 COMMAND_CODE i1, i2;
3598 COMMAND_CODE e1, e2;
3606 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3607 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3608 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3609 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3611 bool allow_equip = FALSE;
3612 bool allow_inven = FALSE;
3613 bool allow_floor = FALSE;
3615 bool toggle = FALSE;
3620 ITEM_NUMBER floor_num;
3621 OBJECT_IDX floor_list[23];
3623 TERM_LEN min_width = 0;
3625 int menu_line = (use_menu ? 1 : 0);
3629 static char prev_tag = '\0';
3630 char cur_tag = '\0';
3632 /* Get the item index */
3633 if (repeat_pull(cp))
3636 if (force && (*cp == INVEN_FORCE))
3638 item_tester_tval = 0;
3639 item_tester_hook = NULL;
3640 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3645 else if (floor && (*cp < 0))
3647 if (prev_tag && command_cmd)
3649 /* Scan all objects in the grid */
3650 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3652 /* Look up the tag */
3653 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3655 /* Accept that choice */
3656 (*cp) = 0 - floor_list[k];
3658 /* Forget restrictions */
3659 item_tester_tval = 0;
3660 item_tester_hook = NULL;
3661 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3667 prev_tag = '\0'; /* prev_tag is no longer effective */
3670 /* Validate the item */
3671 else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
3673 /* Forget restrictions */
3674 item_tester_tval = 0;
3675 item_tester_hook = NULL;
3676 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3683 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3684 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3686 if (prev_tag && command_cmd)
3688 /* Look up the tag and validate the item */
3689 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3690 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3691 else if (!get_item_okay(k)) /* Reject */;
3694 /* Accept that choice */
3697 /* Forget restrictions */
3698 item_tester_tval = 0;
3699 item_tester_hook = NULL;
3700 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3706 prev_tag = '\0'; /* prev_tag is no longer effective */
3709 /* Verify the item */
3710 else if (get_item_okay(*cp))
3712 /* Forget restrictions */
3713 item_tester_tval = 0;
3714 item_tester_hook = NULL;
3715 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3729 /* No item selected */
3733 /* Full inventory */
3735 i2 = INVEN_PACK - 1;
3737 /* Forbid inventory */
3738 if (!inven) i2 = -1;
3741 for (j = 0; j < INVEN_PACK; j++)
3742 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
3745 /* Restrict inventory indexes */
3746 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3747 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3750 /* Full equipment */
3752 e2 = INVEN_TOTAL - 1;
3754 /* Forbid equipment */
3755 if (!equip) e2 = -1;
3758 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3759 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
3760 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3763 /* Restrict equipment indexes */
3764 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3765 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3767 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3771 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3773 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3777 /* Count "okay" floor items */
3780 /* Restrict floor usage */
3783 /* Scan all objects in the grid */
3784 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3787 /* Accept inventory */
3788 if (i1 <= i2) allow_inven = TRUE;
3790 /* Accept equipment */
3791 if (e1 <= e2) allow_equip = TRUE;
3794 if (floor_num) allow_floor = TRUE;
3796 /* Require at least one legal choice */
3797 if (!allow_inven && !allow_equip && !allow_floor)
3799 /* Cancel p_ptr->command_see */
3800 command_see = FALSE;
3810 /* Analyze choices */
3813 /* Hack -- Start on equipment if requested */
3814 if (command_see && (command_wrk == (USE_EQUIP))
3817 command_wrk = (USE_EQUIP);
3820 /* Use inventory if allowed */
3821 else if (allow_inven)
3823 command_wrk = (USE_INVEN);
3826 /* Use equipment if allowed */
3827 else if (allow_equip)
3829 command_wrk = (USE_EQUIP);
3832 /* Use floor if allowed */
3833 else if (allow_floor)
3835 command_wrk = (USE_FLOOR);
3840 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3842 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3844 /* Hack -- start out in "display" mode */
3850 /* Repeat until done */
3853 COMMAND_CODE get_item_label = 0;
3860 for (j = 0; j < 8; j++)
3863 if (!angband_term[j]) continue;
3865 /* Count windows displaying inven */
3866 if (window_flag[j] & (PW_INVEN)) ni++;
3868 /* Count windows displaying equip */
3869 if (window_flag[j] & (PW_EQUIP)) ne++;
3872 /* Toggle if needed */
3873 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3874 (command_wrk == (USE_INVEN) && !ni && ne))
3877 toggle_inven_equip();
3883 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3886 /* Inventory screen */
3887 if (command_wrk == (USE_INVEN))
3889 /* Extract the legal requests */
3893 /* Redraw if needed */
3894 if (command_see) get_item_label = show_inven(menu_line, mode);
3897 /* Equipment screen */
3898 else if (command_wrk == (USE_EQUIP))
3900 /* Extract the legal requests */
3901 n1 = I2A(e1 - INVEN_RARM);
3902 n2 = I2A(e2 - INVEN_RARM);
3904 /* Redraw if needed */
3905 if (command_see) get_item_label = show_equip(menu_line, mode);
3909 else if (command_wrk == (USE_FLOOR))
3912 k = MIN(floor_top + 23, floor_num) - 1;
3914 /* Extract the legal requests */
3915 n1 = I2A(j - floor_top);
3916 n2 = I2A(k - floor_top);
3918 /* Redraw if needed */
3919 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3922 /* Viewing inventory */
3923 if (command_wrk == (USE_INVEN))
3925 /* Begin the prompt */
3926 sprintf(out_val, _("持ち物:", "Inven:"));
3930 /* Build the prompt */
3931 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3932 index_to_label(i1), index_to_label(i2));
3935 strcat(out_val, tmp_val);
3938 /* Indicate ability to "view" */
3939 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3945 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
3946 else if (allow_floor)
3947 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
3949 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
3956 strcat(out_val, _(" '-'床上,", " - for floor,"));
3957 else if (allow_equip)
3958 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
3960 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
3964 /* Viewing equipment */
3965 else if (command_wrk == (USE_EQUIP))
3967 /* Begin the prompt */
3968 sprintf(out_val, _("装備品:", "Equip:"));
3972 /* Build the prompt */
3973 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3974 index_to_label(e1), index_to_label(e2));
3977 strcat(out_val, tmp_val);
3980 /* Indicate ability to "view" */
3981 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3987 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
3988 else if (allow_floor)
3989 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
3991 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
3998 strcat(out_val, _(" '-'床上,", " - for floor,"));
3999 else if (allow_inven)
4000 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4002 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4007 else if (command_wrk == (USE_FLOOR))
4009 /* Begin the prompt */
4010 sprintf(out_val, _("床上:", "Floor:"));
4014 /* Build the prompt */
4015 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4018 strcat(out_val, tmp_val);
4021 /* Indicate ability to "view" */
4022 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4026 if (allow_inven && allow_equip)
4028 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4030 else if (allow_inven)
4032 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4034 else if (allow_equip)
4036 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4040 else if (allow_inven)
4042 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4044 else if (allow_equip)
4046 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4050 if (command_see && !use_menu)
4052 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4057 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4059 /* Finish the prompt */
4060 strcat(out_val, " ESC");
4062 /* Build the prompt */
4063 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4065 /* Show the prompt */
4074 if (command_wrk == USE_INVEN) max_line = max_inven;
4075 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4076 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4092 menu_line += (max_line - 1);
4108 /* Verify legality */
4109 if (command_wrk == (USE_INVEN))
4111 if (allow_floor) command_wrk = USE_FLOOR;
4112 else if (allow_equip) command_wrk = USE_EQUIP;
4119 else if (command_wrk == (USE_EQUIP))
4121 if (allow_inven) command_wrk = USE_INVEN;
4122 else if (allow_floor) command_wrk = USE_FLOOR;
4129 else if (command_wrk == (USE_FLOOR))
4131 if (allow_equip) command_wrk = USE_EQUIP;
4132 else if (allow_inven) command_wrk = USE_INVEN;
4145 /* Hack -- Fix screen */
4152 /* Switch inven/equip */
4153 if (command_wrk == USE_INVEN) max_line = max_inven;
4154 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4155 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4156 if (menu_line > max_line) menu_line = max_line;
4158 /* Need to redraw */
4166 /* Verify legality */
4167 if (command_wrk == (USE_INVEN))
4169 if (allow_equip) command_wrk = USE_EQUIP;
4170 else if (allow_floor) command_wrk = USE_FLOOR;
4177 else if (command_wrk == (USE_EQUIP))
4179 if (allow_floor) command_wrk = USE_FLOOR;
4180 else if (allow_inven) command_wrk = USE_INVEN;
4187 else if (command_wrk == (USE_FLOOR))
4189 if (allow_inven) command_wrk = USE_INVEN;
4190 else if (allow_equip) command_wrk = USE_EQUIP;
4203 /* Hack -- Fix screen */
4210 /* Switch inven/equip */
4211 if (command_wrk == USE_INVEN) max_line = max_inven;
4212 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4213 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4214 if (menu_line > max_line) menu_line = max_line;
4216 /* Need to redraw */
4225 if (command_wrk == USE_FLOOR)
4228 (*cp) = -get_item_label;
4232 /* Validate the item */
4233 if (!get_item_okay(get_item_label))
4239 /* Allow player to "refuse" certain actions */
4240 if (!get_item_allow(get_item_label))
4246 /* Accept that choice */
4247 (*cp) = get_item_label;
4264 if (menu_line > max_line) menu_line -= max_line;
4285 command_see = FALSE;
4306 grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
4308 if (command_wrk != (USE_FLOOR)) break;
4310 /* Get the object being moved. */
4311 o_idx = g_ptr->o_idx;
4313 /* Only rotate a pile of two or more objects. */
4314 if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
4316 /* Remove the first object from the list. */
4317 excise_object_idx(o_idx);
4319 /* Find end of the list. */
4321 while (current_floor_ptr->o_list[i].next_o_idx)
4322 i = current_floor_ptr->o_list[i].next_o_idx;
4324 /* Add after the last object. */
4325 current_floor_ptr->o_list[i].next_o_idx = o_idx;
4327 /* Re-scan floor list */
4328 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4330 /* Hack -- Fix screen */
4342 if (command_wrk == (USE_INVEN))
4349 command_wrk = (USE_EQUIP);
4351 else if (command_wrk == (USE_EQUIP))
4358 command_wrk = (USE_INVEN);
4360 else if (command_wrk == (USE_FLOOR))
4364 command_wrk = (USE_INVEN);
4366 else if (allow_equip)
4368 command_wrk = (USE_EQUIP);
4377 /* Hack -- Fix screen */
4384 /* Need to redraw */
4397 * If we are already examining the floor, and there
4398 * is only one item, we will always select it.
4399 * If we aren't examining the floor and there is only
4400 * one item, we will select it if floor_query_flag
4405 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4408 k = 0 - floor_list[0];
4410 /* Allow player to "refuse" certain actions */
4411 if (!get_item_allow(k))
4417 /* Accept that choice */
4426 /* Hack -- Fix screen */
4433 command_wrk = (USE_FLOOR);
4439 case '1': case '2': case '3':
4440 case '4': case '5': case '6':
4441 case '7': case '8': case '9':
4443 if (command_wrk != USE_FLOOR)
4445 /* Look up the tag */
4446 if (!get_tag(&k, which, command_wrk))
4452 /* Hack -- Validate the item */
4453 if ((k < INVEN_RARM) ? !inven : !equip)
4459 /* Validate the item */
4460 if (!get_item_okay(k))
4468 /* Look up the alphabetical tag */
4469 if (get_tag_floor(&k, which, floor_list, floor_num))
4472 k = 0 - floor_list[k];
4481 /* Allow player to "refuse" certain actions */
4482 if (!get_item_allow(k))
4488 /* Accept that choice */
4500 /* Choose "default" inventory item */
4501 if (command_wrk == (USE_INVEN))
4503 k = ((i1 == i2) ? i1 : -1);
4506 /* Choose "default" equipment item */
4507 else if (command_wrk == (USE_EQUIP))
4509 k = ((e1 == e2) ? e1 : -1);
4512 /* Choose "default" floor item */
4513 else if (command_wrk == (USE_FLOOR))
4518 k = 0 - floor_list[0];
4520 /* Allow player to "refuse" certain actions */
4521 if (!get_item_allow(k))
4527 /* Accept that choice */
4535 /* Validate the item */
4536 if (!get_item_okay(k))
4542 /* Allow player to "refuse" certain actions */
4543 if (!get_item_allow(k))
4549 /* Accept that choice */
4573 if (command_wrk != USE_FLOOR)
4575 bool not_found = FALSE;
4577 /* Look up the alphabetical tag */
4578 if (!get_tag(&k, which, command_wrk))
4583 /* Hack -- Validate the item */
4584 else if ((k < INVEN_RARM) ? !inven : !equip)
4589 /* Validate the item */
4590 else if (!get_item_okay(k))
4597 /* Accept that choice */
4607 /* Look up the alphabetical tag */
4608 if (get_tag_floor(&k, which, floor_list, floor_num))
4611 k = 0 - floor_list[k];
4613 /* Accept that choice */
4622 /* Extract "query" setting */
4623 ver = isupper(which);
4624 which = (char)tolower(which);
4626 /* Convert letter to inventory index */
4627 if (command_wrk == (USE_INVEN))
4629 if (which == '(') k = i1;
4630 else if (which == ')') k = i2;
4631 else k = label_to_inven(which);
4634 /* Convert letter to equipment index */
4635 else if (command_wrk == (USE_EQUIP))
4637 if (which == '(') k = e1;
4638 else if (which == ')') k = e2;
4639 else k = label_to_equip(which);
4642 /* Convert letter to floor index */
4643 else if (command_wrk == USE_FLOOR)
4645 if (which == '(') k = 0;
4646 else if (which == ')') k = floor_num - 1;
4647 else k = islower(which) ? A2I(which) : -1;
4648 if (k < 0 || k >= floor_num || k >= 23)
4655 k = 0 - floor_list[k];
4658 /* Validate the item */
4659 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4665 /* Verify the item */
4666 if (ver && !verify(_("本当に", "Try"), k))
4672 /* Allow player to "refuse" certain actions */
4673 if (!get_item_allow(k))
4679 /* Accept that choice */
4689 /* Fix the screen if necessary */
4694 /* Hack -- Cancel "display" */
4695 command_see = FALSE;
4699 /* Forget the item_tester_tval restriction */
4700 item_tester_tval = 0;
4702 /* Forget the item_tester_hook restriction */
4703 item_tester_hook = NULL;
4706 /* Clean up 'show choices' */
4707 /* Toggle again if needed */
4708 if (toggle) toggle_inven_equip();
4710 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4713 /* Clear the prompt line */
4716 /* Warning if needed */
4717 if (oops && str) msg_print(str);
4722 if (command_cmd) prev_tag = cur_tag;
4723 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4729 * @brief 床上のアイテムを拾う選択用サブルーチン
4730 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4732 static bool py_pickup_floor_aux(void)
4734 OBJECT_IDX this_o_idx;
4738 /* Restrict the choices */
4739 item_tester_hook = inven_carry_okay;
4742 q = _("どれを拾いますか?", "Get which item? ");
4743 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4745 if (choose_object(&item, q, s, (USE_FLOOR)))
4747 this_o_idx = 0 - item;
4754 /* Pick up the object */
4755 py_pickup_aux(this_o_idx);
4761 * @brief 床上のアイテムを拾うメイン処理
4762 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4765 * This is called by py_pickup() when easy_floor is TRUE.
4767 void py_pickup_floor(bool pickup)
4769 OBJECT_IDX this_o_idx, next_o_idx = 0;
4771 GAME_TEXT o_name[MAX_NLEN];
4775 OBJECT_IDX floor_o_idx = 0;
4779 /* Scan the pile of objects */
4780 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)
4782 /* Access the object */
4783 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
4785 object_desc(o_name, o_ptr, 0);
4787 /* Access the next object */
4788 next_o_idx = o_ptr->next_o_idx;
4790 disturb(FALSE, FALSE);
4793 if (o_ptr->tval == TV_GOLD)
4796 msg_format(" $%ld の価値がある%sを見つけた。",
4797 (long)o_ptr->pval, o_name);
4799 msg_format("You have found %ld gold pieces worth of %s.",
4800 (long)o_ptr->pval, o_name);
4803 /* Collect the gold */
4804 p_ptr->au += o_ptr->pval;
4807 p_ptr->redraw |= (PR_GOLD);
4809 p_ptr->window |= (PW_PLAYER);
4811 /* Delete the gold */
4812 delete_object_idx(this_o_idx);
4814 /* Check the next object */
4817 else if (o_ptr->marked & OM_NOMSG)
4819 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4820 * ignored. Otherwise, they are included in the prompt. */
4821 o_ptr->marked &= ~(OM_NOMSG);
4825 /* Count non-gold objects that can be picked up. */
4826 if (inven_carry_okay(o_ptr))
4831 /* Count non-gold objects */
4834 /* Remember this index */
4835 floor_o_idx = this_o_idx;
4838 /* There are no non-gold objects */
4842 /* Mention the number of objects */
4848 /* Access the object */
4849 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4851 #ifdef ALLOW_EASY_SENSE
4853 /* Option: Make object sensing easy */
4856 /* Sense the object */
4857 (void) sense_object(o_ptr);
4860 #endif /* ALLOW_EASY_SENSE */
4862 object_desc(o_name, o_ptr, 0);
4864 msg_format(_("%sがある。", "You see %s."), o_name);
4867 /* Multiple objects */
4870 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4876 /* The player has no room for anything on the floor. */
4882 /* Access the object */
4883 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4885 #ifdef ALLOW_EASY_SENSE
4887 /* Option: Make object sensing easy */
4890 /* Sense the object */
4891 (void) sense_object(o_ptr);
4894 #endif /* ALLOW_EASY_SENSE */
4896 object_desc(o_name, o_ptr, 0);
4898 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4901 /* Multiple objects */
4904 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4914 /* Hack -- query every object */
4915 if (carry_query_flag)
4917 char out_val[MAX_NLEN+20];
4919 /* Access the object */
4920 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4922 #ifdef ALLOW_EASY_SENSE
4924 /* Option: Make object sensing easy */
4927 /* Sense the object */
4928 (void) sense_object(o_ptr);
4931 #endif /* ALLOW_EASY_SENSE */
4933 object_desc(o_name, o_ptr, 0);
4935 /* Build a prompt */
4936 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
4938 /* Ask the user to confirm */
4939 if (!get_check(out_val))
4945 /* Access the object */
4946 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4948 #ifdef ALLOW_EASY_SENSE
4950 /* Option: Make object sensing easy */
4953 /* Sense the object */
4954 (void) sense_object(o_ptr);
4957 #endif /* ALLOW_EASY_SENSE */
4959 /* Pick up the object */
4960 py_pickup_aux(floor_o_idx);
4963 /* Allow the user to choose an object */
4966 while (can_pickup--)
4968 if (!py_pickup_floor_aux()) break;
4975 * @brief 矢弾を射撃した場合の破損確率を返す /
4976 * Determines the odds of an object breaking when thrown at a monster
4977 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
4980 * Note that artifacts never break, see the "drop_near()" function.
4982 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
4984 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
4986 /* Examine the snipe type */
4989 if (snipe_type == SP_KILL_WALL) return (100);
4990 if (snipe_type == SP_EXPLODE) return (100);
4991 if (snipe_type == SP_PIERCE) return (100);
4992 if (snipe_type == SP_FINAL) return (100);
4993 if (snipe_type == SP_NEEDLE) return (100);
4994 if (snipe_type == SP_EVILNESS) return (40);
4995 if (snipe_type == SP_HOLYNESS) return (40);
4998 /* Examine the item type */
4999 switch (o_ptr->tval)
5015 /* Sometimes break */
5020 return (20 - archer_bonus * 2);
5025 return (10 - archer_bonus);