3 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎËâË¡¤Ë´Ø¤¹¤ë¥³¥Þ¥ó¥É¤Î¼ÂÁõ / Spell/Prayer commands
6 * 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.
17 * @brief ÎΰèËâË¡¤Ë±þ¤¸¤Æµ»Ç½¤Î̾¾Î¤òÊÖ¤¹¡£
18 * @param tval ËâË¡½ñ¤Îtval
19 * @return ÎΰèËâË¡¤Îµ»Ç½Ì¾¾Î¤òÊݴɤ·¤¿Ê¸»úÎó¥Ý¥¤¥ó¥¿
21 cptr spell_category_name(int tval)
26 case TV_HISSATSU_BOOK:
35 case TV_HISSATSU_BOOK:
48 bool select_the_force = FALSE;
51 * @brief ÎΰèËâË¡¤Î±ÜÍ÷¡¢³Ø½¬¡¢»ÈÍÑÁªÂò¤¹¤ë¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹½èÍý
52 * Allow user to choose a spell/prayer from the given book.
53 * @param sn ÁªÂò¤·¤¿ËâË¡ID¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
54 * @param prompt ËâË¡¤òÍøÍѤ¹¤ëºÝ¤ÎÆ°»ìɽµ
55 * @param sval ËâÆ»½ñ¤Îsval
56 * @param learned ±ÜÍ÷/»ÈÍÑÁªÂò¤Ê¤é¤ÐTRUE¡¢³Ø½¬½èÍý¤Ê¤éFALSE
57 * @param use_realm ËâË¡ÎΰèID
60 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
61 * If the user hits escape, returns FALSE, and set '*sn' to -1
62 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
64 * The "prompt" should be "cast", "recite", or "study"
65 * The "known" should be TRUE for cast/pray, FALSE for study
68 static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm)
76 bool flag, redraw, okay;
78 const magic_type *s_ptr;
84 int menu_line = (use_menu ? 1 : 0);
86 #ifdef ALLOW_REPEAT /* TNB */
88 /* Get the spell, if available */
91 /* Verify the spell */
92 if (spell_okay(*sn, learned, FALSE, use_realm))
99 #endif /* ALLOW_REPEAT -- TNB */
101 p = spell_category_name(mp_ptr->spell_book);
104 for (spell = 0; spell < 32; spell++)
106 /* Check for this spell */
107 if ((fake_spell_flags[sval] & (1L << spell)))
109 /* Collect this spell */
110 spells[num++] = spell;
114 /* Assume no usable spells */
117 /* Assume no spells available */
120 /* Check for "okay" spells */
121 for (i = 0; i < num; i++)
123 /* Look for "okay" spells */
124 if (spell_okay(spells[i], learned, FALSE, use_realm)) okay = TRUE;
127 /* No "okay" spells */
128 if (!okay) return (FALSE);
129 if (((use_realm) != p_ptr->realm1) && ((use_realm) != p_ptr->realm2) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE)) return FALSE;
130 if (((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) && !is_magic(use_realm)) return FALSE;
131 if ((p_ptr->pclass == CLASS_RED_MAGE) && ((use_realm) != REALM_ARCANE) && (sval > 1)) return FALSE;
133 /* Assume cancelled */
136 /* Nothing chosen yet */
143 p_ptr->window |= (PW_SPELL);
148 /* Build a prompt (accept all spells) */
150 jverb1( prompt, jverb_buf );
151 (void) strnfmt(out_val, 78, "(%^s:%c-%c, '*'¤Ç°ìÍ÷, ESC¤ÇÃæÃÇ) ¤É¤Î%s¤ò%^s¤Þ¤¹¤«? ",
152 p, I2A(0), I2A(num - 1), p, jverb_buf );
154 (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) %^s which %s? ",
155 p, I2A(0), I2A(num - 1), prompt, p);
158 /* Get a spell from the user */
160 choice = (always_show_list || use_menu) ? ESCAPE : 1;
163 if (choice == ESCAPE) choice = ' ';
164 else if (!get_com(out_val, &choice, TRUE))break;
166 if (use_menu && choice != ' ')
180 menu_line += (num - 1);
202 if (menu_line > num) menu_line -= num;
203 /* Display a list of spells */
204 print_spells(menu_line, spells, num, 1, 15, use_realm);
210 if ((choice == ' ') || (choice == '*') || (choice == '?'))
218 /* Save the screen */
221 /* Display a list of spells */
222 print_spells(menu_line, spells, num, 1, 15, use_realm);
228 if (use_menu) continue;
233 /* Restore the screen */
243 ask = (isupper(choice));
246 if (ask) choice = tolower(choice);
248 /* Extract request */
249 i = (islower(choice) ? A2I(choice) : -1);
252 /* Totally Illegal */
253 if ((i < 0) || (i >= num))
259 /* Save the spell index */
262 /* Require "okay" spells */
263 if (!spell_okay(spell, learned, FALSE, use_realm))
267 msg_format("¤½¤Î%s¤ò%s¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£", p, prompt);
269 msg_format("You may not %s that %s.", prompt, p);
280 /* Access the spell */
281 if (!is_magic(use_realm))
283 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
287 s_ptr = &mp_ptr->info[use_realm - 1][spell];
290 /* Extract mana consumption rate */
291 if (use_realm == REALM_HISSATSU)
293 need_mana = s_ptr->smana;
297 need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
302 jverb1( prompt, jverb_buf );
303 /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½¤ËÂбþ */
304 (void) strnfmt(tmp_val, 78, "%s(MP%d, ¼ºÇÔΨ%d%%)¤ò%s¤Þ¤¹¤«? ",
305 do_spell(use_realm, spell, SPELL_NAME), need_mana,
306 spell_chance(spell, use_realm),jverb_buf);
308 (void)strnfmt(tmp_val, 78, "%^s %s (%d mana, %d%% fail)? ",
309 prompt, do_spell(use_realm, spell, SPELL_NAME), need_mana,
310 spell_chance(spell, use_realm));
314 /* Belay that order */
315 if (!get_check(tmp_val)) continue;
323 /* Restore the screen */
324 if (redraw) screen_load();
328 p_ptr->window |= (PW_SPELL);
334 /* Abort if needed */
335 if (!flag) return FALSE;
337 /* Save the choice */
340 #ifdef ALLOW_REPEAT /* TNB */
344 #endif /* ALLOW_REPEAT -- TNB */
351 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥×¥ì¥¤¥ä¡¼¤¬»ÈÍѲÄǽ¤ÊËâÆ»½ñ¤«¤É¤¦¤«¤òȽÄꤹ¤ë
352 * @param ȽÄꤷ¤¿¤¤¥ª¥Ö²ñ¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
353 * @return ³Ø½¬¤Ç¤¤ëËâÆ»½ñ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
355 static bool item_tester_learn_spell(object_type *o_ptr)
357 s32b choices = realm_choices2[p_ptr->pclass];
359 if (p_ptr->pclass == CLASS_PRIEST)
361 if (is_good_realm(p_ptr->realm1))
363 choices &= ~(CH_DEATH | CH_DAEMON);
367 choices &= ~(CH_LIFE | CH_CRUSADE);
371 if ((o_ptr->tval < TV_LIFE_BOOK) || (o_ptr->tval > (TV_LIFE_BOOK + MAX_REALM - 1))) return (FALSE);
372 if ((o_ptr->tval == TV_MUSIC_BOOK) && (p_ptr->pclass == CLASS_BARD)) return (TRUE);
373 else if (!is_magic(tval2realm(o_ptr->tval))) return FALSE;
374 if ((REALM1_BOOK == o_ptr->tval) || (REALM2_BOOK == o_ptr->tval)) return (TRUE);
375 if (choices & (0x0001 << (tval2realm(o_ptr->tval) - 1))) return (TRUE);
380 * @brief ¥×¥ì¥¤¥ä¡¼¤¬ËâÆ»½ñ¤ò°ìºý¤â»ý¤Ã¤Æ¤¤¤Ê¤¤¤«¤òȽÄꤹ¤ë
381 * @return ËâÆ»½ñ¤ò°ìºý¤â»ý¤Ã¤Æ¤¤¤Ê¤¤¤Ê¤éTRUE¤òÊÖ¤¹
383 static bool player_has_no_spellbooks(void)
388 for (i = 0; i < INVEN_PACK; i++)
390 o_ptr = &inventory[i];
391 if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
394 for (i = cave[py][px].o_idx; i; i = o_ptr->next_o_idx)
397 if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
404 * @brief ¥×¥ì¥¤¥ä¡¼¤Î¿¦¶È¤¬Îýµ¤½Ñ»Õ¤Î»þ¡¢ÎΰèËâË¡¤ÈÎýµ¤½Ñ¤òÀڤ괹¤¨¤ë½èÍý¤Î¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹
405 * @param browse_only ËâË¡¤Èµ»Ç½¤Î±ÜÍ÷¤ò¹Ô¤¦¤Ê¤é¤ÐTRUE
406 * @return ËâÆ»½ñ¤ò°ìºý¤â»ý¤Ã¤Æ¤¤¤Ê¤¤¤Ê¤éTRUE¤òÊÖ¤¹
408 static void confirm_use_force(bool browse_only)
415 /* Get the item index */
416 if (repeat_pull(&item) && (item == INVEN_FORCE))
418 browse_only ? do_cmd_mind_browse() : do_cmd_mind();
422 #endif /* ALLOW_REPEAT */
424 /* Show the prompt */
426 prt("('w'Îýµ¤½Ñ, ESC) 'w'¤«ESC¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£ ", 0, 0);
428 prt("(w for the Force, ESC) Hit 'w' or ESC. ", 0, 0);
436 if (which == ESCAPE) break;
437 else if (which == 'w')
442 repeat_push(INVEN_FORCE);
444 #endif /* ALLOW_REPEAT */
450 /* Clear the prompt line */
455 browse_only ? do_cmd_mind_browse() : do_cmd_mind();
461 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎËâË¡¤Èµ»Ç½¤ò±ÜÍ÷¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
462 * Peruse the spells/prayers in a book
466 * Note that *all* spells in the book are listed
468 * Note that browsing is allowed while confused or blind,
469 * and in the dark, primarily to allow browsing in stores.
472 void do_cmd_browse(void)
474 int item, sval, use_realm = 0, j, line;
485 /* Warriors are illiterate */
486 if (!(p_ptr->realm1 || p_ptr->realm2) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE))
489 msg_print("ËܤòÆɤळ¤È¤¬¤Ç¤¤Ê¤¤¡ª");
491 msg_print("You cannot read books!");
497 if (p_ptr->special_defense & KATA_MUSOU)
499 set_action(ACTION_NONE);
502 if (p_ptr->pclass == CLASS_FORCETRAINER)
504 if (player_has_no_spellbooks())
506 confirm_use_force(TRUE);
509 select_the_force = TRUE;
512 /* Restrict choices to "useful" books */
513 if (p_ptr->realm2 == REALM_NONE) item_tester_tval = mp_ptr->spell_book;
514 else item_tester_hook = item_tester_learn_spell;
518 q = "¤É¤ÎËܤòÆɤߤޤ¹¤«? ";
520 q = "Browse which book? ";
524 s = "Æɤá¤ëËܤ¬¤Ê¤¤¡£";
526 s = "You have no books that you can read.";
529 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
531 select_the_force = FALSE;
534 select_the_force = FALSE;
536 if (item == INVEN_FORCE) /* the_force */
538 do_cmd_mind_browse();
542 /* Get the item (in the pack) */
545 o_ptr = &inventory[item];
548 /* Get the item (on the floor) */
551 o_ptr = &o_list[0 - item];
554 /* Access the item's sval */
557 use_realm = tval2realm(o_ptr->tval);
559 /* Track the object kind */
560 object_kind_track(o_ptr->k_idx);
562 /* Hack -- Handle stuff */
567 for (spell = 0; spell < 32; spell++)
569 /* Check for this spell */
570 if ((fake_spell_flags[sval] & (1L << spell)))
572 /* Collect this spell */
573 spells[num++] = spell;
578 /* Save the screen */
581 /* Clear the top line */
584 /* Keep browsing spells. Exit browsing on cancel. */
587 /* Ask for a spell, allow cancel */
589 if (!get_spell(&spell, "Æɤà", o_ptr->sval, TRUE, use_realm))
591 if (!get_spell(&spell, "browse", o_ptr->sval, TRUE, use_realm))
594 /* If cancelled, leave immediately. */
595 if (spell == -1) break;
597 /* Display a list of spells */
598 print_spells(0, spells, num, 1, 15, use_realm);
600 /* Notify that there's nothing to see, and wait. */
601 if (use_realm == REALM_HISSATSU)
603 prt("Æɤá¤ëµ»¤¬¤Ê¤¤¡£", 0, 0);
605 prt("No techniques to browse.", 0, 0);
609 prt("Æɤá¤ë¼öʸ¤¬¤Ê¤¤¡£", 0, 0);
611 prt("No spells to browse.", 0, 0);
616 /* Restore the screen */
622 /* Clear lines, position cursor (really should use strlen here) */
623 Term_erase(14, 14, 255);
624 Term_erase(14, 13, 255);
625 Term_erase(14, 12, 255);
626 Term_erase(14, 11, 255);
628 roff_to_buf(do_spell(use_realm, spell, SPELL_DESC), 62, temp, sizeof(temp));
630 for (j = 0, line = 11; temp[j]; j += 1 + strlen(&temp[j]))
632 prt(&temp[j], line, 15);
637 /* Restore the screen */
642 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÂèÆóËâË¡Îΰè¤òÊѹ¹¤¹¤ë /
643 * @param Êѹ¹Àè¤ÎËâË¡ÎΰèID
646 static void change_realm2(int next_realm)
651 for (i = 0; i < 64; i++)
653 p_ptr->spell_order[j] = p_ptr->spell_order[i];
654 if (p_ptr->spell_order[i] < 32) j++;
657 p_ptr->spell_order[j] = 99;
659 for (i = 32; i < 64; i++)
661 p_ptr->spell_exp[i] = SPELL_EXP_UNSKILLED;
663 p_ptr->spell_learned2 = 0L;
664 p_ptr->spell_worked2 = 0L;
665 p_ptr->spell_forgotten2 = 0L;
668 sprintf(tmp,"ËâË¡¤ÎÎΰè¤ò%s¤«¤é%s¤ËÊѹ¹¤·¤¿¡£", realm_names[p_ptr->realm2], realm_names[next_realm]);
670 sprintf(tmp,"change magic realm from %s to %s.", realm_names[p_ptr->realm2], realm_names[next_realm]);
672 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
673 p_ptr->old_realm |= 1 << (p_ptr->realm2-1);
674 p_ptr->realm2 = next_realm;
676 p_ptr->notice |= (PN_REORDER);
677 p_ptr->update |= (PU_SPELLS);
680 /* Load an autopick preference file */
681 autopick_load_pref(FALSE);
686 * @brief ËâË¡¤ò³Ø½¬¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
687 * Study a book to gain a new spell/prayer
690 void do_cmd_study(void)
694 bool learned = FALSE;
696 /* Spells of realm2 will have an increment of +32 */
699 cptr p = spell_category_name(mp_ptr->spell_book);
708 msg_print("ËܤòÆɤळ¤È¤¬¤Ç¤¤Ê¤¤¡ª");
710 msg_print("You cannot read books!");
716 if (p_ptr->blind || no_lite())
719 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
721 msg_print("You cannot see!");
730 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡ª");
732 msg_print("You are too confused!");
738 if (!(p_ptr->new_spells))
741 msg_format("¿·¤·¤¤%s¤ò³Ð¤¨¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡ª", p);
743 msg_format("You cannot learn any new %ss!", p);
749 if (p_ptr->special_defense & KATA_MUSOU)
751 set_action(ACTION_NONE);
755 if( p_ptr->new_spells < 10 ){
756 msg_format("¤¢¤È %d ¤Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
758 msg_format("¤¢¤È %d ¸Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
761 msg_format("You can learn %d new %s%s.", p_ptr->new_spells, p,
762 (p_ptr->new_spells == 1?"":"s"));
768 /* Restrict choices to "useful" books */
769 if (p_ptr->realm2 == REALM_NONE) item_tester_tval = mp_ptr->spell_book;
770 else item_tester_hook = item_tester_learn_spell;
774 q = "¤É¤ÎËܤ«¤é³Ø¤Ó¤Þ¤¹¤«? ";
776 q = "Study which book? ";
780 s = "Æɤá¤ëËܤ¬¤Ê¤¤¡£";
782 s = "You have no books that you can read.";
785 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
787 /* Get the item (in the pack) */
790 o_ptr = &inventory[item];
793 /* Get the item (on the floor) */
796 o_ptr = &o_list[0 - item];
799 /* Access the item's sval */
802 if (o_ptr->tval == REALM2_BOOK) increment = 32;
803 else if (o_ptr->tval != REALM1_BOOK)
806 if (!get_check("ËÜÅö¤ËËâË¡¤ÎÎΰè¤òÊѹ¹¤·¤Þ¤¹¤«¡©")) return;
808 if (!get_check("Really, change magic realm? ")) return;
810 change_realm2(tval2realm(o_ptr->tval));
814 /* Track the object kind */
815 object_kind_track(o_ptr->k_idx);
817 /* Hack -- Handle stuff */
820 /* Mage -- Learn a selected spell */
821 if (mp_ptr->spell_book != TV_LIFE_BOOK)
823 /* Ask for a spell, allow cancel */
825 if (!get_spell(&spell, "³Ø¤Ö", sval, FALSE, o_ptr->tval - TV_LIFE_BOOK + 1)
826 && (spell == -1)) return;
828 if (!get_spell(&spell, "study", sval, FALSE, o_ptr->tval - TV_LIFE_BOOK + 1)
829 && (spell == -1)) return;
834 /* Priest -- Learn a random prayer */
842 for (spell = 0; spell < 32; spell++)
844 /* Check spells in the book */
845 if ((fake_spell_flags[sval] & (1L << spell)))
847 /* Skip non "okay" prayers */
848 if (!spell_okay(spell, FALSE, TRUE,
849 (increment ? p_ptr->realm2 : p_ptr->realm1))) continue;
851 /* Hack -- Prepare the randomizer */
854 /* Hack -- Apply the randomizer */
855 if (one_in_(k)) gift = spell;
863 /* Nothing to study */
868 msg_format("¤½¤ÎËܤˤϳؤ֤٤%s¤¬¤Ê¤¤¡£", p);
870 msg_format("You cannot learn any %ss in that book.", p);
879 if (increment) spell += increment;
881 /* Learn the spell */
884 if (p_ptr->spell_learned1 & (1L << spell)) learned = TRUE;
885 else p_ptr->spell_learned1 |= (1L << spell);
889 if (p_ptr->spell_learned2 & (1L << (spell - 32))) learned = TRUE;
890 else p_ptr->spell_learned2 |= (1L << (spell - 32));
895 int max_exp = (spell < 32) ? SPELL_EXP_MASTER : SPELL_EXP_EXPERT;
896 int old_exp = p_ptr->spell_exp[spell];
897 int new_rank = EXP_LEVEL_UNSKILLED;
898 cptr name = do_spell(increment ? p_ptr->realm2 : p_ptr->realm1, spell%32, SPELL_NAME);
900 if (old_exp >= max_exp)
903 msg_format("¤½¤Î%s¤Ï´°Á´¤Ë»È¤¤¤³¤Ê¤»¤ë¤Î¤Ç³Ø¤ÖɬÍפϤʤ¤¡£", p);
905 msg_format("You don't need to study this %s anymore.", p);
910 if (!get_check(format("%s¤Î%s¤ò¤µ¤é¤Ë³Ø¤Ó¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©", name, p)))
912 if (!get_check(format("You will study a %s of %s again. Are you sure? ", p, name)))
917 else if (old_exp >= SPELL_EXP_EXPERT)
919 p_ptr->spell_exp[spell] = SPELL_EXP_MASTER;
920 new_rank = EXP_LEVEL_MASTER;
922 else if (old_exp >= SPELL_EXP_SKILLED)
924 if (spell >= 32) p_ptr->spell_exp[spell] = SPELL_EXP_EXPERT;
925 else p_ptr->spell_exp[spell] += SPELL_EXP_EXPERT - SPELL_EXP_SKILLED;
926 new_rank = EXP_LEVEL_EXPERT;
928 else if (old_exp >= SPELL_EXP_BEGINNER)
930 p_ptr->spell_exp[spell] = SPELL_EXP_SKILLED + (old_exp - SPELL_EXP_BEGINNER) * 2 / 3;
931 new_rank = EXP_LEVEL_SKILLED;
935 p_ptr->spell_exp[spell] = SPELL_EXP_BEGINNER + old_exp / 3;
936 new_rank = EXP_LEVEL_BEGINNER;
939 msg_format("%s¤Î½ÏÎýÅÙ¤¬%s¤Ë¾å¤¬¤Ã¤¿¡£", name, exp_level_str[new_rank]);
941 msg_format("Your proficiency of %s is now %s rank.", name, exp_level_str[new_rank]);
946 /* Find the next open entry in "p_ptr->spell_order[]" */
947 for (i = 0; i < 64; i++)
949 /* Stop at the first empty space */
950 if (p_ptr->spell_order[i] == 99) break;
953 /* Add the spell to the known list */
954 p_ptr->spell_order[i++] = spell;
956 /* Mention the result */
958 /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½¤ËÂбþ */
959 if (mp_ptr->spell_book == TV_MUSIC_BOOK)
961 msg_format("%s¤ò³Ø¤ó¤À¡£",
962 do_spell(increment ? p_ptr->realm2 : p_ptr->realm1, spell % 32, SPELL_NAME));
966 msg_format("%s¤Î%s¤ò³Ø¤ó¤À¡£",
967 do_spell(increment ? p_ptr->realm2 : p_ptr->realm1, spell % 32, SPELL_NAME) ,p);
970 msg_format("You have learned the %s of %s.",
971 p, do_spell(increment ? p_ptr->realm2 : p_ptr->realm1, spell % 32, SPELL_NAME));
978 switch (mp_ptr->spell_book)
981 chg_virtue(V_FAITH, 1);
984 chg_virtue(V_UNLIFE, 1);
987 chg_virtue(V_NATURE, 1);
990 chg_virtue(V_KNOWLEDGE, 1);
997 /* One less spell available */
998 p_ptr->learned_spells++;
1000 /* Message if needed */
1001 if (p_ptr->new_spells)
1005 if (p_ptr->new_spells < 10) msg_format("¤¢¤È %d ¤Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
1006 else msg_format("¤¢¤È %d ¸Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
1008 msg_format("You can learn %d more %s%s.", p_ptr->new_spells, p,
1009 (p_ptr->new_spells != 1) ? "s" : "");
1015 p_ptr->update |= (PU_SPELLS);
1018 /* Redraw object recall */
1019 p_ptr->window |= (PW_OBJECT);
1023 static void wild_magic(int spell)
1026 int type = SUMMON_BIZARRE1 + randint0(6);
1028 if (type < SUMMON_BIZARRE1) type = SUMMON_BIZARRE1;
1029 else if (type > SUMMON_BIZARRE6) type = SUMMON_BIZARRE6;
1031 switch (randint1(spell) + randint1(8) + 1)
1036 teleport_player(10, TELEPORT_PASSIVE);
1041 teleport_player(100, TELEPORT_PASSIVE);
1045 teleport_player(200, TELEPORT_PASSIVE);
1055 lite_area(damroll(2, 3), 2);
1058 destroy_doors_touch();
1063 sleep_monsters_touch();
1067 trap_creation(py, px);
1076 aggravate_monsters(0);
1079 earthquake(py, px, 5);
1083 (void)gain_random_mutation(0);
1087 apply_disenchant(1);
1093 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
1100 while (counter++ < 8)
1102 (void)summon_specific(0, py, px, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
1107 activate_hi_summon(py, px, FALSE);
1110 (void)summon_cyber(-1, py, px);
1115 (void)activate_ty_curse(FALSE, &count);
1125 * @brief ËâË¡¤ò±Ó¾§¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
1129 void do_cmd_cast(void)
1131 int item, sval, spell, realm;
1141 const magic_type *s_ptr;
1145 bool over_exerted = FALSE;
1147 /* Require spell ability */
1148 if (!p_ptr->realm1 && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE))
1151 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
1153 msg_print("You cannot cast spells!");
1160 if (p_ptr->blind || no_lite())
1162 if (p_ptr->pclass == CLASS_FORCETRAINER) confirm_use_force(FALSE);
1166 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
1168 msg_print("You cannot see!");
1175 /* Not when confused */
1176 if (p_ptr->confused)
1179 msg_print("º®Í𤷤Ƥ¤¤Æ¾§¤¨¤é¤ì¤Ê¤¤¡ª");
1181 msg_print("You are too confused!");
1188 if (p_ptr->realm1 == REALM_HEX)
1190 if (hex_spell_fully())
1194 msg_print("¤³¤ì°Ê¾å¿·¤·¤¤¼öʸ¤ò±Ó¾§¤¹¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£");
1196 msg_print("Can not spell new spells more.");
1199 if (p_ptr->lev >= 35) flag = stop_hex_spell();
1204 if (p_ptr->pclass == CLASS_FORCETRAINER)
1206 if (player_has_no_spellbooks())
1208 confirm_use_force(FALSE);
1211 select_the_force = TRUE;
1214 prayer = spell_category_name(mp_ptr->spell_book);
1216 /* Restrict choices to spell books */
1217 item_tester_tval = mp_ptr->spell_book;
1221 q = "¤É¤Î¼öʸ½ñ¤ò»È¤¤¤Þ¤¹¤«? ";
1223 q = "Use which book? ";
1227 s = "¼öʸ½ñ¤¬¤Ê¤¤¡ª";
1229 s = "You have no spell books!";
1232 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
1234 select_the_force = FALSE;
1237 select_the_force = FALSE;
1239 if (item == INVEN_FORCE) /* the_force */
1245 /* Get the item (in the pack) */
1248 o_ptr = &inventory[item];
1251 /* Get the item (on the floor) */
1254 o_ptr = &o_list[0 - item];
1257 /* Access the item's sval */
1260 if ((p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE) && (o_ptr->tval == REALM2_BOOK)) increment = 32;
1263 /* Track the object kind */
1264 object_kind_track(o_ptr->k_idx);
1266 /* Hack -- Handle stuff */
1269 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
1270 realm = o_ptr->tval - TV_LIFE_BOOK + 1;
1271 else if (increment) realm = p_ptr->realm2;
1272 else realm = p_ptr->realm1;
1274 /* Ask for a spell */
1276 if (!get_spell(&spell,
1277 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "±Ó¾§¤¹¤ë" : (mp_ptr->spell_book == TV_MUSIC_BOOK) ? "²Î¤¦" : "¾§¤¨¤ë"),
1280 if (spell == -2) msg_format("¤½¤ÎËܤˤÏÃΤäƤ¤¤ë%s¤¬¤Ê¤¤¡£", prayer);
1284 if (!get_spell(&spell, ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
1288 msg_format("You don't know any %ss in that book.", prayer);
1294 use_realm = tval2realm(o_ptr->tval);
1297 if (use_realm == REALM_HEX)
1299 if (hex_spelling(spell))
1302 msg_print("¤½¤Î¼öʸ¤Ï¤¹¤Ç¤Ë±Ó¾§Ãæ¤À¡£");
1304 msg_print("You are already casting it.");
1310 if (!is_magic(use_realm))
1312 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
1316 s_ptr = &mp_ptr->info[realm - 1][spell];
1319 /* Extract mana consumption rate */
1320 need_mana = mod_need_mana(s_ptr->smana, spell, realm);
1322 /* Verify "dangerous" spells */
1323 if (need_mana > p_ptr->csp)
1325 if (flush_failure) flush();
1329 msg_format("¤½¤Î%s¤ò%s¤Î¤Ë½½Ê¬¤Ê¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È¤¬¤Ê¤¤¡£",prayer,
1330 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "±Ó¾§¤¹¤ë" : (mp_ptr->spell_book == TV_LIFE_BOOK) ? "²Î¤¦" : "¾§¤¨¤ë"));
1332 msg_format("You do not have enough mana to %s this %s.",
1333 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
1338 if (!over_exert) return;
1342 if (!get_check_strict("¤½¤ì¤Ç¤âÄ©À路¤Þ¤¹¤«? ", CHECK_OKAY_CANCEL)) return;
1344 if (!get_check_strict("Attempt it anyway? ", CHECK_OKAY_CANCEL)) return;
1349 /* Spell failure chance */
1350 chance = spell_chance(spell, use_realm);
1352 /* Sufficient mana */
1353 if (need_mana <= p_ptr->csp)
1356 p_ptr->csp -= need_mana;
1358 else over_exerted = TRUE;
1361 p_ptr->redraw |= (PR_MANA);
1364 if (randint0(100) < chance)
1366 if (flush_failure) flush();
1369 msg_format("%s¤ò¤¦¤Þ¤¯¾§¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡ª", prayer);
1371 msg_format("You failed to get the %s off!", prayer);
1379 if (randint1(100) < chance) chg_virtue(V_VITALITY, -1);
1382 if (randint1(100) < chance) chg_virtue(V_UNLIFE, -1);
1385 if (randint1(100) < chance) chg_virtue(V_NATURE, -1);
1388 if (randint1(100) < chance) chg_virtue(V_JUSTICE, 1);
1391 if (randint1(100) < chance) chg_virtue(V_JUSTICE, -1);
1394 if (randint1(100) < chance) chg_virtue(V_COMPASSION, -1);
1397 if (randint1(100) < chance) chg_virtue(V_KNOWLEDGE, -1);
1401 /* Failure casting may activate some side effect */
1402 do_spell(realm, spell, SPELL_FAIL);
1405 if ((o_ptr->tval == TV_CHAOS_BOOK) && (randint1(100) < spell))
1408 msg_print("¥«¥ª¥¹Åª¤Ê¸ú²Ì¤òȯÀ¸¤·¤¿¡ª");
1410 msg_print("You produce a chaotic effect!");
1415 else if ((o_ptr->tval == TV_DEATH_BOOK) && (randint1(100) < spell))
1417 if ((sval == 3) && one_in_(2))
1419 sanity_blast(0, TRUE);
1424 msg_print("Äˤ¤¡ª");
1426 msg_print("It hurts!");
1430 take_hit(DAMAGE_LOSELIFE, damroll(o_ptr->sval + 1, 6), "°Å¹õËâË¡¤ÎµÕή", -1);
1432 take_hit(DAMAGE_LOSELIFE, damroll(o_ptr->sval + 1, 6), "a miscast Death spell", -1);
1435 if ((spell > 15) && one_in_(6) && !p_ptr->hold_life)
1436 lose_exp(spell * 250);
1439 else if ((o_ptr->tval == TV_MUSIC_BOOK) && (randint1(200) < spell))
1442 msg_print("¤¤¤ä¤Ê²»¤¬¶Á¤¤¤¿");
1444 msg_print("An infernal sound echoed.");
1447 aggravate_monsters(0);
1449 if (randint1(100) >= chance)
1450 chg_virtue(V_CHANCE,-1);
1456 /* Canceled spells cost neither a turn nor mana */
1457 if (!do_spell(realm, spell, SPELL_CAST)) return;
1459 if (randint1(100) < chance)
1460 chg_virtue(V_CHANCE,1);
1462 /* A spell was cast */
1464 (p_ptr->spell_worked2 & (1L << spell)) :
1465 (p_ptr->spell_worked1 & (1L << spell)))
1466 && (p_ptr->pclass != CLASS_SORCERER)
1467 && (p_ptr->pclass != CLASS_RED_MAGE))
1469 int e = s_ptr->sexp;
1471 /* The spell worked */
1472 if (realm == p_ptr->realm1)
1474 p_ptr->spell_worked1 |= (1L << spell);
1478 p_ptr->spell_worked2 |= (1L << spell);
1481 /* Gain experience */
1482 gain_exp(e * s_ptr->slevel);
1484 /* Redraw object recall */
1485 p_ptr->window |= (PW_OBJECT);
1490 chg_virtue(V_TEMPERANCE, 1);
1491 chg_virtue(V_COMPASSION, 1);
1492 chg_virtue(V_VITALITY, 1);
1493 chg_virtue(V_DILIGENCE, 1);
1496 chg_virtue(V_UNLIFE, 1);
1497 chg_virtue(V_JUSTICE, -1);
1498 chg_virtue(V_FAITH, -1);
1499 chg_virtue(V_VITALITY, -1);
1502 chg_virtue(V_JUSTICE, -1);
1503 chg_virtue(V_FAITH, -1);
1504 chg_virtue(V_HONOUR, -1);
1505 chg_virtue(V_TEMPERANCE, -1);
1508 chg_virtue(V_FAITH, 1);
1509 chg_virtue(V_JUSTICE, 1);
1510 chg_virtue(V_SACRIFICE, 1);
1511 chg_virtue(V_HONOUR, 1);
1514 chg_virtue(V_NATURE, 1);
1515 chg_virtue(V_HARMONY, 1);
1518 chg_virtue(V_JUSTICE, -1);
1519 chg_virtue(V_FAITH, -1);
1520 chg_virtue(V_HONOUR, -1);
1521 chg_virtue(V_COMPASSION, -1);
1524 chg_virtue(V_KNOWLEDGE, 1);
1531 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_TEMPERANCE, 1);
1532 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_COMPASSION, 1);
1533 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_VITALITY, 1);
1534 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_DILIGENCE, 1);
1537 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_UNLIFE, 1);
1538 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_JUSTICE, -1);
1539 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_FAITH, -1);
1540 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_VITALITY, -1);
1543 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_JUSTICE, -1);
1544 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_FAITH, -1);
1545 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_HONOUR, -1);
1546 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_TEMPERANCE, -1);
1549 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_FAITH, 1);
1550 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_JUSTICE, 1);
1551 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_SACRIFICE, 1);
1552 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_HONOUR, 1);
1555 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_NATURE, 1);
1556 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_HARMONY, 1);
1559 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_JUSTICE, -1);
1560 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_FAITH, -1);
1561 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_HONOUR, -1);
1562 if (randint1(100 + p_ptr->lev) < need_mana) chg_virtue(V_COMPASSION, -1);
1565 if (mp_ptr->spell_xtra & MAGIC_GAIN_EXP)
1567 s16b cur_exp = p_ptr->spell_exp[(increment ? 32 : 0)+spell];
1570 if (cur_exp < SPELL_EXP_BEGINNER)
1572 else if (cur_exp < SPELL_EXP_SKILLED)
1574 if ((dun_level > 4) && ((dun_level + 10) > p_ptr->lev))
1577 else if (cur_exp < SPELL_EXP_EXPERT)
1579 if (((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel))
1582 else if ((cur_exp < SPELL_EXP_MASTER) && !increment)
1584 if (((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel))
1587 p_ptr->spell_exp[(increment ? 32 : 0) + spell] += exp_gain;
1595 /* Over-exert the player */
1598 int oops = need_mana;
1602 p_ptr->csp_frac = 0;
1606 msg_print("Àº¿À¤ò½¸Ã椷¤¹¤®¤Æµ¤¤ò¼º¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
1608 msg_print("You faint from the effort!");
1612 /* Hack -- Bypass free action */
1613 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1618 chg_virtue(V_VITALITY, -10);
1621 chg_virtue(V_UNLIFE, -10);
1624 chg_virtue(V_JUSTICE, 10);
1627 chg_virtue(V_NATURE, -10);
1630 chg_virtue(V_JUSTICE, -10);
1633 chg_virtue(V_COMPASSION, 10);
1636 chg_virtue(V_KNOWLEDGE, -10);
1640 /* Damage CON (possibly permanently) */
1641 if (randint0(100) < 50)
1643 bool perm = (randint0(100) < 25);
1647 msg_print("ÂΤò°¤¯¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
1649 msg_print("You have damaged your health!");
1653 /* Reduce constitution */
1654 (void)dec_stat(A_CON, 15 + randint1(10), perm);
1659 p_ptr->window |= (PW_PLAYER);
1660 p_ptr->window |= (PW_SPELL);
1664 * @brief ¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤Æ¤¤¤ë¥â¥ó¥¹¥¿¡¼¤ò¥½¡¼¥È¤¹¤ë¤¿¤á¤ÎÈæ³Ó½èÍý
1665 * @param u ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤ÂÎÇÛÎó
1667 * @param a Èæ³ÓÂоݤΥâ¥ó¥¹¥¿¡¼ID1
1668 * @param b Èæ³ÓÂоݤΥâ¥ó¥¹¥¿¡¼ID2
1669 * @return 2ÈÖÌܤ¬Âç¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
1671 static bool ang_sort_comp_pet_dismiss(vptr u, vptr v, int a, int b)
1673 u16b *who = (u16b*)(u);
1678 monster_type *m_ptr1 = &m_list[w1];
1679 monster_type *m_ptr2 = &m_list[w2];
1680 monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
1681 monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
1686 if (w1 == p_ptr->riding) return TRUE;
1687 if (w2 == p_ptr->riding) return FALSE;
1689 if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
1690 if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
1692 if (!m_ptr1->parent_m_idx && m_ptr2->parent_m_idx) return TRUE;
1693 if (!m_ptr2->parent_m_idx && m_ptr1->parent_m_idx) return FALSE;
1695 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
1696 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
1698 if (r_ptr1->level > r_ptr2->level) return TRUE;
1699 if (r_ptr2->level > r_ptr1->level) return FALSE;
1701 if (m_ptr1->hp > m_ptr2->hp) return TRUE;
1702 if (m_ptr2->hp > m_ptr1->hp) return FALSE;
1708 * @brief ¥Ú¥Ã¥È¤ÎÁ±°Â°À¤Ë±þ¤¸¤¿°Ý»ý¥³¥¹¥È¤ÎÅÓÃæ·×»»½èÍý
1709 * @param m_ptr ·×»»´ð½à¤È¤Ê¤ë¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1710 * @param inc m_ptr¤Ç»ØÄꤷ¤¿¥â¥ó¥¹¥¿¡¼¤ò°Ý»ý¥³¥¹¥È·×»»¤Ë²Ã¤¨¤ë¤Ê¤éTRUE¡¢³°¤¹¤Ê¤éFALSE¤ò»ØÄê
1713 void check_pets_num_and_align(monster_type *m_ptr, bool inc)
1715 s32b old_friend_align = friend_align;
1716 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1721 if (r_ptr->flags3 & RF3_GOOD) friend_align += r_ptr->level;
1722 if (r_ptr->flags3 & RF3_EVIL) friend_align -= r_ptr->level;
1727 if (r_ptr->flags3 & RF3_GOOD) friend_align -= r_ptr->level;
1728 if (r_ptr->flags3 & RF3_EVIL) friend_align += r_ptr->level;
1731 if (old_friend_align != friend_align) p_ptr->update |= (PU_BONUS);
1735 * @brief ¥Ú¥Ã¥È¤Î°Ý»ý¥³¥¹¥È·×»»
1736 * @return °Ý»ý¥³¥¹¥È(%)
1738 int calculate_upkeep(void)
1740 s32b old_friend_align = friend_align;
1742 bool have_a_unique = FALSE;
1743 s32b total_friend_levels = 0;
1748 for (m_idx = m_max - 1; m_idx >=1; m_idx--)
1750 monster_type *m_ptr;
1751 monster_race *r_ptr;
1753 m_ptr = &m_list[m_idx];
1754 if (!m_ptr->r_idx) continue;
1755 r_ptr = &r_info[m_ptr->r_idx];
1760 if (r_ptr->flags1 & RF1_UNIQUE)
1762 if (p_ptr->pclass == CLASS_CAVALRY)
1764 if (p_ptr->riding == m_idx)
1765 total_friend_levels += (r_ptr->level+5)*2;
1766 else if (!have_a_unique && (r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
1767 total_friend_levels += (r_ptr->level+5)*7/2;
1769 total_friend_levels += (r_ptr->level+5)*10;
1770 have_a_unique = TRUE;
1773 total_friend_levels += (r_ptr->level+5)*10;
1776 total_friend_levels += r_ptr->level;
1778 /* Determine pet alignment */
1779 if (r_ptr->flags3 & RF3_GOOD) friend_align += r_ptr->level;
1780 if (r_ptr->flags3 & RF3_EVIL) friend_align -= r_ptr->level;
1783 if (old_friend_align != friend_align) p_ptr->update |= (PU_BONUS);
1787 upkeep_factor = (total_friend_levels - (p_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
1788 if (upkeep_factor < 0) upkeep_factor = 0;
1789 if (upkeep_factor > 1000) upkeep_factor = 1000;
1790 return upkeep_factor;
1797 * @brief ¥Ú¥Ã¥È¤ò³«Êü¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
1800 void do_cmd_pet_dismiss(void)
1802 monster_type *m_ptr;
1803 bool all_pets = FALSE;
1817 /* Allocate the "who" array */
1818 C_MAKE(who, max_m_idx, u16b);
1820 /* Process the monsters (backwards) */
1821 for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
1823 if (is_pet(&m_list[pet_ctr]))
1824 who[max_pet++] = pet_ctr;
1827 /* Select the sort method */
1828 ang_sort_comp = ang_sort_comp_pet_dismiss;
1829 ang_sort_swap = ang_sort_swap_hook;
1831 ang_sort(who, &dummy_why, max_pet);
1833 /* Process the monsters (backwards) */
1834 for (i = 0; i < max_pet; i++)
1837 char friend_name[80];
1840 /* Access the monster */
1842 m_ptr = &m_list[pet_ctr];
1844 delete_this = FALSE;
1845 kakunin = ((pet_ctr == p_ptr->riding) || (m_ptr->nickname));
1846 monster_desc(friend_name, m_ptr, MD_ASSUME_VISIBLE);
1850 /* Hack -- health bar for this monster */
1851 health_track(pet_ctr);
1853 /* Hack -- handle stuff */
1856 msg_format(_("%s¤òÊü¤·¤Þ¤¹¤«¡© [Yes/No/Unnamed (%dÂÎ)]","Dismiss %s? [Yes/No/Unnamed (%d remain)]"), friend_name, max_pet - i);
1859 move_cursor_relative(m_ptr->fy, m_ptr->fx);
1865 if (ch == 'Y' || ch == 'y')
1871 msg_format(_("ËÜÅö¤Ë¤è¤í¤·¤¤¤Ç¤¹¤«¡© (%s) ","Are you sure? (%s) "), friend_name);
1873 if (ch != 'Y' && ch != 'y')
1874 delete_this = FALSE;
1879 if (ch == 'U' || ch == 'u')
1885 if (ch == ESCAPE || ch == 'N' || ch == 'n')
1892 if ((all_pets && !kakunin) || (!all_pets && delete_this))
1894 if (record_named_pet && m_ptr->nickname)
1898 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1899 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
1902 if (pet_ctr == p_ptr->riding)
1904 msg_format(_("%s¤«¤é¹ß¤ê¤¿¡£","You have got off %s. "), friend_name);
1908 /* Update the monsters */
1909 p_ptr->update |= (PU_BONUS | PU_MONSTERS);
1910 p_ptr->redraw |= (PR_EXTRA | PR_UHEALTH);
1913 /* HACK : Add the line to message buffer */
1914 msg_format(_("%s ¤òÊü¤·¤¿¡£","Dismissed %s."), friend_name);
1915 p_ptr->window |= (PW_MESSAGE);
1918 delete_monster_idx(pet_ctr);
1927 C_KILL(who, max_m_idx, u16b);
1930 msg_format("%d ÂΤΥڥåȤòÊü¤·¤Þ¤·¤¿¡£", Dismissed);
1932 msg_format("You have dismissed %d pet%s.", Dismissed,
1933 (Dismissed == 1 ? "" : "s"));
1935 if (Dismissed == 0 && all_pets)
1937 msg_print("'U'nnamed ¤Ï¡¢¾èÇϰʳ°¤Î̾Á°¤Î¤Ê¤¤¥Ú¥Ã¥È¤À¤±¤òÁ´¤Æ²òÊü¤·¤Þ¤¹¡£");
1939 msg_print("'U'nnamed means all your pets except named pets and your mount.");
1944 * @brief ¥×¥ì¥¤¥ä¡¼¤Îµ³¾è/²¼ÇϽèÍýȽÄê
1945 * @param c_ptr ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°Àè¥Þ¥¹¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1946 * @param now_riding TRUE¤Ê¤é²¼ÇϽèÍý¡¢FALSE¤Ê¤é¤Ðµ³¾è½èÍý
1947 * @return ²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
1949 static bool player_can_ride_aux(cave_type *c_ptr, bool now_riding)
1952 bool old_character_xtra = character_xtra;
1953 int old_riding = p_ptr->riding;
1954 bool old_riding_ryoute = p_ptr->riding_ryoute;
1955 bool old_old_riding_ryoute = p_ptr->old_riding_ryoute;
1956 bool old_pf_ryoute = (p_ptr->pet_extra_flags & PF_RYOUTE) ? TRUE : FALSE;
1958 /* Hack -- prevent "icky" message */
1959 character_xtra = TRUE;
1961 if (now_riding) p_ptr->riding = c_ptr->m_idx;
1965 p_ptr->pet_extra_flags &= ~(PF_RYOUTE);
1966 p_ptr->riding_ryoute = p_ptr->old_riding_ryoute = FALSE;
1971 p_can_enter = player_can_enter(c_ptr->feat, CEM_P_CAN_ENTER_PATTERN);
1973 p_ptr->riding = old_riding;
1974 if (old_pf_ryoute) p_ptr->pet_extra_flags |= (PF_RYOUTE);
1975 else p_ptr->pet_extra_flags &= ~(PF_RYOUTE);
1976 p_ptr->riding_ryoute = old_riding_ryoute;
1977 p_ptr->old_riding_ryoute = old_old_riding_ryoute;
1981 character_xtra = old_character_xtra;
1987 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÍîÇÏȽÄê½èÍý
1988 * @param dam ÍîÇÏȽÄê¤òȯ¤·¤¿ºÝ¤Ë¼õ¤±¤¿¥À¥á¡¼¥¸ÎÌ
1989 * @param force TRUE¤Ê¤é¤Ð¶¯À©Åª¤ËÍîÇϤ¹¤ë
1990 * @return ¼ÂºÝ¤ËÍîÇϤ·¤¿¤éTRUE¤òÊÖ¤¹
1992 bool rakuba(int dam, bool force)
1994 int i, y, x, oy, ox;
1995 int sn = 0, sy = 0, sx = 0;
1997 monster_type *m_ptr = &m_list[p_ptr->riding];
1998 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1999 bool fall_dam = FALSE;
2001 if (!p_ptr->riding) return FALSE;
2002 if (p_ptr->wild_mode) return FALSE;
2004 if (dam >= 0 || force)
2008 int cur = p_ptr->skill_exp[GINOU_RIDING];
2009 int max = s_info[p_ptr->pclass].s_max[GINOU_RIDING];
2010 int ridinglevel = r_ptr->level;
2012 /* ÍîÇϤΤ·¤ä¤¹¤µ */
2013 int rakubalevel = r_ptr->level;
2014 if (p_ptr->riding_ryoute) rakubalevel += 20;
2016 if ((cur < max) && (max > 1000) &&
2017 (dam / 2 + ridinglevel) > (cur / 30 + 10))
2021 if (ridinglevel > (cur / 100 + 15))
2022 inc += 1 + (ridinglevel - cur / 100 - 15);
2026 p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
2029 /* ¥ì¥Ù¥ë¤ÎÄ㤤¾èÇϤ«¤é¤ÏÍîÇϤ·¤Ë¤¯¤¤ */
2030 if (randint0(dam / 2 + rakubalevel * 2) < cur / 30 + 10)
2032 if ((((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) && !p_ptr->riding_ryoute) || !one_in_(p_ptr->lev*(p_ptr->riding_ryoute ? 2 : 3) + 30))
2039 /* Check around the player */
2040 for (i = 0; i < 8; i++)
2044 /* Access the location */
2045 y = py + ddy_ddd[i];
2046 x = px + ddx_ddd[i];
2048 c_ptr = &cave[y][x];
2050 if (c_ptr->m_idx) continue;
2052 /* Skip non-empty grids */
2053 if (!cave_have_flag_grid(c_ptr, FF_MOVE) && !cave_have_flag_grid(c_ptr, FF_CAN_FLY))
2055 if (!player_can_ride_aux(c_ptr, FALSE)) continue;
2058 if (cave_have_flag_grid(c_ptr, FF_PATTERN)) continue;
2060 /* Count "safe" grids */
2063 /* Randomize choice */
2064 if (randint0(sn) > 0) continue;
2066 /* Save the safe location */
2071 monster_desc(m_name, m_ptr, 0);
2073 msg_format("%s¤«¤é¿¶¤êÍî¤È¤µ¤ì¤½¤¦¤Ë¤Ê¤Ã¤Æ¡¢Êɤˤ֤Ĥ«¤Ã¤¿¡£",m_name);
2074 take_hit(DAMAGE_NOESCAPE, r_ptr->level+3, "Êɤؤξ×ÆÍ", -1);
2076 msg_format("You have nearly fallen from %s, but bumped into wall.",m_name);
2077 take_hit(DAMAGE_NOESCAPE, r_ptr->level+3, "bumping into wall", -1);
2088 /* Redraw the old spot */
2091 /* Redraw the new spot */
2094 /* Check for new panel */
2099 p_ptr->pet_extra_flags &= ~(PF_RYOUTE);
2100 p_ptr->riding_ryoute = p_ptr->old_riding_ryoute = FALSE;
2104 p_ptr->update |= (PU_BONUS);
2107 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2110 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2112 p_ptr->redraw |= (PR_EXTRA);
2114 /* Update health track of mount */
2115 p_ptr->redraw |= (PR_UHEALTH);
2117 if (p_ptr->levitation && !force)
2119 monster_desc(m_name, m_ptr, 0);
2121 msg_format("%s¤«¤éÍî¤Á¤¿¤¬¡¢¶õÃæ¤Ç¤¦¤Þ¤¯ÂÎÀª¤òΩ¤Æľ¤·¤ÆÃåÃϤ·¤¿¡£",m_name);
2123 msg_format("You are thrown from %s, but make a good landing.",m_name);
2129 take_hit(DAMAGE_NOESCAPE, r_ptr->level+3, "ÍîÇÏ", -1);
2131 take_hit(DAMAGE_NOESCAPE, r_ptr->level+3, "Falling from riding", -1);
2136 /* Move the player */
2137 if (sy && !p_ptr->is_dead)
2138 (void)move_player_effect(py, px, MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
2143 bool do_riding(bool force)
2147 monster_type *m_ptr;
2149 if (!get_rep_dir2(&dir)) return FALSE;
2152 c_ptr = &cave[y][x];
2154 if (p_ptr->special_defense & KATA_MUSOU) set_action(ACTION_NONE);
2158 /* Skip non-empty grids */
2159 if (!player_can_ride_aux(c_ptr, FALSE))
2162 msg_print("¤½¤Á¤é¤Ë¤Ï¹ß¤ê¤é¤ì¤Þ¤»¤ó¡£");
2164 msg_print("You cannot go to that direction.");
2169 if (!pattern_seq(py, px, y, x)) return FALSE;
2178 msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
2180 msg_print("There is a monster in the way!");
2188 p_ptr->pet_extra_flags &= ~(PF_RYOUTE);
2189 p_ptr->riding_ryoute = p_ptr->old_riding_ryoute = FALSE;
2193 if (p_ptr->confused)
2196 msg_print("º®Í𤷤Ƥ¤¤Æ¾è¤ì¤Ê¤¤¡ª");
2198 msg_print("You are too confused!");
2203 m_ptr = &m_list[c_ptr->m_idx];
2205 if (!c_ptr->m_idx || !m_ptr->ml)
2208 msg_print("¤½¤Î¾ì½ê¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
2210 msg_print("Here is no monster.");
2215 if (!is_pet(m_ptr) && !force)
2218 msg_print("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Ï¥Ú¥Ã¥È¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£");
2220 msg_print("That monster is not a pet.");
2225 if (!(r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
2228 msg_print("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Ë¤Ï¾è¤ì¤Ê¤µ¤½¤¦¤À¡£");
2230 msg_print("This monster doesn't seem suitable for riding.");
2236 if (!pattern_seq(py, px, y, x)) return FALSE;
2238 if (!player_can_ride_aux(c_ptr, TRUE))
2240 /* Feature code (applying "mimic" field) */
2241 feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)];
2243 msg_format("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Ï%s¤Î%s¤Ë¤¤¤ë¡£", f_name + f_ptr->name,
2244 ((!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) ||
2245 (!have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_TREE))) ?
2248 msg_format("This monster is %s the %s.",
2249 ((!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) ||
2250 (!have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_TREE))) ?
2251 "in" : "on", f_name + f_ptr->name);
2256 if (r_info[m_ptr->r_idx].level > randint1((p_ptr->skill_exp[GINOU_RIDING] / 50 + p_ptr->lev / 2 + 20)))
2259 msg_print("¤¦¤Þ¤¯¾è¤ì¤Ê¤«¤Ã¤¿¡£");
2261 msg_print("You failed to ride.");
2269 if (MON_CSLEEP(m_ptr))
2272 monster_desc(m_name, m_ptr, 0);
2273 (void)set_monster_csleep(c_ptr->m_idx, 0);
2275 msg_format("%s¤òµ¯¤³¤·¤¿¡£", m_name);
2277 msg_format("You have waked %s up.", m_name);
2281 if (p_ptr->action == ACTION_KAMAE) set_action(ACTION_NONE);
2283 p_ptr->riding = c_ptr->m_idx;
2285 /* Hack -- remove tracked monster */
2286 if (p_ptr->riding == p_ptr->health_who) health_track(0);
2291 /* Mega-Hack -- Forget the view and lite */
2292 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2294 /* Update the monsters */
2295 p_ptr->update |= (PU_BONUS);
2298 p_ptr->redraw |= (PR_MAP | PR_EXTRA);
2300 p_ptr->redraw |= (PR_UHEALTH);
2302 /* Move the player */
2303 (void)move_player_effect(y, x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
2309 * @brief ¥Ú¥Ã¥È¤Ë̾Á°¤ò¤Ä¤±¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
2312 static void do_name_pet(void)
2314 monster_type *m_ptr;
2317 bool old_name = FALSE;
2318 bool old_target_pet = target_pet;
2321 if (!target_set(TARGET_KILL))
2323 target_pet = old_target_pet;
2326 target_pet = old_target_pet;
2328 if (cave[target_row][target_col].m_idx)
2330 m_ptr = &m_list[cave[target_row][target_col].m_idx];
2336 msg_print("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Ï¥Ú¥Ã¥È¤Ç¤Ï¤Ê¤¤¡£");
2338 msg_format("This monster is not a pet.");
2342 if (r_info[m_ptr->r_idx].flags1 & RF1_UNIQUE)
2345 msg_print("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Î̾Á°¤ÏÊѤ¨¤é¤ì¤Ê¤¤¡ª");
2347 msg_format("You cannot change name of this monster!");
2351 monster_desc(m_name, m_ptr, 0);
2355 msg_format("%s¤Ë̾Á°¤ò¤Ä¤±¤ë¡£", m_name);
2357 msg_format("Name %s.", m_name);
2362 /* Start with nothing */
2363 strcpy(out_val, "");
2365 /* Use old inscription */
2366 if (m_ptr->nickname)
2368 /* Start with the old inscription */
2369 strcpy(out_val, quark_str(m_ptr->nickname));
2373 /* Get a new inscription (possibly empty) */
2375 if (get_string("̾Á°: ", out_val, 15))
2377 if (get_string("Name: ", out_val, 15))
2383 /* Save the inscription */
2384 m_ptr->nickname = quark_add(out_val);
2385 if (record_named_pet)
2389 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2390 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_NAME, m_name);
2395 if (record_named_pet && old_name)
2399 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2400 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_UNNAME, m_name);
2402 m_ptr->nickname = 0;
2410 * @brief ¥Ú¥Ã¥È¤Ë´Ø¤¹¤ë¥³¥Þ¥ó¥É¥ê¥¹¥È¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2411 * Issue a pet command
2414 void do_cmd_pet(void)
2419 cptr power_desc[36];
2424 monster_type *m_ptr;
2429 char target_buf[160];
2431 int menu_line = use_menu ? 1 : 0;
2436 power_desc[num] = "¥Ú¥Ã¥È¤òÊü¤¹";
2438 power_desc[num] = "dismiss pets";
2441 powers[num++] = PET_DISMISS;
2444 sprintf(target_buf, "¥Ú¥Ã¥È¤Î¥¿¡¼¥²¥Ã¥È¤ò»ØÄê (¸½ºß¡§%s)",
2445 (pet_t_m_idx ? (p_ptr->image ? "²¿¤«´ñ̯¤Êʪ" : (r_name + r_info[m_list[pet_t_m_idx].ap_r_idx].name)) : "»ØÄê¤Ê¤·"));
2447 sprintf(target_buf, "specify a target of pet (now:%s)",
2448 (pet_t_m_idx ? (p_ptr->image ? "something strange" : (r_name + r_info[m_list[pet_t_m_idx].ap_r_idx].name)) : "nothing"));
2450 power_desc[num] = target_buf;
2452 powers[num++] = PET_TARGET;
2455 power_desc[num] = "¶á¤¯¤Ë¤¤¤í";
2457 power_desc[num] = "stay close";
2460 if (p_ptr->pet_follow_distance == PET_CLOSE_DIST) mode = num;
2461 powers[num++] = PET_STAY_CLOSE;
2464 power_desc[num] = "¤Ä¤¤¤ÆÍ褤";
2466 power_desc[num] = "follow me";
2469 if (p_ptr->pet_follow_distance == PET_FOLLOW_DIST) mode = num;
2470 powers[num++] = PET_FOLLOW_ME;
2473 power_desc[num] = "Ũ¤ò¸«¤Ä¤±¤ÆÅݤ»";
2475 power_desc[num] = "seek and destroy";
2478 if (p_ptr->pet_follow_distance == PET_DESTROY_DIST) mode = num;
2479 powers[num++] = PET_SEEK_AND_DESTROY;
2482 power_desc[num] = "¾¯¤·Î¥¤ì¤Æ¤¤¤í";
2484 power_desc[num] = "give me space";
2487 if (p_ptr->pet_follow_distance == PET_SPACE_DIST) mode = num;
2488 powers[num++] = PET_ALLOW_SPACE;
2491 power_desc[num] = "Î¥¤ì¤Æ¤¤¤í";
2493 power_desc[num] = "stay away";
2496 if (p_ptr->pet_follow_distance == PET_AWAY_DIST) mode = num;
2497 powers[num++] = PET_STAY_AWAY;
2499 if (p_ptr->pet_extra_flags & PF_OPEN_DOORS)
2502 power_desc[num] = "¥É¥¢¤ò³«¤±¤ë (¸½ºß:ON)";
2504 power_desc[num] = "pets open doors (now On)";
2510 power_desc[num] = "¥É¥¢¤ò³«¤±¤ë (¸½ºß:OFF)";
2512 power_desc[num] = "pets open doors (now Off)";
2515 powers[num++] = PET_OPEN_DOORS;
2517 if (p_ptr->pet_extra_flags & PF_PICKUP_ITEMS)
2520 power_desc[num] = "¥¢¥¤¥Æ¥à¤ò½¦¤¦ (¸½ºß:ON)";
2522 power_desc[num] = "pets pick up items (now On)";
2528 power_desc[num] = "¥¢¥¤¥Æ¥à¤ò½¦¤¦ (¸½ºß:OFF)";
2530 power_desc[num] = "pets pick up items (now Off)";
2533 powers[num++] = PET_TAKE_ITEMS;
2535 if (p_ptr->pet_extra_flags & PF_TELEPORT)
2538 power_desc[num] = "¥Æ¥ì¥Ý¡¼¥È·ÏËâË¡¤ò»È¤¦ (¸½ºß:ON)";
2540 power_desc[num] = "allow teleport (now On)";
2546 power_desc[num] = "¥Æ¥ì¥Ý¡¼¥È·ÏËâË¡¤ò»È¤¦ (¸½ºß:OFF)";
2548 power_desc[num] = "allow teleport (now Off)";
2551 powers[num++] = PET_TELEPORT;
2553 if (p_ptr->pet_extra_flags & PF_ATTACK_SPELL)
2556 power_desc[num] = "¹¶·âËâË¡¤ò»È¤¦ (¸½ºß:ON)";
2558 power_desc[num] = "allow cast attack spell (now On)";
2564 power_desc[num] = "¹¶·âËâË¡¤ò»È¤¦ (¸½ºß:OFF)";
2566 power_desc[num] = "allow cast attack spell (now Off)";
2569 powers[num++] = PET_ATTACK_SPELL;
2571 if (p_ptr->pet_extra_flags & PF_SUMMON_SPELL)
2574 power_desc[num] = "¾¤´ËâË¡¤ò»È¤¦ (¸½ºß:ON)";
2576 power_desc[num] = "allow cast summon spell (now On)";
2582 power_desc[num] = "¾¤´ËâË¡¤ò»È¤¦ (¸½ºß:OFF)";
2584 power_desc[num] = "allow cast summon spell (now Off)";
2587 powers[num++] = PET_SUMMON_SPELL;
2589 if (p_ptr->pet_extra_flags & PF_BALL_SPELL)
2592 power_desc[num] = "¥×¥ì¥¤¥ä¡¼¤ò´¬¤¹þ¤àÈÏ°ÏËâË¡¤ò»È¤¦ (¸½ºß:ON)";
2594 power_desc[num] = "allow involve player in area spell (now On)";
2600 power_desc[num] = "¥×¥ì¥¤¥ä¡¼¤ò´¬¤¹þ¤àÈÏ°ÏËâË¡¤ò»È¤¦ (¸½ºß:OFF)";
2602 power_desc[num] = "allow involve player in area spell (now Off)";
2605 powers[num++] = PET_BALL_SPELL;
2610 power_desc[num] = "¥Ú¥Ã¥È¤«¤é¹ß¤ê¤ë";
2612 power_desc[num] = "get off a pet";
2618 power_desc[num] = "¥Ú¥Ã¥È¤Ë¾è¤ë";
2620 power_desc[num] = "ride a pet";
2623 powers[num++] = PET_RIDING;
2626 power_desc[num] = "¥Ú¥Ã¥È¤Ë̾Á°¤ò¤Ä¤±¤ë";
2628 power_desc[num] = "name pets";
2631 powers[num++] = PET_NAME;
2635 if ((p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) &&
2636 object_allow_two_hands_wielding(&inventory[INVEN_RARM])) ||
2637 (p_ptr->hidarite && (empty_hands(FALSE) == EMPTY_HAND_RARM) &&
2638 object_allow_two_hands_wielding(&inventory[INVEN_LARM])))
2640 if (p_ptr->pet_extra_flags & PF_RYOUTE)
2643 power_desc[num] = "Éð´ï¤òÊÒ¼ê¤Ç»ý¤Ä";
2645 power_desc[num] = "use one hand to control a riding pet";
2651 power_desc[num] = "Éð´ï¤òξ¼ê¤Ç»ý¤Ä";
2653 power_desc[num] = "use both hands for a weapon";
2657 powers[num++] = PET_RYOUTE;
2661 switch (p_ptr->pclass)
2664 case CLASS_FORCETRAINER:
2665 case CLASS_BERSERKER:
2666 if (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
2668 if (p_ptr->pet_extra_flags & PF_RYOUTE)
2671 power_desc[num] = "ÊÒ¼ê¤Ç³ÊÆ®¤¹¤ë";
2673 power_desc[num] = "use one hand to control a riding pet";
2679 power_desc[num] = "ξ¼ê¤Ç³ÊÆ®¤¹¤ë";
2681 power_desc[num] = "use both hands for melee";
2685 powers[num++] = PET_RYOUTE;
2687 else if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
2689 if (p_ptr->pet_extra_flags & PF_RYOUTE)
2692 power_desc[num] = "³ÊÆ®¤ò¹Ô¤ï¤Ê¤¤";
2694 power_desc[num] = "use one hand to control a riding pet";
2700 power_desc[num] = "³ÊÆ®¤ò¹Ô¤¦";
2702 power_desc[num] = "use one hand for melee";
2706 powers[num++] = PET_RYOUTE;
2714 if (!(repeat_pull(&i) && (i >= 0) && (i < num)))
2716 #endif /* ALLOW_REPEAT */
2718 /* Nothing chosen yet */
2726 /* Save the screen */
2729 /* Build a prompt */
2731 strnfmt(out_val, 78, "(¥³¥Þ¥ó¥É¡¢ESC=½ªÎ») ¥³¥Þ¥ó¥É¤òÁª¤ó¤Ç¤¯¤À¤µ¤¤:");
2733 strnfmt(out_val, 78, "(Command, ESC=exit) Choose command from menu.");
2738 /* Build a prompt */
2739 strnfmt(out_val, 78,
2741 "(¥³¥Þ¥ó¥É %c-%c¡¢'*'=°ìÍ÷¡¢ESC=½ªÎ») ¥³¥Þ¥ó¥É¤òÁª¤ó¤Ç¤¯¤À¤µ¤¤:",
2743 "(Command %c-%c, *=List, ESC=exit) Select a command: ",
2745 I2A(0), I2A(num - 1));
2748 choice = (always_show_list || use_menu) ? ESCAPE : 1;
2750 /* Get a command from the user */
2755 if (choice == ESCAPE) choice = ' ';
2756 else if (!get_com(out_val, &choice, TRUE)) break;
2758 if (use_menu && (choice != ' '))
2769 menu_line += (num - 1);
2798 if (menu_line > num) menu_line -= num;
2801 /* Request redraw */
2802 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
2805 if (!redraw || use_menu)
2813 /* Save the screen */
2814 if (!use_menu) screen_save();
2819 for (ctr = 0; ctr < num; ctr++)
2821 /* Letter/number for power selection */
2823 if (use_menu) sprintf(buf, "%c%s ", (ctr == mode) ? '*' : ' ', (ctr == (menu_line - 1)) ? "¡Õ" : " ");
2825 if (use_menu) sprintf(buf, "%c%s ", (ctr == mode) ? '*' : ' ', (ctr == (menu_line - 1)) ? "> " : " ");
2827 else sprintf(buf, "%c%c) ", (ctr == mode) ? '*' : ' ', I2A(ctr));
2829 strcat(buf, power_desc[ctr]);
2831 prt(buf, y + ctr, x);
2834 prt("", y + MIN(ctr, 17), x);
2843 /* Restore the screen */
2854 ask = (isupper(choice));
2857 if (ask) choice = tolower(choice);
2859 /* Extract request */
2860 i = (islower(choice) ? A2I(choice) : -1);
2863 /* Totally Illegal */
2864 if ((i < 0) || (i >= num))
2875 strnfmt(buf, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡© ", power_desc[i]);
2877 strnfmt(buf, 78, "Use %s? ", power_desc[i]);
2880 /* Belay that order */
2881 if (!get_check(buf)) continue;
2888 /* Restore the screen */
2889 if (redraw) screen_load();
2891 /* Abort if needed */
2901 #endif /* ALLOW_REPEAT */
2905 case PET_DISMISS: /* Dismiss pets */
2907 /* Check pets (backwards) */
2908 for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
2910 /* Player has pet */
2911 if (is_pet(&m_list[pet_ctr])) break;
2917 msg_print("¥Ú¥Ã¥È¤¬¤¤¤Ê¤¤¡ª");
2919 msg_print("You have no pets!");
2923 do_cmd_pet_dismiss();
2924 (void)calculate_upkeep();
2929 project_length = -1;
2930 if (!target_set(TARGET_KILL)) pet_t_m_idx = 0;
2933 cave_type *c_ptr = &cave[target_row][target_col];
2934 if (c_ptr->m_idx && (m_list[c_ptr->m_idx].ml))
2936 pet_t_m_idx = cave[target_row][target_col].m_idx;
2937 p_ptr->pet_follow_distance = PET_DESTROY_DIST;
2939 else pet_t_m_idx = 0;
2946 case PET_STAY_CLOSE:
2948 p_ptr->pet_follow_distance = PET_CLOSE_DIST;
2955 p_ptr->pet_follow_distance = PET_FOLLOW_DIST;
2959 /* "Seek and destoy" */
2960 case PET_SEEK_AND_DESTROY:
2962 p_ptr->pet_follow_distance = PET_DESTROY_DIST;
2965 /* "Give me space" */
2966 case PET_ALLOW_SPACE:
2968 p_ptr->pet_follow_distance = PET_SPACE_DIST;
2974 p_ptr->pet_follow_distance = PET_AWAY_DIST;
2977 /* flag - allow pets to open doors */
2978 case PET_OPEN_DOORS:
2980 if (p_ptr->pet_extra_flags & PF_OPEN_DOORS) p_ptr->pet_extra_flags &= ~(PF_OPEN_DOORS);
2981 else p_ptr->pet_extra_flags |= (PF_OPEN_DOORS);
2984 /* flag - allow pets to pickup items */
2985 case PET_TAKE_ITEMS:
2987 if (p_ptr->pet_extra_flags & PF_PICKUP_ITEMS)
2989 p_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
2990 for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
2992 /* Access the monster */
2993 m_ptr = &m_list[pet_ctr];
2997 monster_drop_carried_objects(m_ptr);
3001 else p_ptr->pet_extra_flags |= (PF_PICKUP_ITEMS);
3005 /* flag - allow pets to teleport */
3008 if (p_ptr->pet_extra_flags & PF_TELEPORT) p_ptr->pet_extra_flags &= ~(PF_TELEPORT);
3009 else p_ptr->pet_extra_flags |= (PF_TELEPORT);
3012 /* flag - allow pets to cast attack spell */
3013 case PET_ATTACK_SPELL:
3015 if (p_ptr->pet_extra_flags & PF_ATTACK_SPELL) p_ptr->pet_extra_flags &= ~(PF_ATTACK_SPELL);
3016 else p_ptr->pet_extra_flags |= (PF_ATTACK_SPELL);
3019 /* flag - allow pets to cast attack spell */
3020 case PET_SUMMON_SPELL:
3022 if (p_ptr->pet_extra_flags & PF_SUMMON_SPELL) p_ptr->pet_extra_flags &= ~(PF_SUMMON_SPELL);
3023 else p_ptr->pet_extra_flags |= (PF_SUMMON_SPELL);
3026 /* flag - allow pets to cast attack spell */
3027 case PET_BALL_SPELL:
3029 if (p_ptr->pet_extra_flags & PF_BALL_SPELL) p_ptr->pet_extra_flags &= ~(PF_BALL_SPELL);
3030 else p_ptr->pet_extra_flags |= (PF_BALL_SPELL);
3036 (void)do_riding(FALSE);
3048 if (p_ptr->pet_extra_flags & PF_RYOUTE) p_ptr->pet_extra_flags &= ~(PF_RYOUTE);
3049 else p_ptr->pet_extra_flags |= (PF_RYOUTE);
3050 p_ptr->update |= (PU_BONUS);