3 * @brief プレイヤーの読むコマンド実装
\r
10 #include "object-hook.h"
\r
11 #include "spells-summon.h"
\r
12 #include "artifact.h"
\r
15 * @brief 巻物を読むコマンドのサブルーチン
\r
16 * Read a scroll (from the pack or floor).
\r
17 * @param item 読むオブジェクトの所持品ID
\r
18 * @param known 判明済ならばTRUE
\r
22 * Certain scrolls can be "aborted" without losing the scroll. These
\r
23 * include scrolls with no effects but recharge or identify, which are
\r
24 * cancelled before use. XXX Reading them still takes a turn, though.
\r
27 void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known)
\r
29 int k, used_up, ident, lev;
\r
33 /* Get the item (in the pack) */
\r
36 o_ptr = &inventory[item];
\r
39 /* Get the item (on the floor) */
\r
42 o_ptr = &o_list[0 - item];
\r
46 p_ptr->energy_use = 100;
\r
50 if (flush_failure) flush();
\r
51 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen."));
\r
56 if (p_ptr->pclass == CLASS_BERSERKER)
\r
58 msg_print(_("巻物なんて読めない。", "You cannot read."));
\r
62 if (music_singing_any()) stop_singing();
\r
65 if (hex_spelling_any() && ((p_ptr->lev < 35) || hex_spell_fully())) stop_hex_spell_all();
\r
67 /* Not identified yet */
\r
71 lev = k_info[o_ptr->k_idx].level;
\r
73 /* Assume the scroll will get used up */
\r
76 if (o_ptr->tval == TV_SCROLL)
\r
78 /* Analyze the scroll */
\r
79 switch (o_ptr->sval)
\r
81 case SV_SCROLL_DARKNESS:
\r
83 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
\r
85 (void)set_blind(p_ptr->blind + 3 + randint1(5));
\r
87 if (unlite_area(10, 3)) ident = TRUE;
\r
91 case SV_SCROLL_AGGRAVATE_MONSTER:
\r
93 msg_print(_("カン高くうなる様な音が辺りを覆った。", "There is a high pitched humming noise."));
\r
94 aggravate_monsters(0);
\r
99 case SV_SCROLL_CURSE_ARMOR:
\r
101 if (curse_armor()) ident = TRUE;
\r
105 case SV_SCROLL_CURSE_WEAPON:
\r
108 if (buki_motteruka(INVEN_RARM))
\r
111 if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
\r
113 else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM;
\r
114 if (k && curse_weapon(FALSE, k)) ident = TRUE;
\r
118 case SV_SCROLL_SUMMON_MONSTER:
\r
120 for (k = 0; k < randint1(3); k++)
\r
122 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
\r
130 case SV_SCROLL_SUMMON_UNDEAD:
\r
132 for (k = 0; k < randint1(3); k++)
\r
134 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
\r
142 case SV_SCROLL_SUMMON_PET:
\r
144 if (summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0'))
\r
151 case SV_SCROLL_SUMMON_KIN:
\r
153 if (summon_kin_player(p_ptr->lev, p_ptr->y, p_ptr->x, (PM_FORCE_PET | PM_ALLOW_GROUP)))
\r
160 case SV_SCROLL_TRAP_CREATION:
\r
162 if (trap_creation(p_ptr->y, p_ptr->x)) ident = TRUE;
\r
166 case SV_SCROLL_PHASE_DOOR:
\r
168 teleport_player(10, 0L);
\r
173 case SV_SCROLL_TELEPORT:
\r
175 teleport_player(100, 0L);
\r
180 case SV_SCROLL_TELEPORT_LEVEL:
\r
182 (void)teleport_level(0);
\r
187 case SV_SCROLL_WORD_OF_RECALL:
\r
189 if (!recall_player(p_ptr, randint0(21) + 15)) used_up = FALSE;
\r
194 case SV_SCROLL_IDENTIFY:
\r
196 if (!ident_spell(FALSE)) used_up = FALSE;
\r
201 case SV_SCROLL_STAR_IDENTIFY:
\r
203 if (!identify_fully(FALSE)) used_up = FALSE;
\r
208 case SV_SCROLL_REMOVE_CURSE:
\r
210 if (remove_curse())
\r
217 case SV_SCROLL_STAR_REMOVE_CURSE:
\r
219 if (remove_all_curse())
\r
226 case SV_SCROLL_ENCHANT_ARMOR:
\r
229 if (!enchant_spell(0, 0, 1)) used_up = FALSE;
\r
233 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
\r
235 if (!enchant_spell(1, 0, 0)) used_up = FALSE;
\r
240 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
\r
242 if (!enchant_spell(0, 1, 0)) used_up = FALSE;
\r
247 case SV_SCROLL_STAR_ENCHANT_ARMOR:
\r
249 if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
\r
254 case SV_SCROLL_STAR_ENCHANT_WEAPON:
\r
256 if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
\r
261 case SV_SCROLL_RECHARGING:
\r
263 if (!recharge(130)) used_up = FALSE;
\r
268 case SV_SCROLL_MUNDANITY:
\r
271 if (!mundane_spell(FALSE)) used_up = FALSE;
\r
275 case SV_SCROLL_LIGHT:
\r
277 if (lite_area(damroll(2, 8), 2)) ident = TRUE;
\r
281 case SV_SCROLL_MAPPING:
\r
283 map_area(DETECT_RAD_MAP);
\r
288 case SV_SCROLL_DETECT_GOLD:
\r
290 if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
291 if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
295 case SV_SCROLL_DETECT_ITEM:
\r
297 if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
301 case SV_SCROLL_DETECT_TRAP:
\r
303 if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
\r
307 case SV_SCROLL_DETECT_DOOR:
\r
309 if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
310 if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
314 case SV_SCROLL_DETECT_INVIS:
\r
316 if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
320 case SV_SCROLL_SATISFY_HUNGER:
\r
322 if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
\r
326 case SV_SCROLL_BLESSING:
\r
328 if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
\r
332 case SV_SCROLL_HOLY_CHANT:
\r
334 if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
\r
338 case SV_SCROLL_HOLY_PRAYER:
\r
340 if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
\r
344 case SV_SCROLL_MONSTER_CONFUSION:
\r
346 if (!(p_ptr->special_attack & ATTACK_CONFUSE))
\r
348 msg_print(_("手が輝き始めた。", "Your hands begin to glow."));
\r
349 p_ptr->special_attack |= ATTACK_CONFUSE;
\r
350 p_ptr->redraw |= (PR_STATUS);
\r
356 case SV_SCROLL_PROTECTION_FROM_EVIL:
\r
358 k = 3 * p_ptr->lev;
\r
359 if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
\r
363 case SV_SCROLL_RUNE_OF_PROTECTION:
\r
370 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
\r
372 if (destroy_doors_touch()) ident = TRUE;
\r
376 case SV_SCROLL_STAR_DESTRUCTION:
\r
378 if (destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE))
\r
381 msg_print(_("ダンジョンが揺れた...", "The dungeon trembles..."));
\r
386 case SV_SCROLL_DISPEL_UNDEAD:
\r
388 if (dispel_undead(80)) ident = TRUE;
\r
392 case SV_SCROLL_SPELL:
\r
394 if ((p_ptr->pclass == CLASS_WARRIOR) ||
\r
395 (p_ptr->pclass == CLASS_IMITATOR) ||
\r
396 (p_ptr->pclass == CLASS_MINDCRAFTER) ||
\r
397 (p_ptr->pclass == CLASS_SORCERER) ||
\r
398 (p_ptr->pclass == CLASS_ARCHER) ||
\r
399 (p_ptr->pclass == CLASS_MAGIC_EATER) ||
\r
400 (p_ptr->pclass == CLASS_RED_MAGE) ||
\r
401 (p_ptr->pclass == CLASS_SAMURAI) ||
\r
402 (p_ptr->pclass == CLASS_BLUE_MAGE) ||
\r
403 (p_ptr->pclass == CLASS_CAVALRY) ||
\r
404 (p_ptr->pclass == CLASS_BERSERKER) ||
\r
405 (p_ptr->pclass == CLASS_SMITH) ||
\r
406 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
\r
407 (p_ptr->pclass == CLASS_NINJA) ||
\r
408 (p_ptr->pclass == CLASS_SNIPER)) break;
\r
409 p_ptr->add_spells++;
\r
410 p_ptr->update |= (PU_SPELLS);
\r
415 case SV_SCROLL_GENOCIDE:
\r
417 (void)symbol_genocide(300, TRUE);
\r
422 case SV_SCROLL_MASS_GENOCIDE:
\r
424 (void)mass_genocide(300, TRUE);
\r
429 case SV_SCROLL_ACQUIREMENT:
\r
431 acquirement(p_ptr->y, p_ptr->x, 1, TRUE, FALSE, FALSE);
\r
436 case SV_SCROLL_STAR_ACQUIREMENT:
\r
438 acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE);
\r
443 /* New Hengband scrolls */
\r
444 case SV_SCROLL_FIRE:
\r
446 fire_ball(GF_FIRE, 0, 666, 4);
\r
447 /* Note: "Double" damage since it is centered on the player ... */
\r
448 if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
\r
449 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1);
\r
456 case SV_SCROLL_ICE:
\r
458 fire_ball(GF_ICE, 0, 777, 4);
\r
459 if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
\r
460 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
\r
466 case SV_SCROLL_CHAOS:
\r
468 fire_ball(GF_CHAOS, 0, 1000, 4);
\r
469 if (!p_ptr->resist_chaos)
\r
470 take_hit(DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1);
\r
476 case SV_SCROLL_RUMOR:
\r
478 msg_print(_("巻物にはメッセージが書かれている:", "There is message on the scroll. It says:"));
\r
480 display_rumor(TRUE);
\r
482 msg_print(_("巻物は煙を立てて消え去った!", "The scroll disappears in a puff of smoke!"));
\r
488 case SV_SCROLL_ARTIFACT:
\r
491 if (!artifact_scroll()) used_up = FALSE;
\r
495 case SV_SCROLL_RESET_RECALL:
\r
498 if (!reset_recall()) used_up = FALSE;
\r
502 case SV_SCROLL_AMUSEMENT:
\r
505 amusement(p_ptr->y, p_ptr->x, 1, FALSE);
\r
509 case SV_SCROLL_STAR_AMUSEMENT:
\r
512 amusement(p_ptr->y, p_ptr->x, randint1(2) + 1, FALSE);
\r
517 else if (o_ptr->name1 == ART_GHB)
\r
519 msg_print(_("私は苦労して『グレーター・ヘル=ビースト』を倒した。", "I had a very hard time to kill the Greater hell-beast, "));
\r
520 msg_print(_("しかし手に入ったのはこのきたないTシャツだけだった。", "but all I got was this lousy t-shirt!"));
\r
523 else if (o_ptr->name1 == ART_POWER)
\r
525 msg_print(_("「一つの指輪は全てを統べ、", "'One Ring to rule them all, "));
\r
527 msg_print(_("一つの指輪は全てを見つけ、", "One Ring to find them, "));
\r
529 msg_print(_("一つの指輪は全てを捕らえて", "One Ring to bring them all "));
\r
531 msg_print(_("暗闇の中に繋ぎとめる。」", "and in the darkness bind them.'"));
\r
534 else if (o_ptr->tval==TV_PARCHMENT)
\r
537 GAME_TEXT o_name[MAX_NLEN];
\r
541 q=format("book-%d_jp.txt",o_ptr->sval);
\r
543 /* Display object description */
\r
544 object_desc(o_name, o_ptr, OD_NAME_ONLY);
\r
546 /* Build the filename */
\r
547 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q);
\r
549 /* Peruse the help file */
\r
550 (void)show_file(TRUE, buf, o_name, 0, 0);
\r
557 /* Combine / Reorder the pack (later) */
\r
558 p_ptr->update |= (PU_COMBINE | PU_REORDER);
\r
560 if (!(object_is_aware(o_ptr)))
\r
562 chg_virtue(V_PATIENCE, -1);
\r
563 chg_virtue(V_CHANCE, 1);
\r
564 chg_virtue(V_KNOWLEDGE, -1);
\r
567 /* The item was tried */
\r
568 object_tried(o_ptr);
\r
570 /* An identification was made */
\r
571 if (ident && !object_is_aware(o_ptr))
\r
573 object_aware(o_ptr);
\r
574 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
\r
577 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
\r
580 /* Hack -- allow certain scrolls to be "preserved" */
\r
586 sound(SOUND_SCROLL);
\r
588 /* Destroy a scroll in the pack */
\r
591 inven_item_increase(item, -1);
\r
592 inven_item_describe(item);
\r
593 inven_item_optimize(item);
\r
596 /* Destroy a scroll on the floor */
\r
599 floor_item_increase(0 - item, -1);
\r
600 floor_item_describe(0 - item);
\r
601 floor_item_optimize(0 - item);
\r
606 * @brief 読むコマンドのメインルーチン /
\r
607 * Eat some food (from the pack or floor)
\r
610 void do_cmd_read_scroll(void)
\r
612 object_type *o_ptr;
\r
616 if (p_ptr->wild_mode)
\r
621 if (p_ptr->inside_arena)
\r
623 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
\r
628 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
\r
630 set_action(ACTION_NONE);
\r
633 /* Check some conditions */
\r
636 msg_print(_("目が見えない。", "You can't see anything."));
\r
641 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
\r
644 if (p_ptr->confused)
\r
646 msg_print(_("混乱していて読めない。", "You are too confused!"));
\r
651 /* Restrict choices to scrolls */
\r
652 item_tester_hook = item_tester_hook_readable;
\r
654 q = _("どの巻物を読みますか? ", "Read which scroll? ");
\r
655 s = _("読める巻物がない。", "You have no scrolls to read.");
\r
657 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
\r
658 if (!o_ptr) return;
\r
660 /* Read the scroll */
\r
661 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
\r