3 * @brief プレイヤーの読むコマンド実装
\r
10 #include "object-hook.h"
\r
11 #include "spells-summon.h"
\r
12 #include "artifact.h"
\r
14 #include "player-status.h"
\r
15 #include "spells-status.h"
\r
18 * @brief 巻物を読むコマンドのサブルーチン
\r
19 * Read a scroll (from the pack or floor).
\r
20 * @param item 読むオブジェクトの所持品ID
\r
21 * @param known 判明済ならばTRUE
\r
25 * Certain scrolls can be "aborted" without losing the scroll. These
\r
26 * include scrolls with no effects but recharge or identify, which are
\r
27 * cancelled before use. XXX Reading them still takes a turn, though.
\r
30 void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known)
\r
32 int k, used_up, ident, lev;
\r
36 /* Get the item (in the pack) */
\r
39 o_ptr = &inventory[item];
\r
42 /* Get the item (on the floor) */
\r
45 o_ptr = &o_list[0 - item];
\r
49 p_ptr->energy_use = 100;
\r
53 if (flush_failure) flush();
\r
54 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen."));
\r
59 if (p_ptr->pclass == CLASS_BERSERKER)
\r
61 msg_print(_("巻物なんて読めない。", "You cannot read."));
\r
65 if (music_singing_any()) stop_singing();
\r
68 if (hex_spelling_any() && ((p_ptr->lev < 35) || hex_spell_fully())) stop_hex_spell_all();
\r
70 /* Not identified yet */
\r
74 lev = k_info[o_ptr->k_idx].level;
\r
76 /* Assume the scroll will get used up */
\r
79 if (o_ptr->tval == TV_SCROLL)
\r
81 /* Analyze the scroll */
\r
82 switch (o_ptr->sval)
\r
84 case SV_SCROLL_DARKNESS:
\r
86 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
\r
88 (void)set_blind(p_ptr->blind + 3 + randint1(5));
\r
90 if (unlite_area(10, 3)) ident = TRUE;
\r
94 case SV_SCROLL_AGGRAVATE_MONSTER:
\r
96 msg_print(_("カン高くうなる様な音が辺りを覆った。", "There is a high pitched humming noise."));
\r
97 aggravate_monsters(0);
\r
102 case SV_SCROLL_CURSE_ARMOR:
\r
104 if (curse_armor()) ident = TRUE;
\r
108 case SV_SCROLL_CURSE_WEAPON:
\r
111 if (has_melee_weapon(INVEN_RARM))
\r
114 if (has_melee_weapon(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
\r
116 else if (has_melee_weapon(INVEN_LARM)) k = INVEN_LARM;
\r
117 if (k && curse_weapon(FALSE, k)) ident = TRUE;
\r
121 case SV_SCROLL_SUMMON_MONSTER:
\r
123 for (k = 0; k < randint1(3); k++)
\r
125 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
\r
133 case SV_SCROLL_SUMMON_UNDEAD:
\r
135 for (k = 0; k < randint1(3); k++)
\r
137 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
145 case SV_SCROLL_SUMMON_PET:
\r
147 if (summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0'))
\r
154 case SV_SCROLL_SUMMON_KIN:
\r
156 if (summon_kin_player(p_ptr->lev, p_ptr->y, p_ptr->x, (PM_FORCE_PET | PM_ALLOW_GROUP)))
\r
163 case SV_SCROLL_TRAP_CREATION:
\r
165 if (trap_creation(p_ptr->y, p_ptr->x)) ident = TRUE;
\r
169 case SV_SCROLL_PHASE_DOOR:
\r
171 teleport_player(10, 0L);
\r
176 case SV_SCROLL_TELEPORT:
\r
178 teleport_player(100, 0L);
\r
183 case SV_SCROLL_TELEPORT_LEVEL:
\r
185 (void)teleport_level(0);
\r
190 case SV_SCROLL_WORD_OF_RECALL:
\r
192 if (!recall_player(p_ptr, randint0(21) + 15)) used_up = FALSE;
\r
197 case SV_SCROLL_IDENTIFY:
\r
199 if (!ident_spell(FALSE)) used_up = FALSE;
\r
204 case SV_SCROLL_STAR_IDENTIFY:
\r
206 if (!identify_fully(FALSE)) used_up = FALSE;
\r
211 case SV_SCROLL_REMOVE_CURSE:
\r
213 if (remove_curse())
\r
220 case SV_SCROLL_STAR_REMOVE_CURSE:
\r
222 if (remove_all_curse())
\r
229 case SV_SCROLL_ENCHANT_ARMOR:
\r
232 if (!enchant_spell(0, 0, 1)) used_up = FALSE;
\r
236 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
\r
238 if (!enchant_spell(1, 0, 0)) used_up = FALSE;
\r
243 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
\r
245 if (!enchant_spell(0, 1, 0)) used_up = FALSE;
\r
250 case SV_SCROLL_STAR_ENCHANT_ARMOR:
\r
252 if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
\r
257 case SV_SCROLL_STAR_ENCHANT_WEAPON:
\r
259 if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
\r
264 case SV_SCROLL_RECHARGING:
\r
266 if (!recharge(130)) used_up = FALSE;
\r
271 case SV_SCROLL_MUNDANITY:
\r
274 if (!mundane_spell(FALSE)) used_up = FALSE;
\r
278 case SV_SCROLL_LIGHT:
\r
280 if (lite_area(damroll(2, 8), 2)) ident = TRUE;
\r
284 case SV_SCROLL_MAPPING:
\r
286 map_area(DETECT_RAD_MAP);
\r
291 case SV_SCROLL_DETECT_GOLD:
\r
293 if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
294 if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
298 case SV_SCROLL_DETECT_ITEM:
\r
300 if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
304 case SV_SCROLL_DETECT_TRAP:
\r
306 if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
\r
310 case SV_SCROLL_DETECT_DOOR:
\r
312 if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
313 if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
317 case SV_SCROLL_DETECT_INVIS:
\r
319 if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
323 case SV_SCROLL_SATISFY_HUNGER:
\r
325 if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
\r
329 case SV_SCROLL_BLESSING:
\r
331 if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
\r
335 case SV_SCROLL_HOLY_CHANT:
\r
337 if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
\r
341 case SV_SCROLL_HOLY_PRAYER:
\r
343 if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
\r
347 case SV_SCROLL_MONSTER_CONFUSION:
\r
349 if (!(p_ptr->special_attack & ATTACK_CONFUSE))
\r
351 msg_print(_("手が輝き始めた。", "Your hands begin to glow."));
\r
352 p_ptr->special_attack |= ATTACK_CONFUSE;
\r
353 p_ptr->redraw |= (PR_STATUS);
\r
359 case SV_SCROLL_PROTECTION_FROM_EVIL:
\r
361 k = 3 * p_ptr->lev;
\r
362 if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
\r
366 case SV_SCROLL_RUNE_OF_PROTECTION:
\r
373 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
\r
375 if (destroy_doors_touch()) ident = TRUE;
\r
379 case SV_SCROLL_STAR_DESTRUCTION:
\r
381 if (destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE))
\r
384 msg_print(_("ダンジョンが揺れた...", "The dungeon trembles..."));
\r
389 case SV_SCROLL_DISPEL_UNDEAD:
\r
391 if (dispel_undead(80)) ident = TRUE;
\r
395 case SV_SCROLL_SPELL:
\r
397 if ((p_ptr->pclass == CLASS_WARRIOR) ||
\r
398 (p_ptr->pclass == CLASS_IMITATOR) ||
\r
399 (p_ptr->pclass == CLASS_MINDCRAFTER) ||
\r
400 (p_ptr->pclass == CLASS_SORCERER) ||
\r
401 (p_ptr->pclass == CLASS_ARCHER) ||
\r
402 (p_ptr->pclass == CLASS_MAGIC_EATER) ||
\r
403 (p_ptr->pclass == CLASS_RED_MAGE) ||
\r
404 (p_ptr->pclass == CLASS_SAMURAI) ||
\r
405 (p_ptr->pclass == CLASS_BLUE_MAGE) ||
\r
406 (p_ptr->pclass == CLASS_CAVALRY) ||
\r
407 (p_ptr->pclass == CLASS_BERSERKER) ||
\r
408 (p_ptr->pclass == CLASS_SMITH) ||
\r
409 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
\r
410 (p_ptr->pclass == CLASS_NINJA) ||
\r
411 (p_ptr->pclass == CLASS_SNIPER)) break;
\r
412 p_ptr->add_spells++;
\r
413 p_ptr->update |= (PU_SPELLS);
\r
418 case SV_SCROLL_GENOCIDE:
\r
420 (void)symbol_genocide(300, TRUE);
\r
425 case SV_SCROLL_MASS_GENOCIDE:
\r
427 (void)mass_genocide(300, TRUE);
\r
432 case SV_SCROLL_ACQUIREMENT:
\r
434 acquirement(p_ptr->y, p_ptr->x, 1, TRUE, FALSE, FALSE);
\r
439 case SV_SCROLL_STAR_ACQUIREMENT:
\r
441 acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE);
\r
446 /* New Hengband scrolls */
\r
447 case SV_SCROLL_FIRE:
\r
449 fire_ball(GF_FIRE, 0, 666, 4);
\r
450 /* Note: "Double" damage since it is centered on the player ... */
\r
451 if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
\r
452 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1);
\r
459 case SV_SCROLL_ICE:
\r
461 fire_ball(GF_ICE, 0, 777, 4);
\r
462 if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
\r
463 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
\r
469 case SV_SCROLL_CHAOS:
\r
471 fire_ball(GF_CHAOS, 0, 1000, 4);
\r
472 if (!p_ptr->resist_chaos)
\r
473 take_hit(DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1);
\r
479 case SV_SCROLL_RUMOR:
\r
481 msg_print(_("巻物にはメッセージが書かれている:", "There is message on the scroll. It says:"));
\r
483 display_rumor(TRUE);
\r
485 msg_print(_("巻物は煙を立てて消え去った!", "The scroll disappears in a puff of smoke!"));
\r
491 case SV_SCROLL_ARTIFACT:
\r
494 if (!artifact_scroll()) used_up = FALSE;
\r
498 case SV_SCROLL_RESET_RECALL:
\r
501 if (!reset_recall()) used_up = FALSE;
\r
505 case SV_SCROLL_AMUSEMENT:
\r
508 amusement(p_ptr->y, p_ptr->x, 1, FALSE);
\r
512 case SV_SCROLL_STAR_AMUSEMENT:
\r
515 amusement(p_ptr->y, p_ptr->x, randint1(2) + 1, FALSE);
\r
520 else if (o_ptr->name1 == ART_GHB)
\r
522 msg_print(_("私は苦労して『グレーター・ヘル=ビースト』を倒した。", "I had a very hard time to kill the Greater hell-beast, "));
\r
523 msg_print(_("しかし手に入ったのはこのきたないTシャツだけだった。", "but all I got was this lousy t-shirt!"));
\r
526 else if (o_ptr->name1 == ART_POWER)
\r
528 msg_print(_("「一つの指輪は全てを統べ、", "'One Ring to rule them all, "));
\r
530 msg_print(_("一つの指輪は全てを見つけ、", "One Ring to find them, "));
\r
532 msg_print(_("一つの指輪は全てを捕らえて", "One Ring to bring them all "));
\r
534 msg_print(_("暗闇の中に繋ぎとめる。」", "and in the darkness bind them.'"));
\r
537 else if (o_ptr->tval==TV_PARCHMENT)
\r
540 GAME_TEXT o_name[MAX_NLEN];
\r
544 q=format("book-%d_jp.txt",o_ptr->sval);
\r
546 /* Display object description */
\r
547 object_desc(o_name, o_ptr, OD_NAME_ONLY);
\r
549 /* Build the filename */
\r
550 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q);
\r
552 /* Peruse the help file */
\r
553 (void)show_file(TRUE, buf, o_name, 0, 0);
\r
559 p_ptr->update |= (PU_COMBINE | PU_REORDER);
\r
561 if (!(object_is_aware(o_ptr)))
\r
563 chg_virtue(V_PATIENCE, -1);
\r
564 chg_virtue(V_CHANCE, 1);
\r
565 chg_virtue(V_KNOWLEDGE, -1);
\r
568 /* The item was tried */
\r
569 object_tried(o_ptr);
\r
571 /* An identification was made */
\r
572 if (ident && !object_is_aware(o_ptr))
\r
574 object_aware(o_ptr);
\r
575 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
\r
578 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
\r
581 /* Hack -- allow certain scrolls to be "preserved" */
\r
587 sound(SOUND_SCROLL);
\r
589 /* Destroy a scroll in the pack */
\r
592 inven_item_increase(item, -1);
\r
593 inven_item_describe(item);
\r
594 inven_item_optimize(item);
\r
597 /* Destroy a scroll on the floor */
\r
600 floor_item_increase(0 - item, -1);
\r
601 floor_item_describe(0 - item);
\r
602 floor_item_optimize(0 - item);
\r
607 * @brief 読むコマンドのメインルーチン /
\r
608 * Eat some food (from the pack or floor)
\r
611 void do_cmd_read_scroll(void)
\r
613 object_type *o_ptr;
\r
617 if (p_ptr->wild_mode)
\r
622 if (p_ptr->inside_arena)
\r
624 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
\r
629 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
\r
631 set_action(ACTION_NONE);
\r
634 /* Check some conditions */
\r
637 msg_print(_("目が見えない。", "You can't see anything."));
\r
642 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
\r
645 if (p_ptr->confused)
\r
647 msg_print(_("混乱していて読めない。", "You are too confused!"));
\r
652 /* Restrict choices to scrolls */
\r
653 item_tester_hook = item_tester_hook_readable;
\r
655 q = _("どの巻物を読みますか? ", "Read which scroll? ");
\r
656 s = _("読める巻物がない。", "You have no scrolls to read.");
\r
658 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
\r
659 if (!o_ptr) return;
\r
661 /* Read the scroll */
\r
662 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
\r