3 * @brief オブジェクトの実装 / Object code, part 1
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2014 Deskull rearranged comment for Doxygen.\n
16 #include "cmd-activate.h"
17 #include "object-hook.h"
18 #include "player-move.h"
20 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
27 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
29 * This involves resetting various things to their "default" state.\n
31 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
32 * "user pref file" based on the current setting of the "use_graphics"\n
33 * flag. This is useful for switching "graphics" on/off.\n
35 * The features, objects, and monsters, should all be encoded in the\n
36 * relevant "font.pref" and/or "graf.prf" files. \n
38 * The "prefs" parameter is no longer meaningful. \n
40 void reset_visuals(void)
44 /* Extract some info about terrain features */
45 for (i = 0; i < max_f_idx; i++)
47 feature_type *f_ptr = &f_info[i];
49 /* Assume we will use the underlying values */
50 for (j = 0; j < F_LIT_MAX; j++)
52 f_ptr->x_attr[j] = f_ptr->d_attr[j];
53 f_ptr->x_char[j] = f_ptr->d_char[j];
57 /* Extract default attr/char code for objects */
58 for (i = 0; i < max_k_idx; i++)
60 object_kind *k_ptr = &k_info[i];
62 /* Default attr/char */
63 k_ptr->x_attr = k_ptr->d_attr;
64 k_ptr->x_char = k_ptr->d_char;
67 /* Extract default attr/char code for monsters */
68 for (i = 0; i < max_r_idx; i++)
70 monster_race *r_ptr = &r_info[i];
72 /* Default attr/char */
73 r_ptr->x_attr = r_ptr->d_attr;
74 r_ptr->x_char = r_ptr->d_char;
81 /* Process "graf.prf" */
82 process_pref_file("graf.prf");
84 /* Access the "character" pref file */
85 sprintf(buf, "graf-%s.prf", player_base);
87 /* Process "graf-<playername>.prf" */
88 process_pref_file(buf);
96 /* Process "font.prf" */
97 process_pref_file("font.prf");
99 /* Access the "character" pref file */
100 sprintf(buf, "font-%s.prf", player_base);
102 /* Process "font-<playername>.prf" */
103 process_pref_file(buf);
108 * @brief オブジェクトのフラグ類を配列に与える
109 * Obtain the "flags" for an item
110 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
111 * @param flgs フラグ情報を受け取る配列
114 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
116 object_kind *k_ptr = &k_info[o_ptr->k_idx];
120 for (i = 0; i < TR_FLAG_SIZE; i++)
121 flgs[i] = k_ptr->flags[i];
124 if (object_is_fixed_artifact(o_ptr))
126 artifact_type *a_ptr = &a_info[o_ptr->name1];
128 for (i = 0; i < TR_FLAG_SIZE; i++)
129 flgs[i] = a_ptr->flags[i];
133 if (object_is_ego(o_ptr))
135 ego_item_type *e_ptr = &e_info[o_ptr->name2];
137 for (i = 0; i < TR_FLAG_SIZE; i++)
138 flgs[i] |= e_ptr->flags[i];
140 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
142 remove_flag(flgs, TR_SH_FIRE);
144 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
146 remove_flag(flgs, TR_INFRA);
148 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
150 remove_flag(flgs, TR_RES_BLIND);
151 remove_flag(flgs, TR_SEE_INVIS);
155 /* Random artifact ! */
156 for (i = 0; i < TR_FLAG_SIZE; i++)
157 flgs[i] |= o_ptr->art_flags[i];
159 if (object_is_smith(o_ptr))
161 int add = o_ptr->xtra3 - 1;
163 if (add < TR_FLAG_MAX)
167 else if (add == ESSENCE_TMP_RES_ACID)
169 add_flag(flgs, TR_RES_ACID);
170 add_flag(flgs, TR_ACTIVATE);
172 else if (add == ESSENCE_TMP_RES_ELEC)
174 add_flag(flgs, TR_RES_ELEC);
175 add_flag(flgs, TR_ACTIVATE);
177 else if (add == ESSENCE_TMP_RES_FIRE)
179 add_flag(flgs, TR_RES_FIRE);
180 add_flag(flgs, TR_ACTIVATE);
182 else if (add == ESSENCE_TMP_RES_COLD)
184 add_flag(flgs, TR_RES_COLD);
185 add_flag(flgs, TR_ACTIVATE);
187 else if (add == ESSENCE_SH_FIRE)
189 add_flag(flgs, TR_RES_FIRE);
190 add_flag(flgs, TR_SH_FIRE);
192 else if (add == ESSENCE_SH_ELEC)
194 add_flag(flgs, TR_RES_ELEC);
195 add_flag(flgs, TR_SH_ELEC);
197 else if (add == ESSENCE_SH_COLD)
199 add_flag(flgs, TR_RES_COLD);
200 add_flag(flgs, TR_SH_COLD);
202 else if (add == ESSENCE_RESISTANCE)
204 add_flag(flgs, TR_RES_ACID);
205 add_flag(flgs, TR_RES_ELEC);
206 add_flag(flgs, TR_RES_FIRE);
207 add_flag(flgs, TR_RES_COLD);
209 else if (add == TR_IMPACT)
211 add_flag(flgs, TR_ACTIVATE);
217 * @brief オブジェクトの明示されているフラグ類を取得する
218 * Obtain the "flags" for an item which are known to the player
219 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
220 * @param flgs フラグ情報を受け取る配列
223 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
228 object_kind *k_ptr = &k_info[o_ptr->k_idx];
231 for (i = 0; i < TR_FLAG_SIZE; i++)
234 if (!object_is_aware(o_ptr)) return;
237 for (i = 0; i < TR_FLAG_SIZE; i++)
238 flgs[i] = k_ptr->flags[i];
240 /* Must be identified */
241 if (!object_is_known(o_ptr)) return;
243 /* Ego-item (known basic flags) */
244 if (object_is_ego(o_ptr))
246 ego_item_type *e_ptr = &e_info[o_ptr->name2];
248 for (i = 0; i < TR_FLAG_SIZE; i++)
249 flgs[i] |= e_ptr->flags[i];
251 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
253 remove_flag(flgs, TR_SH_FIRE);
255 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
257 remove_flag(flgs, TR_INFRA);
259 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
261 remove_flag(flgs, TR_RES_BLIND);
262 remove_flag(flgs, TR_SEE_INVIS);
267 #ifdef SPOIL_ARTIFACTS
268 /* Full knowledge for some artifacts */
269 if (object_is_artifact(o_ptr)) spoil = TRUE;
270 #endif /* SPOIL_ARTIFACTS */
272 #ifdef SPOIL_EGO_ITEMS
273 /* Full knowledge for some ego-items */
274 if (object_is_ego(o_ptr)) spoil = TRUE;
275 #endif /* SPOIL_EGO_ITEMS */
277 /* Need full knowledge or spoilers */
278 if (spoil || (o_ptr->ident & IDENT_MENTAL))
281 if (object_is_fixed_artifact(o_ptr))
283 artifact_type *a_ptr = &a_info[o_ptr->name1];
285 for (i = 0; i < TR_FLAG_SIZE; i++)
286 flgs[i] = a_ptr->flags[i];
289 /* Random artifact ! */
290 for (i = 0; i < TR_FLAG_SIZE; i++)
291 flgs[i] |= o_ptr->art_flags[i];
294 if (object_is_smith(o_ptr))
296 int add = o_ptr->xtra3 - 1;
298 if (add < TR_FLAG_MAX)
302 else if (add == ESSENCE_TMP_RES_ACID)
304 add_flag(flgs, TR_RES_ACID);
306 else if (add == ESSENCE_TMP_RES_ELEC)
308 add_flag(flgs, TR_RES_ELEC);
310 else if (add == ESSENCE_TMP_RES_FIRE)
312 add_flag(flgs, TR_RES_FIRE);
314 else if (add == ESSENCE_TMP_RES_COLD)
316 add_flag(flgs, TR_RES_COLD);
318 else if (add == ESSENCE_SH_FIRE)
320 add_flag(flgs, TR_RES_FIRE);
321 add_flag(flgs, TR_SH_FIRE);
323 else if (add == ESSENCE_SH_ELEC)
325 add_flag(flgs, TR_RES_ELEC);
326 add_flag(flgs, TR_SH_ELEC);
328 else if (add == ESSENCE_SH_COLD)
330 add_flag(flgs, TR_RES_COLD);
331 add_flag(flgs, TR_SH_COLD);
333 else if (add == ESSENCE_RESISTANCE)
335 add_flag(flgs, TR_RES_ACID);
336 add_flag(flgs, TR_RES_ELEC);
337 add_flag(flgs, TR_RES_FIRE);
338 add_flag(flgs, TR_RES_COLD);
344 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
345 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
346 * @return concptr 発動名称を返す文字列ポインタ
348 static concptr item_activation_dragon_breath(object_type *o_ptr)
350 static char desc[256];
351 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
354 object_flags(o_ptr, flgs);
355 strcpy(desc, _("", "breath "));
357 for (i = 0; dragonbreath_info[i].flag != 0; i++)
359 if (have_flag(flgs, dragonbreath_info[i].flag))
361 if (n > 0) strcat(desc, _("、", ", "));
362 strcat(desc, dragonbreath_info[i].name);
367 strcat(desc, _("のブレス(250)", ""));
373 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
374 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
375 * @return concptr 発動名称を返す文字列ポインタ
377 static concptr item_activation_aux(object_type *o_ptr)
379 static char activation_detail[256];
383 const activation_type* const act_ptr = find_activation_info(o_ptr);
385 if (!act_ptr) return _("未定義", "something undefined");
387 desc = act_ptr->desc;
389 /* Overwrite description if it is special */
390 switch (act_ptr->index) {
392 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
393 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
396 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
397 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
400 desc = item_activation_dragon_breath(o_ptr);
403 if (o_ptr->name1 == ART_HYOUSIGI)
404 desc = _("拍子木を打ちならす", "beat wooden clappers");
406 case ACT_RESIST_ACID:
407 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
408 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
410 case ACT_RESIST_FIRE:
411 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
412 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
414 case ACT_RESIST_COLD:
415 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
416 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
418 case ACT_RESIST_ELEC:
419 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
420 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
422 case ACT_RESIST_POIS:
423 if (o_ptr->name2 == EGO_BRAND_POIS)
424 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
428 /* Timeout description */
429 constant = act_ptr->timeout.constant;
430 dice = act_ptr->timeout.dice;
431 if (constant == 0 && dice == 0) {
432 /* We can activate it every turn */
433 strcpy(timeout, _("いつでも", "every turn"));
434 } else if (constant < 0) {
435 /* Activations that have special timeout */
436 switch (act_ptr->index) {
438 sprintf(timeout, _("%d ターン毎", "every %d turns"),
439 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
442 sprintf(timeout, _("%d ターン毎", "every %d turns"),
443 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
446 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
449 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
452 strcpy(timeout, "undefined");
456 /* Normal timeout activations */
457 char constant_str[16], dice_str[16];
458 sprintf(constant_str, "%d", constant);
459 sprintf(dice_str, "d%d", dice);
460 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
461 (constant > 0) ? constant_str : "",
462 (constant > 0 && dice > 0) ? "+" : "",
463 (dice > 0) ? dice_str : "");
466 /* Build detail activate description */
467 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
469 return activation_detail;
473 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
474 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
475 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
476 * @return concptr 発動名称を返す文字列ポインタ
478 concptr item_activation(object_type *o_ptr)
480 BIT_FLAGS flgs[TR_FLAG_SIZE];
481 object_flags(o_ptr, flgs);
483 /* Require activation ability */
484 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
486 /* Get an explain of an activation */
487 if (activation_index(o_ptr))
489 return item_activation_aux(o_ptr);
493 if (o_ptr->tval == TV_WHISTLE)
495 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
498 if (o_ptr->tval == TV_CAPTURE)
500 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
503 return _("何も起きない", "Nothing");
508 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
509 * Describe a "fully identified" item
510 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
511 * @param mode 表示オプション
512 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
514 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
518 BIT_FLAGS flgs[TR_FLAG_SIZE];
522 GAME_TEXT o_name[MAX_NLEN];
527 int trivial_info = 0;
528 object_flags(o_ptr, flgs);
530 /* Extract the description */
532 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
533 (k_text + k_info[o_ptr->k_idx].text),
534 77 - 15, temp, sizeof(temp));
535 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
536 { info[i] = &temp[j]; i++;}
539 if (object_is_equipment(o_ptr))
541 /* Descriptions of a basic equipment is just a flavor */
545 /* Mega-Hack -- describe activation */
546 if (have_flag(flgs, TR_ACTIVATE))
548 info[i++] = _("始動したときの効果...", "It can be activated for...");
549 info[i++] = item_activation(o_ptr);
550 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
553 /* Figurines, a hack */
554 if (o_ptr->tval == TV_FIGURINE)
556 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
559 /* Figurines, a hack */
560 if (o_ptr->name1 == ART_STONEMASK)
562 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you turn into a vampire permanently.");
565 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
567 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
570 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
572 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
573 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
576 if (o_ptr->name2 == EGO_2WEAPON)
578 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
581 if (have_flag(flgs, TR_EASY_SPELL))
583 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
586 if (o_ptr->name2 == EGO_AMU_FOOL)
588 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
591 if (o_ptr->name2 == EGO_RING_THROW)
593 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
596 if (o_ptr->name2 == EGO_AMU_NAIVETY)
598 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
601 if (o_ptr->tval == TV_STATUE)
603 monster_race *r_ptr = &r_info[o_ptr->pval];
605 if (o_ptr->pval == MON_BULLGATES)
606 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
607 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
608 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
610 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
613 /* Hack -- describe lite's */
615 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
618 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
619 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
620 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
621 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
622 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
623 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
625 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
627 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
629 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
633 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
634 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
637 if(rad != 0) info[i++] = desc;
640 if (o_ptr->name2 == EGO_LITE_LONG)
642 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
645 /* And then describe it fully */
647 if (have_flag(flgs, TR_RIDING))
649 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
650 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
653 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
654 /* This information is not important enough */
658 if (have_flag(flgs, TR_STR))
660 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
662 if (have_flag(flgs, TR_INT))
664 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
666 if (have_flag(flgs, TR_WIS))
668 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
670 if (have_flag(flgs, TR_DEX))
672 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
674 if (have_flag(flgs, TR_CON))
676 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
678 if (have_flag(flgs, TR_CHR))
680 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
683 if (have_flag(flgs, TR_MAGIC_MASTERY))
685 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
688 if (have_flag(flgs, TR_STEALTH))
690 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
692 if (have_flag(flgs, TR_SEARCH))
694 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
696 if (have_flag(flgs, TR_INFRA))
698 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
700 if (have_flag(flgs, TR_TUNNEL))
702 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
704 if (have_flag(flgs, TR_SPEED))
706 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
708 if (have_flag(flgs, TR_BLOWS))
710 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
713 if (have_flag(flgs, TR_BRAND_ACID))
715 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
717 if (have_flag(flgs, TR_BRAND_ELEC))
719 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
721 if (have_flag(flgs, TR_BRAND_FIRE))
723 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
725 if (have_flag(flgs, TR_BRAND_COLD))
727 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
730 if (have_flag(flgs, TR_BRAND_POIS))
732 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
735 if (have_flag(flgs, TR_CHAOTIC))
737 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
740 if (have_flag(flgs, TR_VAMPIRIC))
742 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
745 if (have_flag(flgs, TR_IMPACT))
747 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
750 if (have_flag(flgs, TR_VORPAL))
752 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
755 if (have_flag(flgs, TR_KILL_DRAGON))
757 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
759 else if (have_flag(flgs, TR_SLAY_DRAGON))
761 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
764 if (have_flag(flgs, TR_KILL_ORC))
766 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
768 if (have_flag(flgs, TR_SLAY_ORC))
770 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
773 if (have_flag(flgs, TR_KILL_TROLL))
775 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
777 if (have_flag(flgs, TR_SLAY_TROLL))
779 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
782 if (have_flag(flgs, TR_KILL_GIANT))
784 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
786 else if (have_flag(flgs, TR_SLAY_GIANT))
788 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
791 if (have_flag(flgs, TR_KILL_DEMON))
793 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
795 if (have_flag(flgs, TR_SLAY_DEMON))
797 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
800 if (have_flag(flgs, TR_KILL_UNDEAD))
802 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
804 if (have_flag(flgs, TR_SLAY_UNDEAD))
806 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
809 if (have_flag(flgs, TR_KILL_EVIL))
811 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
813 if (have_flag(flgs, TR_SLAY_EVIL))
815 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
818 if (have_flag(flgs, TR_KILL_ANIMAL))
820 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
822 if (have_flag(flgs, TR_SLAY_ANIMAL))
824 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
827 if (have_flag(flgs, TR_KILL_HUMAN))
829 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
831 if (have_flag(flgs, TR_SLAY_HUMAN))
833 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
836 if (have_flag(flgs, TR_FORCE_WEAPON))
838 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
840 if (have_flag(flgs, TR_DEC_MANA))
842 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
844 if (have_flag(flgs, TR_SUST_STR))
846 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
848 if (have_flag(flgs, TR_SUST_INT))
850 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
852 if (have_flag(flgs, TR_SUST_WIS))
854 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
856 if (have_flag(flgs, TR_SUST_DEX))
858 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
860 if (have_flag(flgs, TR_SUST_CON))
862 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
864 if (have_flag(flgs, TR_SUST_CHR))
866 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
869 if (have_flag(flgs, TR_IM_ACID))
871 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
873 if (have_flag(flgs, TR_IM_ELEC))
875 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
877 if (have_flag(flgs, TR_IM_FIRE))
879 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
881 if (have_flag(flgs, TR_IM_COLD))
883 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
886 if (have_flag(flgs, TR_THROW))
888 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
891 if (have_flag(flgs, TR_FREE_ACT))
893 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
895 if (have_flag(flgs, TR_HOLD_EXP))
897 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
899 if (have_flag(flgs, TR_RES_FEAR))
901 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
903 if (have_flag(flgs, TR_RES_ACID))
905 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
907 if (have_flag(flgs, TR_RES_ELEC))
909 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
911 if (have_flag(flgs, TR_RES_FIRE))
913 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
915 if (have_flag(flgs, TR_RES_COLD))
917 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
919 if (have_flag(flgs, TR_RES_POIS))
921 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
924 if (have_flag(flgs, TR_RES_LITE))
926 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
928 if (have_flag(flgs, TR_RES_DARK))
930 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
933 if (have_flag(flgs, TR_RES_BLIND))
935 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
937 if (have_flag(flgs, TR_RES_CONF))
939 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
941 if (have_flag(flgs, TR_RES_SOUND))
943 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
945 if (have_flag(flgs, TR_RES_SHARDS))
947 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
950 if (have_flag(flgs, TR_RES_NETHER))
952 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
954 if (have_flag(flgs, TR_RES_NEXUS))
956 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
958 if (have_flag(flgs, TR_RES_CHAOS))
960 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
962 if (have_flag(flgs, TR_RES_DISEN))
964 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
967 if (have_flag(flgs, TR_LEVITATION))
969 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
972 if (have_flag(flgs, TR_SEE_INVIS))
974 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
976 if (have_flag(flgs, TR_TELEPATHY))
978 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
980 if (have_flag(flgs, TR_ESP_ANIMAL))
982 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
984 if (have_flag(flgs, TR_ESP_UNDEAD))
986 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
988 if (have_flag(flgs, TR_ESP_DEMON))
990 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
992 if (have_flag(flgs, TR_ESP_ORC))
994 info[i++] = _("それはオークを感知する。", "It senses orcs.");
996 if (have_flag(flgs, TR_ESP_TROLL))
998 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1000 if (have_flag(flgs, TR_ESP_GIANT))
1002 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1004 if (have_flag(flgs, TR_ESP_DRAGON))
1006 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1008 if (have_flag(flgs, TR_ESP_HUMAN))
1010 info[i++] = _("それは人間を感知する。", "It senses humans.");
1012 if (have_flag(flgs, TR_ESP_EVIL))
1014 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1016 if (have_flag(flgs, TR_ESP_GOOD))
1018 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1020 if (have_flag(flgs, TR_ESP_NONLIVING))
1022 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1024 if (have_flag(flgs, TR_ESP_UNIQUE))
1026 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1028 if (have_flag(flgs, TR_SLOW_DIGEST))
1030 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1032 if (have_flag(flgs, TR_REGEN))
1034 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1036 if (have_flag(flgs, TR_WARNING))
1038 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1040 if (have_flag(flgs, TR_REFLECT))
1042 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1044 if (have_flag(flgs, TR_SH_FIRE))
1046 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1048 if (have_flag(flgs, TR_SH_ELEC))
1050 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1052 if (have_flag(flgs, TR_SH_COLD))
1054 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1056 if (have_flag(flgs, TR_NO_MAGIC))
1058 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1060 if (have_flag(flgs, TR_NO_TELE))
1062 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1064 if (have_flag(flgs, TR_XTRA_MIGHT))
1066 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1068 if (have_flag(flgs, TR_XTRA_SHOTS))
1070 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1073 if (have_flag(flgs, TR_BLESSED))
1075 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1078 if (object_is_cursed(o_ptr))
1080 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1082 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1084 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1086 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1090 info[i++] = _("それは呪われている。", "It is cursed.");
1093 * It's a trivial infomation since there is
1094 * fake inscription {cursed}
1100 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1102 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1104 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1106 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1108 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1110 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1112 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1114 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1116 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1118 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1120 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1122 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1124 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1126 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1128 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1130 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1132 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1134 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1136 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1138 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1140 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1142 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1144 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1146 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1148 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1150 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1152 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1154 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1156 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1158 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1160 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1162 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1164 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1166 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1168 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1170 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1173 /* Describe about this kind of object instead of THIS fake object */
1174 if (mode & SCROBJ_FAKE_OBJECT)
1176 switch (o_ptr->tval)
1179 switch (o_ptr->sval)
1181 case SV_RING_LORDLY:
1182 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1184 case SV_RING_WARNING:
1185 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1191 switch (o_ptr->sval)
1193 case SV_AMULET_RESISTANCE:
1194 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1195 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1197 case SV_AMULET_THE_MAGI:
1198 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1205 if (have_flag(flgs, TR_IGNORE_ACID) &&
1206 have_flag(flgs, TR_IGNORE_ELEC) &&
1207 have_flag(flgs, TR_IGNORE_FIRE) &&
1208 have_flag(flgs, TR_IGNORE_COLD))
1210 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1214 if (have_flag(flgs, TR_IGNORE_ACID))
1216 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1218 if (have_flag(flgs, TR_IGNORE_ELEC))
1220 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1222 if (have_flag(flgs, TR_IGNORE_FIRE))
1224 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1226 if (have_flag(flgs, TR_IGNORE_COLD))
1228 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1232 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1234 /* No relevant informations */
1235 if (i <= trivial_info) return (FALSE);
1238 Term_get_size(&wid, &hgt);
1240 /* Display Item name */
1241 if (!(mode & SCROBJ_FAKE_OBJECT))
1242 object_desc(o_name, o_ptr, 0);
1244 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1248 /* Erase the screen */
1249 for (k = 1; k < hgt; k++) prt("", k, 13);
1251 /* Label the information */
1252 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1254 monster_race *r_ptr = &r_info[o_ptr->pval];
1255 int namelen = strlen(r_name + r_ptr->name);
1256 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1257 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1258 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1262 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1265 /* We will print on top of the map (column 13) */
1266 for (k = 2, j = 0; j < i; j++)
1269 prt(info[j], k++, 15);
1271 /* Every 20 entries (lines 2 to 21), start over */
1272 if ((k == hgt - 2) && (j+1 < i))
1274 prt(_("-- 続く --", "-- more --"), k, 15);
1276 for (; k > 2; k--) prt("", k, 15);
1281 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1286 /* Gave knowledge */
1293 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1294 * Convert an inventory index into a one character label
1295 * @param i プレイヤーの所持/装備オブジェクトID
1296 * @return 対応するアルファベット
1297 * @details Note that the label does NOT distinguish inven/equip.
1299 char index_to_label(int i)
1301 /* Indexes for "inven" are easy */
1302 if (i < INVEN_RARM) return (I2A(i));
1304 /* Indexes for "equip" are offset */
1305 return (I2A(i - INVEN_RARM));
1309 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1310 * Convert a label into the index of an item in the "inven"
1311 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1312 * @details Note that the label does NOT distinguish inven/equip.
1314 INVENTORY_IDX label_to_inven(int c)
1319 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1321 /* Verify the index */
1322 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1324 /* Empty slots can never be chosen */
1325 if (!inventory[i].k_idx) return (-1);
1327 /* Return the index */
1333 extern bool select_ring_slot;
1337 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1338 * @param i プレイヤーの所持/装備オブジェクトID
1339 * @return 指輪枠ならばTRUEを返す。
1341 static bool is_ring_slot(int i)
1343 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1348 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1349 * Convert a label into the index of a item in the "equip"
1350 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1352 INVENTORY_IDX label_to_equip(int c)
1357 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1359 /* Verify the index */
1360 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1362 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1364 /* Empty slots can never be chosen */
1365 if (!inventory[i].k_idx) return (-1);
1367 /* Return the index */
1374 * @brief オブジェクトの該当装備部位IDを返す /
1375 * Determine which equipment slot (if any) an item likes
1376 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1377 * @return 対応する装備部位ID
1379 s16b wield_slot(object_type *o_ptr)
1381 /* Slot for equipment */
1382 switch (o_ptr->tval)
1389 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1390 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1391 return (INVEN_LARM);
1398 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1399 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1400 return (INVEN_RARM);
1410 /* Use the right hand first */
1411 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1413 /* Use the left hand for swapping (by default) */
1414 return (INVEN_LEFT);
1420 return (INVEN_NECK);
1425 return (INVEN_LITE);
1432 return (INVEN_BODY);
1437 return (INVEN_OUTER);
1443 return (INVEN_HEAD);
1448 return (INVEN_HANDS);
1453 return (INVEN_FEET);
1457 /* No slot available */
1462 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1463 * Return a string mentioning how a given item is carried
1464 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1465 * @return 部位表現の文字列ポインタ
1467 concptr mention_use(int i)
1471 /* Examine the location */
1475 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1477 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1481 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1483 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1486 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1487 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1488 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1489 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1490 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1491 case INVEN_BODY: p = _(" 体", "On body"); break;
1492 case INVEN_OUTER: p = _("体の上", "About body"); break;
1493 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1494 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1495 case INVEN_FEET: p = _(" 足", "On feet"); break;
1496 default: p = _("ザック", "In pack"); break;
1499 /* Return the result */
1505 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1506 * Return a string describing how a given item is being worn.
1507 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1508 * @return 状態表現内容の文字列ポインタ
1510 * Currently, only used for items in the equipment, not inventory.
1512 concptr describe_use(int i)
1519 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1521 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1525 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1527 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1530 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1531 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1532 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1533 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1534 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1535 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1536 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1537 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1538 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1539 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1540 default: p = _("ザックに入っている", "carrying in your pack"); break;
1543 /* Return the result */
1549 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1550 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1551 * @param book_tval ベースアイテムのtval
1552 * @param book_sval ベースアイテムのsval
1553 * @return 使用可能な魔法書ならばTRUEを返す。
1556 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1558 if (book_tval < TV_LIFE_BOOK) return FALSE;
1559 if (p_ptr->pclass == CLASS_SORCERER)
1561 return is_magic(tval2realm(book_tval));
1563 else if (p_ptr->pclass == CLASS_RED_MAGE)
1565 if (is_magic(tval2realm(book_tval)))
1566 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1568 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1572 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1573 * Check an item against the item tester info
1574 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1575 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1577 bool item_tester_okay(object_type *o_ptr)
1579 /* Hack -- allow listing empty slots */
1580 // if (item_tester_full) return (TRUE); // TODO:DELETE
1582 /* Require an item */
1583 if (!o_ptr->k_idx) return (FALSE);
1585 /* Hack -- ignore "gold" */
1586 if (o_ptr->tval == TV_GOLD)
1589 extern bool show_gold_on_floor;
1591 if (!show_gold_on_floor) return (FALSE);
1594 /* Check the tval */
1595 if (item_tester_tval)
1597 /* Is it a spellbook? If so, we need a hack -- TY */
1598 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1599 (item_tester_tval >= TV_LIFE_BOOK))
1600 return check_book_realm(o_ptr->tval, o_ptr->sval);
1602 if (item_tester_tval != o_ptr->tval) return (FALSE);
1605 /* Check the hook */
1606 if (item_tester_hook)
1608 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1617 * @brief 所持アイテム一覧を表示する /
1618 * Choice window "shadow" of the "show_inven()" function
1621 void display_inven(void)
1623 register int i, n, z = 0;
1625 TERM_COLOR attr = TERM_WHITE;
1627 GAME_TEXT o_name[MAX_NLEN];
1630 Term_get_size(&wid, &hgt);
1632 /* Find the "final" slot */
1633 for (i = 0; i < INVEN_PACK; i++)
1635 o_ptr = &inventory[i];
1637 /* Skip non-objects */
1638 if (!o_ptr->k_idx) continue;
1644 /* Display the pack */
1645 for (i = 0; i < z; i++)
1647 /* Examine the item */
1648 o_ptr = &inventory[i];
1650 /* Start with an empty "index" */
1651 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1653 /* Is this item "acceptable"? */
1654 if (item_tester_okay(o_ptr))
1656 /* Prepare an "index" */
1657 tmp_val[0] = index_to_label(i);
1659 /* Bracket the "index" --(-- */
1663 /* Display the index (or blank space) */
1664 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1666 /* Obtain an item description */
1667 object_desc(o_name, o_ptr, 0);
1669 /* Obtain the length of the description */
1673 attr = tval_to_attr[o_ptr->tval % 128];
1675 /* Grey out charging items */
1681 /* Display the entry itself */
1682 Term_putstr(3, i, n, attr, o_name);
1684 /* Erase the rest of the line */
1685 Term_erase(3+n, i, 255);
1687 /* Display the weight if needed */
1690 int wgt = o_ptr->weight * o_ptr->number;
1692 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1694 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1697 prt(tmp_val, i, wid - 9);
1701 /* Erase the rest of the window */
1702 for (i = z; i < hgt; i++)
1704 /* Erase the line */
1705 Term_erase(0, i, 255);
1712 * @brief 装備アイテム一覧を表示する /
1713 * Choice window "shadow" of the "show_equip()" function
1716 void display_equip(void)
1720 TERM_COLOR attr = TERM_WHITE;
1722 GAME_TEXT o_name[MAX_NLEN];
1725 Term_get_size(&wid, &hgt);
1727 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1729 /* Examine the item */
1730 o_ptr = &inventory[i];
1732 /* Start with an empty "index" */
1733 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1735 /* Is this item "acceptable"? */
1736 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1738 /* Prepare an "index" */
1739 tmp_val[0] = index_to_label(i);
1741 /* Bracket the "index" --(-- */
1745 /* Display the index (or blank space) */
1746 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1748 /* Obtain an item description */
1749 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1751 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1756 object_desc(o_name, o_ptr, 0);
1757 attr = tval_to_attr[o_ptr->tval % 128];
1760 /* Obtain the length of the description */
1763 /* Grey out charging items */
1769 /* Display the entry itself */
1770 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1772 /* Erase the rest of the line */
1773 Term_erase(3+n, i - INVEN_RARM, 255);
1775 /* Display the weight (if needed) */
1778 int wgt = o_ptr->weight * o_ptr->number;
1780 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1782 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1785 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1788 /* Display the slot description (if needed) */
1791 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1792 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1796 /* Erase the rest of the window */
1797 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1799 /* Clear that line */
1800 Term_erase(0, i, 255);
1806 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1807 * Find the "first" inventory object with the given "tag".
1808 * @param cp 対応するタグIDを与える参照ポインタ
1809 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1810 * @param mode 所持、装備の切り替え
1811 * @return タグに該当するオブジェクトがあるならTRUEを返す
1813 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1814 * inscription of an object. Alphabetical characters don't work as a\n
1815 * tag in this form.\n
1817 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1818 * and "x" is the "current" command_cmd code.\n
1820 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1823 COMMAND_CODE start, end;
1826 /* Extract index from mode */
1831 end = INVEN_TOTAL - 1;
1836 end = INVEN_PACK - 1;
1843 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1845 /* Check every inventory object */
1846 for (i = start; i <= end; i++)
1848 object_type *o_ptr = &inventory[i];
1850 /* Skip non-objects */
1851 if (!o_ptr->k_idx) continue;
1853 /* Skip empty inscriptions */
1854 if (!o_ptr->inscription) continue;
1856 /* Skip non-choice */
1857 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1860 s = my_strchr(quark_str(o_ptr->inscription), '@');
1862 /* Process all tags */
1865 /* Check the special tags */
1866 if ((s[1] == command_cmd) && (s[2] == tag))
1868 /* Save the actual inventory ID */
1875 /* Find another '@' */
1876 s = my_strchr(s + 1, '@');
1881 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1883 /* Don't allow {@#} with '#' being alphabet */
1884 if (tag < '0' || '9' < tag)
1890 /* Check every object */
1891 for (i = start; i <= end; i++)
1893 object_type *o_ptr = &inventory[i];
1895 /* Skip non-objects */
1896 if (!o_ptr->k_idx) continue;
1898 /* Skip empty inscriptions */
1899 if (!o_ptr->inscription) continue;
1901 /* Skip non-choice */
1902 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1905 s = my_strchr(quark_str(o_ptr->inscription), '@');
1907 /* Process all tags */
1910 /* Check the normal tags */
1913 /* Save the actual inventory ID */
1920 /* Find another '@' */
1921 s = my_strchr(s + 1, '@');
1931 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1932 * Find the "first" inventory object with the given "tag".
1933 * @param cp 対応するタグIDを与える参照ポインタ
1934 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1935 * @param floor_list 床上アイテムの配列
1936 * @param floor_num 床上アイテムの配列ID
1937 * @return タグに該当するオブジェクトがあるならTRUEを返す
1939 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1940 * inscription of an object. Alphabetical characters don't work as a\n
1941 * tag in this form.\n
1943 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1944 * and "x" is the "current" command_cmd code.\n
1946 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1951 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1953 /* Check every object in the grid */
1954 for (i = 0; i < floor_num && i < 23; i++)
1956 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1958 /* Skip empty inscriptions */
1959 if (!o_ptr->inscription) continue;
1962 s = my_strchr(quark_str(o_ptr->inscription), '@');
1964 /* Process all tags */
1967 /* Check the special tags */
1968 if ((s[1] == command_cmd) && (s[2] == tag))
1970 /* Save the actual floor object ID */
1977 /* Find another '@' */
1978 s = my_strchr(s + 1, '@');
1983 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1985 /* Don't allow {@#} with '#' being alphabet */
1986 if (tag < '0' || '9' < tag)
1992 /* Check every object in the grid */
1993 for (i = 0; i < floor_num && i < 23; i++)
1995 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1997 /* Skip empty inscriptions */
1998 if (!o_ptr->inscription) continue;
2001 s = my_strchr(quark_str(o_ptr->inscription), '@');
2003 /* Process all tags */
2006 /* Check the normal tags */
2009 /* Save the floor object ID */
2016 /* Find another '@' */
2017 s = my_strchr(s + 1, '@');
2027 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2028 * Move around label characters with correspond tags
2029 * @param label ラベルリストを取得する文字列参照ポインタ
2030 * @param mode 所持品リストか装備品リストかの切り替え
2033 static void prepare_label_string(char *label, BIT_FLAGS mode)
2035 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2036 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2039 /* Prepare normal labels */
2040 strcpy(label, alphabet_chars);
2042 /* Move each label */
2043 for (i = 0; i < 52; i++)
2046 SYMBOL_CODE c = alphabet_chars[i];
2048 /* Find a tag with this label */
2049 if (get_tag(&index, c, mode))
2051 /* Delete the overwritten label */
2052 if (label[i] == c) label[i] = ' ';
2054 /* Move the label to the place of corresponding tag */
2055 label[index - offset] = c;
2062 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2063 * Move around label characters with correspond tags (floor version)
2064 * @param label ラベルリストを取得する文字列参照ポインタ
2065 * @param floor_list 床上アイテムの配列
2066 * @param floor_num 床上アイテムの配列ID
2071 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2073 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2076 /* Prepare normal labels */
2077 strcpy(label, alphabet_chars);
2079 /* Move each label */
2080 for (i = 0; i < 52; i++)
2083 SYMBOL_CODE c = alphabet_chars[i];
2085 /* Find a tag with this label */
2086 if (get_tag_floor(&index, c, floor_list, floor_num))
2088 /* Delete the overwritten label */
2089 if (label[i] == c) label[i] = ' ';
2091 /* Move the label to the place of corresponding tag */
2099 * @brief 所持アイテムの表示を行う /
2100 * Display the inventory.
2101 * @param target_item アイテムの選択処理を行うか否か。
2102 * @return 選択したアイテムのタグ
2104 * Hack -- do not display "trailing" empty slots
2106 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2110 int col, cur_col, len;
2112 GAME_TEXT o_name[MAX_NLEN];
2114 COMMAND_CODE out_index[23];
2115 TERM_COLOR out_color[23];
2116 char out_desc[23][MAX_NLEN];
2117 COMMAND_CODE target_item_label = 0;
2119 char inven_label[52 + 1];
2121 /* Starting column */
2124 Term_get_size(&wid, &hgt);
2126 /* Default "max-length" */
2127 len = wid - col - 1;
2130 /* Find the "final" slot */
2131 for (i = 0; i < INVEN_PACK; i++)
2133 o_ptr = &inventory[i];
2135 /* Skip non-objects */
2136 if (!o_ptr->k_idx) continue;
2142 prepare_label_string(inven_label, USE_INVEN);
2144 /* Display the inventory */
2145 for (k = 0, i = 0; i < z; i++)
2147 o_ptr = &inventory[i];
2149 /* Is this item acceptable? */
2150 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2152 object_desc(o_name, o_ptr, 0);
2154 /* Save the object index, color, and description */
2156 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2158 /* Grey out charging items */
2161 out_color[k] = TERM_L_DARK;
2164 (void)strcpy(out_desc[k], o_name);
2166 /* Find the predicted "line length" */
2167 l = strlen(out_desc[k]) + 5;
2169 /* Be sure to account for the weight */
2170 if (show_weights) l += 9;
2172 /* Account for icon if displayed */
2173 if (show_item_graph)
2176 if (use_bigtile) l++;
2179 /* Maintain the maximum length */
2180 if (l > len) len = l;
2182 /* Advance to next "line" */
2186 /* Find the column to start in */
2187 col = (len > wid - 4) ? 0 : (wid - len - 1);
2189 /* Output each entry */
2190 for (j = 0; j < k; j++)
2193 o_ptr = &inventory[i];
2195 /* Clear the line */
2196 prt("", j + 1, col ? col - 2 : col);
2198 if (use_menu && target_item)
2200 if (j == (target_item-1))
2202 strcpy(tmp_val, _("》", "> "));
2203 target_item_label = i;
2205 else strcpy(tmp_val, " ");
2207 else if (i <= INVEN_PACK)
2209 /* Prepare an index --(-- */
2210 sprintf(tmp_val, "%c)", inven_label[i]);
2214 /* Prepare an index --(-- */
2215 sprintf(tmp_val, "%c)", index_to_label(i));
2218 /* Clear the line with the (possibly indented) index */
2219 put_str(tmp_val, j + 1, col);
2223 /* Display graphics for object, if desired */
2224 if (show_item_graph)
2226 TERM_COLOR a = object_attr(o_ptr);
2227 SYMBOL_CODE c = object_char(o_ptr);
2228 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2229 if (use_bigtile) cur_col++;
2235 /* Display the entry itself */
2236 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2238 /* Display the weight if needed */
2241 int wgt = o_ptr->weight * o_ptr->number;
2243 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2245 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2248 prt(tmp_val, j + 1, wid - 9);
2252 /* Make a "shadow" below the list (only if needed) */
2253 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2255 /* Save the new column */
2258 return target_item_label;
2263 * @brief 装備アイテムの表示を行う /
2264 * Display the equipment.
2265 * @param target_item アイテムの選択処理を行うか否か。
2266 * @return 選択したアイテムのタグ
2268 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2272 int col, cur_col, len;
2275 GAME_TEXT o_name[MAX_NLEN];
2276 COMMAND_CODE out_index[23];
2277 TERM_COLOR out_color[23];
2278 char out_desc[23][MAX_NLEN];
2279 COMMAND_CODE target_item_label = 0;
2281 char equip_label[52 + 1];
2283 /* Starting column */
2286 Term_get_size(&wid, &hgt);
2288 /* Maximal length */
2289 len = wid - col - 1;
2292 /* Scan the equipment list */
2293 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2295 o_ptr = &inventory[i];
2297 /* Is this item acceptable? */
2298 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2299 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2300 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2302 object_desc(o_name, o_ptr, 0);
2304 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2306 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2307 out_color[k] = TERM_WHITE;
2311 (void)strcpy(out_desc[k], o_name);
2312 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2316 /* Grey out charging items */
2319 out_color[k] = TERM_L_DARK;
2322 /* Extract the maximal length (see below) */
2324 l = strlen(out_desc[k]) + (2 + 1);
2326 l = strlen(out_desc[k]) + (2 + 3);
2330 /* Increase length for labels (if needed) */
2332 if (show_labels) l += (7 + 2);
2334 if (show_labels) l += (14 + 2);
2338 /* Increase length for weight (if needed) */
2339 if (show_weights) l += 9;
2341 if (show_item_graph) l += 2;
2343 /* Maintain the max-length */
2344 if (l > len) len = l;
2346 /* Advance the entry */
2350 /* Hack -- Find a column to start in */
2352 col = (len > wid - 6) ? 0 : (wid - len - 1);
2354 col = (len > wid - 4) ? 0 : (wid - len - 1);
2357 prepare_label_string(equip_label, USE_EQUIP);
2359 /* Output each entry */
2360 for (j = 0; j < k; j++)
2363 o_ptr = &inventory[i];
2365 /* Clear the line */
2366 prt("", j + 1, col ? col - 2 : col);
2368 if (use_menu && target_item)
2370 if (j == (target_item-1))
2372 strcpy(tmp_val, _("》", "> "));
2373 target_item_label = i;
2375 else strcpy(tmp_val, " ");
2377 else if (i >= INVEN_RARM)
2379 /* Prepare an index --(-- */
2380 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2384 /* Prepare an index --(-- */
2385 sprintf(tmp_val, "%c)", index_to_label(i));
2388 /* Clear the line with the (possibly indented) index */
2389 put_str(tmp_val, j+1, col);
2393 /* Display graphics for object, if desired */
2394 if (show_item_graph)
2396 TERM_COLOR a = object_attr(o_ptr);
2397 SYMBOL_CODE c = object_char(o_ptr);
2398 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2399 if (use_bigtile) cur_col++;
2407 /* Mention the use */
2408 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2410 put_str(tmp_val, j+1, cur_col);
2412 /* Display the entry itself */
2413 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2419 /* Display the entry itself */
2420 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2423 /* Display the weight if needed */
2426 int wgt = o_ptr->weight * o_ptr->number;
2428 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2430 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2433 prt(tmp_val, j + 1, wid - 9);
2437 /* Make a "shadow" below the list (only if needed) */
2438 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2440 /* Save the new column */
2443 return target_item_label;
2447 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2448 * Flip "inven" and "equip" in any sub-windows
2451 void toggle_inven_equip(void)
2456 for (j = 0; j < 8; j++)
2459 if (!angband_term[j]) continue;
2461 /* Flip inven to equip */
2462 if (window_flag[j] & (PW_INVEN))
2465 window_flag[j] &= ~(PW_INVEN);
2466 window_flag[j] |= (PW_EQUIP);
2468 p_ptr->window |= (PW_EQUIP);
2471 /* Flip inven to equip */
2472 else if (window_flag[j] & (PW_EQUIP))
2475 window_flag[j] &= ~(PW_EQUIP);
2476 window_flag[j] |= (PW_INVEN);
2478 p_ptr->window |= (PW_INVEN);
2484 * @brief 選択したアイテムの確認処理の補助 /
2485 * Verify the choice of an item.
2486 * @param prompt メッセージ表示の一部
2487 * @param item 選択アイテムID
2488 * @return 確認がYesならTRUEを返す。
2489 * @details The item can be negative to mean "item on floor".
2491 static bool verify(concptr prompt, INVENTORY_IDX item)
2493 GAME_TEXT o_name[MAX_NLEN];
2494 char out_val[MAX_NLEN+20];
2501 o_ptr = &inventory[item];
2507 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2509 object_desc(o_name, o_ptr, 0);
2512 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2515 return (get_check(out_val));
2520 * @brief 選択したアイテムの確認処理のメインルーチン /
2521 * @param item 選択アイテムID
2522 * @return 確認がYesならTRUEを返す。
2523 * @details The item can be negative to mean "item on floor".
2524 * Hack -- allow user to "prevent" certain choices
2526 static bool get_item_allow(INVENTORY_IDX item)
2530 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2535 o_ptr = &inventory[item];
2541 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2544 /* No inscription */
2545 if (!o_ptr->inscription) return (TRUE);
2548 s = my_strchr(quark_str(o_ptr->inscription), '!');
2550 /* Process preventions */
2553 /* Check the "restriction" */
2554 if ((s[1] == command_cmd) || (s[1] == '*'))
2556 /* Verify the choice */
2557 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2560 /* Find another '!' */
2561 s = my_strchr(s + 1, '!');
2570 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2571 * Auxiliary function for "get_item()" -- test an index
2573 * @return 正規のIDならばTRUEを返す。
2575 static bool get_item_okay(OBJECT_IDX i)
2578 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2580 if (select_ring_slot) return is_ring_slot(i);
2582 /* Verify the item */
2583 if (!item_tester_okay(&inventory[i])) return (FALSE);
2590 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2591 * Determine whether get_item() can get some item or not
2592 * @return アイテムを拾えるならばTRUEを返す。
2593 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2595 bool can_get_item(void)
2598 OBJECT_IDX floor_list[23];
2599 ITEM_NUMBER floor_num = 0;
2601 for (j = 0; j < INVEN_TOTAL; j++)
2602 if (item_tester_okay(&inventory[j]))
2605 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2613 * @brief オブジェクト選択の汎用関数 /
2614 * Let the user select an item, save its "index"
2615 * @param cp 選択したオブジェクトのIDを返す。
2616 * @param pmt 選択目的のメッセージ
2617 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2618 * @param mode オプションフラグ
2619 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2620 * Return TRUE only if an acceptable item was chosen by the user.\n
2622 * The selected item must satisfy the "item_tester_hook()" function,\n
2623 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2625 * All "item_tester" restrictions are cleared before this function returns.\n
2627 * The user is allowed to choose acceptable items from the equipment,\n
2628 * inventory, or floor, respectively, if the proper flag was given,\n
2629 * and there are any acceptable items in that location.\n
2631 * The equipment or inventory are displayed (even if no acceptable\n
2632 * items are in that location) if the proper flag was given.\n
2634 * If there are no acceptable items available anywhere, and "str" is\n
2635 * not NULL, then it will be used as the text of a warning message\n
2636 * before the function returns.\n
2638 * Note that the user must press "-" to specify the item on the floor,\n
2639 * and there is no way to "examine" the item on the floor, while the\n
2640 * use of "capital" letters will "examine" an inventory/equipment item,\n
2641 * and prompt for its use.\n
2643 * If a legal item is selected from the inventory, we save it in "cp"\n
2644 * directly (0 to 35), and return TRUE.\n
2646 * If a legal item is selected from the floor, we save it in "cp" as\n
2647 * a negative (-1 to -511), and return TRUE.\n
2649 * If no item is available, we do nothing to "cp", and we display a\n
2650 * warning message, using "str" if available, and return FALSE.\n
2652 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2654 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2655 * to allow the user to enter a command while viewing those screens, and\n
2656 * also to induce "auto-enter" of stores, and other such stuff.\n
2658 * Global "p_ptr->command_see" may be set before calling this function to start\n
2659 * out in "browse" mode. It is cleared before this function returns.\n
2661 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2662 * If it is TRUE then we are viewing inventory, else equipment.\n
2664 * We always erase the prompt when we are done, leaving a blank line,\n
2665 * or a warning message, if appropriate, if no items are available.\n
2667 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2669 OBJECT_IDX this_o_idx, next_o_idx = 0;
2686 bool allow_floor = FALSE;
2688 bool toggle = FALSE;
2693 int menu_line = (use_menu ? 1 : 0);
2697 static char prev_tag = '\0';
2698 char cur_tag = '\0';
2700 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2703 if (mode & USE_EQUIP) equip = TRUE;
2704 if (mode & USE_INVEN) inven = TRUE;
2705 if (mode & USE_FLOOR) floor = TRUE;
2707 /* Get the item index */
2708 if (repeat_pull(cp))
2711 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2713 item_tester_tval = 0;
2714 item_tester_hook = NULL;
2715 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2720 else if (floor && (*cp < 0))
2726 o_ptr = ¤t_floor_ptr->o_list[k];
2728 /* Validate the item */
2729 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2731 /* Forget restrictions */
2732 item_tester_tval = 0;
2733 item_tester_hook = NULL;
2734 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2741 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2742 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2744 if (prev_tag && command_cmd)
2746 /* Look up the tag and validate the item */
2747 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2748 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2749 else if (!get_item_okay(k)) /* Reject */;
2752 /* Accept that choice */
2755 /* Forget restrictions */
2756 item_tester_tval = 0;
2757 item_tester_hook = NULL;
2758 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2764 prev_tag = '\0'; /* prev_tag is no longer effective */
2767 /* Verify the item */
2768 else if (get_item_okay(*cp))
2770 /* Forget restrictions */
2771 item_tester_tval = 0;
2772 item_tester_hook = NULL;
2773 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2785 /* No item selected */
2789 /* Full inventory */
2791 i2 = INVEN_PACK - 1;
2793 /* Forbid inventory */
2794 if (!inven) i2 = -1;
2797 for (j = 0; j < INVEN_PACK; j++)
2798 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
2801 /* Restrict inventory indexes */
2802 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2803 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2806 /* Full equipment */
2808 e2 = INVEN_TOTAL - 1;
2810 /* Forbid equipment */
2811 if (!equip) e2 = -1;
2814 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2815 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
2816 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2819 /* Restrict equipment indexes */
2820 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2821 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2823 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2827 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2829 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2833 /* Restrict floor usage */
2836 /* Scan all objects in the grid */
2837 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)
2840 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
2841 next_o_idx = o_ptr->next_o_idx;
2843 /* Accept the item on the floor if legal */
2844 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2848 /* Require at least one legal choice */
2849 if (!allow_floor && (i1 > i2) && (e1 > e2))
2851 /* Cancel p_ptr->command_see */
2852 command_see = FALSE;
2856 if (mode & USE_FORCE) {
2862 /* Analyze choices */
2865 /* Hack -- Start on equipment if requested */
2866 if (command_see && command_wrk && equip)
2871 /* Use inventory if allowed */
2874 command_wrk = FALSE;
2877 /* Use equipment if allowed */
2883 /* Use inventory for floor */
2886 command_wrk = FALSE;
2892 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2894 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2896 /* Hack -- start out in "display" mode */
2903 /* Repeat until done */
2906 COMMAND_CODE get_item_label = 0;
2913 for (j = 0; j < 8; j++)
2916 if (!angband_term[j]) continue;
2918 /* Count windows displaying inven */
2919 if (window_flag[j] & (PW_INVEN)) ni++;
2921 /* Count windows displaying equip */
2922 if (window_flag[j] & (PW_EQUIP)) ne++;
2925 /* Toggle if needed */
2926 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2929 toggle_inven_equip();
2935 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2938 /* Inventory screen */
2941 /* Redraw if needed */
2942 if (command_see) get_item_label = show_inven(menu_line, mode);
2945 /* Equipment screen */
2948 /* Redraw if needed */
2949 if (command_see) get_item_label = show_equip(menu_line, mode);
2952 /* Viewing inventory */
2955 /* Begin the prompt */
2956 sprintf(out_val, _("持ち物:", "Inven:"));
2958 /* Some legal items */
2959 if ((i1 <= i2) && !use_menu)
2961 /* Build the prompt */
2962 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2963 index_to_label(i1), index_to_label(i2));
2966 strcat(out_val, tmp_val);
2969 /* Indicate ability to "view" */
2970 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2973 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2976 /* Viewing equipment */
2979 /* Begin the prompt */
2980 sprintf(out_val, _("装備品:", "Equip:"));
2982 /* Some legal items */
2983 if ((e1 <= e2) && !use_menu)
2985 /* Build the prompt */
2986 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2987 index_to_label(e1), index_to_label(e2));
2990 strcat(out_val, tmp_val);
2993 /* Indicate ability to "view" */
2994 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2997 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
3000 /* Indicate legality of the "floor" item */
3001 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3002 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3004 /* Finish the prompt */
3005 strcat(out_val, " ESC");
3007 /* Build the prompt */
3008 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3010 /* Show the prompt */
3018 int max_line = (command_wrk ? max_equip : max_inven);
3034 menu_line += (max_line - 1);
3053 /* Verify legality */
3054 if (!inven || !equip)
3060 /* Hack -- Fix screen */
3067 /* Switch inven/equip */
3068 command_wrk = !command_wrk;
3069 max_line = (command_wrk ? max_equip : max_inven);
3070 if (menu_line > max_line) menu_line = max_line;
3072 /* Need to redraw */
3081 if (command_wrk == USE_FLOOR)
3084 (*cp) = -get_item_label;
3088 /* Validate the item */
3089 if (!get_item_okay(get_item_label))
3095 /* Allow player to "refuse" certain actions */
3096 if (!get_item_allow(get_item_label))
3102 /* Accept that choice */
3103 (*cp) = get_item_label;
3112 if (mode & USE_FORCE) {
3120 if (menu_line > max_line) menu_line -= max_line;
3141 command_see = FALSE;
3158 /* Verify legality */
3159 if (!inven || !equip)
3165 /* Hack -- Fix screen */
3172 /* Switch inven/equip */
3173 command_wrk = !command_wrk;
3175 /* Need to redraw */
3181 /* Use floor item */
3184 /* Scan all objects in the grid */
3185 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)
3188 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3189 next_o_idx = o_ptr->next_o_idx;
3191 /* Validate the item */
3192 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3197 /* Verify the item (if required) */
3198 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3200 /* Allow player to "refuse" certain actions */
3201 if (!get_item_allow(k)) continue;
3203 /* Accept that choice */
3219 case '1': case '2': case '3':
3220 case '4': case '5': case '6':
3221 case '7': case '8': case '9':
3223 /* Look up the tag */
3224 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3230 /* Hack -- Validate the item */
3231 if ((k < INVEN_RARM) ? !inven : !equip)
3237 /* Validate the item */
3238 if (!get_item_okay(k))
3244 /* Allow player to "refuse" certain actions */
3245 if (!get_item_allow(k))
3251 /* Accept that choice */
3263 /* Choose "default" inventory item */
3266 k = ((i1 == i2) ? i1 : -1);
3269 /* Choose "default" equipment item */
3272 k = ((e1 == e2) ? e1 : -1);
3275 /* Validate the item */
3276 if (!get_item_okay(k))
3282 /* Allow player to "refuse" certain actions */
3283 if (!get_item_allow(k))
3289 /* Accept that choice */
3299 if (mode & USE_FORCE) {
3312 bool not_found = FALSE;
3314 /* Look up the alphabetical tag */
3315 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3320 /* Hack -- Validate the item */
3321 else if ((k < INVEN_RARM) ? !inven : !equip)
3326 /* Validate the item */
3327 else if (!get_item_okay(k))
3334 /* Accept that choice */
3342 /* Extract "query" setting */
3343 ver = isupper(which);
3344 which = (char)tolower(which);
3346 /* Convert letter to inventory index */
3349 if (which == '(') k = i1;
3350 else if (which == ')') k = i2;
3351 else k = label_to_inven(which);
3354 /* Convert letter to equipment index */
3357 if (which == '(') k = e1;
3358 else if (which == ')') k = e2;
3359 else k = label_to_equip(which);
3362 /* Validate the item */
3363 if (!get_item_okay(k))
3369 /* Verify the item */
3370 if (ver && !verify(_("本当に", "Try"), k))
3376 /* Allow player to "refuse" certain actions */
3377 if (!get_item_allow(k))
3383 /* Accept that choice */
3394 /* Fix the screen if necessary */
3399 /* Hack -- Cancel "display" */
3400 command_see = FALSE;
3404 /* Forget the item_tester_tval restriction */
3405 item_tester_tval = 0;
3407 /* Forget the item_tester_hook restriction */
3408 item_tester_hook = NULL;
3411 /* Clean up 'show choices' */
3412 /* Toggle again if needed */
3413 if (toggle) toggle_inven_equip();
3415 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3418 /* Clear the prompt line */
3421 /* Warning if needed */
3422 if (oops && str) msg_print(str);
3427 if (command_cmd) prev_tag = cur_tag;
3428 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3434 * Choose an item and get auto-picker entry from it.
3436 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3439 if (!get_item(&item, q, s, option)) return NULL;
3440 if (idx) *idx = item;
3442 if (item == INVEN_FORCE) return NULL;
3444 /* Get the item (in the pack) */
3445 else if (item >= 0) return &inventory[item];
3447 /* Get the item (on the floor) */
3448 else return ¤t_floor_ptr->o_list[0 - item];
3453 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3454 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3455 * @param y 走査するフロアのY座標
3456 * @param x 走査するフロアのX座標
3457 * @param mode オプションフラグ
3458 * @return 対象のマスに落ちているアイテム数
3460 * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
3461 * location. Valid flags are:
3463 * mode & 0x01 -- Item tester
3464 * mode & 0x02 -- Marked items only
3465 * mode & 0x04 -- Stop after first
3467 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3469 OBJECT_IDX this_o_idx, next_o_idx;
3471 ITEM_NUMBER num = 0;
3474 if (!in_bounds(y, x)) return 0;
3476 /* Scan all objects in the grid */
3477 for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3480 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3481 next_o_idx = o_ptr->next_o_idx;
3484 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3487 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3489 /* Accept this item */
3490 /* XXX Hack -- Enforce limit */
3492 items[num] = this_o_idx;
3497 if (mode & 0x04) break;
3504 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3505 * @param target_item カーソルの初期値
3506 * @param y 走査するフロアのY座標
3507 * @param x 走査するフロアのX座標
3508 * @param min_width 表示の長さ
3509 * @return 選択したアイテムの添え字
3512 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3520 GAME_TEXT o_name[MAX_NLEN];
3523 COMMAND_CODE out_index[23];
3524 TERM_COLOR out_color[23];
3525 char out_desc[23][MAX_NLEN];
3526 COMMAND_CODE target_item_label = 0;
3528 OBJECT_IDX floor_list[23];
3529 ITEM_NUMBER floor_num;
3531 char floor_label[52 + 1];
3533 bool dont_need_to_show_weights = TRUE;
3535 Term_get_size(&wid, &hgt);
3537 /* Default length */
3538 len = MAX((*min_width), 20);
3540 /* Scan for objects in the grid, using item_tester_okay() */
3541 floor_num = scan_floor(floor_list, y, x, 0x03);
3543 /* Display the floor objects */
3544 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3546 o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
3548 object_desc(o_name, o_ptr, 0);
3550 /* Save the index */
3553 /* Acquire inventory color */
3554 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3556 /* Save the object description */
3557 strcpy(out_desc[k], o_name);
3559 /* Find the predicted "line length" */
3560 l = strlen(out_desc[k]) + 5;
3562 /* Be sure to account for the weight */
3563 if (show_weights) l += 9;
3565 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3567 /* Maintain the maximum length */
3568 if (l > len) len = l;
3570 /* Advance to next "line" */
3574 if (show_weights && dont_need_to_show_weights) len -= 9;
3579 /* Find the column to start in */
3580 col = (len > wid - 4) ? 0 : (wid - len - 1);
3582 prepare_label_string_floor(floor_label, floor_list, floor_num);
3584 /* Output each entry */
3585 for (j = 0; j < k; j++)
3587 m = floor_list[out_index[j]];
3588 o_ptr = ¤t_floor_ptr->o_list[m];
3590 /* Clear the line */
3591 prt("", j + 1, col ? col - 2 : col);
3593 if (use_menu && target_item)
3595 if (j == (target_item-1))
3597 strcpy(tmp_val, _("》", "> "));
3598 target_item_label = m;
3600 else strcpy(tmp_val, " ");
3604 /* Prepare an index --(-- */
3605 sprintf(tmp_val, "%c)", floor_label[j]);
3608 /* Clear the line with the (possibly indented) index */
3609 put_str(tmp_val, j + 1, col);
3611 /* Display the entry itself */
3612 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3614 /* Display the weight if needed */
3615 if (show_weights && (o_ptr->tval != TV_GOLD))
3617 int wgt = o_ptr->weight * o_ptr->number;
3619 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3621 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3624 prt(tmp_val, j + 1, wid - 9);
3628 /* Make a "shadow" below the list (only if needed) */
3629 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3631 return target_item_label;
3635 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3636 * Let the user select an item, save its "index"
3637 * @param cp 選択したオブジェクトのIDを返す。
3638 * @param pmt 選択目的のメッセージ
3639 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3640 * @param mode オプションフラグ
3641 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3643 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3645 char n1 = ' ', n2 = ' ', which = ' ';
3648 COMMAND_CODE i1, i2;
3649 COMMAND_CODE e1, e2;
3657 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3658 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3659 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3660 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3662 bool allow_equip = FALSE;
3663 bool allow_inven = FALSE;
3664 bool allow_floor = FALSE;
3666 bool toggle = FALSE;
3671 ITEM_NUMBER floor_num;
3672 OBJECT_IDX floor_list[23];
3674 TERM_LEN min_width = 0;
3676 int menu_line = (use_menu ? 1 : 0);
3680 static char prev_tag = '\0';
3681 char cur_tag = '\0';
3683 /* Get the item index */
3684 if (repeat_pull(cp))
3687 if (force && (*cp == INVEN_FORCE))
3689 item_tester_tval = 0;
3690 item_tester_hook = NULL;
3691 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3696 else if (floor && (*cp < 0))
3698 if (prev_tag && command_cmd)
3700 /* Scan all objects in the grid */
3701 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3703 /* Look up the tag */
3704 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3706 /* Accept that choice */
3707 (*cp) = 0 - floor_list[k];
3709 /* Forget restrictions */
3710 item_tester_tval = 0;
3711 item_tester_hook = NULL;
3712 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3718 prev_tag = '\0'; /* prev_tag is no longer effective */
3721 /* Validate the item */
3722 else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
3724 /* Forget restrictions */
3725 item_tester_tval = 0;
3726 item_tester_hook = NULL;
3727 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3734 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3735 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3737 if (prev_tag && command_cmd)
3739 /* Look up the tag and validate the item */
3740 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3741 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3742 else if (!get_item_okay(k)) /* Reject */;
3745 /* Accept that choice */
3748 /* Forget restrictions */
3749 item_tester_tval = 0;
3750 item_tester_hook = NULL;
3751 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3757 prev_tag = '\0'; /* prev_tag is no longer effective */
3760 /* Verify the item */
3761 else if (get_item_okay(*cp))
3763 /* Forget restrictions */
3764 item_tester_tval = 0;
3765 item_tester_hook = NULL;
3766 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3780 /* No item selected */
3784 /* Full inventory */
3786 i2 = INVEN_PACK - 1;
3788 /* Forbid inventory */
3789 if (!inven) i2 = -1;
3792 for (j = 0; j < INVEN_PACK; j++)
3793 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
3796 /* Restrict inventory indexes */
3797 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3798 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3801 /* Full equipment */
3803 e2 = INVEN_TOTAL - 1;
3805 /* Forbid equipment */
3806 if (!equip) e2 = -1;
3809 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3810 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
3811 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3814 /* Restrict equipment indexes */
3815 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3816 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3818 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3822 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3824 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3828 /* Count "okay" floor items */
3831 /* Restrict floor usage */
3834 /* Scan all objects in the grid */
3835 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3838 /* Accept inventory */
3839 if (i1 <= i2) allow_inven = TRUE;
3841 /* Accept equipment */
3842 if (e1 <= e2) allow_equip = TRUE;
3845 if (floor_num) allow_floor = TRUE;
3847 /* Require at least one legal choice */
3848 if (!allow_inven && !allow_equip && !allow_floor)
3850 /* Cancel p_ptr->command_see */
3851 command_see = FALSE;
3861 /* Analyze choices */
3864 /* Hack -- Start on equipment if requested */
3865 if (command_see && (command_wrk == (USE_EQUIP))
3868 command_wrk = (USE_EQUIP);
3871 /* Use inventory if allowed */
3872 else if (allow_inven)
3874 command_wrk = (USE_INVEN);
3877 /* Use equipment if allowed */
3878 else if (allow_equip)
3880 command_wrk = (USE_EQUIP);
3883 /* Use floor if allowed */
3884 else if (allow_floor)
3886 command_wrk = (USE_FLOOR);
3891 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3893 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3895 /* Hack -- start out in "display" mode */
3901 /* Repeat until done */
3904 COMMAND_CODE get_item_label = 0;
3911 for (j = 0; j < 8; j++)
3914 if (!angband_term[j]) continue;
3916 /* Count windows displaying inven */
3917 if (window_flag[j] & (PW_INVEN)) ni++;
3919 /* Count windows displaying equip */
3920 if (window_flag[j] & (PW_EQUIP)) ne++;
3923 /* Toggle if needed */
3924 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3925 (command_wrk == (USE_INVEN) && !ni && ne))
3928 toggle_inven_equip();
3934 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3937 /* Inventory screen */
3938 if (command_wrk == (USE_INVEN))
3940 /* Extract the legal requests */
3944 /* Redraw if needed */
3945 if (command_see) get_item_label = show_inven(menu_line, mode);
3948 /* Equipment screen */
3949 else if (command_wrk == (USE_EQUIP))
3951 /* Extract the legal requests */
3952 n1 = I2A(e1 - INVEN_RARM);
3953 n2 = I2A(e2 - INVEN_RARM);
3955 /* Redraw if needed */
3956 if (command_see) get_item_label = show_equip(menu_line, mode);
3960 else if (command_wrk == (USE_FLOOR))
3963 k = MIN(floor_top + 23, floor_num) - 1;
3965 /* Extract the legal requests */
3966 n1 = I2A(j - floor_top);
3967 n2 = I2A(k - floor_top);
3969 /* Redraw if needed */
3970 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3973 /* Viewing inventory */
3974 if (command_wrk == (USE_INVEN))
3976 /* Begin the prompt */
3977 sprintf(out_val, _("持ち物:", "Inven:"));
3981 /* Build the prompt */
3982 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3983 index_to_label(i1), index_to_label(i2));
3986 strcat(out_val, tmp_val);
3989 /* Indicate ability to "view" */
3990 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3996 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
3997 else if (allow_floor)
3998 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
4000 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4007 strcat(out_val, _(" '-'床上,", " - for floor,"));
4008 else if (allow_equip)
4009 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
4011 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4015 /* Viewing equipment */
4016 else if (command_wrk == (USE_EQUIP))
4018 /* Begin the prompt */
4019 sprintf(out_val, _("装備品:", "Equip:"));
4023 /* Build the prompt */
4024 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4025 index_to_label(e1), index_to_label(e2));
4028 strcat(out_val, tmp_val);
4031 /* Indicate ability to "view" */
4032 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4038 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4039 else if (allow_floor)
4040 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
4042 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4049 strcat(out_val, _(" '-'床上,", " - for floor,"));
4050 else if (allow_inven)
4051 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4053 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4058 else if (command_wrk == (USE_FLOOR))
4060 /* Begin the prompt */
4061 sprintf(out_val, _("床上:", "Floor:"));
4065 /* Build the prompt */
4066 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4069 strcat(out_val, tmp_val);
4072 /* Indicate ability to "view" */
4073 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4077 if (allow_inven && allow_equip)
4079 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4081 else if (allow_inven)
4083 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4085 else if (allow_equip)
4087 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4091 else if (allow_inven)
4093 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4095 else if (allow_equip)
4097 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4101 if (command_see && !use_menu)
4103 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4108 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4110 /* Finish the prompt */
4111 strcat(out_val, " ESC");
4113 /* Build the prompt */
4114 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4116 /* Show the prompt */
4125 if (command_wrk == USE_INVEN) max_line = max_inven;
4126 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4127 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4143 menu_line += (max_line - 1);
4159 /* Verify legality */
4160 if (command_wrk == (USE_INVEN))
4162 if (allow_floor) command_wrk = USE_FLOOR;
4163 else if (allow_equip) command_wrk = USE_EQUIP;
4170 else if (command_wrk == (USE_EQUIP))
4172 if (allow_inven) command_wrk = USE_INVEN;
4173 else if (allow_floor) command_wrk = USE_FLOOR;
4180 else if (command_wrk == (USE_FLOOR))
4182 if (allow_equip) command_wrk = USE_EQUIP;
4183 else if (allow_inven) command_wrk = USE_INVEN;
4196 /* Hack -- Fix screen */
4203 /* Switch inven/equip */
4204 if (command_wrk == USE_INVEN) max_line = max_inven;
4205 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4206 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4207 if (menu_line > max_line) menu_line = max_line;
4209 /* Need to redraw */
4217 /* Verify legality */
4218 if (command_wrk == (USE_INVEN))
4220 if (allow_equip) command_wrk = USE_EQUIP;
4221 else if (allow_floor) command_wrk = USE_FLOOR;
4228 else if (command_wrk == (USE_EQUIP))
4230 if (allow_floor) command_wrk = USE_FLOOR;
4231 else if (allow_inven) command_wrk = USE_INVEN;
4238 else if (command_wrk == (USE_FLOOR))
4240 if (allow_inven) command_wrk = USE_INVEN;
4241 else if (allow_equip) command_wrk = USE_EQUIP;
4254 /* Hack -- Fix screen */
4261 /* Switch inven/equip */
4262 if (command_wrk == USE_INVEN) max_line = max_inven;
4263 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4264 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4265 if (menu_line > max_line) menu_line = max_line;
4267 /* Need to redraw */
4276 if (command_wrk == USE_FLOOR)
4279 (*cp) = -get_item_label;
4283 /* Validate the item */
4284 if (!get_item_okay(get_item_label))
4290 /* Allow player to "refuse" certain actions */
4291 if (!get_item_allow(get_item_label))
4297 /* Accept that choice */
4298 (*cp) = get_item_label;
4315 if (menu_line > max_line) menu_line -= max_line;
4336 command_see = FALSE;
4357 grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
4359 if (command_wrk != (USE_FLOOR)) break;
4361 /* Get the object being moved. */
4362 o_idx = g_ptr->o_idx;
4364 /* Only rotate a pile of two or more objects. */
4365 if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
4367 /* Remove the first object from the list. */
4368 excise_object_idx(o_idx);
4370 /* Find end of the list. */
4372 while (current_floor_ptr->o_list[i].next_o_idx)
4373 i = current_floor_ptr->o_list[i].next_o_idx;
4375 /* Add after the last object. */
4376 current_floor_ptr->o_list[i].next_o_idx = o_idx;
4378 /* Re-scan floor list */
4379 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4381 /* Hack -- Fix screen */
4393 if (command_wrk == (USE_INVEN))
4400 command_wrk = (USE_EQUIP);
4402 else if (command_wrk == (USE_EQUIP))
4409 command_wrk = (USE_INVEN);
4411 else if (command_wrk == (USE_FLOOR))
4415 command_wrk = (USE_INVEN);
4417 else if (allow_equip)
4419 command_wrk = (USE_EQUIP);
4428 /* Hack -- Fix screen */
4435 /* Need to redraw */
4448 * If we are already examining the floor, and there
4449 * is only one item, we will always select it.
4450 * If we aren't examining the floor and there is only
4451 * one item, we will select it if floor_query_flag
4456 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4459 k = 0 - floor_list[0];
4461 /* Allow player to "refuse" certain actions */
4462 if (!get_item_allow(k))
4468 /* Accept that choice */
4477 /* Hack -- Fix screen */
4484 command_wrk = (USE_FLOOR);
4490 case '1': case '2': case '3':
4491 case '4': case '5': case '6':
4492 case '7': case '8': case '9':
4494 if (command_wrk != USE_FLOOR)
4496 /* Look up the tag */
4497 if (!get_tag(&k, which, command_wrk))
4503 /* Hack -- Validate the item */
4504 if ((k < INVEN_RARM) ? !inven : !equip)
4510 /* Validate the item */
4511 if (!get_item_okay(k))
4519 /* Look up the alphabetical tag */
4520 if (get_tag_floor(&k, which, floor_list, floor_num))
4523 k = 0 - floor_list[k];
4532 /* Allow player to "refuse" certain actions */
4533 if (!get_item_allow(k))
4539 /* Accept that choice */
4551 /* Choose "default" inventory item */
4552 if (command_wrk == (USE_INVEN))
4554 k = ((i1 == i2) ? i1 : -1);
4557 /* Choose "default" equipment item */
4558 else if (command_wrk == (USE_EQUIP))
4560 k = ((e1 == e2) ? e1 : -1);
4563 /* Choose "default" floor item */
4564 else if (command_wrk == (USE_FLOOR))
4569 k = 0 - floor_list[0];
4571 /* Allow player to "refuse" certain actions */
4572 if (!get_item_allow(k))
4578 /* Accept that choice */
4586 /* Validate the item */
4587 if (!get_item_okay(k))
4593 /* Allow player to "refuse" certain actions */
4594 if (!get_item_allow(k))
4600 /* Accept that choice */
4624 if (command_wrk != USE_FLOOR)
4626 bool not_found = FALSE;
4628 /* Look up the alphabetical tag */
4629 if (!get_tag(&k, which, command_wrk))
4634 /* Hack -- Validate the item */
4635 else if ((k < INVEN_RARM) ? !inven : !equip)
4640 /* Validate the item */
4641 else if (!get_item_okay(k))
4648 /* Accept that choice */
4658 /* Look up the alphabetical tag */
4659 if (get_tag_floor(&k, which, floor_list, floor_num))
4662 k = 0 - floor_list[k];
4664 /* Accept that choice */
4673 /* Extract "query" setting */
4674 ver = isupper(which);
4675 which = (char)tolower(which);
4677 /* Convert letter to inventory index */
4678 if (command_wrk == (USE_INVEN))
4680 if (which == '(') k = i1;
4681 else if (which == ')') k = i2;
4682 else k = label_to_inven(which);
4685 /* Convert letter to equipment index */
4686 else if (command_wrk == (USE_EQUIP))
4688 if (which == '(') k = e1;
4689 else if (which == ')') k = e2;
4690 else k = label_to_equip(which);
4693 /* Convert letter to floor index */
4694 else if (command_wrk == USE_FLOOR)
4696 if (which == '(') k = 0;
4697 else if (which == ')') k = floor_num - 1;
4698 else k = islower(which) ? A2I(which) : -1;
4699 if (k < 0 || k >= floor_num || k >= 23)
4706 k = 0 - floor_list[k];
4709 /* Validate the item */
4710 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4716 /* Verify the item */
4717 if (ver && !verify(_("本当に", "Try"), k))
4723 /* Allow player to "refuse" certain actions */
4724 if (!get_item_allow(k))
4730 /* Accept that choice */
4740 /* Fix the screen if necessary */
4745 /* Hack -- Cancel "display" */
4746 command_see = FALSE;
4750 /* Forget the item_tester_tval restriction */
4751 item_tester_tval = 0;
4753 /* Forget the item_tester_hook restriction */
4754 item_tester_hook = NULL;
4757 /* Clean up 'show choices' */
4758 /* Toggle again if needed */
4759 if (toggle) toggle_inven_equip();
4761 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4764 /* Clear the prompt line */
4767 /* Warning if needed */
4768 if (oops && str) msg_print(str);
4773 if (command_cmd) prev_tag = cur_tag;
4774 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4780 * @brief 床上のアイテムを拾う選択用サブルーチン
4781 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4783 static bool py_pickup_floor_aux(void)
4785 OBJECT_IDX this_o_idx;
4789 /* Restrict the choices */
4790 item_tester_hook = inven_carry_okay;
4793 q = _("どれを拾いますか?", "Get which item? ");
4794 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4796 if (choose_object(&item, q, s, (USE_FLOOR)))
4798 this_o_idx = 0 - item;
4805 /* Pick up the object */
4806 py_pickup_aux(this_o_idx);
4812 * @brief 床上のアイテムを拾うメイン処理
4813 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4816 * This is called by py_pickup() when easy_floor is TRUE.
4818 void py_pickup_floor(bool pickup)
4820 OBJECT_IDX this_o_idx, next_o_idx = 0;
4822 GAME_TEXT o_name[MAX_NLEN];
4826 OBJECT_IDX floor_o_idx = 0;
4830 /* Scan the pile of objects */
4831 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)
4833 /* Access the object */
4834 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
4836 object_desc(o_name, o_ptr, 0);
4838 /* Access the next object */
4839 next_o_idx = o_ptr->next_o_idx;
4841 disturb(FALSE, FALSE);
4844 if (o_ptr->tval == TV_GOLD)
4847 msg_format(" $%ld の価値がある%sを見つけた。",
4848 (long)o_ptr->pval, o_name);
4850 msg_format("You have found %ld gold pieces worth of %s.",
4851 (long)o_ptr->pval, o_name);
4854 /* Collect the gold */
4855 p_ptr->au += o_ptr->pval;
4858 p_ptr->redraw |= (PR_GOLD);
4860 p_ptr->window |= (PW_PLAYER);
4862 /* Delete the gold */
4863 delete_object_idx(this_o_idx);
4865 /* Check the next object */
4868 else if (o_ptr->marked & OM_NOMSG)
4870 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4871 * ignored. Otherwise, they are included in the prompt. */
4872 o_ptr->marked &= ~(OM_NOMSG);
4876 /* Count non-gold objects that can be picked up. */
4877 if (inven_carry_okay(o_ptr))
4882 /* Count non-gold objects */
4885 /* Remember this index */
4886 floor_o_idx = this_o_idx;
4889 /* There are no non-gold objects */
4893 /* Mention the number of objects */
4899 /* Access the object */
4900 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4902 #ifdef ALLOW_EASY_SENSE
4904 /* Option: Make object sensing easy */
4907 /* Sense the object */
4908 (void) sense_object(o_ptr);
4911 #endif /* ALLOW_EASY_SENSE */
4913 object_desc(o_name, o_ptr, 0);
4915 msg_format(_("%sがある。", "You see %s."), o_name);
4918 /* Multiple objects */
4921 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4927 /* The player has no room for anything on the floor. */
4933 /* Access the object */
4934 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4936 #ifdef ALLOW_EASY_SENSE
4938 /* Option: Make object sensing easy */
4941 /* Sense the object */
4942 (void) sense_object(o_ptr);
4945 #endif /* ALLOW_EASY_SENSE */
4947 object_desc(o_name, o_ptr, 0);
4949 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4952 /* Multiple objects */
4955 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4965 /* Hack -- query every object */
4966 if (carry_query_flag)
4968 char out_val[MAX_NLEN+20];
4970 /* Access the object */
4971 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4973 #ifdef ALLOW_EASY_SENSE
4975 /* Option: Make object sensing easy */
4978 /* Sense the object */
4979 (void) sense_object(o_ptr);
4982 #endif /* ALLOW_EASY_SENSE */
4984 object_desc(o_name, o_ptr, 0);
4986 /* Build a prompt */
4987 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
4989 /* Ask the user to confirm */
4990 if (!get_check(out_val))
4996 /* Access the object */
4997 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4999 #ifdef ALLOW_EASY_SENSE
5001 /* Option: Make object sensing easy */
5004 /* Sense the object */
5005 (void) sense_object(o_ptr);
5008 #endif /* ALLOW_EASY_SENSE */
5010 /* Pick up the object */
5011 py_pickup_aux(floor_o_idx);
5014 /* Allow the user to choose an object */
5017 while (can_pickup--)
5019 if (!py_pickup_floor_aux()) break;
5026 * @brief 矢弾を射撃した場合の破損確率を返す /
5027 * Determines the odds of an object breaking when thrown at a monster
5028 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
5031 * Note that artifacts never break, see the "drop_near()" function.
5033 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
5035 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
5037 /* Examine the snipe type */
5040 if (snipe_type == SP_KILL_WALL) return (100);
5041 if (snipe_type == SP_EXPLODE) return (100);
5042 if (snipe_type == SP_PIERCE) return (100);
5043 if (snipe_type == SP_FINAL) return (100);
5044 if (snipe_type == SP_NEEDLE) return (100);
5045 if (snipe_type == SP_EVILNESS) return (40);
5046 if (snipe_type == SP_HOLYNESS) return (40);
5049 /* Examine the item type */
5050 switch (o_ptr->tval)
5066 /* Sometimes break */
5071 return (20 - archer_bonus * 2);
5076 return (10 - archer_bonus);