3 * @brief プレイヤーの読むコマンド実装
\r
10 #include "object-hook.h"
\r
13 * @brief 巻物を読むコマンドのサブルーチン
\r
14 * Read a scroll (from the pack or floor).
\r
15 * @param item 読むオブジェクトの所持品ID
\r
16 * @param known 判明済ならばTRUE
\r
20 * Certain scrolls can be "aborted" without losing the scroll. These
\r
21 * include scrolls with no effects but recharge or identify, which are
\r
22 * cancelled before use. XXX Reading them still takes a turn, though.
\r
25 void do_cmd_read_scroll_aux(int item, bool known)
\r
27 int k, used_up, ident, lev;
\r
31 /* Get the item (in the pack) */
\r
34 o_ptr = &inventory[item];
\r
37 /* Get the item (on the floor) */
\r
40 o_ptr = &o_list[0 - item];
\r
45 p_ptr->energy_use = 100;
\r
49 if (flush_failure) flush();
\r
50 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen."));
\r
55 if (p_ptr->pclass == CLASS_BERSERKER)
\r
57 msg_print(_("巻物なんて読めない。", "You cannot read."));
\r
61 if (music_singing_any()) stop_singing();
\r
64 if (hex_spelling_any() && ((p_ptr->lev < 35) || hex_spell_fully())) stop_hex_spell_all();
\r
66 /* Not identified yet */
\r
70 lev = k_info[o_ptr->k_idx].level;
\r
72 /* Assume the scroll will get used up */
\r
75 if (o_ptr->tval == TV_SCROLL)
\r
77 /* Analyze the scroll */
\r
78 switch (o_ptr->sval)
\r
80 case SV_SCROLL_DARKNESS:
\r
82 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
\r
84 (void)set_blind(p_ptr->blind + 3 + randint1(5));
\r
86 if (unlite_area(10, 3)) ident = TRUE;
\r
90 case SV_SCROLL_AGGRAVATE_MONSTER:
\r
92 msg_print(_("カン高くうなる様な音が辺りを覆った。", "There is a high pitched humming noise."));
\r
93 aggravate_monsters(0);
\r
98 case SV_SCROLL_CURSE_ARMOR:
\r
100 if (curse_armor()) ident = TRUE;
\r
104 case SV_SCROLL_CURSE_WEAPON:
\r
107 if (buki_motteruka(INVEN_RARM))
\r
110 if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
\r
112 else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM;
\r
113 if (k && curse_weapon(FALSE, k)) ident = TRUE;
\r
117 case SV_SCROLL_SUMMON_MONSTER:
\r
119 for (k = 0; k < randint1(3); k++)
\r
121 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
\r
129 case SV_SCROLL_SUMMON_UNDEAD:
\r
131 for (k = 0; k < randint1(3); k++)
\r
133 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
\r
141 case SV_SCROLL_SUMMON_PET:
\r
143 if (summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET)))
\r
150 case SV_SCROLL_SUMMON_KIN:
\r
152 if (summon_kin_player(p_ptr->lev, p_ptr->y, p_ptr->x, (PM_FORCE_PET | PM_ALLOW_GROUP)))
\r
159 case SV_SCROLL_TRAP_CREATION:
\r
161 if (trap_creation(p_ptr->y, p_ptr->x)) ident = TRUE;
\r
165 case SV_SCROLL_PHASE_DOOR:
\r
167 teleport_player(10, 0L);
\r
172 case SV_SCROLL_TELEPORT:
\r
174 teleport_player(100, 0L);
\r
179 case SV_SCROLL_TELEPORT_LEVEL:
\r
181 (void)teleport_level(0);
\r
186 case SV_SCROLL_WORD_OF_RECALL:
\r
188 if (!word_of_recall()) used_up = FALSE;
\r
193 case SV_SCROLL_IDENTIFY:
\r
195 if (!ident_spell(FALSE)) used_up = FALSE;
\r
200 case SV_SCROLL_STAR_IDENTIFY:
\r
202 if (!identify_fully(FALSE)) used_up = FALSE;
\r
207 case SV_SCROLL_REMOVE_CURSE:
\r
209 if (remove_curse())
\r
211 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
\r
217 case SV_SCROLL_STAR_REMOVE_CURSE:
\r
219 if (remove_all_curse())
\r
221 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
\r
227 case SV_SCROLL_ENCHANT_ARMOR:
\r
230 if (!enchant_spell(0, 0, 1)) used_up = FALSE;
\r
234 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
\r
236 if (!enchant_spell(1, 0, 0)) used_up = FALSE;
\r
241 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
\r
243 if (!enchant_spell(0, 1, 0)) used_up = FALSE;
\r
248 case SV_SCROLL_STAR_ENCHANT_ARMOR:
\r
250 if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
\r
255 case SV_SCROLL_STAR_ENCHANT_WEAPON:
\r
257 if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
\r
262 case SV_SCROLL_RECHARGING:
\r
264 if (!recharge(130)) used_up = FALSE;
\r
269 case SV_SCROLL_MUNDANITY:
\r
272 if (!mundane_spell(FALSE)) used_up = FALSE;
\r
276 case SV_SCROLL_LIGHT:
\r
278 if (lite_area(damroll(2, 8), 2)) ident = TRUE;
\r
282 case SV_SCROLL_MAPPING:
\r
284 map_area(DETECT_RAD_MAP);
\r
289 case SV_SCROLL_DETECT_GOLD:
\r
291 if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
292 if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
296 case SV_SCROLL_DETECT_ITEM:
\r
298 if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
302 case SV_SCROLL_DETECT_TRAP:
\r
304 if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
\r
308 case SV_SCROLL_DETECT_DOOR:
\r
310 if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
311 if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
315 case SV_SCROLL_DETECT_INVIS:
\r
317 if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
\r
321 case SV_SCROLL_SATISFY_HUNGER:
\r
323 if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
\r
327 case SV_SCROLL_BLESSING:
\r
329 if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
\r
333 case SV_SCROLL_HOLY_CHANT:
\r
335 if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
\r
339 case SV_SCROLL_HOLY_PRAYER:
\r
341 if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
\r
345 case SV_SCROLL_MONSTER_CONFUSION:
\r
347 if (!(p_ptr->special_attack & ATTACK_CONFUSE))
\r
349 msg_print(_("手が輝き始めた。", "Your hands begin to glow."));
\r
350 p_ptr->special_attack |= ATTACK_CONFUSE;
\r
351 p_ptr->redraw |= (PR_STATUS);
\r
357 case SV_SCROLL_PROTECTION_FROM_EVIL:
\r
359 k = 3 * p_ptr->lev;
\r
360 if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
\r
364 case SV_SCROLL_RUNE_OF_PROTECTION:
\r
371 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
\r
373 if (destroy_doors_touch()) ident = TRUE;
\r
377 case SV_SCROLL_STAR_DESTRUCTION:
\r
379 if (destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE))
\r
382 msg_print(_("ダンジョンが揺れた...", "The dungeon trembles..."));
\r
387 case SV_SCROLL_DISPEL_UNDEAD:
\r
389 if (dispel_undead(80)) ident = TRUE;
\r
393 case SV_SCROLL_SPELL:
\r
395 if ((p_ptr->pclass == CLASS_WARRIOR) ||
\r
396 (p_ptr->pclass == CLASS_IMITATOR) ||
\r
397 (p_ptr->pclass == CLASS_MINDCRAFTER) ||
\r
398 (p_ptr->pclass == CLASS_SORCERER) ||
\r
399 (p_ptr->pclass == CLASS_ARCHER) ||
\r
400 (p_ptr->pclass == CLASS_MAGIC_EATER) ||
\r
401 (p_ptr->pclass == CLASS_RED_MAGE) ||
\r
402 (p_ptr->pclass == CLASS_SAMURAI) ||
\r
403 (p_ptr->pclass == CLASS_BLUE_MAGE) ||
\r
404 (p_ptr->pclass == CLASS_CAVALRY) ||
\r
405 (p_ptr->pclass == CLASS_BERSERKER) ||
\r
406 (p_ptr->pclass == CLASS_SMITH) ||
\r
407 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
\r
408 (p_ptr->pclass == CLASS_NINJA) ||
\r
409 (p_ptr->pclass == CLASS_SNIPER)) break;
\r
410 p_ptr->add_spells++;
\r
411 p_ptr->update |= (PU_SPELLS);
\r
416 case SV_SCROLL_GENOCIDE:
\r
418 (void)symbol_genocide(300, TRUE);
\r
423 case SV_SCROLL_MASS_GENOCIDE:
\r
425 (void)mass_genocide(300, TRUE);
\r
430 case SV_SCROLL_ACQUIREMENT:
\r
432 acquirement(p_ptr->y, p_ptr->x, 1, TRUE, FALSE, FALSE);
\r
437 case SV_SCROLL_STAR_ACQUIREMENT:
\r
439 acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE);
\r
444 /* New Hengband scrolls */
\r
445 case SV_SCROLL_FIRE:
\r
447 fire_ball(GF_FIRE, 0, 666, 4);
\r
448 /* Note: "Double" damage since it is centered on the player ... */
\r
449 if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
\r
450 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1);
\r
457 case SV_SCROLL_ICE:
\r
459 fire_ball(GF_ICE, 0, 777, 4);
\r
460 if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
\r
461 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
\r
467 case SV_SCROLL_CHAOS:
\r
469 fire_ball(GF_CHAOS, 0, 1000, 4);
\r
470 if (!p_ptr->resist_chaos)
\r
471 take_hit(DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1);
\r
477 case SV_SCROLL_RUMOR:
\r
479 msg_print(_("巻物にはメッセージが書かれている:", "There is message on the scroll. It says:"));
\r
481 display_rumor(TRUE);
\r
483 msg_print(_("巻物は煙を立てて消え去った!", "The scroll disappears in a puff of smoke!"));
\r
489 case SV_SCROLL_ARTIFACT:
\r
492 if (!artifact_scroll()) used_up = FALSE;
\r
496 case SV_SCROLL_RESET_RECALL:
\r
499 if (!reset_recall()) used_up = FALSE;
\r
503 case SV_SCROLL_AMUSEMENT:
\r
506 amusement(p_ptr->y, p_ptr->x, 1, FALSE);
\r
510 case SV_SCROLL_STAR_AMUSEMENT:
\r
513 amusement(p_ptr->y, p_ptr->x, randint1(2) + 1, FALSE);
\r
518 else if (o_ptr->name1 == ART_GHB)
\r
520 msg_print(_("私は苦労して『グレーター・ヘル=ビースト』を倒した。", "I had a very hard time to kill the Greater hell-beast, "));
\r
521 msg_print(_("しかし手に入ったのはこのきたないTシャツだけだった。", "but all I got was this lousy t-shirt!"));
\r
524 else if (o_ptr->name1 == ART_POWER)
\r
526 msg_print(_("「一つの指輪は全てを統べ、", "'One Ring to rule them all, "));
\r
528 msg_print(_("一つの指輪は全てを見つけ、", "One Ring to find them, "));
\r
530 msg_print(_("一つの指輪は全てを捕らえて", "One Ring to bring them all "));
\r
532 msg_print(_("暗闇の中に繋ぎとめる。」", "and in the darkness bind them.'"));
\r
535 else if (o_ptr->tval==TV_PARCHMENT)
\r
538 char 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
562 /* Combine / Reorder the pack (later) */
\r
563 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
\r
565 if (!(object_is_aware(o_ptr)))
\r
567 chg_virtue(V_PATIENCE, -1);
\r
568 chg_virtue(V_CHANCE, 1);
\r
569 chg_virtue(V_KNOWLEDGE, -1);
\r
572 /* The item was tried */
\r
573 object_tried(o_ptr);
\r
575 /* An identification was made */
\r
576 if (ident && !object_is_aware(o_ptr))
\r
578 object_aware(o_ptr);
\r
579 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
\r
583 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
\r
586 /* Hack -- allow certain scrolls to be "preserved" */
\r
592 sound(SOUND_SCROLL);
\r
594 /* Destroy a scroll in the pack */
\r
597 inven_item_increase(item, -1);
\r
598 inven_item_describe(item);
\r
599 inven_item_optimize(item);
\r
602 /* Destroy a scroll on the floor */
\r
605 floor_item_increase(0 - item, -1);
\r
606 floor_item_describe(0 - item);
\r
607 floor_item_optimize(0 - item);
\r
612 * @brief 読むコマンドのメインルーチン /
\r
613 * Eat some food (from the pack or floor)
\r
616 void do_cmd_read_scroll(void)
\r
618 object_type *o_ptr;
\r
622 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
\r
624 set_action(ACTION_NONE);
\r
627 /* Check some conditions */
\r
630 msg_print(_("目が見えない。", "You can't see anything."));
\r
635 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
\r
638 if (p_ptr->confused)
\r
640 msg_print(_("混乱していて読めない。", "You are too confused!"));
\r
645 /* Restrict choices to scrolls */
\r
646 item_tester_hook = item_tester_hook_readable;
\r
649 q = _("どの巻物を読みますか? ", "Read which scroll? ");
\r
650 s = _("読める巻物がない。", "You have no scrolls to read.");
\r
652 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
\r
654 /* Get the item (in the pack) */
\r
657 o_ptr = &inventory[item];
\r
660 /* Get the item (on the floor) */
\r
663 o_ptr = &o_list[0 - item];
\r
666 /* Read the scroll */
\r
667 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
\r