3 * @brief プレイヤーのアイテムに関するコマンドの実装2 / Spell/Prayer commands
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
11 * 2014 Deskull rearranged comment for Doxygen.\n
15 * This file includes code for eating food, drinking potions,
16 * reading scrolls, aiming wands, using staffs, zapping rods,
17 * and activating artifacts.
19 * In all cases, if the player becomes "aware" of the item's use
20 * by testing it, mark it as "aware" and reward some experience
21 * based on the object's level, always rounding up. If the player
22 * remains "unaware", mark that object "kind" as "tried".
24 * This code now correctly handles the unstacking of wands, staffs,
25 * and rods. Note the overly paranoid warning about potential pack
26 * overflow, which allows the player to use and drop a stacked item.
28 * In all "unstacking" scenarios, the "used" object is "carried" as if
29 * the player had just picked it up. In particular, this means that if
30 * the use of an item induces pack overflow, that item will be dropped.
32 * For simplicity, these routines induce a full "pack reorganization"
33 * which not only combines similar items, but also reorganizes various
34 * items to obey the current "sorting" method. This may require about
35 * 400 item comparisons, but only occasionally.
37 * There may be a BIG problem with any "effect" that can cause "changes"
38 * to the inventory. For example, a "scroll of recharging" can cause
39 * a wand/staff to "disappear", moving the inventory up. Luckily, the
40 * scrolls all appear BEFORE the staffs/wands, so this is not a problem.
41 * But, for example, a "staff of recharging" could cause MAJOR problems.
42 * In such a case, it will be best to either (1) "postpone" the effect
43 * until the end of the function, or (2) "change" the effect, say, into
44 * giving a staff "negative" charges, or "turning a staff into a stick".
45 * It seems as though a "rod of recharging" might in fact cause problems.
46 * The basic problem is that the act of recharging (and destroying) an
47 * item causes the inducer of that action to "move", causing "o_ptr" to
48 * no longer point at the correct item, with horrifying results.
50 * Note that food/potions/scrolls no longer use bit-flags for effects,
51 * but instead use the "sval" (which is also used to sort the objects).
59 * @brief 食料を食べるコマンドのサブルーチン
60 * @param item 食べるオブジェクトの所持品ID
63 static void do_cmd_eat_food_aux(int item)
68 if (music_singing_any()) stop_singing();
69 if (hex_spelling_any()) stop_hex_spell_all();
71 /* Get the item (in the pack) */
74 o_ptr = &inventory[item];
77 /* Get the item (on the floor) */
80 o_ptr = &o_list[0 - item];
89 /* Identity not known yet */
93 lev = k_info[o_ptr->k_idx].level;
95 if (o_ptr->tval == TV_FOOD)
97 /* Analyze the food */
102 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
104 if (set_poisoned(p_ptr->poisoned + randint0(10) + 10))
112 case SV_FOOD_BLINDNESS:
114 if (!p_ptr->resist_blind)
116 if (set_blind(p_ptr->blind + randint0(200) + 200))
124 case SV_FOOD_PARANOIA:
126 if (!p_ptr->resist_fear)
128 if (set_afraid(p_ptr->afraid + randint0(10) + 10))
136 case SV_FOOD_CONFUSION:
138 if (!p_ptr->resist_conf)
140 if (set_confused(p_ptr->confused + randint0(10) + 10))
148 case SV_FOOD_HALLUCINATION:
150 if (!p_ptr->resist_chaos)
152 if (set_image(p_ptr->image + randint0(250) + 250))
160 case SV_FOOD_PARALYSIS:
162 if (!p_ptr->free_act)
164 if (set_paralyzed(p_ptr->paralyzed + randint0(10) + 10))
172 case SV_FOOD_WEAKNESS:
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, py, px);
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)
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 /* Pick a nightmare */
813 get_mon_num_prep(get_nightmare, NULL);
815 /* Have some nightmares */
816 have_nightmare(get_mon_num(MAX_DEPTH));
818 /* Remove the monster restriction */
819 get_mon_num_prep(NULL, NULL);
821 if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))
828 case SV_POTION_LOSE_MEMORIES:
829 if (!p_ptr->hold_exp && (p_ptr->exp > 0))
831 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
832 chg_virtue(V_KNOWLEDGE, -5);
834 lose_exp(p_ptr->exp / 4);
839 case SV_POTION_RUINATION:
840 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
841 take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
843 (void)dec_stat(A_DEX, 25, TRUE);
844 (void)dec_stat(A_WIS, 25, TRUE);
845 (void)dec_stat(A_CON, 25, TRUE);
846 (void)dec_stat(A_STR, 25, TRUE);
847 (void)dec_stat(A_CHR, 25, TRUE);
848 (void)dec_stat(A_INT, 25, TRUE);
852 case SV_POTION_DEC_STR:
853 if (do_dec_stat(A_STR)) ident = TRUE;
856 case SV_POTION_DEC_INT:
857 if (do_dec_stat(A_INT)) ident = TRUE;
860 case SV_POTION_DEC_WIS:
861 if (do_dec_stat(A_WIS)) ident = TRUE;
864 case SV_POTION_DEC_DEX:
865 if (do_dec_stat(A_DEX)) ident = TRUE;
868 case SV_POTION_DEC_CON:
869 if (do_dec_stat(A_CON)) ident = TRUE;
872 case SV_POTION_DEC_CHR:
873 if (do_dec_stat(A_CHR)) ident = TRUE;
876 case SV_POTION_DETONATIONS:
877 msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
878 take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);
880 (void)set_stun(p_ptr->stun + 75);
881 (void)set_cut(p_ptr->cut + 5000);
885 case SV_POTION_DEATH:
886 chg_virtue(V_VITALITY, -1);
887 chg_virtue(V_UNLIFE, 5);
888 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
889 take_hit(DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1);
893 case SV_POTION_INFRAVISION:
894 if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))
900 case SV_POTION_DETECT_INVIS:
901 if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))
907 case SV_POTION_SLOW_POISON:
908 if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE;
911 case SV_POTION_CURE_POISON:
912 if (set_poisoned(0)) ident = TRUE;
915 case SV_POTION_BOLDNESS:
916 if (set_afraid(0)) ident = TRUE;
919 case SV_POTION_SPEED:
922 if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;
926 (void)set_fast(p_ptr->fast + 5, FALSE);
930 case SV_POTION_RESIST_HEAT:
931 if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))
937 case SV_POTION_RESIST_COLD:
938 if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))
944 case SV_POTION_HEROISM:
945 if (set_afraid(0)) ident = TRUE;
946 if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE;
947 if (hp_player(10)) ident = TRUE;
950 case SV_POTION_BESERK_STRENGTH:
951 if (set_afraid(0)) ident = TRUE;
952 if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE;
953 if (hp_player(30)) ident = TRUE;
956 case SV_POTION_CURE_LIGHT:
957 if (hp_player(damroll(2, 8))) ident = TRUE;
958 if (set_blind(0)) ident = TRUE;
959 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
960 if (set_shero(0,TRUE)) ident = TRUE;
963 case SV_POTION_CURE_SERIOUS:
964 if (hp_player(damroll(4, 8))) ident = TRUE;
965 if (set_blind(0)) ident = TRUE;
966 if (set_confused(0)) ident = TRUE;
967 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
968 if (set_shero(0,TRUE)) ident = TRUE;
971 case SV_POTION_CURE_CRITICAL:
972 if (hp_player(damroll(6, 8))) ident = TRUE;
973 if (set_blind(0)) ident = TRUE;
974 if (set_confused(0)) ident = TRUE;
975 if (set_poisoned(0)) ident = TRUE;
976 if (set_stun(0)) ident = TRUE;
977 if (set_cut(0)) ident = TRUE;
978 if (set_shero(0,TRUE)) ident = TRUE;
981 case SV_POTION_HEALING:
982 if (hp_player(300)) ident = TRUE;
983 if (set_blind(0)) ident = TRUE;
984 if (set_confused(0)) ident = TRUE;
985 if (set_poisoned(0)) ident = TRUE;
986 if (set_stun(0)) ident = TRUE;
987 if (set_cut(0)) ident = TRUE;
988 if (set_shero(0,TRUE)) ident = TRUE;
991 case SV_POTION_STAR_HEALING:
992 if (hp_player(1200)) ident = TRUE;
993 if (set_blind(0)) ident = TRUE;
994 if (set_confused(0)) ident = TRUE;
995 if (set_poisoned(0)) ident = TRUE;
996 if (set_stun(0)) ident = TRUE;
997 if (set_cut(0)) ident = TRUE;
998 if (set_shero(0,TRUE)) ident = TRUE;
1001 case SV_POTION_LIFE:
1002 chg_virtue(V_VITALITY, 1);
1003 chg_virtue(V_UNLIFE, -5);
1004 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
1006 (void)set_poisoned(0);
1008 (void)set_confused(0);
1012 (void)do_res_stat(A_STR);
1013 (void)do_res_stat(A_CON);
1014 (void)do_res_stat(A_DEX);
1015 (void)do_res_stat(A_WIS);
1016 (void)do_res_stat(A_INT);
1017 (void)do_res_stat(A_CHR);
1018 (void)set_shero(0,TRUE);
1024 case SV_POTION_RESTORE_MANA:
1025 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1028 for (i = 0; i < EATER_EXT*2; i++)
1030 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3;
1031 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;
1033 for (; i < EATER_EXT*3; i++)
1035 int k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);
1036 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;
1037 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
1039 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
1040 p_ptr->window |= (PW_PLAYER);
1043 else if (p_ptr->csp < p_ptr->msp)
1045 p_ptr->csp = p_ptr->msp;
1046 p_ptr->csp_frac = 0;
1047 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
1049 p_ptr->redraw |= (PR_MANA);
1050 p_ptr->window |= (PW_PLAYER);
1051 p_ptr->window |= (PW_SPELL);
1054 if (set_shero(0,TRUE)) ident = TRUE;
1057 case SV_POTION_RESTORE_EXP:
1058 if (restore_level()) ident = TRUE;
1061 case SV_POTION_RES_STR:
1062 if (do_res_stat(A_STR)) ident = TRUE;
1065 case SV_POTION_RES_INT:
1066 if (do_res_stat(A_INT)) ident = TRUE;
1069 case SV_POTION_RES_WIS:
1070 if (do_res_stat(A_WIS)) ident = TRUE;
1073 case SV_POTION_RES_DEX:
1074 if (do_res_stat(A_DEX)) ident = TRUE;
1077 case SV_POTION_RES_CON:
1078 if (do_res_stat(A_CON)) ident = TRUE;
1081 case SV_POTION_RES_CHR:
1082 if (do_res_stat(A_CHR)) ident = TRUE;
1085 case SV_POTION_INC_STR:
1086 if (do_inc_stat(A_STR)) ident = TRUE;
1089 case SV_POTION_INC_INT:
1090 if (do_inc_stat(A_INT)) ident = TRUE;
1093 case SV_POTION_INC_WIS:
1094 if (do_inc_stat(A_WIS)) ident = TRUE;
1097 case SV_POTION_INC_DEX:
1098 if (do_inc_stat(A_DEX)) ident = TRUE;
1101 case SV_POTION_INC_CON:
1102 if (do_inc_stat(A_CON)) ident = TRUE;
1105 case SV_POTION_INC_CHR:
1106 if (do_inc_stat(A_CHR)) ident = TRUE;
1109 case SV_POTION_AUGMENTATION:
1110 if (do_inc_stat(A_STR)) ident = TRUE;
1111 if (do_inc_stat(A_INT)) ident = TRUE;
1112 if (do_inc_stat(A_WIS)) ident = TRUE;
1113 if (do_inc_stat(A_DEX)) ident = TRUE;
1114 if (do_inc_stat(A_CON)) ident = TRUE;
1115 if (do_inc_stat(A_CHR)) ident = TRUE;
1118 case SV_POTION_ENLIGHTENMENT:
1119 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
1120 chg_virtue(V_KNOWLEDGE, 1);
1121 chg_virtue(V_ENLIGHTEN, 1);
1126 case SV_POTION_STAR_ENLIGHTENMENT:
1127 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
1128 chg_virtue(V_KNOWLEDGE, 1);
1129 chg_virtue(V_ENLIGHTEN, 2);
1132 (void)do_inc_stat(A_INT);
1133 (void)do_inc_stat(A_WIS);
1134 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
1135 (void)detect_doors(DETECT_RAD_DEFAULT);
1136 (void)detect_stairs(DETECT_RAD_DEFAULT);
1137 (void)detect_treasure(DETECT_RAD_DEFAULT);
1138 (void)detect_objects_gold(DETECT_RAD_DEFAULT);
1139 (void)detect_objects_normal(DETECT_RAD_DEFAULT);
1145 case SV_POTION_SELF_KNOWLEDGE:
1146 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
1152 case SV_POTION_EXPERIENCE:
1153 if (p_ptr->prace == RACE_ANDROID) break;
1154 chg_virtue(V_ENLIGHTEN, 1);
1155 if (p_ptr->exp < PY_MAX_EXP)
1157 s32b ee = (p_ptr->exp / 2) + 10;
1158 if (ee > 100000L) ee = 100000L;
1159 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
1165 case SV_POTION_RESISTANCE:
1166 (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);
1167 (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
1168 (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
1169 (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);
1170 (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
1174 case SV_POTION_CURING:
1175 if (hp_player(50)) ident = TRUE;
1176 if (set_blind(0)) ident = TRUE;
1177 if (set_poisoned(0)) ident = TRUE;
1178 if (set_confused(0)) ident = TRUE;
1179 if (set_stun(0)) ident = TRUE;
1180 if (set_cut(0)) ident = TRUE;
1181 if (set_image(0)) ident = TRUE;
1184 case SV_POTION_INVULNERABILITY:
1185 (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);
1189 case SV_POTION_NEW_LIFE:
1190 do_cmd_rerate(FALSE);
1192 p_ptr->update |= PU_BONUS;
1193 if (p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3)
1195 chg_virtue(V_CHANCE, -5);
1196 msg_print(_("全ての突然変異が治った。", "You are cured of all mutations."));
1197 p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
1198 p_ptr->update |= PU_BONUS;
1200 mutant_regenerate_mod = calc_mutant_regenerate_mod();
1205 case SV_POTION_NEO_TSUYOSHI:
1207 (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
1211 case SV_POTION_TSUYOSHI:
1212 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
1214 p_ptr->tsuyoshi = 1;
1215 (void)set_tsuyoshi(0, TRUE);
1216 if (!p_ptr->resist_chaos)
1218 (void)set_image(50 + randint1(50));
1223 case SV_POTION_POLYMORPH:
1224 if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
1226 chg_virtue(V_CHANCE, -5);
1227 msg_print(_("全ての突然変異が治った。", "You are cured of all mutations."));
1228 p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
1229 p_ptr->update |= PU_BONUS;
1238 if(gain_random_mutation(0)) ident = TRUE;
1240 else if (lose_mutation(0)) ident = TRUE;
1241 } while(!ident || one_in_(2));
1247 if (prace_is_(RACE_SKELETON))
1249 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
1250 (void)potion_smash_effect(0, py, px, q_ptr->k_idx);
1253 /* Combine / Reorder the pack (later) */
1254 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1256 if (!(object_is_aware(q_ptr)))
1258 chg_virtue(V_PATIENCE, -1);
1259 chg_virtue(V_CHANCE, 1);
1260 chg_virtue(V_KNOWLEDGE, -1);
1263 /* The item has been tried */
1264 object_tried(q_ptr);
1266 /* An identification was made */
1267 if (ident && !object_is_aware(q_ptr))
1269 object_aware(q_ptr);
1270 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1274 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1276 /* Potions can feed the player */
1277 switch (p_ptr->mimic_form)
1280 switch (p_ptr->prace)
1283 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
1292 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1295 if (q_ptr->tval == TV_FLASK)
1297 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
1298 set_food(p_ptr->food + 5000);
1302 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1306 msg_print(_("水分を取り込んだ。", "You are moistened."));
1307 set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
1310 (void)set_food(p_ptr->food + q_ptr->pval);
1315 case MIMIC_DEMON_LORD:
1316 set_food(p_ptr->food + ((q_ptr->pval) / 20));
1319 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
1322 (void)set_food(p_ptr->food + q_ptr->pval);
1329 * @brief オブジェクトをプレイヤーが飲むことができるかを判定する /
1330 * Hook to determine if an object can be quaffed
1331 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1332 * @return 飲むことが可能ならばTRUEを返す
1334 static bool item_tester_hook_quaff(object_type *o_ptr)
1336 if (o_ptr->tval == TV_POTION) return TRUE;
1338 if (prace_is_(RACE_ANDROID))
1340 if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL)
1348 * @brief 薬を飲むコマンドのメインルーチン /
1349 * Quaff some potion (from the pack or floor)
1352 void do_cmd_quaff_potion(void)
1357 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1359 set_action(ACTION_NONE);
1362 /* Restrict choices to potions */
1363 item_tester_hook = item_tester_hook_quaff;
1366 q = _("どの薬を飲みますか? ", "Quaff which potion? ");
1367 s = _("飲める薬がない。", "You have no potions to quaff.");
1369 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1371 /* Quaff the potion */
1372 do_cmd_quaff_potion_aux(item);
1377 * @brief 巻物を読むコマンドのサブルーチン
1378 * Read a scroll (from the pack or floor).
1379 * @param item 読むオブジェクトの所持品ID
1380 * @param known 判明済ならばTRUE
1384 * Certain scrolls can be "aborted" without losing the scroll. These
1385 * include scrolls with no effects but recharge or identify, which are
1386 * cancelled before use. XXX Reading them still takes a turn, though.
1389 static void do_cmd_read_scroll_aux(int item, bool known)
1391 int k, used_up, ident, lev;
1395 /* Get the item (in the pack) */
1398 o_ptr = &inventory[item];
1401 /* Get the item (on the floor) */
1404 o_ptr = &o_list[0 - item];
1413 if (flush_failure) flush();
1414 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen."));
1419 if (p_ptr->pclass == CLASS_BERSERKER)
1421 msg_print(_("巻物なんて読めない。", "You cannot read."));
1425 if (music_singing_any()) stop_singing();
1428 if (hex_spelling_any() && ((p_ptr->lev < 35) || hex_spell_fully())) stop_hex_spell_all();
1430 /* Not identified yet */
1434 lev = k_info[o_ptr->k_idx].level;
1436 /* Assume the scroll will get used up */
1439 if (o_ptr->tval == TV_SCROLL)
1441 /* Analyze the scroll */
1442 switch (o_ptr->sval)
1444 case SV_SCROLL_DARKNESS:
1446 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
1448 (void)set_blind(p_ptr->blind + 3 + randint1(5));
1450 if (unlite_area(10, 3)) ident = TRUE;
1454 case SV_SCROLL_AGGRAVATE_MONSTER:
1456 msg_print(_("カン高くうなる様な音が辺りを覆った。", "There is a high pitched humming noise."));
1457 aggravate_monsters(0);
1462 case SV_SCROLL_CURSE_ARMOR:
1464 if (curse_armor()) ident = TRUE;
1468 case SV_SCROLL_CURSE_WEAPON:
1471 if (buki_motteruka(INVEN_RARM))
1474 if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
1476 else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM;
1477 if (k && curse_weapon(FALSE, k)) ident = TRUE;
1481 case SV_SCROLL_SUMMON_MONSTER:
1483 for (k = 0; k < randint1(3); k++)
1485 if (summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
1493 case SV_SCROLL_SUMMON_UNDEAD:
1495 for (k = 0; k < randint1(3); k++)
1497 if (summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
1505 case SV_SCROLL_SUMMON_PET:
1507 if (summon_specific(-1, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET)))
1514 case SV_SCROLL_SUMMON_KIN:
1516 if (summon_kin_player(p_ptr->lev, py, px, (PM_FORCE_PET | PM_ALLOW_GROUP)))
1523 case SV_SCROLL_TRAP_CREATION:
1525 if (trap_creation(py, px)) ident = TRUE;
1529 case SV_SCROLL_PHASE_DOOR:
1531 teleport_player(10, 0L);
1536 case SV_SCROLL_TELEPORT:
1538 teleport_player(100, 0L);
1543 case SV_SCROLL_TELEPORT_LEVEL:
1545 (void)teleport_level(0);
1550 case SV_SCROLL_WORD_OF_RECALL:
1552 if (!word_of_recall()) used_up = FALSE;
1557 case SV_SCROLL_IDENTIFY:
1559 if (!ident_spell(FALSE)) used_up = FALSE;
1564 case SV_SCROLL_STAR_IDENTIFY:
1566 if (!identify_fully(FALSE)) used_up = FALSE;
1571 case SV_SCROLL_REMOVE_CURSE:
1575 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1581 case SV_SCROLL_STAR_REMOVE_CURSE:
1583 if (remove_all_curse())
1585 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1591 case SV_SCROLL_ENCHANT_ARMOR:
1594 if (!enchant_spell(0, 0, 1)) used_up = FALSE;
1598 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
1600 if (!enchant_spell(1, 0, 0)) used_up = FALSE;
1605 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
1607 if (!enchant_spell(0, 1, 0)) used_up = FALSE;
1612 case SV_SCROLL_STAR_ENCHANT_ARMOR:
1614 if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
1619 case SV_SCROLL_STAR_ENCHANT_WEAPON:
1621 if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
1626 case SV_SCROLL_RECHARGING:
1628 if (!recharge(130)) used_up = FALSE;
1633 case SV_SCROLL_MUNDANITY:
1636 if (!mundane_spell(FALSE)) used_up = FALSE;
1640 case SV_SCROLL_LIGHT:
1642 if (lite_area(damroll(2, 8), 2)) ident = TRUE;
1646 case SV_SCROLL_MAPPING:
1648 map_area(DETECT_RAD_MAP);
1653 case SV_SCROLL_DETECT_GOLD:
1655 if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
1656 if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
1660 case SV_SCROLL_DETECT_ITEM:
1662 if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
1666 case SV_SCROLL_DETECT_TRAP:
1668 if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
1672 case SV_SCROLL_DETECT_DOOR:
1674 if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
1675 if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
1679 case SV_SCROLL_DETECT_INVIS:
1681 if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
1685 case SV_SCROLL_SATISFY_HUNGER:
1687 if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
1691 case SV_SCROLL_BLESSING:
1693 if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
1697 case SV_SCROLL_HOLY_CHANT:
1699 if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
1703 case SV_SCROLL_HOLY_PRAYER:
1705 if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
1709 case SV_SCROLL_MONSTER_CONFUSION:
1711 if (!(p_ptr->special_attack & ATTACK_CONFUSE))
1713 msg_print(_("手が輝き始めた。", "Your hands begin to glow."));
1714 p_ptr->special_attack |= ATTACK_CONFUSE;
1715 p_ptr->redraw |= (PR_STATUS);
1721 case SV_SCROLL_PROTECTION_FROM_EVIL:
1724 if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
1728 case SV_SCROLL_RUNE_OF_PROTECTION:
1735 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
1737 if (destroy_doors_touch()) ident = TRUE;
1741 case SV_SCROLL_STAR_DESTRUCTION:
1743 if (destroy_area(py, px, 13 + randint0(5), FALSE))
1746 msg_print(_("ダンジョンが揺れた...", "The dungeon trembles..."));
1751 case SV_SCROLL_DISPEL_UNDEAD:
1753 if (dispel_undead(80)) ident = TRUE;
1757 case SV_SCROLL_SPELL:
1759 if ((p_ptr->pclass == CLASS_WARRIOR) ||
1760 (p_ptr->pclass == CLASS_IMITATOR) ||
1761 (p_ptr->pclass == CLASS_MINDCRAFTER) ||
1762 (p_ptr->pclass == CLASS_SORCERER) ||
1763 (p_ptr->pclass == CLASS_ARCHER) ||
1764 (p_ptr->pclass == CLASS_MAGIC_EATER) ||
1765 (p_ptr->pclass == CLASS_RED_MAGE) ||
1766 (p_ptr->pclass == CLASS_SAMURAI) ||
1767 (p_ptr->pclass == CLASS_BLUE_MAGE) ||
1768 (p_ptr->pclass == CLASS_CAVALRY) ||
1769 (p_ptr->pclass == CLASS_BERSERKER) ||
1770 (p_ptr->pclass == CLASS_SMITH) ||
1771 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
1772 (p_ptr->pclass == CLASS_NINJA) ||
1773 (p_ptr->pclass == CLASS_SNIPER)) break;
1774 p_ptr->add_spells++;
1775 p_ptr->update |= (PU_SPELLS);
1780 case SV_SCROLL_GENOCIDE:
1782 (void)symbol_genocide(300, TRUE);
1787 case SV_SCROLL_MASS_GENOCIDE:
1789 (void)mass_genocide(300, TRUE);
1794 case SV_SCROLL_ACQUIREMENT:
1796 acquirement(py, px, 1, TRUE, FALSE, FALSE);
1801 case SV_SCROLL_STAR_ACQUIREMENT:
1803 acquirement(py, px, randint1(2) + 1, TRUE, FALSE, FALSE);
1808 /* New Hengband scrolls */
1809 case SV_SCROLL_FIRE:
1811 fire_ball(GF_FIRE, 0, 666, 4);
1812 /* Note: "Double" damage since it is centered on the player ... */
1813 if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
1814 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1);
1823 fire_ball(GF_ICE, 0, 777, 4);
1824 if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
1825 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
1831 case SV_SCROLL_CHAOS:
1833 fire_ball(GF_CHAOS, 0, 1000, 4);
1834 if (!p_ptr->resist_chaos)
1835 take_hit(DAMAGE_NOESCAPE, 111+randint1(111), _("ログルスの巻物", "a Scroll of Logrus"), -1);
1841 case SV_SCROLL_RUMOR:
1843 msg_print(_("巻物にはメッセージが書かれている:", "There is message on the scroll. It says:"));
1845 display_rumor(TRUE);
1847 msg_print(_("巻物は煙を立てて消え去った!", "The scroll disappears in a puff of smoke!"));
1853 case SV_SCROLL_ARTIFACT:
1856 if (!artifact_scroll()) used_up = FALSE;
1860 case SV_SCROLL_RESET_RECALL:
1863 if (!reset_recall()) used_up = FALSE;
1867 case SV_SCROLL_AMUSEMENT:
1870 amusement(py, px, 1, FALSE);
1874 case SV_SCROLL_STAR_AMUSEMENT:
1877 amusement(py, px, randint1(2) + 1, FALSE);
1882 else if (o_ptr->name1 == ART_GHB)
1884 msg_print(_("私は苦労して『グレーター・ヘル=ビースト』を倒した。", "I had a very hard time to kill the Greater hell-beast, "));
1885 msg_print(_("しかし手に入ったのはこのきたないTシャツだけだった。", "but all I got was this lousy t-shirt!"));
1888 else if (o_ptr->name1 == ART_POWER)
1890 msg_print(_("「一つの指輪は全てを統べ、", "'One Ring to rule them all, "));
1892 msg_print(_("一つの指輪は全てを見つけ、", "One Ring to find them, "));
1894 msg_print(_("一つの指輪は全てを捕らえて", "One Ring to bring them all "));
1896 msg_print(_("暗闇の中に繋ぎとめる。」", "and in the darkness bind them.'"));
1899 else if (o_ptr->tval==TV_PARCHMENT)
1902 char o_name[MAX_NLEN];
1908 q=format("book-%d_jp.txt",o_ptr->sval);
1910 /* Display object description */
1911 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1913 /* Build the filename */
1914 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q);
1916 /* Peruse the help file */
1917 (void)show_file(TRUE, buf, o_name, 0, 0);
1926 /* Combine / Reorder the pack (later) */
1927 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1929 if (!(object_is_aware(o_ptr)))
1931 chg_virtue(V_PATIENCE, -1);
1932 chg_virtue(V_CHANCE, 1);
1933 chg_virtue(V_KNOWLEDGE, -1);
1936 /* The item was tried */
1937 object_tried(o_ptr);
1939 /* An identification was made */
1940 if (ident && !object_is_aware(o_ptr))
1942 object_aware(o_ptr);
1943 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1947 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1950 /* Hack -- allow certain scrolls to be "preserved" */
1956 sound(SOUND_SCROLL);
1958 /* Destroy a scroll in the pack */
1961 inven_item_increase(item, -1);
1962 inven_item_describe(item);
1963 inven_item_optimize(item);
1966 /* Destroy a scroll on the floor */
1969 floor_item_increase(0 - item, -1);
1970 floor_item_describe(0 - item);
1971 floor_item_optimize(0 - item);
1976 * @brief オブジェクトをプレイヤーが読むことができるかを判定する /
1977 * Hook to determine if an object is readable
1978 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1979 * @return 読むことが可能ならばTRUEを返す
1981 static bool item_tester_hook_readable(object_type *o_ptr)
1983 if ((o_ptr->tval==TV_SCROLL) || (o_ptr->tval==TV_PARCHMENT) || (o_ptr->name1 == ART_GHB) || (o_ptr->name1 == ART_POWER)) return (TRUE);
1990 * @brief 読むコマンドのメインルーチン /
1991 * Eat some food (from the pack or floor)
1994 void do_cmd_read_scroll(void)
2000 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2002 set_action(ACTION_NONE);
2005 /* Check some conditions */
2008 msg_print(_("目が見えない。", "You can't see anything."));
2013 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
2016 if (p_ptr->confused)
2018 msg_print(_("混乱していて読めない。", "You are too confused!"));
2023 /* Restrict choices to scrolls */
2024 item_tester_hook = item_tester_hook_readable;
2027 q = _("どの巻物を読みますか? ", "Read which scroll? ");
2028 s = _("読める巻物がない。", "You have no scrolls to read.");
2030 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2032 /* Get the item (in the pack) */
2035 o_ptr = &inventory[item];
2038 /* Get the item (on the floor) */
2041 o_ptr = &o_list[0 - item];
2044 /* Read the scroll */
2045 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
2050 * @param sval オブジェクトのsval
2051 * @param use_charge 使用回数を消費したかどうかを返す参照ポインタ
2052 * @param powerful 強力発動上の処理ならばTRUE
2053 * @param magic 魔道具術上の処理ならばTRUE
2054 * @param known 判明済ならばTRUE
2055 * @return 発動により効果内容が確定したならばTRUEを返す
2057 static int staff_effect(int sval, bool *use_charge, bool powerful, bool magic, bool known)
2061 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2062 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
2064 /* Analyze the staff */
2067 case SV_STAFF_DARKNESS:
2069 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
2071 if (set_blind(p_ptr->blind + 3 + randint1(5))) ident = TRUE;
2073 if (unlite_area(10, (powerful ? 6 : 3))) ident = TRUE;
2077 case SV_STAFF_SLOWNESS:
2079 if (set_slow(p_ptr->slow + randint1(30) + 15, FALSE)) ident = TRUE;
2083 case SV_STAFF_HASTE_MONSTERS:
2085 if (speed_monsters()) ident = TRUE;
2089 case SV_STAFF_SUMMONING:
2091 const int times = randint1(powerful ? 8 : 4);
2092 for (k = 0; k < times; k++)
2094 if (summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2102 case SV_STAFF_TELEPORTATION:
2104 teleport_player((powerful ? 150 : 100), 0L);
2109 case SV_STAFF_IDENTIFY:
2112 if (!identify_fully(FALSE)) *use_charge = FALSE;
2114 if (!ident_spell(FALSE)) *use_charge = FALSE;
2120 case SV_STAFF_REMOVE_CURSE:
2122 bool result = powerful ? remove_all_curse() : remove_curse();
2127 msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
2129 else if (!p_ptr->blind)
2131 msg_print(_("杖は一瞬ブルーに輝いた...", "The staff glows blue for a moment..."));
2139 case SV_STAFF_STARLITE:
2141 int num = damroll(5, 3);
2145 if (!p_ptr->blind && !magic)
2147 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2149 for (k = 0; k < num; k++)
2155 scatter(&y, &x, py, px, 4, 0);
2157 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2159 if (!player_bold(y, x)) break;
2162 project(0, 0, y, x, damroll(6 + lev / 8, 10), GF_LITE_WEAK,
2163 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
2171 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
2175 case SV_STAFF_MAPPING:
2177 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
2182 case SV_STAFF_DETECT_GOLD:
2184 if (detect_treasure(detect_rad)) ident = TRUE;
2185 if (detect_objects_gold(detect_rad)) ident = TRUE;
2189 case SV_STAFF_DETECT_ITEM:
2191 if (detect_objects_normal(detect_rad)) ident = TRUE;
2195 case SV_STAFF_DETECT_TRAP:
2197 if (detect_traps(detect_rad, known)) ident = TRUE;
2201 case SV_STAFF_DETECT_DOOR:
2203 if (detect_doors(detect_rad)) ident = TRUE;
2204 if (detect_stairs(detect_rad)) ident = TRUE;
2208 case SV_STAFF_DETECT_INVIS:
2210 if (detect_monsters_invis(detect_rad)) ident = TRUE;
2214 case SV_STAFF_DETECT_EVIL:
2216 if (detect_monsters_evil(detect_rad)) ident = TRUE;
2220 case SV_STAFF_CURE_LIGHT:
2222 if (hp_player(damroll((powerful ? 4 : 2), 8))) ident = TRUE;
2224 if (set_blind(0)) ident = TRUE;
2225 if (set_poisoned(0)) ident = TRUE;
2226 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
2228 if (set_shero(0,TRUE)) ident = TRUE;
2232 case SV_STAFF_CURING:
2234 if (set_blind(0)) ident = TRUE;
2235 if (set_poisoned(0)) ident = TRUE;
2236 if (set_confused(0)) ident = TRUE;
2237 if (set_stun(0)) ident = TRUE;
2238 if (set_cut(0)) ident = TRUE;
2239 if (set_image(0)) ident = TRUE;
2240 if (set_shero(0,TRUE)) ident = TRUE;
2244 case SV_STAFF_HEALING:
2246 if (hp_player(powerful ? 500 : 300)) ident = TRUE;
2247 if (set_stun(0)) ident = TRUE;
2248 if (set_cut(0)) ident = TRUE;
2249 if (set_shero(0,TRUE)) ident = TRUE;
2253 case SV_STAFF_THE_MAGI:
2255 if (do_res_stat(A_INT)) ident = TRUE;
2256 if (p_ptr->csp < p_ptr->msp)
2258 p_ptr->csp = p_ptr->msp;
2259 p_ptr->csp_frac = 0;
2261 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
2263 p_ptr->redraw |= (PR_MANA);
2264 p_ptr->window |= (PW_PLAYER);
2265 p_ptr->window |= (PW_SPELL);
2267 if (set_shero(0,TRUE)) ident = TRUE;
2271 case SV_STAFF_SLEEP_MONSTERS:
2273 if (sleep_monsters(lev)) ident = TRUE;
2277 case SV_STAFF_SLOW_MONSTERS:
2279 if (slow_monsters(lev)) ident = TRUE;
2283 case SV_STAFF_SPEED:
2285 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
2289 case SV_STAFF_PROBING:
2296 case SV_STAFF_DISPEL_EVIL:
2298 if (dispel_evil(powerful ? 120 : 80)) ident = TRUE;
2302 case SV_STAFF_POWER:
2304 if (dispel_monsters(powerful ? 225 : 150)) ident = TRUE;
2308 case SV_STAFF_HOLINESS:
2310 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
2312 if (set_protevil((magic ? 0 : p_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
2313 if (set_poisoned(0)) ident = TRUE;
2314 if (set_afraid(0)) ident = TRUE;
2315 if (hp_player(50)) ident = TRUE;
2316 if (set_stun(0)) ident = TRUE;
2317 if (set_cut(0)) ident = TRUE;
2321 case SV_STAFF_GENOCIDE:
2323 (void)symbol_genocide((magic ? lev + 50 : 200), TRUE);
2328 case SV_STAFF_EARTHQUAKES:
2330 if (earthquake(py, px, (powerful ? 15 : 10)))
2333 msg_print(_("ダンジョンが揺れた。", "The dungeon trembles."));
2338 case SV_STAFF_DESTRUCTION:
2340 if (destroy_area(py, px, (powerful ? 18 : 13) + randint0(5), FALSE))
2346 case SV_STAFF_ANIMATE_DEAD:
2348 if (animate_dead(0, py, px))
2354 case SV_STAFF_MSTORM:
2356 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
2357 project(0, (powerful ? 7 : 5), py, px,
2358 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
2359 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))
2361 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
2368 case SV_STAFF_NOTHING:
2370 msg_print(_("何も起らなかった。", "Nothing happen."));
2371 if (prace_is_(RACE_SKELETON) || prace_is_(RACE_GOLEM) ||
2372 prace_is_(RACE_ZOMBIE) || prace_is_(RACE_SPECTRE))
2373 msg_print(_("もったいない事をしたような気がする。食べ物は大切にしなくては。", "What a waste. It's your food!"));
2381 * @brief 杖を使うコマンドのサブルーチン /
2382 * Use a staff. -RAK-
2383 * @param item 使うオブジェクトの所持品ID
2386 * One charge of one staff disappears.
2387 * Hack -- staffs of identify can be "cancelled".
2389 static void do_cmd_use_staff_aux(int item)
2391 int ident, chance, lev;
2395 /* Hack -- let staffs of identify get aborted */
2396 bool use_charge = TRUE;
2399 /* Get the item (in the pack) */
2402 o_ptr = &inventory[item];
2405 /* Get the item (on the floor) */
2408 o_ptr = &o_list[0 - item];
2412 /* Mega-Hack -- refuse to use a pile from the ground */
2413 if ((item < 0) && (o_ptr->number > 1))
2415 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
2423 /* Extract the item level */
2424 lev = k_info[o_ptr->k_idx].level;
2425 if (lev > 50) lev = 50 + (lev - 50)/2;
2427 /* Base chance of success */
2428 chance = p_ptr->skill_dev;
2430 /* Confusion hurts skill */
2431 if (p_ptr->confused) chance = chance / 2;
2433 /* Hight level objects are harder */
2434 chance = chance - lev;
2436 /* Give everyone a (slight) chance */
2437 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
2439 chance = USE_DEVICE;
2444 if (flush_failure) flush();
2445 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this staff is freezing too."));
2450 /* Roll for usage */
2451 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
2453 if (flush_failure) flush();
2454 msg_print(_("杖をうまく使えなかった。", "You failed to use the staff properly."));
2459 /* Notice empty staffs */
2460 if (o_ptr->pval <= 0)
2462 if (flush_failure) flush();
2463 msg_print(_("この杖にはもう魔力が残っていない。", "The staff has no charges left."));
2464 o_ptr->ident |= (IDENT_EMPTY);
2466 /* Combine / Reorder the pack (later) */
2467 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2468 p_ptr->window |= (PW_INVEN);
2477 ident = staff_effect(o_ptr->sval, &use_charge, FALSE, FALSE, object_is_aware(o_ptr));
2479 if (!(object_is_aware(o_ptr)))
2481 chg_virtue(V_PATIENCE, -1);
2482 chg_virtue(V_CHANCE, 1);
2483 chg_virtue(V_KNOWLEDGE, -1);
2486 /* Combine / Reorder the pack (later) */
2487 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2489 /* Tried the item */
2490 object_tried(o_ptr);
2492 /* An identification was made */
2493 if (ident && !object_is_aware(o_ptr))
2495 object_aware(o_ptr);
2496 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2500 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2503 /* Hack -- some uses are "free" */
2504 if (!use_charge) return;
2507 /* Use a single charge */
2510 /* XXX Hack -- unstack if necessary */
2511 if ((item >= 0) && (o_ptr->number > 1))
2516 /* Get local object */
2519 /* Obtain a local object */
2520 object_copy(q_ptr, o_ptr);
2522 /* Modify quantity */
2525 /* Restore the charges */
2528 /* Unstack the used item */
2530 p_ptr->total_weight -= q_ptr->weight;
2531 item = inven_carry(q_ptr);
2534 msg_print(_("杖をまとめなおした。", "You unstack your staff."));
2537 /* Describe charges in the pack */
2540 inven_item_charges(item);
2543 /* Describe charges on the floor */
2546 floor_item_charges(0 - item);
2551 * @brief 杖を使うコマンドのメインルーチン /
2554 void do_cmd_use_staff(void)
2559 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2561 set_action(ACTION_NONE);
2564 /* Restrict choices to wands */
2565 item_tester_tval = TV_STAFF;
2568 q = _("どの杖を使いますか? ", "Use which staff? ");
2569 s = _("使える杖がない。", "You have no staff to use.");
2571 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2573 do_cmd_use_staff_aux(item);
2577 * @brief 魔法棒の効果を発動する
2578 * @param sval オブジェクトのsval
2579 * @param dir 発動の方向ID
2580 * @param powerful 強力発動上の処理ならばTRUE
2581 * @param magic 魔道具術上の処理ならばTRUE
2582 * @return 発動により効果内容が確定したならばTRUEを返す
2584 static int wand_effect(int sval, int dir, bool powerful, bool magic)
2587 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
2588 int rad = powerful ? 3 : 2;
2590 /* XXX Hack -- Wand of wonder can do anything before it */
2591 if (sval == SV_WAND_WONDER)
2593 int vir = virtue_number(V_CHANCE);
2594 sval = randint0(SV_WAND_WONDER);
2598 if (p_ptr->virtues[vir - 1] > 0)
2600 while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
2601 if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
2605 while (randint1(300) < (0-p_ptr->virtues[vir - 1])) sval--;
2606 if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
2609 if (sval < SV_WAND_TELEPORT_AWAY)
2610 chg_virtue(V_CHANCE, 1);
2613 /* Analyze the wand */
2616 case SV_WAND_HEAL_MONSTER:
2618 int dam = damroll((powerful ? 20 : 10), 10);
2619 if (heal_monster(dir, dam)) ident = TRUE;
2623 case SV_WAND_HASTE_MONSTER:
2625 if (speed_monster(dir, lev)) ident = TRUE;
2629 case SV_WAND_CLONE_MONSTER:
2631 if (clone_monster(dir)) ident = TRUE;
2635 case SV_WAND_TELEPORT_AWAY:
2637 int distance = MAX_SIGHT * (powerful ? 8 : 5);
2638 if (teleport_monster(dir, distance)) ident = TRUE;
2642 case SV_WAND_DISARMING:
2644 if (disarm_trap(dir)) ident = TRUE;
2645 if (powerful && disarm_traps_touch()) ident = TRUE;
2649 case SV_WAND_TRAP_DOOR_DEST:
2651 if (destroy_door(dir)) ident = TRUE;
2652 if (powerful && destroy_doors_touch()) ident = TRUE;
2656 case SV_WAND_STONE_TO_MUD:
2658 int dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
2659 if (wall_to_mud(dir, dam)) ident = TRUE;
2665 int dam = damroll((powerful ? 12 : 6), 8);
2666 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
2667 (void)lite_line(dir, dam);
2672 case SV_WAND_SLEEP_MONSTER:
2674 if (sleep_monster(dir, lev)) ident = TRUE;
2678 case SV_WAND_SLOW_MONSTER:
2680 if (slow_monster(dir, lev)) ident = TRUE;
2684 case SV_WAND_CONFUSE_MONSTER:
2686 if (confuse_monster(dir, lev)) ident = TRUE;
2690 case SV_WAND_FEAR_MONSTER:
2692 if (fear_monster(dir, lev)) ident = TRUE;
2696 case SV_WAND_DRAIN_LIFE:
2698 if (drain_life(dir, 80 + lev)) ident = TRUE;
2702 case SV_WAND_POLYMORPH:
2704 if (poly_monster(dir, lev)) ident = TRUE;
2708 case SV_WAND_STINKING_CLOUD:
2710 fire_ball(GF_POIS, dir, 12 + lev / 4, rad);
2715 case SV_WAND_MAGIC_MISSILE:
2717 fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + lev / 10, 6));
2722 case SV_WAND_ACID_BOLT:
2724 fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + lev / 7, 8));
2729 case SV_WAND_CHARM_MONSTER:
2731 if (charm_monster(dir, MAX(20, lev)))
2736 case SV_WAND_FIRE_BOLT:
2738 fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + lev / 6, 8));
2743 case SV_WAND_COLD_BOLT:
2745 fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + lev / 8, 8));
2750 case SV_WAND_ACID_BALL:
2752 fire_ball(GF_ACID, dir, 60 + 3 * lev / 4, rad);
2757 case SV_WAND_ELEC_BALL:
2759 fire_ball(GF_ELEC, dir, 40 + 3 * lev / 4, rad);
2764 case SV_WAND_FIRE_BALL:
2766 fire_ball(GF_FIRE, dir, 70 + 3 * lev / 4, rad);
2771 case SV_WAND_COLD_BALL:
2773 fire_ball(GF_COLD, dir, 50 + 3 * lev / 4, rad);
2778 case SV_WAND_WONDER:
2780 msg_print(_("おっと、謎の魔法棒を始動させた。", "Oops. Wand of wonder activated."));
2784 case SV_WAND_DRAGON_FIRE:
2786 fire_ball(GF_FIRE, dir, (powerful ? 300 : 200), -3);
2791 case SV_WAND_DRAGON_COLD:
2793 fire_ball(GF_COLD, dir, (powerful ? 270 : 180), -3);
2798 case SV_WAND_DRAGON_BREATH:
2803 switch (randint1(5))
2827 if (powerful) dam = (dam * 3) / 2;
2829 fire_ball(typ, dir, dam, -3);
2835 case SV_WAND_DISINTEGRATE:
2837 fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(lev * 2), rad);
2842 case SV_WAND_ROCKETS:
2844 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
2845 fire_rocket(GF_ROCKET, dir, 250 + lev * 3, rad);
2850 case SV_WAND_STRIKING:
2852 fire_bolt(GF_METEOR, dir, damroll(15 + lev / 3, 13));
2857 case SV_WAND_GENOCIDE:
2859 fire_ball_hide(GF_GENOCIDE, dir, magic ? lev + 50 : 250, 0);
2868 * @brief 魔法棒を使うコマンドのサブルーチン /
2869 * Aim a wand (from the pack or floor).
2870 * @param item 使うオブジェクトの所持品ID
2874 * Use a single charge from a single item.
2875 * Handle "unstacking" in a logical manner.
2876 * For simplicity, you cannot use a stack of items from the
2877 * ground. This would require too much nasty code.
2878 * There are no wands which can "destroy" themselves, in the inventory
2879 * or on the ground, so we can ignore this possibility. Note that this
2880 * required giving "wand of wonder" the ability to ignore destruction
2881 * by electric balls.
2882 * All wands can be "cancelled" at the "Direction?" prompt for free.
2883 * Note that the basic "bolt" wands do slightly less damage than the
2884 * basic "bolt" rods, but the basic "ball" wands do the same damage
2885 * as the basic "ball" rods.
2888 static void do_cmd_aim_wand_aux(int item)
2890 int lev, ident, chance, dir;
2892 bool old_target_pet = target_pet;
2894 /* Get the item (in the pack) */
2897 o_ptr = &inventory[item];
2900 /* Get the item (on the floor) */
2903 o_ptr = &o_list[0 - item];
2906 /* Mega-Hack -- refuse to aim a pile from the ground */
2907 if ((item < 0) && (o_ptr->number > 1))
2909 msg_print(_("まずは魔法棒を拾わなければ。", "You must first pick up the wands."));
2914 /* Allow direction to be cancelled for free */
2915 if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
2916 || o_ptr->sval == SV_WAND_HASTE_MONSTER))
2918 if (!get_aim_dir(&dir))
2920 target_pet = old_target_pet;
2923 target_pet = old_target_pet;
2929 lev = k_info[o_ptr->k_idx].level;
2930 if (lev > 50) lev = 50 + (lev - 50)/2;
2932 /* Base chance of success */
2933 chance = p_ptr->skill_dev;
2935 /* Confusion hurts skill */
2936 if (p_ptr->confused) chance = chance / 2;
2938 /* Hight level objects are harder */
2939 chance = chance - lev;
2941 /* Give everyone a (slight) chance */
2942 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
2944 chance = USE_DEVICE;
2949 if (flush_failure) flush();
2950 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this wand is freezing too."));
2955 /* Roll for usage */
2956 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
2958 if (flush_failure) flush();
2959 msg_print(_("魔法棒をうまく使えなかった。", "You failed to use the wand properly."));
2964 /* The wand is already empty! */
2965 if (o_ptr->pval <= 0)
2967 if (flush_failure) flush();
2968 msg_print(_("この魔法棒にはもう魔力が残っていない。", "The wand has no charges left."));
2969 o_ptr->ident |= (IDENT_EMPTY);
2971 /* Combine / Reorder the pack (later) */
2972 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2973 p_ptr->window |= (PW_INVEN);
2981 ident = wand_effect(o_ptr->sval, dir, FALSE, FALSE);
2983 /* Combine / Reorder the pack (later) */
2984 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2986 if (!(object_is_aware(o_ptr)))
2988 chg_virtue(V_PATIENCE, -1);
2989 chg_virtue(V_CHANCE, 1);
2990 chg_virtue(V_KNOWLEDGE, -1);
2993 /* Mark it as tried */
2994 object_tried(o_ptr);
2996 /* Apply identification */
2997 if (ident && !object_is_aware(o_ptr))
2999 object_aware(o_ptr);
3000 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
3004 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3007 /* Use a single charge */
3010 /* Describe the charges in the pack */
3013 inven_item_charges(item);
3016 /* Describe the charges on the floor */
3019 floor_item_charges(0 - item);
3024 * @brief 魔法棒を使うコマンドのメインルーチン /
3027 void do_cmd_aim_wand(void)
3032 /* Restrict choices to wands */
3033 item_tester_tval = TV_WAND;
3035 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3037 set_action(ACTION_NONE);
3041 q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
3042 s = _("使える魔法棒がない。", "You have no wand to aim.");
3044 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3047 do_cmd_aim_wand_aux(item);
3051 * @brief ロッドの効果を発動する
3052 * @param sval オブジェクトのsval
3053 * @param dir 発動目標の方向ID
3054 * @param use_charge チャージを消費したかどうかを返す参照ポインタ
3055 * @param powerful 強力発動上の処理ならばTRUE
3056 * @param magic 魔道具術上の処理ならばTRUE
3057 * @return 発動により効果内容が確定したならばTRUEを返す
3059 static int rod_effect(int sval, int dir, bool *use_charge, bool powerful, bool magic)
3062 int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
3063 int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
3064 int rad = powerful ? 3 : 2;
3069 /* Analyze the rod */
3072 case SV_ROD_DETECT_TRAP:
3074 if (detect_traps(detect_rad, (bool)(dir ? FALSE : TRUE))) ident = TRUE;
3078 case SV_ROD_DETECT_DOOR:
3080 if (detect_doors(detect_rad)) ident = TRUE;
3081 if (detect_stairs(detect_rad)) ident = TRUE;
3085 case SV_ROD_IDENTIFY:
3088 if (!identify_fully(FALSE)) *use_charge = FALSE;
3090 if (!ident_spell(FALSE)) *use_charge = FALSE;
3098 if (!word_of_recall()) *use_charge = FALSE;
3103 case SV_ROD_ILLUMINATION:
3105 if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
3109 case SV_ROD_MAPPING:
3111 map_area(powerful ? DETECT_RAD_MAP * 3 / 2 : DETECT_RAD_MAP);
3116 case SV_ROD_DETECTION:
3118 detect_all(detect_rad);
3123 case SV_ROD_PROBING:
3132 if (set_blind(0)) ident = TRUE;
3133 if (set_poisoned(0)) ident = TRUE;
3134 if (set_confused(0)) ident = TRUE;
3135 if (set_stun(0)) ident = TRUE;
3136 if (set_cut(0)) ident = TRUE;
3137 if (set_image(0)) ident = TRUE;
3138 if (set_shero(0,TRUE)) ident = TRUE;
3142 case SV_ROD_HEALING:
3144 if (hp_player(powerful ? 750 : 500)) ident = TRUE;
3145 if (set_stun(0)) ident = TRUE;
3146 if (set_cut(0)) ident = TRUE;
3147 if (set_shero(0,TRUE)) ident = TRUE;
3151 case SV_ROD_RESTORATION:
3153 if (restore_level()) ident = TRUE;
3154 if (do_res_stat(A_STR)) ident = TRUE;
3155 if (do_res_stat(A_INT)) ident = TRUE;
3156 if (do_res_stat(A_WIS)) ident = TRUE;
3157 if (do_res_stat(A_DEX)) ident = TRUE;
3158 if (do_res_stat(A_CON)) ident = TRUE;
3159 if (do_res_stat(A_CHR)) ident = TRUE;
3165 if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
3169 case SV_ROD_PESTICIDE:
3171 if (dispel_monsters(powerful ? 8 : 4)) ident = TRUE;
3175 case SV_ROD_TELEPORT_AWAY:
3177 int distance = MAX_SIGHT * (powerful ? 8 : 5);
3178 if (teleport_monster(dir, distance)) ident = TRUE;
3182 case SV_ROD_DISARMING:
3184 if (disarm_trap(dir)) ident = TRUE;
3185 if (powerful && disarm_traps_touch()) ident = TRUE;
3191 int dam = damroll((powerful ? 12 : 6), 8);
3192 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
3193 (void)lite_line(dir, dam);
3198 case SV_ROD_SLEEP_MONSTER:
3200 if (sleep_monster(dir, lev)) ident = TRUE;
3204 case SV_ROD_SLOW_MONSTER:
3206 if (slow_monster(dir, lev)) ident = TRUE;
3210 case SV_ROD_DRAIN_LIFE:
3212 if (drain_life(dir, 70 + 3 * lev / 2)) ident = TRUE;
3216 case SV_ROD_POLYMORPH:
3218 if (poly_monster(dir, lev)) ident = TRUE;
3222 case SV_ROD_ACID_BOLT:
3224 fire_bolt_or_beam(10, GF_ACID, dir, damroll(6 + lev / 7, 8));
3229 case SV_ROD_ELEC_BOLT:
3231 fire_bolt_or_beam(10, GF_ELEC, dir, damroll(4 + lev / 9, 8));
3236 case SV_ROD_FIRE_BOLT:
3238 fire_bolt_or_beam(10, GF_FIRE, dir, damroll(7 + lev / 6, 8));
3243 case SV_ROD_COLD_BOLT:
3245 fire_bolt_or_beam(10, GF_COLD, dir, damroll(5 + lev / 8, 8));
3250 case SV_ROD_ACID_BALL:
3252 fire_ball(GF_ACID, dir, 60 + lev, rad);
3257 case SV_ROD_ELEC_BALL:
3259 fire_ball(GF_ELEC, dir, 40 + lev, rad);
3264 case SV_ROD_FIRE_BALL:
3266 fire_ball(GF_FIRE, dir, 70 + lev, rad);
3271 case SV_ROD_COLD_BALL:
3273 fire_ball(GF_COLD, dir, 50 + lev, rad);
3285 case SV_ROD_STONE_TO_MUD:
3287 int dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
3288 if (wall_to_mud(dir, dam)) ident = TRUE;
3292 case SV_ROD_AGGRAVATE:
3294 aggravate_monsters(0);
3303 * @brief 魔法棒を使うコマンドのサブルーチン /
3304 * Activate (zap) a Rod
3305 * @param item 使うオブジェクトの所持品ID
3309 * Unstack fully charged rods as needed.
3310 * Hack -- rods of perception/genocide can be "cancelled"
3311 * All rods can be cancelled at the "Direction?" prompt
3312 * pvals are defined for each rod in k_info. -LM-
3315 static void do_cmd_zap_rod_aux(int item)
3317 int ident, chance, lev, fail;
3322 /* Hack -- let perception get aborted */
3323 bool use_charge = TRUE;
3327 /* Get the item (in the pack) */
3330 o_ptr = &inventory[item];
3333 /* Get the item (on the floor) */
3336 o_ptr = &o_list[0 - item];
3340 /* Mega-Hack -- refuse to zap a pile from the ground */
3341 if ((item < 0) && (o_ptr->number > 1))
3343 msg_print(_("まずはロッドを拾わなければ。", "You must first pick up the rods."));
3348 /* Get a direction (unless KNOWN not to need it) */
3349 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)) ||
3350 !object_is_aware(o_ptr))
3352 /* Get a direction, allow cancel */
3353 if (!get_aim_dir(&dir)) return;
3360 /* Extract the item level */
3361 lev = k_info[o_ptr->k_idx].level;
3363 /* Base chance of success */
3364 chance = p_ptr->skill_dev;
3366 /* Confusion hurts skill */
3367 if (p_ptr->confused) chance = chance / 2;
3370 if (chance > fail) fail -= (chance - fail)*2;
3371 else chance -= (fail - chance)*2;
3372 if (fail < USE_DEVICE) fail = USE_DEVICE;
3373 if (chance < USE_DEVICE) chance = USE_DEVICE;
3377 if (flush_failure) flush();
3378 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this rod is freezing too."));
3383 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3384 else if (chance > fail)
3386 if (randint0(chance*2) < fail) success = FALSE;
3387 else success = TRUE;
3391 if (randint0(fail*2) < chance) success = TRUE;
3392 else success = FALSE;
3395 /* Roll for usage */
3398 if (flush_failure) flush();
3399 msg_print(_("うまくロッドを使えなかった。", "You failed to use the rod properly."));
3404 k_ptr = &k_info[o_ptr->k_idx];
3406 /* A single rod is still charging */
3407 if ((o_ptr->number == 1) && (o_ptr->timeout))
3409 if (flush_failure) flush();
3410 msg_print(_("このロッドはまだ魔力を充填している最中だ。", "The rod is still charging."));
3413 /* A stack of rods lacks enough energy. */
3414 else if ((o_ptr->number > 1) && (o_ptr->timeout > k_ptr->pval * (o_ptr->number - 1)))
3416 if (flush_failure) flush();
3417 msg_print(_("そのロッドはまだ充填中です。", "The rods are all still charging."));
3424 ident = rod_effect(o_ptr->sval, dir, &use_charge, FALSE, FALSE);
3426 /* Increase the timeout by the rod kind's pval. -LM- */
3427 if (use_charge) o_ptr->timeout += k_ptr->pval;
3429 /* Combine / Reorder the pack (later) */
3430 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3432 if (!(object_is_aware(o_ptr)))
3434 chg_virtue(V_PATIENCE, -1);
3435 chg_virtue(V_CHANCE, 1);
3436 chg_virtue(V_KNOWLEDGE, -1);
3439 /* Tried the object */
3440 object_tried(o_ptr);
3442 /* Successfully determined the object function */
3443 if (ident && !object_is_aware(o_ptr))
3445 object_aware(o_ptr);
3446 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
3450 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3454 * @brief ロッドを使うコマンドのメインルーチン /
3457 void do_cmd_zap_rod(void)
3462 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3464 set_action(ACTION_NONE);
3467 /* Restrict choices to rods */
3468 item_tester_tval = TV_ROD;
3471 q = _("どのロッドを振りますか? ", "Zap which rod? ");
3472 s = _("使えるロッドがない。", "You have no rod to zap.");
3474 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3477 do_cmd_zap_rod_aux(item);
3481 * @brief オブジェクトをプレイヤーが魔道具として発動できるかを判定する /
3482 * Hook to determine if an object is activatable
3483 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
3484 * @return 魔道具として発動可能ならばTRUEを返す
3486 static bool item_tester_hook_activate(object_type *o_ptr)
3488 u32b flgs[TR_FLAG_SIZE];
3491 if (!object_is_known(o_ptr)) return (FALSE);
3493 /* Extract the flags */
3494 object_flags(o_ptr, flgs);
3496 /* Check activation flag */
3497 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
3504 * @brief 『一つの指輪』の効果処理 /
3505 * Hack -- activate the ring of power
3506 * @param dir 発動の方向ID
3509 void ring_of_power(int dir)
3511 /* Pick a random effect */
3512 switch (randint1(10))
3518 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3521 /* Decrease all stats (permanently) */
3522 (void)dec_stat(A_STR, 50, TRUE);
3523 (void)dec_stat(A_INT, 50, TRUE);
3524 (void)dec_stat(A_WIS, 50, TRUE);
3525 (void)dec_stat(A_DEX, 50, TRUE);
3526 (void)dec_stat(A_CON, 50, TRUE);
3527 (void)dec_stat(A_CHR, 50, TRUE);
3529 /* Lose some experience (permanently) */
3530 p_ptr->exp -= (p_ptr->exp / 4);
3531 p_ptr->max_exp -= (p_ptr->exp / 4);
3540 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3542 /* Dispel monsters */
3543 dispel_monsters(1000);
3553 fire_ball(GF_MANA, dir, 600, 3);
3564 fire_bolt(GF_MANA, dir, 500);
3572 * @brief ペット入りモンスターボールをソートするための比較関数
3573 * @param u 所持品配列の参照ポインタ
3577 * @return 1の方が大であればTRUE
3579 static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
3581 u16b *who = (u16b*)(u);
3586 monster_type *m_ptr1 = &m_list[w1];
3587 monster_type *m_ptr2 = &m_list[w2];
3588 monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
3589 monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
3594 if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
3595 if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
3597 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
3598 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
3600 if (r_ptr1->level > r_ptr2->level) return TRUE;
3601 if (r_ptr2->level > r_ptr1->level) return FALSE;
3603 if (m_ptr1->hp > m_ptr2->hp) return TRUE;
3604 if (m_ptr2->hp > m_ptr1->hp) return FALSE;
3611 * @brief 装備を発動するコマンドのサブルーチン /
3612 * Activate a wielded object. Wielded objects never stack.
3613 * And even if they did, activatable objects never stack.
3614 * @param item 発動するオブジェクトの所持品ID
3618 * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
3619 * But one could, for example, easily make an activatable "Ring of Plasma".
3620 * Note that it always takes a turn to activate an artifact, even if
3621 * the user hits "escape" at the "direction" prompt.
3624 static void do_cmd_activate_aux(int item)
3626 int dir, lev, chance, fail;
3631 /* Get the item (in the pack) */
3634 o_ptr = &inventory[item];
3637 /* Get the item (on the floor) */
3640 o_ptr = &o_list[0 - item];
3646 /* Extract the item level */
3647 lev = k_info[o_ptr->k_idx].level;
3649 /* Hack -- use artifact level instead */
3650 if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
3651 else if (object_is_random_artifact(o_ptr))
3653 const activation_type* const act_ptr = find_activation_info(o_ptr);
3655 lev = act_ptr->level;
3658 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
3660 /* Base chance of success */
3661 chance = p_ptr->skill_dev;
3663 /* Confusion hurts skill */
3664 if (p_ptr->confused) chance = chance / 2;
3667 if (chance > fail) fail -= (chance - fail)*2;
3668 else chance -= (fail - chance)*2;
3669 if (fail < USE_DEVICE) fail = USE_DEVICE;
3670 if (chance < USE_DEVICE) chance = USE_DEVICE;
3674 if (flush_failure) flush();
3675 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
3680 if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3681 else if (chance > fail)
3683 if (randint0(chance*2) < fail) success = FALSE;
3684 else success = TRUE;
3688 if (randint0(fail*2) < chance) success = TRUE;
3689 else success = FALSE;
3692 /* Roll for usage */
3695 if (flush_failure) flush();
3696 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
3701 /* Check the recharge */
3704 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
3708 /* Some lights need enough fuel for activation */
3709 if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
3710 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
3712 msg_print(_("燃料がない。", "It has no fuel."));
3717 /* Activate the artifact */
3718 msg_print(_("始動させた...", "You activate it..."));
3723 /* Activate object */
3724 if (activation_index(o_ptr))
3726 (void)activate_random_artifact(o_ptr);
3729 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3736 else if (o_ptr->tval == TV_WHISTLE)
3738 if (music_singing_any()) stop_singing();
3739 if (hex_spelling_any()) stop_hex_spell_all();
3742 if (object_is_cursed(o_ptr))
3744 msg_print(_("カン高い音が響き渡った。", "You produce a shrill whistling sound."));
3745 aggravate_monsters(0);
3755 /* Allocate the "who" array */
3756 C_MAKE(who, max_m_idx, u16b);
3758 /* Process the monsters (backwards) */
3759 for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
3761 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
3762 who[max_pet++] = pet_ctr;
3765 /* Select the sort method */
3766 ang_sort_comp = ang_sort_comp_pet;
3767 ang_sort_swap = ang_sort_swap_hook;
3769 ang_sort(who, &dummy_why, max_pet);
3771 /* Process the monsters (backwards) */
3772 for (i = 0; i < max_pet; i++)
3775 teleport_monster_to(pet_ctr, py, px, 100, TELEPORT_PASSIVE);
3778 /* Free the "who" array */
3779 C_KILL(who, max_m_idx, u16b);
3781 o_ptr->timeout = 100+randint1(100);
3784 else if (o_ptr->tval == TV_CAPTURE)
3788 bool old_target_pet = target_pet;
3790 if (!get_aim_dir(&dir))
3792 target_pet = old_target_pet;
3795 target_pet = old_target_pet;
3797 if(fire_ball(GF_CAPTURE, dir, 0, 0))
3799 o_ptr->pval = cap_mon;
3800 o_ptr->xtra3 = cap_mspeed;
3801 o_ptr->xtra4 = cap_hp;
3802 o_ptr->xtra5 = cap_maxhp;
3809 if (o_ptr->inscription)
3810 strcpy(buf, quark_str(o_ptr->inscription));
3812 for (s = buf;*s && (*s != '#'); s++)
3815 if (iskanji(*s)) s++;
3825 t = quark_str(cap_nickname);
3838 o_ptr->inscription = quark_add(buf);
3844 bool success = FALSE;
3845 if (!get_rep_dir2(&dir)) return;
3846 if (monster_can_enter(py + ddy[dir], px + ddx[dir], &r_info[o_ptr->pval], 0))
3848 if (place_monster_aux(0, py + ddy[dir], px + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
3850 if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
3851 if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
3852 if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
3853 m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
3854 if (o_ptr->inscription)
3862 t = quark_str(o_ptr->inscription);
3863 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
3866 if (iskanji(*t)) t++;
3891 if (quote && *(s-1) =='\'')
3895 m_list[hack_m_idx_ii].nickname = quark_add(buf);
3896 t = quark_str(o_ptr->inscription);
3898 while(*t && (*t != '#'))
3905 o_ptr->inscription = quark_add(buf);
3916 msg_print(_("おっと、解放に失敗した。", "Oops. You failed to release your pet."));
3922 msg_print(_("おっと、このアイテムは始動できない。", "Oops. That object cannot be activated."));
3926 * @brief 装備を発動するコマンドのメインルーチン /
3929 void do_cmd_activate(void)
3935 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3937 set_action(ACTION_NONE);
3940 item_tester_no_ryoute = TRUE;
3941 /* Prepare the hook */
3942 item_tester_hook = item_tester_hook_activate;
3945 q = _("どのアイテムを始動させますか? ", "Activate which item? ");
3946 s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
3948 if (!get_item(&item, q, s, (USE_EQUIP))) return;
3950 /* Activate the item */
3951 do_cmd_activate_aux(item);
3956 * @brief オブジェクトをプレイヤーが簡易使用コマンドで利用できるかを判定する /
3957 * Hook to determine if an object is useable
3958 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
3959 * @return 利用可能ならばTRUEを返す
3961 static bool item_tester_hook_use(object_type *o_ptr)
3963 u32b flgs[TR_FLAG_SIZE];
3966 if (o_ptr->tval == p_ptr->tval_ammo)
3969 /* Useable object */
3970 switch (o_ptr->tval)
3988 if (!object_is_known(o_ptr)) return (FALSE);
3990 /* HACK - only items from the equipment can be activated */
3991 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3993 if (&inventory[i] == o_ptr)
3995 /* Extract the flags */
3996 object_flags(o_ptr, flgs);
3998 /* Check activation flag */
3999 if (have_flag(flgs, TR_ACTIVATE)) return (TRUE);
4011 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
4015 * XXX - Add actions for other item types
4017 void do_cmd_use(void)
4023 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
4025 set_action(ACTION_NONE);
4028 item_tester_no_ryoute = TRUE;
4029 /* Prepare the hook */
4030 item_tester_hook = item_tester_hook_use;
4033 q = _("どれを使いますか?", "Use which item? ");
4034 s = _("使えるものがありません。", "You have nothing to use.");
4036 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR))) return;
4038 /* Get the item (in the pack) */
4041 o_ptr = &inventory[item];
4043 /* Get the item (on the floor) */
4046 o_ptr = &o_list[0 - item];
4049 switch (o_ptr->tval)
4061 do_cmd_eat_food_aux(item);
4068 do_cmd_aim_wand_aux(item);
4075 do_cmd_use_staff_aux(item);
4082 do_cmd_zap_rod_aux(item);
4086 /* Quaff a potion */
4089 do_cmd_quaff_potion_aux(item);
4096 /* Check some conditions */
4099 msg_print(_("目が見えない。", "You can't see anything."));
4104 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
4107 if (p_ptr->confused)
4109 msg_print(_("混乱していて読めない!", "You are too confused!"));
4113 do_cmd_read_scroll_aux(item, TRUE);
4122 do_cmd_fire_aux(item, &inventory[INVEN_BOW]);
4126 /* Activate an artifact */
4129 do_cmd_activate_aux(item);
4136 * @brief 魔道具術師の取り込んだ魔力一覧から選択/閲覧する /
4137 * @param only_browse 閲覧するだけならばTRUE
4138 * @return 選択した魔力のID、キャンセルならば-1を返す
4140 static int select_magic_eater(bool only_browse)
4144 bool flag, request_list;
4146 int ask = TRUE, i = 0;
4149 int menu_line = (use_menu ? 1 : 0);
4153 if (repeat_pull(&sn))
4155 /* Verify the spell */
4156 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))
4158 else if (sn < EATER_EXT*2 && !(p_ptr->magic_num1[sn] < EATER_CHARGE))
4162 #endif /* ALLOW_REPEAT */
4164 for (i = 0; i < 108; i++)
4166 if (p_ptr->magic_num2[i]) break;
4170 msg_print(_("魔法を覚えていない!", "You don't have any magic!"));
4181 prt(format(" %s 杖", (menu_line == 1) ? "》" : " "), 2, 14);
4182 prt(format(" %s 魔法棒", (menu_line == 2) ? "》" : " "), 3, 14);
4183 prt(format(" %s ロッド", (menu_line == 3) ? "》" : " "), 4, 14);
4185 prt(format(" %s staff", (menu_line == 1) ? "> " : " "), 2, 14);
4186 prt(format(" %s wand", (menu_line == 2) ? "> " : " "), 3, 14);
4187 prt(format(" %s rod", (menu_line == 3) ? "> " : " "), 4, 14);
4190 if (only_browse) prt(_("どの種類の魔法を見ますか?", "Which type of magic do you browse?"), 0, 0);
4191 else prt(_("どの種類の魔法を使いますか?", "Which type of magic do you use?"), 0, 0);
4214 ext = (menu_line-1)*EATER_EXT;
4215 if (menu_line == 1) tval = TV_STAFF;
4216 else if (menu_line == 2) tval = TV_WAND;
4220 if (menu_line > 3) menu_line -= 3;
4228 if (!get_com(_("[A] 杖, [B] 魔法棒, [C] ロッド:", "[A] staff, [B] wand, [C] rod:"), &choice, TRUE))
4232 if (choice == 'A' || choice == 'a')
4238 if (choice == 'B' || choice == 'b')
4244 if (choice == 'C' || choice == 'c')
4252 for (i = ext; i < ext + EATER_EXT; i++)
4254 if (p_ptr->magic_num2[i])
4256 if (use_menu) menu_line = i-ext+1;
4260 if (i == ext+EATER_EXT)
4262 msg_print(_("その種類の魔法は覚えていない!", "You don't have that type of magic!"));
4266 /* Nothing chosen yet */
4269 /* Build a prompt */
4270 if (only_browse) strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの魔力を見ますか?",
4271 "(*=List, ESC=exit) Browse which power? "));
4272 else strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの魔力を使いますか?",
4273 "(*=List, ESC=exit) Use which power? "));
4275 /* Save the screen */
4278 request_list = always_show_list;
4280 /* Get a spell from the user */
4284 if (request_list || use_menu)
4295 for (y = 1; y < 20; y++)
4300 /* Print header(s) */
4302 prt(format(" %s 失率 %s 失率", (tval == TV_ROD ? " 状態 " : "使用回数"), (tval == TV_ROD ? " 状態 " : "使用回数")), y++, x);
4304 prt(format(" %s Fail %s Fail", (tval == TV_ROD ? " Stat " : " Charges"), (tval == TV_ROD ? " Stat " : " Charges")), y++, x);
4308 for (ctr = 0; ctr < EATER_EXT; ctr++)
4310 if (!p_ptr->magic_num2[ctr+ext]) continue;
4312 k_idx = lookup_kind(tval, ctr);
4316 if (ctr == (menu_line-1))
4317 strcpy(dummy, _("》", "> "));
4321 /* letter/number for power selection */
4328 letter = '0' + ctr - 26;
4329 sprintf(dummy, "%c)",letter);
4331 x1 = ((ctr < EATER_EXT/2) ? x : x + 40);
4332 y1 = ((ctr < EATER_EXT/2) ? y + ctr : y + ctr - EATER_EXT/2);
4333 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
4334 chance = level * 4 / 5 + 20;
4335 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4337 if (p_ptr->lev > level)
4339 chance -= 3 * (p_ptr->lev - level);
4341 chance = mod_spell_chance_1(chance);
4342 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
4343 /* Stunning makes spells harder */
4344 if (p_ptr->stun > 50) chance += 25;
4345 else if (p_ptr->stun) chance += 15;
4347 if (chance > 95) chance = 95;
4349 chance = mod_spell_chance_2(chance);
4357 strcat(dummy, format(
4358 _(" %-22.22s 充填:%2d/%2d%3d%%", " %-22.22s (%2d/%2d) %3d%%"),
4359 k_name + k_info[k_idx].name,
4360 p_ptr->magic_num1[ctr+ext] ?
4361 (p_ptr->magic_num1[ctr+ext] - 1) / (EATER_ROD_CHARGE * k_info[k_idx].pval) +1 : 0,
4362 p_ptr->magic_num2[ctr+ext], chance));
4363 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;
4367 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));
4368 if (p_ptr->magic_num1[ctr+ext] < EATER_CHARGE) col = TERM_RED;
4373 c_prt(col, dummy, y1, x1);
4377 if (!get_com(out_val, &choice, FALSE)) break;
4379 if (use_menu && choice != ' ')
4395 menu_line += EATER_EXT - 1;
4396 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
4397 } while(!p_ptr->magic_num2[menu_line+ext-1]);
4408 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
4409 } while(!p_ptr->magic_num2[menu_line+ext-1]);
4420 bool reverse = FALSE;
4421 if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
4422 if (menu_line > EATER_EXT/2)
4424 menu_line -= EATER_EXT/2;
4427 else menu_line+=EATER_EXT/2;
4428 while(!p_ptr->magic_num2[menu_line+ext-1])
4433 if (menu_line < 2) reverse = FALSE;
4438 if (menu_line > EATER_EXT-1) reverse = TRUE;
4455 /* Request redraw */
4456 if (use_menu && ask) continue;
4458 /* Request redraw */
4459 if (!use_menu && ((choice == ' ') || (choice == '*') || (choice == '?')))
4465 request_list = FALSE;
4467 /* Restore the screen */
4472 request_list = TRUE;
4480 if (isalpha(choice))
4483 ask = (isupper(choice));
4486 if (ask) choice = tolower(choice);
4488 /* Extract request */
4489 i = (islower(choice) ? A2I(choice) : -1);
4493 ask = FALSE; /* Can't uppercase digits */
4495 i = choice - '0' + 26;
4499 /* Totally Illegal */
4500 if ((i < 0) || (i > EATER_EXT) || !p_ptr->magic_num2[i+ext])
4514 (void) strnfmt(tmp_val, 78, _("%sを使いますか? ", "Use %s?"), k_name + k_info[lookup_kind(tval ,i)].name);
4516 /* Belay that order */
4517 if (!get_check(tmp_val)) continue;
4521 if (p_ptr->magic_num1[ext+i] > k_info[lookup_kind(tval, i)].pval * (p_ptr->magic_num2[ext+i] - 1) * EATER_ROD_CHARGE)
4523 msg_print(_("その魔法はまだ充填している最中だ。", "The magic are still charging."));
4525 if (use_menu) ask = TRUE;
4531 if (p_ptr->magic_num1[ext+i] < EATER_CHARGE)
4533 msg_print(_("その魔法は使用回数が切れている。", "The magic has no charges left."));
4535 if (use_menu) ask = TRUE;
4547 /* Clear lines, position cursor (really should use strlen here) */
4548 Term_erase(7, 23, 255);
4549 Term_erase(7, 22, 255);
4550 Term_erase(7, 21, 255);
4551 Term_erase(7, 20, 255);
4553 roff_to_buf(k_text + k_info[lookup_kind(tval, i)].text, 62, temp, sizeof(temp));
4554 for (j = 0, line = 21; temp[j]; j += 1 + strlen(&temp[j]))
4556 prt(&temp[j], line, 10);
4567 /* Restore the screen */
4570 if (!flag) return -1;
4574 #endif /* ALLOW_REPEAT */
4580 * @brief 取り込んだ魔力を利用するコマンドのメインルーチン /
4581 * Use eaten rod, wand or staff
4582 * @param only_browse 閲覧するだけならばTRUE
4583 * @param powerful 強力発動中の処理ならばTRUE
4584 * @return 実際にコマンドを実行したならばTRUEを返す。
4586 bool do_cmd_magic_eater(bool only_browse, bool powerful)
4588 int item, chance, level, k_idx, tval, sval;
4589 bool use_charge = TRUE;
4591 /* Not when confused */
4592 if (!only_browse && p_ptr->confused)
4594 msg_print(_("混乱していて唱えられない!", "You are too confused!"));
4598 item = select_magic_eater(only_browse);
4604 if (item >= EATER_EXT*2) {tval = TV_ROD;sval = item - EATER_EXT*2;}
4605 else if (item >= EATER_EXT) {tval = TV_WAND;sval = item - EATER_EXT;}
4606 else {tval = TV_STAFF;sval = item;}
4607 k_idx = lookup_kind(tval, sval);
4609 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
4610 chance = level * 4 / 5 + 20;
4611 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4613 if (p_ptr->lev > level)
4615 chance -= 3 * (p_ptr->lev - level);
4617 chance = mod_spell_chance_1(chance);
4618 chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
4619 /* Stunning makes spells harder */
4620 if (p_ptr->stun > 50) chance += 25;
4621 else if (p_ptr->stun) chance += 15;
4623 if (chance > 95) chance = 95;
4625 chance = mod_spell_chance_2(chance);
4627 if (randint0(100) < chance)
4629 if (flush_failure) flush();
4631 msg_print(_("呪文をうまく唱えられなかった!", "You failed to get the magic off!"));
4633 if (randint1(100) >= chance)
4634 chg_virtue(V_CHANCE,-1);
4645 if ((sval >= SV_ROD_MIN_DIRECTION) && (sval != SV_ROD_HAVOC) && (sval != SV_ROD_AGGRAVATE) && (sval != SV_ROD_PESTICIDE))
4646 if (!get_aim_dir(&dir)) return FALSE;
4647 rod_effect(sval, dir, &use_charge, powerful, TRUE);
4648 if (!use_charge) return FALSE;
4650 else if (tval == TV_WAND)
4652 if (!get_aim_dir(&dir)) return FALSE;
4653 wand_effect(sval, dir, powerful, TRUE);
4657 staff_effect(sval, &use_charge, powerful, TRUE, TRUE);
4658 if (!use_charge) return FALSE;
4660 if (randint1(100) < chance)
4661 chg_virtue(V_CHANCE,1);
4664 if (tval == TV_ROD) p_ptr->magic_num1[item] += k_info[k_idx].pval * EATER_ROD_CHARGE;
4665 else p_ptr->magic_num1[item] -= EATER_CHARGE;