3 * @brief プレイヤーの読むコマンド実装
10 #include "object-flavor.h"
11 #include "object-hook.h"
14 #include "player-status.h"
15 #include "player-effects.h"
17 #include "realm-hex.h"
20 #include "spells-object.h"
21 #include "spells-floor.h"
22 #include "spells-summon.h"
23 #include "spells-status.h"
25 #include "cmd-basic.h"
29 * @brief 巻物を読むコマンドのサブルーチン
30 * Read a scroll (from the pack or floor).
31 * @param item 読むオブジェクトの所持品ID
32 * @param known 判明済ならばTRUE
36 * Certain scrolls can be "aborted" without losing the scroll. These
37 * include scrolls with no effects but recharge or identify, which are
38 * cancelled before use. XXX Reading them still takes a current_world_ptr->game_turn, though.
41 void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known)
43 int k, used_up, ident, lev;
47 /* Get the item (in the pack) */
50 o_ptr = &inventory[item];
53 /* Get the item (on the floor) */
56 o_ptr = ¤t_floor_ptr->o_list[0 - item];
59 take_turn(p_ptr, 100);
60 if (cmd_limit_time_walk(p_ptr)) return;
62 if (p_ptr->pclass == CLASS_BERSERKER)
64 msg_print(_("巻物なんて読めない。", "You cannot read."));
68 if (music_singing_any()) stop_singing(p_ptr);
71 if (hex_spelling_any() && ((p_ptr->lev < 35) || hex_spell_fully())) stop_hex_spell_all();
73 /* Not identified yet */
77 lev = k_info[o_ptr->k_idx].level;
79 /* Assume the scroll will get used up */
82 if (o_ptr->tval == TV_SCROLL)
84 /* Analyze the scroll */
87 case SV_SCROLL_DARKNESS:
89 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
91 (void)set_blind(p_ptr->blind + 3 + randint1(5));
93 if (unlite_area(10, 3)) ident = TRUE;
97 case SV_SCROLL_AGGRAVATE_MONSTER:
99 msg_print(_("カン高くうなる様な音が辺りを覆った。", "There is a high pitched humming noise."));
100 aggravate_monsters(0);
105 case SV_SCROLL_CURSE_ARMOR:
107 if (curse_armor()) ident = TRUE;
111 case SV_SCROLL_CURSE_WEAPON:
114 if (has_melee_weapon(INVEN_RARM))
117 if (has_melee_weapon(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
119 else if (has_melee_weapon(INVEN_LARM)) k = INVEN_LARM;
120 if (k && curse_weapon(FALSE, k)) ident = TRUE;
124 case SV_SCROLL_SUMMON_MONSTER:
126 for (k = 0; k < randint1(3); k++)
128 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
136 case SV_SCROLL_SUMMON_UNDEAD:
138 for (k = 0; k < randint1(3); k++)
140 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
148 case SV_SCROLL_SUMMON_PET:
150 if (summon_specific(-1, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0'))
157 case SV_SCROLL_SUMMON_KIN:
159 if (summon_kin_player(p_ptr->lev, p_ptr->y, p_ptr->x, (PM_FORCE_PET | PM_ALLOW_GROUP)))
166 case SV_SCROLL_TRAP_CREATION:
168 if (trap_creation(p_ptr->y, p_ptr->x)) ident = TRUE;
172 case SV_SCROLL_PHASE_DOOR:
174 teleport_player(10, 0L);
179 case SV_SCROLL_TELEPORT:
181 teleport_player(100, 0L);
186 case SV_SCROLL_TELEPORT_LEVEL:
188 (void)teleport_level(0);
193 case SV_SCROLL_WORD_OF_RECALL:
195 if (!recall_player(p_ptr, randint0(21) + 15)) used_up = FALSE;
200 case SV_SCROLL_IDENTIFY:
202 if (!ident_spell(FALSE)) used_up = FALSE;
207 case SV_SCROLL_STAR_IDENTIFY:
209 if (!identify_fully(FALSE)) used_up = FALSE;
214 case SV_SCROLL_REMOVE_CURSE:
223 case SV_SCROLL_STAR_REMOVE_CURSE:
225 if (remove_all_curse())
232 case SV_SCROLL_ENCHANT_ARMOR:
235 if (!enchant_spell(0, 0, 1)) used_up = FALSE;
239 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
241 if (!enchant_spell(1, 0, 0)) used_up = FALSE;
246 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
248 if (!enchant_spell(0, 1, 0)) used_up = FALSE;
253 case SV_SCROLL_STAR_ENCHANT_ARMOR:
255 if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
260 case SV_SCROLL_STAR_ENCHANT_WEAPON:
262 if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
267 case SV_SCROLL_RECHARGING:
269 if (!recharge(130)) used_up = FALSE;
274 case SV_SCROLL_MUNDANITY:
277 if (!mundane_spell(FALSE)) used_up = FALSE;
281 case SV_SCROLL_LIGHT:
283 if (lite_area(damroll(2, 8), 2)) ident = TRUE;
287 case SV_SCROLL_MAPPING:
289 map_area(DETECT_RAD_MAP);
294 case SV_SCROLL_DETECT_GOLD:
296 if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
297 if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
301 case SV_SCROLL_DETECT_ITEM:
303 if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
307 case SV_SCROLL_DETECT_TRAP:
309 if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
313 case SV_SCROLL_DETECT_DOOR:
315 if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
316 if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
320 case SV_SCROLL_DETECT_INVIS:
322 if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
326 case SV_SCROLL_SATISFY_HUNGER:
328 if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
332 case SV_SCROLL_BLESSING:
334 if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
338 case SV_SCROLL_HOLY_CHANT:
340 if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
344 case SV_SCROLL_HOLY_PRAYER:
346 if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
350 case SV_SCROLL_MONSTER_CONFUSION:
352 if (!(p_ptr->special_attack & ATTACK_CONFUSE))
354 msg_print(_("手が輝き始めた。", "Your hands begin to glow."));
355 p_ptr->special_attack |= ATTACK_CONFUSE;
356 p_ptr->redraw |= (PR_STATUS);
362 case SV_SCROLL_PROTECTION_FROM_EVIL:
365 if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
369 case SV_SCROLL_RUNE_OF_PROTECTION:
376 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
378 if (destroy_doors_touch()) ident = TRUE;
382 case SV_SCROLL_STAR_DESTRUCTION:
384 if (destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE))
387 msg_print(_("ダンジョンが揺れた...", "The dungeon trembles..."));
392 case SV_SCROLL_DISPEL_UNDEAD:
394 if (dispel_undead(80)) ident = TRUE;
398 case SV_SCROLL_SPELL:
400 if ((p_ptr->pclass == CLASS_WARRIOR) ||
401 (p_ptr->pclass == CLASS_IMITATOR) ||
402 (p_ptr->pclass == CLASS_MINDCRAFTER) ||
403 (p_ptr->pclass == CLASS_SORCERER) ||
404 (p_ptr->pclass == CLASS_ARCHER) ||
405 (p_ptr->pclass == CLASS_MAGIC_EATER) ||
406 (p_ptr->pclass == CLASS_RED_MAGE) ||
407 (p_ptr->pclass == CLASS_SAMURAI) ||
408 (p_ptr->pclass == CLASS_BLUE_MAGE) ||
409 (p_ptr->pclass == CLASS_CAVALRY) ||
410 (p_ptr->pclass == CLASS_BERSERKER) ||
411 (p_ptr->pclass == CLASS_SMITH) ||
412 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
413 (p_ptr->pclass == CLASS_NINJA) ||
414 (p_ptr->pclass == CLASS_SNIPER)) break;
416 p_ptr->update |= (PU_SPELLS);
421 case SV_SCROLL_GENOCIDE:
423 (void)symbol_genocide(300, TRUE);
428 case SV_SCROLL_MASS_GENOCIDE:
430 (void)mass_genocide(300, TRUE);
435 case SV_SCROLL_ACQUIREMENT:
437 acquirement(p_ptr->y, p_ptr->x, 1, TRUE, FALSE, FALSE);
442 case SV_SCROLL_STAR_ACQUIREMENT:
444 acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE);
449 /* New Hengband scrolls */
452 fire_ball(GF_FIRE, 0, 666, 4);
453 /* Note: "Double" damage since it is centered on the player ... */
454 if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
455 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1);
464 fire_ball(GF_ICE, 0, 777, 4);
465 if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
466 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
472 case SV_SCROLL_CHAOS:
474 fire_ball(GF_CHAOS, 0, 1000, 4);
475 if (!p_ptr->resist_chaos)
476 take_hit(DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1);
482 case SV_SCROLL_RUMOR:
484 msg_print(_("巻物にはメッセージが書かれている:", "There is message on the scroll. It says:"));
488 msg_print(_("巻物は煙を立てて消え去った!", "The scroll disappears in a puff of smoke!"));
494 case SV_SCROLL_ARTIFACT:
497 if (!artifact_scroll()) used_up = FALSE;
501 case SV_SCROLL_RESET_RECALL:
504 if (!reset_recall()) used_up = FALSE;
508 case SV_SCROLL_AMUSEMENT:
511 amusement(p_ptr->y, p_ptr->x, 1, FALSE);
515 case SV_SCROLL_STAR_AMUSEMENT:
518 amusement(p_ptr->y, p_ptr->x, randint1(2) + 1, FALSE);
523 else if (o_ptr->name1 == ART_GHB)
525 msg_print(_("私は苦労して『グレーター・ヘル=ビースト』を倒した。", "I had a very hard time to kill the Greater hell-beast, "));
526 msg_print(_("しかし手に入ったのはこのきたないTシャツだけだった。", "but all I got was this lousy t-shirt!"));
529 else if (o_ptr->name1 == ART_POWER)
531 msg_print(_("「一つの指輪は全てを統べ、", "'One Ring to rule them all, "));
533 msg_print(_("一つの指輪は全てを見つけ、", "One Ring to find them, "));
535 msg_print(_("一つの指輪は全てを捕らえて", "One Ring to bring them all "));
537 msg_print(_("暗闇の中に繋ぎとめる。」", "and in the darkness bind them.'"));
540 else if (o_ptr->tval==TV_PARCHMENT)
543 GAME_TEXT o_name[MAX_NLEN];
547 q=format("book-%d_jp.txt",o_ptr->sval);
549 /* Display object description */
550 object_desc(o_name, o_ptr, OD_NAME_ONLY);
552 /* Build the filename */
553 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q);
555 /* Peruse the help file */
556 (void)show_file(TRUE, buf, o_name, 0, 0);
562 p_ptr->update |= (PU_COMBINE | PU_REORDER);
564 if (!(object_is_aware(o_ptr)))
566 chg_virtue(V_PATIENCE, -1);
567 chg_virtue(V_CHANCE, 1);
568 chg_virtue(V_KNOWLEDGE, -1);
571 /* The item was tried */
574 /* An identification was made */
575 if (ident && !object_is_aware(o_ptr))
578 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
581 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
584 /* Hack -- allow certain scrolls to be "preserved" */
592 /* Destroy a scroll in the pack */
595 inven_item_increase(item, -1);
596 inven_item_describe(item);
597 inven_item_optimize(item);
600 /* Destroy a scroll on the floor */
603 floor_item_increase(0 - item, -1);
604 floor_item_describe(0 - item);
605 floor_item_optimize(0 - item);
610 * @brief 読むコマンドのメインルーチン /
611 * Eat some food (from the pack or floor)
614 void do_cmd_read_scroll(void)
620 if (p_ptr->wild_mode)
625 if (cmd_limit_arena(p_ptr)) return;
627 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
629 set_action(ACTION_NONE);
632 if (cmd_limit_blind(p_ptr)) return;
633 if (cmd_limit_confused(p_ptr)) return;
635 /* Restrict choices to scrolls */
636 item_tester_hook = item_tester_hook_readable;
638 q = _("どの巻物を読みますか? ", "Read which scroll? ");
639 s = _("読める巻物がない。", "You have no scrolls to read.");
641 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
644 /* Read the scroll */
645 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));