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 KIND_OBJECT_IDX 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 lose_all_mutations();
1191 case SV_POTION_NEO_TSUYOSHI:
1193 (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
1197 case SV_POTION_TSUYOSHI:
1198 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
1200 p_ptr->tsuyoshi = 1;
1201 (void)set_tsuyoshi(0, TRUE);
1202 if (!p_ptr->resist_chaos)
1204 (void)set_image(50 + randint1(50));
1209 case SV_POTION_POLYMORPH:
1210 if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
1212 lose_all_mutations();
1220 if(gain_random_mutation(0)) ident = TRUE;
1222 else if (lose_mutation(0)) ident = TRUE;
1223 } while(!ident || one_in_(2));
1229 if (prace_is_(RACE_SKELETON))
1231 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
1232 (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx);
1235 /* Combine / Reorder the pack (later) */
1236 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1238 if (!(object_is_aware(q_ptr)))
1240 chg_virtue(V_PATIENCE, -1);
1241 chg_virtue(V_CHANCE, 1);
1242 chg_virtue(V_KNOWLEDGE, -1);
1245 /* The item has been tried */
1246 object_tried(q_ptr);
1248 /* An identification was made */
1249 if (ident && !object_is_aware(q_ptr))
1251 object_aware(q_ptr);
1252 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1256 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1258 /* Potions can feed the player */
1259 switch (p_ptr->mimic_form)
1262 switch (p_ptr->prace)
1265 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
1274 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1277 if (q_ptr->tval == TV_FLASK)
1279 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
1280 set_food(p_ptr->food + 5000);
1284 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1288 msg_print(_("水分を取り込んだ。", "You are moistened."));
1289 set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
1292 (void)set_food(p_ptr->food + q_ptr->pval);
1297 case MIMIC_DEMON_LORD:
1298 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1301 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
1304 (void)set_food(p_ptr->food + q_ptr->pval);
1311 * @brief オブジェクトをプレイヤーが飲むことができるかを判定する /
1312 * Hook to determine if an object can be quaffed
1313 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1314 * @return 飲むことが可能ならばTRUEを返す
1316 static bool item_tester_hook_quaff(object_type *o_ptr)
1318 if (o_ptr->tval == TV_POTION) return TRUE;
1320 if (prace_is_(RACE_ANDROID))
1322 if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL)
1330 * @brief 薬を飲むコマンドのメインルーチン /
1331 * Quaff some potion (from the pack or floor)
1334 void do_cmd_quaff_potion(void)
1339 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1341 set_action(ACTION_NONE);
1344 /* Restrict choices to potions */
1345 item_tester_hook = item_tester_hook_quaff;
1348 q = _("どの薬を飲みますか? ", "Quaff which potion? ");
1349 s = _("飲める薬がない。", "You have no potions to quaff.");
1351 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1353 /* Quaff the potion */
1354 do_cmd_quaff_potion_aux(item);
1359 * @brief 巻物を読むコマンドのサブルーチン
1360 * Read a scroll (from the pack or floor).
1361 * @param item 読むオブジェクトの所持品ID
1362 * @param known 判明済ならばTRUE
1366 * Certain scrolls can be "aborted" without losing the scroll. These
1367 * include scrolls with no effects but recharge or identify, which are
1368 * cancelled before use. XXX Reading them still takes a turn, though.
1371 static void do_cmd_read_scroll_aux(int item, bool known)
1373 int k, used_up, ident, lev;
1377 /* Get the item (in the pack) */
1380 o_ptr = &inventory[item];
1383 /* Get the item (on the floor) */
1386 o_ptr = &o_list[0 - item];
1391 p_ptr->energy_use = 100;
1395 if (flush_failure) flush();
1396 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen."));
1401 if (p_ptr->pclass == CLASS_BERSERKER)
1403 msg_print(_("巻物なんて読めない。", "You cannot read."));
1407 if (music_singing_any()) stop_singing();
1410 if (hex_spelling_any() && ((p_ptr->lev < 35) || hex_spell_fully())) stop_hex_spell_all();
1412 /* Not identified yet */
1416 lev = k_info[o_ptr->k_idx].level;
1418 /* Assume the scroll will get used up */
1421 if (o_ptr->tval == TV_SCROLL)
1423 /* Analyze the scroll */
1424 switch (o_ptr->sval)
1426 case SV_SCROLL_DARKNESS:
1428 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
1430 (void)set_blind(p_ptr->blind + 3 + randint1(5));
1432 if (unlite_area(10, 3)) ident = TRUE;
1436 case SV_SCROLL_AGGRAVATE_MONSTER:
1438 msg_print(_("カン高くうなる様な音が辺りを覆った。", "There is a high pitched humming noise."));
1439 aggravate_monsters(0);
1444 case SV_SCROLL_CURSE_ARMOR:
1446 if (curse_armor()) ident = TRUE;
1450 case SV_SCROLL_CURSE_WEAPON:
1453 if (buki_motteruka(INVEN_RARM))
1456 if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
1458 else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM;
1459 if (k && curse_weapon(FALSE, k)) ident = TRUE;
1463 case SV_SCROLL_SUMMON_MONSTER:
1465 for (k = 0; k < randint1(3); k++)
1467 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
1475 case SV_SCROLL_SUMMON_UNDEAD:
1477 for (k = 0; k < randint1(3); k++)
1479 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
1487 case SV_SCROLL_SUMMON_PET:
1489 if (summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET)))
1496 case SV_SCROLL_SUMMON_KIN:
1498 if (summon_kin_player(p_ptr->lev, p_ptr->y, p_ptr->x, (PM_FORCE_PET | PM_ALLOW_GROUP)))
1505 case SV_SCROLL_TRAP_CREATION:
1507 if (trap_creation(p_ptr->y, p_ptr->x)) ident = TRUE;
1511 case SV_SCROLL_PHASE_DOOR:
1513 teleport_player(10, 0L);
1518 case SV_SCROLL_TELEPORT:
1520 teleport_player(100, 0L);
1525 case SV_SCROLL_TELEPORT_LEVEL:
1527 (void)teleport_level(0);
1532 case SV_SCROLL_WORD_OF_RECALL:
1534 if (!word_of_recall()) used_up = FALSE;
1539 case SV_SCROLL_IDENTIFY:
1541 if (!ident_spell(FALSE)) used_up = FALSE;
1546 case SV_SCROLL_STAR_IDENTIFY:
1548 if (!identify_fully(FALSE)) used_up = FALSE;
1553 case SV_SCROLL_REMOVE_CURSE:
1557 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1563 case SV_SCROLL_STAR_REMOVE_CURSE:
1565 if (remove_all_curse())
1567 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1573 case SV_SCROLL_ENCHANT_ARMOR:
1576 if (!enchant_spell(0, 0, 1)) used_up = FALSE;
1580 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
1582 if (!enchant_spell(1, 0, 0)) used_up = FALSE;
1587 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
1589 if (!enchant_spell(0, 1, 0)) used_up = FALSE;
1594 case SV_SCROLL_STAR_ENCHANT_ARMOR:
1596 if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
1601 case SV_SCROLL_STAR_ENCHANT_WEAPON:
1603 if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
1608 case SV_SCROLL_RECHARGING:
1610 if (!recharge(130)) used_up = FALSE;
1615 case SV_SCROLL_MUNDANITY:
1618 if (!mundane_spell(FALSE)) used_up = FALSE;
1622 case SV_SCROLL_LIGHT:
1624 if (lite_area(damroll(2, 8), 2)) ident = TRUE;
1628 case SV_SCROLL_MAPPING:
1630 map_area(DETECT_RAD_MAP);
1635 case SV_SCROLL_DETECT_GOLD:
1637 if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
1638 if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
1642 case SV_SCROLL_DETECT_ITEM:
1644 if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
1648 case SV_SCROLL_DETECT_TRAP:
1650 if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
1654 case SV_SCROLL_DETECT_DOOR:
1656 if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
1657 if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
1661 case SV_SCROLL_DETECT_INVIS:
1663 if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
1667 case SV_SCROLL_SATISFY_HUNGER:
1669 if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
1673 case SV_SCROLL_BLESSING:
1675 if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
1679 case SV_SCROLL_HOLY_CHANT:
1681 if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
1685 case SV_SCROLL_HOLY_PRAYER:
1687 if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
1691 case SV_SCROLL_MONSTER_CONFUSION:
1693 if (!(p_ptr->special_attack & ATTACK_CONFUSE))
1695 msg_print(_("手が輝き始めた。", "Your hands begin to glow."));
1696 p_ptr->special_attack |= ATTACK_CONFUSE;
1697 p_ptr->redraw |= (PR_STATUS);
1703 case SV_SCROLL_PROTECTION_FROM_EVIL:
1706 if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
1710 case SV_SCROLL_RUNE_OF_PROTECTION:
1717 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
1719 if (destroy_doors_touch()) ident = TRUE;
1723 case SV_SCROLL_STAR_DESTRUCTION:
1725 if (destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE))
1728 msg_print(_("ダンジョンが揺れた...", "The dungeon trembles..."));
1733 case SV_SCROLL_DISPEL_UNDEAD:
1735 if (dispel_undead(80)) ident = TRUE;
1739 case SV_SCROLL_SPELL:
1741 if ((p_ptr->pclass == CLASS_WARRIOR) ||
1742 (p_ptr->pclass == CLASS_IMITATOR) ||
1743 (p_ptr->pclass == CLASS_MINDCRAFTER) ||
1744 (p_ptr->pclass == CLASS_SORCERER) ||
1745 (p_ptr->pclass == CLASS_ARCHER) ||
1746 (p_ptr->pclass == CLASS_MAGIC_EATER) ||
1747 (p_ptr->pclass == CLASS_RED_MAGE) ||
1748 (p_ptr->pclass == CLASS_SAMURAI) ||
1749 (p_ptr->pclass == CLASS_BLUE_MAGE) ||
1750 (p_ptr->pclass == CLASS_CAVALRY) ||
1751 (p_ptr->pclass == CLASS_BERSERKER) ||
1752 (p_ptr->pclass == CLASS_SMITH) ||
1753 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
1754 (p_ptr->pclass == CLASS_NINJA) ||
1755 (p_ptr->pclass == CLASS_SNIPER)) break;
1756 p_ptr->add_spells++;
1757 p_ptr->update |= (PU_SPELLS);
1762 case SV_SCROLL_GENOCIDE:
1764 (void)symbol_genocide(300, TRUE);
1769 case SV_SCROLL_MASS_GENOCIDE:
1771 (void)mass_genocide(300, TRUE);
1776 case SV_SCROLL_ACQUIREMENT:
1778 acquirement(p_ptr->y, p_ptr->x, 1, TRUE, FALSE, FALSE);
1783 case SV_SCROLL_STAR_ACQUIREMENT:
1785 acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE);
1790 /* New Hengband scrolls */
1791 case SV_SCROLL_FIRE:
1793 fire_ball(GF_FIRE, 0, 666, 4);
1794 /* Note: "Double" damage since it is centered on the player ... */
1795 if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
1796 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1);
1805 fire_ball(GF_ICE, 0, 777, 4);
1806 if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
1807 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
1813 case SV_SCROLL_CHAOS:
1815 fire_ball(GF_CHAOS, 0, 1000, 4);
1816 if (!p_ptr->resist_chaos)
1817 take_hit(DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1);
1823 case SV_SCROLL_RUMOR:
1825 msg_print(_("巻物にはメッセージが書かれている:", "There is message on the scroll. It says:"));
1827 display_rumor(TRUE);
1829 msg_print(_("巻物は煙を立てて消え去った!", "The scroll disappears in a puff of smoke!"));
1835 case SV_SCROLL_ARTIFACT:
1838 if (!artifact_scroll()) used_up = FALSE;
1842 case SV_SCROLL_RESET_RECALL:
1845 if (!reset_recall()) used_up = FALSE;
1849 case SV_SCROLL_AMUSEMENT:
1852 amusement(p_ptr->y, p_ptr->x, 1, FALSE);
1856 case SV_SCROLL_STAR_AMUSEMENT:
1859 amusement(p_ptr->y, p_ptr->x, randint1(2) + 1, FALSE);
1864 else if (o_ptr->name1 == ART_GHB)
1866 msg_print(_("私は苦労して『グレーター・ヘル=ビースト』を倒した。", "I had a very hard time to kill the Greater hell-beast, "));
1867 msg_print(_("しかし手に入ったのはこのきたないTシャツだけだった。", "but all I got was this lousy t-shirt!"));
1870 else if (o_ptr->name1 == ART_POWER)
1872 msg_print(_("「一つの指輪は全てを統べ、", "'One Ring to rule them all, "));
1874 msg_print(_("一つの指輪は全てを見つけ、", "One Ring to find them, "));
1876 msg_print(_("一つの指輪は全てを捕らえて", "One Ring to bring them all "));
1878 msg_print(_("暗闇の中に繋ぎとめる。」", "and in the darkness bind them.'"));
1881 else if (o_ptr->tval==TV_PARCHMENT)
1884 char o_name[MAX_NLEN];
1890 q=format("book-%d_jp.txt",o_ptr->sval);
1892 /* Display object description */
1893 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1895 /* Build the filename */
1896 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q);
1898 /* Peruse the help file */
1899 (void)show_file(TRUE, buf, o_name, 0, 0);
1908 /* Combine / Reorder the pack (later) */
1909 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1911 if (!(object_is_aware(o_ptr)))
1913 chg_virtue(V_PATIENCE, -1);
1914 chg_virtue(V_CHANCE, 1);
1915 chg_virtue(V_KNOWLEDGE, -1);
1918 /* The item was tried */
1919 object_tried(o_ptr);
1921 /* An identification was made */
1922 if (ident && !object_is_aware(o_ptr))
1924 object_aware(o_ptr);
1925 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1929 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1932 /* Hack -- allow certain scrolls to be "preserved" */
1938 sound(SOUND_SCROLL);
1940 /* Destroy a scroll in the pack */
1943 inven_item_increase(item, -1);
1944 inven_item_describe(item);
1945 inven_item_optimize(item);
1948 /* Destroy a scroll on the floor */
1951 floor_item_increase(0 - item, -1);
1952 floor_item_describe(0 - item);
1953 floor_item_optimize(0 - item);
1958 * @brief オブジェクトをプレイヤーが読むことができるかを判定する /
1959 * Hook to determine if an object is readable
1960 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1961 * @return 読むことが可能ならばTRUEを返す
1963 static bool item_tester_hook_readable(object_type *o_ptr)
1965 if ((o_ptr->tval==TV_SCROLL) || (o_ptr->tval==TV_PARCHMENT) || (o_ptr->name1 == ART_GHB) || (o_ptr->name1 == ART_POWER)) return (TRUE);
1972 * @brief 読むコマンドのメインルーチン /
1973 * Eat some food (from the pack or floor)
1976 void do_cmd_read_scroll(void)
1982 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1984 set_action(ACTION_NONE);
1987 /* Check some conditions */
1990 msg_print(_("目が見えない。", "You can't see anything."));
1995 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
1998 if (p_ptr->confused)
2000 msg_print(_("混乱していて読めない。", "You are too confused!"));
2005 /* Restrict choices to scrolls */
2006 item_tester_hook = item_tester_hook_readable;
2009 q = _("どの巻物を読みますか? ", "Read which scroll? ");
2010 s = _("読める巻物がない。", "You have no scrolls to read.");
2012 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2014 /* Get the item (in the pack) */
2017 o_ptr = &inventory[item];
2020 /* Get the item (on the floor) */
2023 o_ptr = &o_list[0 - item];
2026 /* Read the scroll */
2027 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
2032 * @param sval オブジェクトのsval
2033 * @param use_charge 使用回数を消費したかどうかを返す参照ポインタ
2034 * @param powerful 強力発動上の処理ならばTRUE
2035 * @param magic 魔道具術上の処理ならばTRUE
2036 * @param known 判明済ならばTRUE
2037 * @return 発動により効果内容が確定したならばTRUEを返す
2039 static int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, bool magic, bool known)
2043 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2044 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
2046 /* Analyze the staff */
2049 case SV_STAFF_DARKNESS:
2051 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
2053 if (set_blind(p_ptr->blind + 3 + randint1(5))) ident = TRUE;
2055 if (unlite_area(10, (powerful ? 6 : 3))) ident = TRUE;
2059 case SV_STAFF_SLOWNESS:
2061 if (set_slow(p_ptr->slow + randint1(30) + 15, FALSE)) ident = TRUE;
2065 case SV_STAFF_HASTE_MONSTERS:
2067 if (speed_monsters()) ident = TRUE;
2071 case SV_STAFF_SUMMONING:
2073 const int times = randint1(powerful ? 8 : 4);
2074 for (k = 0; k < times; k++)
2076 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2084 case SV_STAFF_TELEPORTATION:
2086 teleport_player((powerful ? 150 : 100), 0L);
2091 case SV_STAFF_IDENTIFY:
2094 if (!identify_fully(FALSE)) *use_charge = FALSE;
2096 if (!ident_spell(FALSE)) *use_charge = FALSE;
2102 case SV_STAFF_REMOVE_CURSE:
2104 bool result = powerful ? remove_all_curse() : remove_curse();
2109 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
2111 else if (!p_ptr->blind)
2113 msg_print(_("杖は一瞬ブルーに輝いた...", "The staff glows blue for a moment..."));
2121 case SV_STAFF_STARLITE:
2123 HIT_POINT num = damroll(5, 3);
2124 POSITION y = 0, x = 0;
2127 if (!p_ptr->blind && !magic)
2129 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2131 for (k = 0; k < num; k++)
2137 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
2139 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2141 if (!player_bold(y, x)) break;
2144 project(0, 0, y, x, damroll(6 + lev / 8, 10), GF_LITE_WEAK,
2145 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
2153 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
2157 case SV_STAFF_MAPPING:
2159 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
2164 case SV_STAFF_DETECT_GOLD:
2166 if (detect_treasure(detect_rad)) ident = TRUE;
2167 if (detect_objects_gold(detect_rad)) ident = TRUE;
2171 case SV_STAFF_DETECT_ITEM:
2173 if (detect_objects_normal(detect_rad)) ident = TRUE;
2177 case SV_STAFF_DETECT_TRAP:
2179 if (detect_traps(detect_rad, known)) ident = TRUE;
2183 case SV_STAFF_DETECT_DOOR:
2185 if (detect_doors(detect_rad)) ident = TRUE;
2186 if (detect_stairs(detect_rad)) ident = TRUE;
2190 case SV_STAFF_DETECT_INVIS:
2192 if (detect_monsters_invis(detect_rad)) ident = TRUE;
2196 case SV_STAFF_DETECT_EVIL:
2198 if (detect_monsters_evil(detect_rad)) ident = TRUE;
2202 case SV_STAFF_CURE_LIGHT:
2204 if (hp_player(damroll((powerful ? 4 : 2), 8))) ident = TRUE;
2206 if (set_blind(0)) ident = TRUE;
2207 if (set_poisoned(0)) ident = TRUE;
2208 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
2210 if (set_shero(0,TRUE)) ident = TRUE;
2214 case SV_STAFF_CURING:
2216 if (set_blind(0)) ident = TRUE;
2217 if (set_poisoned(0)) ident = TRUE;
2218 if (set_confused(0)) ident = TRUE;
2219 if (set_stun(0)) ident = TRUE;
2220 if (set_cut(0)) ident = TRUE;
2221 if (set_image(0)) ident = TRUE;
2222 if (set_shero(0,TRUE)) ident = TRUE;
2226 case SV_STAFF_HEALING:
2228 if (hp_player(powerful ? 500 : 300)) ident = TRUE;
2229 if (set_stun(0)) ident = TRUE;
2230 if (set_cut(0)) ident = TRUE;
2231 if (set_shero(0,TRUE)) ident = TRUE;
2235 case SV_STAFF_THE_MAGI:
2237 if (do_res_stat(A_INT)) ident = TRUE;
2238 if (p_ptr->csp < p_ptr->msp)
2240 p_ptr->csp = p_ptr->msp;
2241 p_ptr->csp_frac = 0;
2243 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
2245 p_ptr->redraw |= (PR_MANA);
2246 p_ptr->window |= (PW_PLAYER);
2247 p_ptr->window |= (PW_SPELL);
2249 if (set_shero(0,TRUE)) ident = TRUE;
2253 case SV_STAFF_SLEEP_MONSTERS:
2255 if (sleep_monsters(lev)) ident = TRUE;
2259 case SV_STAFF_SLOW_MONSTERS:
2261 if (slow_monsters(lev)) ident = TRUE;
2265 case SV_STAFF_SPEED:
2267 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
2271 case SV_STAFF_PROBING:
2278 case SV_STAFF_DISPEL_EVIL:
2280 if (dispel_evil(powerful ? 120 : 80)) ident = TRUE;
2284 case SV_STAFF_POWER:
2286 if (dispel_monsters(powerful ? 225 : 150)) ident = TRUE;
2290 case SV_STAFF_HOLINESS:
2292 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
2294 if (set_protevil((magic ? 0 : p_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
2295 if (set_poisoned(0)) ident = TRUE;
2296 if (set_afraid(0)) ident = TRUE;
2297 if (hp_player(50)) ident = TRUE;
2298 if (set_stun(0)) ident = TRUE;
2299 if (set_cut(0)) ident = TRUE;
2303 case SV_STAFF_GENOCIDE:
2305 (void)symbol_genocide((magic ? lev + 50 : 200), TRUE);
2310 case SV_STAFF_EARTHQUAKES:
2312 if (earthquake(p_ptr->y, p_ptr->x, (powerful ? 15 : 10)))
2315 msg_print(_("ダンジョンが揺れた。", "The dungeon trembles."));
2320 case SV_STAFF_DESTRUCTION:
2322 if (destroy_area(p_ptr->y, p_ptr->x, (powerful ? 18 : 13) + randint0(5), FALSE))
2328 case SV_STAFF_ANIMATE_DEAD:
2330 if (animate_dead(0, p_ptr->y, p_ptr->x))
2336 case SV_STAFF_MSTORM:
2338 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
2339 project(0, (powerful ? 7 : 5), p_ptr->y, p_ptr->x,
2340 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
2341 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))
2343 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
2350 case SV_STAFF_NOTHING:
2352 msg_print(_("何も起らなかった。", "Nothing happen."));
2353 if (prace_is_(RACE_SKELETON) || prace_is_(RACE_GOLEM) ||
2354 prace_is_(RACE_ZOMBIE) || prace_is_(RACE_SPECTRE))
2355 msg_print(_("もったいない事をしたような気がする。食べ物は大切にしなくては。", "What a waste. It's your food!"));
2363 * @brief 杖を使うコマンドのサブルーチン /
2364 * Use a staff. -RAK-
2365 * @param item 使うオブジェクトの所持品ID
2368 * One charge of one staff disappears.
2369 * Hack -- staffs of identify can be "cancelled".
2371 static void do_cmd_use_staff_aux(int item)
2373 int ident, chance, lev;
2377 /* Hack -- let staffs of identify get aborted */
2378 bool use_charge = TRUE;
2381 /* Get the item (in the pack) */
2384 o_ptr = &inventory[item];
2387 /* Get the item (on the floor) */
2390 o_ptr = &o_list[0 - item];
2394 /* Mega-Hack -- refuse to use a pile from the ground */
2395 if ((item < 0) && (o_ptr->number > 1))
2397 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
2403 p_ptr->energy_use = 100;
2405 /* Extract the item level */
2406 lev = k_info[o_ptr->k_idx].level;
2407 if (lev > 50) lev = 50 + (lev - 50)/2;
2409 /* Base chance of success */
2410 chance = p_ptr->skill_dev;
2412 /* Confusion hurts skill */
2413 if (p_ptr->confused) chance = chance / 2;
2415 /* Hight level objects are harder */
2416 chance = chance - lev;
2418 /* Give everyone a (slight) chance */
2419 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
2421 chance = USE_DEVICE;
2426 if (flush_failure) flush();
2427 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this staff is freezing too."));
2432 /* Roll for usage */
2433 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
2435 if (flush_failure) flush();
2436 msg_print(_("杖をうまく使えなかった。", "You failed to use the staff properly."));
2441 /* Notice empty staffs */
2442 if (o_ptr->pval <= 0)
2444 if (flush_failure) flush();
2445 msg_print(_("この杖にはもう魔力が残っていない。", "The staff has no charges left."));
2446 o_ptr->ident |= (IDENT_EMPTY);
2448 /* Combine / Reorder the pack (later) */
2449 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2450 p_ptr->window |= (PW_INVEN);
2459 ident = staff_effect(o_ptr->sval, &use_charge, FALSE, FALSE, object_is_aware(o_ptr));
2461 if (!(object_is_aware(o_ptr)))
2463 chg_virtue(V_PATIENCE, -1);
2464 chg_virtue(V_CHANCE, 1);
2465 chg_virtue(V_KNOWLEDGE, -1);
2468 /* Combine / Reorder the pack (later) */
2469 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2471 /* Tried the item */
2472 object_tried(o_ptr);
2474 /* An identification was made */
2475 if (ident && !object_is_aware(o_ptr))
2477 object_aware(o_ptr);
2478 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2482 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2485 /* Hack -- some uses are "free" */
2486 if (!use_charge) return;
2489 /* Use a single charge */
2492 /* XXX Hack -- unstack if necessary */
2493 if ((item >= 0) && (o_ptr->number > 1))
2498 /* Get local object */
2501 /* Obtain a local object */
2502 object_copy(q_ptr, o_ptr);
2504 /* Modify quantity */
2507 /* Restore the charges */
2510 /* Unstack the used item */
2512 p_ptr->total_weight -= q_ptr->weight;
2513 item = inven_carry(q_ptr);
2516 msg_print(_("杖をまとめなおした。", "You unstack your staff."));
2519 /* Describe charges in the pack */
2522 inven_item_charges(item);
2525 /* Describe charges on the floor */
2528 floor_item_charges(0 - item);
2533 * @brief 杖を使うコマンドのメインルーチン /
2536 void do_cmd_use_staff(void)
2541 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2543 set_action(ACTION_NONE);
2546 /* Restrict choices to wands */
2547 item_tester_tval = TV_STAFF;
2550 q = _("どの杖を使いますか? ", "Use which staff? ");
2551 s = _("使える杖がない。", "You have no staff to use.");
2553 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2555 do_cmd_use_staff_aux(item);
2559 * @brief 魔法棒の効果を発動する
2560 * @param sval オブジェクトのsval
2561 * @param dir 発動の方向ID
2562 * @param powerful 強力発動上の処理ならばTRUE
2563 * @param magic 魔道具術上の処理ならばTRUE
2564 * @return 発動により効果内容が確定したならばTRUEを返す
2566 static int wand_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool powerful, bool magic)
2569 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2570 int rad = powerful ? 3 : 2;
2572 /* XXX Hack -- Wand of wonder can do anything before it */
2573 if (sval == SV_WAND_WONDER)
2575 int vir = virtue_number(V_CHANCE);
2576 sval = (OBJECT_SUBTYPE_VALUE)randint0(SV_WAND_WONDER);
2580 if (p_ptr->virtues[vir - 1] > 0)
2582 while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
2583 if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
2587 while (randint1(300) < (0-p_ptr->virtues[vir - 1])) sval--;
2588 if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
2591 if (sval < SV_WAND_TELEPORT_AWAY)
2592 chg_virtue(V_CHANCE, 1);
2595 /* Analyze the wand */
2598 case SV_WAND_HEAL_MONSTER:
2600 HIT_POINT dam = damroll((powerful ? 20 : 10), 10);
2601 if (heal_monster(dir, dam)) ident = TRUE;
2605 case SV_WAND_HASTE_MONSTER:
2607 if (speed_monster(dir, lev)) ident = TRUE;
2611 case SV_WAND_CLONE_MONSTER:
2613 if (clone_monster(dir)) ident = TRUE;
2617 case SV_WAND_TELEPORT_AWAY:
2619 int distance = MAX_SIGHT * (powerful ? 8 : 5);
2620 if (teleport_monster(dir, distance)) ident = TRUE;
2624 case SV_WAND_DISARMING:
2626 if (disarm_trap(dir)) ident = TRUE;
2627 if (powerful && disarm_traps_touch()) ident = TRUE;
2631 case SV_WAND_TRAP_DOOR_DEST:
2633 if (destroy_door(dir)) ident = TRUE;
2634 if (powerful && destroy_doors_touch()) ident = TRUE;
2638 case SV_WAND_STONE_TO_MUD:
2640 HIT_POINT dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
2641 if (wall_to_mud(dir, dam)) ident = TRUE;
2647 HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
2648 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
2649 (void)lite_line(dir, dam);
2654 case SV_WAND_SLEEP_MONSTER:
2656 if (sleep_monster(dir, lev)) ident = TRUE;
2660 case SV_WAND_SLOW_MONSTER:
2662 if (slow_monster(dir, lev)) ident = TRUE;
2666 case SV_WAND_CONFUSE_MONSTER:
2668 if (confuse_monster(dir, lev)) ident = TRUE;
2672 case SV_WAND_FEAR_MONSTER:
2674 if (fear_monster(dir, lev)) ident = TRUE;
2678 case SV_WAND_DRAIN_LIFE:
2680 if (hypodynamic_bolt(dir, 80 + lev)) ident = TRUE;
2684 case SV_WAND_POLYMORPH:
2686 if (poly_monster(dir, lev)) ident = TRUE;
2690 case SV_WAND_STINKING_CLOUD:
2692 fire_ball(GF_POIS, dir, 12 + lev / 4, rad);
2697 case SV_WAND_MAGIC_MISSILE:
2699 fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + lev / 10, 6));
2704 case SV_WAND_ACID_BOLT:
2706 fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + lev / 7, 8));
2711 case SV_WAND_CHARM_MONSTER:
2713 if (charm_monster(dir, MAX(20, lev)))
2718 case SV_WAND_FIRE_BOLT:
2720 fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + lev / 6, 8));
2725 case SV_WAND_COLD_BOLT:
2727 fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + lev / 8, 8));
2732 case SV_WAND_ACID_BALL:
2734 fire_ball(GF_ACID, dir, 60 + 3 * lev / 4, rad);
2739 case SV_WAND_ELEC_BALL:
2741 fire_ball(GF_ELEC, dir, 40 + 3 * lev / 4, rad);
2746 case SV_WAND_FIRE_BALL:
2748 fire_ball(GF_FIRE, dir, 70 + 3 * lev / 4, rad);
2753 case SV_WAND_COLD_BALL:
2755 fire_ball(GF_COLD, dir, 50 + 3 * lev / 4, rad);
2760 case SV_WAND_WONDER:
2762 msg_print(_("おっと、謎の魔法棒を始動させた。", "Oops. Wand of wonder activated."));
2766 case SV_WAND_DRAGON_FIRE:
2768 fire_ball(GF_FIRE, dir, (powerful ? 300 : 200), -3);
2773 case SV_WAND_DRAGON_COLD:
2775 fire_ball(GF_COLD, dir, (powerful ? 270 : 180), -3);
2780 case SV_WAND_DRAGON_BREATH:
2785 switch (randint1(5))
2809 if (powerful) dam = (dam * 3) / 2;
2811 fire_ball(typ, dir, dam, -3);
2817 case SV_WAND_DISINTEGRATE:
2819 fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(lev * 2), rad);
2824 case SV_WAND_ROCKETS:
2826 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
2827 fire_rocket(GF_ROCKET, dir, 250 + lev * 3, rad);
2832 case SV_WAND_STRIKING:
2834 fire_bolt(GF_METEOR, dir, damroll(15 + lev / 3, 13));
2839 case SV_WAND_GENOCIDE:
2841 fire_ball_hide(GF_GENOCIDE, dir, magic ? lev + 50 : 250, 0);
2850 * @brief 魔法棒を使うコマンドのサブルーチン /
2851 * Aim a wand (from the pack or floor).
2852 * @param item 使うオブジェクトの所持品ID
2856 * Use a single charge from a single item.
2857 * Handle "unstacking" in a logical manner.
2858 * For simplicity, you cannot use a stack of items from the
2859 * ground. This would require too much nasty code.
2860 * There are no wands which can "destroy" themselves, in the inventory
2861 * or on the ground, so we can ignore this possibility. Note that this
2862 * required giving "wand of wonder" the ability to ignore destruction
2863 * by electric balls.
2864 * All wands can be "cancelled" at the "Direction?" prompt for free.
2865 * Note that the basic "bolt" wands do slightly less damage than the
2866 * basic "bolt" rods, but the basic "ball" wands do the same damage
2867 * as the basic "ball" rods.
2870 static void do_cmd_aim_wand_aux(int item)
2872 int lev, ident, chance, dir;
2874 bool old_target_pet = target_pet;
2876 /* Get the item (in the pack) */
2879 o_ptr = &inventory[item];
2882 /* Get the item (on the floor) */
2885 o_ptr = &o_list[0 - item];
2888 /* Mega-Hack -- refuse to aim a pile from the ground */
2889 if ((item < 0) && (o_ptr->number > 1))
2891 msg_print(_("まずは魔法棒を拾わなければ。", "You must first pick up the wands."));
2896 /* Allow direction to be cancelled for free */
2897 if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
2898 || o_ptr->sval == SV_WAND_HASTE_MONSTER))
2900 if (!get_aim_dir(&dir))
2902 target_pet = old_target_pet;
2905 target_pet = old_target_pet;
2908 p_ptr->energy_use = 100;
2911 lev = k_info[o_ptr->k_idx].level;
2912 if (lev > 50) lev = 50 + (lev - 50)/2;
2914 /* Base chance of success */
2915 chance = p_ptr->skill_dev;
2917 /* Confusion hurts skill */
2918 if (p_ptr->confused) chance = chance / 2;
2920 /* Hight level objects are harder */
2921 chance = chance - lev;
2923 /* Give everyone a (slight) chance */
2924 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
2926 chance = USE_DEVICE;
2931 if (flush_failure) flush();
2932 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this wand is freezing too."));
2937 /* Roll for usage */
2938 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
2940 if (flush_failure) flush();
2941 msg_print(_("魔法棒をうまく使えなかった。", "You failed to use the wand properly."));
2946 /* The wand is already empty! */
2947 if (o_ptr->pval <= 0)
2949 if (flush_failure) flush();
2950 msg_print(_("この魔法棒にはもう魔力が残っていない。", "The wand has no charges left."));
2951 o_ptr->ident |= (IDENT_EMPTY);
2953 /* Combine / Reorder the pack (later) */
2954 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2955 p_ptr->window |= (PW_INVEN);
2963 ident = wand_effect(o_ptr->sval, dir, FALSE, FALSE);
2965 /* Combine / Reorder the pack (later) */
2966 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2968 if (!(object_is_aware(o_ptr)))
2970 chg_virtue(V_PATIENCE, -1);
2971 chg_virtue(V_CHANCE, 1);
2972 chg_virtue(V_KNOWLEDGE, -1);
2975 /* Mark it as tried */
2976 object_tried(o_ptr);
2978 /* Apply identification */
2979 if (ident && !object_is_aware(o_ptr))
2981 object_aware(o_ptr);
2982 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2986 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2989 /* Use a single charge */
2992 /* Describe the charges in the pack */
2995 inven_item_charges(item);
2998 /* Describe the charges on the floor */
3001 floor_item_charges(0 - item);
3006 * @brief 魔法棒を使うコマンドのメインルーチン /
3009 void do_cmd_aim_wand(void)
3014 /* Restrict choices to wands */
3015 item_tester_tval = TV_WAND;
3017 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3019 set_action(ACTION_NONE);
3023 q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
3024 s = _("使える魔法棒がない。", "You have no wand to aim.");
3026 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3029 do_cmd_aim_wand_aux(item);
3033 * @brief ロッドの効果を発動する
3034 * @param sval オブジェクトのsval
3035 * @param dir 発動目標の方向ID
3036 * @param use_charge チャージを消費したかどうかを返す参照ポインタ
3037 * @param powerful 強力発動上の処理ならばTRUE
3038 * @param magic 魔道具術上の処理ならばTRUE
3039 * @return 発動により効果内容が確定したならばTRUEを返す
3041 static int rod_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool *use_charge, bool powerful, bool magic)
3044 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
3045 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
3046 int rad = powerful ? 3 : 2;
3051 /* Analyze the rod */
3054 case SV_ROD_DETECT_TRAP:
3056 if (detect_traps(detect_rad, (bool)(dir ? FALSE : TRUE))) ident = TRUE;
3060 case SV_ROD_DETECT_DOOR:
3062 if (detect_doors(detect_rad)) ident = TRUE;
3063 if (detect_stairs(detect_rad)) ident = TRUE;
3067 case SV_ROD_IDENTIFY:
3070 if (!identify_fully(FALSE)) *use_charge = FALSE;
3072 if (!ident_spell(FALSE)) *use_charge = FALSE;
3080 if (!word_of_recall()) *use_charge = FALSE;
3085 case SV_ROD_ILLUMINATION:
3087 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
3091 case SV_ROD_MAPPING:
3093 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
3098 case SV_ROD_DETECTION:
3100 detect_all(detect_rad);
3105 case SV_ROD_PROBING:
3114 if (set_blind(0)) ident = TRUE;
3115 if (set_poisoned(0)) ident = TRUE;
3116 if (set_confused(0)) ident = TRUE;
3117 if (set_stun(0)) ident = TRUE;
3118 if (set_cut(0)) ident = TRUE;
3119 if (set_image(0)) ident = TRUE;
3120 if (set_shero(0,TRUE)) ident = TRUE;
3124 case SV_ROD_HEALING:
3126 if (hp_player(powerful ? 750 : 500)) ident = TRUE;
3127 if (set_stun(0)) ident = TRUE;
3128 if (set_cut(0)) ident = TRUE;
3129 if (set_shero(0,TRUE)) ident = TRUE;
3133 case SV_ROD_RESTORATION:
3135 if (restore_level()) ident = TRUE;
3136 if (do_res_stat(A_STR)) ident = TRUE;
3137 if (do_res_stat(A_INT)) ident = TRUE;
3138 if (do_res_stat(A_WIS)) ident = TRUE;
3139 if (do_res_stat(A_DEX)) ident = TRUE;
3140 if (do_res_stat(A_CON)) ident = TRUE;
3141 if (do_res_stat(A_CHR)) ident = TRUE;
3147 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
3151 case SV_ROD_PESTICIDE:
3153 if (dispel_monsters(powerful ? 8 : 4)) ident = TRUE;
3157 case SV_ROD_TELEPORT_AWAY:
3159 int distance = MAX_SIGHT * (powerful ? 8 : 5);
3160 if (teleport_monster(dir, distance)) ident = TRUE;
3164 case SV_ROD_DISARMING:
3166 if (disarm_trap(dir)) ident = TRUE;
3167 if (powerful && disarm_traps_touch()) ident = TRUE;
3173 HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
3174 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
3175 (void)lite_line(dir, dam);
3180 case SV_ROD_SLEEP_MONSTER:
3182 if (sleep_monster(dir, lev)) ident = TRUE;
3186 case SV_ROD_SLOW_MONSTER:
3188 if (slow_monster(dir, lev)) ident = TRUE;
3192 case SV_ROD_DRAIN_LIFE:
3194 if (hypodynamic_bolt(dir, 70 + 3 * lev / 2)) ident = TRUE;
3198 case SV_ROD_POLYMORPH:
3200 if (poly_monster(dir, lev)) ident = TRUE;
3204 case SV_ROD_ACID_BOLT:
3206 fire_bolt_or_beam(10, GF_ACID, dir, damroll(6 + lev / 7, 8));
3211 case SV_ROD_ELEC_BOLT:
3213 fire_bolt_or_beam(10, GF_ELEC, dir, damroll(4 + lev / 9, 8));
3218 case SV_ROD_FIRE_BOLT:
3220 fire_bolt_or_beam(10, GF_FIRE, dir, damroll(7 + lev / 6, 8));
3225 case SV_ROD_COLD_BOLT:
3227 fire_bolt_or_beam(10, GF_COLD, dir, damroll(5 + lev / 8, 8));
3232 case SV_ROD_ACID_BALL:
3234 fire_ball(GF_ACID, dir, 60 + lev, rad);
3239 case SV_ROD_ELEC_BALL:
3241 fire_ball(GF_ELEC, dir, 40 + lev, rad);
3246 case SV_ROD_FIRE_BALL:
3248 fire_ball(GF_FIRE, dir, 70 + lev, rad);
3253 case SV_ROD_COLD_BALL:
3255 fire_ball(GF_COLD, dir, 50 + lev, rad);
3267 case SV_ROD_STONE_TO_MUD:
3269 HIT_POINT dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
3270 if (wall_to_mud(dir, dam)) ident = TRUE;
3274 case SV_ROD_AGGRAVATE:
3276 aggravate_monsters(0);
3285 * @brief 魔法棒を使うコマンドのサブルーチン /
3286 * Activate (zap) a Rod
3287 * @param item 使うオブジェクトの所持品ID
3291 * Unstack fully charged rods as needed.
3292 * Hack -- rods of perception/genocide can be "cancelled"
3293 * All rods can be cancelled at the "Direction?" prompt
3294 * pvals are defined for each rod in k_info. -LM-
3297 static void do_cmd_zap_rod_aux(int item)
3299 int ident, chance, lev, fail;
3304 /* Hack -- let perception get aborted */
3305 bool use_charge = TRUE;
3309 /* Get the item (in the pack) */
3312 o_ptr = &inventory[item];
3315 /* Get the item (on the floor) */
3318 o_ptr = &o_list[0 - item];
3322 /* Mega-Hack -- refuse to zap a pile from the ground */
3323 if ((item < 0) && (o_ptr->number > 1))
3325 msg_print(_("まずはロッドを拾わなければ。", "You must first pick up the rods."));
3330 /* Get a direction (unless KNOWN not to need it) */
3331 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)) ||
3332 !object_is_aware(o_ptr))
3334 /* Get a direction, allow cancel */
3335 if (!get_aim_dir(&dir)) return;
3340 p_ptr->energy_use = 100;
3342 /* Extract the item level */
3343 lev = k_info[o_ptr->k_idx].level;
3345 /* Base chance of success */
3346 chance = p_ptr->skill_dev;
3348 /* Confusion hurts skill */
3349 if (p_ptr->confused) chance = chance / 2;
3352 if (chance > fail) fail -= (chance - fail)*2;
3353 else chance -= (fail - chance)*2;
3354 if (fail < USE_DEVICE) fail = USE_DEVICE;
3355 if (chance < USE_DEVICE) chance = USE_DEVICE;
3359 if (flush_failure) flush();
3360 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this rod is freezing too."));
3365 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3366 else if (chance > fail)
3368 if (randint0(chance*2) < fail) success = FALSE;
3369 else success = TRUE;
3373 if (randint0(fail*2) < chance) success = TRUE;
3374 else success = FALSE;
3377 /* Roll for usage */
3380 if (flush_failure) flush();
3381 msg_print(_("うまくロッドを使えなかった。", "You failed to use the rod properly."));
3386 k_ptr = &k_info[o_ptr->k_idx];
3388 /* A single rod is still charging */
3389 if ((o_ptr->number == 1) && (o_ptr->timeout))
3391 if (flush_failure) flush();
3392 msg_print(_("このロッドはまだ魔力を充填している最中だ。", "The rod is still charging."));
3395 /* A stack of rods lacks enough energy. */
3396 else if ((o_ptr->number > 1) && (o_ptr->timeout > k_ptr->pval * (o_ptr->number - 1)))
3398 if (flush_failure) flush();
3399 msg_print(_("そのロッドはまだ充填中です。", "The rods are all still charging."));
3406 ident = rod_effect(o_ptr->sval, dir, &use_charge, FALSE, FALSE);
3408 /* Increase the timeout by the rod kind's pval. -LM- */
3409 if (use_charge) o_ptr->timeout += k_ptr->pval;
3411 /* Combine / Reorder the pack (later) */
3412 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3414 if (!(object_is_aware(o_ptr)))
3416 chg_virtue(V_PATIENCE, -1);
3417 chg_virtue(V_CHANCE, 1);
3418 chg_virtue(V_KNOWLEDGE, -1);
3421 /* Tried the object */
3422 object_tried(o_ptr);
3424 /* Successfully determined the object function */
3425 if (ident && !object_is_aware(o_ptr))
3427 object_aware(o_ptr);
3428 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
3432 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3436 * @brief ロッドを使うコマンドのメインルーチン /
3439 void do_cmd_zap_rod(void)
3444 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3446 set_action(ACTION_NONE);
3449 /* Restrict choices to rods */
3450 item_tester_tval = TV_ROD;
3453 q = _("どのロッドを振りますか? ", "Zap which rod? ");
3454 s = _("使えるロッドがない。", "You have no rod to zap.");
3456 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3459 do_cmd_zap_rod_aux(item);
3463 * @brief オブジェクトをプレイヤーが魔道具として発動できるかを判定する /
3464 * Hook to determine if an object is activatable
3465 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
3466 * @return 魔道具として発動可能ならばTRUEを返す
3468 static bool item_tester_hook_activate(object_type *o_ptr)
3470 u32b flgs[TR_FLAG_SIZE];
3473 if (!object_is_known(o_ptr)) return (FALSE);
3475 /* Extract the flags */
3476 object_flags(o_ptr, flgs);
3478 /* Check activation flag */
3479 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
3486 * @brief 『一つの指輪』の効果処理 /
3487 * Hack -- activate the ring of power
3488 * @param dir 発動の方向ID
3491 void ring_of_power(int dir)
3493 /* Pick a random effect */
3494 switch (randint1(10))
3500 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3503 /* Decrease all stats (permanently) */
3504 (void)dec_stat(A_STR, 50, TRUE);
3505 (void)dec_stat(A_INT, 50, TRUE);
3506 (void)dec_stat(A_WIS, 50, TRUE);
3507 (void)dec_stat(A_DEX, 50, TRUE);
3508 (void)dec_stat(A_CON, 50, TRUE);
3509 (void)dec_stat(A_CHR, 50, TRUE);
3511 /* Lose some experience (permanently) */
3512 p_ptr->exp -= (p_ptr->exp / 4);
3513 p_ptr->max_exp -= (p_ptr->exp / 4);
3522 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3524 /* Dispel monsters */
3525 dispel_monsters(1000);
3535 fire_ball(GF_MANA, dir, 600, 3);
3546 fire_bolt(GF_MANA, dir, 500);
3554 * @brief ペット入りモンスターボールをソートするための比較関数
3555 * @param u 所持品配列の参照ポインタ
3559 * @return 1の方が大であればTRUE
3561 static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
3563 u16b *who = (u16b*)(u);
3568 monster_type *m_ptr1 = &m_list[w1];
3569 monster_type *m_ptr2 = &m_list[w2];
3570 monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
3571 monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
3576 if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
3577 if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
3579 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
3580 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
3582 if (r_ptr1->level > r_ptr2->level) return TRUE;
3583 if (r_ptr2->level > r_ptr1->level) return FALSE;
3585 if (m_ptr1->hp > m_ptr2->hp) return TRUE;
3586 if (m_ptr2->hp > m_ptr1->hp) return FALSE;
3593 * @brief 装備を発動するコマンドのサブルーチン /
3594 * Activate a wielded object. Wielded objects never stack.
3595 * And even if they did, activatable objects never stack.
3596 * @param item 発動するオブジェクトの所持品ID
3600 * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
3601 * But one could, for example, easily make an activatable "Ring of Plasma".
3602 * Note that it always takes a turn to activate an artifact, even if
3603 * the user hits "escape" at the "direction" prompt.
3606 static void do_cmd_activate_aux(int item)
3608 int dir, lev, chance, fail;
3613 /* Get the item (in the pack) */
3616 o_ptr = &inventory[item];
3619 /* Get the item (on the floor) */
3622 o_ptr = &o_list[0 - item];
3626 p_ptr->energy_use = 100;
3628 /* Extract the item level */
3629 lev = k_info[o_ptr->k_idx].level;
3631 /* Hack -- use artifact level instead */
3632 if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
3633 else if (object_is_random_artifact(o_ptr))
3635 const activation_type* const act_ptr = find_activation_info(o_ptr);
3637 lev = act_ptr->level;
3640 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
3642 /* Base chance of success */
3643 chance = p_ptr->skill_dev;
3645 /* Confusion hurts skill */
3646 if (p_ptr->confused) chance = chance / 2;
3649 if (chance > fail) fail -= (chance - fail)*2;
3650 else chance -= (fail - chance)*2;
3651 if (fail < USE_DEVICE) fail = USE_DEVICE;
3652 if (chance < USE_DEVICE) chance = USE_DEVICE;
3656 if (flush_failure) flush();
3657 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
3662 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3663 else if (chance > fail)
3665 if (randint0(chance*2) < fail) success = FALSE;
3666 else success = TRUE;
3670 if (randint0(fail*2) < chance) success = TRUE;
3671 else success = FALSE;
3674 /* Roll for usage */
3677 if (flush_failure) flush();
3678 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
3683 /* Check the recharge */
3686 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
3690 /* Some lights need enough fuel for activation */
3691 if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
3692 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
3694 msg_print(_("燃料がない。", "It has no fuel."));
3695 p_ptr->energy_use = 0;
3699 /* Activate the artifact */
3700 msg_print(_("始動させた...", "You activate it..."));
3705 /* Activate object */
3706 if (activation_index(o_ptr))
3708 (void)activate_random_artifact(o_ptr);
3711 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3718 else if (o_ptr->tval == TV_WHISTLE)
3720 if (music_singing_any()) stop_singing();
3721 if (hex_spelling_any()) stop_hex_spell_all();
3724 if (object_is_cursed(o_ptr))
3726 msg_print(_("カン高い音が響き渡った。", "You produce a shrill whistling sound."));
3727 aggravate_monsters(0);
3737 /* Allocate the "who" array */
3738 C_MAKE(who, max_m_idx, IDX);
3740 /* Process the monsters (backwards) */
3741 for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
3743 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
3744 who[max_pet++] = pet_ctr;
3747 /* Select the sort method */
3748 ang_sort_comp = ang_sort_comp_pet;
3749 ang_sort_swap = ang_sort_swap_hook;
3751 ang_sort(who, &dummy_why, max_pet);
3753 /* Process the monsters (backwards) */
3754 for (i = 0; i < max_pet; i++)
3757 teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
3760 /* Free the "who" array */
3761 C_KILL(who, max_m_idx, IDX);
3763 o_ptr->timeout = 100+randint1(100);
3766 else if (o_ptr->tval == TV_CAPTURE)
3770 bool old_target_pet = target_pet;
3772 if (!get_aim_dir(&dir))
3774 target_pet = old_target_pet;
3777 target_pet = old_target_pet;
3779 if(fire_ball(GF_CAPTURE, dir, 0, 0))
3781 o_ptr->pval = (PARAMETER_VALUE)cap_mon;
3782 o_ptr->xtra3 = (XTRA8)cap_mspeed;
3783 o_ptr->xtra4 = (XTRA16)cap_hp;
3784 o_ptr->xtra5 = (XTRA16)cap_maxhp;
3791 if (o_ptr->inscription)
3792 strcpy(buf, quark_str(o_ptr->inscription));
3794 for (s = buf;*s && (*s != '#'); s++)
3797 if (iskanji(*s)) s++;
3807 t = quark_str(cap_nickname);
3820 o_ptr->inscription = quark_add(buf);
3827 if (!get_rep_dir2(&dir)) return;
3828 if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
3830 if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
3832 if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
3833 if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
3834 if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
3835 m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
3836 if (o_ptr->inscription)
3844 t = quark_str(o_ptr->inscription);
3845 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
3848 if (iskanji(*t)) t++;
3873 if (quote && *(s-1) =='\'')
3877 m_list[hack_m_idx_ii].nickname = quark_add(buf);
3878 t = quark_str(o_ptr->inscription);
3880 while(*t && (*t != '#'))
3887 o_ptr->inscription = quark_add(buf);
3898 msg_print(_("おっと、解放に失敗した。", "Oops. You failed to release your pet."));
3905 msg_print(_("おっと、このアイテムは始動できない。", "Oops. That object cannot be activated."));
3909 * @brief 装備を発動するコマンドのメインルーチン /
3912 void do_cmd_activate(void)
3918 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3920 set_action(ACTION_NONE);
3923 item_tester_no_ryoute = TRUE;
3924 /* Prepare the hook */
3925 item_tester_hook = item_tester_hook_activate;
3928 q = _("どのアイテムを始動させますか? ", "Activate which item? ");
3929 s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
3931 if (!get_item(&item, q, s, (USE_EQUIP))) return;
3933 /* Activate the item */
3934 do_cmd_activate_aux(item);
3939 * @brief オブジェクトをプレイヤーが簡易使用コマンドで利用できるかを判定する /
3940 * Hook to determine if an object is useable
3941 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
3942 * @return 利用可能ならばTRUEを返す
3944 static bool item_tester_hook_use(object_type *o_ptr)
3946 u32b flgs[TR_FLAG_SIZE];
3949 if (o_ptr->tval == p_ptr->tval_ammo)
3952 /* Useable object */
3953 switch (o_ptr->tval)
3971 if (!object_is_known(o_ptr)) return (FALSE);
3973 /* HACK - only items from the equipment can be activated */
3974 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3976 if (&inventory[i] == o_ptr)
3978 /* Extract the flags */
3979 object_flags(o_ptr, flgs);
3981 /* Check activation flag */
3982 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
3994 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
3998 * XXX - Add actions for other item types
4000 void do_cmd_use(void)
4006 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
4008 set_action(ACTION_NONE);
4011 item_tester_no_ryoute = TRUE;
4012 /* Prepare the hook */
4013 item_tester_hook = item_tester_hook_use;
4016 q = _("どれを使いますか?", "Use which item? ");
4017 s = _("使えるものがありません。", "You have nothing to use.");
4019 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR))) return;
4021 /* Get the item (in the pack) */
4024 o_ptr = &inventory[item];
4026 /* Get the item (on the floor) */
4029 o_ptr = &o_list[0 - item];
4032 switch (o_ptr->tval)
4044 do_cmd_eat_food_aux(item);
4051 do_cmd_aim_wand_aux(item);
4058 do_cmd_use_staff_aux(item);
4065 do_cmd_zap_rod_aux(item);
4069 /* Quaff a potion */
4072 do_cmd_quaff_potion_aux(item);
4079 /* Check some conditions */
4082 msg_print(_("目が見えない。", "You can't see anything."));
4087 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
4090 if (p_ptr->confused)
4092 msg_print(_("混乱していて読めない!", "You are too confused!"));
4096 do_cmd_read_scroll_aux(item, TRUE);
4105 do_cmd_fire_aux(item, &inventory[INVEN_BOW]);
4109 /* Activate an artifact */
4112 do_cmd_activate_aux(item);
4119 * @brief 魔道具術師の取り込んだ魔力一覧から選択/閲覧する /
4120 * @param only_browse 閲覧するだけならばTRUE
4121 * @return 選択した魔力のID、キャンセルならば-1を返す
4123 static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
4125 OBJECT_SUBTYPE_VALUE ext = 0;
4127 bool flag, request_list;
4128 OBJECT_TYPE_VALUE tval = 0;
4130 OBJECT_SUBTYPE_VALUE i = 0;
4133 int menu_line = (use_menu ? 1 : 0);
4137 if (repeat_pull(&sn))
4139 /* Verify the spell */
4140 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))
4142 else if (sn < EATER_EXT*2 && !(p_ptr->magic_num1[sn] < EATER_CHARGE))
4146 #endif /* ALLOW_REPEAT */
4148 for (i = 0; i < 108; i++)
4150 if (p_ptr->magic_num2[i]) break;
4154 msg_print(_("魔法を覚えていない!", "You don't have any magic!"));
4165 prt(format(" %s 杖", (menu_line == 1) ? "》" : " "), 2, 14);
4166 prt(format(" %s 魔法棒", (menu_line == 2) ? "》" : " "), 3, 14);
4167 prt(format(" %s ロッド", (menu_line == 3) ? "》" : " "), 4, 14);
4169 prt(format(" %s staff", (menu_line == 1) ? "> " : " "), 2, 14);
4170 prt(format(" %s wand", (menu_line == 2) ? "> " : " "), 3, 14);
4171 prt(format(" %s rod", (menu_line == 3) ? "> " : " "), 4, 14);
4174 if (only_browse) prt(_("どの種類の魔法を見ますか?", "Which type of magic do you browse?"), 0, 0);
4175 else prt(_("どの種類の魔法を使いますか?", "Which type of magic do you use?"), 0, 0);
4198 ext = (menu_line-1)*EATER_EXT;
4199 if (menu_line == 1) tval = TV_STAFF;
4200 else if (menu_line == 2) tval = TV_WAND;
4204 if (menu_line > 3) menu_line -= 3;
4212 if (!get_com(_("[A] 杖, [B] 魔法棒, [C] ロッド:", "[A] staff, [B] wand, [C] rod:"), &choice, TRUE))
4216 if (choice == 'A' || choice == 'a')
4222 if (choice == 'B' || choice == 'b')
4228 if (choice == 'C' || choice == 'c')
4236 for (i = ext; i < ext + EATER_EXT; i++)
4238 if (p_ptr->magic_num2[i])
4240 if (use_menu) menu_line = i-ext+1;
4244 if (i == ext+EATER_EXT)
4246 msg_print(_("その種類の魔法は覚えていない!", "You don't have that type of magic!"));
4250 /* Nothing chosen yet */
4253 /* Build a prompt */
4254 if (only_browse) strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの魔力を見ますか?",
4255 "(*=List, ESC=exit) Browse which power? "));
4256 else strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの魔力を使いますか?",
4257 "(*=List, ESC=exit) Use which power? "));
4259 /* Save the screen */
4262 request_list = always_show_list;
4264 /* Get a spell from the user */
4268 if (request_list || use_menu)
4271 OBJECT_SUBTYPE_VALUE ctr;
4281 for (y = 1; y < 20; y++)
4286 /* Print header(s) */
4288 prt(format(" %s 失率 %s 失率", (tval == TV_ROD ? " 状態 " : "使用回数"), (tval == TV_ROD ? " 状態 " : "使用回数")), y++, x);
4290 prt(format(" %s Fail %s Fail", (tval == TV_ROD ? " Stat " : " Charges"), (tval == TV_ROD ? " Stat " : " Charges")), y++, x);
4294 for (ctr = 0; ctr < EATER_EXT; ctr++)
4296 if (!p_ptr->magic_num2[ctr+ext]) continue;
4298 k_idx = lookup_kind(tval, ctr);
4302 if (ctr == (menu_line-1))
4303 strcpy(dummy, _("》", "> "));
4307 /* letter/number for power selection */
4314 letter = '0' + ctr - 26;
4315 sprintf(dummy, "%c)",letter);
4317 x1 = ((ctr < EATER_EXT/2) ? x : x + 40);
4318 y1 = ((ctr < EATER_EXT/2) ? y + ctr : y + ctr - EATER_EXT/2);
4319 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
4320 chance = level * 4 / 5 + 20;
4321 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4323 if (p_ptr->lev > level)
4325 chance -= 3 * (p_ptr->lev - level);
4327 chance = mod_spell_chance_1(chance);
4328 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
4329 /* Stunning makes spells harder */
4330 if (p_ptr->stun > 50) chance += 25;
4331 else if (p_ptr->stun) chance += 15;
4333 if (chance > 95) chance = 95;
4335 chance = mod_spell_chance_2(chance);
4343 strcat(dummy, format(
4344 _(" %-22.22s 充填:%2d/%2d%3d%%", " %-22.22s (%2d/%2d) %3d%%"),
4345 k_name + k_info[k_idx].name,
4346 p_ptr->magic_num1[ctr+ext] ?
4347 (p_ptr->magic_num1[ctr+ext] - 1) / (EATER_ROD_CHARGE * k_info[k_idx].pval) +1 : 0,
4348 p_ptr->magic_num2[ctr+ext], chance));
4349 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;
4353 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));
4354 if (p_ptr->magic_num1[ctr+ext] < EATER_CHARGE) col = TERM_RED;
4359 c_prt(col, dummy, y1, x1);
4363 if (!get_com(out_val, &choice, FALSE)) break;
4365 if (use_menu && choice != ' ')
4381 menu_line += EATER_EXT - 1;
4382 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
4383 } while(!p_ptr->magic_num2[menu_line+ext-1]);
4394 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
4395 } while(!p_ptr->magic_num2[menu_line+ext-1]);
4406 bool reverse = FALSE;
4407 if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
4408 if (menu_line > EATER_EXT/2)
4410 menu_line -= EATER_EXT/2;
4413 else menu_line+=EATER_EXT/2;
4414 while(!p_ptr->magic_num2[menu_line+ext-1])
4419 if (menu_line < 2) reverse = FALSE;
4424 if (menu_line > EATER_EXT-1) reverse = TRUE;
4441 /* Request redraw */
4442 if (use_menu && ask) continue;
4444 /* Request redraw */
4445 if (!use_menu && ((choice == ' ') || (choice == '*') || (choice == '?')))
4451 request_list = FALSE;
4453 /* Restore the screen */
4458 request_list = TRUE;
4466 if (isalpha(choice))
4469 ask = (isupper(choice));
4472 if (ask) choice = (char)tolower(choice);
4474 /* Extract request */
4475 i = (islower(choice) ? A2I(choice) : -1);
4479 ask = FALSE; /* Can't uppercase digits */
4481 i = choice - '0' + 26;
4485 /* Totally Illegal */
4486 if ((i < 0) || (i > EATER_EXT) || !p_ptr->magic_num2[i+ext])
4500 (void) strnfmt(tmp_val, 78, _("%sを使いますか? ", "Use %s?"), k_name + k_info[lookup_kind(tval ,i)].name);
4502 /* Belay that order */
4503 if (!get_check(tmp_val)) continue;
4507 if (p_ptr->magic_num1[ext+i] > k_info[lookup_kind(tval, i)].pval * (p_ptr->magic_num2[ext+i] - 1) * EATER_ROD_CHARGE)
4509 msg_print(_("その魔法はまだ充填している最中だ。", "The magic are still charging."));
4511 if (use_menu) ask = TRUE;
4517 if (p_ptr->magic_num1[ext+i] < EATER_CHARGE)
4519 msg_print(_("その魔法は使用回数が切れている。", "The magic has no charges left."));
4521 if (use_menu) ask = TRUE;
4533 /* Clear lines, position cursor (really should use strlen here) */
4534 Term_erase(7, 23, 255);
4535 Term_erase(7, 22, 255);
4536 Term_erase(7, 21, 255);
4537 Term_erase(7, 20, 255);
4539 roff_to_buf(k_text + k_info[lookup_kind(tval, i)].text, 62, temp, sizeof(temp));
4540 for (j = 0, line = 21; temp[j]; j += 1 + strlen(&temp[j]))
4542 prt(&temp[j], line, 10);
4553 /* Restore the screen */
4556 if (!flag) return -1;
4560 #endif /* ALLOW_REPEAT */
4566 * @brief 取り込んだ魔力を利用するコマンドのメインルーチン /
4567 * Use eaten rod, wand or staff
4568 * @param only_browse 閲覧するだけならばTRUE
4569 * @param powerful 強力発動中の処理ならばTRUE
4570 * @return 実際にコマンドを実行したならばTRUEを返す。
4572 bool do_cmd_magic_eater(bool only_browse, bool powerful)
4574 OBJECT_SUBTYPE_VALUE item;
4578 OBJECT_TYPE_VALUE tval;
4579 OBJECT_SUBTYPE_VALUE sval;
4580 bool use_charge = TRUE;
4582 /* Not when confused */
4583 if (!only_browse && p_ptr->confused)
4585 msg_print(_("混乱していて唱えられない!", "You are too confused!"));
4589 item = select_magic_eater(only_browse);
4592 p_ptr->energy_use = 0;
4595 if (item >= EATER_EXT*2) {tval = TV_ROD;sval = item - EATER_EXT*2;}
4596 else if (item >= EATER_EXT) {tval = TV_WAND;sval = item - EATER_EXT;}
4597 else {tval = TV_STAFF; sval = item;}
4598 k_idx = lookup_kind(tval, sval);
4600 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
4601 chance = level * 4 / 5 + 20;
4602 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4604 if (p_ptr->lev > level)
4606 chance -= 3 * (p_ptr->lev - level);
4608 chance = mod_spell_chance_1(chance);
4609 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
4610 /* Stunning makes spells harder */
4611 if (p_ptr->stun > 50) chance += 25;
4612 else if (p_ptr->stun) chance += 15;
4614 if (chance > 95) chance = 95;
4616 chance = mod_spell_chance_2(chance);
4618 if (randint0(100) < chance)
4620 if (flush_failure) flush();
4622 msg_print(_("呪文をうまく唱えられなかった!", "You failed to get the magic off!"));
4624 if (randint1(100) >= chance)
4625 chg_virtue(V_CHANCE,-1);
4626 p_ptr->energy_use = 100;
4636 if ((sval >= SV_ROD_MIN_DIRECTION) && (sval != SV_ROD_HAVOC) && (sval != SV_ROD_AGGRAVATE) && (sval != SV_ROD_PESTICIDE))
4637 if (!get_aim_dir(&dir)) return FALSE;
4638 rod_effect(sval, dir, &use_charge, powerful, TRUE);
4639 if (!use_charge) return FALSE;
4641 else if (tval == TV_WAND)
4643 if (!get_aim_dir(&dir)) return FALSE;
4644 wand_effect(sval, dir, powerful, TRUE);
4648 staff_effect(sval, &use_charge, powerful, TRUE, TRUE);
4649 if (!use_charge) return FALSE;
4651 if (randint1(100) < chance)
4652 chg_virtue(V_CHANCE,1);
4654 p_ptr->energy_use = 100;
4655 if (tval == TV_ROD) p_ptr->magic_num1[item] += k_info[k_idx].pval * EATER_ROD_CHARGE;
4656 else p_ptr->magic_num1[item] -= EATER_CHARGE;