3 * @brief オブジェクトの実装 / Object code, part 1
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2014 Deskull rearranged comment for Doxygen.\n
19 #include "cmd-activate.h"
20 #include "objectkind.h"
21 #include "object-ego.h"
22 #include "object-flavor.h"
23 #include "object-hook.h"
24 #include "player-move.h"
28 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
35 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
37 * This involves resetting various things to their "default" state.\n
39 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
40 * "user pref file" based on the current setting of the "use_graphics"\n
41 * flag. This is useful for switching "graphics" on/off.\n
43 * The features, objects, and monsters, should all be encoded in the\n
44 * relevant "font.pref" and/or "graf.prf" files. \n
46 * The "prefs" parameter is no longer meaningful. \n
48 void reset_visuals(void)
52 /* Extract some info about terrain features */
53 for (i = 0; i < max_f_idx; i++)
55 feature_type *f_ptr = &f_info[i];
57 /* Assume we will use the underlying values */
58 for (j = 0; j < F_LIT_MAX; j++)
60 f_ptr->x_attr[j] = f_ptr->d_attr[j];
61 f_ptr->x_char[j] = f_ptr->d_char[j];
65 /* Extract default attr/char code for objects */
66 for (i = 0; i < max_k_idx; i++)
68 object_kind *k_ptr = &k_info[i];
70 /* Default attr/char */
71 k_ptr->x_attr = k_ptr->d_attr;
72 k_ptr->x_char = k_ptr->d_char;
75 /* Extract default attr/char code for monsters */
76 for (i = 0; i < max_r_idx; i++)
78 monster_race *r_ptr = &r_info[i];
80 /* Default attr/char */
81 r_ptr->x_attr = r_ptr->d_attr;
82 r_ptr->x_char = r_ptr->d_char;
89 /* Process "graf.prf" */
90 process_pref_file("graf.prf");
92 /* Access the "character" pref file */
93 sprintf(buf, "graf-%s.prf", player_base);
95 /* Process "graf-<playername>.prf" */
96 process_pref_file(buf);
104 /* Process "font.prf" */
105 process_pref_file("font.prf");
107 /* Access the "character" pref file */
108 sprintf(buf, "font-%s.prf", player_base);
110 /* Process "font-<playername>.prf" */
111 process_pref_file(buf);
116 * @brief オブジェクトのフラグ類を配列に与える
117 * Obtain the "flags" for an item
118 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
119 * @param flgs フラグ情報を受け取る配列
122 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
124 object_kind *k_ptr = &k_info[o_ptr->k_idx];
128 for (i = 0; i < TR_FLAG_SIZE; i++)
129 flgs[i] = k_ptr->flags[i];
132 if (object_is_fixed_artifact(o_ptr))
134 artifact_type *a_ptr = &a_info[o_ptr->name1];
136 for (i = 0; i < TR_FLAG_SIZE; i++)
137 flgs[i] = a_ptr->flags[i];
141 if (object_is_ego(o_ptr))
143 ego_item_type *e_ptr = &e_info[o_ptr->name2];
145 for (i = 0; i < TR_FLAG_SIZE; i++)
146 flgs[i] |= e_ptr->flags[i];
148 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
150 remove_flag(flgs, TR_SH_FIRE);
152 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
154 remove_flag(flgs, TR_INFRA);
156 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
158 remove_flag(flgs, TR_RES_BLIND);
159 remove_flag(flgs, TR_SEE_INVIS);
163 /* Random artifact ! */
164 for (i = 0; i < TR_FLAG_SIZE; i++)
165 flgs[i] |= o_ptr->art_flags[i];
167 if (object_is_smith(o_ptr))
169 int add = o_ptr->xtra3 - 1;
171 if (add < TR_FLAG_MAX)
175 else if (add == ESSENCE_TMP_RES_ACID)
177 add_flag(flgs, TR_RES_ACID);
178 add_flag(flgs, TR_ACTIVATE);
180 else if (add == ESSENCE_TMP_RES_ELEC)
182 add_flag(flgs, TR_RES_ELEC);
183 add_flag(flgs, TR_ACTIVATE);
185 else if (add == ESSENCE_TMP_RES_FIRE)
187 add_flag(flgs, TR_RES_FIRE);
188 add_flag(flgs, TR_ACTIVATE);
190 else if (add == ESSENCE_TMP_RES_COLD)
192 add_flag(flgs, TR_RES_COLD);
193 add_flag(flgs, TR_ACTIVATE);
195 else if (add == ESSENCE_SH_FIRE)
197 add_flag(flgs, TR_RES_FIRE);
198 add_flag(flgs, TR_SH_FIRE);
200 else if (add == ESSENCE_SH_ELEC)
202 add_flag(flgs, TR_RES_ELEC);
203 add_flag(flgs, TR_SH_ELEC);
205 else if (add == ESSENCE_SH_COLD)
207 add_flag(flgs, TR_RES_COLD);
208 add_flag(flgs, TR_SH_COLD);
210 else if (add == ESSENCE_RESISTANCE)
212 add_flag(flgs, TR_RES_ACID);
213 add_flag(flgs, TR_RES_ELEC);
214 add_flag(flgs, TR_RES_FIRE);
215 add_flag(flgs, TR_RES_COLD);
217 else if (add == TR_IMPACT)
219 add_flag(flgs, TR_ACTIVATE);
225 * @brief オブジェクトの明示されているフラグ類を取得する
226 * Obtain the "flags" for an item which are known to the player
227 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
228 * @param flgs フラグ情報を受け取る配列
231 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
236 object_kind *k_ptr = &k_info[o_ptr->k_idx];
239 for (i = 0; i < TR_FLAG_SIZE; i++)
242 if (!object_is_aware(o_ptr)) return;
245 for (i = 0; i < TR_FLAG_SIZE; i++)
246 flgs[i] = k_ptr->flags[i];
248 /* Must be identified */
249 if (!object_is_known(o_ptr)) return;
251 /* Ego-item (known basic flags) */
252 if (object_is_ego(o_ptr))
254 ego_item_type *e_ptr = &e_info[o_ptr->name2];
256 for (i = 0; i < TR_FLAG_SIZE; i++)
257 flgs[i] |= e_ptr->flags[i];
259 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
261 remove_flag(flgs, TR_SH_FIRE);
263 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
265 remove_flag(flgs, TR_INFRA);
267 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
269 remove_flag(flgs, TR_RES_BLIND);
270 remove_flag(flgs, TR_SEE_INVIS);
275 #ifdef SPOIL_ARTIFACTS
276 /* Full knowledge for some artifacts */
277 if (object_is_artifact(o_ptr)) spoil = TRUE;
278 #endif /* SPOIL_ARTIFACTS */
280 #ifdef SPOIL_EGO_ITEMS
281 /* Full knowledge for some ego-items */
282 if (object_is_ego(o_ptr)) spoil = TRUE;
283 #endif /* SPOIL_EGO_ITEMS */
285 /* Need full knowledge or spoilers */
286 if (spoil || (o_ptr->ident & IDENT_MENTAL))
289 if (object_is_fixed_artifact(o_ptr))
291 artifact_type *a_ptr = &a_info[o_ptr->name1];
293 for (i = 0; i < TR_FLAG_SIZE; i++)
294 flgs[i] = a_ptr->flags[i];
297 /* Random artifact ! */
298 for (i = 0; i < TR_FLAG_SIZE; i++)
299 flgs[i] |= o_ptr->art_flags[i];
302 if (object_is_smith(o_ptr))
304 int add = o_ptr->xtra3 - 1;
306 if (add < TR_FLAG_MAX)
310 else if (add == ESSENCE_TMP_RES_ACID)
312 add_flag(flgs, TR_RES_ACID);
314 else if (add == ESSENCE_TMP_RES_ELEC)
316 add_flag(flgs, TR_RES_ELEC);
318 else if (add == ESSENCE_TMP_RES_FIRE)
320 add_flag(flgs, TR_RES_FIRE);
322 else if (add == ESSENCE_TMP_RES_COLD)
324 add_flag(flgs, TR_RES_COLD);
326 else if (add == ESSENCE_SH_FIRE)
328 add_flag(flgs, TR_RES_FIRE);
329 add_flag(flgs, TR_SH_FIRE);
331 else if (add == ESSENCE_SH_ELEC)
333 add_flag(flgs, TR_RES_ELEC);
334 add_flag(flgs, TR_SH_ELEC);
336 else if (add == ESSENCE_SH_COLD)
338 add_flag(flgs, TR_RES_COLD);
339 add_flag(flgs, TR_SH_COLD);
341 else if (add == ESSENCE_RESISTANCE)
343 add_flag(flgs, TR_RES_ACID);
344 add_flag(flgs, TR_RES_ELEC);
345 add_flag(flgs, TR_RES_FIRE);
346 add_flag(flgs, TR_RES_COLD);
352 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
353 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
354 * @return concptr 発動名称を返す文字列ポインタ
356 static concptr item_activation_dragon_breath(object_type *o_ptr)
358 static char desc[256];
359 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
362 object_flags(o_ptr, flgs);
363 strcpy(desc, _("", "breath "));
365 for (i = 0; dragonbreath_info[i].flag != 0; i++)
367 if (have_flag(flgs, dragonbreath_info[i].flag))
369 if (n > 0) strcat(desc, _("、", ", "));
370 strcat(desc, dragonbreath_info[i].name);
375 strcat(desc, _("のブレス(250)", ""));
381 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
382 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
383 * @return concptr 発動名称を返す文字列ポインタ
385 static concptr item_activation_aux(object_type *o_ptr)
387 static char activation_detail[256];
391 const activation_type* const act_ptr = find_activation_info(o_ptr);
393 if (!act_ptr) return _("未定義", "something undefined");
395 desc = act_ptr->desc;
397 /* Overwrite description if it is special */
398 switch (act_ptr->index) {
400 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
401 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
404 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
405 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
408 desc = item_activation_dragon_breath(o_ptr);
411 if (o_ptr->name1 == ART_HYOUSIGI)
412 desc = _("拍子木を打ちならす", "beat wooden clappers");
414 case ACT_RESIST_ACID:
415 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
416 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
418 case ACT_RESIST_FIRE:
419 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
420 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
422 case ACT_RESIST_COLD:
423 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
424 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
426 case ACT_RESIST_ELEC:
427 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
428 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
430 case ACT_RESIST_POIS:
431 if (o_ptr->name2 == EGO_BRAND_POIS)
432 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
436 /* Timeout description */
437 constant = act_ptr->timeout.constant;
438 dice = act_ptr->timeout.dice;
439 if (constant == 0 && dice == 0) {
440 /* We can activate it every current_world_ptr->game_turn */
441 strcpy(timeout, _("いつでも", "every current_world_ptr->game_turn"));
442 } else if (constant < 0) {
443 /* Activations that have special timeout */
444 switch (act_ptr->index) {
446 sprintf(timeout, _("%d ターン毎", "every %d turns"),
447 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
450 sprintf(timeout, _("%d ターン毎", "every %d turns"),
451 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
454 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
457 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
460 strcpy(timeout, "undefined");
464 /* Normal timeout activations */
465 char constant_str[16], dice_str[16];
466 sprintf(constant_str, "%d", constant);
467 sprintf(dice_str, "d%d", dice);
468 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
469 (constant > 0) ? constant_str : "",
470 (constant > 0 && dice > 0) ? "+" : "",
471 (dice > 0) ? dice_str : "");
474 /* Build detail activate description */
475 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
477 return activation_detail;
481 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
482 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
483 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
484 * @return concptr 発動名称を返す文字列ポインタ
486 concptr item_activation(object_type *o_ptr)
488 BIT_FLAGS flgs[TR_FLAG_SIZE];
489 object_flags(o_ptr, flgs);
491 /* Require activation ability */
492 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
494 /* Get an explain of an activation */
495 if (activation_index(o_ptr))
497 return item_activation_aux(o_ptr);
501 if (o_ptr->tval == TV_WHISTLE)
503 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
506 if (o_ptr->tval == TV_CAPTURE)
508 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
511 return _("何も起きない", "Nothing");
516 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
517 * Describe a "fully identified" item
518 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
519 * @param mode 表示オプション
520 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
522 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
526 BIT_FLAGS flgs[TR_FLAG_SIZE];
530 GAME_TEXT o_name[MAX_NLEN];
535 int trivial_info = 0;
536 object_flags(o_ptr, flgs);
538 /* Extract the description */
540 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
541 (k_text + k_info[o_ptr->k_idx].text),
542 77 - 15, temp, sizeof(temp));
543 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
544 { info[i] = &temp[j]; i++;}
547 if (object_is_equipment(o_ptr))
549 /* Descriptions of a basic equipment is just a flavor */
553 /* Mega-Hack -- describe activation */
554 if (have_flag(flgs, TR_ACTIVATE))
556 info[i++] = _("始動したときの効果...", "It can be activated for...");
557 info[i++] = item_activation(o_ptr);
558 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
561 /* Figurines, a hack */
562 if (o_ptr->tval == TV_FIGURINE)
564 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
567 /* Figurines, a hack */
568 if (o_ptr->name1 == ART_STONEMASK)
570 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you current_world_ptr->game_turn into a vampire permanently.");
573 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
575 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
578 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
580 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
581 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
584 if (o_ptr->name2 == EGO_2WEAPON)
586 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
589 if (have_flag(flgs, TR_EASY_SPELL))
591 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
594 if (o_ptr->name2 == EGO_AMU_FOOL)
596 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
599 if (o_ptr->name2 == EGO_RING_THROW)
601 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
604 if (o_ptr->name2 == EGO_AMU_NAIVETY)
606 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
609 if (o_ptr->tval == TV_STATUE)
611 monster_race *r_ptr = &r_info[o_ptr->pval];
613 if (o_ptr->pval == MON_BULLGATES)
614 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
615 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
616 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
618 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
621 /* Hack -- describe lite's */
623 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
626 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
627 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
628 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
629 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
630 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
631 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
633 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
635 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
637 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
641 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
642 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
645 if(rad != 0) info[i++] = desc;
648 if (o_ptr->name2 == EGO_LITE_LONG)
650 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
653 /* And then describe it fully */
655 if (have_flag(flgs, TR_RIDING))
657 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
658 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
661 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
662 /* This information is not important enough */
666 if (have_flag(flgs, TR_STR))
668 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
670 if (have_flag(flgs, TR_INT))
672 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
674 if (have_flag(flgs, TR_WIS))
676 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
678 if (have_flag(flgs, TR_DEX))
680 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
682 if (have_flag(flgs, TR_CON))
684 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
686 if (have_flag(flgs, TR_CHR))
688 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
691 if (have_flag(flgs, TR_MAGIC_MASTERY))
693 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
696 if (have_flag(flgs, TR_STEALTH))
698 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
700 if (have_flag(flgs, TR_SEARCH))
702 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
704 if (have_flag(flgs, TR_INFRA))
706 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
708 if (have_flag(flgs, TR_TUNNEL))
710 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
712 if (have_flag(flgs, TR_SPEED))
714 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
716 if (have_flag(flgs, TR_BLOWS))
718 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
721 if (have_flag(flgs, TR_BRAND_ACID))
723 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
725 if (have_flag(flgs, TR_BRAND_ELEC))
727 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
729 if (have_flag(flgs, TR_BRAND_FIRE))
731 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
733 if (have_flag(flgs, TR_BRAND_COLD))
735 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
738 if (have_flag(flgs, TR_BRAND_POIS))
740 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
743 if (have_flag(flgs, TR_CHAOTIC))
745 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
748 if (have_flag(flgs, TR_VAMPIRIC))
750 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
753 if (have_flag(flgs, TR_IMPACT))
755 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
758 if (have_flag(flgs, TR_VORPAL))
760 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
763 if (have_flag(flgs, TR_KILL_DRAGON))
765 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
767 else if (have_flag(flgs, TR_SLAY_DRAGON))
769 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
772 if (have_flag(flgs, TR_KILL_ORC))
774 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
776 if (have_flag(flgs, TR_SLAY_ORC))
778 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
781 if (have_flag(flgs, TR_KILL_TROLL))
783 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
785 if (have_flag(flgs, TR_SLAY_TROLL))
787 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
790 if (have_flag(flgs, TR_KILL_GIANT))
792 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
794 else if (have_flag(flgs, TR_SLAY_GIANT))
796 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
799 if (have_flag(flgs, TR_KILL_DEMON))
801 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
803 if (have_flag(flgs, TR_SLAY_DEMON))
805 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
808 if (have_flag(flgs, TR_KILL_UNDEAD))
810 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
812 if (have_flag(flgs, TR_SLAY_UNDEAD))
814 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
817 if (have_flag(flgs, TR_KILL_EVIL))
819 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
821 if (have_flag(flgs, TR_SLAY_EVIL))
823 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
826 if (have_flag(flgs, TR_KILL_ANIMAL))
828 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
830 if (have_flag(flgs, TR_SLAY_ANIMAL))
832 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
835 if (have_flag(flgs, TR_KILL_HUMAN))
837 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
839 if (have_flag(flgs, TR_SLAY_HUMAN))
841 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
844 if (have_flag(flgs, TR_FORCE_WEAPON))
846 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
848 if (have_flag(flgs, TR_DEC_MANA))
850 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
852 if (have_flag(flgs, TR_SUST_STR))
854 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
856 if (have_flag(flgs, TR_SUST_INT))
858 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
860 if (have_flag(flgs, TR_SUST_WIS))
862 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
864 if (have_flag(flgs, TR_SUST_DEX))
866 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
868 if (have_flag(flgs, TR_SUST_CON))
870 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
872 if (have_flag(flgs, TR_SUST_CHR))
874 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
877 if (have_flag(flgs, TR_IM_ACID))
879 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
881 if (have_flag(flgs, TR_IM_ELEC))
883 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
885 if (have_flag(flgs, TR_IM_FIRE))
887 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
889 if (have_flag(flgs, TR_IM_COLD))
891 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
894 if (have_flag(flgs, TR_THROW))
896 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
899 if (have_flag(flgs, TR_FREE_ACT))
901 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
903 if (have_flag(flgs, TR_HOLD_EXP))
905 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
907 if (have_flag(flgs, TR_RES_FEAR))
909 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
911 if (have_flag(flgs, TR_RES_ACID))
913 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
915 if (have_flag(flgs, TR_RES_ELEC))
917 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
919 if (have_flag(flgs, TR_RES_FIRE))
921 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
923 if (have_flag(flgs, TR_RES_COLD))
925 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
927 if (have_flag(flgs, TR_RES_POIS))
929 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
932 if (have_flag(flgs, TR_RES_LITE))
934 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
936 if (have_flag(flgs, TR_RES_DARK))
938 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
941 if (have_flag(flgs, TR_RES_BLIND))
943 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
945 if (have_flag(flgs, TR_RES_CONF))
947 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
949 if (have_flag(flgs, TR_RES_SOUND))
951 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
953 if (have_flag(flgs, TR_RES_SHARDS))
955 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
958 if (have_flag(flgs, TR_RES_NETHER))
960 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
962 if (have_flag(flgs, TR_RES_NEXUS))
964 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
966 if (have_flag(flgs, TR_RES_CHAOS))
968 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
970 if (have_flag(flgs, TR_RES_DISEN))
972 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
975 if (have_flag(flgs, TR_LEVITATION))
977 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
980 if (have_flag(flgs, TR_SEE_INVIS))
982 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
984 if (have_flag(flgs, TR_TELEPATHY))
986 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
988 if (have_flag(flgs, TR_ESP_ANIMAL))
990 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
992 if (have_flag(flgs, TR_ESP_UNDEAD))
994 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
996 if (have_flag(flgs, TR_ESP_DEMON))
998 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
1000 if (have_flag(flgs, TR_ESP_ORC))
1002 info[i++] = _("それはオークを感知する。", "It senses orcs.");
1004 if (have_flag(flgs, TR_ESP_TROLL))
1006 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1008 if (have_flag(flgs, TR_ESP_GIANT))
1010 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1012 if (have_flag(flgs, TR_ESP_DRAGON))
1014 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1016 if (have_flag(flgs, TR_ESP_HUMAN))
1018 info[i++] = _("それは人間を感知する。", "It senses humans.");
1020 if (have_flag(flgs, TR_ESP_EVIL))
1022 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1024 if (have_flag(flgs, TR_ESP_GOOD))
1026 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1028 if (have_flag(flgs, TR_ESP_NONLIVING))
1030 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1032 if (have_flag(flgs, TR_ESP_UNIQUE))
1034 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1036 if (have_flag(flgs, TR_SLOW_DIGEST))
1038 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1040 if (have_flag(flgs, TR_REGEN))
1042 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1044 if (have_flag(flgs, TR_WARNING))
1046 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1048 if (have_flag(flgs, TR_REFLECT))
1050 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1052 if (have_flag(flgs, TR_SH_FIRE))
1054 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1056 if (have_flag(flgs, TR_SH_ELEC))
1058 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1060 if (have_flag(flgs, TR_SH_COLD))
1062 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1064 if (have_flag(flgs, TR_NO_MAGIC))
1066 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1068 if (have_flag(flgs, TR_NO_TELE))
1070 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1072 if (have_flag(flgs, TR_XTRA_MIGHT))
1074 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1076 if (have_flag(flgs, TR_XTRA_SHOTS))
1078 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1081 if (have_flag(flgs, TR_BLESSED))
1083 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1086 if (object_is_cursed(o_ptr))
1088 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1090 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1092 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1094 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1098 info[i++] = _("それは呪われている。", "It is cursed.");
1101 * It's a trivial infomation since there is
1102 * fake inscription {cursed}
1108 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1110 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1112 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1114 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1116 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1118 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1120 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1122 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1124 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1126 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1128 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1130 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1132 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1134 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1136 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1138 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1140 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1142 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1144 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1146 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1148 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1150 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1152 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1154 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1156 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1158 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1160 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1162 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1164 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1166 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1168 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1170 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1172 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1174 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1176 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1178 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1181 /* Describe about this kind of object instead of THIS fake object */
1182 if (mode & SCROBJ_FAKE_OBJECT)
1184 switch (o_ptr->tval)
1187 switch (o_ptr->sval)
1189 case SV_RING_LORDLY:
1190 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1192 case SV_RING_WARNING:
1193 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1199 switch (o_ptr->sval)
1201 case SV_AMULET_RESISTANCE:
1202 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1203 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1205 case SV_AMULET_THE_MAGI:
1206 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1213 if (have_flag(flgs, TR_IGNORE_ACID) &&
1214 have_flag(flgs, TR_IGNORE_ELEC) &&
1215 have_flag(flgs, TR_IGNORE_FIRE) &&
1216 have_flag(flgs, TR_IGNORE_COLD))
1218 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1222 if (have_flag(flgs, TR_IGNORE_ACID))
1224 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1226 if (have_flag(flgs, TR_IGNORE_ELEC))
1228 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1230 if (have_flag(flgs, TR_IGNORE_FIRE))
1232 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1234 if (have_flag(flgs, TR_IGNORE_COLD))
1236 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1240 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1242 /* No relevant informations */
1243 if (i <= trivial_info) return (FALSE);
1246 Term_get_size(&wid, &hgt);
1248 /* Display Item name */
1249 if (!(mode & SCROBJ_FAKE_OBJECT))
1250 object_desc(o_name, o_ptr, 0);
1252 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1256 /* Erase the screen */
1257 for (k = 1; k < hgt; k++) prt("", k, 13);
1259 /* Label the information */
1260 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1262 monster_race *r_ptr = &r_info[o_ptr->pval];
1263 int namelen = strlen(r_name + r_ptr->name);
1264 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1265 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1266 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1270 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1273 /* We will print on top of the map (column 13) */
1274 for (k = 2, j = 0; j < i; j++)
1277 prt(info[j], k++, 15);
1279 /* Every 20 entries (lines 2 to 21), start over */
1280 if ((k == hgt - 2) && (j+1 < i))
1282 prt(_("-- 続く --", "-- more --"), k, 15);
1284 for (; k > 2; k--) prt("", k, 15);
1289 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1294 /* Gave knowledge */
1301 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1302 * Convert an p_ptr->inventory_list index into a one character label
1303 * @param i プレイヤーの所持/装備オブジェクトID
1304 * @return 対応するアルファベット
1305 * @details Note that the label does NOT distinguish inven/equip.
1307 char index_to_label(int i)
1309 /* Indexes for "inven" are easy */
1310 if (i < INVEN_RARM) return (I2A(i));
1312 /* Indexes for "equip" are offset */
1313 return (I2A(i - INVEN_RARM));
1317 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1318 * Convert a label into the index of an item in the "inven"
1319 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1320 * @details Note that the label does NOT distinguish inven/equip.
1322 INVENTORY_IDX label_to_inven(int c)
1327 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1329 /* Verify the index */
1330 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1332 /* Empty slots can never be chosen */
1333 if (!p_ptr->inventory_list[i].k_idx) return (-1);
1335 /* Return the index */
1341 extern bool select_ring_slot;
1345 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1346 * @param i プレイヤーの所持/装備オブジェクトID
1347 * @return 指輪枠ならばTRUEを返す。
1349 static bool is_ring_slot(int i)
1351 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1356 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1357 * Convert a label into the index of a item in the "equip"
1358 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1360 INVENTORY_IDX label_to_equip(int c)
1365 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1367 /* Verify the index */
1368 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1370 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1372 /* Empty slots can never be chosen */
1373 if (!p_ptr->inventory_list[i].k_idx) return (-1);
1375 /* Return the index */
1382 * @brief オブジェクトの該当装備部位IDを返す /
1383 * Determine which equipment slot (if any) an item likes
1384 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1385 * @return 対応する装備部位ID
1387 s16b wield_slot(object_type *o_ptr)
1389 /* Slot for equipment */
1390 switch (o_ptr->tval)
1397 if (!p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_RARM);
1398 if (p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_RARM);
1399 return (INVEN_LARM);
1406 if (!p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_LARM);
1407 if (p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_LARM);
1408 return (INVEN_RARM);
1418 /* Use the right hand first */
1419 if (!p_ptr->inventory_list[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1421 /* Use the left hand for swapping (by default) */
1422 return (INVEN_LEFT);
1428 return (INVEN_NECK);
1433 return (INVEN_LITE);
1440 return (INVEN_BODY);
1445 return (INVEN_OUTER);
1451 return (INVEN_HEAD);
1456 return (INVEN_HANDS);
1461 return (INVEN_FEET);
1465 /* No slot available */
1470 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1471 * Return a string mentioning how a given item is carried
1472 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1473 * @return 部位表現の文字列ポインタ
1475 concptr mention_use(int i)
1479 /* Examine the location */
1483 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1485 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1489 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1491 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1494 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1495 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1496 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1497 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1498 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1499 case INVEN_BODY: p = _(" 体", "On body"); break;
1500 case INVEN_OUTER: p = _("体の上", "About body"); break;
1501 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1502 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1503 case INVEN_FEET: p = _(" 足", "On feet"); break;
1504 default: p = _("ザック", "In pack"); break;
1507 /* Return the result */
1513 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1514 * Return a string describing how a given item is being worn.
1515 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1516 * @return 状態表現内容の文字列ポインタ
1518 * Currently, only used for items in the equipment, not p_ptr->inventory_list.
1520 concptr describe_use(int i)
1527 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1529 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1533 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1535 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1538 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1539 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1540 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1541 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1542 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1543 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1544 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1545 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1546 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1547 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1548 default: p = _("ザックに入っている", "carrying in your pack"); break;
1551 /* Return the result */
1557 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1558 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1559 * @param book_tval ベースアイテムのtval
1560 * @param book_sval ベースアイテムのsval
1561 * @return 使用可能な魔法書ならばTRUEを返す。
1564 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1566 if (book_tval < TV_LIFE_BOOK) return FALSE;
1567 if (p_ptr->pclass == CLASS_SORCERER)
1569 return is_magic(tval2realm(book_tval));
1571 else if (p_ptr->pclass == CLASS_RED_MAGE)
1573 if (is_magic(tval2realm(book_tval)))
1574 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1576 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1580 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1581 * Check an item against the item tester info
1582 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1583 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1585 bool item_tester_okay(object_type *o_ptr)
1587 /* Hack -- allow listing empty slots */
1588 // if (item_tester_full) return (TRUE); // TODO:DELETE
1590 /* Require an item */
1591 if (!o_ptr->k_idx) return (FALSE);
1593 /* Hack -- ignore "gold" */
1594 if (o_ptr->tval == TV_GOLD)
1597 extern bool show_gold_on_floor;
1599 if (!show_gold_on_floor) return (FALSE);
1602 /* Check the tval */
1603 if (item_tester_tval)
1605 /* Is it a spellbook? If so, we need a hack -- TY */
1606 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1607 (item_tester_tval >= TV_LIFE_BOOK))
1608 return check_book_realm(o_ptr->tval, o_ptr->sval);
1610 if (item_tester_tval != o_ptr->tval) return (FALSE);
1613 /* Check the hook */
1614 if (item_tester_hook)
1616 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1625 * @brief 所持アイテム一覧を表示する /
1626 * Choice window "shadow" of the "show_inven()" function
1629 void display_inven(void)
1631 register int i, n, z = 0;
1633 TERM_COLOR attr = TERM_WHITE;
1635 GAME_TEXT o_name[MAX_NLEN];
1638 Term_get_size(&wid, &hgt);
1640 for (i = 0; i < INVEN_PACK; i++)
1642 o_ptr = &p_ptr->inventory_list[i];
1643 if (!o_ptr->k_idx) continue;
1647 for (i = 0; i < z; i++)
1649 o_ptr = &p_ptr->inventory_list[i];
1650 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1651 if (item_tester_okay(o_ptr))
1653 tmp_val[0] = index_to_label(i);
1657 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1658 object_desc(o_name, o_ptr, 0);
1660 attr = tval_to_attr[o_ptr->tval % 128];
1666 Term_putstr(3, i, n, attr, o_name);
1667 Term_erase(3+n, i, 255);
1671 int wgt = o_ptr->weight * o_ptr->number;
1673 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1675 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1677 prt(tmp_val, i, wid - 9);
1681 for (i = z; i < hgt; i++)
1683 Term_erase(0, i, 255);
1690 * @brief 装備アイテム一覧を表示する /
1691 * Choice window "shadow" of the "show_equip()" function
1694 void display_equip(void)
1698 TERM_COLOR attr = TERM_WHITE;
1700 GAME_TEXT o_name[MAX_NLEN];
1703 Term_get_size(&wid, &hgt);
1705 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1707 o_ptr = &p_ptr->inventory_list[i];
1708 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1709 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1711 tmp_val[0] = index_to_label(i);
1715 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1716 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1718 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1723 object_desc(o_name, o_ptr, 0);
1724 attr = tval_to_attr[o_ptr->tval % 128];
1732 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1734 Term_erase(3 + n, i - INVEN_RARM, 255);
1738 int wgt = o_ptr->weight * o_ptr->number;
1740 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1742 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1745 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1750 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1751 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1755 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1757 Term_erase(0, i, 255);
1763 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1764 * Find the "first" p_ptr->inventory_list object with the given "tag".
1765 * @param cp 対応するタグIDを与える参照ポインタ
1766 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1767 * @param mode 所持、装備の切り替え
1768 * @return タグに該当するオブジェクトがあるならTRUEを返す
1770 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1771 * inscription of an object. Alphabetical characters don't work as a\n
1772 * tag in this form.\n
1774 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1775 * and "x" is the "current" command_cmd code.\n
1777 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1780 COMMAND_CODE start, end;
1783 /* Extract index from mode */
1788 end = INVEN_TOTAL - 1;
1793 end = INVEN_PACK - 1;
1800 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1802 /* Check every p_ptr->inventory_list object */
1803 for (i = start; i <= end; i++)
1805 object_type *o_ptr = &p_ptr->inventory_list[i];
1806 if (!o_ptr->k_idx) continue;
1808 /* Skip empty inscriptions */
1809 if (!o_ptr->inscription) continue;
1811 /* Skip non-choice */
1812 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1815 s = my_strchr(quark_str(o_ptr->inscription), '@');
1817 /* Process all tags */
1820 /* Check the special tags */
1821 if ((s[1] == command_cmd) && (s[2] == tag))
1823 /* Save the actual p_ptr->inventory_list ID */
1830 /* Find another '@' */
1831 s = my_strchr(s + 1, '@');
1836 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1838 /* Don't allow {@#} with '#' being alphabet */
1839 if (tag < '0' || '9' < tag)
1845 /* Check every object */
1846 for (i = start; i <= end; i++)
1848 object_type *o_ptr = &p_ptr->inventory_list[i];
1849 if (!o_ptr->k_idx) continue;
1851 /* Skip empty inscriptions */
1852 if (!o_ptr->inscription) continue;
1854 /* Skip non-choice */
1855 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1858 s = my_strchr(quark_str(o_ptr->inscription), '@');
1860 /* Process all tags */
1863 /* Check the normal tags */
1866 /* Save the actual p_ptr->inventory_list ID */
1873 /* Find another '@' */
1874 s = my_strchr(s + 1, '@');
1884 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1885 * Find the "first" p_ptr->inventory_list object with the given "tag".
1886 * @param cp 対応するタグIDを与える参照ポインタ
1887 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1888 * @param floor_list 床上アイテムの配列
1889 * @param floor_num 床上アイテムの配列ID
1890 * @return タグに該当するオブジェクトがあるならTRUEを返す
1892 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1893 * inscription of an object. Alphabetical characters don't work as a\n
1894 * tag in this form.\n
1896 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1897 * and "x" is the "current" command_cmd code.\n
1899 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1904 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1906 /* Check every object in the grid */
1907 for (i = 0; i < floor_num && i < 23; i++)
1909 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1911 /* Skip empty inscriptions */
1912 if (!o_ptr->inscription) continue;
1915 s = my_strchr(quark_str(o_ptr->inscription), '@');
1917 /* Process all tags */
1920 /* Check the special tags */
1921 if ((s[1] == command_cmd) && (s[2] == tag))
1923 /* Save the actual floor object ID */
1930 /* Find another '@' */
1931 s = my_strchr(s + 1, '@');
1936 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1938 /* Don't allow {@#} with '#' being alphabet */
1939 if (tag < '0' || '9' < tag)
1945 /* Check every object in the grid */
1946 for (i = 0; i < floor_num && i < 23; i++)
1948 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1950 /* Skip empty inscriptions */
1951 if (!o_ptr->inscription) continue;
1954 s = my_strchr(quark_str(o_ptr->inscription), '@');
1956 /* Process all tags */
1959 /* Check the normal tags */
1962 /* Save the floor object ID */
1969 /* Find another '@' */
1970 s = my_strchr(s + 1, '@');
1980 * @brief タグIDにあわせてタグアルファベットのリストを返す /
1981 * Move around label characters with correspond tags
1982 * @param label ラベルリストを取得する文字列参照ポインタ
1983 * @param mode 所持品リストか装備品リストかの切り替え
1986 static void prepare_label_string(char *label, BIT_FLAGS mode)
1988 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
1989 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
1992 /* Prepare normal labels */
1993 strcpy(label, alphabet_chars);
1995 /* Move each label */
1996 for (i = 0; i < 52; i++)
1999 SYMBOL_CODE c = alphabet_chars[i];
2001 /* Find a tag with this label */
2002 if (get_tag(&index, c, mode))
2004 /* Delete the overwritten label */
2005 if (label[i] == c) label[i] = ' ';
2007 /* Move the label to the place of corresponding tag */
2008 label[index - offset] = c;
2015 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2016 * Move around label characters with correspond tags (floor version)
2017 * @param label ラベルリストを取得する文字列参照ポインタ
2018 * @param floor_list 床上アイテムの配列
2019 * @param floor_num 床上アイテムの配列ID
2024 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2026 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2029 /* Prepare normal labels */
2030 strcpy(label, alphabet_chars);
2032 /* Move each label */
2033 for (i = 0; i < 52; i++)
2036 SYMBOL_CODE c = alphabet_chars[i];
2038 /* Find a tag with this label */
2039 if (get_tag_floor(&index, c, floor_list, floor_num))
2041 /* Delete the overwritten label */
2042 if (label[i] == c) label[i] = ' ';
2044 /* Move the label to the place of corresponding tag */
2052 * @brief 所持アイテムの表示を行う /
2053 * Display the p_ptr->inventory_list.
2054 * @param target_item アイテムの選択処理を行うか否か。
2055 * @return 選択したアイテムのタグ
2057 * Hack -- do not display "trailing" empty slots
2059 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2063 int col, cur_col, len;
2065 GAME_TEXT o_name[MAX_NLEN];
2067 COMMAND_CODE out_index[23];
2068 TERM_COLOR out_color[23];
2069 char out_desc[23][MAX_NLEN];
2070 COMMAND_CODE target_item_label = 0;
2072 char inven_label[52 + 1];
2074 /* Starting column */
2077 Term_get_size(&wid, &hgt);
2079 /* Default "max-length" */
2080 len = wid - col - 1;
2083 /* Find the "final" slot */
2084 for (i = 0; i < INVEN_PACK; i++)
2086 o_ptr = &p_ptr->inventory_list[i];
2087 if (!o_ptr->k_idx) continue;
2093 prepare_label_string(inven_label, USE_INVEN);
2095 /* Display the p_ptr->inventory_list */
2096 for (k = 0, i = 0; i < z; i++)
2098 o_ptr = &p_ptr->inventory_list[i];
2100 /* Is this item acceptable? */
2101 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2103 object_desc(o_name, o_ptr, 0);
2105 /* Save the object index, color, and description */
2107 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2109 /* Grey out charging items */
2112 out_color[k] = TERM_L_DARK;
2115 (void)strcpy(out_desc[k], o_name);
2117 /* Find the predicted "line length" */
2118 l = strlen(out_desc[k]) + 5;
2120 /* Be sure to account for the weight */
2121 if (show_weights) l += 9;
2123 /* Account for icon if displayed */
2124 if (show_item_graph)
2127 if (use_bigtile) l++;
2130 /* Maintain the maximum length */
2131 if (l > len) len = l;
2133 /* Advance to next "line" */
2137 /* Find the column to start in */
2138 col = (len > wid - 4) ? 0 : (wid - len - 1);
2140 /* Output each entry */
2141 for (j = 0; j < k; j++)
2144 o_ptr = &p_ptr->inventory_list[i];
2146 /* Clear the line */
2147 prt("", j + 1, col ? col - 2 : col);
2149 if (use_menu && target_item)
2151 if (j == (target_item-1))
2153 strcpy(tmp_val, _("》", "> "));
2154 target_item_label = i;
2156 else strcpy(tmp_val, " ");
2158 else if (i <= INVEN_PACK)
2160 /* Prepare an index --(-- */
2161 sprintf(tmp_val, "%c)", inven_label[i]);
2165 /* Prepare an index --(-- */
2166 sprintf(tmp_val, "%c)", index_to_label(i));
2169 /* Clear the line with the (possibly indented) index */
2170 put_str(tmp_val, j + 1, col);
2174 /* Display graphics for object, if desired */
2175 if (show_item_graph)
2177 TERM_COLOR a = object_attr(o_ptr);
2178 SYMBOL_CODE c = object_char(o_ptr);
2179 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2180 if (use_bigtile) cur_col++;
2186 /* Display the entry itself */
2187 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2189 /* Display the weight if needed */
2192 int wgt = o_ptr->weight * o_ptr->number;
2194 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2196 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2199 prt(tmp_val, j + 1, wid - 9);
2203 /* Make a "shadow" below the list (only if needed) */
2204 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2206 /* Save the new column */
2209 return target_item_label;
2214 * @brief 装備アイテムの表示を行う /
2215 * Display the equipment.
2216 * @param target_item アイテムの選択処理を行うか否か。
2217 * @return 選択したアイテムのタグ
2219 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2223 int col, cur_col, len;
2226 GAME_TEXT o_name[MAX_NLEN];
2227 COMMAND_CODE out_index[23];
2228 TERM_COLOR out_color[23];
2229 char out_desc[23][MAX_NLEN];
2230 COMMAND_CODE target_item_label = 0;
2232 char equip_label[52 + 1];
2234 /* Starting column */
2237 Term_get_size(&wid, &hgt);
2239 /* Maximal length */
2240 len = wid - col - 1;
2243 /* Scan the equipment list */
2244 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2246 o_ptr = &p_ptr->inventory_list[i];
2248 /* Is this item acceptable? */
2249 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2250 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2251 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2253 object_desc(o_name, o_ptr, 0);
2255 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2257 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2258 out_color[k] = TERM_WHITE;
2262 (void)strcpy(out_desc[k], o_name);
2263 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2267 /* Grey out charging items */
2270 out_color[k] = TERM_L_DARK;
2273 /* Extract the maximal length (see below) */
2275 l = strlen(out_desc[k]) + (2 + 1);
2277 l = strlen(out_desc[k]) + (2 + 3);
2281 /* Increase length for labels (if needed) */
2283 if (show_labels) l += (7 + 2);
2285 if (show_labels) l += (14 + 2);
2289 /* Increase length for weight (if needed) */
2290 if (show_weights) l += 9;
2292 if (show_item_graph) l += 2;
2294 /* Maintain the max-length */
2295 if (l > len) len = l;
2297 /* Advance the entry */
2301 /* Hack -- Find a column to start in */
2303 col = (len > wid - 6) ? 0 : (wid - len - 1);
2305 col = (len > wid - 4) ? 0 : (wid - len - 1);
2308 prepare_label_string(equip_label, USE_EQUIP);
2310 /* Output each entry */
2311 for (j = 0; j < k; j++)
2314 o_ptr = &p_ptr->inventory_list[i];
2316 /* Clear the line */
2317 prt("", j + 1, col ? col - 2 : col);
2319 if (use_menu && target_item)
2321 if (j == (target_item-1))
2323 strcpy(tmp_val, _("》", "> "));
2324 target_item_label = i;
2326 else strcpy(tmp_val, " ");
2328 else if (i >= INVEN_RARM)
2330 /* Prepare an index --(-- */
2331 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2335 /* Prepare an index --(-- */
2336 sprintf(tmp_val, "%c)", index_to_label(i));
2339 /* Clear the line with the (possibly indented) index */
2340 put_str(tmp_val, j+1, col);
2344 /* Display graphics for object, if desired */
2345 if (show_item_graph)
2347 TERM_COLOR a = object_attr(o_ptr);
2348 SYMBOL_CODE c = object_char(o_ptr);
2349 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2350 if (use_bigtile) cur_col++;
2358 /* Mention the use */
2359 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2361 put_str(tmp_val, j+1, cur_col);
2363 /* Display the entry itself */
2364 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2370 /* Display the entry itself */
2371 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2374 /* Display the weight if needed */
2377 int wgt = o_ptr->weight * o_ptr->number;
2379 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2381 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2384 prt(tmp_val, j + 1, wid - 9);
2388 /* Make a "shadow" below the list (only if needed) */
2389 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2391 /* Save the new column */
2394 return target_item_label;
2398 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2399 * Flip "inven" and "equip" in any sub-windows
2402 void toggle_inven_equip(void)
2407 for (j = 0; j < 8; j++)
2410 if (!angband_term[j]) continue;
2412 /* Flip inven to equip */
2413 if (window_flag[j] & (PW_INVEN))
2416 window_flag[j] &= ~(PW_INVEN);
2417 window_flag[j] |= (PW_EQUIP);
2419 p_ptr->window |= (PW_EQUIP);
2422 /* Flip inven to equip */
2423 else if (window_flag[j] & (PW_EQUIP))
2426 window_flag[j] &= ~(PW_EQUIP);
2427 window_flag[j] |= (PW_INVEN);
2429 p_ptr->window |= (PW_INVEN);
2435 * @brief 選択したアイテムの確認処理の補助 /
2436 * Verify the choice of an item.
2437 * @param prompt メッセージ表示の一部
2438 * @param item 選択アイテムID
2439 * @return 確認がYesならTRUEを返す。
2440 * @details The item can be negative to mean "item on floor".
2442 static bool verify(concptr prompt, INVENTORY_IDX item)
2444 GAME_TEXT o_name[MAX_NLEN];
2445 char out_val[MAX_NLEN+20];
2452 o_ptr = &p_ptr->inventory_list[item];
2458 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2460 object_desc(o_name, o_ptr, 0);
2463 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2466 return (get_check(out_val));
2471 * @brief 選択したアイテムの確認処理のメインルーチン /
2472 * @param item 選択アイテムID
2473 * @return 確認がYesならTRUEを返す。
2474 * @details The item can be negative to mean "item on floor".
2475 * Hack -- allow user to "prevent" certain choices
2477 static bool get_item_allow(INVENTORY_IDX item)
2481 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2486 o_ptr = &p_ptr->inventory_list[item];
2492 o_ptr = ¤t_floor_ptr->o_list[0 - item];
2495 /* No inscription */
2496 if (!o_ptr->inscription) return (TRUE);
2499 s = my_strchr(quark_str(o_ptr->inscription), '!');
2501 /* Process preventions */
2504 /* Check the "restriction" */
2505 if ((s[1] == command_cmd) || (s[1] == '*'))
2507 /* Verify the choice */
2508 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2511 /* Find another '!' */
2512 s = my_strchr(s + 1, '!');
2521 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2522 * Auxiliary function for "get_item()" -- test an index
2524 * @return 正規のIDならばTRUEを返す。
2526 static bool get_item_okay(OBJECT_IDX i)
2529 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2531 if (select_ring_slot) return is_ring_slot(i);
2533 /* Verify the item */
2534 if (!item_tester_okay(&p_ptr->inventory_list[i])) return (FALSE);
2541 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2542 * Determine whether get_item() can get some item or not
2543 * @return アイテムを拾えるならばTRUEを返す。
2544 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2546 bool can_get_item(void)
2549 OBJECT_IDX floor_list[23];
2550 ITEM_NUMBER floor_num = 0;
2552 for (j = 0; j < INVEN_TOTAL; j++)
2553 if (item_tester_okay(&p_ptr->inventory_list[j]))
2556 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2564 * @brief オブジェクト選択の汎用関数 /
2565 * Let the user select an item, save its "index"
2566 * @param cp 選択したオブジェクトのIDを返す。
2567 * @param pmt 選択目的のメッセージ
2568 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2569 * @param mode オプションフラグ
2570 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2571 * Return TRUE only if an acceptable item was chosen by the user.\n
2573 * The selected item must satisfy the "item_tester_hook()" function,\n
2574 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2576 * All "item_tester" restrictions are cleared before this function returns.\n
2578 * The user is allowed to choose acceptable items from the equipment,\n
2579 * p_ptr->inventory_list, or floor, respectively, if the proper flag was given,\n
2580 * and there are any acceptable items in that location.\n
2582 * The equipment or p_ptr->inventory_list are displayed (even if no acceptable\n
2583 * items are in that location) if the proper flag was given.\n
2585 * If there are no acceptable items available anywhere, and "str" is\n
2586 * not NULL, then it will be used as the text of a warning message\n
2587 * before the function returns.\n
2589 * Note that the user must press "-" to specify the item on the floor,\n
2590 * and there is no way to "examine" the item on the floor, while the\n
2591 * use of "capital" letters will "examine" an p_ptr->inventory_list/equipment item,\n
2592 * and prompt for its use.\n
2594 * If a legal item is selected from the p_ptr->inventory_list, we save it in "cp"\n
2595 * directly (0 to 35), and return TRUE.\n
2597 * If a legal item is selected from the floor, we save it in "cp" as\n
2598 * a negative (-1 to -511), and return TRUE.\n
2600 * If no item is available, we do nothing to "cp", and we display a\n
2601 * warning message, using "str" if available, and return FALSE.\n
2603 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2605 * Global "p_ptr->command_new" is used when viewing the p_ptr->inventory_list or equipment\n
2606 * to allow the user to enter a command while viewing those screens, and\n
2607 * also to induce "auto-enter" of stores, and other such stuff.\n
2609 * Global "p_ptr->command_see" may be set before calling this function to start\n
2610 * out in "browse" mode. It is cleared before this function returns.\n
2612 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2613 * If it is TRUE then we are viewing p_ptr->inventory_list, else equipment.\n
2615 * We always erase the prompt when we are done, leaving a blank line,\n
2616 * or a warning message, if appropriate, if no items are available.\n
2618 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2620 OBJECT_IDX this_o_idx, next_o_idx = 0;
2637 bool allow_floor = FALSE;
2639 bool toggle = FALSE;
2644 int menu_line = (use_menu ? 1 : 0);
2648 static char prev_tag = '\0';
2649 char cur_tag = '\0';
2651 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2654 if (mode & USE_EQUIP) equip = TRUE;
2655 if (mode & USE_INVEN) inven = TRUE;
2656 if (mode & USE_FLOOR) floor = TRUE;
2658 /* Get the item index */
2659 if (repeat_pull(cp))
2662 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2664 item_tester_tval = 0;
2665 item_tester_hook = NULL;
2666 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2671 else if (floor && (*cp < 0))
2677 o_ptr = ¤t_floor_ptr->o_list[k];
2679 /* Validate the item */
2680 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2682 /* Forget restrictions */
2683 item_tester_tval = 0;
2684 item_tester_hook = NULL;
2685 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2692 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2693 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2695 if (prev_tag && command_cmd)
2697 /* Look up the tag and validate the item */
2698 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2699 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2700 else if (!get_item_okay(k)) /* Reject */;
2703 /* Accept that choice */
2706 /* Forget restrictions */
2707 item_tester_tval = 0;
2708 item_tester_hook = NULL;
2709 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2715 prev_tag = '\0'; /* prev_tag is no longer effective */
2718 /* Verify the item */
2719 else if (get_item_okay(*cp))
2721 /* Forget restrictions */
2722 item_tester_tval = 0;
2723 item_tester_hook = NULL;
2724 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2736 /* No item selected */
2740 /* Full p_ptr->inventory_list */
2742 i2 = INVEN_PACK - 1;
2744 /* Forbid p_ptr->inventory_list */
2745 if (!inven) i2 = -1;
2748 for (j = 0; j < INVEN_PACK; j++)
2749 if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
2752 /* Restrict p_ptr->inventory_list indexes */
2753 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2754 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2757 /* Full equipment */
2759 e2 = INVEN_TOTAL - 1;
2761 /* Forbid equipment */
2762 if (!equip) e2 = -1;
2765 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2766 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
2767 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2770 /* Restrict equipment indexes */
2771 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2772 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2774 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2778 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2780 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2784 /* Restrict floor usage */
2787 /* Scan all objects in the grid */
2788 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)
2791 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
2792 next_o_idx = o_ptr->next_o_idx;
2794 /* Accept the item on the floor if legal */
2795 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2799 /* Require at least one legal choice */
2800 if (!allow_floor && (i1 > i2) && (e1 > e2))
2802 /* Cancel p_ptr->command_see */
2803 command_see = FALSE;
2807 if (mode & USE_FORCE) {
2813 /* Analyze choices */
2816 /* Hack -- Start on equipment if requested */
2817 if (command_see && command_wrk && equip)
2822 /* Use p_ptr->inventory_list if allowed */
2825 command_wrk = FALSE;
2828 /* Use equipment if allowed */
2834 /* Use p_ptr->inventory_list for floor */
2837 command_wrk = FALSE;
2843 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2845 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2847 /* Hack -- start out in "display" mode */
2854 /* Repeat until done */
2857 COMMAND_CODE get_item_label = 0;
2864 for (j = 0; j < 8; j++)
2867 if (!angband_term[j]) continue;
2869 /* Count windows displaying inven */
2870 if (window_flag[j] & (PW_INVEN)) ni++;
2872 /* Count windows displaying equip */
2873 if (window_flag[j] & (PW_EQUIP)) ne++;
2876 /* Toggle if needed */
2877 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2880 toggle_inven_equip();
2886 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2889 /* Inventory screen */
2892 /* Redraw if needed */
2893 if (command_see) get_item_label = show_inven(menu_line, mode);
2896 /* Equipment screen */
2899 /* Redraw if needed */
2900 if (command_see) get_item_label = show_equip(menu_line, mode);
2903 /* Viewing p_ptr->inventory_list */
2906 /* Begin the prompt */
2907 sprintf(out_val, _("持ち物:", "Inven:"));
2909 /* Some legal items */
2910 if ((i1 <= i2) && !use_menu)
2912 /* Build the prompt */
2913 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2914 index_to_label(i1), index_to_label(i2));
2917 strcat(out_val, tmp_val);
2920 /* Indicate ability to "view" */
2921 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2924 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2927 /* Viewing equipment */
2930 /* Begin the prompt */
2931 sprintf(out_val, _("装備品:", "Equip:"));
2933 /* Some legal items */
2934 if ((e1 <= e2) && !use_menu)
2936 /* Build the prompt */
2937 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2938 index_to_label(e1), index_to_label(e2));
2941 strcat(out_val, tmp_val);
2944 /* Indicate ability to "view" */
2945 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2948 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
2951 /* Indicate legality of the "floor" item */
2952 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
2953 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
2955 /* Finish the prompt */
2956 strcat(out_val, " ESC");
2958 /* Build the prompt */
2959 sprintf(tmp_val, "(%s) %s", out_val, pmt);
2961 /* Show the prompt */
2969 int max_line = (command_wrk ? max_equip : max_inven);
2985 menu_line += (max_line - 1);
3004 /* Verify legality */
3005 if (!inven || !equip)
3011 /* Hack -- Fix screen */
3018 /* Switch inven/equip */
3019 command_wrk = !command_wrk;
3020 max_line = (command_wrk ? max_equip : max_inven);
3021 if (menu_line > max_line) menu_line = max_line;
3023 /* Need to redraw */
3032 if (command_wrk == USE_FLOOR)
3035 (*cp) = -get_item_label;
3039 /* Validate the item */
3040 if (!get_item_okay(get_item_label))
3046 /* Allow player to "refuse" certain actions */
3047 if (!get_item_allow(get_item_label))
3053 /* Accept that choice */
3054 (*cp) = get_item_label;
3063 if (mode & USE_FORCE) {
3071 if (menu_line > max_line) menu_line -= max_line;
3092 command_see = FALSE;
3109 /* Verify legality */
3110 if (!inven || !equip)
3116 /* Hack -- Fix screen */
3123 /* Switch inven/equip */
3124 command_wrk = !command_wrk;
3126 /* Need to redraw */
3132 /* Use floor item */
3135 /* Scan all objects in the grid */
3136 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)
3139 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3140 next_o_idx = o_ptr->next_o_idx;
3142 /* Validate the item */
3143 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3148 /* Verify the item (if required) */
3149 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3151 /* Allow player to "refuse" certain actions */
3152 if (!get_item_allow(k)) continue;
3154 /* Accept that choice */
3170 case '1': case '2': case '3':
3171 case '4': case '5': case '6':
3172 case '7': case '8': case '9':
3174 /* Look up the tag */
3175 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3181 /* Hack -- Validate the item */
3182 if ((k < INVEN_RARM) ? !inven : !equip)
3188 /* Validate the item */
3189 if (!get_item_okay(k))
3195 /* Allow player to "refuse" certain actions */
3196 if (!get_item_allow(k))
3202 /* Accept that choice */
3214 /* Choose "default" p_ptr->inventory_list item */
3217 k = ((i1 == i2) ? i1 : -1);
3220 /* Choose "default" equipment item */
3223 k = ((e1 == e2) ? e1 : -1);
3226 /* Validate the item */
3227 if (!get_item_okay(k))
3233 /* Allow player to "refuse" certain actions */
3234 if (!get_item_allow(k))
3240 /* Accept that choice */
3250 if (mode & USE_FORCE) {
3263 bool not_found = FALSE;
3265 /* Look up the alphabetical tag */
3266 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3271 /* Hack -- Validate the item */
3272 else if ((k < INVEN_RARM) ? !inven : !equip)
3277 /* Validate the item */
3278 else if (!get_item_okay(k))
3285 /* Accept that choice */
3293 /* Extract "query" setting */
3294 ver = isupper(which);
3295 which = (char)tolower(which);
3297 /* Convert letter to p_ptr->inventory_list index */
3300 if (which == '(') k = i1;
3301 else if (which == ')') k = i2;
3302 else k = label_to_inven(which);
3305 /* Convert letter to equipment index */
3308 if (which == '(') k = e1;
3309 else if (which == ')') k = e2;
3310 else k = label_to_equip(which);
3313 /* Validate the item */
3314 if (!get_item_okay(k))
3320 /* Verify the item */
3321 if (ver && !verify(_("本当に", "Try"), k))
3327 /* Allow player to "refuse" certain actions */
3328 if (!get_item_allow(k))
3334 /* Accept that choice */
3345 /* Fix the screen if necessary */
3350 /* Hack -- Cancel "display" */
3351 command_see = FALSE;
3355 /* Forget the item_tester_tval restriction */
3356 item_tester_tval = 0;
3358 /* Forget the item_tester_hook restriction */
3359 item_tester_hook = NULL;
3362 /* Clean up 'show choices' */
3363 /* Toggle again if needed */
3364 if (toggle) toggle_inven_equip();
3366 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3369 /* Clear the prompt line */
3372 /* Warning if needed */
3373 if (oops && str) msg_print(str);
3378 if (command_cmd) prev_tag = cur_tag;
3379 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3385 * Choose an item and get auto-picker entry from it.
3387 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3390 if (!get_item(&item, q, s, option)) return NULL;
3391 if (idx) *idx = item;
3393 if (item == INVEN_FORCE) return NULL;
3395 /* Get the item (in the pack) */
3396 else if (item >= 0) return &p_ptr->inventory_list[item];
3398 /* Get the item (on the floor) */
3399 else return ¤t_floor_ptr->o_list[0 - item];
3404 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3405 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3406 * @param y 走査するフロアのY座標
3407 * @param x 走査するフロアのX座標
3408 * @param mode オプションフラグ
3409 * @return 対象のマスに落ちているアイテム数
3411 * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
3412 * location. Valid flags are:
3414 * mode & 0x01 -- Item tester
3415 * mode & 0x02 -- Marked items only
3416 * mode & 0x04 -- Stop after first
3418 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3420 OBJECT_IDX this_o_idx, next_o_idx;
3422 ITEM_NUMBER num = 0;
3425 if (!in_bounds(y, x)) return 0;
3427 /* Scan all objects in the grid */
3428 for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3431 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3432 next_o_idx = o_ptr->next_o_idx;
3435 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3438 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3440 /* Accept this item */
3441 /* XXX Hack -- Enforce limit */
3443 items[num] = this_o_idx;
3448 if (mode & 0x04) break;
3455 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3456 * @param target_item カーソルの初期値
3457 * @param y 走査するフロアのY座標
3458 * @param x 走査するフロアのX座標
3459 * @param min_width 表示の長さ
3460 * @return 選択したアイテムの添え字
3463 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3471 GAME_TEXT o_name[MAX_NLEN];
3474 COMMAND_CODE out_index[23];
3475 TERM_COLOR out_color[23];
3476 char out_desc[23][MAX_NLEN];
3477 COMMAND_CODE target_item_label = 0;
3479 OBJECT_IDX floor_list[23];
3480 ITEM_NUMBER floor_num;
3482 char floor_label[52 + 1];
3484 bool dont_need_to_show_weights = TRUE;
3486 Term_get_size(&wid, &hgt);
3488 /* Default length */
3489 len = MAX((*min_width), 20);
3491 /* Scan for objects in the grid, using item_tester_okay() */
3492 floor_num = scan_floor(floor_list, y, x, 0x03);
3494 /* Display the floor objects */
3495 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3497 o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
3499 object_desc(o_name, o_ptr, 0);
3501 /* Save the index */
3504 /* Acquire p_ptr->inventory_list color */
3505 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3507 /* Save the object description */
3508 strcpy(out_desc[k], o_name);
3510 /* Find the predicted "line length" */
3511 l = strlen(out_desc[k]) + 5;
3513 /* Be sure to account for the weight */
3514 if (show_weights) l += 9;
3516 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3518 /* Maintain the maximum length */
3519 if (l > len) len = l;
3521 /* Advance to next "line" */
3525 if (show_weights && dont_need_to_show_weights) len -= 9;
3530 /* Find the column to start in */
3531 col = (len > wid - 4) ? 0 : (wid - len - 1);
3533 prepare_label_string_floor(floor_label, floor_list, floor_num);
3535 /* Output each entry */
3536 for (j = 0; j < k; j++)
3538 m = floor_list[out_index[j]];
3539 o_ptr = ¤t_floor_ptr->o_list[m];
3541 /* Clear the line */
3542 prt("", j + 1, col ? col - 2 : col);
3544 if (use_menu && target_item)
3546 if (j == (target_item-1))
3548 strcpy(tmp_val, _("》", "> "));
3549 target_item_label = m;
3551 else strcpy(tmp_val, " ");
3555 /* Prepare an index --(-- */
3556 sprintf(tmp_val, "%c)", floor_label[j]);
3559 /* Clear the line with the (possibly indented) index */
3560 put_str(tmp_val, j + 1, col);
3562 /* Display the entry itself */
3563 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3565 /* Display the weight if needed */
3566 if (show_weights && (o_ptr->tval != TV_GOLD))
3568 int wgt = o_ptr->weight * o_ptr->number;
3570 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3572 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3575 prt(tmp_val, j + 1, wid - 9);
3579 /* Make a "shadow" below the list (only if needed) */
3580 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3582 return target_item_label;
3586 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3587 * Let the user select an item, save its "index"
3588 * @param cp 選択したオブジェクトのIDを返す。
3589 * @param pmt 選択目的のメッセージ
3590 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3591 * @param mode オプションフラグ
3592 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3594 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3596 char n1 = ' ', n2 = ' ', which = ' ';
3599 COMMAND_CODE i1, i2;
3600 COMMAND_CODE e1, e2;
3608 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3609 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3610 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3611 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3613 bool allow_equip = FALSE;
3614 bool allow_inven = FALSE;
3615 bool allow_floor = FALSE;
3617 bool toggle = FALSE;
3622 ITEM_NUMBER floor_num;
3623 OBJECT_IDX floor_list[23];
3625 TERM_LEN min_width = 0;
3627 int menu_line = (use_menu ? 1 : 0);
3631 static char prev_tag = '\0';
3632 char cur_tag = '\0';
3634 /* Get the item index */
3635 if (repeat_pull(cp))
3638 if (force && (*cp == INVEN_FORCE))
3640 item_tester_tval = 0;
3641 item_tester_hook = NULL;
3642 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3647 else if (floor && (*cp < 0))
3649 if (prev_tag && command_cmd)
3651 /* Scan all objects in the grid */
3652 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3654 /* Look up the tag */
3655 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3657 /* Accept that choice */
3658 (*cp) = 0 - floor_list[k];
3660 /* Forget restrictions */
3661 item_tester_tval = 0;
3662 item_tester_hook = NULL;
3663 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3669 prev_tag = '\0'; /* prev_tag is no longer effective */
3672 /* Validate the item */
3673 else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
3675 /* Forget restrictions */
3676 item_tester_tval = 0;
3677 item_tester_hook = NULL;
3678 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3685 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3686 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3688 if (prev_tag && command_cmd)
3690 /* Look up the tag and validate the item */
3691 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3692 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3693 else if (!get_item_okay(k)) /* Reject */;
3696 /* Accept that choice */
3699 /* Forget restrictions */
3700 item_tester_tval = 0;
3701 item_tester_hook = NULL;
3702 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3708 prev_tag = '\0'; /* prev_tag is no longer effective */
3711 /* Verify the item */
3712 else if (get_item_okay(*cp))
3714 /* Forget restrictions */
3715 item_tester_tval = 0;
3716 item_tester_hook = NULL;
3717 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3731 /* No item selected */
3735 /* Full p_ptr->inventory_list */
3737 i2 = INVEN_PACK - 1;
3739 /* Forbid p_ptr->inventory_list */
3740 if (!inven) i2 = -1;
3743 for (j = 0; j < INVEN_PACK; j++)
3744 if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
3747 /* Restrict p_ptr->inventory_list indexes */
3748 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3749 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3752 /* Full equipment */
3754 e2 = INVEN_TOTAL - 1;
3756 /* Forbid equipment */
3757 if (!equip) e2 = -1;
3760 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3761 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
3762 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3765 /* Restrict equipment indexes */
3766 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3767 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3769 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3773 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3775 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3779 /* Count "okay" floor items */
3782 /* Restrict floor usage */
3785 /* Scan all objects in the grid */
3786 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3789 /* Accept p_ptr->inventory_list */
3790 if (i1 <= i2) allow_inven = TRUE;
3792 /* Accept equipment */
3793 if (e1 <= e2) allow_equip = TRUE;
3796 if (floor_num) allow_floor = TRUE;
3798 /* Require at least one legal choice */
3799 if (!allow_inven && !allow_equip && !allow_floor)
3801 /* Cancel p_ptr->command_see */
3802 command_see = FALSE;
3812 /* Analyze choices */
3815 /* Hack -- Start on equipment if requested */
3816 if (command_see && (command_wrk == (USE_EQUIP))
3819 command_wrk = (USE_EQUIP);
3822 /* Use p_ptr->inventory_list if allowed */
3823 else if (allow_inven)
3825 command_wrk = (USE_INVEN);
3828 /* Use equipment if allowed */
3829 else if (allow_equip)
3831 command_wrk = (USE_EQUIP);
3834 /* Use floor if allowed */
3835 else if (allow_floor)
3837 command_wrk = (USE_FLOOR);
3842 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3844 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3846 /* Hack -- start out in "display" mode */
3852 /* Repeat until done */
3855 COMMAND_CODE get_item_label = 0;
3862 for (j = 0; j < 8; j++)
3865 if (!angband_term[j]) continue;
3867 /* Count windows displaying inven */
3868 if (window_flag[j] & (PW_INVEN)) ni++;
3870 /* Count windows displaying equip */
3871 if (window_flag[j] & (PW_EQUIP)) ne++;
3874 /* Toggle if needed */
3875 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3876 (command_wrk == (USE_INVEN) && !ni && ne))
3879 toggle_inven_equip();
3885 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3888 /* Inventory screen */
3889 if (command_wrk == (USE_INVEN))
3891 /* Extract the legal requests */
3895 /* Redraw if needed */
3896 if (command_see) get_item_label = show_inven(menu_line, mode);
3899 /* Equipment screen */
3900 else if (command_wrk == (USE_EQUIP))
3902 /* Extract the legal requests */
3903 n1 = I2A(e1 - INVEN_RARM);
3904 n2 = I2A(e2 - INVEN_RARM);
3906 /* Redraw if needed */
3907 if (command_see) get_item_label = show_equip(menu_line, mode);
3911 else if (command_wrk == (USE_FLOOR))
3914 k = MIN(floor_top + 23, floor_num) - 1;
3916 /* Extract the legal requests */
3917 n1 = I2A(j - floor_top);
3918 n2 = I2A(k - floor_top);
3920 /* Redraw if needed */
3921 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3924 /* Viewing p_ptr->inventory_list */
3925 if (command_wrk == (USE_INVEN))
3927 /* Begin the prompt */
3928 sprintf(out_val, _("持ち物:", "Inven:"));
3932 /* Build the prompt */
3933 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3934 index_to_label(i1), index_to_label(i2));
3937 strcat(out_val, tmp_val);
3940 /* Indicate ability to "view" */
3941 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3947 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
3948 else if (allow_floor)
3949 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
3951 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
3958 strcat(out_val, _(" '-'床上,", " - for floor,"));
3959 else if (allow_equip)
3960 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
3962 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
3966 /* Viewing equipment */
3967 else if (command_wrk == (USE_EQUIP))
3969 /* Begin the prompt */
3970 sprintf(out_val, _("装備品:", "Equip:"));
3974 /* Build the prompt */
3975 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3976 index_to_label(e1), index_to_label(e2));
3979 strcat(out_val, tmp_val);
3982 /* Indicate ability to "view" */
3983 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3989 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
3990 else if (allow_floor)
3991 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
3993 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4000 strcat(out_val, _(" '-'床上,", " - for floor,"));
4001 else if (allow_inven)
4002 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4004 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4009 else if (command_wrk == (USE_FLOOR))
4011 /* Begin the prompt */
4012 sprintf(out_val, _("床上:", "Floor:"));
4016 /* Build the prompt */
4017 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4020 strcat(out_val, tmp_val);
4023 /* Indicate ability to "view" */
4024 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4028 if (allow_inven && allow_equip)
4030 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4032 else if (allow_inven)
4034 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4036 else if (allow_equip)
4038 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4042 else if (allow_inven)
4044 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4046 else if (allow_equip)
4048 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4052 if (command_see && !use_menu)
4054 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4059 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4061 /* Finish the prompt */
4062 strcat(out_val, " ESC");
4064 /* Build the prompt */
4065 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4067 /* Show the prompt */
4076 if (command_wrk == USE_INVEN) max_line = max_inven;
4077 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4078 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4094 menu_line += (max_line - 1);
4110 /* Verify legality */
4111 if (command_wrk == (USE_INVEN))
4113 if (allow_floor) command_wrk = USE_FLOOR;
4114 else if (allow_equip) command_wrk = USE_EQUIP;
4121 else if (command_wrk == (USE_EQUIP))
4123 if (allow_inven) command_wrk = USE_INVEN;
4124 else if (allow_floor) command_wrk = USE_FLOOR;
4131 else if (command_wrk == (USE_FLOOR))
4133 if (allow_equip) command_wrk = USE_EQUIP;
4134 else if (allow_inven) command_wrk = USE_INVEN;
4147 /* Hack -- Fix screen */
4154 /* Switch inven/equip */
4155 if (command_wrk == USE_INVEN) max_line = max_inven;
4156 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4157 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4158 if (menu_line > max_line) menu_line = max_line;
4160 /* Need to redraw */
4168 /* Verify legality */
4169 if (command_wrk == (USE_INVEN))
4171 if (allow_equip) command_wrk = USE_EQUIP;
4172 else if (allow_floor) command_wrk = USE_FLOOR;
4179 else if (command_wrk == (USE_EQUIP))
4181 if (allow_floor) command_wrk = USE_FLOOR;
4182 else if (allow_inven) command_wrk = USE_INVEN;
4189 else if (command_wrk == (USE_FLOOR))
4191 if (allow_inven) command_wrk = USE_INVEN;
4192 else if (allow_equip) command_wrk = USE_EQUIP;
4205 /* Hack -- Fix screen */
4212 /* Switch inven/equip */
4213 if (command_wrk == USE_INVEN) max_line = max_inven;
4214 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4215 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4216 if (menu_line > max_line) menu_line = max_line;
4218 /* Need to redraw */
4227 if (command_wrk == USE_FLOOR)
4230 (*cp) = -get_item_label;
4234 /* Validate the item */
4235 if (!get_item_okay(get_item_label))
4241 /* Allow player to "refuse" certain actions */
4242 if (!get_item_allow(get_item_label))
4248 /* Accept that choice */
4249 (*cp) = get_item_label;
4266 if (menu_line > max_line) menu_line -= max_line;
4287 command_see = FALSE;
4308 grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
4310 if (command_wrk != (USE_FLOOR)) break;
4312 /* Get the object being moved. */
4313 o_idx = g_ptr->o_idx;
4315 /* Only rotate a pile of two or more objects. */
4316 if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
4318 /* Remove the first object from the list. */
4319 excise_object_idx(o_idx);
4321 /* Find end of the list. */
4323 while (current_floor_ptr->o_list[i].next_o_idx)
4324 i = current_floor_ptr->o_list[i].next_o_idx;
4326 /* Add after the last object. */
4327 current_floor_ptr->o_list[i].next_o_idx = o_idx;
4329 /* Re-scan floor list */
4330 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4332 /* Hack -- Fix screen */
4344 if (command_wrk == (USE_INVEN))
4351 command_wrk = (USE_EQUIP);
4353 else if (command_wrk == (USE_EQUIP))
4360 command_wrk = (USE_INVEN);
4362 else if (command_wrk == (USE_FLOOR))
4366 command_wrk = (USE_INVEN);
4368 else if (allow_equip)
4370 command_wrk = (USE_EQUIP);
4379 /* Hack -- Fix screen */
4386 /* Need to redraw */
4399 * If we are already examining the floor, and there
4400 * is only one item, we will always select it.
4401 * If we aren't examining the floor and there is only
4402 * one item, we will select it if floor_query_flag
4407 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4410 k = 0 - floor_list[0];
4412 /* Allow player to "refuse" certain actions */
4413 if (!get_item_allow(k))
4419 /* Accept that choice */
4428 /* Hack -- Fix screen */
4435 command_wrk = (USE_FLOOR);
4441 case '1': case '2': case '3':
4442 case '4': case '5': case '6':
4443 case '7': case '8': case '9':
4445 if (command_wrk != USE_FLOOR)
4447 /* Look up the tag */
4448 if (!get_tag(&k, which, command_wrk))
4454 /* Hack -- Validate the item */
4455 if ((k < INVEN_RARM) ? !inven : !equip)
4461 /* Validate the item */
4462 if (!get_item_okay(k))
4470 /* Look up the alphabetical tag */
4471 if (get_tag_floor(&k, which, floor_list, floor_num))
4474 k = 0 - floor_list[k];
4483 /* Allow player to "refuse" certain actions */
4484 if (!get_item_allow(k))
4490 /* Accept that choice */
4502 /* Choose "default" p_ptr->inventory_list item */
4503 if (command_wrk == (USE_INVEN))
4505 k = ((i1 == i2) ? i1 : -1);
4508 /* Choose "default" equipment item */
4509 else if (command_wrk == (USE_EQUIP))
4511 k = ((e1 == e2) ? e1 : -1);
4514 /* Choose "default" floor item */
4515 else if (command_wrk == (USE_FLOOR))
4520 k = 0 - floor_list[0];
4522 /* Allow player to "refuse" certain actions */
4523 if (!get_item_allow(k))
4529 /* Accept that choice */
4537 /* Validate the item */
4538 if (!get_item_okay(k))
4544 /* Allow player to "refuse" certain actions */
4545 if (!get_item_allow(k))
4551 /* Accept that choice */
4575 if (command_wrk != USE_FLOOR)
4577 bool not_found = FALSE;
4579 /* Look up the alphabetical tag */
4580 if (!get_tag(&k, which, command_wrk))
4585 /* Hack -- Validate the item */
4586 else if ((k < INVEN_RARM) ? !inven : !equip)
4591 /* Validate the item */
4592 else if (!get_item_okay(k))
4599 /* Accept that choice */
4609 /* Look up the alphabetical tag */
4610 if (get_tag_floor(&k, which, floor_list, floor_num))
4613 k = 0 - floor_list[k];
4615 /* Accept that choice */
4624 /* Extract "query" setting */
4625 ver = isupper(which);
4626 which = (char)tolower(which);
4628 /* Convert letter to p_ptr->inventory_list index */
4629 if (command_wrk == (USE_INVEN))
4631 if (which == '(') k = i1;
4632 else if (which == ')') k = i2;
4633 else k = label_to_inven(which);
4636 /* Convert letter to equipment index */
4637 else if (command_wrk == (USE_EQUIP))
4639 if (which == '(') k = e1;
4640 else if (which == ')') k = e2;
4641 else k = label_to_equip(which);
4644 /* Convert letter to floor index */
4645 else if (command_wrk == USE_FLOOR)
4647 if (which == '(') k = 0;
4648 else if (which == ')') k = floor_num - 1;
4649 else k = islower(which) ? A2I(which) : -1;
4650 if (k < 0 || k >= floor_num || k >= 23)
4657 k = 0 - floor_list[k];
4660 /* Validate the item */
4661 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4667 /* Verify the item */
4668 if (ver && !verify(_("本当に", "Try"), k))
4674 /* Allow player to "refuse" certain actions */
4675 if (!get_item_allow(k))
4681 /* Accept that choice */
4691 /* Fix the screen if necessary */
4696 /* Hack -- Cancel "display" */
4697 command_see = FALSE;
4701 /* Forget the item_tester_tval restriction */
4702 item_tester_tval = 0;
4704 /* Forget the item_tester_hook restriction */
4705 item_tester_hook = NULL;
4708 /* Clean up 'show choices' */
4709 /* Toggle again if needed */
4710 if (toggle) toggle_inven_equip();
4712 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4715 /* Clear the prompt line */
4718 /* Warning if needed */
4719 if (oops && str) msg_print(str);
4724 if (command_cmd) prev_tag = cur_tag;
4725 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4731 * @brief 床上のアイテムを拾う選択用サブルーチン
4732 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4734 static bool py_pickup_floor_aux(void)
4736 OBJECT_IDX this_o_idx;
4740 /* Restrict the choices */
4741 item_tester_hook = inven_carry_okay;
4744 q = _("どれを拾いますか?", "Get which item? ");
4745 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4747 if (choose_object(&item, q, s, (USE_FLOOR)))
4749 this_o_idx = 0 - item;
4756 /* Pick up the object */
4757 py_pickup_aux(this_o_idx);
4763 * @brief 床上のアイテムを拾うメイン処理
4764 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4767 * This is called by py_pickup() when easy_floor is TRUE.
4769 void py_pickup_floor(bool pickup)
4771 OBJECT_IDX this_o_idx, next_o_idx = 0;
4773 GAME_TEXT o_name[MAX_NLEN];
4777 OBJECT_IDX floor_o_idx = 0;
4781 /* Scan the pile of objects */
4782 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)
4784 /* Access the object */
4785 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
4787 object_desc(o_name, o_ptr, 0);
4789 /* Access the next object */
4790 next_o_idx = o_ptr->next_o_idx;
4792 disturb(FALSE, FALSE);
4795 if (o_ptr->tval == TV_GOLD)
4798 msg_format(" $%ld の価値がある%sを見つけた。",
4799 (long)o_ptr->pval, o_name);
4801 msg_format("You have found %ld gold pieces worth of %s.",
4802 (long)o_ptr->pval, o_name);
4805 /* Collect the gold */
4806 p_ptr->au += o_ptr->pval;
4809 p_ptr->redraw |= (PR_GOLD);
4811 p_ptr->window |= (PW_PLAYER);
4813 /* Delete the gold */
4814 delete_object_idx(this_o_idx);
4816 /* Check the next object */
4819 else if (o_ptr->marked & OM_NOMSG)
4821 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4822 * ignored. Otherwise, they are included in the prompt. */
4823 o_ptr->marked &= ~(OM_NOMSG);
4827 /* Count non-gold objects that can be picked up. */
4828 if (inven_carry_okay(o_ptr))
4833 /* Count non-gold objects */
4836 /* Remember this index */
4837 floor_o_idx = this_o_idx;
4840 /* There are no non-gold objects */
4844 /* Mention the number of objects */
4850 /* Access the object */
4851 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4853 #ifdef ALLOW_EASY_SENSE
4855 /* Option: Make object sensing easy */
4858 /* Sense the object */
4859 (void) sense_object(o_ptr);
4862 #endif /* ALLOW_EASY_SENSE */
4864 object_desc(o_name, o_ptr, 0);
4866 msg_format(_("%sがある。", "You see %s."), o_name);
4869 /* Multiple objects */
4872 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4878 /* The player has no room for anything on the floor. */
4884 /* Access the object */
4885 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4887 #ifdef ALLOW_EASY_SENSE
4889 /* Option: Make object sensing easy */
4892 /* Sense the object */
4893 (void) sense_object(o_ptr);
4896 #endif /* ALLOW_EASY_SENSE */
4898 object_desc(o_name, o_ptr, 0);
4900 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4903 /* Multiple objects */
4906 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4916 /* Hack -- query every object */
4917 if (carry_query_flag)
4919 char out_val[MAX_NLEN+20];
4921 /* Access the object */
4922 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4924 #ifdef ALLOW_EASY_SENSE
4926 /* Option: Make object sensing easy */
4929 /* Sense the object */
4930 (void) sense_object(o_ptr);
4933 #endif /* ALLOW_EASY_SENSE */
4935 object_desc(o_name, o_ptr, 0);
4937 /* Build a prompt */
4938 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
4940 /* Ask the user to confirm */
4941 if (!get_check(out_val))
4947 /* Access the object */
4948 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
4950 #ifdef ALLOW_EASY_SENSE
4952 /* Option: Make object sensing easy */
4955 /* Sense the object */
4956 (void) sense_object(o_ptr);
4959 #endif /* ALLOW_EASY_SENSE */
4961 /* Pick up the object */
4962 py_pickup_aux(floor_o_idx);
4965 /* Allow the user to choose an object */
4968 while (can_pickup--)
4970 if (!py_pickup_floor_aux()) break;
4977 * @brief 矢弾を射撃した場合の破損確率を返す /
4978 * Determines the odds of an object breaking when thrown at a monster
4979 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
4982 * Note that artifacts never break, see the "drop_near()" function.
4984 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
4986 PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
4988 /* Examine the snipe type */
4991 if (snipe_type == SP_KILL_WALL) return (100);
4992 if (snipe_type == SP_EXPLODE) return (100);
4993 if (snipe_type == SP_PIERCE) return (100);
4994 if (snipe_type == SP_FINAL) return (100);
4995 if (snipe_type == SP_NEEDLE) return (100);
4996 if (snipe_type == SP_EVILNESS) return (40);
4997 if (snipe_type == SP_HOLYNESS) return (40);
5000 /* Examine the item type */
5001 switch (o_ptr->tval)
5017 /* Sometimes break */
5022 return (20 - archer_bonus * 2);
5027 return (10 - archer_bonus);