3 * @brief オブジェクトの実装 / Object code, part 1
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2014 Deskull rearranged comment for Doxygen.\n
17 #include "cmd-activate.h"
18 #include "object-hook.h"
19 #include "player-move.h"
22 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
29 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
31 * This involves resetting various things to their "default" state.\n
33 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
34 * "user pref file" based on the current setting of the "use_graphics"\n
35 * flag. This is useful for switching "graphics" on/off.\n
37 * The features, objects, and monsters, should all be encoded in the\n
38 * relevant "font.pref" and/or "graf.prf" files. \n
40 * The "prefs" parameter is no longer meaningful. \n
42 void reset_visuals(void)
46 /* Extract some info about terrain features */
47 for (i = 0; i < max_f_idx; i++)
49 feature_type *f_ptr = &f_info[i];
51 /* Assume we will use the underlying values */
52 for (j = 0; j < F_LIT_MAX; j++)
54 f_ptr->x_attr[j] = f_ptr->d_attr[j];
55 f_ptr->x_char[j] = f_ptr->d_char[j];
59 /* Extract default attr/char code for objects */
60 for (i = 0; i < max_k_idx; i++)
62 object_kind *k_ptr = &k_info[i];
64 /* Default attr/char */
65 k_ptr->x_attr = k_ptr->d_attr;
66 k_ptr->x_char = k_ptr->d_char;
69 /* Extract default attr/char code for monsters */
70 for (i = 0; i < max_r_idx; i++)
72 monster_race *r_ptr = &r_info[i];
74 /* Default attr/char */
75 r_ptr->x_attr = r_ptr->d_attr;
76 r_ptr->x_char = r_ptr->d_char;
83 /* Process "graf.prf" */
84 process_pref_file("graf.prf");
86 /* Access the "character" pref file */
87 sprintf(buf, "graf-%s.prf", player_base);
89 /* Process "graf-<playername>.prf" */
90 process_pref_file(buf);
98 /* Process "font.prf" */
99 process_pref_file("font.prf");
101 /* Access the "character" pref file */
102 sprintf(buf, "font-%s.prf", player_base);
104 /* Process "font-<playername>.prf" */
105 process_pref_file(buf);
110 * @brief オブジェクトのフラグ類を配列に与える
111 * Obtain the "flags" for an item
112 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
113 * @param flgs フラグ情報を受け取る配列
116 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
118 object_kind *k_ptr = &k_info[o_ptr->k_idx];
122 for (i = 0; i < TR_FLAG_SIZE; i++)
123 flgs[i] = k_ptr->flags[i];
126 if (object_is_fixed_artifact(o_ptr))
128 artifact_type *a_ptr = &a_info[o_ptr->name1];
130 for (i = 0; i < TR_FLAG_SIZE; i++)
131 flgs[i] = a_ptr->flags[i];
135 if (object_is_ego(o_ptr))
137 ego_item_type *e_ptr = &e_info[o_ptr->name2];
139 for (i = 0; i < TR_FLAG_SIZE; i++)
140 flgs[i] |= e_ptr->flags[i];
142 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
144 remove_flag(flgs, TR_SH_FIRE);
146 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
148 remove_flag(flgs, TR_INFRA);
150 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
152 remove_flag(flgs, TR_RES_BLIND);
153 remove_flag(flgs, TR_SEE_INVIS);
157 /* Random artifact ! */
158 for (i = 0; i < TR_FLAG_SIZE; i++)
159 flgs[i] |= o_ptr->art_flags[i];
161 if (object_is_smith(o_ptr))
163 int add = o_ptr->xtra3 - 1;
165 if (add < TR_FLAG_MAX)
169 else if (add == ESSENCE_TMP_RES_ACID)
171 add_flag(flgs, TR_RES_ACID);
172 add_flag(flgs, TR_ACTIVATE);
174 else if (add == ESSENCE_TMP_RES_ELEC)
176 add_flag(flgs, TR_RES_ELEC);
177 add_flag(flgs, TR_ACTIVATE);
179 else if (add == ESSENCE_TMP_RES_FIRE)
181 add_flag(flgs, TR_RES_FIRE);
182 add_flag(flgs, TR_ACTIVATE);
184 else if (add == ESSENCE_TMP_RES_COLD)
186 add_flag(flgs, TR_RES_COLD);
187 add_flag(flgs, TR_ACTIVATE);
189 else if (add == ESSENCE_SH_FIRE)
191 add_flag(flgs, TR_RES_FIRE);
192 add_flag(flgs, TR_SH_FIRE);
194 else if (add == ESSENCE_SH_ELEC)
196 add_flag(flgs, TR_RES_ELEC);
197 add_flag(flgs, TR_SH_ELEC);
199 else if (add == ESSENCE_SH_COLD)
201 add_flag(flgs, TR_RES_COLD);
202 add_flag(flgs, TR_SH_COLD);
204 else if (add == ESSENCE_RESISTANCE)
206 add_flag(flgs, TR_RES_ACID);
207 add_flag(flgs, TR_RES_ELEC);
208 add_flag(flgs, TR_RES_FIRE);
209 add_flag(flgs, TR_RES_COLD);
211 else if (add == TR_IMPACT)
213 add_flag(flgs, TR_ACTIVATE);
219 * @brief オブジェクトの明示されているフラグ類を取得する
220 * Obtain the "flags" for an item which are known to the player
221 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
222 * @param flgs フラグ情報を受け取る配列
225 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
230 object_kind *k_ptr = &k_info[o_ptr->k_idx];
233 for (i = 0; i < TR_FLAG_SIZE; i++)
236 if (!object_is_aware(o_ptr)) return;
239 for (i = 0; i < TR_FLAG_SIZE; i++)
240 flgs[i] = k_ptr->flags[i];
242 /* Must be identified */
243 if (!object_is_known(o_ptr)) return;
245 /* Ego-item (known basic flags) */
246 if (object_is_ego(o_ptr))
248 ego_item_type *e_ptr = &e_info[o_ptr->name2];
250 for (i = 0; i < TR_FLAG_SIZE; i++)
251 flgs[i] |= e_ptr->flags[i];
253 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
255 remove_flag(flgs, TR_SH_FIRE);
257 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
259 remove_flag(flgs, TR_INFRA);
261 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
263 remove_flag(flgs, TR_RES_BLIND);
264 remove_flag(flgs, TR_SEE_INVIS);
269 #ifdef SPOIL_ARTIFACTS
270 /* Full knowledge for some artifacts */
271 if (object_is_artifact(o_ptr)) spoil = TRUE;
272 #endif /* SPOIL_ARTIFACTS */
274 #ifdef SPOIL_EGO_ITEMS
275 /* Full knowledge for some ego-items */
276 if (object_is_ego(o_ptr)) spoil = TRUE;
277 #endif /* SPOIL_EGO_ITEMS */
279 /* Need full knowledge or spoilers */
280 if (spoil || (o_ptr->ident & IDENT_MENTAL))
283 if (object_is_fixed_artifact(o_ptr))
285 artifact_type *a_ptr = &a_info[o_ptr->name1];
287 for (i = 0; i < TR_FLAG_SIZE; i++)
288 flgs[i] = a_ptr->flags[i];
291 /* Random artifact ! */
292 for (i = 0; i < TR_FLAG_SIZE; i++)
293 flgs[i] |= o_ptr->art_flags[i];
296 if (object_is_smith(o_ptr))
298 int add = o_ptr->xtra3 - 1;
300 if (add < TR_FLAG_MAX)
304 else if (add == ESSENCE_TMP_RES_ACID)
306 add_flag(flgs, TR_RES_ACID);
308 else if (add == ESSENCE_TMP_RES_ELEC)
310 add_flag(flgs, TR_RES_ELEC);
312 else if (add == ESSENCE_TMP_RES_FIRE)
314 add_flag(flgs, TR_RES_FIRE);
316 else if (add == ESSENCE_TMP_RES_COLD)
318 add_flag(flgs, TR_RES_COLD);
320 else if (add == ESSENCE_SH_FIRE)
322 add_flag(flgs, TR_RES_FIRE);
323 add_flag(flgs, TR_SH_FIRE);
325 else if (add == ESSENCE_SH_ELEC)
327 add_flag(flgs, TR_RES_ELEC);
328 add_flag(flgs, TR_SH_ELEC);
330 else if (add == ESSENCE_SH_COLD)
332 add_flag(flgs, TR_RES_COLD);
333 add_flag(flgs, TR_SH_COLD);
335 else if (add == ESSENCE_RESISTANCE)
337 add_flag(flgs, TR_RES_ACID);
338 add_flag(flgs, TR_RES_ELEC);
339 add_flag(flgs, TR_RES_FIRE);
340 add_flag(flgs, TR_RES_COLD);
346 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
347 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
348 * @return concptr 発動名称を返す文字列ポインタ
350 static concptr item_activation_dragon_breath(object_type *o_ptr)
352 static char desc[256];
353 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
356 object_flags(o_ptr, flgs);
357 strcpy(desc, _("", "breath "));
359 for (i = 0; dragonbreath_info[i].flag != 0; i++)
361 if (have_flag(flgs, dragonbreath_info[i].flag))
363 if (n > 0) strcat(desc, _("、", ", "));
364 strcat(desc, dragonbreath_info[i].name);
369 strcat(desc, _("のブレス(250)", ""));
375 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
376 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
377 * @return concptr 発動名称を返す文字列ポインタ
379 static concptr item_activation_aux(object_type *o_ptr)
381 static char activation_detail[256];
385 const activation_type* const act_ptr = find_activation_info(o_ptr);
387 if (!act_ptr) return _("未定義", "something undefined");
389 desc = act_ptr->desc;
391 /* Overwrite description if it is special */
392 switch (act_ptr->index) {
394 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
395 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
398 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
399 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
402 desc = item_activation_dragon_breath(o_ptr);
405 if (o_ptr->name1 == ART_HYOUSIGI)
406 desc = _("拍子木を打ちならす", "beat wooden clappers");
408 case ACT_RESIST_ACID:
409 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
410 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
412 case ACT_RESIST_FIRE:
413 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
414 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
416 case ACT_RESIST_COLD:
417 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
418 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
420 case ACT_RESIST_ELEC:
421 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
422 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
424 case ACT_RESIST_POIS:
425 if (o_ptr->name2 == EGO_BRAND_POIS)
426 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
430 /* Timeout description */
431 constant = act_ptr->timeout.constant;
432 dice = act_ptr->timeout.dice;
433 if (constant == 0 && dice == 0) {
434 /* We can activate it every current_world_ptr->game_turn */
435 strcpy(timeout, _("いつでも", "every current_world_ptr->game_turn"));
436 } else if (constant < 0) {
437 /* Activations that have special timeout */
438 switch (act_ptr->index) {
440 sprintf(timeout, _("%d ターン毎", "every %d turns"),
441 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
444 sprintf(timeout, _("%d ターン毎", "every %d turns"),
445 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
448 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
451 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
454 strcpy(timeout, "undefined");
458 /* Normal timeout activations */
459 char constant_str[16], dice_str[16];
460 sprintf(constant_str, "%d", constant);
461 sprintf(dice_str, "d%d", dice);
462 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
463 (constant > 0) ? constant_str : "",
464 (constant > 0 && dice > 0) ? "+" : "",
465 (dice > 0) ? dice_str : "");
468 /* Build detail activate description */
469 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
471 return activation_detail;
475 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
476 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
477 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
478 * @return concptr 発動名称を返す文字列ポインタ
480 concptr item_activation(object_type *o_ptr)
482 BIT_FLAGS flgs[TR_FLAG_SIZE];
483 object_flags(o_ptr, flgs);
485 /* Require activation ability */
486 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
488 /* Get an explain of an activation */
489 if (activation_index(o_ptr))
491 return item_activation_aux(o_ptr);
495 if (o_ptr->tval == TV_WHISTLE)
497 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
500 if (o_ptr->tval == TV_CAPTURE)
502 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
505 return _("何も起きない", "Nothing");
510 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
511 * Describe a "fully identified" item
512 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
513 * @param mode 表示オプション
514 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
516 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
520 BIT_FLAGS flgs[TR_FLAG_SIZE];
524 GAME_TEXT o_name[MAX_NLEN];
529 int trivial_info = 0;
530 object_flags(o_ptr, flgs);
532 /* Extract the description */
534 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
535 (k_text + k_info[o_ptr->k_idx].text),
536 77 - 15, temp, sizeof(temp));
537 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
538 { info[i] = &temp[j]; i++;}
541 if (object_is_equipment(o_ptr))
543 /* Descriptions of a basic equipment is just a flavor */
547 /* Mega-Hack -- describe activation */
548 if (have_flag(flgs, TR_ACTIVATE))
550 info[i++] = _("始動したときの効果...", "It can be activated for...");
551 info[i++] = item_activation(o_ptr);
552 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
555 /* Figurines, a hack */
556 if (o_ptr->tval == TV_FIGURINE)
558 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
561 /* Figurines, a hack */
562 if (o_ptr->name1 == ART_STONEMASK)
564 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you current_world_ptr->game_turn into a vampire permanently.");
567 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
569 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
572 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
574 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
575 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
578 if (o_ptr->name2 == EGO_2WEAPON)
580 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
583 if (have_flag(flgs, TR_EASY_SPELL))
585 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
588 if (o_ptr->name2 == EGO_AMU_FOOL)
590 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
593 if (o_ptr->name2 == EGO_RING_THROW)
595 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
598 if (o_ptr->name2 == EGO_AMU_NAIVETY)
600 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
603 if (o_ptr->tval == TV_STATUE)
605 monster_race *r_ptr = &r_info[o_ptr->pval];
607 if (o_ptr->pval == MON_BULLGATES)
608 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
609 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
610 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
612 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
615 /* Hack -- describe lite's */
617 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
620 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
621 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
622 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
623 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
624 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
625 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
627 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
629 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
631 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
635 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
636 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
639 if(rad != 0) info[i++] = desc;
642 if (o_ptr->name2 == EGO_LITE_LONG)
644 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
647 /* And then describe it fully */
649 if (have_flag(flgs, TR_RIDING))
651 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
652 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
655 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
656 /* This information is not important enough */
660 if (have_flag(flgs, TR_STR))
662 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
664 if (have_flag(flgs, TR_INT))
666 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
668 if (have_flag(flgs, TR_WIS))
670 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
672 if (have_flag(flgs, TR_DEX))
674 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
676 if (have_flag(flgs, TR_CON))
678 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
680 if (have_flag(flgs, TR_CHR))
682 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
685 if (have_flag(flgs, TR_MAGIC_MASTERY))
687 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
690 if (have_flag(flgs, TR_STEALTH))
692 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
694 if (have_flag(flgs, TR_SEARCH))
696 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
698 if (have_flag(flgs, TR_INFRA))
700 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
702 if (have_flag(flgs, TR_TUNNEL))
704 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
706 if (have_flag(flgs, TR_SPEED))
708 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
710 if (have_flag(flgs, TR_BLOWS))
712 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
715 if (have_flag(flgs, TR_BRAND_ACID))
717 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
719 if (have_flag(flgs, TR_BRAND_ELEC))
721 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
723 if (have_flag(flgs, TR_BRAND_FIRE))
725 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
727 if (have_flag(flgs, TR_BRAND_COLD))
729 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
732 if (have_flag(flgs, TR_BRAND_POIS))
734 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
737 if (have_flag(flgs, TR_CHAOTIC))
739 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
742 if (have_flag(flgs, TR_VAMPIRIC))
744 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
747 if (have_flag(flgs, TR_IMPACT))
749 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
752 if (have_flag(flgs, TR_VORPAL))
754 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
757 if (have_flag(flgs, TR_KILL_DRAGON))
759 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
761 else if (have_flag(flgs, TR_SLAY_DRAGON))
763 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
766 if (have_flag(flgs, TR_KILL_ORC))
768 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
770 if (have_flag(flgs, TR_SLAY_ORC))
772 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
775 if (have_flag(flgs, TR_KILL_TROLL))
777 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
779 if (have_flag(flgs, TR_SLAY_TROLL))
781 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
784 if (have_flag(flgs, TR_KILL_GIANT))
786 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
788 else if (have_flag(flgs, TR_SLAY_GIANT))
790 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
793 if (have_flag(flgs, TR_KILL_DEMON))
795 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
797 if (have_flag(flgs, TR_SLAY_DEMON))
799 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
802 if (have_flag(flgs, TR_KILL_UNDEAD))
804 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
806 if (have_flag(flgs, TR_SLAY_UNDEAD))
808 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
811 if (have_flag(flgs, TR_KILL_EVIL))
813 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
815 if (have_flag(flgs, TR_SLAY_EVIL))
817 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
820 if (have_flag(flgs, TR_KILL_ANIMAL))
822 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
824 if (have_flag(flgs, TR_SLAY_ANIMAL))
826 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
829 if (have_flag(flgs, TR_KILL_HUMAN))
831 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
833 if (have_flag(flgs, TR_SLAY_HUMAN))
835 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
838 if (have_flag(flgs, TR_FORCE_WEAPON))
840 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
842 if (have_flag(flgs, TR_DEC_MANA))
844 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
846 if (have_flag(flgs, TR_SUST_STR))
848 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
850 if (have_flag(flgs, TR_SUST_INT))
852 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
854 if (have_flag(flgs, TR_SUST_WIS))
856 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
858 if (have_flag(flgs, TR_SUST_DEX))
860 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
862 if (have_flag(flgs, TR_SUST_CON))
864 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
866 if (have_flag(flgs, TR_SUST_CHR))
868 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
871 if (have_flag(flgs, TR_IM_ACID))
873 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
875 if (have_flag(flgs, TR_IM_ELEC))
877 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
879 if (have_flag(flgs, TR_IM_FIRE))
881 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
883 if (have_flag(flgs, TR_IM_COLD))
885 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
888 if (have_flag(flgs, TR_THROW))
890 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
893 if (have_flag(flgs, TR_FREE_ACT))
895 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
897 if (have_flag(flgs, TR_HOLD_EXP))
899 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
901 if (have_flag(flgs, TR_RES_FEAR))
903 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
905 if (have_flag(flgs, TR_RES_ACID))
907 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
909 if (have_flag(flgs, TR_RES_ELEC))
911 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
913 if (have_flag(flgs, TR_RES_FIRE))
915 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
917 if (have_flag(flgs, TR_RES_COLD))
919 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
921 if (have_flag(flgs, TR_RES_POIS))
923 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
926 if (have_flag(flgs, TR_RES_LITE))
928 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
930 if (have_flag(flgs, TR_RES_DARK))
932 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
935 if (have_flag(flgs, TR_RES_BLIND))
937 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
939 if (have_flag(flgs, TR_RES_CONF))
941 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
943 if (have_flag(flgs, TR_RES_SOUND))
945 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
947 if (have_flag(flgs, TR_RES_SHARDS))
949 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
952 if (have_flag(flgs, TR_RES_NETHER))
954 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
956 if (have_flag(flgs, TR_RES_NEXUS))
958 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
960 if (have_flag(flgs, TR_RES_CHAOS))
962 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
964 if (have_flag(flgs, TR_RES_DISEN))
966 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
969 if (have_flag(flgs, TR_LEVITATION))
971 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
974 if (have_flag(flgs, TR_SEE_INVIS))
976 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
978 if (have_flag(flgs, TR_TELEPATHY))
980 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
982 if (have_flag(flgs, TR_ESP_ANIMAL))
984 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
986 if (have_flag(flgs, TR_ESP_UNDEAD))
988 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
990 if (have_flag(flgs, TR_ESP_DEMON))
992 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
994 if (have_flag(flgs, TR_ESP_ORC))
996 info[i++] = _("それはオークを感知する。", "It senses orcs.");
998 if (have_flag(flgs, TR_ESP_TROLL))
1000 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1002 if (have_flag(flgs, TR_ESP_GIANT))
1004 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1006 if (have_flag(flgs, TR_ESP_DRAGON))
1008 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1010 if (have_flag(flgs, TR_ESP_HUMAN))
1012 info[i++] = _("それは人間を感知する。", "It senses humans.");
1014 if (have_flag(flgs, TR_ESP_EVIL))
1016 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1018 if (have_flag(flgs, TR_ESP_GOOD))
1020 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1022 if (have_flag(flgs, TR_ESP_NONLIVING))
1024 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1026 if (have_flag(flgs, TR_ESP_UNIQUE))
1028 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1030 if (have_flag(flgs, TR_SLOW_DIGEST))
1032 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1034 if (have_flag(flgs, TR_REGEN))
1036 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1038 if (have_flag(flgs, TR_WARNING))
1040 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1042 if (have_flag(flgs, TR_REFLECT))
1044 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1046 if (have_flag(flgs, TR_SH_FIRE))
1048 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1050 if (have_flag(flgs, TR_SH_ELEC))
1052 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1054 if (have_flag(flgs, TR_SH_COLD))
1056 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1058 if (have_flag(flgs, TR_NO_MAGIC))
1060 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1062 if (have_flag(flgs, TR_NO_TELE))
1064 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1066 if (have_flag(flgs, TR_XTRA_MIGHT))
1068 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1070 if (have_flag(flgs, TR_XTRA_SHOTS))
1072 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1075 if (have_flag(flgs, TR_BLESSED))
1077 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1080 if (object_is_cursed(o_ptr))
1082 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1084 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1086 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1088 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1092 info[i++] = _("それは呪われている。", "It is cursed.");
1095 * It's a trivial infomation since there is
1096 * fake inscription {cursed}
1102 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1104 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1106 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1108 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1110 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1112 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1114 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1116 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1118 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1120 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1122 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1124 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1126 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1128 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1130 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1132 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1134 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1136 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1138 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1140 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1142 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1144 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1146 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1148 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1150 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1152 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1154 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1156 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1158 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1160 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1162 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1164 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1166 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1168 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1170 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1172 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1175 /* Describe about this kind of object instead of THIS fake object */
1176 if (mode & SCROBJ_FAKE_OBJECT)
1178 switch (o_ptr->tval)
1181 switch (o_ptr->sval)
1183 case SV_RING_LORDLY:
1184 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1186 case SV_RING_WARNING:
1187 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1193 switch (o_ptr->sval)
1195 case SV_AMULET_RESISTANCE:
1196 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1197 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1199 case SV_AMULET_THE_MAGI:
1200 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1207 if (have_flag(flgs, TR_IGNORE_ACID) &&
1208 have_flag(flgs, TR_IGNORE_ELEC) &&
1209 have_flag(flgs, TR_IGNORE_FIRE) &&
1210 have_flag(flgs, TR_IGNORE_COLD))
1212 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1216 if (have_flag(flgs, TR_IGNORE_ACID))
1218 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1220 if (have_flag(flgs, TR_IGNORE_ELEC))
1222 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1224 if (have_flag(flgs, TR_IGNORE_FIRE))
1226 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1228 if (have_flag(flgs, TR_IGNORE_COLD))
1230 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1234 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1236 /* No relevant informations */
1237 if (i <= trivial_info) return (FALSE);
1240 Term_get_size(&wid, &hgt);
1242 /* Display Item name */
1243 if (!(mode & SCROBJ_FAKE_OBJECT))
1244 object_desc(o_name, o_ptr, 0);
1246 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1250 /* Erase the screen */
1251 for (k = 1; k < hgt; k++) prt("", k, 13);
1253 /* Label the information */
1254 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1256 monster_race *r_ptr = &r_info[o_ptr->pval];
1257 int namelen = strlen(r_name + r_ptr->name);
1258 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1259 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1260 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1264 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1267 /* We will print on top of the map (column 13) */
1268 for (k = 2, j = 0; j < i; j++)
1271 prt(info[j], k++, 15);
1273 /* Every 20 entries (lines 2 to 21), start over */
1274 if ((k == hgt - 2) && (j+1 < i))
1276 prt(_("-- 続く --", "-- more --"), k, 15);
1278 for (; k > 2; k--) prt("", k, 15);
1283 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1288 /* Gave knowledge */
1295 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1296 * Convert an inventory index into a one character label
1297 * @param i プレイヤーの所持/装備オブジェクトID
1298 * @return 対応するアルファベット
1299 * @details Note that the label does NOT distinguish inven/equip.
1301 char index_to_label(int i)
1303 /* Indexes for "inven" are easy */
1304 if (i < INVEN_RARM) return (I2A(i));
1306 /* Indexes for "equip" are offset */
1307 return (I2A(i - INVEN_RARM));
1311 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1312 * Convert a label into the index of an item in the "inven"
1313 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1314 * @details Note that the label does NOT distinguish inven/equip.
1316 INVENTORY_IDX label_to_inven(int c)
1321 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1323 /* Verify the index */
1324 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1326 /* Empty slots can never be chosen */
1327 if (!inventory[i].k_idx) return (-1);
1329 /* Return the index */
1335 extern bool select_ring_slot;
1339 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1340 * @param i プレイヤーの所持/装備オブジェクトID
1341 * @return 指輪枠ならばTRUEを返す。
1343 static bool is_ring_slot(int i)
1345 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1350 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1351 * Convert a label into the index of a item in the "equip"
1352 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1354 INVENTORY_IDX label_to_equip(int c)
1359 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1361 /* Verify the index */
1362 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1364 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1366 /* Empty slots can never be chosen */
1367 if (!inventory[i].k_idx) return (-1);
1369 /* Return the index */
1376 * @brief オブジェクトの該当装備部位IDを返す /
1377 * Determine which equipment slot (if any) an item likes
1378 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1379 * @return 対応する装備部位ID
1381 s16b wield_slot(object_type *o_ptr)
1383 /* Slot for equipment */
1384 switch (o_ptr->tval)
1391 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1392 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1393 return (INVEN_LARM);
1400 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1401 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1402 return (INVEN_RARM);
1412 /* Use the right hand first */
1413 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1415 /* Use the left hand for swapping (by default) */
1416 return (INVEN_LEFT);
1422 return (INVEN_NECK);
1427 return (INVEN_LITE);
1434 return (INVEN_BODY);
1439 return (INVEN_OUTER);
1445 return (INVEN_HEAD);
1450 return (INVEN_HANDS);
1455 return (INVEN_FEET);
1459 /* No slot available */
1464 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1465 * Return a string mentioning how a given item is carried
1466 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1467 * @return 部位表現の文字列ポインタ
1469 concptr mention_use(int i)
1473 /* Examine the location */
1477 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1479 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1483 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1485 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1488 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1489 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1490 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1491 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1492 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1493 case INVEN_BODY: p = _(" 体", "On body"); break;
1494 case INVEN_OUTER: p = _("体の上", "About body"); break;
1495 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1496 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1497 case INVEN_FEET: p = _(" 足", "On feet"); break;
1498 default: p = _("ザック", "In pack"); break;
1501 /* Return the result */
1507 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1508 * Return a string describing how a given item is being worn.
1509 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1510 * @return 状態表現内容の文字列ポインタ
1512 * Currently, only used for items in the equipment, not inventory.
1514 concptr describe_use(int i)
1521 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1523 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1527 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1529 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1532 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1533 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1534 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1535 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1536 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1537 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1538 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1539 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1540 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1541 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1542 default: p = _("ザックに入っている", "carrying in your pack"); break;
1545 /* Return the result */
1551 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1552 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1553 * @param book_tval ベースアイテムのtval
1554 * @param book_sval ベースアイテムのsval
1555 * @return 使用可能な魔法書ならばTRUEを返す。
1558 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1560 if (book_tval < TV_LIFE_BOOK) return FALSE;
1561 if (p_ptr->pclass == CLASS_SORCERER)
1563 return is_magic(tval2realm(book_tval));
1565 else if (p_ptr->pclass == CLASS_RED_MAGE)
1567 if (is_magic(tval2realm(book_tval)))
1568 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1570 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1574 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1575 * Check an item against the item tester info
1576 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1577 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1579 bool item_tester_okay(object_type *o_ptr)
1581 /* Hack -- allow listing empty slots */
1582 // if (item_tester_full) return (TRUE); // TODO:DELETE
1584 /* Require an item */
1585 if (!o_ptr->k_idx) return (FALSE);
1587 /* Hack -- ignore "gold" */
1588 if (o_ptr->tval == TV_GOLD)
1591 extern bool show_gold_on_floor;
1593 if (!show_gold_on_floor) return (FALSE);
1596 /* Check the tval */
1597 if (item_tester_tval)
1599 /* Is it a spellbook? If so, we need a hack -- TY */
1600 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1601 (item_tester_tval >= TV_LIFE_BOOK))
1602 return check_book_realm(o_ptr->tval, o_ptr->sval);
1604 if (item_tester_tval != o_ptr->tval) return (FALSE);
1607 /* Check the hook */
1608 if (item_tester_hook)
1610 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1619 * @brief 所持アイテム一覧を表示する /
1620 * Choice window "shadow" of the "show_inven()" function
1623 void display_inven(void)
1625 register int i, n, z = 0;
1627 TERM_COLOR attr = TERM_WHITE;
1629 GAME_TEXT o_name[MAX_NLEN];
1632 Term_get_size(&wid, &hgt);
1634 /* Find the "final" slot */
1635 for (i = 0; i < INVEN_PACK; i++)
1637 o_ptr = &inventory[i];
1639 /* Skip non-objects */
1640 if (!o_ptr->k_idx) continue;
1646 /* Display the pack */
1647 for (i = 0; i < z; i++)
1649 /* Examine the item */
1650 o_ptr = &inventory[i];
1652 /* Start with an empty "index" */
1653 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1655 /* Is this item "acceptable"? */
1656 if (item_tester_okay(o_ptr))
1658 /* Prepare an "index" */
1659 tmp_val[0] = index_to_label(i);
1661 /* Bracket the "index" --(-- */
1665 /* Display the index (or blank space) */
1666 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1668 /* Obtain an item description */
1669 object_desc(o_name, o_ptr, 0);
1671 /* Obtain the length of the description */
1675 attr = tval_to_attr[o_ptr->tval % 128];
1677 /* Grey out charging items */
1683 /* Display the entry itself */
1684 Term_putstr(3, i, n, attr, o_name);
1686 /* Erase the rest of the line */
1687 Term_erase(3+n, i, 255);
1689 /* Display the weight if needed */
1692 int wgt = o_ptr->weight * o_ptr->number;
1694 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1696 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1699 prt(tmp_val, i, wid - 9);
1703 /* Erase the rest of the window */
1704 for (i = z; i < hgt; i++)
1706 /* Erase the line */
1707 Term_erase(0, i, 255);
1714 * @brief 装備アイテム一覧を表示する /
1715 * Choice window "shadow" of the "show_equip()" function
1718 void display_equip(void)
1722 TERM_COLOR attr = TERM_WHITE;
1724 GAME_TEXT o_name[MAX_NLEN];
1727 Term_get_size(&wid, &hgt);
1729 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1731 /* Examine the item */
1732 o_ptr = &inventory[i];
1734 /* Start with an empty "index" */
1735 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1737 /* Is this item "acceptable"? */
1738 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1740 /* Prepare an "index" */
1741 tmp_val[0] = index_to_label(i);
1743 /* Bracket the "index" --(-- */
1747 /* Display the index (or blank space) */
1748 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1750 /* Obtain an item description */
1751 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1753 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1758 object_desc(o_name, o_ptr, 0);
1759 attr = tval_to_attr[o_ptr->tval % 128];
1762 /* Obtain the length of the description */
1765 /* Grey out charging items */
1771 /* Display the entry itself */
1772 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1774 /* Erase the rest of the line */
1775 Term_erase(3+n, i - INVEN_RARM, 255);
1777 /* Display the weight (if needed) */
1780 int wgt = o_ptr->weight * o_ptr->number;
1782 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1784 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1787 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1790 /* Display the slot description (if needed) */
1793 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1794 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1798 /* Erase the rest of the window */
1799 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1801 /* Clear that line */
1802 Term_erase(0, i, 255);
1808 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1809 * Find the "first" inventory object with the given "tag".
1810 * @param cp 対応するタグIDを与える参照ポインタ
1811 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1812 * @param mode 所持、装備の切り替え
1813 * @return タグに該当するオブジェクトがあるならTRUEを返す
1815 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1816 * inscription of an object. Alphabetical characters don't work as a\n
1817 * tag in this form.\n
1819 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1820 * and "x" is the "current" command_cmd code.\n
1822 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1825 COMMAND_CODE start, end;
1828 /* Extract index from mode */
1833 end = INVEN_TOTAL - 1;
1838 end = INVEN_PACK - 1;
1845 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1847 /* Check every inventory object */
1848 for (i = start; i <= end; i++)
1850 object_type *o_ptr = &inventory[i];
1852 /* Skip non-objects */
1853 if (!o_ptr->k_idx) continue;
1855 /* Skip empty inscriptions */
1856 if (!o_ptr->inscription) continue;
1858 /* Skip non-choice */
1859 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1862 s = my_strchr(quark_str(o_ptr->inscription), '@');
1864 /* Process all tags */
1867 /* Check the special tags */
1868 if ((s[1] == command_cmd) && (s[2] == tag))
1870 /* Save the actual inventory ID */
1877 /* Find another '@' */
1878 s = my_strchr(s + 1, '@');
1883 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1885 /* Don't allow {@#} with '#' being alphabet */
1886 if (tag < '0' || '9' < tag)
1892 /* Check every object */
1893 for (i = start; i <= end; i++)
1895 object_type *o_ptr = &inventory[i];
1897 /* Skip non-objects */
1898 if (!o_ptr->k_idx) continue;
1900 /* Skip empty inscriptions */
1901 if (!o_ptr->inscription) continue;
1903 /* Skip non-choice */
1904 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1907 s = my_strchr(quark_str(o_ptr->inscription), '@');
1909 /* Process all tags */
1912 /* Check the normal tags */
1915 /* Save the actual inventory ID */
1922 /* Find another '@' */
1923 s = my_strchr(s + 1, '@');
1933 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1934 * Find the "first" inventory object with the given "tag".
1935 * @param cp 対応するタグIDを与える参照ポインタ
1936 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1937 * @param floor_list 床上アイテムの配列
1938 * @param floor_num 床上アイテムの配列ID
1939 * @return タグに該当するオブジェクトがあるならTRUEを返す
1941 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1942 * inscription of an object. Alphabetical characters don't work as a\n
1943 * tag in this form.\n
1945 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1946 * and "x" is the "current" command_cmd code.\n
1948 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1953 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1955 /* Check every object in the grid */
1956 for (i = 0; i < floor_num && i < 23; i++)
1958 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1960 /* Skip empty inscriptions */
1961 if (!o_ptr->inscription) continue;
1964 s = my_strchr(quark_str(o_ptr->inscription), '@');
1966 /* Process all tags */
1969 /* Check the special tags */
1970 if ((s[1] == command_cmd) && (s[2] == tag))
1972 /* Save the actual floor object ID */
1979 /* Find another '@' */
1980 s = my_strchr(s + 1, '@');
1985 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1987 /* Don't allow {@#} with '#' being alphabet */
1988 if (tag < '0' || '9' < tag)
1994 /* Check every object in the grid */
1995 for (i = 0; i < floor_num && i < 23; i++)
1997 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1999 /* Skip empty inscriptions */
2000 if (!o_ptr->inscription) continue;
2003 s = my_strchr(quark_str(o_ptr->inscription), '@');
2005 /* Process all tags */
2008 /* Check the normal tags */
2011 /* Save the floor object ID */
2018 /* Find another '@' */
2019 s = my_strchr(s + 1, '@');
2029 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2030 * Move around label characters with correspond tags
2031 * @param label ラベルリストを取得する文字列参照ポインタ
2032 * @param mode 所持品リストか装備品リストかの切り替え
2035 static void prepare_label_string(char *label, BIT_FLAGS mode)
2037 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2038 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2041 /* Prepare normal labels */
2042 strcpy(label, alphabet_chars);
2044 /* Move each label */
2045 for (i = 0; i < 52; i++)
2048 SYMBOL_CODE c = alphabet_chars[i];
2050 /* Find a tag with this label */
2051 if (get_tag(&index, c, mode))
2053 /* Delete the overwritten label */
2054 if (label[i] == c) label[i] = ' ';
2056 /* Move the label to the place of corresponding tag */
2057 label[index - offset] = c;
2064 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2065 * Move around label characters with correspond tags (floor version)
2066 * @param label ラベルリストを取得する文字列参照ポインタ
2067 * @param floor_list 床上アイテムの配列
2068 * @param floor_num 床上アイテムの配列ID
2073 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2075 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2078 /* Prepare normal labels */
2079 strcpy(label, alphabet_chars);
2081 /* Move each label */
2082 for (i = 0; i < 52; i++)
2085 SYMBOL_CODE c = alphabet_chars[i];
2087 /* Find a tag with this label */
2088 if (get_tag_floor(&index, c, floor_list, floor_num))
2090 /* Delete the overwritten label */
2091 if (label[i] == c) label[i] = ' ';
2093 /* Move the label to the place of corresponding tag */
2101 * @brief 所持アイテムの表示を行う /
2102 * Display the inventory.
2103 * @param target_item アイテムの選択処理を行うか否か。
2104 * @return 選択したアイテムのタグ
2106 * Hack -- do not display "trailing" empty slots
2108 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2112 int col, cur_col, len;
2114 GAME_TEXT o_name[MAX_NLEN];
2116 COMMAND_CODE out_index[23];
2117 TERM_COLOR out_color[23];
2118 char out_desc[23][MAX_NLEN];
2119 COMMAND_CODE target_item_label = 0;
2121 char inven_label[52 + 1];
2123 /* Starting column */
2126 Term_get_size(&wid, &hgt);
2128 /* Default "max-length" */
2129 len = wid - col - 1;
2132 /* Find the "final" slot */
2133 for (i = 0; i < INVEN_PACK; i++)
2135 o_ptr = &inventory[i];
2137 /* Skip non-objects */
2138 if (!o_ptr->k_idx) continue;
2144 prepare_label_string(inven_label, USE_INVEN);
2146 /* Display the inventory */
2147 for (k = 0, i = 0; i < z; i++)
2149 o_ptr = &inventory[i];
2151 /* Is this item acceptable? */
2152 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2154 object_desc(o_name, o_ptr, 0);
2156 /* Save the object index, color, and description */
2158 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2160 /* Grey out charging items */
2163 out_color[k] = TERM_L_DARK;
2166 (void)strcpy(out_desc[k], o_name);
2168 /* Find the predicted "line length" */
2169 l = strlen(out_desc[k]) + 5;
2171 /* Be sure to account for the weight */
2172 if (show_weights) l += 9;
2174 /* Account for icon if displayed */
2175 if (show_item_graph)
2178 if (use_bigtile) l++;
2181 /* Maintain the maximum length */
2182 if (l > len) len = l;
2184 /* Advance to next "line" */
2188 /* Find the column to start in */
2189 col = (len > wid - 4) ? 0 : (wid - len - 1);
2191 /* Output each entry */
2192 for (j = 0; j < k; j++)
2195 o_ptr = &inventory[i];
2197 /* Clear the line */
2198 prt("", j + 1, col ? col - 2 : col);
2200 if (use_menu && target_item)
2202 if (j == (target_item-1))
2204 strcpy(tmp_val, _("》", "> "));
2205 target_item_label = i;
2207 else strcpy(tmp_val, " ");
2209 else if (i <= INVEN_PACK)
2211 /* Prepare an index --(-- */
2212 sprintf(tmp_val, "%c)", inven_label[i]);
2216 /* Prepare an index --(-- */
2217 sprintf(tmp_val, "%c)", index_to_label(i));
2220 /* Clear the line with the (possibly indented) index */
2221 put_str(tmp_val, j + 1, col);
2225 /* Display graphics for object, if desired */
2226 if (show_item_graph)
2228 TERM_COLOR a = object_attr(o_ptr);
2229 SYMBOL_CODE c = object_char(o_ptr);
2230 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2231 if (use_bigtile) cur_col++;
2237 /* Display the entry itself */
2238 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2240 /* Display the weight if needed */
2243 int wgt = o_ptr->weight * o_ptr->number;
2245 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2247 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2250 prt(tmp_val, j + 1, wid - 9);
2254 /* Make a "shadow" below the list (only if needed) */
2255 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2257 /* Save the new column */
2260 return target_item_label;
2265 * @brief 装備アイテムの表示を行う /
2266 * Display the equipment.
2267 * @param target_item アイテムの選択処理を行うか否か。
2268 * @return 選択したアイテムのタグ
2270 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2274 int col, cur_col, len;
2277 GAME_TEXT o_name[MAX_NLEN];
2278 COMMAND_CODE out_index[23];
2279 TERM_COLOR out_color[23];
2280 char out_desc[23][MAX_NLEN];
2281 COMMAND_CODE target_item_label = 0;
2283 char equip_label[52 + 1];
2285 /* Starting column */
2288 Term_get_size(&wid, &hgt);
2290 /* Maximal length */
2291 len = wid - col - 1;
2294 /* Scan the equipment list */
2295 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2297 o_ptr = &inventory[i];
2299 /* Is this item acceptable? */
2300 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2301 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2302 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2304 object_desc(o_name, o_ptr, 0);
2306 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2308 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2309 out_color[k] = TERM_WHITE;
2313 (void)strcpy(out_desc[k], o_name);
2314 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2318 /* Grey out charging items */
2321 out_color[k] = TERM_L_DARK;
2324 /* Extract the maximal length (see below) */
2326 l = strlen(out_desc[k]) + (2 + 1);
2328 l = strlen(out_desc[k]) + (2 + 3);
2332 /* Increase length for labels (if needed) */
2334 if (show_labels) l += (7 + 2);
2336 if (show_labels) l += (14 + 2);
2340 /* Increase length for weight (if needed) */
2341 if (show_weights) l += 9;
2343 if (show_item_graph) l += 2;
2345 /* Maintain the max-length */
2346 if (l > len) len = l;
2348 /* Advance the entry */
2352 /* Hack -- Find a column to start in */
2354 col = (len > wid - 6) ? 0 : (wid - len - 1);
2356 col = (len > wid - 4) ? 0 : (wid - len - 1);
2359 prepare_label_string(equip_label, USE_EQUIP);
2361 /* Output each entry */
2362 for (j = 0; j < k; j++)
2365 o_ptr = &inventory[i];
2367 /* Clear the line */
2368 prt("", j + 1, col ? col - 2 : col);
2370 if (use_menu && target_item)
2372 if (j == (target_item-1))
2374 strcpy(tmp_val, _("》", "> "));
2375 target_item_label = i;
2377 else strcpy(tmp_val, " ");
2379 else if (i >= INVEN_RARM)
2381 /* Prepare an index --(-- */
2382 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2386 /* Prepare an index --(-- */
2387 sprintf(tmp_val, "%c)", index_to_label(i));
2390 /* Clear the line with the (possibly indented) index */
2391 put_str(tmp_val, j+1, col);
2395 /* Display graphics for object, if desired */
2396 if (show_item_graph)
2398 TERM_COLOR a = object_attr(o_ptr);
2399 SYMBOL_CODE c = object_char(o_ptr);
2400 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2401 if (use_bigtile) cur_col++;
2409 /* Mention the use */
2410 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2412 put_str(tmp_val, j+1, cur_col);
2414 /* Display the entry itself */
2415 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2421 /* Display the entry itself */
2422 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2425 /* Display the weight if needed */
2428 int wgt = o_ptr->weight * o_ptr->number;
2430 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2432 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2435 prt(tmp_val, j + 1, wid - 9);
2439 /* Make a "shadow" below the list (only if needed) */
2440 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2442 /* Save the new column */
2445 return target_item_label;
2449 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2450 * Flip "inven" and "equip" in any sub-windows
2453 void toggle_inven_equip(void)
2458 for (j = 0; j < 8; j++)
2461 if (!angband_term[j]) continue;
2463 /* Flip inven to equip */
2464 if (window_flag[j] & (PW_INVEN))
2467 window_flag[j] &= ~(PW_INVEN);
2468 window_flag[j] |= (PW_EQUIP);
2470 p_ptr->window |= (PW_EQUIP);
2473 /* Flip inven to equip */
2474 else if (window_flag[j] & (PW_EQUIP))
2477 window_flag[j] &= ~(PW_EQUIP);
2478 window_flag[j] |= (PW_INVEN);
2480 p_ptr->window |= (PW_INVEN);
2486 * @brief 選択したアイテムの確認処理の補助 /
2487 * Verify the choice of an item.
2488 * @param prompt メッセージ表示の一部
2489 * @param item 選択アイテムID
2490 * @return 確認がYesならTRUEを返す。
2491 * @details The item can be negative to mean "item on floor".
2493 static bool verify(concptr prompt, INVENTORY_IDX item)
2495 GAME_TEXT o_name[MAX_NLEN];
2496 char out_val[MAX_NLEN+20];
2503 o_ptr = &inventory[item];
2509 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2511 object_desc(o_name, o_ptr, 0);
2514 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2517 return (get_check(out_val));
2522 * @brief 選択したアイテムの確認処理のメインルーチン /
2523 * @param item 選択アイテムID
2524 * @return 確認がYesならTRUEを返す。
2525 * @details The item can be negative to mean "item on floor".
2526 * Hack -- allow user to "prevent" certain choices
2528 static bool get_item_allow(INVENTORY_IDX item)
2532 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2537 o_ptr = &inventory[item];
2543 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2546 /* No inscription */
2547 if (!o_ptr->inscription) return (TRUE);
2550 s = my_strchr(quark_str(o_ptr->inscription), '!');
2552 /* Process preventions */
2555 /* Check the "restriction" */
2556 if ((s[1] == command_cmd) || (s[1] == '*'))
2558 /* Verify the choice */
2559 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2562 /* Find another '!' */
2563 s = my_strchr(s + 1, '!');
2572 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2573 * Auxiliary function for "get_item()" -- test an index
2575 * @return 正規のIDならばTRUEを返す。
2577 static bool get_item_okay(OBJECT_IDX i)
2580 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2582 if (select_ring_slot) return is_ring_slot(i);
2584 /* Verify the item */
2585 if (!item_tester_okay(&inventory[i])) return (FALSE);
2592 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2593 * Determine whether get_item() can get some item or not
2594 * @return アイテムを拾えるならばTRUEを返す。
2595 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2597 bool can_get_item(void)
2600 OBJECT_IDX floor_list[23];
2601 ITEM_NUMBER floor_num = 0;
2603 for (j = 0; j < INVEN_TOTAL; j++)
2604 if (item_tester_okay(&inventory[j]))
2607 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2615 * @brief オブジェクト選択の汎用関数 /
2616 * Let the user select an item, save its "index"
2617 * @param cp 選択したオブジェクトのIDを返す。
2618 * @param pmt 選択目的のメッセージ
2619 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2620 * @param mode オプションフラグ
2621 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2622 * Return TRUE only if an acceptable item was chosen by the user.\n
2624 * The selected item must satisfy the "item_tester_hook()" function,\n
2625 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2627 * All "item_tester" restrictions are cleared before this function returns.\n
2629 * The user is allowed to choose acceptable items from the equipment,\n
2630 * inventory, or floor, respectively, if the proper flag was given,\n
2631 * and there are any acceptable items in that location.\n
2633 * The equipment or inventory are displayed (even if no acceptable\n
2634 * items are in that location) if the proper flag was given.\n
2636 * If there are no acceptable items available anywhere, and "str" is\n
2637 * not NULL, then it will be used as the text of a warning message\n
2638 * before the function returns.\n
2640 * Note that the user must press "-" to specify the item on the floor,\n
2641 * and there is no way to "examine" the item on the floor, while the\n
2642 * use of "capital" letters will "examine" an inventory/equipment item,\n
2643 * and prompt for its use.\n
2645 * If a legal item is selected from the inventory, we save it in "cp"\n
2646 * directly (0 to 35), and return TRUE.\n
2648 * If a legal item is selected from the floor, we save it in "cp" as\n
2649 * a negative (-1 to -511), and return TRUE.\n
2651 * If no item is available, we do nothing to "cp", and we display a\n
2652 * warning message, using "str" if available, and return FALSE.\n
2654 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2656 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2657 * to allow the user to enter a command while viewing those screens, and\n
2658 * also to induce "auto-enter" of stores, and other such stuff.\n
2660 * Global "p_ptr->command_see" may be set before calling this function to start\n
2661 * out in "browse" mode. It is cleared before this function returns.\n
2663 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2664 * If it is TRUE then we are viewing inventory, else equipment.\n
2666 * We always erase the prompt when we are done, leaving a blank line,\n
2667 * or a warning message, if appropriate, if no items are available.\n
2669 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2671 OBJECT_IDX this_o_idx, next_o_idx = 0;
2688 bool allow_floor = FALSE;
2690 bool toggle = FALSE;
2695 int menu_line = (use_menu ? 1 : 0);
2699 static char prev_tag = '\0';
2700 char cur_tag = '\0';
2702 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2705 if (mode & USE_EQUIP) equip = TRUE;
2706 if (mode & USE_INVEN) inven = TRUE;
2707 if (mode & USE_FLOOR) floor = TRUE;
2709 /* Get the item index */
2710 if (repeat_pull(cp))
2713 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2715 item_tester_tval = 0;
2716 item_tester_hook = NULL;
2717 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2722 else if (floor && (*cp < 0))
2728 o_ptr = ¤t_floor_ptr->o_list[k];
2730 /* Validate the item */
2731 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2733 /* Forget restrictions */
2734 item_tester_tval = 0;
2735 item_tester_hook = NULL;
2736 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2743 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2744 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2746 if (prev_tag && command_cmd)
2748 /* Look up the tag and validate the item */
2749 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2750 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2751 else if (!get_item_okay(k)) /* Reject */;
2754 /* Accept that choice */
2757 /* Forget restrictions */
2758 item_tester_tval = 0;
2759 item_tester_hook = NULL;
2760 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2766 prev_tag = '\0'; /* prev_tag is no longer effective */
2769 /* Verify the item */
2770 else if (get_item_okay(*cp))
2772 /* Forget restrictions */
2773 item_tester_tval = 0;
2774 item_tester_hook = NULL;
2775 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2787 /* No item selected */
2791 /* Full inventory */
2793 i2 = INVEN_PACK - 1;
2795 /* Forbid inventory */
2796 if (!inven) i2 = -1;
2799 for (j = 0; j < INVEN_PACK; j++)
2800 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
2803 /* Restrict inventory indexes */
2804 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2805 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2808 /* Full equipment */
2810 e2 = INVEN_TOTAL - 1;
2812 /* Forbid equipment */
2813 if (!equip) e2 = -1;
2816 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2817 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
2818 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2821 /* Restrict equipment indexes */
2822 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2823 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2825 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2829 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2831 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2835 /* Restrict floor usage */
2838 /* Scan all objects in the grid */
2839 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)
2842 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
2843 next_o_idx = o_ptr->next_o_idx;
2845 /* Accept the item on the floor if legal */
2846 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2850 /* Require at least one legal choice */
2851 if (!allow_floor && (i1 > i2) && (e1 > e2))
2853 /* Cancel p_ptr->command_see */
2854 command_see = FALSE;
2858 if (mode & USE_FORCE) {
2864 /* Analyze choices */
2867 /* Hack -- Start on equipment if requested */
2868 if (command_see && command_wrk && equip)
2873 /* Use inventory if allowed */
2876 command_wrk = FALSE;
2879 /* Use equipment if allowed */
2885 /* Use inventory for floor */
2888 command_wrk = FALSE;
2894 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2896 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2898 /* Hack -- start out in "display" mode */
2905 /* Repeat until done */
2908 COMMAND_CODE get_item_label = 0;
2915 for (j = 0; j < 8; j++)
2918 if (!angband_term[j]) continue;
2920 /* Count windows displaying inven */
2921 if (window_flag[j] & (PW_INVEN)) ni++;
2923 /* Count windows displaying equip */
2924 if (window_flag[j] & (PW_EQUIP)) ne++;
2927 /* Toggle if needed */
2928 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2931 toggle_inven_equip();
2937 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2940 /* Inventory screen */
2943 /* Redraw if needed */
2944 if (command_see) get_item_label = show_inven(menu_line, mode);
2947 /* Equipment screen */
2950 /* Redraw if needed */
2951 if (command_see) get_item_label = show_equip(menu_line, mode);
2954 /* Viewing inventory */
2957 /* Begin the prompt */
2958 sprintf(out_val, _("持ち物:", "Inven:"));
2960 /* Some legal items */
2961 if ((i1 <= i2) && !use_menu)
2963 /* Build the prompt */
2964 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2965 index_to_label(i1), index_to_label(i2));
2968 strcat(out_val, tmp_val);
2971 /* Indicate ability to "view" */
2972 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2975 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2978 /* Viewing equipment */
2981 /* Begin the prompt */
2982 sprintf(out_val, _("装備品:", "Equip:"));
2984 /* Some legal items */
2985 if ((e1 <= e2) && !use_menu)
2987 /* Build the prompt */
2988 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2989 index_to_label(e1), index_to_label(e2));
2992 strcat(out_val, tmp_val);
2995 /* Indicate ability to "view" */
2996 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2999 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
3002 /* Indicate legality of the "floor" item */
3003 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3004 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3006 /* Finish the prompt */
3007 strcat(out_val, " ESC");
3009 /* Build the prompt */
3010 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3012 /* Show the prompt */
3020 int max_line = (command_wrk ? max_equip : max_inven);
3036 menu_line += (max_line - 1);
3055 /* Verify legality */
3056 if (!inven || !equip)
3062 /* Hack -- Fix screen */
3069 /* Switch inven/equip */
3070 command_wrk = !command_wrk;
3071 max_line = (command_wrk ? max_equip : max_inven);
3072 if (menu_line > max_line) menu_line = max_line;
3074 /* Need to redraw */
3083 if (command_wrk == USE_FLOOR)
3086 (*cp) = -get_item_label;
3090 /* Validate the item */
3091 if (!get_item_okay(get_item_label))
3097 /* Allow player to "refuse" certain actions */
3098 if (!get_item_allow(get_item_label))
3104 /* Accept that choice */
3105 (*cp) = get_item_label;
3114 if (mode & USE_FORCE) {
3122 if (menu_line > max_line) menu_line -= max_line;
3143 command_see = FALSE;
3160 /* Verify legality */
3161 if (!inven || !equip)
3167 /* Hack -- Fix screen */
3174 /* Switch inven/equip */
3175 command_wrk = !command_wrk;
3177 /* Need to redraw */
3183 /* Use floor item */
3186 /* Scan all objects in the grid */
3187 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)
3190 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3191 next_o_idx = o_ptr->next_o_idx;
3193 /* Validate the item */
3194 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3199 /* Verify the item (if required) */
3200 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3202 /* Allow player to "refuse" certain actions */
3203 if (!get_item_allow(k)) continue;
3205 /* Accept that choice */
3221 case '1': case '2': case '3':
3222 case '4': case '5': case '6':
3223 case '7': case '8': case '9':
3225 /* Look up the tag */
3226 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3232 /* Hack -- Validate the item */
3233 if ((k < INVEN_RARM) ? !inven : !equip)
3239 /* Validate the item */
3240 if (!get_item_okay(k))
3246 /* Allow player to "refuse" certain actions */
3247 if (!get_item_allow(k))
3253 /* Accept that choice */
3265 /* Choose "default" inventory item */
3268 k = ((i1 == i2) ? i1 : -1);
3271 /* Choose "default" equipment item */
3274 k = ((e1 == e2) ? e1 : -1);
3277 /* Validate the item */
3278 if (!get_item_okay(k))
3284 /* Allow player to "refuse" certain actions */
3285 if (!get_item_allow(k))
3291 /* Accept that choice */
3301 if (mode & USE_FORCE) {
3314 bool not_found = FALSE;
3316 /* Look up the alphabetical tag */
3317 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3322 /* Hack -- Validate the item */
3323 else if ((k < INVEN_RARM) ? !inven : !equip)
3328 /* Validate the item */
3329 else if (!get_item_okay(k))
3336 /* Accept that choice */
3344 /* Extract "query" setting */
3345 ver = isupper(which);
3346 which = (char)tolower(which);
3348 /* Convert letter to inventory index */
3351 if (which == '(') k = i1;
3352 else if (which == ')') k = i2;
3353 else k = label_to_inven(which);
3356 /* Convert letter to equipment index */
3359 if (which == '(') k = e1;
3360 else if (which == ')') k = e2;
3361 else k = label_to_equip(which);
3364 /* Validate the item */
3365 if (!get_item_okay(k))
3371 /* Verify the item */
3372 if (ver && !verify(_("本当に", "Try"), k))
3378 /* Allow player to "refuse" certain actions */
3379 if (!get_item_allow(k))
3385 /* Accept that choice */
3396 /* Fix the screen if necessary */
3401 /* Hack -- Cancel "display" */
3402 command_see = FALSE;
3406 /* Forget the item_tester_tval restriction */
3407 item_tester_tval = 0;
3409 /* Forget the item_tester_hook restriction */
3410 item_tester_hook = NULL;
3413 /* Clean up 'show choices' */
3414 /* Toggle again if needed */
3415 if (toggle) toggle_inven_equip();
3417 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3420 /* Clear the prompt line */
3423 /* Warning if needed */
3424 if (oops && str) msg_print(str);
3429 if (command_cmd) prev_tag = cur_tag;
3430 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3436 * Choose an item and get auto-picker entry from it.
3438 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3441 if (!get_item(&item, q, s, option)) return NULL;
3442 if (idx) *idx = item;
3444 if (item == INVEN_FORCE) return NULL;
3446 /* Get the item (in the pack) */
3447 else if (item >= 0) return &inventory[item];
3449 /* Get the item (on the floor) */
3450 else return ¤t_floor_ptr->o_list[0 - item];
3455 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3456 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3457 * @param y 走査するフロアのY座標
3458 * @param x 走査するフロアのX座標
3459 * @param mode オプションフラグ
3460 * @return 対象のマスに落ちているアイテム数
3462 * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
3463 * location. Valid flags are:
3465 * mode & 0x01 -- Item tester
3466 * mode & 0x02 -- Marked items only
3467 * mode & 0x04 -- Stop after first
3469 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3471 OBJECT_IDX this_o_idx, next_o_idx;
3473 ITEM_NUMBER num = 0;
3476 if (!in_bounds(y, x)) return 0;
3478 /* Scan all objects in the grid */
3479 for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3482 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3483 next_o_idx = o_ptr->next_o_idx;
3486 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3489 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3491 /* Accept this item */
3492 /* XXX Hack -- Enforce limit */
3494 items[num] = this_o_idx;
3499 if (mode & 0x04) break;
3506 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3507 * @param target_item カーソルの初期値
3508 * @param y 走査するフロアのY座標
3509 * @param x 走査するフロアのX座標
3510 * @param min_width 表示の長さ
3511 * @return 選択したアイテムの添え字
3514 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3522 GAME_TEXT o_name[MAX_NLEN];
3525 COMMAND_CODE out_index[23];
3526 TERM_COLOR out_color[23];
3527 char out_desc[23][MAX_NLEN];
3528 COMMAND_CODE target_item_label = 0;
3530 OBJECT_IDX floor_list[23];
3531 ITEM_NUMBER floor_num;
3533 char floor_label[52 + 1];
3535 bool dont_need_to_show_weights = TRUE;
3537 Term_get_size(&wid, &hgt);
3539 /* Default length */
3540 len = MAX((*min_width), 20);
3542 /* Scan for objects in the grid, using item_tester_okay() */
3543 floor_num = scan_floor(floor_list, y, x, 0x03);
3545 /* Display the floor objects */
3546 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3548 o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
3550 object_desc(o_name, o_ptr, 0);
3552 /* Save the index */
3555 /* Acquire inventory color */
3556 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3558 /* Save the object description */
3559 strcpy(out_desc[k], o_name);
3561 /* Find the predicted "line length" */
3562 l = strlen(out_desc[k]) + 5;
3564 /* Be sure to account for the weight */
3565 if (show_weights) l += 9;
3567 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3569 /* Maintain the maximum length */
3570 if (l > len) len = l;
3572 /* Advance to next "line" */
3576 if (show_weights && dont_need_to_show_weights) len -= 9;
3581 /* Find the column to start in */
3582 col = (len > wid - 4) ? 0 : (wid - len - 1);
3584 prepare_label_string_floor(floor_label, floor_list, floor_num);
3586 /* Output each entry */
3587 for (j = 0; j < k; j++)
3589 m = floor_list[out_index[j]];
3590 o_ptr = ¤t_floor_ptr->o_list[m];
3592 /* Clear the line */
3593 prt("", j + 1, col ? col - 2 : col);
3595 if (use_menu && target_item)
3597 if (j == (target_item-1))
3599 strcpy(tmp_val, _("》", "> "));
3600 target_item_label = m;
3602 else strcpy(tmp_val, " ");
3606 /* Prepare an index --(-- */
3607 sprintf(tmp_val, "%c)", floor_label[j]);
3610 /* Clear the line with the (possibly indented) index */
3611 put_str(tmp_val, j + 1, col);
3613 /* Display the entry itself */
3614 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3616 /* Display the weight if needed */
3617 if (show_weights && (o_ptr->tval != TV_GOLD))
3619 int wgt = o_ptr->weight * o_ptr->number;
3621 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3623 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3626 prt(tmp_val, j + 1, wid - 9);
3630 /* Make a "shadow" below the list (only if needed) */
3631 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3633 return target_item_label;
3637 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3638 * Let the user select an item, save its "index"
3639 * @param cp 選択したオブジェクトのIDを返す。
3640 * @param pmt 選択目的のメッセージ
3641 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3642 * @param mode オプションフラグ
3643 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3645 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3647 char n1 = ' ', n2 = ' ', which = ' ';
3650 COMMAND_CODE i1, i2;
3651 COMMAND_CODE e1, e2;
3659 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3660 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3661 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3662 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3664 bool allow_equip = FALSE;
3665 bool allow_inven = FALSE;
3666 bool allow_floor = FALSE;
3668 bool toggle = FALSE;
3673 ITEM_NUMBER floor_num;
3674 OBJECT_IDX floor_list[23];
3676 TERM_LEN min_width = 0;
3678 int menu_line = (use_menu ? 1 : 0);
3682 static char prev_tag = '\0';
3683 char cur_tag = '\0';
3685 /* Get the item index */
3686 if (repeat_pull(cp))
3689 if (force && (*cp == INVEN_FORCE))
3691 item_tester_tval = 0;
3692 item_tester_hook = NULL;
3693 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3698 else if (floor && (*cp < 0))
3700 if (prev_tag && command_cmd)
3702 /* Scan all objects in the grid */
3703 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3705 /* Look up the tag */
3706 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3708 /* Accept that choice */
3709 (*cp) = 0 - floor_list[k];
3711 /* Forget restrictions */
3712 item_tester_tval = 0;
3713 item_tester_hook = NULL;
3714 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3720 prev_tag = '\0'; /* prev_tag is no longer effective */
3723 /* Validate the item */
3724 else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
3726 /* Forget restrictions */
3727 item_tester_tval = 0;
3728 item_tester_hook = NULL;
3729 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3736 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3737 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3739 if (prev_tag && command_cmd)
3741 /* Look up the tag and validate the item */
3742 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3743 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3744 else if (!get_item_okay(k)) /* Reject */;
3747 /* Accept that choice */
3750 /* Forget restrictions */
3751 item_tester_tval = 0;
3752 item_tester_hook = NULL;
3753 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3759 prev_tag = '\0'; /* prev_tag is no longer effective */
3762 /* Verify the item */
3763 else if (get_item_okay(*cp))
3765 /* Forget restrictions */
3766 item_tester_tval = 0;
3767 item_tester_hook = NULL;
3768 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3782 /* No item selected */
3786 /* Full inventory */
3788 i2 = INVEN_PACK - 1;
3790 /* Forbid inventory */
3791 if (!inven) i2 = -1;
3794 for (j = 0; j < INVEN_PACK; j++)
3795 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
3798 /* Restrict inventory indexes */
3799 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3800 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3803 /* Full equipment */
3805 e2 = INVEN_TOTAL - 1;
3807 /* Forbid equipment */
3808 if (!equip) e2 = -1;
3811 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3812 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
3813 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3816 /* Restrict equipment indexes */
3817 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3818 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3820 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3824 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3826 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3830 /* Count "okay" floor items */
3833 /* Restrict floor usage */
3836 /* Scan all objects in the grid */
3837 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3840 /* Accept inventory */
3841 if (i1 <= i2) allow_inven = TRUE;
3843 /* Accept equipment */
3844 if (e1 <= e2) allow_equip = TRUE;
3847 if (floor_num) allow_floor = TRUE;
3849 /* Require at least one legal choice */
3850 if (!allow_inven && !allow_equip && !allow_floor)
3852 /* Cancel p_ptr->command_see */
3853 command_see = FALSE;
3863 /* Analyze choices */
3866 /* Hack -- Start on equipment if requested */
3867 if (command_see && (command_wrk == (USE_EQUIP))
3870 command_wrk = (USE_EQUIP);
3873 /* Use inventory if allowed */
3874 else if (allow_inven)
3876 command_wrk = (USE_INVEN);
3879 /* Use equipment if allowed */
3880 else if (allow_equip)
3882 command_wrk = (USE_EQUIP);
3885 /* Use floor if allowed */
3886 else if (allow_floor)
3888 command_wrk = (USE_FLOOR);
3893 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3895 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3897 /* Hack -- start out in "display" mode */
3903 /* Repeat until done */
3906 COMMAND_CODE get_item_label = 0;
3913 for (j = 0; j < 8; j++)
3916 if (!angband_term[j]) continue;
3918 /* Count windows displaying inven */
3919 if (window_flag[j] & (PW_INVEN)) ni++;
3921 /* Count windows displaying equip */
3922 if (window_flag[j] & (PW_EQUIP)) ne++;
3925 /* Toggle if needed */
3926 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3927 (command_wrk == (USE_INVEN) && !ni && ne))
3930 toggle_inven_equip();
3936 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3939 /* Inventory screen */
3940 if (command_wrk == (USE_INVEN))
3942 /* Extract the legal requests */
3946 /* Redraw if needed */
3947 if (command_see) get_item_label = show_inven(menu_line, mode);
3950 /* Equipment screen */
3951 else if (command_wrk == (USE_EQUIP))
3953 /* Extract the legal requests */
3954 n1 = I2A(e1 - INVEN_RARM);
3955 n2 = I2A(e2 - INVEN_RARM);
3957 /* Redraw if needed */
3958 if (command_see) get_item_label = show_equip(menu_line, mode);
3962 else if (command_wrk == (USE_FLOOR))
3965 k = MIN(floor_top + 23, floor_num) - 1;
3967 /* Extract the legal requests */
3968 n1 = I2A(j - floor_top);
3969 n2 = I2A(k - floor_top);
3971 /* Redraw if needed */
3972 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3975 /* Viewing inventory */
3976 if (command_wrk == (USE_INVEN))
3978 /* Begin the prompt */
3979 sprintf(out_val, _("持ち物:", "Inven:"));
3983 /* Build the prompt */
3984 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3985 index_to_label(i1), index_to_label(i2));
3988 strcat(out_val, tmp_val);
3991 /* Indicate ability to "view" */
3992 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3998 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
3999 else if (allow_floor)
4000 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
4002 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4009 strcat(out_val, _(" '-'床上,", " - for floor,"));
4010 else if (allow_equip)
4011 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
4013 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4017 /* Viewing equipment */
4018 else if (command_wrk == (USE_EQUIP))
4020 /* Begin the prompt */
4021 sprintf(out_val, _("装備品:", "Equip:"));
4025 /* Build the prompt */
4026 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4027 index_to_label(e1), index_to_label(e2));
4030 strcat(out_val, tmp_val);
4033 /* Indicate ability to "view" */
4034 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4040 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4041 else if (allow_floor)
4042 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
4044 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4051 strcat(out_val, _(" '-'床上,", " - for floor,"));
4052 else if (allow_inven)
4053 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4055 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4060 else if (command_wrk == (USE_FLOOR))
4062 /* Begin the prompt */
4063 sprintf(out_val, _("床上:", "Floor:"));
4067 /* Build the prompt */
4068 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4071 strcat(out_val, tmp_val);
4074 /* Indicate ability to "view" */
4075 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4079 if (allow_inven && allow_equip)
4081 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4083 else if (allow_inven)
4085 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4087 else if (allow_equip)
4089 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4093 else if (allow_inven)
4095 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4097 else if (allow_equip)
4099 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4103 if (command_see && !use_menu)
4105 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4110 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4112 /* Finish the prompt */
4113 strcat(out_val, " ESC");
4115 /* Build the prompt */
4116 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4118 /* Show the prompt */
4127 if (command_wrk == USE_INVEN) max_line = max_inven;
4128 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4129 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4145 menu_line += (max_line - 1);
4161 /* Verify legality */
4162 if (command_wrk == (USE_INVEN))
4164 if (allow_floor) command_wrk = USE_FLOOR;
4165 else if (allow_equip) command_wrk = USE_EQUIP;
4172 else if (command_wrk == (USE_EQUIP))
4174 if (allow_inven) command_wrk = USE_INVEN;
4175 else if (allow_floor) command_wrk = USE_FLOOR;
4182 else if (command_wrk == (USE_FLOOR))
4184 if (allow_equip) command_wrk = USE_EQUIP;
4185 else if (allow_inven) command_wrk = USE_INVEN;
4198 /* Hack -- Fix screen */
4205 /* Switch inven/equip */
4206 if (command_wrk == USE_INVEN) max_line = max_inven;
4207 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4208 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4209 if (menu_line > max_line) menu_line = max_line;
4211 /* Need to redraw */
4219 /* Verify legality */
4220 if (command_wrk == (USE_INVEN))
4222 if (allow_equip) command_wrk = USE_EQUIP;
4223 else if (allow_floor) command_wrk = USE_FLOOR;
4230 else if (command_wrk == (USE_EQUIP))
4232 if (allow_floor) command_wrk = USE_FLOOR;
4233 else if (allow_inven) command_wrk = USE_INVEN;
4240 else if (command_wrk == (USE_FLOOR))
4242 if (allow_inven) command_wrk = USE_INVEN;
4243 else if (allow_equip) command_wrk = USE_EQUIP;
4256 /* Hack -- Fix screen */
4263 /* Switch inven/equip */
4264 if (command_wrk == USE_INVEN) max_line = max_inven;
4265 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4266 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4267 if (menu_line > max_line) menu_line = max_line;
4269 /* Need to redraw */
4278 if (command_wrk == USE_FLOOR)
4281 (*cp) = -get_item_label;
4285 /* Validate the item */
4286 if (!get_item_okay(get_item_label))
4292 /* Allow player to "refuse" certain actions */
4293 if (!get_item_allow(get_item_label))
4299 /* Accept that choice */
4300 (*cp) = get_item_label;
4317 if (menu_line > max_line) menu_line -= max_line;
4338 command_see = FALSE;
4359 grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
4361 if (command_wrk != (USE_FLOOR)) break;
4363 /* Get the object being moved. */
4364 o_idx = g_ptr->o_idx;
4366 /* Only rotate a pile of two or more objects. */
4367 if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
4369 /* Remove the first object from the list. */
4370 excise_object_idx(o_idx);
4372 /* Find end of the list. */
4374 while (current_floor_ptr->o_list[i].next_o_idx)
4375 i = current_floor_ptr->o_list[i].next_o_idx;
4377 /* Add after the last object. */
4378 current_floor_ptr->o_list[i].next_o_idx = o_idx;
4380 /* Re-scan floor list */
4381 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4383 /* Hack -- Fix screen */
4395 if (command_wrk == (USE_INVEN))
4402 command_wrk = (USE_EQUIP);
4404 else if (command_wrk == (USE_EQUIP))
4411 command_wrk = (USE_INVEN);
4413 else if (command_wrk == (USE_FLOOR))
4417 command_wrk = (USE_INVEN);
4419 else if (allow_equip)
4421 command_wrk = (USE_EQUIP);
4430 /* Hack -- Fix screen */
4437 /* Need to redraw */
4450 * If we are already examining the floor, and there
4451 * is only one item, we will always select it.
4452 * If we aren't examining the floor and there is only
4453 * one item, we will select it if floor_query_flag
4458 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4461 k = 0 - floor_list[0];
4463 /* Allow player to "refuse" certain actions */
4464 if (!get_item_allow(k))
4470 /* Accept that choice */
4479 /* Hack -- Fix screen */
4486 command_wrk = (USE_FLOOR);
4492 case '1': case '2': case '3':
4493 case '4': case '5': case '6':
4494 case '7': case '8': case '9':
4496 if (command_wrk != USE_FLOOR)
4498 /* Look up the tag */
4499 if (!get_tag(&k, which, command_wrk))
4505 /* Hack -- Validate the item */
4506 if ((k < INVEN_RARM) ? !inven : !equip)
4512 /* Validate the item */
4513 if (!get_item_okay(k))
4521 /* Look up the alphabetical tag */
4522 if (get_tag_floor(&k, which, floor_list, floor_num))
4525 k = 0 - floor_list[k];
4534 /* Allow player to "refuse" certain actions */
4535 if (!get_item_allow(k))
4541 /* Accept that choice */
4553 /* Choose "default" inventory item */
4554 if (command_wrk == (USE_INVEN))
4556 k = ((i1 == i2) ? i1 : -1);
4559 /* Choose "default" equipment item */
4560 else if (command_wrk == (USE_EQUIP))
4562 k = ((e1 == e2) ? e1 : -1);
4565 /* Choose "default" floor item */
4566 else if (command_wrk == (USE_FLOOR))
4571 k = 0 - floor_list[0];
4573 /* Allow player to "refuse" certain actions */
4574 if (!get_item_allow(k))
4580 /* Accept that choice */
4588 /* Validate the item */
4589 if (!get_item_okay(k))
4595 /* Allow player to "refuse" certain actions */
4596 if (!get_item_allow(k))
4602 /* Accept that choice */
4626 if (command_wrk != USE_FLOOR)
4628 bool not_found = FALSE;
4630 /* Look up the alphabetical tag */
4631 if (!get_tag(&k, which, command_wrk))
4636 /* Hack -- Validate the item */
4637 else if ((k < INVEN_RARM) ? !inven : !equip)
4642 /* Validate the item */
4643 else if (!get_item_okay(k))
4650 /* Accept that choice */
4660 /* Look up the alphabetical tag */
4661 if (get_tag_floor(&k, which, floor_list, floor_num))
4664 k = 0 - floor_list[k];
4666 /* Accept that choice */
4675 /* Extract "query" setting */
4676 ver = isupper(which);
4677 which = (char)tolower(which);
4679 /* Convert letter to inventory index */
4680 if (command_wrk == (USE_INVEN))
4682 if (which == '(') k = i1;
4683 else if (which == ')') k = i2;
4684 else k = label_to_inven(which);
4687 /* Convert letter to equipment index */
4688 else if (command_wrk == (USE_EQUIP))
4690 if (which == '(') k = e1;
4691 else if (which == ')') k = e2;
4692 else k = label_to_equip(which);
4695 /* Convert letter to floor index */
4696 else if (command_wrk == USE_FLOOR)
4698 if (which == '(') k = 0;
4699 else if (which == ')') k = floor_num - 1;
4700 else k = islower(which) ? A2I(which) : -1;
4701 if (k < 0 || k >= floor_num || k >= 23)
4708 k = 0 - floor_list[k];
4711 /* Validate the item */
4712 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4718 /* Verify the item */
4719 if (ver && !verify(_("本当に", "Try"), k))
4725 /* Allow player to "refuse" certain actions */
4726 if (!get_item_allow(k))
4732 /* Accept that choice */
4742 /* Fix the screen if necessary */
4747 /* Hack -- Cancel "display" */
4748 command_see = FALSE;
4752 /* Forget the item_tester_tval restriction */
4753 item_tester_tval = 0;
4755 /* Forget the item_tester_hook restriction */
4756 item_tester_hook = NULL;
4759 /* Clean up 'show choices' */
4760 /* Toggle again if needed */
4761 if (toggle) toggle_inven_equip();
4763 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4766 /* Clear the prompt line */
4769 /* Warning if needed */
4770 if (oops && str) msg_print(str);
4775 if (command_cmd) prev_tag = cur_tag;
4776 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4782 * @brief 床上のアイテムを拾う選択用サブルーチン
4783 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4785 static bool py_pickup_floor_aux(void)
4787 OBJECT_IDX this_o_idx;
4791 /* Restrict the choices */
4792 item_tester_hook = inven_carry_okay;
4795 q = _("どれを拾いますか?", "Get which item? ");
4796 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4798 if (choose_object(&item, q, s, (USE_FLOOR)))
4800 this_o_idx = 0 - item;
4807 /* Pick up the object */
4808 py_pickup_aux(this_o_idx);
4814 * @brief 床上のアイテムを拾うメイン処理
4815 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4818 * This is called by py_pickup() when easy_floor is TRUE.
4820 void py_pickup_floor(bool pickup)
4822 OBJECT_IDX this_o_idx, next_o_idx = 0;
4824 GAME_TEXT o_name[MAX_NLEN];
4828 OBJECT_IDX floor_o_idx = 0;
4832 /* Scan the pile of objects */
4833 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)
4835 /* Access the object */
4836 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
4838 object_desc(o_name, o_ptr, 0);
4840 /* Access the next object */
4841 next_o_idx = o_ptr->next_o_idx;
4843 disturb(FALSE, FALSE);
4846 if (o_ptr->tval == TV_GOLD)
4849 msg_format(" $%ld の価値がある%sを見つけた。",
4850 (long)o_ptr->pval, o_name);
4852 msg_format("You have found %ld gold pieces worth of %s.",
4853 (long)o_ptr->pval, o_name);
4856 /* Collect the gold */
4857 p_ptr->au += o_ptr->pval;
4860 p_ptr->redraw |= (PR_GOLD);
4862 p_ptr->window |= (PW_PLAYER);
4864 /* Delete the gold */
4865 delete_object_idx(this_o_idx);
4867 /* Check the next object */
4870 else if (o_ptr->marked & OM_NOMSG)
4872 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4873 * ignored. Otherwise, they are included in the prompt. */
4874 o_ptr->marked &= ~(OM_NOMSG);
4878 /* Count non-gold objects that can be picked up. */
4879 if (inven_carry_okay(o_ptr))
4884 /* Count non-gold objects */
4887 /* Remember this index */
4888 floor_o_idx = this_o_idx;
4891 /* There are no non-gold objects */
4895 /* Mention the number of objects */
4901 /* Access the object */
4902 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4904 #ifdef ALLOW_EASY_SENSE
4906 /* Option: Make object sensing easy */
4909 /* Sense the object */
4910 (void) sense_object(o_ptr);
4913 #endif /* ALLOW_EASY_SENSE */
4915 object_desc(o_name, o_ptr, 0);
4917 msg_format(_("%sがある。", "You see %s."), o_name);
4920 /* Multiple objects */
4923 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4929 /* The player has no room for anything on the floor. */
4935 /* Access the object */
4936 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4938 #ifdef ALLOW_EASY_SENSE
4940 /* Option: Make object sensing easy */
4943 /* Sense the object */
4944 (void) sense_object(o_ptr);
4947 #endif /* ALLOW_EASY_SENSE */
4949 object_desc(o_name, o_ptr, 0);
4951 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4954 /* Multiple objects */
4957 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4967 /* Hack -- query every object */
4968 if (carry_query_flag)
4970 char out_val[MAX_NLEN+20];
4972 /* Access the object */
4973 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4975 #ifdef ALLOW_EASY_SENSE
4977 /* Option: Make object sensing easy */
4980 /* Sense the object */
4981 (void) sense_object(o_ptr);
4984 #endif /* ALLOW_EASY_SENSE */
4986 object_desc(o_name, o_ptr, 0);
4988 /* Build a prompt */
4989 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
4991 /* Ask the user to confirm */
4992 if (!get_check(out_val))
4998 /* Access the object */
4999 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
5001 #ifdef ALLOW_EASY_SENSE
5003 /* Option: Make object sensing easy */
5006 /* Sense the object */
5007 (void) sense_object(o_ptr);
5010 #endif /* ALLOW_EASY_SENSE */
5012 /* Pick up the object */
5013 py_pickup_aux(floor_o_idx);
5016 /* Allow the user to choose an object */
5019 while (can_pickup--)
5021 if (!py_pickup_floor_aux()) break;
5028 * @brief 矢弾を射撃した場合の破損確率を返す /
5029 * Determines the odds of an object breaking when thrown at a monster
5030 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
5033 * Note that artifacts never break, see the "drop_near()" function.
5035 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
5037 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
5039 /* Examine the snipe type */
5042 if (snipe_type == SP_KILL_WALL) return (100);
5043 if (snipe_type == SP_EXPLODE) return (100);
5044 if (snipe_type == SP_PIERCE) return (100);
5045 if (snipe_type == SP_FINAL) return (100);
5046 if (snipe_type == SP_NEEDLE) return (100);
5047 if (snipe_type == SP_EVILNESS) return (40);
5048 if (snipe_type == SP_HOLYNESS) return (40);
5051 /* Examine the item type */
5052 switch (o_ptr->tval)
5068 /* Sometimes break */
5073 return (20 - archer_bonus * 2);
5078 return (10 - archer_bonus);