3 * @brief プレイヤーのアイテムに関するコマンドの実装2 / Spell/Prayer commands
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
11 * 2014 Deskull rearranged comment for Doxygen.\n
15 * This file includes code for eating food, drinking potions,
16 * reading scrolls, aiming wands, using staffs, zapping rods,
17 * and activating artifacts.
19 * In all cases, if the player becomes "aware" of the item's use
20 * by testing it, mark it as "aware" and reward some experience
21 * based on the object's level, always rounding up. If the player
22 * remains "unaware", mark that object "kind" as "tried".
24 * This code now correctly handles the unstacking of wands, staffs,
25 * and rods. Note the overly paranoid warning about potential pack
26 * overflow, which allows the player to use and drop a stacked item.
28 * In all "unstacking" scenarios, the "used" object is "carried" as if
29 * the player had just picked it up. In particular, this means that if
30 * the use of an item induces pack overflow, that item will be dropped.
32 * For simplicity, these routines induce a full "pack reorganization"
33 * which not only combines similar items, but also reorganizes various
34 * items to obey the current "sorting" method. This may require about
35 * 400 item comparisons, but only occasionally.
37 * There may be a BIG problem with any "effect" that can cause "changes"
38 * to the inventory. For example, a "scroll of recharging" can cause
39 * a wand/staff to "disappear", moving the inventory up. Luckily, the
40 * scrolls all appear BEFORE the staffs/wands, so this is not a problem.
41 * But, for example, a "staff of recharging" could cause MAJOR problems.
42 * In such a case, it will be best to either (1) "postpone" the effect
43 * until the end of the function, or (2) "change" the effect, say, into
44 * giving a staff "negative" charges, or "turning a staff into a stick".
45 * It seems as though a "rod of recharging" might in fact cause problems.
46 * The basic problem is that the act of recharging (and destroying) an
47 * item causes the inducer of that action to "move", causing "o_ptr" to
48 * no longer point at the correct item, with horrifying results.
50 * Note that food/potions/scrolls no longer use bit-flags for effects,
51 * but instead use the "sval" (which is also used to sort the objects).
62 * @brief 薬を飲むコマンドのサブルーチン /
63 * Quaff a potion (from the pack or the floor)
64 * @param item 飲む薬オブジェクトの所持品ID
67 static void do_cmd_quaff_potion_aux(int item)
76 p_ptr->energy_use = 100;
80 if (flush_failure) flush();
81 msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from a bottle."));
87 if (music_singing_any()) stop_singing();
88 if (hex_spelling_any())
90 if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all();
93 /* Get the item (in the pack) */
96 o_ptr = &inventory[item];
99 /* Get the item (on the floor) */
102 o_ptr = &o_list[0 - item];
105 /* Get local object */
108 /* Obtain a local object */
109 object_copy(q_ptr, o_ptr);
114 /* Reduce and describe inventory */
117 inven_item_increase(item, -1);
118 inven_item_describe(item);
119 inven_item_optimize(item);
122 /* Reduce and describe floor item */
125 floor_item_increase(0 - item, -1);
126 floor_item_describe(0 - item);
127 floor_item_optimize(0 - item);
134 /* Not identified yet */
138 lev = k_info[q_ptr->k_idx].level;
140 /* Analyze the potion */
141 if (q_ptr->tval == TV_POTION)
145 /* 飲みごたえをオリジナルより細かく表現 */
146 case SV_POTION_WATER:
147 msg_print(_("口の中がさっぱりした。", ""));
148 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
152 case SV_POTION_APPLE_JUICE:
153 msg_print(_("甘くてサッパリとしていて、とてもおいしい。", ""));
154 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
158 case SV_POTION_SLIME_MOLD:
159 msg_print(_("なんとも不気味な味だ。", ""));
160 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
164 case SV_POTION_SLOWNESS:
165 if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE;
168 case SV_POTION_SALT_WATER:
169 msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
171 if (!(prace_is_(RACE_GOLEM) ||
172 prace_is_(RACE_ZOMBIE) ||
173 prace_is_(RACE_DEMON) ||
174 prace_is_(RACE_ANDROID) ||
175 prace_is_(RACE_SPECTRE) ||
176 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
178 /* Only living creatures get thirsty */
179 (void)set_food(PY_FOOD_STARVE - 1);
182 (void)set_poisoned(0);
183 (void)set_paralyzed(p_ptr->paralyzed + 4);
187 case SV_POTION_POISON:
188 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
190 if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))
197 case SV_POTION_BLINDNESS:
198 if (!p_ptr->resist_blind)
200 if (set_blind(p_ptr->blind + randint0(100) + 100))
207 case SV_POTION_CONFUSION: /* Booze */
208 if (p_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1);
209 else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN;
210 if (!p_ptr->resist_conf)
212 if (set_confused(randint0(20) + 15))
218 if (!p_ptr->resist_chaos)
222 if (set_image(p_ptr->image + randint0(150) + 150))
227 if (one_in_(13) && (p_ptr->pclass != CLASS_MONK))
230 if (one_in_(3)) lose_all_info();
232 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
234 msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head..."));
235 msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing, or how you got here!"));
240 case SV_POTION_SLEEP:
241 if (!p_ptr->free_act)
243 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
245 if (ironman_nightmare)
247 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
249 /* Have some nightmares */
250 sanity_blast(NULL, FALSE);
252 if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))
259 case SV_POTION_LOSE_MEMORIES:
260 if (!p_ptr->hold_exp && (p_ptr->exp > 0))
262 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
263 chg_virtue(V_KNOWLEDGE, -5);
265 lose_exp(p_ptr->exp / 4);
270 case SV_POTION_RUINATION:
271 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
272 take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
274 (void)dec_stat(A_DEX, 25, TRUE);
275 (void)dec_stat(A_WIS, 25, TRUE);
276 (void)dec_stat(A_CON, 25, TRUE);
277 (void)dec_stat(A_STR, 25, TRUE);
278 (void)dec_stat(A_CHR, 25, TRUE);
279 (void)dec_stat(A_INT, 25, TRUE);
283 case SV_POTION_DEC_STR:
284 if (do_dec_stat(A_STR)) ident = TRUE;
287 case SV_POTION_DEC_INT:
288 if (do_dec_stat(A_INT)) ident = TRUE;
291 case SV_POTION_DEC_WIS:
292 if (do_dec_stat(A_WIS)) ident = TRUE;
295 case SV_POTION_DEC_DEX:
296 if (do_dec_stat(A_DEX)) ident = TRUE;
299 case SV_POTION_DEC_CON:
300 if (do_dec_stat(A_CON)) ident = TRUE;
303 case SV_POTION_DEC_CHR:
304 if (do_dec_stat(A_CHR)) ident = TRUE;
307 case SV_POTION_DETONATIONS:
308 msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
309 take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);
311 (void)set_stun(p_ptr->stun + 75);
312 (void)set_cut(p_ptr->cut + 5000);
316 case SV_POTION_DEATH:
317 chg_virtue(V_VITALITY, -1);
318 chg_virtue(V_UNLIFE, 5);
319 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
320 take_hit(DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1);
324 case SV_POTION_INFRAVISION:
325 if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))
331 case SV_POTION_DETECT_INVIS:
332 if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))
338 case SV_POTION_SLOW_POISON:
339 if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE;
342 case SV_POTION_CURE_POISON:
343 if (set_poisoned(0)) ident = TRUE;
346 case SV_POTION_BOLDNESS:
347 if (set_afraid(0)) ident = TRUE;
350 case SV_POTION_SPEED:
353 if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;
357 (void)set_fast(p_ptr->fast + 5, FALSE);
361 case SV_POTION_RESIST_HEAT:
362 if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))
368 case SV_POTION_RESIST_COLD:
369 if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))
375 case SV_POTION_HEROISM:
376 if (set_afraid(0)) ident = TRUE;
377 if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE;
378 if (hp_player(10)) ident = TRUE;
381 case SV_POTION_BESERK_STRENGTH:
382 if (set_afraid(0)) ident = TRUE;
383 if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE;
384 if (hp_player(30)) ident = TRUE;
387 case SV_POTION_CURE_LIGHT:
388 if (hp_player(damroll(2, 8))) ident = TRUE;
389 if (set_blind(0)) ident = TRUE;
390 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
391 if (set_shero(0,TRUE)) ident = TRUE;
394 case SV_POTION_CURE_SERIOUS:
395 if (hp_player(damroll(4, 8))) ident = TRUE;
396 if (set_blind(0)) ident = TRUE;
397 if (set_confused(0)) ident = TRUE;
398 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
399 if (set_shero(0,TRUE)) ident = TRUE;
402 case SV_POTION_CURE_CRITICAL:
403 if (hp_player(damroll(6, 8))) ident = TRUE;
404 if (set_blind(0)) ident = TRUE;
405 if (set_confused(0)) ident = TRUE;
406 if (set_poisoned(0)) ident = TRUE;
407 if (set_stun(0)) ident = TRUE;
408 if (set_cut(0)) ident = TRUE;
409 if (set_shero(0,TRUE)) ident = TRUE;
412 case SV_POTION_HEALING:
413 if (hp_player(300)) ident = TRUE;
414 if (set_blind(0)) ident = TRUE;
415 if (set_confused(0)) ident = TRUE;
416 if (set_poisoned(0)) ident = TRUE;
417 if (set_stun(0)) ident = TRUE;
418 if (set_cut(0)) ident = TRUE;
419 if (set_shero(0,TRUE)) ident = TRUE;
422 case SV_POTION_STAR_HEALING:
423 if (hp_player(1200)) ident = TRUE;
424 if (set_blind(0)) ident = TRUE;
425 if (set_confused(0)) ident = TRUE;
426 if (set_poisoned(0)) ident = TRUE;
427 if (set_stun(0)) ident = TRUE;
428 if (set_cut(0)) ident = TRUE;
429 if (set_shero(0,TRUE)) ident = TRUE;
433 chg_virtue(V_VITALITY, 1);
434 chg_virtue(V_UNLIFE, -5);
435 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
437 (void)set_poisoned(0);
439 (void)set_confused(0);
443 (void)do_res_stat(A_STR);
444 (void)do_res_stat(A_CON);
445 (void)do_res_stat(A_DEX);
446 (void)do_res_stat(A_WIS);
447 (void)do_res_stat(A_INT);
448 (void)do_res_stat(A_CHR);
449 (void)set_shero(0,TRUE);
455 case SV_POTION_RESTORE_MANA:
456 if (p_ptr->pclass == CLASS_MAGIC_EATER)
459 for (i = 0; i < EATER_EXT*2; i++)
461 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3;
462 if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i]*EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
464 for (; i < EATER_EXT*3; i++)
466 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);
467 p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE*3 : p_ptr->magic_num2[i]*EATER_ROD_CHARGE/3)*k_info[k_idx].pval;
468 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
470 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
471 p_ptr->window |= (PW_PLAYER);
474 else if (p_ptr->csp < p_ptr->msp)
476 p_ptr->csp = p_ptr->msp;
478 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
480 p_ptr->redraw |= (PR_MANA);
481 p_ptr->window |= (PW_PLAYER);
482 p_ptr->window |= (PW_SPELL);
485 if (set_shero(0,TRUE)) ident = TRUE;
488 case SV_POTION_RESTORE_EXP:
489 if (restore_level()) ident = TRUE;
492 case SV_POTION_RES_STR:
493 if (do_res_stat(A_STR)) ident = TRUE;
496 case SV_POTION_RES_INT:
497 if (do_res_stat(A_INT)) ident = TRUE;
500 case SV_POTION_RES_WIS:
501 if (do_res_stat(A_WIS)) ident = TRUE;
504 case SV_POTION_RES_DEX:
505 if (do_res_stat(A_DEX)) ident = TRUE;
508 case SV_POTION_RES_CON:
509 if (do_res_stat(A_CON)) ident = TRUE;
512 case SV_POTION_RES_CHR:
513 if (do_res_stat(A_CHR)) ident = TRUE;
516 case SV_POTION_INC_STR:
517 if (do_inc_stat(A_STR)) ident = TRUE;
520 case SV_POTION_INC_INT:
521 if (do_inc_stat(A_INT)) ident = TRUE;
524 case SV_POTION_INC_WIS:
525 if (do_inc_stat(A_WIS)) ident = TRUE;
528 case SV_POTION_INC_DEX:
529 if (do_inc_stat(A_DEX)) ident = TRUE;
532 case SV_POTION_INC_CON:
533 if (do_inc_stat(A_CON)) ident = TRUE;
536 case SV_POTION_INC_CHR:
537 if (do_inc_stat(A_CHR)) ident = TRUE;
540 case SV_POTION_AUGMENTATION:
541 if (do_inc_stat(A_STR)) ident = TRUE;
542 if (do_inc_stat(A_INT)) ident = TRUE;
543 if (do_inc_stat(A_WIS)) ident = TRUE;
544 if (do_inc_stat(A_DEX)) ident = TRUE;
545 if (do_inc_stat(A_CON)) ident = TRUE;
546 if (do_inc_stat(A_CHR)) ident = TRUE;
549 case SV_POTION_ENLIGHTENMENT:
550 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
551 chg_virtue(V_KNOWLEDGE, 1);
552 chg_virtue(V_ENLIGHTEN, 1);
557 case SV_POTION_STAR_ENLIGHTENMENT:
558 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
559 chg_virtue(V_KNOWLEDGE, 1);
560 chg_virtue(V_ENLIGHTEN, 2);
563 (void)do_inc_stat(A_INT);
564 (void)do_inc_stat(A_WIS);
565 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
566 (void)detect_doors(DETECT_RAD_DEFAULT);
567 (void)detect_stairs(DETECT_RAD_DEFAULT);
568 (void)detect_treasure(DETECT_RAD_DEFAULT);
569 (void)detect_objects_gold(DETECT_RAD_DEFAULT);
570 (void)detect_objects_normal(DETECT_RAD_DEFAULT);
576 case SV_POTION_SELF_KNOWLEDGE:
577 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
583 case SV_POTION_EXPERIENCE:
584 if (p_ptr->prace == RACE_ANDROID) break;
585 chg_virtue(V_ENLIGHTEN, 1);
586 if (p_ptr->exp < PY_MAX_EXP)
588 s32b ee = (p_ptr->exp / 2) + 10;
589 if (ee > 100000L) ee = 100000L;
590 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
596 case SV_POTION_RESISTANCE:
597 (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);
598 (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
599 (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
600 (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);
601 (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
605 case SV_POTION_CURING:
606 if (hp_player(50)) ident = TRUE;
607 if (set_blind(0)) ident = TRUE;
608 if (set_poisoned(0)) ident = TRUE;
609 if (set_confused(0)) ident = TRUE;
610 if (set_stun(0)) ident = TRUE;
611 if (set_cut(0)) ident = TRUE;
612 if (set_image(0)) ident = TRUE;
615 case SV_POTION_INVULNERABILITY:
616 (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);
620 case SV_POTION_NEW_LIFE:
621 do_cmd_rerate(FALSE);
623 p_ptr->update |= PU_BONUS;
624 lose_all_mutations();
628 case SV_POTION_NEO_TSUYOSHI:
630 (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
634 case SV_POTION_TSUYOSHI:
635 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
638 (void)set_tsuyoshi(0, TRUE);
639 if (!p_ptr->resist_chaos)
641 (void)set_image(50 + randint1(50));
646 case SV_POTION_POLYMORPH:
647 if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
649 lose_all_mutations();
657 if(gain_random_mutation(0)) ident = TRUE;
659 else if (lose_mutation(0)) ident = TRUE;
660 } while(!ident || one_in_(2));
666 if (prace_is_(RACE_SKELETON))
668 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
669 (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx);
672 /* Combine / Reorder the pack (later) */
673 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
675 if (!(object_is_aware(q_ptr)))
677 chg_virtue(V_PATIENCE, -1);
678 chg_virtue(V_CHANCE, 1);
679 chg_virtue(V_KNOWLEDGE, -1);
682 /* The item has been tried */
685 /* An identification was made */
686 if (ident && !object_is_aware(q_ptr))
689 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
693 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
695 /* Potions can feed the player */
696 switch (p_ptr->mimic_form)
699 switch (p_ptr->prace)
702 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
711 set_food(p_ptr->food + ((q_ptr->pval) / 20));
714 if (q_ptr->tval == TV_FLASK)
716 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
717 set_food(p_ptr->food + 5000);
721 set_food(p_ptr->food + ((q_ptr->pval) / 20));
725 msg_print(_("水分を取り込んだ。", "You are moistened."));
726 set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
729 (void)set_food(p_ptr->food + q_ptr->pval);
734 case MIMIC_DEMON_LORD:
735 set_food(p_ptr->food + ((q_ptr->pval) / 20));
738 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
741 (void)set_food(p_ptr->food + q_ptr->pval);
748 * @brief オブジェクトをプレイヤーが飲むことができるかを判定する /
749 * Hook to determine if an object can be quaffed
750 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
751 * @return 飲むことが可能ならばTRUEを返す
753 static bool item_tester_hook_quaff(object_type *o_ptr)
755 if (o_ptr->tval == TV_POTION) return TRUE;
757 if (prace_is_(RACE_ANDROID))
759 if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL)
767 * @brief 薬を飲むコマンドのメインルーチン /
768 * Quaff some potion (from the pack or floor)
771 void do_cmd_quaff_potion(void)
776 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
778 set_action(ACTION_NONE);
781 /* Restrict choices to potions */
782 item_tester_hook = item_tester_hook_quaff;
785 q = _("どの薬を飲みますか? ", "Quaff which potion? ");
786 s = _("飲める薬がない。", "You have no potions to quaff.");
788 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
790 /* Quaff the potion */
791 do_cmd_quaff_potion_aux(item);
796 * @brief 巻物を読むコマンドのサブルーチン
797 * Read a scroll (from the pack or floor).
798 * @param item 読むオブジェクトの所持品ID
799 * @param known 判明済ならばTRUE
803 * Certain scrolls can be "aborted" without losing the scroll. These
804 * include scrolls with no effects but recharge or identify, which are
805 * cancelled before use. XXX Reading them still takes a turn, though.
808 static void do_cmd_read_scroll_aux(int item, bool known)
810 int k, used_up, ident, lev;
814 /* Get the item (in the pack) */
817 o_ptr = &inventory[item];
820 /* Get the item (on the floor) */
823 o_ptr = &o_list[0 - item];
828 p_ptr->energy_use = 100;
832 if (flush_failure) flush();
833 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen."));
838 if (p_ptr->pclass == CLASS_BERSERKER)
840 msg_print(_("巻物なんて読めない。", "You cannot read."));
844 if (music_singing_any()) stop_singing();
847 if (hex_spelling_any() && ((p_ptr->lev < 35) || hex_spell_fully())) stop_hex_spell_all();
849 /* Not identified yet */
853 lev = k_info[o_ptr->k_idx].level;
855 /* Assume the scroll will get used up */
858 if (o_ptr->tval == TV_SCROLL)
860 /* Analyze the scroll */
863 case SV_SCROLL_DARKNESS:
865 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
867 (void)set_blind(p_ptr->blind + 3 + randint1(5));
869 if (unlite_area(10, 3)) ident = TRUE;
873 case SV_SCROLL_AGGRAVATE_MONSTER:
875 msg_print(_("カン高くうなる様な音が辺りを覆った。", "There is a high pitched humming noise."));
876 aggravate_monsters(0);
881 case SV_SCROLL_CURSE_ARMOR:
883 if (curse_armor()) ident = TRUE;
887 case SV_SCROLL_CURSE_WEAPON:
890 if (buki_motteruka(INVEN_RARM))
893 if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
895 else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM;
896 if (k && curse_weapon(FALSE, k)) ident = TRUE;
900 case SV_SCROLL_SUMMON_MONSTER:
902 for (k = 0; k < randint1(3); k++)
904 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
912 case SV_SCROLL_SUMMON_UNDEAD:
914 for (k = 0; k < randint1(3); k++)
916 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
924 case SV_SCROLL_SUMMON_PET:
926 if (summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET)))
933 case SV_SCROLL_SUMMON_KIN:
935 if (summon_kin_player(p_ptr->lev, p_ptr->y, p_ptr->x, (PM_FORCE_PET | PM_ALLOW_GROUP)))
942 case SV_SCROLL_TRAP_CREATION:
944 if (trap_creation(p_ptr->y, p_ptr->x)) ident = TRUE;
948 case SV_SCROLL_PHASE_DOOR:
950 teleport_player(10, 0L);
955 case SV_SCROLL_TELEPORT:
957 teleport_player(100, 0L);
962 case SV_SCROLL_TELEPORT_LEVEL:
964 (void)teleport_level(0);
969 case SV_SCROLL_WORD_OF_RECALL:
971 if (!word_of_recall()) used_up = FALSE;
976 case SV_SCROLL_IDENTIFY:
978 if (!ident_spell(FALSE)) used_up = FALSE;
983 case SV_SCROLL_STAR_IDENTIFY:
985 if (!identify_fully(FALSE)) used_up = FALSE;
990 case SV_SCROLL_REMOVE_CURSE:
994 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1000 case SV_SCROLL_STAR_REMOVE_CURSE:
1002 if (remove_all_curse())
1004 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1010 case SV_SCROLL_ENCHANT_ARMOR:
1013 if (!enchant_spell(0, 0, 1)) used_up = FALSE;
1017 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
1019 if (!enchant_spell(1, 0, 0)) used_up = FALSE;
1024 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
1026 if (!enchant_spell(0, 1, 0)) used_up = FALSE;
1031 case SV_SCROLL_STAR_ENCHANT_ARMOR:
1033 if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
1038 case SV_SCROLL_STAR_ENCHANT_WEAPON:
1040 if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
1045 case SV_SCROLL_RECHARGING:
1047 if (!recharge(130)) used_up = FALSE;
1052 case SV_SCROLL_MUNDANITY:
1055 if (!mundane_spell(FALSE)) used_up = FALSE;
1059 case SV_SCROLL_LIGHT:
1061 if (lite_area(damroll(2, 8), 2)) ident = TRUE;
1065 case SV_SCROLL_MAPPING:
1067 map_area(DETECT_RAD_MAP);
1072 case SV_SCROLL_DETECT_GOLD:
1074 if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
1075 if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
1079 case SV_SCROLL_DETECT_ITEM:
1081 if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
1085 case SV_SCROLL_DETECT_TRAP:
1087 if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
1091 case SV_SCROLL_DETECT_DOOR:
1093 if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
1094 if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
1098 case SV_SCROLL_DETECT_INVIS:
1100 if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
1104 case SV_SCROLL_SATISFY_HUNGER:
1106 if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
1110 case SV_SCROLL_BLESSING:
1112 if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
1116 case SV_SCROLL_HOLY_CHANT:
1118 if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
1122 case SV_SCROLL_HOLY_PRAYER:
1124 if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
1128 case SV_SCROLL_MONSTER_CONFUSION:
1130 if (!(p_ptr->special_attack & ATTACK_CONFUSE))
1132 msg_print(_("手が輝き始めた。", "Your hands begin to glow."));
1133 p_ptr->special_attack |= ATTACK_CONFUSE;
1134 p_ptr->redraw |= (PR_STATUS);
1140 case SV_SCROLL_PROTECTION_FROM_EVIL:
1143 if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
1147 case SV_SCROLL_RUNE_OF_PROTECTION:
1154 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
1156 if (destroy_doors_touch()) ident = TRUE;
1160 case SV_SCROLL_STAR_DESTRUCTION:
1162 if (destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE))
1165 msg_print(_("ダンジョンが揺れた...", "The dungeon trembles..."));
1170 case SV_SCROLL_DISPEL_UNDEAD:
1172 if (dispel_undead(80)) ident = TRUE;
1176 case SV_SCROLL_SPELL:
1178 if ((p_ptr->pclass == CLASS_WARRIOR) ||
1179 (p_ptr->pclass == CLASS_IMITATOR) ||
1180 (p_ptr->pclass == CLASS_MINDCRAFTER) ||
1181 (p_ptr->pclass == CLASS_SORCERER) ||
1182 (p_ptr->pclass == CLASS_ARCHER) ||
1183 (p_ptr->pclass == CLASS_MAGIC_EATER) ||
1184 (p_ptr->pclass == CLASS_RED_MAGE) ||
1185 (p_ptr->pclass == CLASS_SAMURAI) ||
1186 (p_ptr->pclass == CLASS_BLUE_MAGE) ||
1187 (p_ptr->pclass == CLASS_CAVALRY) ||
1188 (p_ptr->pclass == CLASS_BERSERKER) ||
1189 (p_ptr->pclass == CLASS_SMITH) ||
1190 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
1191 (p_ptr->pclass == CLASS_NINJA) ||
1192 (p_ptr->pclass == CLASS_SNIPER)) break;
1193 p_ptr->add_spells++;
1194 p_ptr->update |= (PU_SPELLS);
1199 case SV_SCROLL_GENOCIDE:
1201 (void)symbol_genocide(300, TRUE);
1206 case SV_SCROLL_MASS_GENOCIDE:
1208 (void)mass_genocide(300, TRUE);
1213 case SV_SCROLL_ACQUIREMENT:
1215 acquirement(p_ptr->y, p_ptr->x, 1, TRUE, FALSE, FALSE);
1220 case SV_SCROLL_STAR_ACQUIREMENT:
1222 acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE);
1227 /* New Hengband scrolls */
1228 case SV_SCROLL_FIRE:
1230 fire_ball(GF_FIRE, 0, 666, 4);
1231 /* Note: "Double" damage since it is centered on the player ... */
1232 if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
1233 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1);
1242 fire_ball(GF_ICE, 0, 777, 4);
1243 if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
1244 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
1250 case SV_SCROLL_CHAOS:
1252 fire_ball(GF_CHAOS, 0, 1000, 4);
1253 if (!p_ptr->resist_chaos)
1254 take_hit(DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1);
1260 case SV_SCROLL_RUMOR:
1262 msg_print(_("巻物にはメッセージが書かれている:", "There is message on the scroll. It says:"));
1264 display_rumor(TRUE);
1266 msg_print(_("巻物は煙を立てて消え去った!", "The scroll disappears in a puff of smoke!"));
1272 case SV_SCROLL_ARTIFACT:
1275 if (!artifact_scroll()) used_up = FALSE;
1279 case SV_SCROLL_RESET_RECALL:
1282 if (!reset_recall()) used_up = FALSE;
1286 case SV_SCROLL_AMUSEMENT:
1289 amusement(p_ptr->y, p_ptr->x, 1, FALSE);
1293 case SV_SCROLL_STAR_AMUSEMENT:
1296 amusement(p_ptr->y, p_ptr->x, randint1(2) + 1, FALSE);
1301 else if (o_ptr->name1 == ART_GHB)
1303 msg_print(_("私は苦労して『グレーター・ヘル=ビースト』を倒した。", "I had a very hard time to kill the Greater hell-beast, "));
1304 msg_print(_("しかし手に入ったのはこのきたないTシャツだけだった。", "but all I got was this lousy t-shirt!"));
1307 else if (o_ptr->name1 == ART_POWER)
1309 msg_print(_("「一つの指輪は全てを統べ、", "'One Ring to rule them all, "));
1311 msg_print(_("一つの指輪は全てを見つけ、", "One Ring to find them, "));
1313 msg_print(_("一つの指輪は全てを捕らえて", "One Ring to bring them all "));
1315 msg_print(_("暗闇の中に繋ぎとめる。」", "and in the darkness bind them.'"));
1318 else if (o_ptr->tval==TV_PARCHMENT)
1321 char o_name[MAX_NLEN];
1327 q=format("book-%d_jp.txt",o_ptr->sval);
1329 /* Display object description */
1330 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1332 /* Build the filename */
1333 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q);
1335 /* Peruse the help file */
1336 (void)show_file(TRUE, buf, o_name, 0, 0);
1345 /* Combine / Reorder the pack (later) */
1346 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1348 if (!(object_is_aware(o_ptr)))
1350 chg_virtue(V_PATIENCE, -1);
1351 chg_virtue(V_CHANCE, 1);
1352 chg_virtue(V_KNOWLEDGE, -1);
1355 /* The item was tried */
1356 object_tried(o_ptr);
1358 /* An identification was made */
1359 if (ident && !object_is_aware(o_ptr))
1361 object_aware(o_ptr);
1362 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1366 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1369 /* Hack -- allow certain scrolls to be "preserved" */
1375 sound(SOUND_SCROLL);
1377 /* Destroy a scroll in the pack */
1380 inven_item_increase(item, -1);
1381 inven_item_describe(item);
1382 inven_item_optimize(item);
1385 /* Destroy a scroll on the floor */
1388 floor_item_increase(0 - item, -1);
1389 floor_item_describe(0 - item);
1390 floor_item_optimize(0 - item);
1395 * @brief オブジェクトをプレイヤーが読むことができるかを判定する /
1396 * Hook to determine if an object is readable
1397 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1398 * @return 読むことが可能ならばTRUEを返す
1400 static bool item_tester_hook_readable(object_type *o_ptr)
1402 if ((o_ptr->tval==TV_SCROLL) || (o_ptr->tval==TV_PARCHMENT) || (o_ptr->name1 == ART_GHB) || (o_ptr->name1 == ART_POWER)) return (TRUE);
1409 * @brief 読むコマンドのメインルーチン /
1410 * Eat some food (from the pack or floor)
1413 void do_cmd_read_scroll(void)
1419 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1421 set_action(ACTION_NONE);
1424 /* Check some conditions */
1427 msg_print(_("目が見えない。", "You can't see anything."));
1432 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
1435 if (p_ptr->confused)
1437 msg_print(_("混乱していて読めない。", "You are too confused!"));
1442 /* Restrict choices to scrolls */
1443 item_tester_hook = item_tester_hook_readable;
1446 q = _("どの巻物を読みますか? ", "Read which scroll? ");
1447 s = _("読める巻物がない。", "You have no scrolls to read.");
1449 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1451 /* Get the item (in the pack) */
1454 o_ptr = &inventory[item];
1457 /* Get the item (on the floor) */
1460 o_ptr = &o_list[0 - item];
1463 /* Read the scroll */
1464 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
1469 * @param sval オブジェクトのsval
1470 * @param use_charge 使用回数を消費したかどうかを返す参照ポインタ
1471 * @param powerful 強力発動上の処理ならばTRUE
1472 * @param magic 魔道具術上の処理ならばTRUE
1473 * @param known 判明済ならばTRUE
1474 * @return 発動により効果内容が確定したならばTRUEを返す
1476 static int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, bool magic, bool known)
1480 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
1481 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
1483 /* Analyze the staff */
1486 case SV_STAFF_DARKNESS:
1488 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
1490 if (set_blind(p_ptr->blind + 3 + randint1(5))) ident = TRUE;
1492 if (unlite_area(10, (powerful ? 6 : 3))) ident = TRUE;
1496 case SV_STAFF_SLOWNESS:
1498 if (set_slow(p_ptr->slow + randint1(30) + 15, FALSE)) ident = TRUE;
1502 case SV_STAFF_HASTE_MONSTERS:
1504 if (speed_monsters()) ident = TRUE;
1508 case SV_STAFF_SUMMONING:
1510 const int times = randint1(powerful ? 8 : 4);
1511 for (k = 0; k < times; k++)
1513 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
1521 case SV_STAFF_TELEPORTATION:
1523 teleport_player((powerful ? 150 : 100), 0L);
1528 case SV_STAFF_IDENTIFY:
1531 if (!identify_fully(FALSE)) *use_charge = FALSE;
1533 if (!ident_spell(FALSE)) *use_charge = FALSE;
1539 case SV_STAFF_REMOVE_CURSE:
1541 bool result = powerful ? remove_all_curse() : remove_curse();
1546 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1548 else if (!p_ptr->blind)
1550 msg_print(_("杖は一瞬ブルーに輝いた...", "The staff glows blue for a moment..."));
1558 case SV_STAFF_STARLITE:
1560 HIT_POINT num = damroll(5, 3);
1561 POSITION y = 0, x = 0;
1564 if (!p_ptr->blind && !magic)
1566 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
1568 for (k = 0; k < num; k++)
1574 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
1576 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
1578 if (!player_bold(y, x)) break;
1581 project(0, 0, y, x, damroll(6 + lev / 8, 10), GF_LITE_WEAK,
1582 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
1590 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
1594 case SV_STAFF_MAPPING:
1596 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
1601 case SV_STAFF_DETECT_GOLD:
1603 if (detect_treasure(detect_rad)) ident = TRUE;
1604 if (detect_objects_gold(detect_rad)) ident = TRUE;
1608 case SV_STAFF_DETECT_ITEM:
1610 if (detect_objects_normal(detect_rad)) ident = TRUE;
1614 case SV_STAFF_DETECT_TRAP:
1616 if (detect_traps(detect_rad, known)) ident = TRUE;
1620 case SV_STAFF_DETECT_DOOR:
1622 if (detect_doors(detect_rad)) ident = TRUE;
1623 if (detect_stairs(detect_rad)) ident = TRUE;
1627 case SV_STAFF_DETECT_INVIS:
1629 if (detect_monsters_invis(detect_rad)) ident = TRUE;
1633 case SV_STAFF_DETECT_EVIL:
1635 if (detect_monsters_evil(detect_rad)) ident = TRUE;
1639 case SV_STAFF_CURE_LIGHT:
1641 if (hp_player(damroll((powerful ? 4 : 2), 8))) ident = TRUE;
1643 if (set_blind(0)) ident = TRUE;
1644 if (set_poisoned(0)) ident = TRUE;
1645 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
1647 if (set_shero(0,TRUE)) ident = TRUE;
1651 case SV_STAFF_CURING:
1653 if (set_blind(0)) ident = TRUE;
1654 if (set_poisoned(0)) ident = TRUE;
1655 if (set_confused(0)) ident = TRUE;
1656 if (set_stun(0)) ident = TRUE;
1657 if (set_cut(0)) ident = TRUE;
1658 if (set_image(0)) ident = TRUE;
1659 if (set_shero(0,TRUE)) ident = TRUE;
1663 case SV_STAFF_HEALING:
1665 if (hp_player(powerful ? 500 : 300)) ident = TRUE;
1666 if (set_stun(0)) ident = TRUE;
1667 if (set_cut(0)) ident = TRUE;
1668 if (set_shero(0,TRUE)) ident = TRUE;
1672 case SV_STAFF_THE_MAGI:
1674 if (do_res_stat(A_INT)) ident = TRUE;
1675 if (p_ptr->csp < p_ptr->msp)
1677 p_ptr->csp = p_ptr->msp;
1678 p_ptr->csp_frac = 0;
1680 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
1682 p_ptr->redraw |= (PR_MANA);
1683 p_ptr->window |= (PW_PLAYER);
1684 p_ptr->window |= (PW_SPELL);
1686 if (set_shero(0,TRUE)) ident = TRUE;
1690 case SV_STAFF_SLEEP_MONSTERS:
1692 if (sleep_monsters(lev)) ident = TRUE;
1696 case SV_STAFF_SLOW_MONSTERS:
1698 if (slow_monsters(lev)) ident = TRUE;
1702 case SV_STAFF_SPEED:
1704 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
1708 case SV_STAFF_PROBING:
1715 case SV_STAFF_DISPEL_EVIL:
1717 if (dispel_evil(powerful ? 120 : 80)) ident = TRUE;
1721 case SV_STAFF_POWER:
1723 if (dispel_monsters(powerful ? 225 : 150)) ident = TRUE;
1727 case SV_STAFF_HOLINESS:
1729 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
1731 if (set_protevil((magic ? 0 : p_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
1732 if (set_poisoned(0)) ident = TRUE;
1733 if (set_afraid(0)) ident = TRUE;
1734 if (hp_player(50)) ident = TRUE;
1735 if (set_stun(0)) ident = TRUE;
1736 if (set_cut(0)) ident = TRUE;
1740 case SV_STAFF_GENOCIDE:
1742 (void)symbol_genocide((magic ? lev + 50 : 200), TRUE);
1747 case SV_STAFF_EARTHQUAKES:
1749 if (earthquake(p_ptr->y, p_ptr->x, (powerful ? 15 : 10)))
1752 msg_print(_("ダンジョンが揺れた。", "The dungeon trembles."));
1757 case SV_STAFF_DESTRUCTION:
1759 if (destroy_area(p_ptr->y, p_ptr->x, (powerful ? 18 : 13) + randint0(5), FALSE))
1765 case SV_STAFF_ANIMATE_DEAD:
1767 if (animate_dead(0, p_ptr->y, p_ptr->x))
1773 case SV_STAFF_MSTORM:
1775 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
1776 project(0, (powerful ? 7 : 5), p_ptr->y, p_ptr->x,
1777 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
1778 if ((p_ptr->pclass != CLASS_MAGE) && (p_ptr->pclass != CLASS_HIGH_MAGE) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_MAGIC_EATER) && (p_ptr->pclass != CLASS_BLUE_MAGE))
1780 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
1787 case SV_STAFF_NOTHING:
1789 msg_print(_("何も起らなかった。", "Nothing happen."));
1790 if (prace_is_(RACE_SKELETON) || prace_is_(RACE_GOLEM) ||
1791 prace_is_(RACE_ZOMBIE) || prace_is_(RACE_SPECTRE))
1792 msg_print(_("もったいない事をしたような気がする。食べ物は大切にしなくては。", "What a waste. It's your food!"));
1800 * @brief 杖を使うコマンドのサブルーチン /
1801 * Use a staff. -RAK-
1802 * @param item 使うオブジェクトの所持品ID
1805 * One charge of one staff disappears.
1806 * Hack -- staffs of identify can be "cancelled".
1808 static void do_cmd_use_staff_aux(int item)
1810 int ident, chance, lev;
1814 /* Hack -- let staffs of identify get aborted */
1815 bool use_charge = TRUE;
1818 /* Get the item (in the pack) */
1821 o_ptr = &inventory[item];
1824 /* Get the item (on the floor) */
1827 o_ptr = &o_list[0 - item];
1831 /* Mega-Hack -- refuse to use a pile from the ground */
1832 if ((item < 0) && (o_ptr->number > 1))
1834 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
1840 p_ptr->energy_use = 100;
1842 /* Extract the item level */
1843 lev = k_info[o_ptr->k_idx].level;
1844 if (lev > 50) lev = 50 + (lev - 50)/2;
1846 /* Base chance of success */
1847 chance = p_ptr->skill_dev;
1849 /* Confusion hurts skill */
1850 if (p_ptr->confused) chance = chance / 2;
1852 /* Hight level objects are harder */
1853 chance = chance - lev;
1855 /* Give everyone a (slight) chance */
1856 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
1858 chance = USE_DEVICE;
1863 if (flush_failure) flush();
1864 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this staff is freezing too."));
1869 /* Roll for usage */
1870 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
1872 if (flush_failure) flush();
1873 msg_print(_("杖をうまく使えなかった。", "You failed to use the staff properly."));
1878 /* Notice empty staffs */
1879 if (o_ptr->pval <= 0)
1881 if (flush_failure) flush();
1882 msg_print(_("この杖にはもう魔力が残っていない。", "The staff has no charges left."));
1883 o_ptr->ident |= (IDENT_EMPTY);
1885 /* Combine / Reorder the pack (later) */
1886 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1887 p_ptr->window |= (PW_INVEN);
1896 ident = staff_effect(o_ptr->sval, &use_charge, FALSE, FALSE, object_is_aware(o_ptr));
1898 if (!(object_is_aware(o_ptr)))
1900 chg_virtue(V_PATIENCE, -1);
1901 chg_virtue(V_CHANCE, 1);
1902 chg_virtue(V_KNOWLEDGE, -1);
1905 /* Combine / Reorder the pack (later) */
1906 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1908 /* Tried the item */
1909 object_tried(o_ptr);
1911 /* An identification was made */
1912 if (ident && !object_is_aware(o_ptr))
1914 object_aware(o_ptr);
1915 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1919 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1922 /* Hack -- some uses are "free" */
1923 if (!use_charge) return;
1926 /* Use a single charge */
1929 /* XXX Hack -- unstack if necessary */
1930 if ((item >= 0) && (o_ptr->number > 1))
1935 /* Get local object */
1938 /* Obtain a local object */
1939 object_copy(q_ptr, o_ptr);
1941 /* Modify quantity */
1944 /* Restore the charges */
1947 /* Unstack the used item */
1949 p_ptr->total_weight -= q_ptr->weight;
1950 item = inven_carry(q_ptr);
1953 msg_print(_("杖をまとめなおした。", "You unstack your staff."));
1956 /* Describe charges in the pack */
1959 inven_item_charges(item);
1962 /* Describe charges on the floor */
1965 floor_item_charges(0 - item);
1970 * @brief 杖を使うコマンドのメインルーチン /
1973 void do_cmd_use_staff(void)
1978 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1980 set_action(ACTION_NONE);
1983 /* Restrict choices to wands */
1984 item_tester_tval = TV_STAFF;
1987 q = _("どの杖を使いますか? ", "Use which staff? ");
1988 s = _("使える杖がない。", "You have no staff to use.");
1990 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1992 do_cmd_use_staff_aux(item);
1996 * @brief 魔法棒の効果を発動する
1997 * @param sval オブジェクトのsval
1998 * @param dir 発動の方向ID
1999 * @param powerful 強力発動上の処理ならばTRUE
2000 * @param magic 魔道具術上の処理ならばTRUE
2001 * @return 発動により効果内容が確定したならばTRUEを返す
2003 static int wand_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool powerful, bool magic)
2006 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2007 int rad = powerful ? 3 : 2;
2009 /* XXX Hack -- Wand of wonder can do anything before it */
2010 if (sval == SV_WAND_WONDER)
2012 int vir = virtue_number(V_CHANCE);
2013 sval = (OBJECT_SUBTYPE_VALUE)randint0(SV_WAND_WONDER);
2017 if (p_ptr->virtues[vir - 1] > 0)
2019 while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
2020 if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
2024 while (randint1(300) < (0-p_ptr->virtues[vir - 1])) sval--;
2025 if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
2028 if (sval < SV_WAND_TELEPORT_AWAY)
2029 chg_virtue(V_CHANCE, 1);
2032 /* Analyze the wand */
2035 case SV_WAND_HEAL_MONSTER:
2037 HIT_POINT dam = damroll((powerful ? 20 : 10), 10);
2038 if (heal_monster(dir, dam)) ident = TRUE;
2042 case SV_WAND_HASTE_MONSTER:
2044 if (speed_monster(dir, lev)) ident = TRUE;
2048 case SV_WAND_CLONE_MONSTER:
2050 if (clone_monster(dir)) ident = TRUE;
2054 case SV_WAND_TELEPORT_AWAY:
2056 int distance = MAX_SIGHT * (powerful ? 8 : 5);
2057 if (teleport_monster(dir, distance)) ident = TRUE;
2061 case SV_WAND_DISARMING:
2063 if (disarm_trap(dir)) ident = TRUE;
2064 if (powerful && disarm_traps_touch()) ident = TRUE;
2068 case SV_WAND_TRAP_DOOR_DEST:
2070 if (destroy_door(dir)) ident = TRUE;
2071 if (powerful && destroy_doors_touch()) ident = TRUE;
2075 case SV_WAND_STONE_TO_MUD:
2077 HIT_POINT dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
2078 if (wall_to_mud(dir, dam)) ident = TRUE;
2084 HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
2085 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
2086 (void)lite_line(dir, dam);
2091 case SV_WAND_SLEEP_MONSTER:
2093 if (sleep_monster(dir, lev)) ident = TRUE;
2097 case SV_WAND_SLOW_MONSTER:
2099 if (slow_monster(dir, lev)) ident = TRUE;
2103 case SV_WAND_CONFUSE_MONSTER:
2105 if (confuse_monster(dir, lev)) ident = TRUE;
2109 case SV_WAND_FEAR_MONSTER:
2111 if (fear_monster(dir, lev)) ident = TRUE;
2115 case SV_WAND_HYPODYNAMIA:
2117 if (hypodynamic_bolt(dir, 80 + lev)) ident = TRUE;
2121 case SV_WAND_POLYMORPH:
2123 if (poly_monster(dir, lev)) ident = TRUE;
2127 case SV_WAND_STINKING_CLOUD:
2129 fire_ball(GF_POIS, dir, 12 + lev / 4, rad);
2134 case SV_WAND_MAGIC_MISSILE:
2136 fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + lev / 10, 6));
2141 case SV_WAND_ACID_BOLT:
2143 fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + lev / 7, 8));
2148 case SV_WAND_CHARM_MONSTER:
2150 if (charm_monster(dir, MAX(20, lev)))
2155 case SV_WAND_FIRE_BOLT:
2157 fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + lev / 6, 8));
2162 case SV_WAND_COLD_BOLT:
2164 fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + lev / 8, 8));
2169 case SV_WAND_ACID_BALL:
2171 fire_ball(GF_ACID, dir, 60 + 3 * lev / 4, rad);
2176 case SV_WAND_ELEC_BALL:
2178 fire_ball(GF_ELEC, dir, 40 + 3 * lev / 4, rad);
2183 case SV_WAND_FIRE_BALL:
2185 fire_ball(GF_FIRE, dir, 70 + 3 * lev / 4, rad);
2190 case SV_WAND_COLD_BALL:
2192 fire_ball(GF_COLD, dir, 50 + 3 * lev / 4, rad);
2197 case SV_WAND_WONDER:
2199 msg_print(_("おっと、謎の魔法棒を始動させた。", "Oops. Wand of wonder activated."));
2203 case SV_WAND_DRAGON_FIRE:
2205 fire_breath(GF_FIRE, dir, (powerful ? 300 : 200), 3);
2210 case SV_WAND_DRAGON_COLD:
2212 fire_breath(GF_COLD, dir, (powerful ? 270 : 180), 3);
2217 case SV_WAND_DRAGON_BREATH:
2222 switch (randint1(5))
2246 if (powerful) dam = (dam * 3) / 2;
2248 fire_ball(typ, dir, dam, -3);
2254 case SV_WAND_DISINTEGRATE:
2256 fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(lev * 2), rad);
2261 case SV_WAND_ROCKETS:
2263 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
2264 fire_rocket(GF_ROCKET, dir, 250 + lev * 3, rad);
2269 case SV_WAND_STRIKING:
2271 fire_bolt(GF_METEOR, dir, damroll(15 + lev / 3, 13));
2276 case SV_WAND_GENOCIDE:
2278 fire_ball_hide(GF_GENOCIDE, dir, magic ? lev + 50 : 250, 0);
2287 * @brief 魔法棒を使うコマンドのサブルーチン /
2288 * Aim a wand (from the pack or floor).
2289 * @param item 使うオブジェクトの所持品ID
2293 * Use a single charge from a single item.
2294 * Handle "unstacking" in a logical manner.
2295 * For simplicity, you cannot use a stack of items from the
2296 * ground. This would require too much nasty code.
2297 * There are no wands which can "destroy" themselves, in the inventory
2298 * or on the ground, so we can ignore this possibility. Note that this
2299 * required giving "wand of wonder" the ability to ignore destruction
2300 * by electric balls.
2301 * All wands can be "cancelled" at the "Direction?" prompt for free.
2302 * Note that the basic "bolt" wands do slightly less damage than the
2303 * basic "bolt" rods, but the basic "ball" wands do the same damage
2304 * as the basic "ball" rods.
2307 static void do_cmd_aim_wand_aux(int item)
2309 int lev, ident, chance, dir;
2311 bool old_target_pet = target_pet;
2313 /* Get the item (in the pack) */
2316 o_ptr = &inventory[item];
2319 /* Get the item (on the floor) */
2322 o_ptr = &o_list[0 - item];
2325 /* Mega-Hack -- refuse to aim a pile from the ground */
2326 if ((item < 0) && (o_ptr->number > 1))
2328 msg_print(_("まずは魔法棒を拾わなければ。", "You must first pick up the wands."));
2333 /* Allow direction to be cancelled for free */
2334 if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
2335 || o_ptr->sval == SV_WAND_HASTE_MONSTER))
2337 if (!get_aim_dir(&dir))
2339 target_pet = old_target_pet;
2342 target_pet = old_target_pet;
2345 p_ptr->energy_use = 100;
2348 lev = k_info[o_ptr->k_idx].level;
2349 if (lev > 50) lev = 50 + (lev - 50)/2;
2351 /* Base chance of success */
2352 chance = p_ptr->skill_dev;
2354 /* Confusion hurts skill */
2355 if (p_ptr->confused) chance = chance / 2;
2357 /* Hight level objects are harder */
2358 chance = chance - lev;
2360 /* Give everyone a (slight) chance */
2361 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
2363 chance = USE_DEVICE;
2368 if (flush_failure) flush();
2369 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this wand is freezing too."));
2374 /* Roll for usage */
2375 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
2377 if (flush_failure) flush();
2378 msg_print(_("魔法棒をうまく使えなかった。", "You failed to use the wand properly."));
2383 /* The wand is already empty! */
2384 if (o_ptr->pval <= 0)
2386 if (flush_failure) flush();
2387 msg_print(_("この魔法棒にはもう魔力が残っていない。", "The wand has no charges left."));
2388 o_ptr->ident |= (IDENT_EMPTY);
2390 /* Combine / Reorder the pack (later) */
2391 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2392 p_ptr->window |= (PW_INVEN);
2400 ident = wand_effect(o_ptr->sval, dir, FALSE, FALSE);
2402 /* Combine / Reorder the pack (later) */
2403 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2405 if (!(object_is_aware(o_ptr)))
2407 chg_virtue(V_PATIENCE, -1);
2408 chg_virtue(V_CHANCE, 1);
2409 chg_virtue(V_KNOWLEDGE, -1);
2412 /* Mark it as tried */
2413 object_tried(o_ptr);
2415 /* Apply identification */
2416 if (ident && !object_is_aware(o_ptr))
2418 object_aware(o_ptr);
2419 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2423 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2426 /* Use a single charge */
2429 /* Describe the charges in the pack */
2432 inven_item_charges(item);
2435 /* Describe the charges on the floor */
2438 floor_item_charges(0 - item);
2443 * @brief 魔法棒を使うコマンドのメインルーチン /
2446 void do_cmd_aim_wand(void)
2451 /* Restrict choices to wands */
2452 item_tester_tval = TV_WAND;
2454 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2456 set_action(ACTION_NONE);
2460 q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
2461 s = _("使える魔法棒がない。", "You have no wand to aim.");
2463 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2466 do_cmd_aim_wand_aux(item);
2470 * @brief ロッドの効果を発動する
2471 * @param sval オブジェクトのsval
2472 * @param dir 発動目標の方向ID
2473 * @param use_charge チャージを消費したかどうかを返す参照ポインタ
2474 * @param powerful 強力発動上の処理ならばTRUE
2475 * @param magic 魔道具術上の処理ならばTRUE
2476 * @return 発動により効果内容が確定したならばTRUEを返す
2478 static int rod_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool *use_charge, bool powerful, bool magic)
2481 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2482 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
2483 int rad = powerful ? 3 : 2;
2488 /* Analyze the rod */
2491 case SV_ROD_DETECT_TRAP:
2493 if (detect_traps(detect_rad, (bool)(dir ? FALSE : TRUE))) ident = TRUE;
2497 case SV_ROD_DETECT_DOOR:
2499 if (detect_doors(detect_rad)) ident = TRUE;
2500 if (detect_stairs(detect_rad)) ident = TRUE;
2504 case SV_ROD_IDENTIFY:
2507 if (!identify_fully(FALSE)) *use_charge = FALSE;
2509 if (!ident_spell(FALSE)) *use_charge = FALSE;
2517 if (!word_of_recall()) *use_charge = FALSE;
2522 case SV_ROD_ILLUMINATION:
2524 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
2528 case SV_ROD_MAPPING:
2530 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
2535 case SV_ROD_DETECTION:
2537 detect_all(detect_rad);
2542 case SV_ROD_PROBING:
2551 if (set_blind(0)) ident = TRUE;
2552 if (set_poisoned(0)) ident = TRUE;
2553 if (set_confused(0)) ident = TRUE;
2554 if (set_stun(0)) ident = TRUE;
2555 if (set_cut(0)) ident = TRUE;
2556 if (set_image(0)) ident = TRUE;
2557 if (set_shero(0,TRUE)) ident = TRUE;
2561 case SV_ROD_HEALING:
2563 if (hp_player(powerful ? 750 : 500)) ident = TRUE;
2564 if (set_stun(0)) ident = TRUE;
2565 if (set_cut(0)) ident = TRUE;
2566 if (set_shero(0,TRUE)) ident = TRUE;
2570 case SV_ROD_RESTORATION:
2572 if (restore_level()) ident = TRUE;
2573 if (do_res_stat(A_STR)) ident = TRUE;
2574 if (do_res_stat(A_INT)) ident = TRUE;
2575 if (do_res_stat(A_WIS)) ident = TRUE;
2576 if (do_res_stat(A_DEX)) ident = TRUE;
2577 if (do_res_stat(A_CON)) ident = TRUE;
2578 if (do_res_stat(A_CHR)) ident = TRUE;
2584 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
2588 case SV_ROD_PESTICIDE:
2590 if (dispel_monsters(powerful ? 8 : 4)) ident = TRUE;
2594 case SV_ROD_TELEPORT_AWAY:
2596 int distance = MAX_SIGHT * (powerful ? 8 : 5);
2597 if (teleport_monster(dir, distance)) ident = TRUE;
2601 case SV_ROD_DISARMING:
2603 if (disarm_trap(dir)) ident = TRUE;
2604 if (powerful && disarm_traps_touch()) ident = TRUE;
2610 HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
2611 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
2612 (void)lite_line(dir, dam);
2617 case SV_ROD_SLEEP_MONSTER:
2619 if (sleep_monster(dir, lev)) ident = TRUE;
2623 case SV_ROD_SLOW_MONSTER:
2625 if (slow_monster(dir, lev)) ident = TRUE;
2629 case SV_ROD_HYPODYNAMIA:
2631 if (hypodynamic_bolt(dir, 70 + 3 * lev / 2)) ident = TRUE;
2635 case SV_ROD_POLYMORPH:
2637 if (poly_monster(dir, lev)) ident = TRUE;
2641 case SV_ROD_ACID_BOLT:
2643 fire_bolt_or_beam(10, GF_ACID, dir, damroll(6 + lev / 7, 8));
2648 case SV_ROD_ELEC_BOLT:
2650 fire_bolt_or_beam(10, GF_ELEC, dir, damroll(4 + lev / 9, 8));
2655 case SV_ROD_FIRE_BOLT:
2657 fire_bolt_or_beam(10, GF_FIRE, dir, damroll(7 + lev / 6, 8));
2662 case SV_ROD_COLD_BOLT:
2664 fire_bolt_or_beam(10, GF_COLD, dir, damroll(5 + lev / 8, 8));
2669 case SV_ROD_ACID_BALL:
2671 fire_ball(GF_ACID, dir, 60 + lev, rad);
2676 case SV_ROD_ELEC_BALL:
2678 fire_ball(GF_ELEC, dir, 40 + lev, rad);
2683 case SV_ROD_FIRE_BALL:
2685 fire_ball(GF_FIRE, dir, 70 + lev, rad);
2690 case SV_ROD_COLD_BALL:
2692 fire_ball(GF_COLD, dir, 50 + lev, rad);
2704 case SV_ROD_STONE_TO_MUD:
2706 HIT_POINT dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
2707 if (wall_to_mud(dir, dam)) ident = TRUE;
2711 case SV_ROD_AGGRAVATE:
2713 aggravate_monsters(0);
2722 * @brief 魔法棒を使うコマンドのサブルーチン /
2723 * Activate (zap) a Rod
2724 * @param item 使うオブジェクトの所持品ID
2728 * Unstack fully charged rods as needed.
2729 * Hack -- rods of perception/genocide can be "cancelled"
2730 * All rods can be cancelled at the "Direction?" prompt
2731 * pvals are defined for each rod in k_info. -LM-
2734 static void do_cmd_zap_rod_aux(int item)
2736 int ident, chance, lev, fail;
2741 /* Hack -- let perception get aborted */
2742 bool use_charge = TRUE;
2746 /* Get the item (in the pack) */
2749 o_ptr = &inventory[item];
2752 /* Get the item (on the floor) */
2755 o_ptr = &o_list[0 - item];
2759 /* Mega-Hack -- refuse to zap a pile from the ground */
2760 if ((item < 0) && (o_ptr->number > 1))
2762 msg_print(_("まずはロッドを拾わなければ。", "You must first pick up the rods."));
2767 /* Get a direction (unless KNOWN not to need it) */
2768 if (((o_ptr->sval >= SV_ROD_MIN_DIRECTION) && (o_ptr->sval != SV_ROD_HAVOC) && (o_ptr->sval != SV_ROD_AGGRAVATE) && (o_ptr->sval != SV_ROD_PESTICIDE)) ||
2769 !object_is_aware(o_ptr))
2771 /* Get a direction, allow cancel */
2772 if (!get_aim_dir(&dir)) return;
2777 p_ptr->energy_use = 100;
2779 /* Extract the item level */
2780 lev = k_info[o_ptr->k_idx].level;
2782 /* Base chance of success */
2783 chance = p_ptr->skill_dev;
2785 /* Confusion hurts skill */
2786 if (p_ptr->confused) chance = chance / 2;
2789 if (chance > fail) fail -= (chance - fail)*2;
2790 else chance -= (fail - chance)*2;
2791 if (fail < USE_DEVICE) fail = USE_DEVICE;
2792 if (chance < USE_DEVICE) chance = USE_DEVICE;
2796 if (flush_failure) flush();
2797 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this rod is freezing too."));
2802 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
2803 else if (chance > fail)
2805 if (randint0(chance*2) < fail) success = FALSE;
2806 else success = TRUE;
2810 if (randint0(fail*2) < chance) success = TRUE;
2811 else success = FALSE;
2814 /* Roll for usage */
2817 if (flush_failure) flush();
2818 msg_print(_("うまくロッドを使えなかった。", "You failed to use the rod properly."));
2823 k_ptr = &k_info[o_ptr->k_idx];
2825 /* A single rod is still charging */
2826 if ((o_ptr->number == 1) && (o_ptr->timeout))
2828 if (flush_failure) flush();
2829 msg_print(_("このロッドはまだ魔力を充填している最中だ。", "The rod is still charging."));
2832 /* A stack of rods lacks enough energy. */
2833 else if ((o_ptr->number > 1) && (o_ptr->timeout > k_ptr->pval * (o_ptr->number - 1)))
2835 if (flush_failure) flush();
2836 msg_print(_("そのロッドはまだ充填中です。", "The rods are all still charging."));
2843 ident = rod_effect(o_ptr->sval, dir, &use_charge, FALSE, FALSE);
2845 /* Increase the timeout by the rod kind's pval. -LM- */
2846 if (use_charge) o_ptr->timeout += k_ptr->pval;
2848 /* Combine / Reorder the pack (later) */
2849 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2851 if (!(object_is_aware(o_ptr)))
2853 chg_virtue(V_PATIENCE, -1);
2854 chg_virtue(V_CHANCE, 1);
2855 chg_virtue(V_KNOWLEDGE, -1);
2858 /* Tried the object */
2859 object_tried(o_ptr);
2861 /* Successfully determined the object function */
2862 if (ident && !object_is_aware(o_ptr))
2864 object_aware(o_ptr);
2865 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2869 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2873 * @brief ロッドを使うコマンドのメインルーチン /
2876 void do_cmd_zap_rod(void)
2881 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2883 set_action(ACTION_NONE);
2886 /* Restrict choices to rods */
2887 item_tester_tval = TV_ROD;
2890 q = _("どのロッドを振りますか? ", "Zap which rod? ");
2891 s = _("使えるロッドがない。", "You have no rod to zap.");
2893 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2896 do_cmd_zap_rod_aux(item);
2900 * @brief オブジェクトをプレイヤーが魔道具として発動できるかを判定する /
2901 * Hook to determine if an object is activatable
2902 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
2903 * @return 魔道具として発動可能ならばTRUEを返す
2905 static bool item_tester_hook_activate(object_type *o_ptr)
2907 u32b flgs[TR_FLAG_SIZE];
2910 if (!object_is_known(o_ptr)) return (FALSE);
2912 /* Extract the flags */
2913 object_flags(o_ptr, flgs);
2915 /* Check activation flag */
2916 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
2923 * @brief 『一つの指輪』の効果処理 /
2924 * Hack -- activate the ring of power
2925 * @param dir 発動の方向ID
2928 void ring_of_power(int dir)
2930 /* Pick a random effect */
2931 switch (randint1(10))
2937 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
2940 /* Decrease all stats (permanently) */
2941 (void)dec_stat(A_STR, 50, TRUE);
2942 (void)dec_stat(A_INT, 50, TRUE);
2943 (void)dec_stat(A_WIS, 50, TRUE);
2944 (void)dec_stat(A_DEX, 50, TRUE);
2945 (void)dec_stat(A_CON, 50, TRUE);
2946 (void)dec_stat(A_CHR, 50, TRUE);
2948 /* Lose some experience (permanently) */
2949 p_ptr->exp -= (p_ptr->exp / 4);
2950 p_ptr->max_exp -= (p_ptr->exp / 4);
2959 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
2961 /* Dispel monsters */
2962 dispel_monsters(1000);
2972 fire_ball(GF_MANA, dir, 600, 3);
2983 fire_bolt(GF_MANA, dir, 500);
2991 * @brief ペット入りモンスターボールをソートするための比較関数
2992 * @param u 所持品配列の参照ポインタ
2996 * @return 1の方が大であればTRUE
2998 static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
3000 u16b *who = (u16b*)(u);
3005 monster_type *m_ptr1 = &m_list[w1];
3006 monster_type *m_ptr2 = &m_list[w2];
3007 monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
3008 monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
3013 if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
3014 if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
3016 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
3017 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
3019 if (r_ptr1->level > r_ptr2->level) return TRUE;
3020 if (r_ptr2->level > r_ptr1->level) return FALSE;
3022 if (m_ptr1->hp > m_ptr2->hp) return TRUE;
3023 if (m_ptr2->hp > m_ptr1->hp) return FALSE;
3030 * @brief 装備を発動するコマンドのサブルーチン /
3031 * Activate a wielded object. Wielded objects never stack.
3032 * And even if they did, activatable objects never stack.
3033 * @param item 発動するオブジェクトの所持品ID
3037 * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
3038 * But one could, for example, easily make an activatable "Ring of Plasma".
3039 * Note that it always takes a turn to activate an artifact, even if
3040 * the user hits "escape" at the "direction" prompt.
3043 static void do_cmd_activate_aux(int item)
3045 int dir, lev, chance, fail;
3050 /* Get the item (in the pack) */
3053 o_ptr = &inventory[item];
3056 /* Get the item (on the floor) */
3059 o_ptr = &o_list[0 - item];
3063 p_ptr->energy_use = 100;
3065 /* Extract the item level */
3066 lev = k_info[o_ptr->k_idx].level;
3068 /* Hack -- use artifact level instead */
3069 if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
3070 else if (object_is_random_artifact(o_ptr))
3072 const activation_type* const act_ptr = find_activation_info(o_ptr);
3074 lev = act_ptr->level;
3077 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
3079 /* Base chance of success */
3080 chance = p_ptr->skill_dev;
3082 /* Confusion hurts skill */
3083 if (p_ptr->confused) chance = chance / 2;
3086 if (chance > fail) fail -= (chance - fail)*2;
3087 else chance -= (fail - chance)*2;
3088 if (fail < USE_DEVICE) fail = USE_DEVICE;
3089 if (chance < USE_DEVICE) chance = USE_DEVICE;
3093 if (flush_failure) flush();
3094 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
3099 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3100 else if (chance > fail)
3102 if (randint0(chance*2) < fail) success = FALSE;
3103 else success = TRUE;
3107 if (randint0(fail*2) < chance) success = TRUE;
3108 else success = FALSE;
3111 /* Roll for usage */
3114 if (flush_failure) flush();
3115 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
3120 /* Check the recharge */
3123 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
3127 /* Some lights need enough fuel for activation */
3128 if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
3129 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
3131 msg_print(_("燃料がない。", "It has no fuel."));
3132 p_ptr->energy_use = 0;
3136 /* Activate the artifact */
3137 msg_print(_("始動させた...", "You activate it..."));
3142 /* Activate object */
3143 if (activation_index(o_ptr))
3145 (void)activate_random_artifact(o_ptr);
3148 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3155 else if (o_ptr->tval == TV_WHISTLE)
3157 if (music_singing_any()) stop_singing();
3158 if (hex_spelling_any()) stop_hex_spell_all();
3161 if (object_is_cursed(o_ptr))
3163 msg_print(_("カン高い音が響き渡った。", "You produce a shrill whistling sound."));
3164 aggravate_monsters(0);
3174 /* Allocate the "who" array */
3175 C_MAKE(who, max_m_idx, IDX);
3177 /* Process the monsters (backwards) */
3178 for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
3180 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
3181 who[max_pet++] = pet_ctr;
3184 /* Select the sort method */
3185 ang_sort_comp = ang_sort_comp_pet;
3186 ang_sort_swap = ang_sort_swap_hook;
3188 ang_sort(who, &dummy_why, max_pet);
3190 /* Process the monsters (backwards) */
3191 for (i = 0; i < max_pet; i++)
3194 teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
3197 /* Free the "who" array */
3198 C_KILL(who, max_m_idx, IDX);
3200 o_ptr->timeout = 100+randint1(100);
3203 else if (o_ptr->tval == TV_CAPTURE)
3207 bool old_target_pet = target_pet;
3209 if (!get_aim_dir(&dir))
3211 target_pet = old_target_pet;
3214 target_pet = old_target_pet;
3216 if(fire_ball(GF_CAPTURE, dir, 0, 0))
3218 o_ptr->pval = (PARAMETER_VALUE)cap_mon;
3219 o_ptr->xtra3 = (XTRA8)cap_mspeed;
3220 o_ptr->xtra4 = (XTRA16)cap_hp;
3221 o_ptr->xtra5 = (XTRA16)cap_maxhp;
3228 if (o_ptr->inscription)
3229 strcpy(buf, quark_str(o_ptr->inscription));
3231 for (s = buf;*s && (*s != '#'); s++)
3234 if (iskanji(*s)) s++;
3244 t = quark_str(cap_nickname);
3257 o_ptr->inscription = quark_add(buf);
3264 if (!get_rep_dir2(&dir)) return;
3265 if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
3267 if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
3269 if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
3270 if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
3271 if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
3272 m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
3273 if (o_ptr->inscription)
3281 t = quark_str(o_ptr->inscription);
3282 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
3285 if (iskanji(*t)) t++;
3310 if (quote && *(s-1) =='\'')
3314 m_list[hack_m_idx_ii].nickname = quark_add(buf);
3315 t = quark_str(o_ptr->inscription);
3317 while(*t && (*t != '#'))
3324 o_ptr->inscription = quark_add(buf);
3335 msg_print(_("おっと、解放に失敗した。", "Oops. You failed to release your pet."));
3342 msg_print(_("おっと、このアイテムは始動できない。", "Oops. That object cannot be activated."));
3346 * @brief 装備を発動するコマンドのメインルーチン /
3349 void do_cmd_activate(void)
3355 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3357 set_action(ACTION_NONE);
3360 item_tester_no_ryoute = TRUE;
3361 /* Prepare the hook */
3362 item_tester_hook = item_tester_hook_activate;
3365 q = _("どのアイテムを始動させますか? ", "Activate which item? ");
3366 s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
3368 if (!get_item(&item, q, s, (USE_EQUIP))) return;
3370 /* Activate the item */
3371 do_cmd_activate_aux(item);
3376 * @brief オブジェクトをプレイヤーが簡易使用コマンドで利用できるかを判定する /
3377 * Hook to determine if an object is useable
3378 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
3379 * @return 利用可能ならばTRUEを返す
3381 static bool item_tester_hook_use(object_type *o_ptr)
3383 u32b flgs[TR_FLAG_SIZE];
3386 if (o_ptr->tval == p_ptr->tval_ammo)
3389 /* Useable object */
3390 switch (o_ptr->tval)
3408 if (!object_is_known(o_ptr)) return (FALSE);
3410 /* HACK - only items from the equipment can be activated */
3411 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3413 if (&inventory[i] == o_ptr)
3415 /* Extract the flags */
3416 object_flags(o_ptr, flgs);
3418 /* Check activation flag */
3419 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
3431 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
3435 * XXX - Add actions for other item types
3437 void do_cmd_use(void)
3443 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3445 set_action(ACTION_NONE);
3448 item_tester_no_ryoute = TRUE;
3449 /* Prepare the hook */
3450 item_tester_hook = item_tester_hook_use;
3453 q = _("どれを使いますか?", "Use which item? ");
3454 s = _("使えるものがありません。", "You have nothing to use.");
3456 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR))) return;
3458 /* Get the item (in the pack) */
3461 o_ptr = &inventory[item];
3463 /* Get the item (on the floor) */
3466 o_ptr = &o_list[0 - item];
3469 switch (o_ptr->tval)
3481 do_cmd_eat_food_aux(item);
3488 do_cmd_aim_wand_aux(item);
3495 do_cmd_use_staff_aux(item);
3502 do_cmd_zap_rod_aux(item);
3506 /* Quaff a potion */
3509 do_cmd_quaff_potion_aux(item);
3516 /* Check some conditions */
3519 msg_print(_("目が見えない。", "You can't see anything."));
3524 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
3527 if (p_ptr->confused)
3529 msg_print(_("混乱していて読めない!", "You are too confused!"));
3533 do_cmd_read_scroll_aux(item, TRUE);
3542 do_cmd_fire_aux(item, &inventory[INVEN_BOW]);
3546 /* Activate an artifact */
3549 do_cmd_activate_aux(item);
3556 * @brief 魔道具術師の取り込んだ魔力一覧から選択/閲覧する /
3557 * @param only_browse 閲覧するだけならばTRUE
3558 * @return 選択した魔力のID、キャンセルならば-1を返す
3560 static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
3562 OBJECT_SUBTYPE_VALUE ext = 0;
3564 bool flag, request_list;
3565 OBJECT_TYPE_VALUE tval = 0;
3567 OBJECT_SUBTYPE_VALUE i = 0;
3570 int menu_line = (use_menu ? 1 : 0);
3574 if (repeat_pull(&sn))
3576 /* Verify the spell */
3577 if (sn >= EATER_EXT*2 && !(p_ptr->magic_num1[sn] > k_info[lookup_kind(TV_ROD, sn-EATER_EXT*2)].pval * (p_ptr->magic_num2[sn] - 1) * EATER_ROD_CHARGE))
3579 else if (sn < EATER_EXT*2 && !(p_ptr->magic_num1[sn] < EATER_CHARGE))
3583 #endif /* ALLOW_REPEAT */
3585 for (i = 0; i < 108; i++)
3587 if (p_ptr->magic_num2[i]) break;
3591 msg_print(_("魔法を覚えていない!", "You don't have any magic!"));
3602 prt(format(" %s 杖", (menu_line == 1) ? "》" : " "), 2, 14);
3603 prt(format(" %s 魔法棒", (menu_line == 2) ? "》" : " "), 3, 14);
3604 prt(format(" %s ロッド", (menu_line == 3) ? "》" : " "), 4, 14);
3606 prt(format(" %s staff", (menu_line == 1) ? "> " : " "), 2, 14);
3607 prt(format(" %s wand", (menu_line == 2) ? "> " : " "), 3, 14);
3608 prt(format(" %s rod", (menu_line == 3) ? "> " : " "), 4, 14);
3611 if (only_browse) prt(_("どの種類の魔法を見ますか?", "Which type of magic do you browse?"), 0, 0);
3612 else prt(_("どの種類の魔法を使いますか?", "Which type of magic do you use?"), 0, 0);
3635 ext = (menu_line-1)*EATER_EXT;
3636 if (menu_line == 1) tval = TV_STAFF;
3637 else if (menu_line == 2) tval = TV_WAND;
3641 if (menu_line > 3) menu_line -= 3;
3649 if (!get_com(_("[A] 杖, [B] 魔法棒, [C] ロッド:", "[A] staff, [B] wand, [C] rod:"), &choice, TRUE))
3653 if (choice == 'A' || choice == 'a')
3659 if (choice == 'B' || choice == 'b')
3665 if (choice == 'C' || choice == 'c')
3673 for (i = ext; i < ext + EATER_EXT; i++)
3675 if (p_ptr->magic_num2[i])
3677 if (use_menu) menu_line = i-ext+1;
3681 if (i == ext+EATER_EXT)
3683 msg_print(_("その種類の魔法は覚えていない!", "You don't have that type of magic!"));
3687 /* Nothing chosen yet */
3690 /* Build a prompt */
3691 if (only_browse) strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの魔力を見ますか?",
3692 "(*=List, ESC=exit) Browse which power? "));
3693 else strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの魔力を使いますか?",
3694 "(*=List, ESC=exit) Use which power? "));
3696 /* Save the screen */
3699 request_list = always_show_list;
3701 /* Get a spell from the user */
3705 if (request_list || use_menu)
3708 OBJECT_SUBTYPE_VALUE ctr;
3718 for (y = 1; y < 20; y++)
3723 /* Print header(s) */
3725 prt(format(" %s 失率 %s 失率", (tval == TV_ROD ? " 状態 " : "使用回数"), (tval == TV_ROD ? " 状態 " : "使用回数")), y++, x);
3727 prt(format(" %s Fail %s Fail", (tval == TV_ROD ? " Stat " : " Charges"), (tval == TV_ROD ? " Stat " : " Charges")), y++, x);
3731 for (ctr = 0; ctr < EATER_EXT; ctr++)
3733 if (!p_ptr->magic_num2[ctr+ext]) continue;
3735 k_idx = lookup_kind(tval, ctr);
3739 if (ctr == (menu_line-1))
3740 strcpy(dummy, _("》", "> "));
3744 /* letter/number for power selection */
3751 letter = '0' + ctr - 26;
3752 sprintf(dummy, "%c)",letter);
3754 x1 = ((ctr < EATER_EXT/2) ? x : x + 40);
3755 y1 = ((ctr < EATER_EXT/2) ? y + ctr : y + ctr - EATER_EXT/2);
3756 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
3757 chance = level * 4 / 5 + 20;
3758 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3760 if (p_ptr->lev > level)
3762 chance -= 3 * (p_ptr->lev - level);
3764 chance = mod_spell_chance_1(chance);
3765 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
3766 /* Stunning makes spells harder */
3767 if (p_ptr->stun > 50) chance += 25;
3768 else if (p_ptr->stun) chance += 15;
3770 if (chance > 95) chance = 95;
3772 chance = mod_spell_chance_2(chance);
3780 strcat(dummy, format(
3781 _(" %-22.22s 充填:%2d/%2d%3d%%", " %-22.22s (%2d/%2d) %3d%%"),
3782 k_name + k_info[k_idx].name,
3783 p_ptr->magic_num1[ctr+ext] ?
3784 (p_ptr->magic_num1[ctr+ext] - 1) / (EATER_ROD_CHARGE * k_info[k_idx].pval) +1 : 0,
3785 p_ptr->magic_num2[ctr+ext], chance));
3786 if (p_ptr->magic_num1[ctr+ext] > k_info[k_idx].pval * (p_ptr->magic_num2[ctr+ext]-1) * EATER_ROD_CHARGE) col = TERM_RED;
3790 strcat(dummy, format(" %-22.22s %2d/%2d %3d%%", k_name + k_info[k_idx].name, (s16b)(p_ptr->magic_num1[ctr+ext]/EATER_CHARGE), p_ptr->magic_num2[ctr+ext], chance));
3791 if (p_ptr->magic_num1[ctr+ext] < EATER_CHARGE) col = TERM_RED;
3796 c_prt(col, dummy, y1, x1);
3800 if (!get_com(out_val, &choice, FALSE)) break;
3802 if (use_menu && choice != ' ')
3818 menu_line += EATER_EXT - 1;
3819 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
3820 } while(!p_ptr->magic_num2[menu_line+ext-1]);
3831 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
3832 } while(!p_ptr->magic_num2[menu_line+ext-1]);
3843 bool reverse = FALSE;
3844 if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
3845 if (menu_line > EATER_EXT/2)
3847 menu_line -= EATER_EXT/2;
3850 else menu_line+=EATER_EXT/2;
3851 while(!p_ptr->magic_num2[menu_line+ext-1])
3856 if (menu_line < 2) reverse = FALSE;
3861 if (menu_line > EATER_EXT-1) reverse = TRUE;
3878 /* Request redraw */
3879 if (use_menu && ask) continue;
3881 /* Request redraw */
3882 if (!use_menu && ((choice == ' ') || (choice == '*') || (choice == '?')))
3888 request_list = FALSE;
3890 /* Restore the screen */
3895 request_list = TRUE;
3903 if (isalpha(choice))
3906 ask = (isupper(choice));
3909 if (ask) choice = (char)tolower(choice);
3911 /* Extract request */
3912 i = (islower(choice) ? A2I(choice) : -1);
3916 ask = FALSE; /* Can't uppercase digits */
3918 i = choice - '0' + 26;
3922 /* Totally Illegal */
3923 if ((i < 0) || (i > EATER_EXT) || !p_ptr->magic_num2[i+ext])
3937 (void) strnfmt(tmp_val, 78, _("%sを使いますか? ", "Use %s?"), k_name + k_info[lookup_kind(tval ,i)].name);
3939 /* Belay that order */
3940 if (!get_check(tmp_val)) continue;
3944 if (p_ptr->magic_num1[ext+i] > k_info[lookup_kind(tval, i)].pval * (p_ptr->magic_num2[ext+i] - 1) * EATER_ROD_CHARGE)
3946 msg_print(_("その魔法はまだ充填している最中だ。", "The magic are still charging."));
3948 if (use_menu) ask = TRUE;
3954 if (p_ptr->magic_num1[ext+i] < EATER_CHARGE)
3956 msg_print(_("その魔法は使用回数が切れている。", "The magic has no charges left."));
3958 if (use_menu) ask = TRUE;
3970 /* Clear lines, position cursor (really should use strlen here) */
3971 Term_erase(7, 23, 255);
3972 Term_erase(7, 22, 255);
3973 Term_erase(7, 21, 255);
3974 Term_erase(7, 20, 255);
3976 roff_to_buf(k_text + k_info[lookup_kind(tval, i)].text, 62, temp, sizeof(temp));
3977 for (j = 0, line = 21; temp[j]; j += 1 + strlen(&temp[j]))
3979 prt(&temp[j], line, 10);
3990 /* Restore the screen */
3993 if (!flag) return -1;
3997 #endif /* ALLOW_REPEAT */
4003 * @brief 取り込んだ魔力を利用するコマンドのメインルーチン /
4004 * Use eaten rod, wand or staff
4005 * @param only_browse 閲覧するだけならばTRUE
4006 * @param powerful 強力発動中の処理ならばTRUE
4007 * @return 実際にコマンドを実行したならばTRUEを返す。
4009 bool do_cmd_magic_eater(bool only_browse, bool powerful)
4011 OBJECT_SUBTYPE_VALUE item;
4015 OBJECT_TYPE_VALUE tval;
4016 OBJECT_SUBTYPE_VALUE sval;
4017 bool use_charge = TRUE;
4019 /* Not when confused */
4020 if (!only_browse && p_ptr->confused)
4022 msg_print(_("混乱していて唱えられない!", "You are too confused!"));
4026 item = select_magic_eater(only_browse);
4029 p_ptr->energy_use = 0;
4032 if (item >= EATER_EXT*2) {tval = TV_ROD;sval = item - EATER_EXT*2;}
4033 else if (item >= EATER_EXT) {tval = TV_WAND;sval = item - EATER_EXT;}
4034 else {tval = TV_STAFF; sval = item;}
4035 k_idx = lookup_kind(tval, sval);
4037 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
4038 chance = level * 4 / 5 + 20;
4039 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4041 if (p_ptr->lev > level)
4043 chance -= 3 * (p_ptr->lev - level);
4045 chance = mod_spell_chance_1(chance);
4046 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
4047 /* Stunning makes spells harder */
4048 if (p_ptr->stun > 50) chance += 25;
4049 else if (p_ptr->stun) chance += 15;
4051 if (chance > 95) chance = 95;
4053 chance = mod_spell_chance_2(chance);
4055 if (randint0(100) < chance)
4057 if (flush_failure) flush();
4059 msg_print(_("呪文をうまく唱えられなかった!", "You failed to get the magic off!"));
4061 if (randint1(100) >= chance)
4062 chg_virtue(V_CHANCE,-1);
4063 p_ptr->energy_use = 100;
4073 if ((sval >= SV_ROD_MIN_DIRECTION) && (sval != SV_ROD_HAVOC) && (sval != SV_ROD_AGGRAVATE) && (sval != SV_ROD_PESTICIDE))
4074 if (!get_aim_dir(&dir)) return FALSE;
4075 rod_effect(sval, dir, &use_charge, powerful, TRUE);
4076 if (!use_charge) return FALSE;
4078 else if (tval == TV_WAND)
4080 if (!get_aim_dir(&dir)) return FALSE;
4081 wand_effect(sval, dir, powerful, TRUE);
4085 staff_effect(sval, &use_charge, powerful, TRUE, TRUE);
4086 if (!use_charge) return FALSE;
4088 if (randint1(100) < chance)
4089 chg_virtue(V_CHANCE,1);
4091 p_ptr->energy_use = 100;
4092 if (tval == TV_ROD) p_ptr->magic_num1[item] += k_info[k_idx].pval * EATER_ROD_CHARGE;
4093 else p_ptr->magic_num1[item] -= EATER_CHARGE;