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];
87 p_ptr->energy_use = 100;
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:
174 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
175 (void)do_dec_stat(A_STR);
180 case SV_FOOD_SICKNESS:
182 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
183 (void)do_dec_stat(A_CON);
188 case SV_FOOD_STUPIDITY:
190 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
191 (void)do_dec_stat(A_INT);
196 case SV_FOOD_NAIVETY:
198 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
199 (void)do_dec_stat(A_WIS);
204 case SV_FOOD_UNHEALTH:
206 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
207 (void)do_dec_stat(A_CON);
212 case SV_FOOD_DISEASE:
214 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
215 (void)do_dec_stat(A_STR);
220 case SV_FOOD_CURE_POISON:
222 if (set_poisoned(0)) ident = TRUE;
226 case SV_FOOD_CURE_BLINDNESS:
228 if (set_blind(0)) ident = TRUE;
232 case SV_FOOD_CURE_PARANOIA:
234 if (set_afraid(0)) ident = TRUE;
238 case SV_FOOD_CURE_CONFUSION:
240 if (set_confused(0)) ident = TRUE;
244 case SV_FOOD_CURE_SERIOUS:
246 if (hp_player(damroll(4, 8))) ident = TRUE;
250 case SV_FOOD_RESTORE_STR:
252 if (do_res_stat(A_STR)) ident = TRUE;
256 case SV_FOOD_RESTORE_CON:
258 if (do_res_stat(A_CON)) ident = TRUE;
262 case SV_FOOD_RESTORING:
264 if (do_res_stat(A_STR)) ident = TRUE;
265 if (do_res_stat(A_INT)) ident = TRUE;
266 if (do_res_stat(A_WIS)) ident = TRUE;
267 if (do_res_stat(A_DEX)) ident = TRUE;
268 if (do_res_stat(A_CON)) ident = TRUE;
269 if (do_res_stat(A_CHR)) ident = TRUE;
275 /* それぞれの食べ物の感想をオリジナルより細かく表現 */
276 case SV_FOOD_BISCUIT:
278 msg_print("甘くてサクサクしてとてもおいしい。");
285 msg_print("歯ごたえがあっておいしい。");
290 case SV_FOOD_SLIME_MOLD:
292 msg_print("これはなんとも形容しがたい味だ。");
299 msg_print("これはおいしい。");
305 case SV_FOOD_BISCUIT:
307 case SV_FOOD_SLIME_MOLD:
309 msg_print("That tastes good.");
316 case SV_FOOD_WAYBREAD:
318 msg_print(_("これはひじょうに美味だ。", "That tastes good."));
319 (void)set_poisoned(0);
320 (void)hp_player(damroll(4, 8));
326 case SV_FOOD_PINT_OF_ALE:
328 msg_print("のどごし爽やかだ。");
333 case SV_FOOD_PINT_OF_WINE:
335 msg_print("That tastes good.");
340 case SV_FOOD_PINT_OF_ALE:
341 case SV_FOOD_PINT_OF_WINE:
343 msg_print("That tastes good.");
352 /* Combine / Reorder the pack (later) */
353 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
355 if (!(object_is_aware(o_ptr)))
357 chg_virtue(V_KNOWLEDGE, -1);
358 chg_virtue(V_PATIENCE, -1);
359 chg_virtue(V_CHANCE, 1);
362 /* We have tried it */
363 if (o_ptr->tval == TV_FOOD) object_tried(o_ptr);
365 /* The player is now aware of the object */
366 if (ident && !object_is_aware(o_ptr))
369 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
373 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
376 /* Food can feed the player */
377 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
379 /* Reduced nutritional benefit */
380 (void)set_food(p_ptr->food + (o_ptr->pval / 10));
381 msg_print(_("あなたのような者にとって食糧など僅かな栄養にしかならない。",
382 "Mere victuals hold scant sustenance for a being such as yourself."));
384 if (p_ptr->food < PY_FOOD_ALERT) /* Hungry */
385 msg_print(_("あなたの飢えは新鮮な血によってのみ満たされる!",
386 "Your hunger can only be satisfied with fresh blood!"));
388 else if ((prace_is_(RACE_SKELETON) ||
389 prace_is_(RACE_GOLEM) ||
390 prace_is_(RACE_ZOMBIE) ||
391 prace_is_(RACE_SPECTRE)) &&
392 (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
396 if (o_ptr->tval == TV_STAFF &&
397 (item < 0) && (o_ptr->number > 1))
399 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
402 staff = (o_ptr->tval == TV_STAFF) ? _("杖", "staff") : _("魔法棒", "wand");
405 if (o_ptr->pval == 0)
407 msg_format(_("この%sにはもう魔力が残っていない。", "The %s has no charges left."), staff);
408 o_ptr->ident |= (IDENT_EMPTY);
410 /* Combine / Reorder the pack (later) */
411 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
412 p_ptr->window |= (PW_INVEN);
416 msg_format(_("あなたは%sの魔力をエネルギー源として吸収した。", "You absorb mana of the %s as your energy."), staff);
418 /* Use a single charge */
422 set_food(p_ptr->food + 5000);
424 /* XXX Hack -- unstack if necessary */
425 if (o_ptr->tval == TV_STAFF &&
426 (item >= 0) && (o_ptr->number > 1))
431 /* Get local object */
434 /* Obtain a local object */
435 object_copy(q_ptr, o_ptr);
437 /* Modify quantity */
440 /* Restore the charges */
443 /* Unstack the used item */
445 p_ptr->total_weight -= q_ptr->weight;
446 item = inven_carry(q_ptr);
449 msg_format(_("杖をまとめなおした。", "You unstack your staff."));
452 /* Describe charges in the pack */
455 inven_item_charges(item);
458 /* Describe charges on the floor */
461 floor_item_charges(0 - item);
465 p_ptr->window |= (PW_INVEN | PW_EQUIP);
467 /* Don't eat a staff/wand itself */
470 else if ((prace_is_(RACE_DEMON) ||
471 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
472 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
473 my_strchr("pht", r_info[o_ptr->pval].d_char)))
475 /* Drain vitality of humanoids */
476 char o_name[MAX_NLEN];
477 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
478 msg_format(_("%sは燃え上り灰になった。精力を吸収した気がする。", "%^s is burnt to ashes. You absorb its vitality!"), o_name);
479 (void)set_food(PY_FOOD_MAX - 1);
481 else if (prace_is_(RACE_SKELETON))
484 if (o_ptr->tval == TV_SKELETON ||
485 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
487 msg_print(_("あなたは骨で自分の体を補った。", "Your body absorbs the bone."));
488 set_food(p_ptr->food + 5000);
493 if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
494 (o_ptr->sval < SV_FOOD_BISCUIT)))
497 object_type *q_ptr = &forge;
499 msg_print(_("食べ物がアゴを素通りして落ちた!", "The food falls through your jaws!"));
501 /* Create the item */
502 object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval));
504 /* Drop the object from heaven */
505 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
509 msg_print(_("食べ物がアゴを素通りして落ち、消えた!", "The food falls through your jaws and vanishes!"));
512 else if (prace_is_(RACE_GOLEM) ||
513 prace_is_(RACE_ZOMBIE) ||
514 prace_is_(RACE_ENT) ||
515 prace_is_(RACE_DEMON) ||
516 prace_is_(RACE_ANDROID) ||
517 prace_is_(RACE_SPECTRE) ||
518 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
520 msg_print(_("生者の食物はあなたにとってほとんど栄養にならない。", "The food of mortals is poor sustenance for you."));
521 set_food(p_ptr->food + ((o_ptr->pval) / 20));
523 else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
525 /* Waybread is always fully satisfying. */
526 set_food(MAX(p_ptr->food, PY_FOOD_MAX - 1));
530 /* Food can feed the player */
531 (void)set_food(p_ptr->food + o_ptr->pval);
534 /* Destroy a food in the pack */
537 inven_item_increase(item, -1);
538 inven_item_describe(item);
539 inven_item_optimize(item);
542 /* Destroy a food on the floor */
545 floor_item_increase(0 - item, -1);
546 floor_item_describe(0 - item);
547 floor_item_optimize(0 - item);
553 * @brief オブジェクトをプレイヤーが食べることができるかを判定する /
554 * Hook to determine if an object is eatable
555 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
556 * @return 食べることが可能ならばTRUEを返す
558 static bool item_tester_hook_eatable(object_type *o_ptr)
560 if (o_ptr->tval==TV_FOOD) return TRUE;
563 if (prace_is_(RACE_SKELETON))
565 if (o_ptr->tval == TV_SKELETON ||
566 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
572 if (prace_is_(RACE_SKELETON) ||
573 prace_is_(RACE_GOLEM) ||
574 prace_is_(RACE_ZOMBIE) ||
575 prace_is_(RACE_SPECTRE))
577 if (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND)
580 else if (prace_is_(RACE_DEMON) ||
581 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON))
583 if (o_ptr->tval == TV_CORPSE &&
584 o_ptr->sval == SV_CORPSE &&
585 my_strchr("pht", r_info[o_ptr->pval].d_char))
595 * @brief 食料を食べるコマンドのメインルーチン /
596 * Eat some food (from the pack or floor)
599 void do_cmd_eat_food(void)
605 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
607 set_action(ACTION_NONE);
610 /* Restrict choices to food */
611 item_tester_hook = item_tester_hook_eatable;
614 q = _("どれを食べますか? ", "Eat which item? ");
615 s = _("食べ物がない。", "You have nothing to eat.");
617 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
620 do_cmd_eat_food_aux(item);
625 * @brief 薬を飲むコマンドのサブルーチン /
626 * Quaff a potion (from the pack or the floor)
627 * @param item 飲む薬オブジェクトの所持品ID
630 static void do_cmd_quaff_potion_aux(int item)
639 p_ptr->energy_use = 100;
643 if (flush_failure) flush();
644 msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from a bottle."));
650 if (music_singing_any()) stop_singing();
651 if (hex_spelling_any())
653 if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all();
656 /* Get the item (in the pack) */
659 o_ptr = &inventory[item];
662 /* Get the item (on the floor) */
665 o_ptr = &o_list[0 - item];
668 /* Get local object */
671 /* Obtain a local object */
672 object_copy(q_ptr, o_ptr);
677 /* Reduce and describe inventory */
680 inven_item_increase(item, -1);
681 inven_item_describe(item);
682 inven_item_optimize(item);
685 /* Reduce and describe floor item */
688 floor_item_increase(0 - item, -1);
689 floor_item_describe(0 - item);
690 floor_item_optimize(0 - item);
697 /* Not identified yet */
701 lev = k_info[q_ptr->k_idx].level;
703 /* Analyze the potion */
704 if (q_ptr->tval == TV_POTION)
708 /* 飲みごたえをオリジナルより細かく表現 */
709 case SV_POTION_WATER:
710 msg_print(_("口の中がさっぱりした。", ""));
711 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
715 case SV_POTION_APPLE_JUICE:
716 msg_print(_("甘くてサッパリとしていて、とてもおいしい。", ""));
717 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
721 case SV_POTION_SLIME_MOLD:
722 msg_print(_("なんとも不気味な味だ。", ""));
723 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
727 case SV_POTION_SLOWNESS:
728 if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE;
731 case SV_POTION_SALT_WATER:
732 msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
734 if (!(prace_is_(RACE_GOLEM) ||
735 prace_is_(RACE_ZOMBIE) ||
736 prace_is_(RACE_DEMON) ||
737 prace_is_(RACE_ANDROID) ||
738 prace_is_(RACE_SPECTRE) ||
739 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
741 /* Only living creatures get thirsty */
742 (void)set_food(PY_FOOD_STARVE - 1);
745 (void)set_poisoned(0);
746 (void)set_paralyzed(p_ptr->paralyzed + 4);
750 case SV_POTION_POISON:
751 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
753 if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))
760 case SV_POTION_BLINDNESS:
761 if (!p_ptr->resist_blind)
763 if (set_blind(p_ptr->blind + randint0(100) + 100))
770 case SV_POTION_CONFUSION: /* Booze */
771 if (p_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1);
772 else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN;
773 if (!p_ptr->resist_conf)
775 if (set_confused(randint0(20) + 15))
781 if (!p_ptr->resist_chaos)
785 if (set_image(p_ptr->image + randint0(150) + 150))
790 if (one_in_(13) && (p_ptr->pclass != CLASS_MONK))
793 if (one_in_(3)) lose_all_info();
795 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
797 msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head..."));
798 msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing, or how you got here!"));
803 case SV_POTION_SLEEP:
804 if (!p_ptr->free_act)
806 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
808 if (ironman_nightmare)
810 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
812 /* Have some nightmares */
813 sanity_blast(NULL, FALSE);
815 if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))
822 case SV_POTION_LOSE_MEMORIES:
823 if (!p_ptr->hold_exp && (p_ptr->exp > 0))
825 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
826 chg_virtue(V_KNOWLEDGE, -5);
828 lose_exp(p_ptr->exp / 4);
833 case SV_POTION_RUINATION:
834 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
835 take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
837 (void)dec_stat(A_DEX, 25, TRUE);
838 (void)dec_stat(A_WIS, 25, TRUE);
839 (void)dec_stat(A_CON, 25, TRUE);
840 (void)dec_stat(A_STR, 25, TRUE);
841 (void)dec_stat(A_CHR, 25, TRUE);
842 (void)dec_stat(A_INT, 25, TRUE);
846 case SV_POTION_DEC_STR:
847 if (do_dec_stat(A_STR)) ident = TRUE;
850 case SV_POTION_DEC_INT:
851 if (do_dec_stat(A_INT)) ident = TRUE;
854 case SV_POTION_DEC_WIS:
855 if (do_dec_stat(A_WIS)) ident = TRUE;
858 case SV_POTION_DEC_DEX:
859 if (do_dec_stat(A_DEX)) ident = TRUE;
862 case SV_POTION_DEC_CON:
863 if (do_dec_stat(A_CON)) ident = TRUE;
866 case SV_POTION_DEC_CHR:
867 if (do_dec_stat(A_CHR)) ident = TRUE;
870 case SV_POTION_DETONATIONS:
871 msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
872 take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);
874 (void)set_stun(p_ptr->stun + 75);
875 (void)set_cut(p_ptr->cut + 5000);
879 case SV_POTION_DEATH:
880 chg_virtue(V_VITALITY, -1);
881 chg_virtue(V_UNLIFE, 5);
882 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
883 take_hit(DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1);
887 case SV_POTION_INFRAVISION:
888 if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))
894 case SV_POTION_DETECT_INVIS:
895 if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))
901 case SV_POTION_SLOW_POISON:
902 if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE;
905 case SV_POTION_CURE_POISON:
906 if (set_poisoned(0)) ident = TRUE;
909 case SV_POTION_BOLDNESS:
910 if (set_afraid(0)) ident = TRUE;
913 case SV_POTION_SPEED:
916 if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;
920 (void)set_fast(p_ptr->fast + 5, FALSE);
924 case SV_POTION_RESIST_HEAT:
925 if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))
931 case SV_POTION_RESIST_COLD:
932 if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))
938 case SV_POTION_HEROISM:
939 if (set_afraid(0)) ident = TRUE;
940 if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE;
941 if (hp_player(10)) ident = TRUE;
944 case SV_POTION_BESERK_STRENGTH:
945 if (set_afraid(0)) ident = TRUE;
946 if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE;
947 if (hp_player(30)) ident = TRUE;
950 case SV_POTION_CURE_LIGHT:
951 if (hp_player(damroll(2, 8))) ident = TRUE;
952 if (set_blind(0)) ident = TRUE;
953 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
954 if (set_shero(0,TRUE)) ident = TRUE;
957 case SV_POTION_CURE_SERIOUS:
958 if (hp_player(damroll(4, 8))) ident = TRUE;
959 if (set_blind(0)) ident = TRUE;
960 if (set_confused(0)) ident = TRUE;
961 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
962 if (set_shero(0,TRUE)) ident = TRUE;
965 case SV_POTION_CURE_CRITICAL:
966 if (hp_player(damroll(6, 8))) ident = TRUE;
967 if (set_blind(0)) ident = TRUE;
968 if (set_confused(0)) ident = TRUE;
969 if (set_poisoned(0)) ident = TRUE;
970 if (set_stun(0)) ident = TRUE;
971 if (set_cut(0)) ident = TRUE;
972 if (set_shero(0,TRUE)) ident = TRUE;
975 case SV_POTION_HEALING:
976 if (hp_player(300)) ident = TRUE;
977 if (set_blind(0)) ident = TRUE;
978 if (set_confused(0)) ident = TRUE;
979 if (set_poisoned(0)) ident = TRUE;
980 if (set_stun(0)) ident = TRUE;
981 if (set_cut(0)) ident = TRUE;
982 if (set_shero(0,TRUE)) ident = TRUE;
985 case SV_POTION_STAR_HEALING:
986 if (hp_player(1200)) ident = TRUE;
987 if (set_blind(0)) ident = TRUE;
988 if (set_confused(0)) ident = TRUE;
989 if (set_poisoned(0)) ident = TRUE;
990 if (set_stun(0)) ident = TRUE;
991 if (set_cut(0)) ident = TRUE;
992 if (set_shero(0,TRUE)) ident = TRUE;
996 chg_virtue(V_VITALITY, 1);
997 chg_virtue(V_UNLIFE, -5);
998 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
1000 (void)set_poisoned(0);
1002 (void)set_confused(0);
1006 (void)do_res_stat(A_STR);
1007 (void)do_res_stat(A_CON);
1008 (void)do_res_stat(A_DEX);
1009 (void)do_res_stat(A_WIS);
1010 (void)do_res_stat(A_INT);
1011 (void)do_res_stat(A_CHR);
1012 (void)set_shero(0,TRUE);
1018 case SV_POTION_RESTORE_MANA:
1019 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1022 for (i = 0; i < EATER_EXT*2; i++)
1024 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3;
1025 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;
1027 for (; i < EATER_EXT*3; i++)
1029 int k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);
1030 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;
1031 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
1033 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
1034 p_ptr->window |= (PW_PLAYER);
1037 else if (p_ptr->csp < p_ptr->msp)
1039 p_ptr->csp = p_ptr->msp;
1040 p_ptr->csp_frac = 0;
1041 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
1043 p_ptr->redraw |= (PR_MANA);
1044 p_ptr->window |= (PW_PLAYER);
1045 p_ptr->window |= (PW_SPELL);
1048 if (set_shero(0,TRUE)) ident = TRUE;
1051 case SV_POTION_RESTORE_EXP:
1052 if (restore_level()) ident = TRUE;
1055 case SV_POTION_RES_STR:
1056 if (do_res_stat(A_STR)) ident = TRUE;
1059 case SV_POTION_RES_INT:
1060 if (do_res_stat(A_INT)) ident = TRUE;
1063 case SV_POTION_RES_WIS:
1064 if (do_res_stat(A_WIS)) ident = TRUE;
1067 case SV_POTION_RES_DEX:
1068 if (do_res_stat(A_DEX)) ident = TRUE;
1071 case SV_POTION_RES_CON:
1072 if (do_res_stat(A_CON)) ident = TRUE;
1075 case SV_POTION_RES_CHR:
1076 if (do_res_stat(A_CHR)) ident = TRUE;
1079 case SV_POTION_INC_STR:
1080 if (do_inc_stat(A_STR)) ident = TRUE;
1083 case SV_POTION_INC_INT:
1084 if (do_inc_stat(A_INT)) ident = TRUE;
1087 case SV_POTION_INC_WIS:
1088 if (do_inc_stat(A_WIS)) ident = TRUE;
1091 case SV_POTION_INC_DEX:
1092 if (do_inc_stat(A_DEX)) ident = TRUE;
1095 case SV_POTION_INC_CON:
1096 if (do_inc_stat(A_CON)) ident = TRUE;
1099 case SV_POTION_INC_CHR:
1100 if (do_inc_stat(A_CHR)) ident = TRUE;
1103 case SV_POTION_AUGMENTATION:
1104 if (do_inc_stat(A_STR)) ident = TRUE;
1105 if (do_inc_stat(A_INT)) ident = TRUE;
1106 if (do_inc_stat(A_WIS)) ident = TRUE;
1107 if (do_inc_stat(A_DEX)) ident = TRUE;
1108 if (do_inc_stat(A_CON)) ident = TRUE;
1109 if (do_inc_stat(A_CHR)) ident = TRUE;
1112 case SV_POTION_ENLIGHTENMENT:
1113 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
1114 chg_virtue(V_KNOWLEDGE, 1);
1115 chg_virtue(V_ENLIGHTEN, 1);
1120 case SV_POTION_STAR_ENLIGHTENMENT:
1121 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
1122 chg_virtue(V_KNOWLEDGE, 1);
1123 chg_virtue(V_ENLIGHTEN, 2);
1126 (void)do_inc_stat(A_INT);
1127 (void)do_inc_stat(A_WIS);
1128 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
1129 (void)detect_doors(DETECT_RAD_DEFAULT);
1130 (void)detect_stairs(DETECT_RAD_DEFAULT);
1131 (void)detect_treasure(DETECT_RAD_DEFAULT);
1132 (void)detect_objects_gold(DETECT_RAD_DEFAULT);
1133 (void)detect_objects_normal(DETECT_RAD_DEFAULT);
1139 case SV_POTION_SELF_KNOWLEDGE:
1140 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
1146 case SV_POTION_EXPERIENCE:
1147 if (p_ptr->prace == RACE_ANDROID) break;
1148 chg_virtue(V_ENLIGHTEN, 1);
1149 if (p_ptr->exp < PY_MAX_EXP)
1151 s32b ee = (p_ptr->exp / 2) + 10;
1152 if (ee > 100000L) ee = 100000L;
1153 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
1159 case SV_POTION_RESISTANCE:
1160 (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);
1161 (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
1162 (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
1163 (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);
1164 (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
1168 case SV_POTION_CURING:
1169 if (hp_player(50)) ident = TRUE;
1170 if (set_blind(0)) ident = TRUE;
1171 if (set_poisoned(0)) ident = TRUE;
1172 if (set_confused(0)) ident = TRUE;
1173 if (set_stun(0)) ident = TRUE;
1174 if (set_cut(0)) ident = TRUE;
1175 if (set_image(0)) ident = TRUE;
1178 case SV_POTION_INVULNERABILITY:
1179 (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);
1183 case SV_POTION_NEW_LIFE:
1184 do_cmd_rerate(FALSE);
1186 p_ptr->update |= PU_BONUS;
1187 if (p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3)
1189 chg_virtue(V_CHANCE, -5);
1190 msg_print(_("全ての突然変異が治った。", "You are cured of all mutations."));
1191 p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
1192 p_ptr->update |= PU_BONUS;
1194 mutant_regenerate_mod = calc_mutant_regenerate_mod();
1199 case SV_POTION_NEO_TSUYOSHI:
1201 (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
1205 case SV_POTION_TSUYOSHI:
1206 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
1208 p_ptr->tsuyoshi = 1;
1209 (void)set_tsuyoshi(0, TRUE);
1210 if (!p_ptr->resist_chaos)
1212 (void)set_image(50 + randint1(50));
1217 case SV_POTION_POLYMORPH:
1218 if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
1220 chg_virtue(V_CHANCE, -5);
1221 msg_print(_("全ての突然変異が治った。", "You are cured of all mutations."));
1222 p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
1223 p_ptr->update |= PU_BONUS;
1232 if(gain_random_mutation(0)) ident = TRUE;
1234 else if (lose_mutation(0)) ident = TRUE;
1235 } while(!ident || one_in_(2));
1241 if (prace_is_(RACE_SKELETON))
1243 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
1244 (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx);
1247 /* Combine / Reorder the pack (later) */
1248 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1250 if (!(object_is_aware(q_ptr)))
1252 chg_virtue(V_PATIENCE, -1);
1253 chg_virtue(V_CHANCE, 1);
1254 chg_virtue(V_KNOWLEDGE, -1);
1257 /* The item has been tried */
1258 object_tried(q_ptr);
1260 /* An identification was made */
1261 if (ident && !object_is_aware(q_ptr))
1263 object_aware(q_ptr);
1264 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1268 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1270 /* Potions can feed the player */
1271 switch (p_ptr->mimic_form)
1274 switch (p_ptr->prace)
1277 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
1286 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1289 if (q_ptr->tval == TV_FLASK)
1291 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
1292 set_food(p_ptr->food + 5000);
1296 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1300 msg_print(_("水分を取り込んだ。", "You are moistened."));
1301 set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
1304 (void)set_food(p_ptr->food + q_ptr->pval);
1309 case MIMIC_DEMON_LORD:
1310 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1313 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
1316 (void)set_food(p_ptr->food + q_ptr->pval);
1323 * @brief オブジェクトをプレイヤーが飲むことができるかを判定する /
1324 * Hook to determine if an object can be quaffed
1325 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1326 * @return 飲むことが可能ならばTRUEを返す
1328 static bool item_tester_hook_quaff(object_type *o_ptr)
1330 if (o_ptr->tval == TV_POTION) return TRUE;
1332 if (prace_is_(RACE_ANDROID))
1334 if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL)
1342 * @brief 薬を飲むコマンドのメインルーチン /
1343 * Quaff some potion (from the pack or floor)
1346 void do_cmd_quaff_potion(void)
1351 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1353 set_action(ACTION_NONE);
1356 /* Restrict choices to potions */
1357 item_tester_hook = item_tester_hook_quaff;
1360 q = _("どの薬を飲みますか? ", "Quaff which potion? ");
1361 s = _("飲める薬がない。", "You have no potions to quaff.");
1363 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1365 /* Quaff the potion */
1366 do_cmd_quaff_potion_aux(item);
1371 * @brief 巻物を読むコマンドのサブルーチン
1372 * Read a scroll (from the pack or floor).
1373 * @param item 読むオブジェクトの所持品ID
1374 * @param known 判明済ならばTRUE
1378 * Certain scrolls can be "aborted" without losing the scroll. These
1379 * include scrolls with no effects but recharge or identify, which are
1380 * cancelled before use. XXX Reading them still takes a turn, though.
1383 static void do_cmd_read_scroll_aux(int item, bool known)
1385 int k, used_up, ident, lev;
1389 /* Get the item (in the pack) */
1392 o_ptr = &inventory[item];
1395 /* Get the item (on the floor) */
1398 o_ptr = &o_list[0 - item];
1403 p_ptr->energy_use = 100;
1407 if (flush_failure) flush();
1408 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen."));
1413 if (p_ptr->pclass == CLASS_BERSERKER)
1415 msg_print(_("巻物なんて読めない。", "You cannot read."));
1419 if (music_singing_any()) stop_singing();
1422 if (hex_spelling_any() && ((p_ptr->lev < 35) || hex_spell_fully())) stop_hex_spell_all();
1424 /* Not identified yet */
1428 lev = k_info[o_ptr->k_idx].level;
1430 /* Assume the scroll will get used up */
1433 if (o_ptr->tval == TV_SCROLL)
1435 /* Analyze the scroll */
1436 switch (o_ptr->sval)
1438 case SV_SCROLL_DARKNESS:
1440 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
1442 (void)set_blind(p_ptr->blind + 3 + randint1(5));
1444 if (unlite_area(10, 3)) ident = TRUE;
1448 case SV_SCROLL_AGGRAVATE_MONSTER:
1450 msg_print(_("カン高くうなる様な音が辺りを覆った。", "There is a high pitched humming noise."));
1451 aggravate_monsters(0);
1456 case SV_SCROLL_CURSE_ARMOR:
1458 if (curse_armor()) ident = TRUE;
1462 case SV_SCROLL_CURSE_WEAPON:
1465 if (buki_motteruka(INVEN_RARM))
1468 if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
1470 else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM;
1471 if (k && curse_weapon(FALSE, k)) ident = TRUE;
1475 case SV_SCROLL_SUMMON_MONSTER:
1477 for (k = 0; k < randint1(3); k++)
1479 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
1487 case SV_SCROLL_SUMMON_UNDEAD:
1489 for (k = 0; k < randint1(3); k++)
1491 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
1499 case SV_SCROLL_SUMMON_PET:
1501 if (summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET)))
1508 case SV_SCROLL_SUMMON_KIN:
1510 if (summon_kin_player(p_ptr->lev, p_ptr->y, p_ptr->x, (PM_FORCE_PET | PM_ALLOW_GROUP)))
1517 case SV_SCROLL_TRAP_CREATION:
1519 if (trap_creation(p_ptr->y, p_ptr->x)) ident = TRUE;
1523 case SV_SCROLL_PHASE_DOOR:
1525 teleport_player(10, 0L);
1530 case SV_SCROLL_TELEPORT:
1532 teleport_player(100, 0L);
1537 case SV_SCROLL_TELEPORT_LEVEL:
1539 (void)teleport_level(0);
1544 case SV_SCROLL_WORD_OF_RECALL:
1546 if (!word_of_recall()) used_up = FALSE;
1551 case SV_SCROLL_IDENTIFY:
1553 if (!ident_spell(FALSE)) used_up = FALSE;
1558 case SV_SCROLL_STAR_IDENTIFY:
1560 if (!identify_fully(FALSE)) used_up = FALSE;
1565 case SV_SCROLL_REMOVE_CURSE:
1569 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1575 case SV_SCROLL_STAR_REMOVE_CURSE:
1577 if (remove_all_curse())
1579 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1585 case SV_SCROLL_ENCHANT_ARMOR:
1588 if (!enchant_spell(0, 0, 1)) used_up = FALSE;
1592 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
1594 if (!enchant_spell(1, 0, 0)) used_up = FALSE;
1599 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
1601 if (!enchant_spell(0, 1, 0)) used_up = FALSE;
1606 case SV_SCROLL_STAR_ENCHANT_ARMOR:
1608 if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
1613 case SV_SCROLL_STAR_ENCHANT_WEAPON:
1615 if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
1620 case SV_SCROLL_RECHARGING:
1622 if (!recharge(130)) used_up = FALSE;
1627 case SV_SCROLL_MUNDANITY:
1630 if (!mundane_spell(FALSE)) used_up = FALSE;
1634 case SV_SCROLL_LIGHT:
1636 if (lite_area(damroll(2, 8), 2)) ident = TRUE;
1640 case SV_SCROLL_MAPPING:
1642 map_area(DETECT_RAD_MAP);
1647 case SV_SCROLL_DETECT_GOLD:
1649 if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
1650 if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
1654 case SV_SCROLL_DETECT_ITEM:
1656 if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
1660 case SV_SCROLL_DETECT_TRAP:
1662 if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
1666 case SV_SCROLL_DETECT_DOOR:
1668 if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
1669 if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
1673 case SV_SCROLL_DETECT_INVIS:
1675 if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
1679 case SV_SCROLL_SATISFY_HUNGER:
1681 if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
1685 case SV_SCROLL_BLESSING:
1687 if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
1691 case SV_SCROLL_HOLY_CHANT:
1693 if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
1697 case SV_SCROLL_HOLY_PRAYER:
1699 if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
1703 case SV_SCROLL_MONSTER_CONFUSION:
1705 if (!(p_ptr->special_attack & ATTACK_CONFUSE))
1707 msg_print(_("手が輝き始めた。", "Your hands begin to glow."));
1708 p_ptr->special_attack |= ATTACK_CONFUSE;
1709 p_ptr->redraw |= (PR_STATUS);
1715 case SV_SCROLL_PROTECTION_FROM_EVIL:
1718 if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
1722 case SV_SCROLL_RUNE_OF_PROTECTION:
1729 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
1731 if (destroy_doors_touch()) ident = TRUE;
1735 case SV_SCROLL_STAR_DESTRUCTION:
1737 if (destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE))
1740 msg_print(_("ダンジョンが揺れた...", "The dungeon trembles..."));
1745 case SV_SCROLL_DISPEL_UNDEAD:
1747 if (dispel_undead(80)) ident = TRUE;
1751 case SV_SCROLL_SPELL:
1753 if ((p_ptr->pclass == CLASS_WARRIOR) ||
1754 (p_ptr->pclass == CLASS_IMITATOR) ||
1755 (p_ptr->pclass == CLASS_MINDCRAFTER) ||
1756 (p_ptr->pclass == CLASS_SORCERER) ||
1757 (p_ptr->pclass == CLASS_ARCHER) ||
1758 (p_ptr->pclass == CLASS_MAGIC_EATER) ||
1759 (p_ptr->pclass == CLASS_RED_MAGE) ||
1760 (p_ptr->pclass == CLASS_SAMURAI) ||
1761 (p_ptr->pclass == CLASS_BLUE_MAGE) ||
1762 (p_ptr->pclass == CLASS_CAVALRY) ||
1763 (p_ptr->pclass == CLASS_BERSERKER) ||
1764 (p_ptr->pclass == CLASS_SMITH) ||
1765 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
1766 (p_ptr->pclass == CLASS_NINJA) ||
1767 (p_ptr->pclass == CLASS_SNIPER)) break;
1768 p_ptr->add_spells++;
1769 p_ptr->update |= (PU_SPELLS);
1774 case SV_SCROLL_GENOCIDE:
1776 (void)symbol_genocide(300, TRUE);
1781 case SV_SCROLL_MASS_GENOCIDE:
1783 (void)mass_genocide(300, TRUE);
1788 case SV_SCROLL_ACQUIREMENT:
1790 acquirement(p_ptr->y, p_ptr->x, 1, TRUE, FALSE, FALSE);
1795 case SV_SCROLL_STAR_ACQUIREMENT:
1797 acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE);
1802 /* New Hengband scrolls */
1803 case SV_SCROLL_FIRE:
1805 fire_ball(GF_FIRE, 0, 666, 4);
1806 /* Note: "Double" damage since it is centered on the player ... */
1807 if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
1808 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1);
1817 fire_ball(GF_ICE, 0, 777, 4);
1818 if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
1819 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
1825 case SV_SCROLL_CHAOS:
1827 fire_ball(GF_CHAOS, 0, 1000, 4);
1828 if (!p_ptr->resist_chaos)
1829 take_hit(DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1);
1835 case SV_SCROLL_RUMOR:
1837 msg_print(_("巻物にはメッセージが書かれている:", "There is message on the scroll. It says:"));
1839 display_rumor(TRUE);
1841 msg_print(_("巻物は煙を立てて消え去った!", "The scroll disappears in a puff of smoke!"));
1847 case SV_SCROLL_ARTIFACT:
1850 if (!artifact_scroll()) used_up = FALSE;
1854 case SV_SCROLL_RESET_RECALL:
1857 if (!reset_recall()) used_up = FALSE;
1861 case SV_SCROLL_AMUSEMENT:
1864 amusement(p_ptr->y, p_ptr->x, 1, FALSE);
1868 case SV_SCROLL_STAR_AMUSEMENT:
1871 amusement(p_ptr->y, p_ptr->x, randint1(2) + 1, FALSE);
1876 else if (o_ptr->name1 == ART_GHB)
1878 msg_print(_("私は苦労して『グレーター・ヘル=ビースト』を倒した。", "I had a very hard time to kill the Greater hell-beast, "));
1879 msg_print(_("しかし手に入ったのはこのきたないTシャツだけだった。", "but all I got was this lousy t-shirt!"));
1882 else if (o_ptr->name1 == ART_POWER)
1884 msg_print(_("「一つの指輪は全てを統べ、", "'One Ring to rule them all, "));
1886 msg_print(_("一つの指輪は全てを見つけ、", "One Ring to find them, "));
1888 msg_print(_("一つの指輪は全てを捕らえて", "One Ring to bring them all "));
1890 msg_print(_("暗闇の中に繋ぎとめる。」", "and in the darkness bind them.'"));
1893 else if (o_ptr->tval==TV_PARCHMENT)
1896 char o_name[MAX_NLEN];
1902 q=format("book-%d_jp.txt",o_ptr->sval);
1904 /* Display object description */
1905 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1907 /* Build the filename */
1908 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q);
1910 /* Peruse the help file */
1911 (void)show_file(TRUE, buf, o_name, 0, 0);
1920 /* Combine / Reorder the pack (later) */
1921 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1923 if (!(object_is_aware(o_ptr)))
1925 chg_virtue(V_PATIENCE, -1);
1926 chg_virtue(V_CHANCE, 1);
1927 chg_virtue(V_KNOWLEDGE, -1);
1930 /* The item was tried */
1931 object_tried(o_ptr);
1933 /* An identification was made */
1934 if (ident && !object_is_aware(o_ptr))
1936 object_aware(o_ptr);
1937 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1941 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1944 /* Hack -- allow certain scrolls to be "preserved" */
1950 sound(SOUND_SCROLL);
1952 /* Destroy a scroll in the pack */
1955 inven_item_increase(item, -1);
1956 inven_item_describe(item);
1957 inven_item_optimize(item);
1960 /* Destroy a scroll on the floor */
1963 floor_item_increase(0 - item, -1);
1964 floor_item_describe(0 - item);
1965 floor_item_optimize(0 - item);
1970 * @brief オブジェクトをプレイヤーが読むことができるかを判定する /
1971 * Hook to determine if an object is readable
1972 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1973 * @return 読むことが可能ならばTRUEを返す
1975 static bool item_tester_hook_readable(object_type *o_ptr)
1977 if ((o_ptr->tval==TV_SCROLL) || (o_ptr->tval==TV_PARCHMENT) || (o_ptr->name1 == ART_GHB) || (o_ptr->name1 == ART_POWER)) return (TRUE);
1984 * @brief 読むコマンドのメインルーチン /
1985 * Eat some food (from the pack or floor)
1988 void do_cmd_read_scroll(void)
1994 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1996 set_action(ACTION_NONE);
1999 /* Check some conditions */
2002 msg_print(_("目が見えない。", "You can't see anything."));
2007 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
2010 if (p_ptr->confused)
2012 msg_print(_("混乱していて読めない。", "You are too confused!"));
2017 /* Restrict choices to scrolls */
2018 item_tester_hook = item_tester_hook_readable;
2021 q = _("どの巻物を読みますか? ", "Read which scroll? ");
2022 s = _("読める巻物がない。", "You have no scrolls to read.");
2024 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2026 /* Get the item (in the pack) */
2029 o_ptr = &inventory[item];
2032 /* Get the item (on the floor) */
2035 o_ptr = &o_list[0 - item];
2038 /* Read the scroll */
2039 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
2044 * @param sval オブジェクトのsval
2045 * @param use_charge 使用回数を消費したかどうかを返す参照ポインタ
2046 * @param powerful 強力発動上の処理ならばTRUE
2047 * @param magic 魔道具術上の処理ならばTRUE
2048 * @param known 判明済ならばTRUE
2049 * @return 発動により効果内容が確定したならばTRUEを返す
2051 static int staff_effect(int sval, bool *use_charge, bool powerful, bool magic, bool known)
2055 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2056 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
2058 /* Analyze the staff */
2061 case SV_STAFF_DARKNESS:
2063 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
2065 if (set_blind(p_ptr->blind + 3 + randint1(5))) ident = TRUE;
2067 if (unlite_area(10, (powerful ? 6 : 3))) ident = TRUE;
2071 case SV_STAFF_SLOWNESS:
2073 if (set_slow(p_ptr->slow + randint1(30) + 15, FALSE)) ident = TRUE;
2077 case SV_STAFF_HASTE_MONSTERS:
2079 if (speed_monsters()) ident = TRUE;
2083 case SV_STAFF_SUMMONING:
2085 const int times = randint1(powerful ? 8 : 4);
2086 for (k = 0; k < times; k++)
2088 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2096 case SV_STAFF_TELEPORTATION:
2098 teleport_player((powerful ? 150 : 100), 0L);
2103 case SV_STAFF_IDENTIFY:
2106 if (!identify_fully(FALSE)) *use_charge = FALSE;
2108 if (!ident_spell(FALSE)) *use_charge = FALSE;
2114 case SV_STAFF_REMOVE_CURSE:
2116 bool result = powerful ? remove_all_curse() : remove_curse();
2121 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
2123 else if (!p_ptr->blind)
2125 msg_print(_("杖は一瞬ブルーに輝いた...", "The staff glows blue for a moment..."));
2133 case SV_STAFF_STARLITE:
2135 int num = damroll(5, 3);
2139 if (!p_ptr->blind && !magic)
2141 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2143 for (k = 0; k < num; k++)
2149 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
2151 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2153 if (!player_bold(y, x)) break;
2156 project(0, 0, y, x, damroll(6 + lev / 8, 10), GF_LITE_WEAK,
2157 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
2165 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
2169 case SV_STAFF_MAPPING:
2171 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
2176 case SV_STAFF_DETECT_GOLD:
2178 if (detect_treasure(detect_rad)) ident = TRUE;
2179 if (detect_objects_gold(detect_rad)) ident = TRUE;
2183 case SV_STAFF_DETECT_ITEM:
2185 if (detect_objects_normal(detect_rad)) ident = TRUE;
2189 case SV_STAFF_DETECT_TRAP:
2191 if (detect_traps(detect_rad, known)) ident = TRUE;
2195 case SV_STAFF_DETECT_DOOR:
2197 if (detect_doors(detect_rad)) ident = TRUE;
2198 if (detect_stairs(detect_rad)) ident = TRUE;
2202 case SV_STAFF_DETECT_INVIS:
2204 if (detect_monsters_invis(detect_rad)) ident = TRUE;
2208 case SV_STAFF_DETECT_EVIL:
2210 if (detect_monsters_evil(detect_rad)) ident = TRUE;
2214 case SV_STAFF_CURE_LIGHT:
2216 if (hp_player(damroll((powerful ? 4 : 2), 8))) ident = TRUE;
2218 if (set_blind(0)) ident = TRUE;
2219 if (set_poisoned(0)) ident = TRUE;
2220 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
2222 if (set_shero(0,TRUE)) ident = TRUE;
2226 case SV_STAFF_CURING:
2228 if (set_blind(0)) ident = TRUE;
2229 if (set_poisoned(0)) ident = TRUE;
2230 if (set_confused(0)) ident = TRUE;
2231 if (set_stun(0)) ident = TRUE;
2232 if (set_cut(0)) ident = TRUE;
2233 if (set_image(0)) ident = TRUE;
2234 if (set_shero(0,TRUE)) ident = TRUE;
2238 case SV_STAFF_HEALING:
2240 if (hp_player(powerful ? 500 : 300)) ident = TRUE;
2241 if (set_stun(0)) ident = TRUE;
2242 if (set_cut(0)) ident = TRUE;
2243 if (set_shero(0,TRUE)) ident = TRUE;
2247 case SV_STAFF_THE_MAGI:
2249 if (do_res_stat(A_INT)) ident = TRUE;
2250 if (p_ptr->csp < p_ptr->msp)
2252 p_ptr->csp = p_ptr->msp;
2253 p_ptr->csp_frac = 0;
2255 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
2257 p_ptr->redraw |= (PR_MANA);
2258 p_ptr->window |= (PW_PLAYER);
2259 p_ptr->window |= (PW_SPELL);
2261 if (set_shero(0,TRUE)) ident = TRUE;
2265 case SV_STAFF_SLEEP_MONSTERS:
2267 if (sleep_monsters(lev)) ident = TRUE;
2271 case SV_STAFF_SLOW_MONSTERS:
2273 if (slow_monsters(lev)) ident = TRUE;
2277 case SV_STAFF_SPEED:
2279 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
2283 case SV_STAFF_PROBING:
2290 case SV_STAFF_DISPEL_EVIL:
2292 if (dispel_evil(powerful ? 120 : 80)) ident = TRUE;
2296 case SV_STAFF_POWER:
2298 if (dispel_monsters(powerful ? 225 : 150)) ident = TRUE;
2302 case SV_STAFF_HOLINESS:
2304 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
2306 if (set_protevil((magic ? 0 : p_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
2307 if (set_poisoned(0)) ident = TRUE;
2308 if (set_afraid(0)) ident = TRUE;
2309 if (hp_player(50)) ident = TRUE;
2310 if (set_stun(0)) ident = TRUE;
2311 if (set_cut(0)) ident = TRUE;
2315 case SV_STAFF_GENOCIDE:
2317 (void)symbol_genocide((magic ? lev + 50 : 200), TRUE);
2322 case SV_STAFF_EARTHQUAKES:
2324 if (earthquake(p_ptr->y, p_ptr->x, (powerful ? 15 : 10)))
2327 msg_print(_("ダンジョンが揺れた。", "The dungeon trembles."));
2332 case SV_STAFF_DESTRUCTION:
2334 if (destroy_area(p_ptr->y, p_ptr->x, (powerful ? 18 : 13) + randint0(5), FALSE))
2340 case SV_STAFF_ANIMATE_DEAD:
2342 if (animate_dead(0, p_ptr->y, p_ptr->x))
2348 case SV_STAFF_MSTORM:
2350 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
2351 project(0, (powerful ? 7 : 5), p_ptr->y, p_ptr->x,
2352 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
2353 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))
2355 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
2362 case SV_STAFF_NOTHING:
2364 msg_print(_("何も起らなかった。", "Nothing happen."));
2365 if (prace_is_(RACE_SKELETON) || prace_is_(RACE_GOLEM) ||
2366 prace_is_(RACE_ZOMBIE) || prace_is_(RACE_SPECTRE))
2367 msg_print(_("もったいない事をしたような気がする。食べ物は大切にしなくては。", "What a waste. It's your food!"));
2375 * @brief 杖を使うコマンドのサブルーチン /
2376 * Use a staff. -RAK-
2377 * @param item 使うオブジェクトの所持品ID
2380 * One charge of one staff disappears.
2381 * Hack -- staffs of identify can be "cancelled".
2383 static void do_cmd_use_staff_aux(int item)
2385 int ident, chance, lev;
2389 /* Hack -- let staffs of identify get aborted */
2390 bool use_charge = TRUE;
2393 /* Get the item (in the pack) */
2396 o_ptr = &inventory[item];
2399 /* Get the item (on the floor) */
2402 o_ptr = &o_list[0 - item];
2406 /* Mega-Hack -- refuse to use a pile from the ground */
2407 if ((item < 0) && (o_ptr->number > 1))
2409 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
2415 p_ptr->energy_use = 100;
2417 /* Extract the item level */
2418 lev = k_info[o_ptr->k_idx].level;
2419 if (lev > 50) lev = 50 + (lev - 50)/2;
2421 /* Base chance of success */
2422 chance = p_ptr->skill_dev;
2424 /* Confusion hurts skill */
2425 if (p_ptr->confused) chance = chance / 2;
2427 /* Hight level objects are harder */
2428 chance = chance - lev;
2430 /* Give everyone a (slight) chance */
2431 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
2433 chance = USE_DEVICE;
2438 if (flush_failure) flush();
2439 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this staff is freezing too."));
2444 /* Roll for usage */
2445 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
2447 if (flush_failure) flush();
2448 msg_print(_("杖をうまく使えなかった。", "You failed to use the staff properly."));
2453 /* Notice empty staffs */
2454 if (o_ptr->pval <= 0)
2456 if (flush_failure) flush();
2457 msg_print(_("この杖にはもう魔力が残っていない。", "The staff has no charges left."));
2458 o_ptr->ident |= (IDENT_EMPTY);
2460 /* Combine / Reorder the pack (later) */
2461 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2462 p_ptr->window |= (PW_INVEN);
2471 ident = staff_effect(o_ptr->sval, &use_charge, FALSE, FALSE, object_is_aware(o_ptr));
2473 if (!(object_is_aware(o_ptr)))
2475 chg_virtue(V_PATIENCE, -1);
2476 chg_virtue(V_CHANCE, 1);
2477 chg_virtue(V_KNOWLEDGE, -1);
2480 /* Combine / Reorder the pack (later) */
2481 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2483 /* Tried the item */
2484 object_tried(o_ptr);
2486 /* An identification was made */
2487 if (ident && !object_is_aware(o_ptr))
2489 object_aware(o_ptr);
2490 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2494 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2497 /* Hack -- some uses are "free" */
2498 if (!use_charge) return;
2501 /* Use a single charge */
2504 /* XXX Hack -- unstack if necessary */
2505 if ((item >= 0) && (o_ptr->number > 1))
2510 /* Get local object */
2513 /* Obtain a local object */
2514 object_copy(q_ptr, o_ptr);
2516 /* Modify quantity */
2519 /* Restore the charges */
2522 /* Unstack the used item */
2524 p_ptr->total_weight -= q_ptr->weight;
2525 item = inven_carry(q_ptr);
2528 msg_print(_("杖をまとめなおした。", "You unstack your staff."));
2531 /* Describe charges in the pack */
2534 inven_item_charges(item);
2537 /* Describe charges on the floor */
2540 floor_item_charges(0 - item);
2545 * @brief 杖を使うコマンドのメインルーチン /
2548 void do_cmd_use_staff(void)
2553 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2555 set_action(ACTION_NONE);
2558 /* Restrict choices to wands */
2559 item_tester_tval = TV_STAFF;
2562 q = _("どの杖を使いますか? ", "Use which staff? ");
2563 s = _("使える杖がない。", "You have no staff to use.");
2565 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2567 do_cmd_use_staff_aux(item);
2571 * @brief 魔法棒の効果を発動する
2572 * @param sval オブジェクトのsval
2573 * @param dir 発動の方向ID
2574 * @param powerful 強力発動上の処理ならばTRUE
2575 * @param magic 魔道具術上の処理ならばTRUE
2576 * @return 発動により効果内容が確定したならばTRUEを返す
2578 static int wand_effect(int sval, int dir, bool powerful, bool magic)
2581 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2582 int rad = powerful ? 3 : 2;
2584 /* XXX Hack -- Wand of wonder can do anything before it */
2585 if (sval == SV_WAND_WONDER)
2587 int vir = virtue_number(V_CHANCE);
2588 sval = randint0(SV_WAND_WONDER);
2592 if (p_ptr->virtues[vir - 1] > 0)
2594 while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
2595 if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
2599 while (randint1(300) < (0-p_ptr->virtues[vir - 1])) sval--;
2600 if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
2603 if (sval < SV_WAND_TELEPORT_AWAY)
2604 chg_virtue(V_CHANCE, 1);
2607 /* Analyze the wand */
2610 case SV_WAND_HEAL_MONSTER:
2612 int dam = damroll((powerful ? 20 : 10), 10);
2613 if (heal_monster(dir, dam)) ident = TRUE;
2617 case SV_WAND_HASTE_MONSTER:
2619 if (speed_monster(dir, lev)) ident = TRUE;
2623 case SV_WAND_CLONE_MONSTER:
2625 if (clone_monster(dir)) ident = TRUE;
2629 case SV_WAND_TELEPORT_AWAY:
2631 int distance = MAX_SIGHT * (powerful ? 8 : 5);
2632 if (teleport_monster(dir, distance)) ident = TRUE;
2636 case SV_WAND_DISARMING:
2638 if (disarm_trap(dir)) ident = TRUE;
2639 if (powerful && disarm_traps_touch()) ident = TRUE;
2643 case SV_WAND_TRAP_DOOR_DEST:
2645 if (destroy_door(dir)) ident = TRUE;
2646 if (powerful && destroy_doors_touch()) ident = TRUE;
2650 case SV_WAND_STONE_TO_MUD:
2652 int dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
2653 if (wall_to_mud(dir, dam)) ident = TRUE;
2659 int dam = damroll((powerful ? 12 : 6), 8);
2660 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
2661 (void)lite_line(dir, dam);
2666 case SV_WAND_SLEEP_MONSTER:
2668 if (sleep_monster(dir, lev)) ident = TRUE;
2672 case SV_WAND_SLOW_MONSTER:
2674 if (slow_monster(dir, lev)) ident = TRUE;
2678 case SV_WAND_CONFUSE_MONSTER:
2680 if (confuse_monster(dir, lev)) ident = TRUE;
2684 case SV_WAND_FEAR_MONSTER:
2686 if (fear_monster(dir, lev)) ident = TRUE;
2690 case SV_WAND_DRAIN_LIFE:
2692 if (drain_life(dir, 80 + lev)) ident = TRUE;
2696 case SV_WAND_POLYMORPH:
2698 if (poly_monster(dir, lev)) ident = TRUE;
2702 case SV_WAND_STINKING_CLOUD:
2704 fire_ball(GF_POIS, dir, 12 + lev / 4, rad);
2709 case SV_WAND_MAGIC_MISSILE:
2711 fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + lev / 10, 6));
2716 case SV_WAND_ACID_BOLT:
2718 fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + lev / 7, 8));
2723 case SV_WAND_CHARM_MONSTER:
2725 if (charm_monster(dir, MAX(20, lev)))
2730 case SV_WAND_FIRE_BOLT:
2732 fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + lev / 6, 8));
2737 case SV_WAND_COLD_BOLT:
2739 fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + lev / 8, 8));
2744 case SV_WAND_ACID_BALL:
2746 fire_ball(GF_ACID, dir, 60 + 3 * lev / 4, rad);
2751 case SV_WAND_ELEC_BALL:
2753 fire_ball(GF_ELEC, dir, 40 + 3 * lev / 4, rad);
2758 case SV_WAND_FIRE_BALL:
2760 fire_ball(GF_FIRE, dir, 70 + 3 * lev / 4, rad);
2765 case SV_WAND_COLD_BALL:
2767 fire_ball(GF_COLD, dir, 50 + 3 * lev / 4, rad);
2772 case SV_WAND_WONDER:
2774 msg_print(_("おっと、謎の魔法棒を始動させた。", "Oops. Wand of wonder activated."));
2778 case SV_WAND_DRAGON_FIRE:
2780 fire_ball(GF_FIRE, dir, (powerful ? 300 : 200), -3);
2785 case SV_WAND_DRAGON_COLD:
2787 fire_ball(GF_COLD, dir, (powerful ? 270 : 180), -3);
2792 case SV_WAND_DRAGON_BREATH:
2797 switch (randint1(5))
2821 if (powerful) dam = (dam * 3) / 2;
2823 fire_ball(typ, dir, dam, -3);
2829 case SV_WAND_DISINTEGRATE:
2831 fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(lev * 2), rad);
2836 case SV_WAND_ROCKETS:
2838 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
2839 fire_rocket(GF_ROCKET, dir, 250 + lev * 3, rad);
2844 case SV_WAND_STRIKING:
2846 fire_bolt(GF_METEOR, dir, damroll(15 + lev / 3, 13));
2851 case SV_WAND_GENOCIDE:
2853 fire_ball_hide(GF_GENOCIDE, dir, magic ? lev + 50 : 250, 0);
2862 * @brief 魔法棒を使うコマンドのサブルーチン /
2863 * Aim a wand (from the pack or floor).
2864 * @param item 使うオブジェクトの所持品ID
2868 * Use a single charge from a single item.
2869 * Handle "unstacking" in a logical manner.
2870 * For simplicity, you cannot use a stack of items from the
2871 * ground. This would require too much nasty code.
2872 * There are no wands which can "destroy" themselves, in the inventory
2873 * or on the ground, so we can ignore this possibility. Note that this
2874 * required giving "wand of wonder" the ability to ignore destruction
2875 * by electric balls.
2876 * All wands can be "cancelled" at the "Direction?" prompt for free.
2877 * Note that the basic "bolt" wands do slightly less damage than the
2878 * basic "bolt" rods, but the basic "ball" wands do the same damage
2879 * as the basic "ball" rods.
2882 static void do_cmd_aim_wand_aux(int item)
2884 int lev, ident, chance, dir;
2886 bool old_target_pet = target_pet;
2888 /* Get the item (in the pack) */
2891 o_ptr = &inventory[item];
2894 /* Get the item (on the floor) */
2897 o_ptr = &o_list[0 - item];
2900 /* Mega-Hack -- refuse to aim a pile from the ground */
2901 if ((item < 0) && (o_ptr->number > 1))
2903 msg_print(_("まずは魔法棒を拾わなければ。", "You must first pick up the wands."));
2908 /* Allow direction to be cancelled for free */
2909 if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
2910 || o_ptr->sval == SV_WAND_HASTE_MONSTER))
2912 if (!get_aim_dir(&dir))
2914 target_pet = old_target_pet;
2917 target_pet = old_target_pet;
2920 p_ptr->energy_use = 100;
2923 lev = k_info[o_ptr->k_idx].level;
2924 if (lev > 50) lev = 50 + (lev - 50)/2;
2926 /* Base chance of success */
2927 chance = p_ptr->skill_dev;
2929 /* Confusion hurts skill */
2930 if (p_ptr->confused) chance = chance / 2;
2932 /* Hight level objects are harder */
2933 chance = chance - lev;
2935 /* Give everyone a (slight) chance */
2936 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
2938 chance = USE_DEVICE;
2943 if (flush_failure) flush();
2944 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this wand is freezing too."));
2949 /* Roll for usage */
2950 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
2952 if (flush_failure) flush();
2953 msg_print(_("魔法棒をうまく使えなかった。", "You failed to use the wand properly."));
2958 /* The wand is already empty! */
2959 if (o_ptr->pval <= 0)
2961 if (flush_failure) flush();
2962 msg_print(_("この魔法棒にはもう魔力が残っていない。", "The wand has no charges left."));
2963 o_ptr->ident |= (IDENT_EMPTY);
2965 /* Combine / Reorder the pack (later) */
2966 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2967 p_ptr->window |= (PW_INVEN);
2975 ident = wand_effect(o_ptr->sval, dir, FALSE, FALSE);
2977 /* Combine / Reorder the pack (later) */
2978 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2980 if (!(object_is_aware(o_ptr)))
2982 chg_virtue(V_PATIENCE, -1);
2983 chg_virtue(V_CHANCE, 1);
2984 chg_virtue(V_KNOWLEDGE, -1);
2987 /* Mark it as tried */
2988 object_tried(o_ptr);
2990 /* Apply identification */
2991 if (ident && !object_is_aware(o_ptr))
2993 object_aware(o_ptr);
2994 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2998 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3001 /* Use a single charge */
3004 /* Describe the charges in the pack */
3007 inven_item_charges(item);
3010 /* Describe the charges on the floor */
3013 floor_item_charges(0 - item);
3018 * @brief 魔法棒を使うコマンドのメインルーチン /
3021 void do_cmd_aim_wand(void)
3026 /* Restrict choices to wands */
3027 item_tester_tval = TV_WAND;
3029 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3031 set_action(ACTION_NONE);
3035 q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
3036 s = _("使える魔法棒がない。", "You have no wand to aim.");
3038 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3041 do_cmd_aim_wand_aux(item);
3045 * @brief ロッドの効果を発動する
3046 * @param sval オブジェクトのsval
3047 * @param dir 発動目標の方向ID
3048 * @param use_charge チャージを消費したかどうかを返す参照ポインタ
3049 * @param powerful 強力発動上の処理ならばTRUE
3050 * @param magic 魔道具術上の処理ならばTRUE
3051 * @return 発動により効果内容が確定したならばTRUEを返す
3053 static int rod_effect(int sval, int dir, bool *use_charge, bool powerful, bool magic)
3056 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
3057 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
3058 int rad = powerful ? 3 : 2;
3063 /* Analyze the rod */
3066 case SV_ROD_DETECT_TRAP:
3068 if (detect_traps(detect_rad, (bool)(dir ? FALSE : TRUE))) ident = TRUE;
3072 case SV_ROD_DETECT_DOOR:
3074 if (detect_doors(detect_rad)) ident = TRUE;
3075 if (detect_stairs(detect_rad)) ident = TRUE;
3079 case SV_ROD_IDENTIFY:
3082 if (!identify_fully(FALSE)) *use_charge = FALSE;
3084 if (!ident_spell(FALSE)) *use_charge = FALSE;
3092 if (!word_of_recall()) *use_charge = FALSE;
3097 case SV_ROD_ILLUMINATION:
3099 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
3103 case SV_ROD_MAPPING:
3105 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
3110 case SV_ROD_DETECTION:
3112 detect_all(detect_rad);
3117 case SV_ROD_PROBING:
3126 if (set_blind(0)) ident = TRUE;
3127 if (set_poisoned(0)) ident = TRUE;
3128 if (set_confused(0)) ident = TRUE;
3129 if (set_stun(0)) ident = TRUE;
3130 if (set_cut(0)) ident = TRUE;
3131 if (set_image(0)) ident = TRUE;
3132 if (set_shero(0,TRUE)) ident = TRUE;
3136 case SV_ROD_HEALING:
3138 if (hp_player(powerful ? 750 : 500)) ident = TRUE;
3139 if (set_stun(0)) ident = TRUE;
3140 if (set_cut(0)) ident = TRUE;
3141 if (set_shero(0,TRUE)) ident = TRUE;
3145 case SV_ROD_RESTORATION:
3147 if (restore_level()) ident = TRUE;
3148 if (do_res_stat(A_STR)) ident = TRUE;
3149 if (do_res_stat(A_INT)) ident = TRUE;
3150 if (do_res_stat(A_WIS)) ident = TRUE;
3151 if (do_res_stat(A_DEX)) ident = TRUE;
3152 if (do_res_stat(A_CON)) ident = TRUE;
3153 if (do_res_stat(A_CHR)) ident = TRUE;
3159 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
3163 case SV_ROD_PESTICIDE:
3165 if (dispel_monsters(powerful ? 8 : 4)) ident = TRUE;
3169 case SV_ROD_TELEPORT_AWAY:
3171 int distance = MAX_SIGHT * (powerful ? 8 : 5);
3172 if (teleport_monster(dir, distance)) ident = TRUE;
3176 case SV_ROD_DISARMING:
3178 if (disarm_trap(dir)) ident = TRUE;
3179 if (powerful && disarm_traps_touch()) ident = TRUE;
3185 int dam = damroll((powerful ? 12 : 6), 8);
3186 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
3187 (void)lite_line(dir, dam);
3192 case SV_ROD_SLEEP_MONSTER:
3194 if (sleep_monster(dir, lev)) ident = TRUE;
3198 case SV_ROD_SLOW_MONSTER:
3200 if (slow_monster(dir, lev)) ident = TRUE;
3204 case SV_ROD_DRAIN_LIFE:
3206 if (drain_life(dir, 70 + 3 * lev / 2)) ident = TRUE;
3210 case SV_ROD_POLYMORPH:
3212 if (poly_monster(dir, lev)) ident = TRUE;
3216 case SV_ROD_ACID_BOLT:
3218 fire_bolt_or_beam(10, GF_ACID, dir, damroll(6 + lev / 7, 8));
3223 case SV_ROD_ELEC_BOLT:
3225 fire_bolt_or_beam(10, GF_ELEC, dir, damroll(4 + lev / 9, 8));
3230 case SV_ROD_FIRE_BOLT:
3232 fire_bolt_or_beam(10, GF_FIRE, dir, damroll(7 + lev / 6, 8));
3237 case SV_ROD_COLD_BOLT:
3239 fire_bolt_or_beam(10, GF_COLD, dir, damroll(5 + lev / 8, 8));
3244 case SV_ROD_ACID_BALL:
3246 fire_ball(GF_ACID, dir, 60 + lev, rad);
3251 case SV_ROD_ELEC_BALL:
3253 fire_ball(GF_ELEC, dir, 40 + lev, rad);
3258 case SV_ROD_FIRE_BALL:
3260 fire_ball(GF_FIRE, dir, 70 + lev, rad);
3265 case SV_ROD_COLD_BALL:
3267 fire_ball(GF_COLD, dir, 50 + lev, rad);
3279 case SV_ROD_STONE_TO_MUD:
3281 int dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
3282 if (wall_to_mud(dir, dam)) ident = TRUE;
3286 case SV_ROD_AGGRAVATE:
3288 aggravate_monsters(0);
3297 * @brief 魔法棒を使うコマンドのサブルーチン /
3298 * Activate (zap) a Rod
3299 * @param item 使うオブジェクトの所持品ID
3303 * Unstack fully charged rods as needed.
3304 * Hack -- rods of perception/genocide can be "cancelled"
3305 * All rods can be cancelled at the "Direction?" prompt
3306 * pvals are defined for each rod in k_info. -LM-
3309 static void do_cmd_zap_rod_aux(int item)
3311 int ident, chance, lev, fail;
3316 /* Hack -- let perception get aborted */
3317 bool use_charge = TRUE;
3321 /* Get the item (in the pack) */
3324 o_ptr = &inventory[item];
3327 /* Get the item (on the floor) */
3330 o_ptr = &o_list[0 - item];
3334 /* Mega-Hack -- refuse to zap a pile from the ground */
3335 if ((item < 0) && (o_ptr->number > 1))
3337 msg_print(_("まずはロッドを拾わなければ。", "You must first pick up the rods."));
3342 /* Get a direction (unless KNOWN not to need it) */
3343 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)) ||
3344 !object_is_aware(o_ptr))
3346 /* Get a direction, allow cancel */
3347 if (!get_aim_dir(&dir)) return;
3352 p_ptr->energy_use = 100;
3354 /* Extract the item level */
3355 lev = k_info[o_ptr->k_idx].level;
3357 /* Base chance of success */
3358 chance = p_ptr->skill_dev;
3360 /* Confusion hurts skill */
3361 if (p_ptr->confused) chance = chance / 2;
3364 if (chance > fail) fail -= (chance - fail)*2;
3365 else chance -= (fail - chance)*2;
3366 if (fail < USE_DEVICE) fail = USE_DEVICE;
3367 if (chance < USE_DEVICE) chance = USE_DEVICE;
3371 if (flush_failure) flush();
3372 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this rod is freezing too."));
3377 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3378 else if (chance > fail)
3380 if (randint0(chance*2) < fail) success = FALSE;
3381 else success = TRUE;
3385 if (randint0(fail*2) < chance) success = TRUE;
3386 else success = FALSE;
3389 /* Roll for usage */
3392 if (flush_failure) flush();
3393 msg_print(_("うまくロッドを使えなかった。", "You failed to use the rod properly."));
3398 k_ptr = &k_info[o_ptr->k_idx];
3400 /* A single rod is still charging */
3401 if ((o_ptr->number == 1) && (o_ptr->timeout))
3403 if (flush_failure) flush();
3404 msg_print(_("このロッドはまだ魔力を充填している最中だ。", "The rod is still charging."));
3407 /* A stack of rods lacks enough energy. */
3408 else if ((o_ptr->number > 1) && (o_ptr->timeout > k_ptr->pval * (o_ptr->number - 1)))
3410 if (flush_failure) flush();
3411 msg_print(_("そのロッドはまだ充填中です。", "The rods are all still charging."));
3418 ident = rod_effect(o_ptr->sval, dir, &use_charge, FALSE, FALSE);
3420 /* Increase the timeout by the rod kind's pval. -LM- */
3421 if (use_charge) o_ptr->timeout += k_ptr->pval;
3423 /* Combine / Reorder the pack (later) */
3424 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3426 if (!(object_is_aware(o_ptr)))
3428 chg_virtue(V_PATIENCE, -1);
3429 chg_virtue(V_CHANCE, 1);
3430 chg_virtue(V_KNOWLEDGE, -1);
3433 /* Tried the object */
3434 object_tried(o_ptr);
3436 /* Successfully determined the object function */
3437 if (ident && !object_is_aware(o_ptr))
3439 object_aware(o_ptr);
3440 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
3444 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3448 * @brief ロッドを使うコマンドのメインルーチン /
3451 void do_cmd_zap_rod(void)
3456 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3458 set_action(ACTION_NONE);
3461 /* Restrict choices to rods */
3462 item_tester_tval = TV_ROD;
3465 q = _("どのロッドを振りますか? ", "Zap which rod? ");
3466 s = _("使えるロッドがない。", "You have no rod to zap.");
3468 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3471 do_cmd_zap_rod_aux(item);
3475 * @brief オブジェクトをプレイヤーが魔道具として発動できるかを判定する /
3476 * Hook to determine if an object is activatable
3477 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
3478 * @return 魔道具として発動可能ならばTRUEを返す
3480 static bool item_tester_hook_activate(object_type *o_ptr)
3482 u32b flgs[TR_FLAG_SIZE];
3485 if (!object_is_known(o_ptr)) return (FALSE);
3487 /* Extract the flags */
3488 object_flags(o_ptr, flgs);
3490 /* Check activation flag */
3491 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
3498 * @brief 『一つの指輪』の効果処理 /
3499 * Hack -- activate the ring of power
3500 * @param dir 発動の方向ID
3503 void ring_of_power(int dir)
3505 /* Pick a random effect */
3506 switch (randint1(10))
3512 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3515 /* Decrease all stats (permanently) */
3516 (void)dec_stat(A_STR, 50, TRUE);
3517 (void)dec_stat(A_INT, 50, TRUE);
3518 (void)dec_stat(A_WIS, 50, TRUE);
3519 (void)dec_stat(A_DEX, 50, TRUE);
3520 (void)dec_stat(A_CON, 50, TRUE);
3521 (void)dec_stat(A_CHR, 50, TRUE);
3523 /* Lose some experience (permanently) */
3524 p_ptr->exp -= (p_ptr->exp / 4);
3525 p_ptr->max_exp -= (p_ptr->exp / 4);
3534 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3536 /* Dispel monsters */
3537 dispel_monsters(1000);
3547 fire_ball(GF_MANA, dir, 600, 3);
3558 fire_bolt(GF_MANA, dir, 500);
3566 * @brief ペット入りモンスターボールをソートするための比較関数
3567 * @param u 所持品配列の参照ポインタ
3571 * @return 1の方が大であればTRUE
3573 static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
3575 u16b *who = (u16b*)(u);
3580 monster_type *m_ptr1 = &m_list[w1];
3581 monster_type *m_ptr2 = &m_list[w2];
3582 monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
3583 monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
3588 if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
3589 if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
3591 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
3592 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
3594 if (r_ptr1->level > r_ptr2->level) return TRUE;
3595 if (r_ptr2->level > r_ptr1->level) return FALSE;
3597 if (m_ptr1->hp > m_ptr2->hp) return TRUE;
3598 if (m_ptr2->hp > m_ptr1->hp) return FALSE;
3605 * @brief 装備を発動するコマンドのサブルーチン /
3606 * Activate a wielded object. Wielded objects never stack.
3607 * And even if they did, activatable objects never stack.
3608 * @param item 発動するオブジェクトの所持品ID
3612 * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
3613 * But one could, for example, easily make an activatable "Ring of Plasma".
3614 * Note that it always takes a turn to activate an artifact, even if
3615 * the user hits "escape" at the "direction" prompt.
3618 static void do_cmd_activate_aux(int item)
3620 int dir, lev, chance, fail;
3625 /* Get the item (in the pack) */
3628 o_ptr = &inventory[item];
3631 /* Get the item (on the floor) */
3634 o_ptr = &o_list[0 - item];
3638 p_ptr->energy_use = 100;
3640 /* Extract the item level */
3641 lev = k_info[o_ptr->k_idx].level;
3643 /* Hack -- use artifact level instead */
3644 if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
3645 else if (object_is_random_artifact(o_ptr))
3647 const activation_type* const act_ptr = find_activation_info(o_ptr);
3649 lev = act_ptr->level;
3652 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
3654 /* Base chance of success */
3655 chance = p_ptr->skill_dev;
3657 /* Confusion hurts skill */
3658 if (p_ptr->confused) chance = chance / 2;
3661 if (chance > fail) fail -= (chance - fail)*2;
3662 else chance -= (fail - chance)*2;
3663 if (fail < USE_DEVICE) fail = USE_DEVICE;
3664 if (chance < USE_DEVICE) chance = USE_DEVICE;
3668 if (flush_failure) flush();
3669 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
3674 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3675 else if (chance > fail)
3677 if (randint0(chance*2) < fail) success = FALSE;
3678 else success = TRUE;
3682 if (randint0(fail*2) < chance) success = TRUE;
3683 else success = FALSE;
3686 /* Roll for usage */
3689 if (flush_failure) flush();
3690 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
3695 /* Check the recharge */
3698 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
3702 /* Some lights need enough fuel for activation */
3703 if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
3704 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
3706 msg_print(_("燃料がない。", "It has no fuel."));
3707 p_ptr->energy_use = 0;
3711 /* Activate the artifact */
3712 msg_print(_("始動させた...", "You activate it..."));
3717 /* Activate object */
3718 if (activation_index(o_ptr))
3720 (void)activate_random_artifact(o_ptr);
3723 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3730 else if (o_ptr->tval == TV_WHISTLE)
3732 if (music_singing_any()) stop_singing();
3733 if (hex_spelling_any()) stop_hex_spell_all();
3736 if (object_is_cursed(o_ptr))
3738 msg_print(_("カン高い音が響き渡った。", "You produce a shrill whistling sound."));
3739 aggravate_monsters(0);
3749 /* Allocate the "who" array */
3750 C_MAKE(who, max_m_idx, u16b);
3752 /* Process the monsters (backwards) */
3753 for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
3755 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
3756 who[max_pet++] = pet_ctr;
3759 /* Select the sort method */
3760 ang_sort_comp = ang_sort_comp_pet;
3761 ang_sort_swap = ang_sort_swap_hook;
3763 ang_sort(who, &dummy_why, max_pet);
3765 /* Process the monsters (backwards) */
3766 for (i = 0; i < max_pet; i++)
3769 teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
3772 /* Free the "who" array */
3773 C_KILL(who, max_m_idx, u16b);
3775 o_ptr->timeout = 100+randint1(100);
3778 else if (o_ptr->tval == TV_CAPTURE)
3782 bool old_target_pet = target_pet;
3784 if (!get_aim_dir(&dir))
3786 target_pet = old_target_pet;
3789 target_pet = old_target_pet;
3791 if(fire_ball(GF_CAPTURE, dir, 0, 0))
3793 o_ptr->pval = cap_mon;
3794 o_ptr->xtra3 = cap_mspeed;
3795 o_ptr->xtra4 = cap_hp;
3796 o_ptr->xtra5 = cap_maxhp;
3803 if (o_ptr->inscription)
3804 strcpy(buf, quark_str(o_ptr->inscription));
3806 for (s = buf;*s && (*s != '#'); s++)
3809 if (iskanji(*s)) s++;
3819 t = quark_str(cap_nickname);
3832 o_ptr->inscription = quark_add(buf);
3839 if (!get_rep_dir2(&dir)) return;
3840 if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
3842 if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
3844 if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
3845 if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
3846 if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
3847 m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
3848 if (o_ptr->inscription)
3856 t = quark_str(o_ptr->inscription);
3857 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
3860 if (iskanji(*t)) t++;
3885 if (quote && *(s-1) =='\'')
3889 m_list[hack_m_idx_ii].nickname = quark_add(buf);
3890 t = quark_str(o_ptr->inscription);
3892 while(*t && (*t != '#'))
3899 o_ptr->inscription = quark_add(buf);
3910 msg_print(_("おっと、解放に失敗した。", "Oops. You failed to release your pet."));
3917 msg_print(_("おっと、このアイテムは始動できない。", "Oops. That object cannot be activated."));
3921 * @brief 装備を発動するコマンドのメインルーチン /
3924 void do_cmd_activate(void)
3930 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3932 set_action(ACTION_NONE);
3935 item_tester_no_ryoute = TRUE;
3936 /* Prepare the hook */
3937 item_tester_hook = item_tester_hook_activate;
3940 q = _("どのアイテムを始動させますか? ", "Activate which item? ");
3941 s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
3943 if (!get_item(&item, q, s, (USE_EQUIP))) return;
3945 /* Activate the item */
3946 do_cmd_activate_aux(item);
3951 * @brief オブジェクトをプレイヤーが簡易使用コマンドで利用できるかを判定する /
3952 * Hook to determine if an object is useable
3953 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
3954 * @return 利用可能ならばTRUEを返す
3956 static bool item_tester_hook_use(object_type *o_ptr)
3958 u32b flgs[TR_FLAG_SIZE];
3961 if (o_ptr->tval == p_ptr->tval_ammo)
3964 /* Useable object */
3965 switch (o_ptr->tval)
3983 if (!object_is_known(o_ptr)) return (FALSE);
3985 /* HACK - only items from the equipment can be activated */
3986 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3988 if (&inventory[i] == o_ptr)
3990 /* Extract the flags */
3991 object_flags(o_ptr, flgs);
3993 /* Check activation flag */
3994 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
4006 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
4010 * XXX - Add actions for other item types
4012 void do_cmd_use(void)
4018 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
4020 set_action(ACTION_NONE);
4023 item_tester_no_ryoute = TRUE;
4024 /* Prepare the hook */
4025 item_tester_hook = item_tester_hook_use;
4028 q = _("どれを使いますか?", "Use which item? ");
4029 s = _("使えるものがありません。", "You have nothing to use.");
4031 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR))) return;
4033 /* Get the item (in the pack) */
4036 o_ptr = &inventory[item];
4038 /* Get the item (on the floor) */
4041 o_ptr = &o_list[0 - item];
4044 switch (o_ptr->tval)
4056 do_cmd_eat_food_aux(item);
4063 do_cmd_aim_wand_aux(item);
4070 do_cmd_use_staff_aux(item);
4077 do_cmd_zap_rod_aux(item);
4081 /* Quaff a potion */
4084 do_cmd_quaff_potion_aux(item);
4091 /* Check some conditions */
4094 msg_print(_("目が見えない。", "You can't see anything."));
4099 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
4102 if (p_ptr->confused)
4104 msg_print(_("混乱していて読めない!", "You are too confused!"));
4108 do_cmd_read_scroll_aux(item, TRUE);
4117 do_cmd_fire_aux(item, &inventory[INVEN_BOW]);
4121 /* Activate an artifact */
4124 do_cmd_activate_aux(item);
4131 * @brief 魔道具術師の取り込んだ魔力一覧から選択/閲覧する /
4132 * @param only_browse 閲覧するだけならばTRUE
4133 * @return 選択した魔力のID、キャンセルならば-1を返す
4135 static int select_magic_eater(bool only_browse)
4139 bool flag, request_list;
4141 int ask = TRUE, i = 0;
4144 int menu_line = (use_menu ? 1 : 0);
4148 if (repeat_pull(&sn))
4150 /* Verify the spell */
4151 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))
4153 else if (sn < EATER_EXT*2 && !(p_ptr->magic_num1[sn] < EATER_CHARGE))
4157 #endif /* ALLOW_REPEAT */
4159 for (i = 0; i < 108; i++)
4161 if (p_ptr->magic_num2[i]) break;
4165 msg_print(_("魔法を覚えていない!", "You don't have any magic!"));
4176 prt(format(" %s 杖", (menu_line == 1) ? "》" : " "), 2, 14);
4177 prt(format(" %s 魔法棒", (menu_line == 2) ? "》" : " "), 3, 14);
4178 prt(format(" %s ロッド", (menu_line == 3) ? "》" : " "), 4, 14);
4180 prt(format(" %s staff", (menu_line == 1) ? "> " : " "), 2, 14);
4181 prt(format(" %s wand", (menu_line == 2) ? "> " : " "), 3, 14);
4182 prt(format(" %s rod", (menu_line == 3) ? "> " : " "), 4, 14);
4185 if (only_browse) prt(_("どの種類の魔法を見ますか?", "Which type of magic do you browse?"), 0, 0);
4186 else prt(_("どの種類の魔法を使いますか?", "Which type of magic do you use?"), 0, 0);
4209 ext = (menu_line-1)*EATER_EXT;
4210 if (menu_line == 1) tval = TV_STAFF;
4211 else if (menu_line == 2) tval = TV_WAND;
4215 if (menu_line > 3) menu_line -= 3;
4223 if (!get_com(_("[A] 杖, [B] 魔法棒, [C] ロッド:", "[A] staff, [B] wand, [C] rod:"), &choice, TRUE))
4227 if (choice == 'A' || choice == 'a')
4233 if (choice == 'B' || choice == 'b')
4239 if (choice == 'C' || choice == 'c')
4247 for (i = ext; i < ext + EATER_EXT; i++)
4249 if (p_ptr->magic_num2[i])
4251 if (use_menu) menu_line = i-ext+1;
4255 if (i == ext+EATER_EXT)
4257 msg_print(_("その種類の魔法は覚えていない!", "You don't have that type of magic!"));
4261 /* Nothing chosen yet */
4264 /* Build a prompt */
4265 if (only_browse) strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの魔力を見ますか?",
4266 "(*=List, ESC=exit) Browse which power? "));
4267 else strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの魔力を使いますか?",
4268 "(*=List, ESC=exit) Use which power? "));
4270 /* Save the screen */
4273 request_list = always_show_list;
4275 /* Get a spell from the user */
4279 if (request_list || use_menu)
4290 for (y = 1; y < 20; y++)
4295 /* Print header(s) */
4297 prt(format(" %s 失率 %s 失率", (tval == TV_ROD ? " 状態 " : "使用回数"), (tval == TV_ROD ? " 状態 " : "使用回数")), y++, x);
4299 prt(format(" %s Fail %s Fail", (tval == TV_ROD ? " Stat " : " Charges"), (tval == TV_ROD ? " Stat " : " Charges")), y++, x);
4303 for (ctr = 0; ctr < EATER_EXT; ctr++)
4305 if (!p_ptr->magic_num2[ctr+ext]) continue;
4307 k_idx = lookup_kind(tval, ctr);
4311 if (ctr == (menu_line-1))
4312 strcpy(dummy, _("》", "> "));
4316 /* letter/number for power selection */
4323 letter = '0' + ctr - 26;
4324 sprintf(dummy, "%c)",letter);
4326 x1 = ((ctr < EATER_EXT/2) ? x : x + 40);
4327 y1 = ((ctr < EATER_EXT/2) ? y + ctr : y + ctr - EATER_EXT/2);
4328 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
4329 chance = level * 4 / 5 + 20;
4330 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4332 if (p_ptr->lev > level)
4334 chance -= 3 * (p_ptr->lev - level);
4336 chance = mod_spell_chance_1(chance);
4337 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
4338 /* Stunning makes spells harder */
4339 if (p_ptr->stun > 50) chance += 25;
4340 else if (p_ptr->stun) chance += 15;
4342 if (chance > 95) chance = 95;
4344 chance = mod_spell_chance_2(chance);
4352 strcat(dummy, format(
4353 _(" %-22.22s 充填:%2d/%2d%3d%%", " %-22.22s (%2d/%2d) %3d%%"),
4354 k_name + k_info[k_idx].name,
4355 p_ptr->magic_num1[ctr+ext] ?
4356 (p_ptr->magic_num1[ctr+ext] - 1) / (EATER_ROD_CHARGE * k_info[k_idx].pval) +1 : 0,
4357 p_ptr->magic_num2[ctr+ext], chance));
4358 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;
4362 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));
4363 if (p_ptr->magic_num1[ctr+ext] < EATER_CHARGE) col = TERM_RED;
4368 c_prt(col, dummy, y1, x1);
4372 if (!get_com(out_val, &choice, FALSE)) break;
4374 if (use_menu && choice != ' ')
4390 menu_line += EATER_EXT - 1;
4391 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
4392 } while(!p_ptr->magic_num2[menu_line+ext-1]);
4403 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
4404 } while(!p_ptr->magic_num2[menu_line+ext-1]);
4415 bool reverse = FALSE;
4416 if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
4417 if (menu_line > EATER_EXT/2)
4419 menu_line -= EATER_EXT/2;
4422 else menu_line+=EATER_EXT/2;
4423 while(!p_ptr->magic_num2[menu_line+ext-1])
4428 if (menu_line < 2) reverse = FALSE;
4433 if (menu_line > EATER_EXT-1) reverse = TRUE;
4450 /* Request redraw */
4451 if (use_menu && ask) continue;
4453 /* Request redraw */
4454 if (!use_menu && ((choice == ' ') || (choice == '*') || (choice == '?')))
4460 request_list = FALSE;
4462 /* Restore the screen */
4467 request_list = TRUE;
4475 if (isalpha(choice))
4478 ask = (isupper(choice));
4481 if (ask) choice = tolower(choice);
4483 /* Extract request */
4484 i = (islower(choice) ? A2I(choice) : -1);
4488 ask = FALSE; /* Can't uppercase digits */
4490 i = choice - '0' + 26;
4494 /* Totally Illegal */
4495 if ((i < 0) || (i > EATER_EXT) || !p_ptr->magic_num2[i+ext])
4509 (void) strnfmt(tmp_val, 78, _("%sを使いますか? ", "Use %s?"), k_name + k_info[lookup_kind(tval ,i)].name);
4511 /* Belay that order */
4512 if (!get_check(tmp_val)) continue;
4516 if (p_ptr->magic_num1[ext+i] > k_info[lookup_kind(tval, i)].pval * (p_ptr->magic_num2[ext+i] - 1) * EATER_ROD_CHARGE)
4518 msg_print(_("その魔法はまだ充填している最中だ。", "The magic are still charging."));
4520 if (use_menu) ask = TRUE;
4526 if (p_ptr->magic_num1[ext+i] < EATER_CHARGE)
4528 msg_print(_("その魔法は使用回数が切れている。", "The magic has no charges left."));
4530 if (use_menu) ask = TRUE;
4542 /* Clear lines, position cursor (really should use strlen here) */
4543 Term_erase(7, 23, 255);
4544 Term_erase(7, 22, 255);
4545 Term_erase(7, 21, 255);
4546 Term_erase(7, 20, 255);
4548 roff_to_buf(k_text + k_info[lookup_kind(tval, i)].text, 62, temp, sizeof(temp));
4549 for (j = 0, line = 21; temp[j]; j += 1 + strlen(&temp[j]))
4551 prt(&temp[j], line, 10);
4562 /* Restore the screen */
4565 if (!flag) return -1;
4569 #endif /* ALLOW_REPEAT */
4575 * @brief 取り込んだ魔力を利用するコマンドのメインルーチン /
4576 * Use eaten rod, wand or staff
4577 * @param only_browse 閲覧するだけならばTRUE
4578 * @param powerful 強力発動中の処理ならばTRUE
4579 * @return 実際にコマンドを実行したならばTRUEを返す。
4581 bool do_cmd_magic_eater(bool only_browse, bool powerful)
4583 int item, chance, level, k_idx, tval, sval;
4584 bool use_charge = TRUE;
4586 /* Not when confused */
4587 if (!only_browse && p_ptr->confused)
4589 msg_print(_("混乱していて唱えられない!", "You are too confused!"));
4593 item = select_magic_eater(only_browse);
4596 p_ptr->energy_use = 0;
4599 if (item >= EATER_EXT*2) {tval = TV_ROD;sval = item - EATER_EXT*2;}
4600 else if (item >= EATER_EXT) {tval = TV_WAND;sval = item - EATER_EXT;}
4601 else {tval = TV_STAFF;sval = item;}
4602 k_idx = lookup_kind(tval, sval);
4604 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
4605 chance = level * 4 / 5 + 20;
4606 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4608 if (p_ptr->lev > level)
4610 chance -= 3 * (p_ptr->lev - level);
4612 chance = mod_spell_chance_1(chance);
4613 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
4614 /* Stunning makes spells harder */
4615 if (p_ptr->stun > 50) chance += 25;
4616 else if (p_ptr->stun) chance += 15;
4618 if (chance > 95) chance = 95;
4620 chance = mod_spell_chance_2(chance);
4622 if (randint0(100) < chance)
4624 if (flush_failure) flush();
4626 msg_print(_("呪文をうまく唱えられなかった!", "You failed to get the magic off!"));
4628 if (randint1(100) >= chance)
4629 chg_virtue(V_CHANCE,-1);
4630 p_ptr->energy_use = 100;
4640 if ((sval >= SV_ROD_MIN_DIRECTION) && (sval != SV_ROD_HAVOC) && (sval != SV_ROD_AGGRAVATE) && (sval != SV_ROD_PESTICIDE))
4641 if (!get_aim_dir(&dir)) return FALSE;
4642 rod_effect(sval, dir, &use_charge, powerful, TRUE);
4643 if (!use_charge) return FALSE;
4645 else if (tval == TV_WAND)
4647 if (!get_aim_dir(&dir)) return FALSE;
4648 wand_effect(sval, dir, powerful, TRUE);
4652 staff_effect(sval, &use_charge, powerful, TRUE, TRUE);
4653 if (!use_charge) return FALSE;
4655 if (randint1(100) < chance)
4656 chg_virtue(V_CHANCE,1);
4658 p_ptr->energy_use = 100;
4659 if (tval == TV_ROD) p_ptr->magic_num1[item] += k_info[k_idx].pval * EATER_ROD_CHARGE;
4660 else p_ptr->magic_num1[item] -= EATER_CHARGE;