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).
59 * @brief ¿©ÎÁ¤ò¿©¤Ù¤ë¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó
60 * @param item ¿©¤Ù¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê»ýÉÊID
63 static void do_cmd_eat_food_aux(int item)
68 if (music_singing_any()) stop_singing();
69 if (hex_spelling_any()) stop_hex_spell_all();
71 /* Get the item (in the pack) */
74 o_ptr = &inventory[item];
77 /* Get the item (on the floor) */
80 o_ptr = &o_list[0 - item];
89 /* Identity not known yet */
93 lev = k_info[o_ptr->k_idx].level;
95 if (o_ptr->tval == TV_FOOD)
97 /* Analyze the food */
102 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
104 if (set_poisoned(p_ptr->poisoned + randint0(10) + 10))
112 case SV_FOOD_BLINDNESS:
114 if (!p_ptr->resist_blind)
116 if (set_blind(p_ptr->blind + randint0(200) + 200))
124 case SV_FOOD_PARANOIA:
126 if (!p_ptr->resist_fear)
128 if (set_afraid(p_ptr->afraid + randint0(10) + 10))
136 case SV_FOOD_CONFUSION:
138 if (!p_ptr->resist_conf)
140 if (set_confused(p_ptr->confused + randint0(10) + 10))
148 case SV_FOOD_HALLUCINATION:
150 if (!p_ptr->resist_chaos)
152 if (set_image(p_ptr->image + randint0(250) + 250))
160 case SV_FOOD_PARALYSIS:
162 if (!p_ptr->free_act)
164 if (set_paralyzed(p_ptr->paralyzed + randint0(10) + 10))
172 case SV_FOOD_WEAKNESS:
175 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "ÆÇÆþ¤ê¿©ÎÁ", -1);
177 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "poisonous food", -1);
180 (void)do_dec_stat(A_STR);
185 case SV_FOOD_SICKNESS:
188 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "ÆÇÆþ¤ê¿©ÎÁ", -1);
190 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "poisonous food", -1);
193 (void)do_dec_stat(A_CON);
198 case SV_FOOD_STUPIDITY:
201 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "ÆÇÆþ¤ê¿©ÎÁ", -1);
203 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "poisonous food", -1);
206 (void)do_dec_stat(A_INT);
211 case SV_FOOD_NAIVETY:
214 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "ÆÇÆþ¤ê¿©ÎÁ", -1);
216 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "poisonous food", -1);
219 (void)do_dec_stat(A_WIS);
224 case SV_FOOD_UNHEALTH:
227 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "ÆÇÆþ¤ê¿©ÎÁ", -1);
229 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "poisonous food", -1);
232 (void)do_dec_stat(A_CON);
237 case SV_FOOD_DISEASE:
240 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "ÆÇÆþ¤ê¿©ÎÁ", -1);
242 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "poisonous food", -1);
245 (void)do_dec_stat(A_STR);
250 case SV_FOOD_CURE_POISON:
252 if (set_poisoned(0)) ident = TRUE;
256 case SV_FOOD_CURE_BLINDNESS:
258 if (set_blind(0)) ident = TRUE;
262 case SV_FOOD_CURE_PARANOIA:
264 if (set_afraid(0)) ident = TRUE;
268 case SV_FOOD_CURE_CONFUSION:
270 if (set_confused(0)) ident = TRUE;
274 case SV_FOOD_CURE_SERIOUS:
276 if (hp_player(damroll(4, 8))) ident = TRUE;
280 case SV_FOOD_RESTORE_STR:
282 if (do_res_stat(A_STR)) ident = TRUE;
286 case SV_FOOD_RESTORE_CON:
288 if (do_res_stat(A_CON)) ident = TRUE;
292 case SV_FOOD_RESTORING:
294 if (do_res_stat(A_STR)) ident = TRUE;
295 if (do_res_stat(A_INT)) ident = TRUE;
296 if (do_res_stat(A_WIS)) ident = TRUE;
297 if (do_res_stat(A_DEX)) ident = TRUE;
298 if (do_res_stat(A_CON)) ident = TRUE;
299 if (do_res_stat(A_CHR)) ident = TRUE;
305 /* ¤½¤ì¤¾¤ì¤Î¿©¤Ùʪ¤Î´¶ÁÛ¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¸½ */
306 case SV_FOOD_BISCUIT:
308 msg_print("´Å¤¯¤Æ¥µ¥¯¥µ¥¯¤·¤Æ¤È¤Æ¤â¤ª¤¤¤·¤¤¡£");
315 msg_print("»õ¤´¤¿¤¨¤¬¤¢¤Ã¤Æ¤ª¤¤¤·¤¤¡£");
320 case SV_FOOD_SLIME_MOLD:
322 msg_print("¤³¤ì¤Ï¤Ê¤ó¤È¤â·ÁÍƤ·¤¬¤¿¤¤Ì£¤À¡£");
329 msg_print("¤³¤ì¤Ï¤ª¤¤¤·¤¤¡£");
335 case SV_FOOD_BISCUIT:
337 case SV_FOOD_SLIME_MOLD:
339 msg_print("That tastes good.");
346 case SV_FOOD_WAYBREAD:
349 msg_print("¤³¤ì¤Ï¤Ò¤¸¤ç¤¦¤ËÈþÌ£¤À¡£");
351 msg_print("That tastes good.");
354 (void)set_poisoned(0);
355 (void)hp_player(damroll(4, 8));
361 case SV_FOOD_PINT_OF_ALE:
363 msg_print("¤Î¤É¤´¤·Á֤䤫¤À¡£");
368 case SV_FOOD_PINT_OF_WINE:
370 msg_print("That tastes good.");
375 case SV_FOOD_PINT_OF_ALE:
376 case SV_FOOD_PINT_OF_WINE:
378 msg_print("That tastes good.");
387 /* Combine / Reorder the pack (later) */
388 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
390 if (!(object_is_aware(o_ptr)))
392 chg_virtue(V_KNOWLEDGE, -1);
393 chg_virtue(V_PATIENCE, -1);
394 chg_virtue(V_CHANCE, 1);
397 /* We have tried it */
398 if (o_ptr->tval == TV_FOOD) object_tried(o_ptr);
400 /* The player is now aware of the object */
401 if (ident && !object_is_aware(o_ptr))
404 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
408 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
411 /* Food can feed the player */
412 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
414 /* Reduced nutritional benefit */
415 (void)set_food(p_ptr->food + (o_ptr->pval / 10));
417 msg_print("¤¢¤Ê¤¿¤Î¤è¤¦¤Ê¼Ô¤Ë¤È¤Ã¤Æ¿©ÎȤʤɶϤ«¤Ê±ÉÍܤˤ·¤«¤Ê¤é¤Ê¤¤¡£");
419 msg_print("Mere victuals hold scant sustenance for a being such as yourself.");
422 if (p_ptr->food < PY_FOOD_ALERT) /* Hungry */
424 msg_print("¤¢¤Ê¤¿¤Îµ²¤¨¤Ï¿·Á¯¤Ê·ì¤Ë¤è¤Ã¤Æ¤Î¤ßËþ¤¿¤µ¤ì¤ë¡ª");
426 msg_print("Your hunger can only be satisfied with fresh blood!");
430 else if ((prace_is_(RACE_SKELETON) ||
431 prace_is_(RACE_GOLEM) ||
432 prace_is_(RACE_ZOMBIE) ||
433 prace_is_(RACE_SPECTRE)) &&
434 (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
438 if (o_ptr->tval == TV_STAFF &&
439 (item < 0) && (o_ptr->number > 1))
442 msg_print("¤Þ¤º¤Ï¾ó¤ò½¦¤ï¤Ê¤±¤ì¤Ð¡£");
444 msg_print("You must first pick up the staffs.");
450 staff = (o_ptr->tval == TV_STAFF) ? "¾ó" : "ËâË¡ËÀ";
452 staff = (o_ptr->tval == TV_STAFF) ? "staff" : "wand";
456 if (o_ptr->pval == 0)
459 msg_format("¤³¤Î%s¤Ë¤Ï¤â¤¦ËâÎϤ¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¡£", staff);
461 msg_format("The %s has no charges left.", staff);
464 o_ptr->ident |= (IDENT_EMPTY);
466 /* Combine / Reorder the pack (later) */
467 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
468 p_ptr->window |= (PW_INVEN);
474 msg_format("¤¢¤Ê¤¿¤Ï%s¤ÎËâÎϤò¥¨¥Í¥ë¥®¡¼¸»¤È¤·¤ÆµÛ¼ý¤·¤¿¡£", staff);
476 msg_format("You absorb mana of the %s as your energy.", staff);
479 /* Use a single charge */
483 set_food(p_ptr->food + 5000);
485 /* XXX Hack -- unstack if necessary */
486 if (o_ptr->tval == TV_STAFF &&
487 (item >= 0) && (o_ptr->number > 1))
492 /* Get local object */
495 /* Obtain a local object */
496 object_copy(q_ptr, o_ptr);
498 /* Modify quantity */
501 /* Restore the charges */
504 /* Unstack the used item */
506 p_ptr->total_weight -= q_ptr->weight;
507 item = inven_carry(q_ptr);
511 msg_format("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
513 msg_print("You unstack your staff.");
517 /* Describe charges in the pack */
520 inven_item_charges(item);
523 /* Describe charges on the floor */
526 floor_item_charges(0 - item);
530 p_ptr->window |= (PW_INVEN | PW_EQUIP);
532 /* Don't eat a staff/wand itself */
535 else if ((prace_is_(RACE_DEMON) ||
536 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
537 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
538 my_strchr("pht", r_info[o_ptr->pval].d_char)))
540 /* Drain vitality of humanoids */
541 char o_name[MAX_NLEN];
543 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
546 msg_format("%s¤Ïdz¤¨¾å¤ê³¥¤Ë¤Ê¤Ã¤¿¡£ÀºÎϤòµÛ¼ý¤·¤¿µ¤¤¬¤¹¤ë¡£", o_name);
548 msg_format("%^s is burnt to ashes. You absorb its vitality!", o_name);
550 (void)set_food(PY_FOOD_MAX - 1);
552 else if (prace_is_(RACE_SKELETON))
555 if (o_ptr->tval == TV_SKELETON ||
556 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
559 msg_print("¤¢¤Ê¤¿¤Ï¹ü¤Ç¼«Ê¬¤ÎÂΤòÊä¤Ã¤¿¡£");
561 msg_print("Your body absorbs the bone.");
563 set_food(p_ptr->food + 5000);
568 if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
569 (o_ptr->sval < SV_FOOD_BISCUIT)))
572 object_type *q_ptr = &forge;
575 msg_print("¿©¤Ùʪ¤¬¥¢¥´¤òÁÇÄ̤ꤷ¤ÆÍî¤Á¤¿¡ª");
577 msg_print("The food falls through your jaws!");
581 /* Create the item */
582 object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval));
584 /* Drop the object from heaven */
585 (void)drop_near(q_ptr, -1, py, px);
590 msg_print("¿©¤Ùʪ¤¬¥¢¥´¤òÁÇÄ̤ꤷ¤ÆÍî¤Á¡¢¾Ã¤¨¤¿¡ª");
592 msg_print("The food falls through your jaws and vanishes!");
597 else if (prace_is_(RACE_GOLEM) ||
598 prace_is_(RACE_ZOMBIE) ||
599 prace_is_(RACE_ENT) ||
600 prace_is_(RACE_DEMON) ||
601 prace_is_(RACE_ANDROID) ||
602 prace_is_(RACE_SPECTRE) ||
603 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
606 msg_print("À¸¼Ô¤Î¿©Êª¤Ï¤¢¤Ê¤¿¤Ë¤È¤Ã¤Æ¤Û¤È¤ó¤É±ÉÍܤˤʤé¤Ê¤¤¡£");
608 msg_print("The food of mortals is poor sustenance for you.");
611 set_food(p_ptr->food + ((o_ptr->pval) / 20));
613 else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
615 /* Waybread is always fully satisfying. */
616 set_food(MAX(p_ptr->food, PY_FOOD_MAX - 1));
620 /* Food can feed the player */
621 (void)set_food(p_ptr->food + o_ptr->pval);
624 /* Destroy a food in the pack */
627 inven_item_increase(item, -1);
628 inven_item_describe(item);
629 inven_item_optimize(item);
632 /* Destroy a food on the floor */
635 floor_item_increase(0 - item, -1);
636 floor_item_describe(0 - item);
637 floor_item_optimize(0 - item);
643 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥×¥ì¥¤¥ä¡¼¤¬¿©¤Ù¤ë¤³¤È¤¬¤Ç¤¤ë¤«¤òȽÄꤹ¤ë /
644 * Hook to determine if an object is eatable
645 * @param o_ptr ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
646 * @return ¿©¤Ù¤ë¤³¤È¤¬²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
648 static bool item_tester_hook_eatable(object_type *o_ptr)
650 if (o_ptr->tval==TV_FOOD) return TRUE;
653 if (prace_is_(RACE_SKELETON))
655 if (o_ptr->tval == TV_SKELETON ||
656 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
662 if (prace_is_(RACE_SKELETON) ||
663 prace_is_(RACE_GOLEM) ||
664 prace_is_(RACE_ZOMBIE) ||
665 prace_is_(RACE_SPECTRE))
667 if (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND)
670 else if (prace_is_(RACE_DEMON) ||
671 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON))
673 if (o_ptr->tval == TV_CORPSE &&
674 o_ptr->sval == SV_CORPSE &&
675 my_strchr("pht", r_info[o_ptr->pval].d_char))
685 * @brief ¿©ÎÁ¤ò¿©¤Ù¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
686 * Eat some food (from the pack or floor)
689 void do_cmd_eat_food(void)
695 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
697 set_action(ACTION_NONE);
700 /* Restrict choices to food */
701 item_tester_hook = item_tester_hook_eatable;
705 q = "¤É¤ì¤ò¿©¤Ù¤Þ¤¹¤«? ";
706 s = "¿©¤Ùʪ¤¬¤Ê¤¤¡£";
708 q = "Eat which item? ";
709 s = "You have nothing to eat.";
712 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
715 do_cmd_eat_food_aux(item);
720 * @brief Ìô¤ò°û¤à¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
721 * Quaff a potion (from the pack or the floor)
722 * @param item °û¤àÌô¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê»ýÉÊID
725 static void do_cmd_quaff_potion_aux(int item)
738 if (flush_failure) flush();
740 msg_print("ÉÓ¤«¤é¿å¤¬Î®¤ì½Ð¤Æ¤³¤Ê¤¤¡ª");
742 msg_print("The potion doesn't flow out from a bottle.");
749 if (music_singing_any()) stop_singing();
750 if (hex_spelling_any())
752 if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all();
755 /* Get the item (in the pack) */
758 o_ptr = &inventory[item];
761 /* Get the item (on the floor) */
764 o_ptr = &o_list[0 - item];
767 /* Get local object */
770 /* Obtain a local object */
771 object_copy(q_ptr, o_ptr);
776 /* Reduce and describe inventory */
779 inven_item_increase(item, -1);
780 inven_item_describe(item);
781 inven_item_optimize(item);
784 /* Reduce and describe floor item */
787 floor_item_increase(0 - item, -1);
788 floor_item_describe(0 - item);
789 floor_item_optimize(0 - item);
796 /* Not identified yet */
800 lev = k_info[q_ptr->k_idx].level;
802 /* Analyze the potion */
803 if (q_ptr->tval == TV_POTION)
808 /* °û¤ß¤´¤¿¤¨¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¸½ */
809 case SV_POTION_WATER:
810 msg_print("¸ý¤ÎÃ椬¤µ¤Ã¤Ñ¤ê¤·¤¿¡£");
811 msg_print("¤Î¤É¤Î³é¤¤¬¾¯¤·¤ª¤µ¤Þ¤Ã¤¿¡£");
815 case SV_POTION_APPLE_JUICE:
816 msg_print("´Å¤¯¤Æ¥µ¥Ã¥Ñ¥ê¤È¤·¤Æ¤¤¤Æ¡¢¤È¤Æ¤â¤ª¤¤¤·¤¤¡£");
817 msg_print("¤Î¤É¤Î³é¤¤¬¾¯¤·¤ª¤µ¤Þ¤Ã¤¿¡£");
821 case SV_POTION_SLIME_MOLD:
822 msg_print("¤Ê¤ó¤È¤âÉÔµ¤Ì£¤ÊÌ£¤À¡£");
823 msg_print("¤Î¤É¤Î³é¤¤¬¾¯¤·¤ª¤µ¤Þ¤Ã¤¿¡£");
828 case SV_POTION_WATER:
829 case SV_POTION_APPLE_JUICE:
830 case SV_POTION_SLIME_MOLD:
831 msg_print("You feel less thirsty.");
836 case SV_POTION_SLOWNESS:
837 if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE;
840 case SV_POTION_SALT_WATER:
842 msg_print("¤¦¤§¡ª»×¤ï¤ºÅǤ¤¤Æ¤·¤Þ¤Ã¤¿¡£");
844 msg_print("The potion makes you vomit!");
847 if (!(prace_is_(RACE_GOLEM) ||
848 prace_is_(RACE_ZOMBIE) ||
849 prace_is_(RACE_DEMON) ||
850 prace_is_(RACE_ANDROID) ||
851 prace_is_(RACE_SPECTRE) ||
852 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
854 /* Only living creatures get thirsty */
855 (void)set_food(PY_FOOD_STARVE - 1);
858 (void)set_poisoned(0);
859 (void)set_paralyzed(p_ptr->paralyzed + 4);
863 case SV_POTION_POISON:
864 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
866 if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))
873 case SV_POTION_BLINDNESS:
874 if (!p_ptr->resist_blind)
876 if (set_blind(p_ptr->blind + randint0(100) + 100))
883 case SV_POTION_CONFUSION: /* Booze */
884 if (p_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1);
885 else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN;
886 if (!p_ptr->resist_conf)
888 if (set_confused(randint0(20) + 15))
894 if (!p_ptr->resist_chaos)
898 if (set_image(p_ptr->image + randint0(150) + 150))
903 if (one_in_(13) && (p_ptr->pclass != CLASS_MONK))
906 if (one_in_(3)) lose_all_info();
908 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
911 msg_print("ÃΤé¤Ê¤¤¾ì½ê¤ÇÌܤ¬Àä᤿¡£Æ¬Äˤ¬¤¹¤ë¡£");
912 msg_print("²¿¤â»×¤¤½Ð¤»¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ØÍ褿¤Î¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
914 msg_print("You wake up somewhere with a sore head...");
915 msg_print("You can't remember a thing, or how you got here!");
922 case SV_POTION_SLEEP:
923 if (!p_ptr->free_act)
926 msg_print("¤¢¤Ê¤¿¤Ï̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
928 msg_print("You fall asleep.");
932 if (ironman_nightmare)
935 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
937 msg_print("A horrible vision enters your mind.");
941 /* Pick a nightmare */
942 get_mon_num_prep(get_nightmare, NULL);
944 /* Have some nightmares */
945 have_nightmare(get_mon_num(MAX_DEPTH));
947 /* Remove the monster restriction */
948 get_mon_num_prep(NULL, NULL);
950 if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))
957 case SV_POTION_LOSE_MEMORIES:
958 if (!p_ptr->hold_exp && (p_ptr->exp > 0))
961 msg_print("²áµî¤Îµ²±¤¬Çö¤ì¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
963 msg_print("You feel your memories fade.");
965 chg_virtue(V_KNOWLEDGE, -5);
967 lose_exp(p_ptr->exp / 4);
972 case SV_POTION_RUINATION:
974 msg_print("¿È¤â¿´¤â¼å¤Ã¤Æ¤¤Æ¡¢Àºµ¤¤¬È´¤±¤Æ¤¤¤¯¤è¤¦¤À¡£");
975 take_hit(DAMAGE_LOSELIFE, damroll(10, 10), "ÇËÌǤÎÌô", -1);
977 msg_print("Your nerves and muscles feel weak and lifeless!");
978 take_hit(DAMAGE_LOSELIFE, damroll(10, 10), "a potion of Ruination", -1);
981 (void)dec_stat(A_DEX, 25, TRUE);
982 (void)dec_stat(A_WIS, 25, TRUE);
983 (void)dec_stat(A_CON, 25, TRUE);
984 (void)dec_stat(A_STR, 25, TRUE);
985 (void)dec_stat(A_CHR, 25, TRUE);
986 (void)dec_stat(A_INT, 25, TRUE);
990 case SV_POTION_DEC_STR:
991 if (do_dec_stat(A_STR)) ident = TRUE;
994 case SV_POTION_DEC_INT:
995 if (do_dec_stat(A_INT)) ident = TRUE;
998 case SV_POTION_DEC_WIS:
999 if (do_dec_stat(A_WIS)) ident = TRUE;
1002 case SV_POTION_DEC_DEX:
1003 if (do_dec_stat(A_DEX)) ident = TRUE;
1006 case SV_POTION_DEC_CON:
1007 if (do_dec_stat(A_CON)) ident = TRUE;
1010 case SV_POTION_DEC_CHR:
1011 if (do_dec_stat(A_CHR)) ident = TRUE;
1014 case SV_POTION_DETONATIONS:
1016 msg_print("ÂΤÎÃæ¤Ç·ã¤·¤¤Çúȯ¤¬µ¯¤¤¿¡ª");
1017 take_hit(DAMAGE_NOESCAPE, damroll(50, 20), "Çúȯ¤ÎÌô", -1);
1019 msg_print("Massive explosions rupture your body!");
1020 take_hit(DAMAGE_NOESCAPE, damroll(50, 20), "a potion of Detonation", -1);
1023 (void)set_stun(p_ptr->stun + 75);
1024 (void)set_cut(p_ptr->cut + 5000);
1028 case SV_POTION_DEATH:
1029 chg_virtue(V_VITALITY, -1);
1030 chg_virtue(V_UNLIFE, 5);
1032 msg_print("»à¤Îͽ´¶¤¬ÂÎÃæ¤ò¶î¤±¤á¤°¤Ã¤¿¡£");
1033 take_hit(DAMAGE_LOSELIFE, 5000, "»à¤ÎÌô", -1);
1035 msg_print("A feeling of Death flows through your body.");
1036 take_hit(DAMAGE_LOSELIFE, 5000, "a potion of Death", -1);
1042 case SV_POTION_INFRAVISION:
1043 if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))
1049 case SV_POTION_DETECT_INVIS:
1050 if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))
1056 case SV_POTION_SLOW_POISON:
1057 if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE;
1060 case SV_POTION_CURE_POISON:
1061 if (set_poisoned(0)) ident = TRUE;
1064 case SV_POTION_BOLDNESS:
1065 if (set_afraid(0)) ident = TRUE;
1068 case SV_POTION_SPEED:
1071 if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;
1075 (void)set_fast(p_ptr->fast + 5, FALSE);
1079 case SV_POTION_RESIST_HEAT:
1080 if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))
1086 case SV_POTION_RESIST_COLD:
1087 if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))
1093 case SV_POTION_HEROISM:
1094 if (set_afraid(0)) ident = TRUE;
1095 if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE;
1096 if (hp_player(10)) ident = TRUE;
1099 case SV_POTION_BESERK_STRENGTH:
1100 if (set_afraid(0)) ident = TRUE;
1101 if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE;
1102 if (hp_player(30)) ident = TRUE;
1105 case SV_POTION_CURE_LIGHT:
1106 if (hp_player(damroll(2, 8))) ident = TRUE;
1107 if (set_blind(0)) ident = TRUE;
1108 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
1109 if (set_shero(0,TRUE)) ident = TRUE;
1112 case SV_POTION_CURE_SERIOUS:
1113 if (hp_player(damroll(4, 8))) ident = TRUE;
1114 if (set_blind(0)) ident = TRUE;
1115 if (set_confused(0)) ident = TRUE;
1116 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
1117 if (set_shero(0,TRUE)) ident = TRUE;
1120 case SV_POTION_CURE_CRITICAL:
1121 if (hp_player(damroll(6, 8))) ident = TRUE;
1122 if (set_blind(0)) ident = TRUE;
1123 if (set_confused(0)) ident = TRUE;
1124 if (set_poisoned(0)) ident = TRUE;
1125 if (set_stun(0)) ident = TRUE;
1126 if (set_cut(0)) ident = TRUE;
1127 if (set_shero(0,TRUE)) ident = TRUE;
1130 case SV_POTION_HEALING:
1131 if (hp_player(300)) ident = TRUE;
1132 if (set_blind(0)) ident = TRUE;
1133 if (set_confused(0)) ident = TRUE;
1134 if (set_poisoned(0)) ident = TRUE;
1135 if (set_stun(0)) ident = TRUE;
1136 if (set_cut(0)) ident = TRUE;
1137 if (set_shero(0,TRUE)) ident = TRUE;
1140 case SV_POTION_STAR_HEALING:
1141 if (hp_player(1200)) ident = TRUE;
1142 if (set_blind(0)) ident = TRUE;
1143 if (set_confused(0)) ident = TRUE;
1144 if (set_poisoned(0)) ident = TRUE;
1145 if (set_stun(0)) ident = TRUE;
1146 if (set_cut(0)) ident = TRUE;
1147 if (set_shero(0,TRUE)) ident = TRUE;
1150 case SV_POTION_LIFE:
1151 chg_virtue(V_VITALITY, 1);
1152 chg_virtue(V_UNLIFE, -5);
1154 msg_print("ÂÎÃæ¤ËÀ¸Ì¿ÎϤ¬Ëþ¤Á¤¢¤Õ¤ì¤Æ¤¤¿¡ª");
1156 msg_print("You feel life flow through your body!");
1160 (void)set_poisoned(0);
1162 (void)set_confused(0);
1166 (void)do_res_stat(A_STR);
1167 (void)do_res_stat(A_CON);
1168 (void)do_res_stat(A_DEX);
1169 (void)do_res_stat(A_WIS);
1170 (void)do_res_stat(A_INT);
1171 (void)do_res_stat(A_CHR);
1172 (void)set_shero(0,TRUE);
1178 case SV_POTION_RESTORE_MANA:
1179 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1182 for (i = 0; i < EATER_EXT*2; i++)
1184 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3;
1185 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;
1187 for (; i < EATER_EXT*3; i++)
1189 int k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);
1190 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;
1191 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
1194 msg_print("Ƭ¤¬¥Ï¥Ã¥¥ê¤È¤·¤¿¡£");
1196 msg_print("You feel your head clear.");
1198 p_ptr->window |= (PW_PLAYER);
1201 else if (p_ptr->csp < p_ptr->msp)
1203 p_ptr->csp = p_ptr->msp;
1204 p_ptr->csp_frac = 0;
1206 msg_print("Ƭ¤¬¥Ï¥Ã¥¥ê¤È¤·¤¿¡£");
1208 msg_print("You feel your head clear.");
1211 p_ptr->redraw |= (PR_MANA);
1212 p_ptr->window |= (PW_PLAYER);
1213 p_ptr->window |= (PW_SPELL);
1216 if (set_shero(0,TRUE)) ident = TRUE;
1219 case SV_POTION_RESTORE_EXP:
1220 if (restore_level()) ident = TRUE;
1223 case SV_POTION_RES_STR:
1224 if (do_res_stat(A_STR)) ident = TRUE;
1227 case SV_POTION_RES_INT:
1228 if (do_res_stat(A_INT)) ident = TRUE;
1231 case SV_POTION_RES_WIS:
1232 if (do_res_stat(A_WIS)) ident = TRUE;
1235 case SV_POTION_RES_DEX:
1236 if (do_res_stat(A_DEX)) ident = TRUE;
1239 case SV_POTION_RES_CON:
1240 if (do_res_stat(A_CON)) ident = TRUE;
1243 case SV_POTION_RES_CHR:
1244 if (do_res_stat(A_CHR)) ident = TRUE;
1247 case SV_POTION_INC_STR:
1248 if (do_inc_stat(A_STR)) ident = TRUE;
1251 case SV_POTION_INC_INT:
1252 if (do_inc_stat(A_INT)) ident = TRUE;
1255 case SV_POTION_INC_WIS:
1256 if (do_inc_stat(A_WIS)) ident = TRUE;
1259 case SV_POTION_INC_DEX:
1260 if (do_inc_stat(A_DEX)) ident = TRUE;
1263 case SV_POTION_INC_CON:
1264 if (do_inc_stat(A_CON)) ident = TRUE;
1267 case SV_POTION_INC_CHR:
1268 if (do_inc_stat(A_CHR)) ident = TRUE;
1271 case SV_POTION_AUGMENTATION:
1272 if (do_inc_stat(A_STR)) ident = TRUE;
1273 if (do_inc_stat(A_INT)) ident = TRUE;
1274 if (do_inc_stat(A_WIS)) ident = TRUE;
1275 if (do_inc_stat(A_DEX)) ident = TRUE;
1276 if (do_inc_stat(A_CON)) ident = TRUE;
1277 if (do_inc_stat(A_CHR)) ident = TRUE;
1280 case SV_POTION_ENLIGHTENMENT:
1282 msg_print("¼«Ê¬¤ÎÃÖ¤«¤ì¤Æ¤¤¤ë¾õ¶·¤¬Ç¾Î¢¤ËÉ⤫¤ó¤Ç¤¤¿...");
1284 msg_print("An image of your surroundings forms in your mind...");
1287 chg_virtue(V_KNOWLEDGE, 1);
1288 chg_virtue(V_ENLIGHTEN, 1);
1293 case SV_POTION_STAR_ENLIGHTENMENT:
1295 msg_print("¹¹¤Ê¤ë·¼Ìؤò´¶¤¸¤¿...");
1297 msg_print("You begin to feel more enlightened...");
1300 chg_virtue(V_KNOWLEDGE, 1);
1301 chg_virtue(V_ENLIGHTEN, 2);
1304 (void)do_inc_stat(A_INT);
1305 (void)do_inc_stat(A_WIS);
1306 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
1307 (void)detect_doors(DETECT_RAD_DEFAULT);
1308 (void)detect_stairs(DETECT_RAD_DEFAULT);
1309 (void)detect_treasure(DETECT_RAD_DEFAULT);
1310 (void)detect_objects_gold(DETECT_RAD_DEFAULT);
1311 (void)detect_objects_normal(DETECT_RAD_DEFAULT);
1317 case SV_POTION_SELF_KNOWLEDGE:
1319 msg_print("¼«Ê¬¼«¿È¤Î¤³¤È¤¬¾¯¤·¤Ïʬ¤«¤Ã¤¿µ¤¤¬¤¹¤ë...");
1321 msg_print("You begin to know yourself a little better...");
1329 case SV_POTION_EXPERIENCE:
1330 if (p_ptr->prace == RACE_ANDROID) break;
1331 chg_virtue(V_ENLIGHTEN, 1);
1332 if (p_ptr->exp < PY_MAX_EXP)
1334 s32b ee = (p_ptr->exp / 2) + 10;
1335 if (ee > 100000L) ee = 100000L;
1337 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
1339 msg_print("You feel more experienced.");
1347 case SV_POTION_RESISTANCE:
1348 (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);
1349 (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
1350 (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
1351 (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);
1352 (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
1356 case SV_POTION_CURING:
1357 if (hp_player(50)) ident = TRUE;
1358 if (set_blind(0)) ident = TRUE;
1359 if (set_poisoned(0)) ident = TRUE;
1360 if (set_confused(0)) ident = TRUE;
1361 if (set_stun(0)) ident = TRUE;
1362 if (set_cut(0)) ident = TRUE;
1363 if (set_image(0)) ident = TRUE;
1366 case SV_POTION_INVULNERABILITY:
1367 (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);
1371 case SV_POTION_NEW_LIFE:
1372 do_cmd_rerate(FALSE);
1374 p_ptr->update |= PU_BONUS;
1375 if (p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3)
1377 chg_virtue(V_CHANCE, -5);
1379 msg_print("Á´¤Æ¤ÎÆÍÁ³ÊÑ°Û¤¬¼£¤Ã¤¿¡£");
1381 msg_print("You are cured of all mutations.");
1384 p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
1385 p_ptr->update |= PU_BONUS;
1387 mutant_regenerate_mod = calc_mutant_regenerate_mod();
1392 case SV_POTION_NEO_TSUYOSHI:
1394 (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
1398 case SV_POTION_TSUYOSHI:
1400 msg_print("¡Ö¥ª¥¯¥ì·»¤µ¤ó¡ª¡×");
1402 msg_print("Brother OKURE!");
1405 p_ptr->tsuyoshi = 1;
1406 (void)set_tsuyoshi(0, TRUE);
1407 if (!p_ptr->resist_chaos)
1409 (void)set_image(50 + randint1(50));
1414 case SV_POTION_POLYMORPH:
1415 if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
1417 chg_virtue(V_CHANCE, -5);
1419 msg_print("Á´¤Æ¤ÎÆÍÁ³ÊÑ°Û¤¬¼£¤Ã¤¿¡£");
1421 msg_print("You are cured of all mutations.");
1424 p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
1425 p_ptr->update |= PU_BONUS;
1434 if(gain_random_mutation(0)) ident = TRUE;
1436 else if (lose_mutation(0)) ident = TRUE;
1437 } while(!ident || one_in_(2));
1443 if (prace_is_(RACE_SKELETON))
1446 msg_print("±ÕÂΤΰìÉô¤Ï¤¢¤Ê¤¿¤Î¥¢¥´¤òÁÇÄ̤ꤷ¤ÆÍî¤Á¤¿¡ª");
1448 msg_print("Some of the fluid falls through your jaws!");
1451 (void)potion_smash_effect(0, py, px, q_ptr->k_idx);
1454 /* Combine / Reorder the pack (later) */
1455 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1457 if (!(object_is_aware(q_ptr)))
1459 chg_virtue(V_PATIENCE, -1);
1460 chg_virtue(V_CHANCE, 1);
1461 chg_virtue(V_KNOWLEDGE, -1);
1464 /* The item has been tried */
1465 object_tried(q_ptr);
1467 /* An identification was made */
1468 if (ident && !object_is_aware(q_ptr))
1470 object_aware(q_ptr);
1471 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1475 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1477 /* Potions can feed the player */
1478 switch (p_ptr->mimic_form)
1481 switch (p_ptr->prace)
1484 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
1493 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1496 if (q_ptr->tval == TV_FLASK)
1499 msg_print("¥ª¥¤¥ë¤òÊäµë¤·¤¿¡£");
1501 msg_print("You replenish yourself with the oil.");
1503 set_food(p_ptr->food + 5000);
1507 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1512 msg_print("¿åʬ¤ò¼è¤ê¹þ¤ó¤À¡£");
1514 msg_print("You are moistened.");
1516 set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
1519 (void)set_food(p_ptr->food + q_ptr->pval);
1524 case MIMIC_DEMON_LORD:
1525 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1528 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
1531 (void)set_food(p_ptr->food + q_ptr->pval);
1538 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥×¥ì¥¤¥ä¡¼¤¬°û¤à¤³¤È¤¬¤Ç¤¤ë¤«¤òȽÄꤹ¤ë /
1539 * Hook to determine if an object can be quaffed
1540 * @param o_ptr ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1541 * @return °û¤à¤³¤È¤¬²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
1543 static bool item_tester_hook_quaff(object_type *o_ptr)
1545 if (o_ptr->tval == TV_POTION) return TRUE;
1547 if (prace_is_(RACE_ANDROID))
1549 if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL)
1557 * @brief Ìô¤ò°û¤à¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
1558 * Quaff some potion (from the pack or floor)
1561 void do_cmd_quaff_potion(void)
1566 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1568 set_action(ACTION_NONE);
1571 /* Restrict choices to potions */
1572 item_tester_hook = item_tester_hook_quaff;
1576 q = "¤É¤ÎÌô¤ò°û¤ß¤Þ¤¹¤«? ";
1577 s = "°û¤á¤ëÌô¤¬¤Ê¤¤¡£";
1579 q = "Quaff which potion? ";
1580 s = "You have no potions to quaff.";
1583 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1585 /* Quaff the potion */
1586 do_cmd_quaff_potion_aux(item);
1591 * @brief ´¬Êª¤òÆɤॳ¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó
1592 * Read a scroll (from the pack or floor).
1593 * @param item Æɤ४¥Ö¥¸¥§¥¯¥È¤Î½ê»ýÉÊID
1594 * @param known ȽÌÀºÑ¤Ê¤é¤ÐTRUE
1598 * Certain scrolls can be "aborted" without losing the scroll. These
1599 * include scrolls with no effects but recharge or identify, which are
1600 * cancelled before use. XXX Reading them still takes a turn, though.
1603 static void do_cmd_read_scroll_aux(int item, bool known)
1605 int k, used_up, ident, lev;
1609 /* Get the item (in the pack) */
1612 o_ptr = &inventory[item];
1615 /* Get the item (on the floor) */
1618 o_ptr = &o_list[0 - item];
1627 if (flush_failure) flush();
1629 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
1631 msg_print("Nothing happen.");
1638 if (p_ptr->pclass == CLASS_BERSERKER)
1641 msg_print("´¬Êª¤Ê¤ó¤ÆÆɤá¤Ê¤¤¡£");
1643 msg_print("You cannot read.");
1648 if (music_singing_any()) stop_singing();
1651 if (hex_spelling_any() && ((p_ptr->lev < 35) || hex_spell_fully())) stop_hex_spell_all();
1653 /* Not identified yet */
1657 lev = k_info[o_ptr->k_idx].level;
1659 /* Assume the scroll will get used up */
1662 if (o_ptr->tval == TV_SCROLL)
1664 /* Analyze the scroll */
1665 switch (o_ptr->sval)
1667 case SV_SCROLL_DARKNESS:
1669 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
1671 (void)set_blind(p_ptr->blind + 3 + randint1(5));
1673 if (unlite_area(10, 3)) ident = TRUE;
1677 case SV_SCROLL_AGGRAVATE_MONSTER:
1680 msg_print("¥«¥ó¹â¤¯¤¦¤Ê¤ëÍͤʲ»¤¬ÊÕ¤ê¤òʤ¤Ã¤¿¡£");
1682 msg_print("There is a high pitched humming noise.");
1685 aggravate_monsters(0);
1690 case SV_SCROLL_CURSE_ARMOR:
1692 if (curse_armor()) ident = TRUE;
1696 case SV_SCROLL_CURSE_WEAPON:
1699 if (buki_motteruka(INVEN_RARM))
1702 if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
1704 else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM;
1705 if (k && curse_weapon(FALSE, k)) ident = TRUE;
1709 case SV_SCROLL_SUMMON_MONSTER:
1711 for (k = 0; k < randint1(3); k++)
1713 if (summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
1721 case SV_SCROLL_SUMMON_UNDEAD:
1723 for (k = 0; k < randint1(3); k++)
1725 if (summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
1733 case SV_SCROLL_SUMMON_PET:
1735 if (summon_specific(-1, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET)))
1742 case SV_SCROLL_SUMMON_KIN:
1744 if (summon_kin_player(p_ptr->lev, py, px, (PM_FORCE_PET | PM_ALLOW_GROUP)))
1751 case SV_SCROLL_TRAP_CREATION:
1753 if (trap_creation(py, px)) ident = TRUE;
1757 case SV_SCROLL_PHASE_DOOR:
1759 teleport_player(10, 0L);
1764 case SV_SCROLL_TELEPORT:
1766 teleport_player(100, 0L);
1771 case SV_SCROLL_TELEPORT_LEVEL:
1773 (void)teleport_level(0);
1778 case SV_SCROLL_WORD_OF_RECALL:
1780 if (!word_of_recall()) used_up = FALSE;
1785 case SV_SCROLL_IDENTIFY:
1787 if (!ident_spell(FALSE)) used_up = FALSE;
1792 case SV_SCROLL_STAR_IDENTIFY:
1794 if (!identify_fully(FALSE)) used_up = FALSE;
1799 case SV_SCROLL_REMOVE_CURSE:
1804 msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
1806 msg_print("You feel as if someone is watching over you.");
1814 case SV_SCROLL_STAR_REMOVE_CURSE:
1816 if (remove_all_curse())
1819 msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
1821 msg_print("You feel as if someone is watching over you.");
1828 case SV_SCROLL_ENCHANT_ARMOR:
1831 if (!enchant_spell(0, 0, 1)) used_up = FALSE;
1835 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
1837 if (!enchant_spell(1, 0, 0)) used_up = FALSE;
1842 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
1844 if (!enchant_spell(0, 1, 0)) used_up = FALSE;
1849 case SV_SCROLL_STAR_ENCHANT_ARMOR:
1851 if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
1856 case SV_SCROLL_STAR_ENCHANT_WEAPON:
1858 if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
1863 case SV_SCROLL_RECHARGING:
1865 if (!recharge(130)) used_up = FALSE;
1870 case SV_SCROLL_MUNDANITY:
1873 if (!mundane_spell(FALSE)) used_up = FALSE;
1877 case SV_SCROLL_LIGHT:
1879 if (lite_area(damroll(2, 8), 2)) ident = TRUE;
1883 case SV_SCROLL_MAPPING:
1885 map_area(DETECT_RAD_MAP);
1890 case SV_SCROLL_DETECT_GOLD:
1892 if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
1893 if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
1897 case SV_SCROLL_DETECT_ITEM:
1899 if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
1903 case SV_SCROLL_DETECT_TRAP:
1905 if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
1909 case SV_SCROLL_DETECT_DOOR:
1911 if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
1912 if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
1916 case SV_SCROLL_DETECT_INVIS:
1918 if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
1922 case SV_SCROLL_SATISFY_HUNGER:
1924 if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
1928 case SV_SCROLL_BLESSING:
1930 if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
1934 case SV_SCROLL_HOLY_CHANT:
1936 if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
1940 case SV_SCROLL_HOLY_PRAYER:
1942 if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
1946 case SV_SCROLL_MONSTER_CONFUSION:
1948 if (!(p_ptr->special_attack & ATTACK_CONFUSE))
1951 msg_print("¼ê¤¬µ±¤»Ï¤á¤¿¡£");
1953 msg_print("Your hands begin to glow.");
1956 p_ptr->special_attack |= ATTACK_CONFUSE;
1957 p_ptr->redraw |= (PR_STATUS);
1963 case SV_SCROLL_PROTECTION_FROM_EVIL:
1966 if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
1970 case SV_SCROLL_RUNE_OF_PROTECTION:
1977 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
1979 if (destroy_doors_touch()) ident = TRUE;
1983 case SV_SCROLL_STAR_DESTRUCTION:
1985 if (destroy_area(py, px, 13 + randint0(5), FALSE))
1989 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Íɤ줿...");
1991 msg_print("The dungeon trembles...");
1998 case SV_SCROLL_DISPEL_UNDEAD:
2000 if (dispel_undead(80)) ident = TRUE;
2004 case SV_SCROLL_SPELL:
2006 if ((p_ptr->pclass == CLASS_WARRIOR) ||
2007 (p_ptr->pclass == CLASS_IMITATOR) ||
2008 (p_ptr->pclass == CLASS_MINDCRAFTER) ||
2009 (p_ptr->pclass == CLASS_SORCERER) ||
2010 (p_ptr->pclass == CLASS_ARCHER) ||
2011 (p_ptr->pclass == CLASS_MAGIC_EATER) ||
2012 (p_ptr->pclass == CLASS_RED_MAGE) ||
2013 (p_ptr->pclass == CLASS_SAMURAI) ||
2014 (p_ptr->pclass == CLASS_BLUE_MAGE) ||
2015 (p_ptr->pclass == CLASS_CAVALRY) ||
2016 (p_ptr->pclass == CLASS_BERSERKER) ||
2017 (p_ptr->pclass == CLASS_SMITH) ||
2018 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
2019 (p_ptr->pclass == CLASS_NINJA) ||
2020 (p_ptr->pclass == CLASS_SNIPER)) break;
2021 p_ptr->add_spells++;
2022 p_ptr->update |= (PU_SPELLS);
2027 case SV_SCROLL_GENOCIDE:
2029 (void)symbol_genocide(300, TRUE);
2034 case SV_SCROLL_MASS_GENOCIDE:
2036 (void)mass_genocide(300, TRUE);
2041 case SV_SCROLL_ACQUIREMENT:
2043 acquirement(py, px, 1, TRUE, FALSE, FALSE);
2048 case SV_SCROLL_STAR_ACQUIREMENT:
2050 acquirement(py, px, randint1(2) + 1, TRUE, FALSE, FALSE);
2055 /* New Hengband scrolls */
2056 case SV_SCROLL_FIRE:
2058 fire_ball(GF_FIRE, 0, 666, 4);
2059 /* Note: "Double" damage since it is centered on the player ... */
2060 if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
2062 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), "±ê¤Î´¬Êª", -1);
2064 take_hit(DAMAGE_NOESCAPE, 50 + randint1(50), "a Scroll of Fire", -1);
2074 fire_ball(GF_ICE, 0, 777, 4);
2075 if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
2077 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), "ɹ¤Î´¬Êª", -1);
2079 take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "a Scroll of Ice", -1);
2086 case SV_SCROLL_CHAOS:
2088 fire_ball(GF_CHAOS, 0, 1000, 4);
2089 if (!p_ptr->resist_chaos)
2091 take_hit(DAMAGE_NOESCAPE, 111+randint1(111), "¥í¥°¥ë¥¹¤Î´¬Êª", -1);
2093 take_hit(DAMAGE_NOESCAPE, 111 + randint1(111), "a Scroll of Logrus", -1);
2100 case SV_SCROLL_RUMOR:
2103 msg_print("´¬Êª¤Ë¤Ï¥á¥Ã¥»¡¼¥¸¤¬½ñ¤«¤ì¤Æ¤¤¤ë:");
2105 msg_print("There is message on the scroll. It says:");
2109 display_rumor(TRUE);
2112 msg_print("´¬Êª¤Ï±ì¤òΩ¤Æ¤Æ¾Ã¤¨µî¤Ã¤¿¡ª");
2114 msg_print("The scroll disappears in a puff of smoke!");
2121 case SV_SCROLL_ARTIFACT:
2124 if (!artifact_scroll()) used_up = FALSE;
2128 case SV_SCROLL_RESET_RECALL:
2131 if (!reset_recall()) used_up = FALSE;
2135 case SV_SCROLL_AMUSEMENT:
2138 amusement(py, px, 1, FALSE);
2142 case SV_SCROLL_STAR_AMUSEMENT:
2145 amusement(py, px, randint1(2) + 1, FALSE);
2150 else if (o_ptr->name1 == ART_GHB)
2153 msg_print("»ä¤Ï¶ìÏ«¤·¤Æ¡Ø¥°¥ì¡¼¥¿¡¼¡¦¥Ø¥ë=¥Ó¡¼¥¹¥È¡Ù¤òÅݤ·¤¿¡£");
2154 msg_print("¤·¤«¤·¼ê¤ËÆþ¤Ã¤¿¤Î¤Ï¤³¤Î¤¤¿¤Ê¤¤£Ô¥·¥ã¥Ä¤À¤±¤À¤Ã¤¿¡£");
2156 msg_print("I had a very hard time to kill the Greater hell-beast, ");
2157 msg_print("but all I got was this lousy t-shirt!");
2161 else if (o_ptr->name1 == ART_POWER)
2164 msg_print("¡Ö°ì¤Ä¤Î»ØÎؤÏÁ´¤Æ¤òÅý¤Ù¡¢");
2166 msg_print("°ì¤Ä¤Î»ØÎؤÏÁ´¤Æ¤ò¸«¤Ä¤±¡¢");
2168 msg_print("°ì¤Ä¤Î»ØÎؤÏÁ´¤Æ¤òÊá¤é¤¨¤Æ");
2170 msg_print("°Å°Ç¤ÎÃæ¤Ë·Ò¤®¤È¤á¤ë¡£¡×");
2172 msg_print("'One Ring to rule them all, ");
2174 msg_print("One Ring to find them, ");
2176 msg_print("One Ring to bring them all ");
2178 msg_print("and in the darkness bind them.'");
2182 else if (o_ptr->tval==TV_PARCHMENT)
2185 char o_name[MAX_NLEN];
2191 q=format("book-%d_jp.txt",o_ptr->sval);
2193 /* Display object description */
2194 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2196 /* Build the filename */
2197 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q);
2199 /* Peruse the help file */
2200 (void)show_file(TRUE, buf, o_name, 0, 0);
2209 /* Combine / Reorder the pack (later) */
2210 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2212 if (!(object_is_aware(o_ptr)))
2214 chg_virtue(V_PATIENCE, -1);
2215 chg_virtue(V_CHANCE, 1);
2216 chg_virtue(V_KNOWLEDGE, -1);
2219 /* The item was tried */
2220 object_tried(o_ptr);
2222 /* An identification was made */
2223 if (ident && !object_is_aware(o_ptr))
2225 object_aware(o_ptr);
2226 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2230 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2233 /* Hack -- allow certain scrolls to be "preserved" */
2239 sound(SOUND_SCROLL);
2241 /* Destroy a scroll in the pack */
2244 inven_item_increase(item, -1);
2245 inven_item_describe(item);
2246 inven_item_optimize(item);
2249 /* Destroy a scroll on the floor */
2252 floor_item_increase(0 - item, -1);
2253 floor_item_describe(0 - item);
2254 floor_item_optimize(0 - item);
2259 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥×¥ì¥¤¥ä¡¼¤¬Æɤळ¤È¤¬¤Ç¤¤ë¤«¤òȽÄꤹ¤ë /
2260 * Hook to determine if an object is readable
2261 * @param o_ptr ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
2262 * @return Æɤळ¤È¤¬²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
2264 static bool item_tester_hook_readable(object_type *o_ptr)
2266 if ((o_ptr->tval==TV_SCROLL) || (o_ptr->tval==TV_PARCHMENT) || (o_ptr->name1 == ART_GHB) || (o_ptr->name1 == ART_POWER)) return (TRUE);
2273 * @brief Æɤॳ¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2274 * Eat some food (from the pack or floor)
2277 void do_cmd_read_scroll(void)
2283 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2285 set_action(ACTION_NONE);
2288 /* Check some conditions */
2292 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡£");
2294 msg_print("You can't see anything.");
2302 msg_print("ÌÀ¤«¤ê¤¬¤Ê¤¤¤Î¤Ç¡¢°Å¤¯¤ÆÆɤá¤Ê¤¤¡£");
2304 msg_print("You have no light to read by.");
2309 if (p_ptr->confused)
2312 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡£");
2314 msg_print("You are too confused!");
2321 /* Restrict choices to scrolls */
2322 item_tester_hook = item_tester_hook_readable;
2326 q = "¤É¤Î´¬Êª¤òÆɤߤޤ¹¤«? ";
2327 s = "Æɤá¤ë´¬Êª¤¬¤Ê¤¤¡£";
2329 q = "Read which scroll? ";
2330 s = "You have no scrolls to read.";
2333 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2335 /* Get the item (in the pack) */
2338 o_ptr = &inventory[item];
2341 /* Get the item (on the floor) */
2344 o_ptr = &o_list[0 - item];
2347 /* Read the scroll */
2348 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
2352 * @brief ¾ó¤Î¸ú²Ì¤òȯư¤¹¤ë
2353 * @param sval ¥ª¥Ö¥¸¥§¥¯¥È¤Îsval
2354 * @param use_charge »ÈÍѲó¿ô¤ò¾ÃÈñ¤·¤¿¤«¤É¤¦¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
2355 * @param powerful ¶¯ÎÏȯư¾å¤Î½èÍý¤Ê¤é¤ÐTRUE
2356 * @param magic ËâÆ»¶ñ½Ñ¾å¤Î½èÍý¤Ê¤é¤ÐTRUE
2357 * @param known ȽÌÀºÑ¤Ê¤é¤ÐTRUE
2358 * @return ȯư¤Ë¤è¤ê¸ú²ÌÆâÍƤ¬³ÎÄꤷ¤¿¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
2360 static int staff_effect(int sval, bool *use_charge, bool powerful, bool magic, bool known)
2364 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2365 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
2367 /* Analyze the staff */
2370 case SV_STAFF_DARKNESS:
2372 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
2374 if (set_blind(p_ptr->blind + 3 + randint1(5))) ident = TRUE;
2376 if (unlite_area(10, (powerful ? 6 : 3))) ident = TRUE;
2380 case SV_STAFF_SLOWNESS:
2382 if (set_slow(p_ptr->slow + randint1(30) + 15, FALSE)) ident = TRUE;
2386 case SV_STAFF_HASTE_MONSTERS:
2388 if (speed_monsters()) ident = TRUE;
2392 case SV_STAFF_SUMMONING:
2394 const int times = randint1(powerful ? 8 : 4);
2395 for (k = 0; k < times; k++)
2397 if (summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2405 case SV_STAFF_TELEPORTATION:
2407 teleport_player((powerful ? 150 : 100), 0L);
2412 case SV_STAFF_IDENTIFY:
2415 if (!identify_fully(FALSE)) *use_charge = FALSE;
2417 if (!ident_spell(FALSE)) *use_charge = FALSE;
2423 case SV_STAFF_REMOVE_CURSE:
2425 bool result = powerful ? remove_all_curse() : remove_curse();
2431 msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
2433 msg_print("You feel as if someone is watching over you.");
2436 else if (!p_ptr->blind)
2439 msg_print("¾ó¤Ï°ì½Ö¥Ö¥ë¡¼¤Ëµ±¤¤¤¿...");
2441 msg_print("The staff glows blue for a moment...");
2450 case SV_STAFF_STARLITE:
2452 int num = damroll(5, 3);
2456 if (!p_ptr->blind && !magic)
2459 msg_print("¾ó¤ÎÀ褬ÌÀ¤ë¤¯µ±¤¤¤¿...");
2461 msg_print("The end of the staff glows brightly...");
2465 for (k = 0; k < num; k++)
2471 scatter(&y, &x, py, px, 4, 0);
2473 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2475 if (!player_bold(y, x)) break;
2478 project(0, 0, y, x, damroll(6 + lev / 8, 10), GF_LITE_WEAK,
2479 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
2487 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
2491 case SV_STAFF_MAPPING:
2493 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
2498 case SV_STAFF_DETECT_GOLD:
2500 if (detect_treasure(detect_rad)) ident = TRUE;
2501 if (detect_objects_gold(detect_rad)) ident = TRUE;
2505 case SV_STAFF_DETECT_ITEM:
2507 if (detect_objects_normal(detect_rad)) ident = TRUE;
2511 case SV_STAFF_DETECT_TRAP:
2513 if (detect_traps(detect_rad, known)) ident = TRUE;
2517 case SV_STAFF_DETECT_DOOR:
2519 if (detect_doors(detect_rad)) ident = TRUE;
2520 if (detect_stairs(detect_rad)) ident = TRUE;
2524 case SV_STAFF_DETECT_INVIS:
2526 if (detect_monsters_invis(detect_rad)) ident = TRUE;
2530 case SV_STAFF_DETECT_EVIL:
2532 if (detect_monsters_evil(detect_rad)) ident = TRUE;
2536 case SV_STAFF_CURE_LIGHT:
2538 if (hp_player(damroll((powerful ? 4 : 2), 8))) ident = TRUE;
2540 if (set_blind(0)) ident = TRUE;
2541 if (set_poisoned(0)) ident = TRUE;
2542 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
2544 if (set_shero(0,TRUE)) ident = TRUE;
2548 case SV_STAFF_CURING:
2550 if (set_blind(0)) ident = TRUE;
2551 if (set_poisoned(0)) ident = TRUE;
2552 if (set_confused(0)) ident = TRUE;
2553 if (set_stun(0)) ident = TRUE;
2554 if (set_cut(0)) ident = TRUE;
2555 if (set_image(0)) ident = TRUE;
2556 if (set_shero(0,TRUE)) ident = TRUE;
2560 case SV_STAFF_HEALING:
2562 if (hp_player(powerful ? 500 : 300)) ident = TRUE;
2563 if (set_stun(0)) ident = TRUE;
2564 if (set_cut(0)) ident = TRUE;
2565 if (set_shero(0,TRUE)) ident = TRUE;
2569 case SV_STAFF_THE_MAGI:
2571 if (do_res_stat(A_INT)) ident = TRUE;
2572 if (p_ptr->csp < p_ptr->msp)
2574 p_ptr->csp = p_ptr->msp;
2575 p_ptr->csp_frac = 0;
2578 msg_print("Ƭ¤¬¥Ï¥Ã¥¥ê¤È¤·¤¿¡£");
2580 msg_print("You feel your head clear.");
2583 p_ptr->redraw |= (PR_MANA);
2584 p_ptr->window |= (PW_PLAYER);
2585 p_ptr->window |= (PW_SPELL);
2587 if (set_shero(0,TRUE)) ident = TRUE;
2591 case SV_STAFF_SLEEP_MONSTERS:
2593 if (sleep_monsters(lev)) ident = TRUE;
2597 case SV_STAFF_SLOW_MONSTERS:
2599 if (slow_monsters(lev)) ident = TRUE;
2603 case SV_STAFF_SPEED:
2605 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
2609 case SV_STAFF_PROBING:
2616 case SV_STAFF_DISPEL_EVIL:
2618 if (dispel_evil(powerful ? 120 : 80)) ident = TRUE;
2622 case SV_STAFF_POWER:
2624 if (dispel_monsters(powerful ? 225 : 150)) ident = TRUE;
2628 case SV_STAFF_HOLINESS:
2630 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
2632 if (set_protevil((magic ? 0 : p_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
2633 if (set_poisoned(0)) ident = TRUE;
2634 if (set_afraid(0)) ident = TRUE;
2635 if (hp_player(50)) ident = TRUE;
2636 if (set_stun(0)) ident = TRUE;
2637 if (set_cut(0)) ident = TRUE;
2641 case SV_STAFF_GENOCIDE:
2643 (void)symbol_genocide((magic ? lev + 50 : 200), TRUE);
2648 case SV_STAFF_EARTHQUAKES:
2650 if (earthquake(py, px, (powerful ? 15 : 10)))
2654 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Íɤ줿¡£");
2656 msg_print("The dungeon trembles.");
2663 case SV_STAFF_DESTRUCTION:
2665 if (destroy_area(py, px, (powerful ? 18 : 13) + randint0(5), FALSE))
2671 case SV_STAFF_ANIMATE_DEAD:
2673 if (animate_dead(0, py, px))
2679 case SV_STAFF_MSTORM:
2682 msg_print("¶¯ÎϤÊËâÎϤ¬Å¨¤ò°ú¤Îö¤¤¤¿¡ª");
2684 msg_print("Mighty magics rend your enemies!");
2686 project(0, (powerful ? 7 : 5), py, px,
2687 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
2688 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))
2691 (void)take_hit(DAMAGE_NOESCAPE, 50, "¥³¥ó¥È¥í¡¼¥ë¤·Æñ¤¤¶¯ÎϤÊËâÎϤβòÊü", -1);
2693 (void)take_hit(DAMAGE_NOESCAPE, 50, "unleashing magics too mighty to control", -1);
2701 case SV_STAFF_NOTHING:
2704 msg_print("²¿¤âµ¯¤é¤Ê¤«¤Ã¤¿¡£");
2706 msg_print("Nothing happen.");
2708 if (prace_is_(RACE_SKELETON) || prace_is_(RACE_GOLEM) ||
2709 prace_is_(RACE_ZOMBIE) || prace_is_(RACE_SPECTRE))
2711 msg_print("¤â¤Ã¤¿¤¤¤Ê¤¤»ö¤ò¤·¤¿¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£¿©¤Ùʪ¤ÏÂçÀڤˤ·¤Ê¤¯¤Æ¤Ï¡£");
2713 msg_print("What a waste. It's your food!");
2722 * @brief ¾ó¤ò»È¤¦¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
2723 * Use a staff. -RAK-
2724 * @param item »È¤¦¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê»ýÉÊID
2727 * One charge of one staff disappears.
2728 * Hack -- staffs of identify can be "cancelled".
2730 static void do_cmd_use_staff_aux(int item)
2732 int ident, chance, lev;
2736 /* Hack -- let staffs of identify get aborted */
2737 bool use_charge = TRUE;
2740 /* Get the item (in the pack) */
2743 o_ptr = &inventory[item];
2746 /* Get the item (on the floor) */
2749 o_ptr = &o_list[0 - item];
2753 /* Mega-Hack -- refuse to use a pile from the ground */
2754 if ((item < 0) && (o_ptr->number > 1))
2757 msg_print("¤Þ¤º¤Ï¾ó¤ò½¦¤ï¤Ê¤±¤ì¤Ð¡£");
2759 msg_print("You must first pick up the staffs.");
2769 /* Extract the item level */
2770 lev = k_info[o_ptr->k_idx].level;
2771 if (lev > 50) lev = 50 + (lev - 50)/2;
2773 /* Base chance of success */
2774 chance = p_ptr->skill_dev;
2776 /* Confusion hurts skill */
2777 if (p_ptr->confused) chance = chance / 2;
2779 /* Hight level objects are harder */
2780 chance = chance - lev;
2782 /* Give everyone a (slight) chance */
2783 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
2785 chance = USE_DEVICE;
2790 if (flush_failure) flush();
2792 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
2794 msg_print("Nothing happen. Maybe this staff is freezing too.");
2801 /* Roll for usage */
2802 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
2804 if (flush_failure) flush();
2806 msg_print("¾ó¤ò¤¦¤Þ¤¯»È¤¨¤Ê¤«¤Ã¤¿¡£");
2808 msg_print("You failed to use the staff properly.");
2815 /* Notice empty staffs */
2816 if (o_ptr->pval <= 0)
2818 if (flush_failure) flush();
2820 msg_print("¤³¤Î¾ó¤Ë¤Ï¤â¤¦ËâÎϤ¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¡£");
2822 msg_print("The staff has no charges left.");
2825 o_ptr->ident |= (IDENT_EMPTY);
2827 /* Combine / Reorder the pack (later) */
2828 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2829 p_ptr->window |= (PW_INVEN);
2838 ident = staff_effect(o_ptr->sval, &use_charge, FALSE, FALSE, object_is_aware(o_ptr));
2840 if (!(object_is_aware(o_ptr)))
2842 chg_virtue(V_PATIENCE, -1);
2843 chg_virtue(V_CHANCE, 1);
2844 chg_virtue(V_KNOWLEDGE, -1);
2847 /* Combine / Reorder the pack (later) */
2848 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2850 /* Tried the item */
2851 object_tried(o_ptr);
2853 /* An identification was made */
2854 if (ident && !object_is_aware(o_ptr))
2856 object_aware(o_ptr);
2857 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2861 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2864 /* Hack -- some uses are "free" */
2865 if (!use_charge) return;
2868 /* Use a single charge */
2871 /* XXX Hack -- unstack if necessary */
2872 if ((item >= 0) && (o_ptr->number > 1))
2877 /* Get local object */
2880 /* Obtain a local object */
2881 object_copy(q_ptr, o_ptr);
2883 /* Modify quantity */
2886 /* Restore the charges */
2889 /* Unstack the used item */
2891 p_ptr->total_weight -= q_ptr->weight;
2892 item = inven_carry(q_ptr);
2896 msg_print("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
2898 msg_print("You unstack your staff.");
2903 /* Describe charges in the pack */
2906 inven_item_charges(item);
2909 /* Describe charges on the floor */
2912 floor_item_charges(0 - item);
2917 * @brief ¾ó¤ò»È¤¦¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2920 void do_cmd_use_staff(void)
2925 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2927 set_action(ACTION_NONE);
2930 /* Restrict choices to wands */
2931 item_tester_tval = TV_STAFF;
2935 q = "¤É¤Î¾ó¤ò»È¤¤¤Þ¤¹¤«? ";
2936 s = "»È¤¨¤ë¾ó¤¬¤Ê¤¤¡£";
2938 q = "Use which staff? ";
2939 s = "You have no staff to use.";
2942 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2944 do_cmd_use_staff_aux(item);
2948 * @brief ËâË¡ËÀ¤Î¸ú²Ì¤òȯư¤¹¤ë
2949 * @param sval ¥ª¥Ö¥¸¥§¥¯¥È¤Îsval
2950 * @param dir ȯư¤ÎÊý¸þID
2951 * @param powerful ¶¯ÎÏȯư¾å¤Î½èÍý¤Ê¤é¤ÐTRUE
2952 * @param magic ËâÆ»¶ñ½Ñ¾å¤Î½èÍý¤Ê¤é¤ÐTRUE
2953 * @return ȯư¤Ë¤è¤ê¸ú²ÌÆâÍƤ¬³ÎÄꤷ¤¿¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
2955 static int wand_effect(int sval, int dir, bool powerful, bool magic)
2958 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2959 int rad = powerful ? 3 : 2;
2961 /* XXX Hack -- Wand of wonder can do anything before it */
2962 if (sval == SV_WAND_WONDER)
2964 int vir = virtue_number(V_CHANCE);
2965 sval = randint0(SV_WAND_WONDER);
2969 if (p_ptr->virtues[vir - 1] > 0)
2971 while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
2972 if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
2976 while (randint1(300) < (0-p_ptr->virtues[vir - 1])) sval--;
2977 if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
2980 if (sval < SV_WAND_TELEPORT_AWAY)
2981 chg_virtue(V_CHANCE, 1);
2984 /* Analyze the wand */
2987 case SV_WAND_HEAL_MONSTER:
2989 int dam = damroll((powerful ? 20 : 10), 10);
2990 if (heal_monster(dir, dam)) ident = TRUE;
2994 case SV_WAND_HASTE_MONSTER:
2996 if (speed_monster(dir, lev)) ident = TRUE;
3000 case SV_WAND_CLONE_MONSTER:
3002 if (clone_monster(dir)) ident = TRUE;
3006 case SV_WAND_TELEPORT_AWAY:
3008 int distance = MAX_SIGHT * (powerful ? 8 : 5);
3009 if (teleport_monster(dir, distance)) ident = TRUE;
3013 case SV_WAND_DISARMING:
3015 if (disarm_trap(dir)) ident = TRUE;
3016 if (powerful && disarm_traps_touch()) ident = TRUE;
3020 case SV_WAND_TRAP_DOOR_DEST:
3022 if (destroy_door(dir)) ident = TRUE;
3023 if (powerful && destroy_doors_touch()) ident = TRUE;
3027 case SV_WAND_STONE_TO_MUD:
3029 int dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
3030 if (wall_to_mud(dir, dam)) ident = TRUE;
3036 int dam = damroll((powerful ? 12 : 6), 8);
3038 msg_print("ÀĤ¯µ±¤¯¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£");
3040 msg_print("A line of blue shimmering light appears.");
3043 (void)lite_line(dir, dam);
3048 case SV_WAND_SLEEP_MONSTER:
3050 if (sleep_monster(dir, lev)) ident = TRUE;
3054 case SV_WAND_SLOW_MONSTER:
3056 if (slow_monster(dir, lev)) ident = TRUE;
3060 case SV_WAND_CONFUSE_MONSTER:
3062 if (confuse_monster(dir, lev)) ident = TRUE;
3066 case SV_WAND_FEAR_MONSTER:
3068 if (fear_monster(dir, lev)) ident = TRUE;
3072 case SV_WAND_DRAIN_LIFE:
3074 if (drain_life(dir, 80 + lev)) ident = TRUE;
3078 case SV_WAND_POLYMORPH:
3080 if (poly_monster(dir, lev)) ident = TRUE;
3084 case SV_WAND_STINKING_CLOUD:
3086 fire_ball(GF_POIS, dir, 12 + lev / 4, rad);
3091 case SV_WAND_MAGIC_MISSILE:
3093 fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + lev / 10, 6));
3098 case SV_WAND_ACID_BOLT:
3100 fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + lev / 7, 8));
3105 case SV_WAND_CHARM_MONSTER:
3107 if (charm_monster(dir, MAX(20, lev)))
3112 case SV_WAND_FIRE_BOLT:
3114 fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + lev / 6, 8));
3119 case SV_WAND_COLD_BOLT:
3121 fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + lev / 8, 8));
3126 case SV_WAND_ACID_BALL:
3128 fire_ball(GF_ACID, dir, 60 + 3 * lev / 4, rad);
3133 case SV_WAND_ELEC_BALL:
3135 fire_ball(GF_ELEC, dir, 40 + 3 * lev / 4, rad);
3140 case SV_WAND_FIRE_BALL:
3142 fire_ball(GF_FIRE, dir, 70 + 3 * lev / 4, rad);
3147 case SV_WAND_COLD_BALL:
3149 fire_ball(GF_COLD, dir, 50 + 3 * lev / 4, rad);
3154 case SV_WAND_WONDER:
3157 msg_print("¤ª¤Ã¤È¡¢Ææ¤ÎËâË¡ËÀ¤ò»ÏÆ°¤µ¤»¤¿¡£");
3159 msg_print("Oops. Wand of wonder activated.");
3165 case SV_WAND_DRAGON_FIRE:
3167 fire_ball(GF_FIRE, dir, (powerful ? 300 : 200), -3);
3172 case SV_WAND_DRAGON_COLD:
3174 fire_ball(GF_COLD, dir, (powerful ? 270 : 180), -3);
3179 case SV_WAND_DRAGON_BREATH:
3184 switch (randint1(5))
3208 if (powerful) dam = (dam * 3) / 2;
3210 fire_ball(typ, dir, dam, -3);
3216 case SV_WAND_DISINTEGRATE:
3218 fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(lev * 2), rad);
3223 case SV_WAND_ROCKETS:
3226 msg_print("¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡ª");
3228 msg_print("You launch a rocket!");
3231 fire_rocket(GF_ROCKET, dir, 250 + lev * 3, rad);
3236 case SV_WAND_STRIKING:
3238 fire_bolt(GF_METEOR, dir, damroll(15 + lev / 3, 13));
3243 case SV_WAND_GENOCIDE:
3245 fire_ball_hide(GF_GENOCIDE, dir, magic ? lev + 50 : 250, 0);
3254 * @brief ËâË¡ËÀ¤ò»È¤¦¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
3255 * Aim a wand (from the pack or floor).
3256 * @param item »È¤¦¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê»ýÉÊID
3260 * Use a single charge from a single item.
3261 * Handle "unstacking" in a logical manner.
3262 * For simplicity, you cannot use a stack of items from the
3263 * ground. This would require too much nasty code.
3264 * There are no wands which can "destroy" themselves, in the inventory
3265 * or on the ground, so we can ignore this possibility. Note that this
3266 * required giving "wand of wonder" the ability to ignore destruction
3267 * by electric balls.
3268 * All wands can be "cancelled" at the "Direction?" prompt for free.
3269 * Note that the basic "bolt" wands do slightly less damage than the
3270 * basic "bolt" rods, but the basic "ball" wands do the same damage
3271 * as the basic "ball" rods.
3274 static void do_cmd_aim_wand_aux(int item)
3276 int lev, ident, chance, dir;
3278 bool old_target_pet = target_pet;
3280 /* Get the item (in the pack) */
3283 o_ptr = &inventory[item];
3286 /* Get the item (on the floor) */
3289 o_ptr = &o_list[0 - item];
3292 /* Mega-Hack -- refuse to aim a pile from the ground */
3293 if ((item < 0) && (o_ptr->number > 1))
3296 msg_print("¤Þ¤º¤ÏËâË¡ËÀ¤ò½¦¤ï¤Ê¤±¤ì¤Ð¡£");
3298 msg_print("You must first pick up the wands.");
3305 /* Allow direction to be cancelled for free */
3306 if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
3307 || o_ptr->sval == SV_WAND_HASTE_MONSTER))
3309 if (!get_aim_dir(&dir))
3311 target_pet = old_target_pet;
3314 target_pet = old_target_pet;
3320 lev = k_info[o_ptr->k_idx].level;
3321 if (lev > 50) lev = 50 + (lev - 50)/2;
3323 /* Base chance of success */
3324 chance = p_ptr->skill_dev;
3326 /* Confusion hurts skill */
3327 if (p_ptr->confused) chance = chance / 2;
3329 /* Hight level objects are harder */
3330 chance = chance - lev;
3332 /* Give everyone a (slight) chance */
3333 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
3335 chance = USE_DEVICE;
3340 if (flush_failure) flush();
3342 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
3344 msg_print("Nothing happen. Maybe this wand is freezing too.");
3351 /* Roll for usage */
3352 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
3354 if (flush_failure) flush();
3356 msg_print("ËâË¡ËÀ¤ò¤¦¤Þ¤¯»È¤¨¤Ê¤«¤Ã¤¿¡£");
3358 msg_print("You failed to use the wand properly.");
3365 /* The wand is already empty! */
3366 if (o_ptr->pval <= 0)
3368 if (flush_failure) flush();
3370 msg_print("¤³¤ÎËâË¡ËÀ¤Ë¤Ï¤â¤¦ËâÎϤ¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¡£");
3372 msg_print("The wand has no charges left.");
3375 o_ptr->ident |= (IDENT_EMPTY);
3377 /* Combine / Reorder the pack (later) */
3378 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3379 p_ptr->window |= (PW_INVEN);
3387 ident = wand_effect(o_ptr->sval, dir, FALSE, FALSE);
3389 /* Combine / Reorder the pack (later) */
3390 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3392 if (!(object_is_aware(o_ptr)))
3394 chg_virtue(V_PATIENCE, -1);
3395 chg_virtue(V_CHANCE, 1);
3396 chg_virtue(V_KNOWLEDGE, -1);
3399 /* Mark it as tried */
3400 object_tried(o_ptr);
3402 /* Apply identification */
3403 if (ident && !object_is_aware(o_ptr))
3405 object_aware(o_ptr);
3406 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
3410 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3413 /* Use a single charge */
3416 /* Describe the charges in the pack */
3419 inven_item_charges(item);
3422 /* Describe the charges on the floor */
3425 floor_item_charges(0 - item);
3430 * @brief ËâË¡ËÀ¤ò»È¤¦¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
3433 void do_cmd_aim_wand(void)
3438 /* Restrict choices to wands */
3439 item_tester_tval = TV_WAND;
3441 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3443 set_action(ACTION_NONE);
3448 q = "¤É¤ÎËâË¡ËÀ¤ÇÁÀ¤¤¤Þ¤¹¤«? ";
3449 s = "»È¤¨¤ëËâË¡ËÀ¤¬¤Ê¤¤¡£";
3451 q = "Aim which wand? ";
3452 s = "You have no wand to aim.";
3455 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3458 do_cmd_aim_wand_aux(item);
3462 * @brief ¥í¥Ã¥É¤Î¸ú²Ì¤òȯư¤¹¤ë
3463 * @param sval ¥ª¥Ö¥¸¥§¥¯¥È¤Îsval
3464 * @param dir ȯưÌÜɸ¤ÎÊý¸þID
3465 * @param use_charge ¥Á¥ã¡¼¥¸¤ò¾ÃÈñ¤·¤¿¤«¤É¤¦¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
3466 * @param powerful ¶¯ÎÏȯư¾å¤Î½èÍý¤Ê¤é¤ÐTRUE
3467 * @param magic ËâÆ»¶ñ½Ñ¾å¤Î½èÍý¤Ê¤é¤ÐTRUE
3468 * @return ȯư¤Ë¤è¤ê¸ú²ÌÆâÍƤ¬³ÎÄꤷ¤¿¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
3470 static int rod_effect(int sval, int dir, bool *use_charge, bool powerful, bool magic)
3473 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
3474 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
3475 int rad = powerful ? 3 : 2;
3480 /* Analyze the rod */
3483 case SV_ROD_DETECT_TRAP:
3485 if (detect_traps(detect_rad, (bool)(dir ? FALSE : TRUE))) ident = TRUE;
3489 case SV_ROD_DETECT_DOOR:
3491 if (detect_doors(detect_rad)) ident = TRUE;
3492 if (detect_stairs(detect_rad)) ident = TRUE;
3496 case SV_ROD_IDENTIFY:
3499 if (!identify_fully(FALSE)) *use_charge = FALSE;
3501 if (!ident_spell(FALSE)) *use_charge = FALSE;
3509 if (!word_of_recall()) *use_charge = FALSE;
3514 case SV_ROD_ILLUMINATION:
3516 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
3520 case SV_ROD_MAPPING:
3522 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
3527 case SV_ROD_DETECTION:
3529 detect_all(detect_rad);
3534 case SV_ROD_PROBING:
3543 if (set_blind(0)) ident = TRUE;
3544 if (set_poisoned(0)) ident = TRUE;
3545 if (set_confused(0)) ident = TRUE;
3546 if (set_stun(0)) ident = TRUE;
3547 if (set_cut(0)) ident = TRUE;
3548 if (set_image(0)) ident = TRUE;
3549 if (set_shero(0,TRUE)) ident = TRUE;
3553 case SV_ROD_HEALING:
3555 if (hp_player(powerful ? 750 : 500)) ident = TRUE;
3556 if (set_stun(0)) ident = TRUE;
3557 if (set_cut(0)) ident = TRUE;
3558 if (set_shero(0,TRUE)) ident = TRUE;
3562 case SV_ROD_RESTORATION:
3564 if (restore_level()) ident = TRUE;
3565 if (do_res_stat(A_STR)) ident = TRUE;
3566 if (do_res_stat(A_INT)) ident = TRUE;
3567 if (do_res_stat(A_WIS)) ident = TRUE;
3568 if (do_res_stat(A_DEX)) ident = TRUE;
3569 if (do_res_stat(A_CON)) ident = TRUE;
3570 if (do_res_stat(A_CHR)) ident = TRUE;
3576 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
3580 case SV_ROD_PESTICIDE:
3582 if (dispel_monsters(powerful ? 8 : 4)) ident = TRUE;
3586 case SV_ROD_TELEPORT_AWAY:
3588 int distance = MAX_SIGHT * (powerful ? 8 : 5);
3589 if (teleport_monster(dir, distance)) ident = TRUE;
3593 case SV_ROD_DISARMING:
3595 if (disarm_trap(dir)) ident = TRUE;
3596 if (powerful && disarm_traps_touch()) ident = TRUE;
3602 int dam = damroll((powerful ? 12 : 6), 8);
3604 msg_print("ÀĤ¯µ±¤¯¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£");
3606 msg_print("A line of blue shimmering light appears.");
3609 (void)lite_line(dir, dam);
3614 case SV_ROD_SLEEP_MONSTER:
3616 if (sleep_monster(dir, lev)) ident = TRUE;
3620 case SV_ROD_SLOW_MONSTER:
3622 if (slow_monster(dir, lev)) ident = TRUE;
3626 case SV_ROD_DRAIN_LIFE:
3628 if (drain_life(dir, 70 + 3 * lev / 2)) ident = TRUE;
3632 case SV_ROD_POLYMORPH:
3634 if (poly_monster(dir, lev)) ident = TRUE;
3638 case SV_ROD_ACID_BOLT:
3640 fire_bolt_or_beam(10, GF_ACID, dir, damroll(6 + lev / 7, 8));
3645 case SV_ROD_ELEC_BOLT:
3647 fire_bolt_or_beam(10, GF_ELEC, dir, damroll(4 + lev / 9, 8));
3652 case SV_ROD_FIRE_BOLT:
3654 fire_bolt_or_beam(10, GF_FIRE, dir, damroll(7 + lev / 6, 8));
3659 case SV_ROD_COLD_BOLT:
3661 fire_bolt_or_beam(10, GF_COLD, dir, damroll(5 + lev / 8, 8));
3666 case SV_ROD_ACID_BALL:
3668 fire_ball(GF_ACID, dir, 60 + lev, rad);
3673 case SV_ROD_ELEC_BALL:
3675 fire_ball(GF_ELEC, dir, 40 + lev, rad);
3680 case SV_ROD_FIRE_BALL:
3682 fire_ball(GF_FIRE, dir, 70 + lev, rad);
3687 case SV_ROD_COLD_BALL:
3689 fire_ball(GF_COLD, dir, 50 + lev, rad);
3701 case SV_ROD_STONE_TO_MUD:
3703 int dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
3704 if (wall_to_mud(dir, dam)) ident = TRUE;
3708 case SV_ROD_AGGRAVATE:
3710 aggravate_monsters(0);
3719 * @brief ËâË¡ËÀ¤ò»È¤¦¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
3720 * Activate (zap) a Rod
3721 * @param item »È¤¦¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê»ýÉÊID
3725 * Unstack fully charged rods as needed.
3726 * Hack -- rods of perception/genocide can be "cancelled"
3727 * All rods can be cancelled at the "Direction?" prompt
3728 * pvals are defined for each rod in k_info. -LM-
3731 static void do_cmd_zap_rod_aux(int item)
3733 int ident, chance, lev, fail;
3738 /* Hack -- let perception get aborted */
3739 bool use_charge = TRUE;
3743 /* Get the item (in the pack) */
3746 o_ptr = &inventory[item];
3749 /* Get the item (on the floor) */
3752 o_ptr = &o_list[0 - item];
3756 /* Mega-Hack -- refuse to zap a pile from the ground */
3757 if ((item < 0) && (o_ptr->number > 1))
3760 msg_print("¤Þ¤º¤Ï¥í¥Ã¥É¤ò½¦¤ï¤Ê¤±¤ì¤Ð¡£");
3762 msg_print("You must first pick up the rods.");
3769 /* Get a direction (unless KNOWN not to need it) */
3770 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)) ||
3771 !object_is_aware(o_ptr))
3773 /* Get a direction, allow cancel */
3774 if (!get_aim_dir(&dir)) return;
3781 /* Extract the item level */
3782 lev = k_info[o_ptr->k_idx].level;
3784 /* Base chance of success */
3785 chance = p_ptr->skill_dev;
3787 /* Confusion hurts skill */
3788 if (p_ptr->confused) chance = chance / 2;
3791 if (chance > fail) fail -= (chance - fail)*2;
3792 else chance -= (fail - chance)*2;
3793 if (fail < USE_DEVICE) fail = USE_DEVICE;
3794 if (chance < USE_DEVICE) chance = USE_DEVICE;
3798 if (flush_failure) flush();
3800 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
3802 msg_print("Nothing happen. Maybe this rod is freezing too.");
3809 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3810 else if (chance > fail)
3812 if (randint0(chance*2) < fail) success = FALSE;
3813 else success = TRUE;
3817 if (randint0(fail*2) < chance) success = TRUE;
3818 else success = FALSE;
3821 /* Roll for usage */
3824 if (flush_failure) flush();
3826 msg_print("¤¦¤Þ¤¯¥í¥Ã¥É¤ò»È¤¨¤Ê¤«¤Ã¤¿¡£");
3828 msg_print("You failed to use the rod properly.");
3835 k_ptr = &k_info[o_ptr->k_idx];
3837 /* A single rod is still charging */
3838 if ((o_ptr->number == 1) && (o_ptr->timeout))
3840 if (flush_failure) flush();
3842 msg_print("¤³¤Î¥í¥Ã¥É¤Ï¤Þ¤ÀËâÎϤò½¼Å¶¤·¤Æ¤¤¤ëºÇÃæ¤À¡£");
3844 msg_print("The rod is still charging.");
3849 /* A stack of rods lacks enough energy. */
3850 else if ((o_ptr->number > 1) && (o_ptr->timeout > k_ptr->pval * (o_ptr->number - 1)))
3852 if (flush_failure) flush();
3854 msg_print("¤½¤Î¥í¥Ã¥É¤Ï¤Þ¤À½¼Å¶Ãæ¤Ç¤¹¡£");
3856 msg_print("The rods are all still charging.");
3865 ident = rod_effect(o_ptr->sval, dir, &use_charge, FALSE, FALSE);
3867 /* Increase the timeout by the rod kind's pval. -LM- */
3868 if (use_charge) o_ptr->timeout += k_ptr->pval;
3870 /* Combine / Reorder the pack (later) */
3871 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3873 if (!(object_is_aware(o_ptr)))
3875 chg_virtue(V_PATIENCE, -1);
3876 chg_virtue(V_CHANCE, 1);
3877 chg_virtue(V_KNOWLEDGE, -1);
3880 /* Tried the object */
3881 object_tried(o_ptr);
3883 /* Successfully determined the object function */
3884 if (ident && !object_is_aware(o_ptr))
3886 object_aware(o_ptr);
3887 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
3891 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3895 * @brief ¥í¥Ã¥É¤ò»È¤¦¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
3898 void do_cmd_zap_rod(void)
3903 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3905 set_action(ACTION_NONE);
3908 /* Restrict choices to rods */
3909 item_tester_tval = TV_ROD;
3913 q = "¤É¤Î¥í¥Ã¥É¤ò¿¶¤ê¤Þ¤¹¤«? ";
3914 s = "»È¤¨¤ë¥í¥Ã¥É¤¬¤Ê¤¤¡£";
3916 q = "Zap which rod? ";
3917 s = "You have no rod to zap.";
3920 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3923 do_cmd_zap_rod_aux(item);
3927 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥×¥ì¥¤¥ä¡¼¤¬ËâÆ»¶ñ¤È¤·¤Æȯư¤Ç¤¤ë¤«¤òȽÄꤹ¤ë /
3928 * Hook to determine if an object is activatable
3929 * @param o_ptr ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
3930 * @return ËâÆ»¶ñ¤È¤·¤Æȯư²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
3932 static bool item_tester_hook_activate(object_type *o_ptr)
3934 u32b flgs[TR_FLAG_SIZE];
3937 if (!object_is_known(o_ptr)) return (FALSE);
3939 /* Extract the flags */
3940 object_flags(o_ptr, flgs);
3942 /* Check activation flag */
3943 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
3950 * @brief ¡Ø°ì¤Ä¤Î»ØÎء٤θú²Ì½èÍý /
3951 * Hack -- activate the ring of power
3952 * @param dir ȯư¤ÎÊý¸þID
3955 void ring_of_power(int dir)
3957 /* Pick a random effect */
3958 switch (randint1(10))
3965 msg_print("¤¢¤Ê¤¿¤Ï°À¤Î¥ª¡¼¥é¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡£");
3967 msg_print("You are surrounded by a malignant aura.");
3972 /* Decrease all stats (permanently) */
3973 (void)dec_stat(A_STR, 50, TRUE);
3974 (void)dec_stat(A_INT, 50, TRUE);
3975 (void)dec_stat(A_WIS, 50, TRUE);
3976 (void)dec_stat(A_DEX, 50, TRUE);
3977 (void)dec_stat(A_CON, 50, TRUE);
3978 (void)dec_stat(A_CHR, 50, TRUE);
3980 /* Lose some experience (permanently) */
3981 p_ptr->exp -= (p_ptr->exp / 4);
3982 p_ptr->max_exp -= (p_ptr->exp / 4);
3992 msg_print("¤¢¤Ê¤¿¤Ï¶¯ÎϤʥª¡¼¥é¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡£");
3994 msg_print("You are surrounded by a powerful aura.");
3998 /* Dispel monsters */
3999 dispel_monsters(1000);
4009 fire_ball(GF_MANA, dir, 600, 3);
4020 fire_bolt(GF_MANA, dir, 500);
4028 * @brief ¥Ú¥Ã¥ÈÆþ¤ê¥â¥ó¥¹¥¿¡¼¥Ü¡¼¥ë¤ò¥½¡¼¥È¤¹¤ë¤¿¤á¤ÎÈæ³Ó´Ø¿ô
4029 * @param u ½ê»ýÉÊÇÛÎó¤Î»²¾È¥Ý¥¤¥ó¥¿
4031 * @param a ½ê»ýÉÊID1
4032 * @param b ½ê»ýÉÊID2
4033 * @return 1¤ÎÊý¤¬Âç¤Ç¤¢¤ì¤ÐTRUE
4035 static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
4037 u16b *who = (u16b*)(u);
4042 monster_type *m_ptr1 = &m_list[w1];
4043 monster_type *m_ptr2 = &m_list[w2];
4044 monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
4045 monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
4050 if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
4051 if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
4053 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
4054 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
4056 if (r_ptr1->level > r_ptr2->level) return TRUE;
4057 if (r_ptr2->level > r_ptr1->level) return FALSE;
4059 if (m_ptr1->hp > m_ptr2->hp) return TRUE;
4060 if (m_ptr2->hp > m_ptr1->hp) return FALSE;
4067 * @brief ÁõÈ÷¤òȯư¤¹¤ë¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
4068 * Activate a wielded object. Wielded objects never stack.
4069 * And even if they did, activatable objects never stack.
4070 * @param item ȯư¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê»ýÉÊID
4074 * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
4075 * But one could, for example, easily make an activatable "Ring of Plasma".
4076 * Note that it always takes a turn to activate an artifact, even if
4077 * the user hits "escape" at the "direction" prompt.
4080 static void do_cmd_activate_aux(int item)
4082 int dir, lev, chance, fail;
4087 /* Get the item (in the pack) */
4090 o_ptr = &inventory[item];
4093 /* Get the item (on the floor) */
4096 o_ptr = &o_list[0 - item];
4102 /* Extract the item level */
4103 lev = k_info[o_ptr->k_idx].level;
4105 /* Hack -- use artifact level instead */
4106 if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
4107 else if (object_is_random_artifact(o_ptr))
4109 const activation_type* const act_ptr = find_activation_info(o_ptr);
4111 lev = act_ptr->level;
4114 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
4116 /* Base chance of success */
4117 chance = p_ptr->skill_dev;
4119 /* Confusion hurts skill */
4120 if (p_ptr->confused) chance = chance / 2;
4123 if (chance > fail) fail -= (chance - fail)*2;
4124 else chance -= (fail - chance)*2;
4125 if (fail < USE_DEVICE) fail = USE_DEVICE;
4126 if (chance < USE_DEVICE) chance = USE_DEVICE;
4130 if (flush_failure) flush();
4132 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
4134 msg_print("It shows no reaction.");
4140 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
4141 else if (chance > fail)
4143 if (randint0(chance*2) < fail) success = FALSE;
4144 else success = TRUE;
4148 if (randint0(fail*2) < chance) success = TRUE;
4149 else success = FALSE;
4152 /* Roll for usage */
4155 if (flush_failure) flush();
4157 msg_print("¤¦¤Þ¤¯»ÏÆ°¤µ¤»¤ë¤³¤È¤¬¤Ç¤¤Ê¤«¤Ã¤¿¡£");
4159 msg_print("You failed to activate it properly.");
4165 /* Check the recharge */
4169 msg_print("¤½¤ì¤ÏÈù¤«¤Ë²»¤òΩ¤Æ¡¢µ±¤¡¢¾Ã¤¨¤¿...");
4171 msg_print("It whines, glows and fades...");
4176 /* Some lights need enough fuel for activation */
4177 if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
4178 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
4181 msg_print("dzÎÁ¤¬¤Ê¤¤¡£");
4183 msg_print("It has no fuel.");
4189 /* Activate the artifact */
4191 msg_print("»ÏÆ°¤µ¤»¤¿...");
4193 msg_print("You activate it...");
4200 /* Activate object */
4201 if (activation_index(o_ptr))
4203 (void)activate_random_artifact(o_ptr);
4206 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4213 else if (o_ptr->tval == TV_WHISTLE)
4215 if (music_singing_any()) stop_singing();
4216 if (hex_spelling_any()) stop_hex_spell_all();
4219 if (object_is_cursed(o_ptr))
4222 msg_print("¥«¥ó¹â¤¤²»¤¬¶Á¤ÅϤä¿¡£");
4224 msg_print("You produce a shrill whistling sound.");
4226 aggravate_monsters(0);
4236 /* Allocate the "who" array */
4237 C_MAKE(who, max_m_idx, u16b);
4239 /* Process the monsters (backwards) */
4240 for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
4242 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
4243 who[max_pet++] = pet_ctr;
4246 /* Select the sort method */
4247 ang_sort_comp = ang_sort_comp_pet;
4248 ang_sort_swap = ang_sort_swap_hook;
4250 ang_sort(who, &dummy_why, max_pet);
4252 /* Process the monsters (backwards) */
4253 for (i = 0; i < max_pet; i++)
4256 teleport_monster_to(pet_ctr, py, px, 100, TELEPORT_PASSIVE);
4259 /* Free the "who" array */
4260 C_KILL(who, max_m_idx, u16b);
4262 o_ptr->timeout = 100+randint1(100);
4265 else if (o_ptr->tval == TV_CAPTURE)
4269 bool old_target_pet = target_pet;
4271 if (!get_aim_dir(&dir))
4273 target_pet = old_target_pet;
4276 target_pet = old_target_pet;
4278 if(fire_ball(GF_CAPTURE, dir, 0, 0))
4280 o_ptr->pval = cap_mon;
4281 o_ptr->xtra3 = cap_mspeed;
4282 o_ptr->xtra4 = cap_hp;
4283 o_ptr->xtra5 = cap_maxhp;
4290 if (o_ptr->inscription)
4291 strcpy(buf, quark_str(o_ptr->inscription));
4293 for (s = buf;*s && (*s != '#'); s++)
4296 if (iskanji(*s)) s++;
4306 t = quark_str(cap_nickname);
4319 o_ptr->inscription = quark_add(buf);
4325 bool success = FALSE;
4326 if (!get_rep_dir2(&dir)) return;
4327 if (monster_can_enter(py + ddy[dir], px + ddx[dir], &r_info[o_ptr->pval], 0))
4329 if (place_monster_aux(0, py + ddy[dir], px + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
4331 if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
4332 if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
4333 if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
4334 m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
4335 if (o_ptr->inscription)
4343 t = quark_str(o_ptr->inscription);
4344 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
4347 if (iskanji(*t)) t++;
4372 if (quote && *(s-1) =='\'')
4376 m_list[hack_m_idx_ii].nickname = quark_add(buf);
4377 t = quark_str(o_ptr->inscription);
4379 while(*t && (*t != '#'))
4386 o_ptr->inscription = quark_add(buf);
4398 msg_print("¤ª¤Ã¤È¡¢²òÊü¤Ë¼ºÇÔ¤·¤¿¡£");
4400 msg_print("Oops. You failed to release your pet.");
4408 msg_print("¤ª¤Ã¤È¡¢¤³¤Î¥¢¥¤¥Æ¥à¤Ï»ÏÆ°¤Ç¤¤Ê¤¤¡£");
4410 msg_print("Oops. That object cannot be activated.");
4416 * @brief ÁõÈ÷¤òȯư¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
4419 void do_cmd_activate(void)
4425 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
4427 set_action(ACTION_NONE);
4430 item_tester_no_ryoute = TRUE;
4431 /* Prepare the hook */
4432 item_tester_hook = item_tester_hook_activate;
4436 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò»ÏÆ°¤µ¤»¤Þ¤¹¤«? ";
4437 s = "»ÏÆ°¤Ç¤¤ë¥¢¥¤¥Æ¥à¤òÁõÈ÷¤·¤Æ¤¤¤Ê¤¤¡£";
4439 q = "Activate which item? ";
4440 s = "You have nothing to activate.";
4443 if (!get_item(&item, q, s, (USE_EQUIP))) return;
4445 /* Activate the item */
4446 do_cmd_activate_aux(item);
4451 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥×¥ì¥¤¥ä¡¼¤¬´Ê°×»ÈÍÑ¥³¥Þ¥ó¥É¤ÇÍøÍѤǤ¤ë¤«¤òȽÄꤹ¤ë /
4452 * Hook to determine if an object is useable
4453 * @param o_ptr ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
4454 * @return ÍøÍѲÄǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
4456 static bool item_tester_hook_use(object_type *o_ptr)
4458 u32b flgs[TR_FLAG_SIZE];
4461 if (o_ptr->tval == p_ptr->tval_ammo)
4464 /* Useable object */
4465 switch (o_ptr->tval)
4483 if (!object_is_known(o_ptr)) return (FALSE);
4485 /* HACK - only items from the equipment can be activated */
4486 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4488 if (&inventory[i] == o_ptr)
4490 /* Extract the flags */
4491 object_flags(o_ptr, flgs);
4493 /* Check activation flag */
4494 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
4506 * @brief ¥¢¥¤¥Æ¥à¤òÈÆÍÑŪ¤Ë¡Ö»È¤¦¡×¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
4510 * XXX - Add actions for other item types
4512 void do_cmd_use(void)
4518 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
4520 set_action(ACTION_NONE);
4523 item_tester_no_ryoute = TRUE;
4524 /* Prepare the hook */
4525 item_tester_hook = item_tester_hook_use;
4529 q = "¤É¤ì¤ò»È¤¤¤Þ¤¹¤«¡©";
4530 s = "»È¤¨¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
4532 q = "Use which item? ";
4533 s = "You have nothing to use.";
4536 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR))) return;
4538 /* Get the item (in the pack) */
4541 o_ptr = &inventory[item];
4543 /* Get the item (on the floor) */
4546 o_ptr = &o_list[0 - item];
4549 switch (o_ptr->tval)
4561 do_cmd_eat_food_aux(item);
4568 do_cmd_aim_wand_aux(item);
4575 do_cmd_use_staff_aux(item);
4582 do_cmd_zap_rod_aux(item);
4586 /* Quaff a potion */
4589 do_cmd_quaff_potion_aux(item);
4596 /* Check some conditions */
4600 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡£");
4602 msg_print("You can't see anything.");
4610 msg_print("ÌÀ¤«¤ê¤¬¤Ê¤¤¤Î¤Ç¡¢°Å¤¯¤ÆÆɤá¤Ê¤¤¡£");
4612 msg_print("You have no light to read by.");
4617 if (p_ptr->confused)
4620 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡ª");
4622 msg_print("You are too confused!");
4628 do_cmd_read_scroll_aux(item, TRUE);
4637 do_cmd_fire_aux(item, &inventory[INVEN_BOW]);
4641 /* Activate an artifact */
4644 do_cmd_activate_aux(item);
4651 * @brief ËâÆ»¶ñ½Ñ»Õ¤Î¼è¤ê¹þ¤ó¤ÀËâÎÏ°ìÍ÷¤«¤éÁªÂò/±ÜÍ÷¤¹¤ë /
4652 * @param only_browse ±ÜÍ÷¤¹¤ë¤À¤±¤Ê¤é¤ÐTRUE
4653 * @return ÁªÂò¤·¤¿ËâÎϤÎID¡¢¥¥ã¥ó¥»¥ë¤Ê¤é¤Ð-1¤òÊÖ¤¹
4655 static int select_magic_eater(bool only_browse)
4659 bool flag, request_list;
4661 int ask = TRUE, i = 0;
4664 int menu_line = (use_menu ? 1 : 0);
4668 if (repeat_pull(&sn))
4670 /* Verify the spell */
4671 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))
4673 else if (sn < EATER_EXT*2 && !(p_ptr->magic_num1[sn] < EATER_CHARGE))
4677 #endif /* ALLOW_REPEAT */
4679 for (i = 0; i < 108; i++)
4681 if (p_ptr->magic_num2[i]) break;
4686 msg_print("ËâË¡¤ò³Ð¤¨¤Æ¤¤¤Ê¤¤¡ª");
4688 msg_print("You don't have any magic!");
4700 prt(format(" %s ¾ó", (menu_line == 1) ? "¡Õ" : " "), 2, 14);
4701 prt(format(" %s ËâË¡ËÀ", (menu_line == 2) ? "¡Õ" : " "), 3, 14);
4702 prt(format(" %s ¥í¥Ã¥É", (menu_line == 3) ? "¡Õ" : " "), 4, 14);
4704 prt(format(" %s staff", (menu_line == 1) ? "> " : " "), 2, 14);
4705 prt(format(" %s wand", (menu_line == 2) ? "> " : " "), 3, 14);
4706 prt(format(" %s rod", (menu_line == 3) ? "> " : " "), 4, 14);
4709 if (only_browse) prt(_("¤É¤Î¼ïÎà¤ÎËâË¡¤ò¸«¤Þ¤¹¤«¡©", "Which type of magic do you browse?"), 0, 0);
4710 else prt(_("¤É¤Î¼ïÎà¤ÎËâË¡¤ò»È¤¤¤Þ¤¹¤«¡©", "Which type of magic do you use?"), 0, 0);
4733 ext = (menu_line-1)*EATER_EXT;
4734 if (menu_line == 1) tval = TV_STAFF;
4735 else if (menu_line == 2) tval = TV_WAND;
4739 if (menu_line > 3) menu_line -= 3;
4748 if (!get_com("[A] ¾ó, [B] ËâË¡ËÀ, [C] ¥í¥Ã¥É:", &choice, TRUE))
4750 if (!get_com("[A] staff, [B] wand, [C] rod:", &choice, TRUE))
4755 if (choice == 'A' || choice == 'a')
4761 if (choice == 'B' || choice == 'b')
4767 if (choice == 'C' || choice == 'c')
4775 for (i = ext; i < ext + EATER_EXT; i++)
4777 if (p_ptr->magic_num2[i])
4779 if (use_menu) menu_line = i-ext+1;
4783 if (i == ext+EATER_EXT)
4786 msg_print("¤½¤Î¼ïÎà¤ÎËâË¡¤Ï³Ð¤¨¤Æ¤¤¤Ê¤¤¡ª");
4788 msg_print("You don't have that type of magic!");
4793 /* Nothing chosen yet */
4796 /* Build a prompt */
4797 if (only_browse) strnfmt(out_val, 78, _("('*'¤Ç°ìÍ÷, ESC¤ÇÃæÃÇ) ¤É¤ÎËâÎϤò¸«¤Þ¤¹¤«¡©",
4798 "(*=List, ESC=exit) Browse which power? "));
4799 else strnfmt(out_val, 78, _("('*'¤Ç°ìÍ÷, ESC¤ÇÃæÃÇ) ¤É¤ÎËâÎϤò»È¤¤¤Þ¤¹¤«¡©",
4800 "(*=List, ESC=exit) Use which power? "));
4802 /* Save the screen */
4805 request_list = always_show_list;
4807 /* Get a spell from the user */
4811 if (request_list || use_menu)
4822 for (y = 1; y < 20; y++)
4827 /* Print header(s) */
4829 prt(format(" %s ¼ºÎ¨ %s ¼ºÎ¨", (tval == TV_ROD ? " ¾õÂÖ " : "»ÈÍѲó¿ô"), (tval == TV_ROD ? " ¾õÂÖ " : "»ÈÍѲó¿ô")), y++, x);
4831 prt(format(" %s Fail %s Fail", (tval == TV_ROD ? " Stat " : " Charges"), (tval == TV_ROD ? " Stat " : " Charges")), y++, x);
4835 for (ctr = 0; ctr < EATER_EXT; ctr++)
4837 if (!p_ptr->magic_num2[ctr+ext]) continue;
4839 k_idx = lookup_kind(tval, ctr);
4843 if (ctr == (menu_line-1))
4845 strcpy(dummy, "¡Õ");
4847 strcpy(dummy, "> ");
4849 else strcpy(dummy, " ");
4852 /* letter/number for power selection */
4859 letter = '0' + ctr - 26;
4860 sprintf(dummy, "%c)",letter);
4862 x1 = ((ctr < EATER_EXT/2) ? x : x + 40);
4863 y1 = ((ctr < EATER_EXT/2) ? y + ctr : y + ctr - EATER_EXT/2);
4864 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
4865 chance = level * 4 / 5 + 20;
4866 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4868 if (p_ptr->lev > level)
4870 chance -= 3 * (p_ptr->lev - level);
4872 chance = mod_spell_chance_1(chance);
4873 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
4874 /* Stunning makes spells harder */
4875 if (p_ptr->stun > 50) chance += 25;
4876 else if (p_ptr->stun) chance += 15;
4878 if (chance > 95) chance = 95;
4880 chance = mod_spell_chance_2(chance);
4888 strcat(dummy, format(
4890 " %-22.22s ½¼Å¶:%2d/%2d%3d%%",
4892 " %-22.22s (%2d/%2d) %3d%%",
4894 k_name + k_info[k_idx].name,
4895 p_ptr->magic_num1[ctr+ext] ?
4896 (p_ptr->magic_num1[ctr+ext] - 1) / (EATER_ROD_CHARGE * k_info[k_idx].pval) +1 : 0,
4897 p_ptr->magic_num2[ctr+ext], chance));
4898 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;
4902 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));
4903 if (p_ptr->magic_num1[ctr+ext] < EATER_CHARGE) col = TERM_RED;
4908 c_prt(col, dummy, y1, x1);
4912 if (!get_com(out_val, &choice, FALSE)) break;
4914 if (use_menu && choice != ' ')
4930 menu_line += EATER_EXT - 1;
4931 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
4932 } while(!p_ptr->magic_num2[menu_line+ext-1]);
4943 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
4944 } while(!p_ptr->magic_num2[menu_line+ext-1]);
4955 bool reverse = FALSE;
4956 if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
4957 if (menu_line > EATER_EXT/2)
4959 menu_line -= EATER_EXT/2;
4962 else menu_line+=EATER_EXT/2;
4963 while(!p_ptr->magic_num2[menu_line+ext-1])
4968 if (menu_line < 2) reverse = FALSE;
4973 if (menu_line > EATER_EXT-1) reverse = TRUE;
4990 /* Request redraw */
4991 if (use_menu && ask) continue;
4993 /* Request redraw */
4994 if (!use_menu && ((choice == ' ') || (choice == '*') || (choice == '?')))
5000 request_list = FALSE;
5002 /* Restore the screen */
5007 request_list = TRUE;
5015 if (isalpha(choice))
5018 ask = (isupper(choice));
5021 if (ask) choice = tolower(choice);
5023 /* Extract request */
5024 i = (islower(choice) ? A2I(choice) : -1);
5028 ask = FALSE; /* Can't uppercase digits */
5030 i = choice - '0' + 26;
5034 /* Totally Illegal */
5035 if ((i < 0) || (i > EATER_EXT) || !p_ptr->magic_num2[i+ext])
5050 (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡© ", k_name + k_info[lookup_kind(tval ,i)].name);
5052 (void) strnfmt(tmp_val, 78, "Use %s?", k_name + k_info[lookup_kind(tval ,i)].name);
5055 /* Belay that order */
5056 if (!get_check(tmp_val)) continue;
5060 if (p_ptr->magic_num1[ext+i] > k_info[lookup_kind(tval, i)].pval * (p_ptr->magic_num2[ext+i] - 1) * EATER_ROD_CHARGE)
5063 msg_print("¤½¤ÎËâË¡¤Ï¤Þ¤À½¼Å¶¤·¤Æ¤¤¤ëºÇÃæ¤À¡£");
5065 msg_print("The magic are still charging.");
5068 if (use_menu) ask = TRUE;
5074 if (p_ptr->magic_num1[ext+i] < EATER_CHARGE)
5077 msg_print("¤½¤ÎËâË¡¤Ï»ÈÍѲó¿ô¤¬ÀÚ¤ì¤Æ¤¤¤ë¡£");
5079 msg_print("The magic has no charges left.");
5082 if (use_menu) ask = TRUE;
5094 /* Clear lines, position cursor (really should use strlen here) */
5095 Term_erase(7, 23, 255);
5096 Term_erase(7, 22, 255);
5097 Term_erase(7, 21, 255);
5098 Term_erase(7, 20, 255);
5100 roff_to_buf(k_text + k_info[lookup_kind(tval, i)].text, 62, temp, sizeof(temp));
5101 for (j = 0, line = 21; temp[j]; j += 1 + strlen(&temp[j]))
5103 prt(&temp[j], line, 10);
5114 /* Restore the screen */
5117 if (!flag) return -1;
5121 #endif /* ALLOW_REPEAT */
5127 * @brief ¼è¤ê¹þ¤ó¤ÀËâÎϤòÍøÍѤ¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
5128 * Use eaten rod, wand or staff
5129 * @param only_browse ±ÜÍ÷¤¹¤ë¤À¤±¤Ê¤é¤ÐTRUE
5130 * @param powerful ¶¯ÎÏȯưÃæ¤Î½èÍý¤Ê¤é¤ÐTRUE
5131 * @return ¼ÂºÝ¤Ë¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¤¿¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
5133 bool do_cmd_magic_eater(bool only_browse, bool powerful)
5135 int item, chance, level, k_idx, tval, sval;
5136 bool use_charge = TRUE;
5138 /* Not when confused */
5139 if (!only_browse && p_ptr->confused)
5142 msg_print("º®Í𤷤Ƥ¤¤Æ¾§¤¨¤é¤ì¤Ê¤¤¡ª");
5144 msg_print("You are too confused!");
5150 item = select_magic_eater(only_browse);
5156 if (item >= EATER_EXT*2) {tval = TV_ROD;sval = item - EATER_EXT*2;}
5157 else if (item >= EATER_EXT) {tval = TV_WAND;sval = item - EATER_EXT;}
5158 else {tval = TV_STAFF;sval = item;}
5159 k_idx = lookup_kind(tval, sval);
5161 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
5162 chance = level * 4 / 5 + 20;
5163 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
5165 if (p_ptr->lev > level)
5167 chance -= 3 * (p_ptr->lev - level);
5169 chance = mod_spell_chance_1(chance);
5170 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
5171 /* Stunning makes spells harder */
5172 if (p_ptr->stun > 50) chance += 25;
5173 else if (p_ptr->stun) chance += 15;
5175 if (chance > 95) chance = 95;
5177 chance = mod_spell_chance_2(chance);
5179 if (randint0(100) < chance)
5181 if (flush_failure) flush();
5184 msg_print("¼öʸ¤ò¤¦¤Þ¤¯¾§¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡ª");
5186 msg_format("You failed to get the magic off!");
5190 if (randint1(100) >= chance)
5191 chg_virtue(V_CHANCE,-1);
5202 if ((sval >= SV_ROD_MIN_DIRECTION) && (sval != SV_ROD_HAVOC) && (sval != SV_ROD_AGGRAVATE) && (sval != SV_ROD_PESTICIDE))
5203 if (!get_aim_dir(&dir)) return FALSE;
5204 rod_effect(sval, dir, &use_charge, powerful, TRUE);
5205 if (!use_charge) return FALSE;
5207 else if (tval == TV_WAND)
5209 if (!get_aim_dir(&dir)) return FALSE;
5210 wand_effect(sval, dir, powerful, TRUE);
5214 staff_effect(sval, &use_charge, powerful, TRUE, TRUE);
5215 if (!use_charge) return FALSE;
5217 if (randint1(100) < chance)
5218 chg_virtue(V_CHANCE,1);
5221 if (tval == TV_ROD) p_ptr->magic_num1[item] += k_info[k_idx].pval * EATER_ROD_CHARGE;
5222 else p_ptr->magic_num1[item] -= EATER_CHARGE;