OSDN Git Service

ペット命令メニューを繰り返しコマンドとEnterメニューに対応.
[hengband/hengband.git] / src / cmd5.c
index a74e48e..49e67e2 100644 (file)
@@ -12,8 +12,6 @@
 
 #include "angband.h"
 
-#include "spellstips.h"
-
 cptr spell_category_name(int tval)
 {
        switch (tval)
@@ -29,7 +27,7 @@ cptr spell_category_name(int tval)
                return "¼öʸ";
 #else
        case TV_HISSATSU_BOOK:
-               return "arts";
+               return "art";
        case TV_LIFE_BOOK:
                return "prayer";
        case TV_MUSIC_BOOK:
@@ -51,7 +49,7 @@ cptr spell_category_name(int tval)
  * The "known" should be TRUE for cast/pray, FALSE for study
  */
 
-bool select_the_force=FALSE;
+bool select_the_force = FALSE;
 
 static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm)
 {
@@ -290,11 +288,11 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm
                        jverb1( prompt, jverb_buf );
                        /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½¤ËÂбþ */
                        (void) strnfmt(tmp_val, 78, "%s(MP%d, ¼ºÇÔΨ%d%%)¤ò%s¤Þ¤¹¤«? ",
-                               spell_names[technic2magic(use_realm)-1][spell], need_mana,
+                               do_spell(use_realm, spell, SPELL_NAME), need_mana,
                                       spell_chance(spell, use_realm),jverb_buf);
 #else
                        (void)strnfmt(tmp_val, 78, "%^s %s (%d mana, %d%% fail)? ",
-                               prompt, spell_names[technic2magic(use_realm)-1][spell], need_mana,
+                               prompt, do_spell(use_realm, spell, SPELL_NAME), need_mana,
                                spell_chance(spell, use_realm));
 #endif
 
@@ -361,6 +359,79 @@ static bool item_tester_learn_spell(object_type *o_ptr)
 }
 
 
+static bool player_has_no_spellbooks(void)
+{
+       int         i;
+       object_type *o_ptr;
+
+       for (i = 0; i < INVEN_PACK; i++)
+       {
+               o_ptr = &inventory[i];
+               if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
+       }
+
+       for (i = cave[py][px].o_idx; i; i = o_ptr->next_o_idx)
+       {
+               o_ptr = &o_list[i];
+               if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+static void confirm_use_force(bool browse_only)
+{
+       int  item;
+       char which;
+
+#ifdef ALLOW_REPEAT
+
+       /* Get the item index */
+       if (repeat_pull(&item) && (item == INVEN_FORCE))
+       {
+               browse_only ? do_cmd_mind_browse() : do_cmd_mind();
+               return;
+       }
+
+#endif /* ALLOW_REPEAT */
+
+       /* Show the prompt */
+#ifdef JP
+       prt("('w'Îýµ¤½Ñ, ESC) 'w'¤«ESC¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£ ", 0, 0);
+#else
+       prt("(w for the Force, ESC) Hit 'w' or ESC. ", 0, 0);
+#endif
+
+       while (1)
+       {
+               /* Get a key */
+               which = inkey();
+
+               if (which == ESCAPE) break;
+               else if (which == 'w')
+               {
+
+#ifdef ALLOW_REPEAT
+
+                       repeat_push(INVEN_FORCE);
+
+#endif /* ALLOW_REPEAT */
+
+                       break;
+               }
+       }
+
+       /* Clear the prompt line */
+       prt("", 0, 0);
+
+       if (which == 'w')
+       {
+               browse_only ? do_cmd_mind_browse() : do_cmd_mind();
+       }
+}
+
+
 /*
  * Peruse the spells/prayers in a book
  *
@@ -386,7 +457,7 @@ void do_cmd_browse(void)
        if (!(p_ptr->realm1 || p_ptr->realm2) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE))
        {
 #ifdef JP
-msg_print("ËܤòÆɤळ¤È¤¬¤Ç¤­¤Ê¤¤¡ª");
+               msg_print("ËܤòÆɤळ¤È¤¬¤Ç¤­¤Ê¤¤¡ª");
 #else
                msg_print("You cannot read books!");
 #endif
@@ -399,37 +470,48 @@ msg_print("
                set_action(ACTION_NONE);
        }
 
+       if (p_ptr->pclass == CLASS_FORCETRAINER)
+       {
+               if (player_has_no_spellbooks())
+               {
+                       confirm_use_force(TRUE);
+                       return;
+               }
+               select_the_force = TRUE;
+       }
+
        /* Restrict choices to "useful" books */
        if (p_ptr->realm2 == REALM_NONE) item_tester_tval = mp_ptr->spell_book;
        else item_tester_hook = item_tester_learn_spell;
 
        /* Get an item */
 #ifdef JP
-q = "¤É¤ÎËܤòÆɤߤޤ¹¤«? ";
+       q = "¤É¤ÎËܤòÆɤߤޤ¹¤«? ";
 #else
        q = "Browse which book? ";
 #endif
 
 #ifdef JP
-s = "Æɤá¤ëËܤ¬¤Ê¤¤¡£";
+       s = "Æɤá¤ëËܤ¬¤Ê¤¤¡£";
 #else
        s = "You have no books that you can read.";
 #endif
 
-       if (p_ptr->pclass == CLASS_FORCETRAINER)
-               select_the_force = TRUE;
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))){
-           select_the_force = FALSE;
-           return;
+       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
+       {
+               select_the_force = FALSE;
+               return;
        }
        select_the_force = FALSE;
 
-       if (item == INVEN_FORCE) { /* the_force */
-           do_cmd_mind_browse();
-           return;
-       } else
+       if (item == INVEN_FORCE) /* the_force */
+       {
+               do_cmd_mind_browse();
+               return;
+       }
+
        /* Get the item (in the pack) */
-       if (item >= 0)
+       else if (item >= 0)
        {
                o_ptr = &inventory[item];
        }
@@ -514,7 +596,8 @@ s = "
                Term_erase(14, 12, 255);
                Term_erase(14, 11, 255);
 
-               roff_to_buf(spell_tips[technic2magic(use_realm) - 1][spell], 62, temp, sizeof(temp));
+               roff_to_buf(do_spell(use_realm, spell, SPELL_DESC), 62, temp, sizeof(temp));
+
                for (j = 0, line = 11; temp[j]; j += 1 + strlen(&temp[j]))
                {
                        prt(&temp[j], line, 15);
@@ -777,7 +860,7 @@ msg_format("
                int max_exp = (spell < 32) ? SPELL_EXP_MASTER : SPELL_EXP_EXPERT;
                int old_exp = p_ptr->spell_exp[spell];
                int new_rank = EXP_LEVEL_UNSKILLED;
-               cptr name = spell_names[technic2magic(increment ? p_ptr->realm2 : p_ptr->realm1)-1][spell%32];
+               cptr name = do_spell(increment ? p_ptr->realm2 : p_ptr->realm1, spell%32, SPELL_NAME);
 
                if (old_exp >= max_exp)
                {
@@ -841,16 +924,16 @@ msg_format("
                if (mp_ptr->spell_book == TV_MUSIC_BOOK)
                {
                        msg_format("%s¤ò³Ø¤ó¤À¡£",
-                                   spell_names[technic2magic(increment ? p_ptr->realm2 : p_ptr->realm1)-1][spell % 32]);
+                                   do_spell(increment ? p_ptr->realm2 : p_ptr->realm1, spell % 32, SPELL_NAME));
                }
                else
                {
                        msg_format("%s¤Î%s¤ò³Ø¤ó¤À¡£",
-                                   spell_names[technic2magic(increment ? p_ptr->realm2 : p_ptr->realm1)-1][spell % 32] ,p);
+                                   do_spell(increment ? p_ptr->realm2 : p_ptr->realm1, spell % 32, SPELL_NAME) ,p);
                }
 #else
                msg_format("You have learned the %s of %s.",
-                       p, spell_names[technic2magic(increment ? p_ptr->realm2 : p_ptr->realm1)-1][spell % 32]);
+                       p, do_spell(increment ? p_ptr->realm2 : p_ptr->realm1, spell % 32, SPELL_NAME));
 #endif
        }
 
@@ -910,3740 +993,96 @@ static void wild_magic(int spell)
        if (type < SUMMON_BIZARRE1) type = SUMMON_BIZARRE1;
        else if (type > SUMMON_BIZARRE6) type = SUMMON_BIZARRE6;
 
-       switch (randint1(spell) + randint1(8) + 1)
-       {
-       case 1:
-       case 2:
-       case 3:
-               teleport_player(10, TRUE);
-               break;
-       case 4:
-       case 5:
-       case 6:
-               teleport_player(100, TRUE);
-               break;
-       case 7:
-       case 8:
-               teleport_player(200, TRUE);
-               break;
-       case 9:
-       case 10:
-       case 11:
-               unlite_area(10, 3);
-               break;
-       case 12:
-       case 13:
-       case 14:
-               lite_area(damroll(2, 3), 2);
-               break;
-       case 15:
-               destroy_doors_touch();
-               break;
-       case 16: case 17:
-               wall_breaker();
-       case 18:
-               sleep_monsters_touch();
-               break;
-       case 19:
-       case 20:
-               trap_creation(py, px);
-               break;
-       case 21:
-       case 22:
-               door_creation();
-               break;
-       case 23:
-       case 24:
-       case 25:
-               aggravate_monsters(0);
-               break;
-       case 26:
-               earthquake(py, px, 5);
-               break;
-       case 27:
-       case 28:
-               (void)gain_random_mutation(0);
-               break;
-       case 29:
-       case 30:
-               apply_disenchant(1);
-               break;
-       case 31:
-               lose_all_info();
-               break;
-       case 32:
-               fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
-               break;
-       case 33:
-               wall_stone();
-               break;
-       case 34:
-       case 35:
-               while (counter++ < 8)
-               {
-                       (void)summon_specific(0, py, px, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
-               }
-               break;
-       case 36:
-       case 37:
-               activate_hi_summon(py, px, FALSE);
-               break;
-       case 38:
-               (void)summon_cyber(-1, py, px);
-               break;
-       default:
-               {
-                       int count = 0;
-                       (void)activate_ty_curse(FALSE, &count);
-                       break;
-               }
-       }
-
-       return;
-}
-
-
-static bool cast_life_spell(int spell)
-{
-       int     dir;
-       int     plev = p_ptr->lev;
-
-       switch (spell)
-       {
-       case 0: /* Cure Light Wounds */
-               (void)hp_player(damroll(2, 10));
-               (void)set_cut(p_ptr->cut - 10);
-               break;
-       case 1: /* Bless */
-               (void)set_blessed(randint1(12) + 12, FALSE);
-               break;
-       case 2: /* Make Light Wounds */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball_hide(GF_WOUNDS, dir, damroll(3 + ((plev - 1) / 5), 4), 0);
-               break;
-       case 3: /* Call Light */
-               (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
-               break;
-       case 4: /* Detect Traps + Secret Doors */
-               (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
-               (void)detect_doors(DETECT_RAD_DEFAULT);
-               (void)detect_stairs(DETECT_RAD_DEFAULT);
-               break;
-       case 5: /* Cure Medium Wounds */
-               (void)hp_player(damroll(4, 10));
-               (void)set_cut((p_ptr->cut / 2) - 20);
-               break;
-       case 6: /* Cure Poison */
-               (void)set_poisoned(0);
-               break;
-       case 7: /* Satisfy Hunger */
-               (void)set_food(PY_FOOD_MAX - 1);
-               break;
-       case 8: /* Remove Curse */
-               if (remove_curse())
-               {
-#ifdef JP
-                       msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
-#else
-                       msg_print("You feel as if someone is watching over you.");
-#endif
-               }
-               break;
-       case 9: /* Make Medium Wounds */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball_hide(GF_WOUNDS, dir, damroll(8 + ((plev - 5) / 4), 8), 0);
-               break;
-       case 10: /* Cure Critical Wounds */
-               (void)hp_player(damroll(8, 10));
-               (void)set_stun(0);
-               (void)set_cut(0);
-               break;
-       case 11:
-               (void)set_oppose_cold(randint1(20) + 20, FALSE);
-               (void)set_oppose_fire(randint1(20) + 20, FALSE);
-               break;
-       case 12:
-               map_area(DETECT_RAD_MAP);
-               break;
-       case 13:
-               (void)turn_undead();
-               break;
-       case 14: /* Healing */
-               (void)hp_player(300);
-               (void)set_stun(0);
-               (void)set_cut(0);
-               break;
-       case 15: /* Glyph of Warding */
-               warding_glyph();
-               break;
-       case 16: /* Dispel Curse */
-               if (remove_all_curse())
-               {
-#ifdef JP
-                       msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
-#else
-                       msg_print("You feel as if someone is watching over you.");
-#endif
-               }
-               break;
-       case 17: /* Perception */
-               return ident_spell(FALSE);
-       case 18: /* Dispel Undead */
-               (void)dispel_undead(randint1(plev * 5));
-               break;
-       case 19: /* 'Day of the Dove' */
-               charm_monsters(plev * 2);
-               break;
-       case 20: /* Make Critical Wounds */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball_hide(GF_WOUNDS, dir, damroll(5+((plev - 5) / 3), 15), 0);
-               break;
-       case 21: /* Word of Recall */
-               return word_of_recall();
-       case 22: /* Alter Reality */
-               alter_reality();
-               break;
-       case 23: /* Warding True */
-               warding_glyph();
-               glyph_creation();
-               break;
-       case 24:
-               num_repro += MAX_REPRO;
-               break;
-       case 25: /* Detection True */
-               (void)detect_all(DETECT_RAD_DEFAULT);
-               break;
-       case 26: /* Genocide Undead */
-               (void)mass_genocide_undead(plev+50,TRUE);
-               break;
-       case 27: /* Clairvoyance */
-               wiz_lite(FALSE);
-               break;
-       case 28: /* Restoration */
-               (void)do_res_stat(A_STR);
-               (void)do_res_stat(A_INT);
-               (void)do_res_stat(A_WIS);
-               (void)do_res_stat(A_DEX);
-               (void)do_res_stat(A_CON);
-               (void)do_res_stat(A_CHR);
-               (void)restore_level();
-               break;
-       case 29: /* Healing True */
-               (void)hp_player(2000);
-               (void)set_stun(0);
-               (void)set_cut(0);
-               break;
-       case 30: /* Holy Vision */
-               return identify_fully(FALSE);
-       case 31: /* Ultimate resistance */
-       {
-               int v = randint1(plev/2)+plev/2;
-               (void)set_fast(v, FALSE);
-               set_oppose_acid(v, FALSE);
-               set_oppose_elec(v, FALSE);
-               set_oppose_fire(v, FALSE);
-               set_oppose_cold(v, FALSE);
-               set_oppose_pois(v, FALSE);
-               set_ultimate_res(v, FALSE);
-               break;
-       }
-       default:
-#ifdef JP
-msg_format("¤¢¤Ê¤¿¤ÏÉÔÌÀ¤Ê¥é¥¤¥Õ¤Î¼öʸ %d ¤ò¾§¤¨¤¿¡£", spell);
-#else
-               msg_format("You cast an unknown Life spell: %d.", spell);
-#endif
-
-               msg_print(NULL);
-       }
-
-       return TRUE;
-}
-
-
-
-static bool cast_sorcery_spell(int spell)
-{
-       int     dir;
-       int     plev = p_ptr->lev;
-
-       switch (spell)
-       {
-       case 0: /* Detect Monsters */
-               (void)detect_monsters_normal(DETECT_RAD_DEFAULT);
-               break;
-       case 1: /* Phase Door */
-               teleport_player(10, FALSE);
-               break;
-       case 2: /* Detect Doors and Traps */
-               (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
-               (void)detect_doors(DETECT_RAD_DEFAULT);
-               (void)detect_stairs(DETECT_RAD_DEFAULT);
-               break;
-       case 3: /* Light Area */
-               (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
-               break;
-       case 4: /* Confuse Monster */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)confuse_monster(dir, (plev * 3) / 2);
-               break;
-       case 5: /* Teleport */
-               teleport_player(plev * 5, FALSE);
-               break;
-       case 6: /* Sleep Monster */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)sleep_monster(dir);
-               break;
-       case 7: /* Recharging */
-               return recharge(plev * 4);
-       case 8: /* Magic Mapping */
-               map_area(DETECT_RAD_MAP);
-               break;
-       case 9: /* Identify */
-               return ident_spell(FALSE);
-       case 10: /* Slow Monster */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)slow_monster(dir);
-               break;
-       case 11: /* Mass Sleep */
-               (void)sleep_monsters();
-               break;
-       case 12: /* Teleport Away */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)fire_beam(GF_AWAY_ALL, dir, plev);
-               break;
-       case 13: /* Haste Self */
-               (void)set_fast(randint1(20 + plev) + plev, FALSE);
-               break;
-       case 14: /* Detection True */
-               (void)detect_all(DETECT_RAD_DEFAULT);
-               break;
-       case 15: /* Identify True */
-               return identify_fully(FALSE);
-       case 16: /* Detect Objects and Treasure*/
-               (void)detect_objects_normal(DETECT_RAD_DEFAULT);
-               (void)detect_treasure(DETECT_RAD_DEFAULT);
-               (void)detect_objects_gold(DETECT_RAD_DEFAULT);
-               break;
-       case 17: /* Charm Monster */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)charm_monster(dir, plev);
-               break;
-       case 18: /* Sense Minds */
-               (void)set_tim_esp(randint1(30) + 25, FALSE);
-               break;
-       case 19: /* Teleport to town */
-               return tele_town();
-       case 20: /* Self knowledge */
-               (void)self_knowledge();
-               break;
-       case 21: /* Teleport Level */
-#ifdef JP
-               if (!get_check("ËÜÅö¤Ë¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©")) return FALSE;
-#else
-               if (!get_check("Are you sure? (Teleport Level)")) return FALSE;
-#endif
-               (void)teleport_level(0);
-               break;
-       case 22: /* Word of Recall */
-               return word_of_recall();
-       case 23: /* Dimension Door */
-#ifdef JP
-msg_print("¼¡¸µ¤ÎÈ⤬³«¤¤¤¿¡£ÌÜŪÃϤòÁª¤ó¤Ç²¼¤µ¤¤¡£");
-#else
-               msg_print("You open a dimensional gate. Choose a destination.");
-#endif
-
-               return dimension_door();
-       case 24: /* Probing */
-               (void)probing();
-               break;
-       case 25: /* Explosive Rune */
-               explosive_rune();
-               break;
-       case 26: /* Telekinesis */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fetch(dir, plev * 15, FALSE);
-               break;
-       case 27: /* Clairvoyance */
-               chg_virtue(V_KNOWLEDGE, 1);
-               chg_virtue(V_ENLIGHTEN, 1);
-
-               wiz_lite(FALSE);
-               if (!(p_ptr->telepathy))
-               {
-                       (void)set_tim_esp(randint1(30) + 25, FALSE);
-               }
-               break;
-       case 28: /* Charm Monsters */
-               charm_monsters(plev * 2);
-               break;
-       case 29: /* Alchemy */
-               return alchemy();
-       case 30: /* Banish */
-               banish_monsters(plev * 4);
-               break;
-       case 31: /* Globe of Invulnerability */
-               (void)set_invuln(randint1(4) + 4, FALSE);
-               break;
-       default:
-#ifdef JP
-msg_format("¤¢¤Ê¤¿¤ÏÉÔÌÀ¤Ê¥½¡¼¥µ¥ê¡¼¤Î¼öʸ %d ¤ò¾§¤¨¤¿¡£", spell);
-#else
-               msg_format("You cast an unknown Sorcery spell: %d.", spell);
-#endif
-
-               msg_print(NULL);
-       }
-
-       return TRUE;
-}
-
-
-static bool cast_nature_spell(int spell)
-{
-       int         dir;
-       int         beam;
-       int         plev = p_ptr->lev;
-
-       if (p_ptr->pclass == CLASS_MAGE) beam = plev;
-       else if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) beam = plev + 10;
-       else beam = plev / 2;
-
-       switch (spell)
-       {
-       case 0: /* Detect Creatures */
-               (void)detect_monsters_normal(DETECT_RAD_DEFAULT);
-               break;
-       case 1: /* Lightning Bolt */
-               project_length = plev / 6 + 2;
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_beam(GF_ELEC, dir,
-                       damroll(3 + ((plev - 1) / 5), 4));
-               break;
-       case 2: /* Detect Doors & Traps */
-               (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
-               (void)detect_doors(DETECT_RAD_DEFAULT);
-               (void)detect_stairs(DETECT_RAD_DEFAULT);
-               break;
-       case 3: /* Produce Food */
-       {
-               object_type forge, *q_ptr = &forge;
-
-#ifdef JP
-               msg_print("¿©ÎÁ¤òÀ¸À®¤·¤¿¡£");
-#else
-               msg_print("A food ration is produced.");
-#endif
-
-               /* Create the food ration */
-               object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
-
-               /* Drop the object from heaven */
-               (void)drop_near(q_ptr, -1, py, px);
-               break;
-
-       }
-       case 4: /* Daylight */
-               (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
-               if ((prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE)) && !p_ptr->resist_lite)
-               {
-#ifdef JP
-msg_print("Æü¤Î¸÷¤¬¤¢¤Ê¤¿¤ÎÆùÂΤò¾Ç¤¬¤·¤¿¡ª");
-#else
-                       msg_print("The daylight scorches your flesh!");
-#endif
-
-#ifdef JP
-take_hit(DAMAGE_NOESCAPE, damroll(2, 2), "Æü¤Î¸÷", -1);
-#else
-                       take_hit(DAMAGE_NOESCAPE, damroll(2, 2), "daylight", -1);
-#endif
-
-               }
-               break;
-       case 5: /* Animal Taming */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)charm_animal(dir, plev);
-               break;
-       case 6: /* Resist Environment */
-               (void)set_oppose_cold(randint1(20) + 20, FALSE);
-               (void)set_oppose_fire(randint1(20) + 20, FALSE);
-               (void)set_oppose_elec(randint1(20) + 20, FALSE);
-               break;
-       case 7: /* Cure Wounds & Poison */
-               (void)hp_player(damroll(2, 8));
-               (void)set_cut(0);
-               (void)set_poisoned(0);
-               break;
-       case 8: /* Stone to Mud */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)wall_to_mud(dir);
-               break;
-       case 9: /* Frost Bolt */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt_or_beam(beam - 10, GF_COLD, dir,
-                       damroll(3 + ((plev - 5) / 4), 8));
-               break;
-       case 10: /* Nature Awareness -- downgraded */
-               map_area(DETECT_RAD_MAP);
-               (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
-               (void)detect_doors(DETECT_RAD_DEFAULT);
-               (void)detect_stairs(DETECT_RAD_DEFAULT);
-               (void)detect_monsters_normal(DETECT_RAD_DEFAULT);
-               break;
-       case 11: /* Fire Bolt */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt_or_beam(beam - 10, GF_FIRE, dir,
-                       damroll(5 + ((plev - 5) / 4), 8));
-               break;
-       case 12: /* Ray of Sunlight */
-               if (!get_aim_dir(&dir)) return FALSE;
-#ifdef JP
-msg_print("ÂÀÍÛ¸÷Àþ¤¬¸½¤ì¤¿¡£");
-#else
-               msg_print("A line of sunlight appears.");
-#endif
-
-               (void)lite_line(dir);
-               break;
-       case 13: /* Entangle */
-               slow_monsters();
-               break;
-       case 14: /* Summon Animals */
-               if (!(summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET))))
-               {
-#ifdef JP
-                       msg_print("ưʪ¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
-#else
-                       msg_print("No animals arrive.");
-#endif
-               }
-               break;
-       case 15: /* Herbal Healing */
-               (void)hp_player(500);
-               (void)set_stun(0);
-               (void)set_cut(0);
-               (void)set_poisoned(0);
-               break;
-       case 16: /* Stair Building */
-               (void)stair_creation();
-               break;
-       case 17: /* Stone Skin */
-               (void)set_shield(randint1(20) + 30, FALSE);
-               break;
-       case 18: /* Resistance True */
-               (void)set_oppose_acid(randint1(20) + 20, FALSE);
-               (void)set_oppose_elec(randint1(20) + 20, FALSE);
-               (void)set_oppose_fire(randint1(20) + 20, FALSE);
-               (void)set_oppose_cold(randint1(20) + 20, FALSE);
-               (void)set_oppose_pois(randint1(20) + 20, FALSE);
-               break;
-       case 19: /* Tree Creation */
-               (void)tree_creation();
-               break;
-       case 20: /* Animal Friendship */
-               (void)charm_animals(plev * 2);
-               break;
-       case 21: /* Stone Tell */
-               return identify_fully(FALSE);
-       case 22: /* Wall of Stone */
-               (void)wall_stone();
-               break;
-       case 23: /* Protection from Corrosion */
-               return rustproof();
-       case 24: /* Earthquake */
-               earthquake(py, px, 10);
-               break;
-       case 25: /* Whirlwind Attack */
-               {
-                       int y = 0, x = 0;
-                       cave_type       *c_ptr;
-                       monster_type    *m_ptr;
-
-                       for (dir = 0; dir < 8; dir++)
-                       {
-                               y = py + ddy_ddd[dir];
-                               x = px + ddx_ddd[dir];
-                               c_ptr = &cave[y][x];
-
-                               /* Get the monster */
-                               m_ptr = &m_list[c_ptr->m_idx];
-
-                               /* Hack -- attack monsters */
-                               if (c_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))
-                                       py_attack(y, x, 0);
-                       }
-               }
-               break;
-       case 26: /* Blizzard */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_COLD, dir, 70 + plev * 3 / 2, (plev / 12) + 1);
-               break;
-       case 27: /* Lightning Storm */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_ELEC, dir, 90 + plev * 3 / 2, (plev / 12) + 1);
-               break;
-       case 28: /* Whirlpool */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_WATER, dir, 100 + plev * 3 / 2, (plev / 12) + 1);
-               break;
-       case 29: /* Call Sunlight */
-               fire_ball(GF_LITE, 0, 150, 8);
-               chg_virtue(V_KNOWLEDGE, 1);
-               chg_virtue(V_ENLIGHTEN, 1);
-               wiz_lite(FALSE);
-               if ((prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE)) && !p_ptr->resist_lite)
-               {
-#ifdef JP
-msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤ÎÆùÂΤò¾Ç¤¬¤·¤¿¡ª");
-#else
-                       msg_print("The sunlight scorches your flesh!");
-#endif
-
-#ifdef JP
-take_hit(DAMAGE_NOESCAPE, 50, "Æü¸÷", -1);
-#else
-                       take_hit(DAMAGE_NOESCAPE, 50, "sunlight", -1);
-#endif
-
-               }
-               break;
-       case 30: /* Elemental Branding */
-               brand_weapon(randint0(2));
-               break;
-       case 31: /* Nature's Wrath */
-               (void)dispel_monsters(plev * 4);
-               earthquake(py, px, 20 + (plev / 2));
-               project(0, 1 + plev / 12, py, px,
-                       (100 + plev) * 2, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
-               break;
-       default:
-#ifdef JP
-msg_format("¤¢¤Ê¤¿¤ÏÉÔÌÀ¤Ê¥Í¥¤¥Á¥ã¡¼¤Î¼öʸ %d ¤ò¾§¤¨¤¿¡£", spell);
-#else
-               msg_format("You cast an unknown Nature spell: %d.", spell);
-#endif
-
-               msg_print(NULL);
-       }
-
-       return TRUE;
-}
-
-
-static bool cast_chaos_spell(int spell)
-{
-       int     dir, i, beam;
-       int     plev = p_ptr->lev;
-
-       if (p_ptr->pclass == CLASS_MAGE) beam = plev;
-       else if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) beam = plev + 10;
-       else beam = plev / 2;
-
-       switch (spell)
-       {
-       case 0: /* Magic Missile */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam - 10, GF_MISSILE, dir,
-                       damroll(3 + ((plev - 1) / 5), 4));
-               break;
-       case 1: /* Trap / Door destruction */
-               (void)destroy_doors_touch();
-               break;
-       case 2: /* Flash of Light == Light Area */
-               (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
-               break;
-       case 3: /* Touch of Confusion */
-               if (!(p_ptr->special_attack & ATTACK_CONFUSE))
-               {
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Î¼ê¤Ï¸÷¤ê»Ï¤á¤¿¡£");
-#else
-                       msg_print("Your hands start glowing.");
-#endif
-
-                       p_ptr->special_attack |= ATTACK_CONFUSE;
-                       p_ptr->redraw |= (PR_STATUS);
-               }
-               break;
-       case 4: /* Mana Burst */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_MISSILE, dir,
-                       (damroll(3, 5) + plev +
-                       (plev / (((p_ptr->pclass == CLASS_MAGE)
-                       || (p_ptr->pclass == CLASS_HIGH_MAGE)
-                       || (p_ptr->pclass == CLASS_SORCERER)) ? 2 : 4))),
-                       ((plev < 30) ? 2 : 3));
-                       /* Shouldn't actually use GF_MANA, as it will destroy all
-                        * items on the floor */
-               break;
-       case 5: /* Fire Bolt */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam, GF_FIRE, dir,
-                       damroll(8 + ((plev - 5) / 4), 8));
-               break;
-       case 6: /* Fist of Force ("Fist of Fun") */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_DISINTEGRATE, dir,
-                       damroll(8 + ((plev - 5) / 4), 8), 0);
-               break;
-       case 7: /* Teleport Self */
-               teleport_player(plev * 5, FALSE);
-               break;
-       case 8: /* Wonder */
-               {
-               /* This spell should become more useful (more
-               controlled) as the player gains experience levels.
-               Thus, add 1/5 of the player's level to the die roll.
-               This eliminates the worst effects later on, while
-               keeping the results quite random.  It also allows
-                       some potent effects only at high level. */
-
-                       int die = randint1(100) + plev / 5;
-                       int vir = virtue_number(V_CHANCE);
-                       if (vir)
-                       {
-                               if (p_ptr->virtues[vir - 1] > 0)
-                               {
-                                       while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
-                               }
-                               else
-                               {
-                                       while (randint1(400) < (0-p_ptr->virtues[vir - 1])) die--;
-                               }
-                       }
-
-                       if (die < 26)
-                               chg_virtue(V_CHANCE, 1);
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       if (die > 100)
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤ÏÎϤ¬¤ß¤Ê¤®¤ë¤Î¤ò´¶¤¸¤¿¡ª");
-#else
-                               msg_print("You feel a surge of power!");
-#endif
-
-                       if (die < 8) clone_monster(dir);
-                       else if (die < 14) speed_monster(dir);
-                       else if (die < 26) heal_monster(dir, damroll(4, 6));
-                       else if (die < 31) poly_monster(dir);
-                       else if (die < 36)
-                               fire_bolt_or_beam(beam - 10, GF_MISSILE, dir,
-                                   damroll(3 + ((plev - 1) / 5), 4));
-                       else if (die < 41) confuse_monster(dir, plev);
-                       else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
-                       else if (die < 51) (void)lite_line(dir);
-                       else if (die < 56)
-                               fire_bolt_or_beam(beam - 10, GF_ELEC, dir,
-                                   damroll(3 + ((plev - 5) / 4), 8));
-                       else if (die < 61)
-                               fire_bolt_or_beam(beam - 10, GF_COLD, dir,
-                                   damroll(5 + ((plev - 5) / 4), 8));
-                       else if (die < 66)
-                               fire_bolt_or_beam(beam, GF_ACID, dir,
-                                   damroll(6 + ((plev - 5) / 4), 8));
-                       else if (die < 71)
-                               fire_bolt_or_beam(beam, GF_FIRE, dir,
-                                   damroll(8 + ((plev - 5) / 4), 8));
-                       else if (die < 76) drain_life(dir, 75);
-                       else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
-                       else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
-                       else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
-                       else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
-                       else if (die < 101) drain_life(dir, 100 + plev);
-                       else if (die < 104)
-                       {
-                               earthquake(py, px, 12);
-                       }
-                       else if (die < 106)
-                       {
-                               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
-                       }
-                       else if (die < 108)
-                       {
-                               symbol_genocide(plev+50, TRUE);
-                       }
-                       else if (die < 110) dispel_monsters(120);
-                       else /* RARE */
-                       {
-                               dispel_monsters(150);
-                               slow_monsters();
-                               sleep_monsters();
-                               hp_player(300);
-                       }
-               }
-               break;
-       case 9: /* Chaos Bolt */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam, GF_CHAOS, dir,
-                       damroll(10 + ((plev - 5) / 4), 8));
-               break;
-       case 10: /* Sonic Boom */
-#ifdef JP
-msg_print("¥É¡¼¥ó¡ªÉô²°¤¬Íɤ줿¡ª");
-#else
-               msg_print("BOOM! Shake the room!");
-#endif
-
-               project(0, plev / 10 + 2, py, px,
-                       (60 + plev), GF_SOUND, PROJECT_KILL | PROJECT_ITEM, -1);
-               break;
-       case 11: /* Doom Bolt -- always beam in 2.0.7 or later */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_beam(GF_MANA, dir, damroll(11 + ((plev - 5) / 4), 8));
-               break;
-       case 12: /* Fire Ball */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_FIRE, dir, plev + 55, 2);
-               break;
-       case 13: /* Teleport Other */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)fire_beam(GF_AWAY_ALL, dir, plev);
-               break;
-       case 14: /* Word of Destruction */
-               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
-               break;
-       case 15: /* Invoke Logrus */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_CHAOS, dir, plev*2 + 99, plev / 5);
-               break;
-       case 16: /* Polymorph Other */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)poly_monster(dir);
-               break;
-       case 17: /* Chain Lightning */
-               for (dir = 0; dir <= 9; dir++)
-                       fire_beam(GF_ELEC, dir, damroll(5 + (plev / 10), 8));
-               break;
-       case 18: /* Arcane Binding == Charging */
-               return recharge(90);
-       case 19: /* Disintegration */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_DISINTEGRATE, dir, plev + 70, 3 + plev / 40);
-               break;
-       case 20: /* Alter Reality */
-               alter_reality();
-               break;
-       case 21: /* Magic Rocket */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-#ifdef JP
-msg_print("¥í¥±¥Ã¥Èȯ¼Í¡ª");
-#else
-               msg_print("You launch a rocket!");
-#endif
-
-               fire_rocket(GF_ROCKET, dir, 120 + plev*2, 2);
-               break;
-       case 22: /* Chaos Branding */
-               brand_weapon(2);
-               break;
-       case 23: /* Summon monster, demon */
-               {
-                       u32b mode = 0L;
-                       bool pet = !one_in_(3);
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= PM_NO_PET;
-                       if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
-
-                       if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, SUMMON_DEMON, mode))
-                       {
-#ifdef JP
-msg_print("ⲫ¤Î°­½­¤¬½¼Ëþ¤·¤¿¡£");
-#else
-                               msg_print("The area fills with a stench of sulphur and brimstone.");
-#endif
-
-
-                               if (pet)
-#ifdef JP
-msg_print("¡Ö¤´ÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¤´¼ç¿ÍÍÍ¡×");
-#else
-                                       msg_print("'What is thy bidding... Master?'");
-#endif
-
-                               else
-#ifdef JP
-msg_print("¡ÖÈܤ·¤­¼Ô¤è¡¢²æ¤ÏÆò¤Î²¼Ëͤˤ¢¤é¤º¡ª ¤ªÁ°¤Îº²¤òĺ¤¯¤¾¡ª¡×");
-#else
-                                       msg_print("'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'");
-#endif
-
-                       }
-                       break;
-               }
-       case 24: /* Beam of Gravity */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_beam(GF_GRAVITY, dir, damroll(9 + ((plev - 5) / 4), 8));
-               break;
-       case 25: /* Meteor Swarm  */
-               {
-                       int x, y, dx, dy;
-                       int b = 10 + randint1(10);
-                       for (i = 0; i < b; i++)
-                       {
-                               int count = 0, d = 0;
-
-                               while (1)
-                               {
-                                       count++;
-                                       if (count > 20) break;
-                                       x = px - 8 + randint0(17);
-                                       y = py - 8 + randint0(17);
-
-                                       if (!in_bounds(y, x) || !projectable(py, px, y, x)) continue;
-
-                                       dx = (px > x) ? (px - x) : (x - px);
-                                       dy = (py > y) ? (py - y) : (y - py);
-
-                                       /* Approximate distance */
-                                       d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
-                                       if (d < 9) break;
-                               }
-
-                               if (count > 20) continue;
-
-                               project(0, 2, y, x, plev * 2, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
-                       }
-               }
-               break;
-       case 26: /* Flame Strike */
-               fire_ball(GF_FIRE, 0, 300 + (3 * plev), 8);
-               break;
-       case 27: /* Call Chaos */
-               call_chaos();
-               break;
-       case 28: /* Polymorph Self */
-#ifdef JP
-               if (!get_check("ÊѿȤ·¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) return FALSE;
-#else
-               if (!get_check("You will polymorph yourself. Are you sure? ")) return FALSE;
-#endif
-               do_poly_self();
-               break;
-       case 29: /* Mana Storm */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_MANA, dir, 300 + (plev * 4), 4);
-               break;
-       case 30: /* Breathe Logrus */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_CHAOS, dir, p_ptr->chp, 2);
-               break;
-       case 31: /* Call the Void */
-               call_the_();
-               break;
-       default:
-#ifdef JP
-msg_format("¤¢¤Ê¤¿¤ÏÉÔÌÀ¤Ê¥«¥ª¥¹¤Î¼öʸ %d ¤ò¾§¤¨¤¿¡£", spell);
-#else
-               msg_format("You cast an unknown Chaos spell: %d.", spell);
-#endif
-
-               msg_print(NULL);
-       }
-
-       return TRUE;
-}
-
-
-static bool cast_death_spell(int spell)
-{
-       int     dir;
-       int     beam;
-       int     plev = p_ptr->lev;
-       int     dummy = 0;
-
-       if (p_ptr->pclass == CLASS_MAGE) beam = plev;
-       else if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) beam = plev + 10;
-       else beam = plev / 2;
-
-       switch (spell)
-       {
-       case 0: /* Detect Undead & Demons -> Unlife */
-               (void)detect_monsters_nonliving(DETECT_RAD_DEFAULT);
-               break;
-       case 1: /* Malediction */
-               if (!get_aim_dir(&dir)) return FALSE;
-               /* A radius-0 ball may (1) be aimed at objects etc.,
-                * and will affect them; (2) may be aimed at ANY
-                * visible monster, unlike a 'bolt' which must travel
-                * to the monster. */
-
-               fire_ball(GF_HELL_FIRE, dir,
-                       damroll(3 + ((plev - 1) / 5), 4), 0);
-
-               if (one_in_(5))
-               {   /* Special effect first */
-                       dummy = randint1(1000);
-                       if (dummy == 666)
-                               fire_ball_hide(GF_DEATH_RAY, dir, plev * 200, 0);
-                       else if (dummy < 500)
-                               fire_ball_hide(GF_TURN_ALL, dir, plev, 0);
-                       else if (dummy < 800)
-                               fire_ball_hide(GF_OLD_CONF, dir, plev, 0);
-                       else
-                               fire_ball_hide(GF_STUN, dir, plev, 0);
-               }
-               break;
-       case 2: /* Detect Evil */
-               (void)detect_monsters_evil(DETECT_RAD_DEFAULT);
-               break;
-       case 3: /* Stinking Cloud */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_POIS, dir, 10 + (plev / 2), 2);
-               break;
-       case 4: /* Black Sleep */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)sleep_monster(dir);
-               break;
-       case 5: /* Resist Poison */
-               (void)set_oppose_pois(randint1(20) + 20, FALSE);
-               break;
-       case 6: /* Horrify */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)fear_monster(dir, plev);
-               (void)stun_monster(dir, plev);
-               break;
-       case 7: /* Enslave Undead */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)control_one_undead(dir, plev);
-               break;
-       case 8: /* Orb of Entropy */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_OLD_DRAIN, dir,
-                       (damroll(3, 6) + plev +
-                       (plev / (((p_ptr->pclass == CLASS_MAGE) ||
-                       (p_ptr->pclass == CLASS_HIGH_MAGE) ||
-                       (p_ptr->pclass == CLASS_SORCERER)) ? 2 : 4))),
-                       ((plev < 30) ? 2 : 3));
-               break;
-       case 9: /* Nether Bolt */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam, GF_NETHER, dir,
-                   damroll(8 + ((plev - 5) / 4), 8));
-               break;
-       case 10: /* Cloud kill */
-               project(0, plev / 10 + 2, py, px,
-                       (30 + plev) * 2, GF_POIS, PROJECT_KILL | PROJECT_ITEM, -1);
-               break;
-       case 11: /* Genocide One */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball_hide(GF_GENOCIDE, dir, plev + 50, 0);
-               break;
-       case 12: /* Poison Branding */
-               brand_weapon(3);
-               break;
-       case 13: /* Vampiric Drain */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               dummy = plev * 2 + randint1(plev * 2);   /* Dmg */
-               if (drain_life(dir, dummy))
-               {
-                       chg_virtue(V_SACRIFICE, -1);
-                       chg_virtue(V_VITALITY, -1);
-
-                       (void)hp_player(dummy);
-                       /* Gain nutritional sustenance: 150/hp drained */
-                       /* A Food ration gives 5000 food points (by contrast) */
-                       /* Don't ever get more than "Full" this way */
-                       /* But if we ARE Gorged,  it won't cure us */
-                       dummy = p_ptr->food + MIN(5000, 100 * dummy);
-                       if (p_ptr->food < PY_FOOD_MAX)   /* Not gorged already */
-                               (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
-               }
-               break;
-       case 14: /* Animate Dead */
-               animate_dead(0, py, px);
-               break;
-       case 15: /* Genocide */
-               (void)symbol_genocide(plev+50, TRUE);
-               break;
-       case 16: /* Berserk */
-               (void)set_shero(randint1(25) + 25, FALSE);
-               (void)hp_player(30);
-               (void)set_afraid(0);
-               break;
-       case 17: /* Invoke Spirits */
-               {
-                       int die = randint1(100) + plev / 5;
-                       int vir = virtue_number(V_CHANCE);
-                       if (vir)
-                       {
-                               if (p_ptr->virtues[vir - 1] > 0)
-                               {
-                                       while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
-                               }
-                               else
-                               {
-                                       while (randint1(400) < (0-p_ptr->virtues[vir - 1])) die--;
-                               }
-                       }
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï»à¼Ô¤¿¤Á¤ÎÎϤò¾·½¸¤·¤¿...");
-#else
-                       msg_print("You call on the power of the dead...");
-#endif
-                       if (die < 26)
-                               chg_virtue(V_CHANCE, 1);
-
-                       if (die > 100)
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¤ª¤É¤í¤ª¤É¤í¤·¤¤ÎϤΤ¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
-#else
-                               msg_print("You feel a surge of eldritch force!");
-#endif
-
-
-                       if (die < 8)
-                       {
-#ifdef JP
-msg_print("¤Ê¤ó¤Æ¤³¤Ã¤¿¡ª¤¢¤Ê¤¿¤Î¼þ¤ê¤ÎÃÏÌ̤«¤éµà¤Á¤¿¿Í±Æ¤¬Î©¤Á¾å¤¬¤Ã¤Æ¤­¤¿¡ª");
-#else
-                               msg_print("Oh no! Mouldering forms rise from the earth around you!");
-#endif
-
-                               (void)summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                               chg_virtue(V_UNLIFE, 1);
-                       }
-                       else if (die < 14)
-                       {
-#ifdef JP
-msg_print("̾¾õ¤·Æñ¤¤¼Ù°­¤Ê¸ºß¤¬¤¢¤Ê¤¿¤Î¿´¤òÄ̤ê²á¤®¤Æ¹Ô¤Ã¤¿...");
-#else
-                               msg_print("An unnamable evil brushes against your mind...");
-#endif
-
-                               set_afraid(p_ptr->afraid + randint1(4) + 4);
-                       }
-                       else if (die < 26)
-                       {
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤ÎƬ¤ËÂçÎ̤ÎÍ©Î¤Á¤ÎÁû¡¹¤·¤¤À¼¤¬²¡¤·´ó¤»¤Æ¤­¤¿...");
-#else
-                               msg_print("Your head is invaded by a horde of gibbering spectral voices...");
-#endif
-
-                               set_confused(p_ptr->confused + randint1(4) + 4);
-                       }
-                       else if (die < 31)
-                       {
-                               poly_monster(dir);
-                       }
-                       else if (die < 36)
-                       {
-                               fire_bolt_or_beam(beam - 10, GF_MISSILE, dir,
-                                       damroll(3 + ((plev - 1) / 5), 4));
-                       }
-                       else if (die < 41)
-                       {
-                               confuse_monster (dir, plev);
-                       }
-                       else if (die < 46)
-                       {
-                               fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
-                       }
-                       else if (die < 51)
-                       {
-                               (void)lite_line(dir);
-                       }
-                       else if (die < 56)
-                       {
-                               fire_bolt_or_beam(beam - 10, GF_ELEC, dir,
-                                       damroll(3+((plev-5)/4),8));
-                       }
-                       else if (die < 61)
-                       {
-                               fire_bolt_or_beam(beam - 10, GF_COLD, dir,
-                                       damroll(5+((plev-5)/4),8));
-                       }
-                       else if (die < 66)
-                       {
-                               fire_bolt_or_beam(beam, GF_ACID, dir,
-                                       damroll(6+((plev-5)/4),8));
-                       }
-                       else if (die < 71)
-                       {
-                               fire_bolt_or_beam(beam, GF_FIRE, dir,
-                                       damroll(8+((plev-5)/4),8));
-                       }
-                       else if (die < 76)
-                       {
-                               drain_life(dir, 75);
-                       }
-                       else if (die < 81)
-                       {
-                               fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
-                       }
-                       else if (die < 86)
-                       {
-                               fire_ball(GF_ACID, dir, 40 + plev, 2);
-                       }
-                       else if (die < 91)
-                       {
-                               fire_ball(GF_ICE, dir, 70 + plev, 3);
-                       }
-                       else if (die < 96)
-                       {
-                               fire_ball(GF_FIRE, dir, 80 + plev, 3);
-                       }
-                       else if (die < 101)
-                       {
-                               drain_life(dir, 100 + plev);
-                       }
-                       else if (die < 104)
-                       {
-                               earthquake(py, px, 12);
-                       }
-                       else if (die < 106)
-                       {
-                               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
-                       }
-                       else if (die < 108)
-                       {
-                               symbol_genocide(plev+50, TRUE);
-                       }
-                       else if (die < 110)
-                       {
-                               dispel_monsters(120);
-                       }
-                       else
-                       { /* RARE */
-                               dispel_monsters(150);
-                               slow_monsters();
-                               sleep_monsters();
-                               hp_player(300);
-                       }
-
-                       if (die < 31)
-#ifdef JP
-msg_print("±¢±µ¤ÊÀ¼¤¬¥¯¥¹¥¯¥¹¾Ð¤¦¡£¡Ö¤â¤¦¤¹¤°¤ª¤Þ¤¨¤Ï²æ¡¹¤ÎÃç´Ö¤Ë¤Ê¤ë¤À¤í¤¦¡£¼å¤­¼Ô¤è¡£¡×");
-#else
-                               msg_print("Sepulchral voices chuckle. 'Soon you will join us, mortal.'");
-#endif
-
-                       break;
-               }
-       case 18: /* Dark Bolt */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam, GF_DARK, dir,
-                       damroll(4 + ((plev - 5) / 4), 8));
-               break;
-       case 19: /* Battle Frenzy */
-               (void)set_shero(randint1(25) + 25, FALSE);
-               (void)hp_player(30);
-               (void)set_afraid(0);
-               (void)set_fast(randint1(20 + (plev / 2)) + (plev / 2), FALSE);
-               break;
-       case 20: /* Vampiric Branding */
-               brand_weapon(4);
-               break;
-       case 21: /* Vampirism True */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               chg_virtue(V_SACRIFICE, -1);
-               chg_virtue(V_VITALITY, -1);
-
-               for (dummy = 0; dummy < 3; dummy++)
-               {
-                       if (drain_life(dir, 100))
-                               hp_player(100);
-               }
-               break;
-       case 22: /* Word of Death */
-               (void)dispel_living(randint1(plev * 3));
-               break;
-       case 23: /* Darkness Storm */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_DARK, dir, 100+plev*2, 4);
-               break;
-       case 24: /* Death Ray */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)death_ray(dir, plev);
-               break;
-       case 25: /* Raise the Dead */
-               {
-                       int type;
-                       bool pet = one_in_(3);
-                       u32b mode = 0L;
-
-                       type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
-
-                       if (!pet || (pet && (plev > 24) && one_in_(3)))
-                               mode |= PM_ALLOW_GROUP;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
-
-                       if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, type, mode))
-                       {
-#ifdef JP
-msg_print("Î䤿¤¤É÷¤¬¤¢¤Ê¤¿¤Î¼þ¤ê¤Ë¿á¤­»Ï¤á¤¿¡£¤½¤ì¤ÏÉåÇÔ½­¤ò±¿¤ó¤Ç¤¤¤ë...");
-#else
-                               msg_print("Cold winds begin to blow around you, carrying with them the stench of decay...");
-#endif
-
-
-                               if (pet)
-#ifdef JP
-msg_print("¸Å¤¨¤Î»à¤»¤ë¼Ô¶¦¤¬¤¢¤Ê¤¿¤Ë»Å¤¨¤ë¤¿¤áÅÚ¤«¤éᴤä¿¡ª");
-#else
-                                       msg_print("Ancient, long-dead forms arise from the ground to serve you!");
-#endif
-
-                               else
-#ifdef JP
-msg_print("»à¼Ô¤¬á´¤Ã¤¿¡£Ì²¤ê¤ò˸¤²¤ë¤¢¤Ê¤¿¤òȳ¤¹¤ë¤¿¤á¤Ë¡ª");
-#else
-                                       msg_print("'The dead arise... to punish you for disturbing them!'");
-#endif
-
-                       chg_virtue(V_UNLIFE, 1);
-                       }
-
-                       break;
-               }
-       case 26: /* Esoteria */
-               if (randint1(50) > plev)
-                       return ident_spell(FALSE);
-               else
-                       return identify_fully(FALSE);
-       case 27: /* Mimic vampire */
-               (void)set_mimic(10+plev/2 + randint1(10+plev/2), MIMIC_VAMPIRE, FALSE);
-               break;
-       case 28: /* Restore Life */
-               (void)restore_level();
-               break;
-       case 29: /* Mass Genocide */
-               (void)mass_genocide(plev+50, TRUE);
-               break;
-       case 30: /* Hellfire */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_HELL_FIRE, dir, 666, 3);
-#ifdef JP
-take_hit(DAMAGE_USELIFE, 20 + randint1(30), "ÃϹö¤Î¹å²Ð¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
-#else
-               take_hit(DAMAGE_USELIFE, 20 + randint1(30), "the strain of casting Hellfire", -1);
-#endif
-
-               break;
-       case 31: /* Wraithform */
-               set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
-               break;
-       default:
-               msg_format("You cast an unknown Death spell: %d.", spell);
-               msg_print(NULL);
-       }
-
-       return TRUE;
-}
-
-
-static bool cast_trump_spell(int spell, bool success)
-{
-       int     dir;
-       int     plev = p_ptr->lev;
-       int     summon_lev = plev * 2 / 3 + randint1(plev/2);
-       int     dummy = 0;
-       bool    no_trump = FALSE;
-       bool    unique_okay = FALSE;
-
-       if (summon_lev < 1) summon_lev = 1;
-       if (!success || (randint1(50+plev) < plev/10)) unique_okay = TRUE;
-       switch (spell)
-       {
-               case 0: /* Phase Door */
-                       if (success)
-                       {
-                               teleport_player(10, FALSE);
-                       }
-                       break;
-               case 1: /* Trump Spiders */
-               {
-                       bool pet = success; /* (randint1(5) > 2) */
-                       u32b mode = PM_ALLOW_GROUP;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= PM_NO_PET;
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤ÏÃØéá¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of an spider...");
-#endif
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_SPIDER, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿ÃØéá¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned spiders get angry!");
-#endif
-                       }
-                       else
-                       {
-                               no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               case 2: /* Shuffle */
-                       if (success)
-                       {
-                               /* A limited power 'wonder' spell */
-                               int die = randint1(120);
-                               int vir = virtue_number(V_CHANCE);
-
-                               if ((p_ptr->pclass == CLASS_ROGUE) ||
-                                       (p_ptr->pclass == CLASS_HIGH_MAGE) ||
-                                       (p_ptr->pclass == CLASS_SORCERER))
-                                       die = (randint1(110)) + plev / 5;
-                               /* Card sharks and high mages get a level bonus */
-
-                               if (vir)
-                               {
-                                       if (p_ptr->virtues[vir - 1] > 0)
-                                       {
-                                               while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
-                                       }
-                                       else
-                                       {
-                                               while (randint1(400) < (0-p_ptr->virtues[vir - 1])) die--;
-                                       }
-                               }
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¥«¡¼¥É¤òÀڤäưìËç°ú¤¤¤¿...");
-#else
-                               msg_print("You shuffle the deck and draw a card...");
-#endif
-
-                               if (die < 30)
-                                       chg_virtue(V_CHANCE, 1);
-
-                               if (die < 7)
-                               {
-#ifdef JP
-msg_print("¤Ê¤ó¤Æ¤³¤Ã¤¿¡ª¡Ô»à¡Õ¤À¡ª");
-#else
-                                       msg_print("Oh no! It's Death!");
-#endif
-
-                                       for (dummy = 0; dummy < randint1(3); dummy++)
-                                               (void)activate_hi_summon(py, px, FALSE);
-                               }
-                               else if (die < 14)
-                               {
-#ifdef JP
-msg_print("¤Ê¤ó¤Æ¤³¤Ã¤¿¡ª¡Ô°­Ëâ¡Õ¤À¡ª");
-#else
-                                       msg_print("Oh no! It's the Devil!");
-#endif
-
-                                       (void)summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                               }
-                               else if (die < 18)
-                               {
-                                       int count = 0;
-#ifdef JP
-msg_print("¤Ê¤ó¤Æ¤³¤Ã¤¿¡ª¡ÔÄߤé¤ì¤¿ÃË¡Õ¤À¡ª");
-#else
-                                       msg_print("Oh no! It's the Hanged Man.");
-#endif
-
-                                       (void)activate_ty_curse(FALSE, &count);
-                               }
-                               else if (die < 22)
-                               {
-#ifdef JP
-msg_print("¡ÔÉÔĴϤηõ¡Õ¤À¡£");
-#else
-                                       msg_print("It's the swords of discord.");
-#endif
-
-                                       aggravate_monsters(0);
-                               }
-                               else if (die < 26)
-                               {
-#ifdef JP
-msg_print("¡Ô¶ò¼Ô¡Õ¤À¡£");
-#else
-                                       msg_print("It's the Fool.");
-#endif
-
-                                       (void)do_dec_stat(A_INT);
-                                       (void)do_dec_stat(A_WIS);
-                               }
-                               else if (die < 30)
-                               {
-#ifdef JP
-msg_print("´ñ̯¤Ê¥â¥ó¥¹¥¿¡¼¤Î³¨¤À¡£");
-#else
-                                       msg_print("It's the picture of a strange monster.");
-#endif
-
-                                       if (!(summon_specific(0, py, px, (dun_level * 3) / 2, 32 + randint1(6), (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))))
-                                               no_trump = TRUE;
-                               }
-                               else if (die < 33)
-                               {
-#ifdef JP
-msg_print("¡Ô·î¡Õ¤À¡£");
-#else
-                                       msg_print("It's the Moon.");
-#endif
-
-                                       unlite_area(10, 3);
-                               }
-                               else if (die < 38)
-                               {
-#ifdef JP
-msg_print("¡Ô±¿Ì¿¤ÎÎØ¡Õ¤À¡£");
-#else
-                                       msg_print("It's the Wheel of Fortune.");
-#endif
-
-                                       wild_magic(randint0(32));
-                               }
-                               else if (die < 40)
-                               {
-#ifdef JP
-msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥«¡¼¥É¤À¡£");
-#else
-                                       msg_print("It's a teleport trump card.");
-#endif
-
-                                       teleport_player(10, TRUE);
-                               }
-                               else if (die < 42)
-                               {
-#ifdef JP
-msg_print("¡ÔÀµµÁ¡Õ¤À¡£");
-#else
-                                       msg_print("It's Justice.");
-#endif
-
-                                       set_blessed(p_ptr->lev, FALSE);
-                               }
-                               else if (die < 47)
-                               {
-#ifdef JP
-msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥«¡¼¥É¤À¡£");
-#else
-                                       msg_print("It's a teleport trump card.");
-#endif
-
-                                       teleport_player(100, TRUE);
-                               }
-                               else if (die < 52)
-                               {
-#ifdef JP
-msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥«¡¼¥É¤À¡£");
-#else
-                                       msg_print("It's a teleport trump card.");
-#endif
-
-                                       teleport_player(200, TRUE);
-                               }
-                               else if (die < 60)
-                               {
-#ifdef JP
-msg_print("¡ÔÅã¡Õ¤À¡£");
-#else
-                                       msg_print("It's the Tower.");
-#endif
-
-                                       wall_breaker();
-                               }
-                               else if (die < 72)
-                               {
-#ifdef JP
-msg_print("¡ÔÀáÀ©¡Õ¤À¡£");
-#else
-                                       msg_print("It's Temperance.");
-#endif
-
-                                       sleep_monsters_touch();
-                               }
-                               else if (die < 80)
-                               {
-#ifdef JP
-msg_print("¡ÔÅã¡Õ¤À¡£");
-#else
-                                       msg_print("It's the Tower.");
-#endif
-
-                                       earthquake(py, px, 5);
-                               }
-                               else if (die < 82)
-                               {
-#ifdef JP
-msg_print("ͧ¹¥Åª¤Ê¥â¥ó¥¹¥¿¡¼¤Î³¨¤À¡£");
-#else
-                                       msg_print("It's the picture of a friendly monster.");
-#endif
-
-                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE1, PM_FORCE_PET)))
-                                               no_trump = TRUE;
-                               }
-                               else if (die < 84)
-                               {
-#ifdef JP
-msg_print("ͧ¹¥Åª¤Ê¥â¥ó¥¹¥¿¡¼¤Î³¨¤À¡£");
-#else
-                                       msg_print("It's the picture of a friendly monster.");
-#endif
-
-                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE2, PM_FORCE_PET)))
-                                               no_trump = TRUE;
-                               }
-                               else if (die < 86)
-                               {
-#ifdef JP
-msg_print("ͧ¹¥Åª¤Ê¥â¥ó¥¹¥¿¡¼¤Î³¨¤À¡£");
-#else
-                                       msg_print("It's the picture of a friendly monster.");
-#endif
-
-                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE4, PM_FORCE_PET)))
-                                               no_trump = TRUE;
-                               }
-                               else if (die < 88)
-                               {
-#ifdef JP
-msg_print("ͧ¹¥Åª¤Ê¥â¥ó¥¹¥¿¡¼¤Î³¨¤À¡£");
-#else
-                                       msg_print("It's the picture of a friendly monster.");
-#endif
-
-                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE5, PM_FORCE_PET)))
-                                               no_trump = TRUE;
-                               }
-                               else if (die < 96)
-                               {
-#ifdef JP
-msg_print("¡ÔÎø¿Í¡Õ¤À¡£");
-#else
-                                       msg_print("It's the Lovers.");
-#endif
-
-                                       if (get_aim_dir(&dir))
-                                               (void)charm_monster(dir, MIN(p_ptr->lev, 20));
-                               }
-                               else if (die < 101)
-                               {
-#ifdef JP
-msg_print("¡Ô±£¼Ô¡Õ¤À¡£");
-#else
-                                       msg_print("It's the Hermit.");
-#endif
-
-                                       wall_stone();
-                               }
-                               else if (die < 111)
-                               {
-#ifdef JP
-msg_print("¡Ô¿³È½¡Õ¤À¡£");
-#else
-                                       msg_print("It's the Judgement.");
-#endif
-
-                                       do_cmd_rerate(FALSE);
-                                       if (p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3)
-                                       {
-#ifdef JP
-msg_print("Á´¤Æ¤ÎÆÍÁ³ÊÑ°Û¤¬¼£¤Ã¤¿¡£");
-#else
-                                               msg_print("You are cured of all mutations.");
-#endif
-
-                                               p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
-                                               p_ptr->update |= PU_BONUS;
-                                               handle_stuff();
-                                       }
-                               }
-                               else if (die < 120)
-                               {
-#ifdef JP
-msg_print("¡ÔÂÀÍÛ¡Õ¤À¡£");
-#else
-                                       msg_print("It's the Sun.");
-#endif
-
-                                       chg_virtue(V_KNOWLEDGE, 1);
-                                       chg_virtue(V_ENLIGHTEN, 1);
-                                       wiz_lite(FALSE);
-                               }
-                               else
-                               {
-#ifdef JP
-msg_print("¡ÔÀ¤³¦¡Õ¤À¡£");
-#else
-                                       msg_print("It's the World.");
-#endif
-
-                                       if (p_ptr->exp < PY_MAX_EXP)
-                                       {
-                                               s32b ee = (p_ptr->exp / 25) + 1;
-                                               if (ee > 5000) ee = 5000;
-#ifdef JP
-msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
-#else
-                                               msg_print("You feel more experienced.");
-#endif
-
-                                               gain_exp(ee);
-                                       }
-                               }
-                       }
-                       break;
-               case 3: /* Reset Recall */
-                       if (success)
-                       {
-                               if (!reset_recall()) return FALSE;
-                       }
-                       break;
-               case 4: /* Teleport Self */
-                       if (success)
-                       {
-                               teleport_player(plev * 4, FALSE);
-                       }
-                       break;
-               case 5: /* Trump Spying */
-                       if (success)
-                       {
-                               (void)set_tim_esp(randint1(30) + 25, FALSE);
-                       }
-                       break;
-               case 6: /* Teleport Away */
-                       if (success)
-                       {
-                               if (!get_aim_dir(&dir)) return FALSE;
-                               (void)fire_beam(GF_AWAY_ALL, dir, plev);
-                       }
-                       break;
-               case 7: /* Trump Animals */
-               {
-                       bool pet = success; /* was (randint1(5) > 2) */
-                       int type = (pet ? SUMMON_ANIMAL_RANGER : SUMMON_ANIMAL);
-                       u32b mode = 0L;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ïưʪ¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of an animal...");
-#endif
-
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, type, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿Æ°Êª¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned animal gets angry!");
-#endif
-
-                       }
-                       else
-                       {
-                               no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               case 8: /* Trump Reach */
-                       if (success)
-                       {
-                               if (!get_aim_dir(&dir)) return FALSE;
-                               fetch(dir, plev * 15, TRUE);
-                       }
-                       break;
-               case 9: /* Trump Kamikaze */
-               {
-                       int x = px, y = py;
-                       if (success)
-                       {
-                               if (!target_set(TARGET_KILL)) return FALSE;
-                               x = target_col;
-                               y = target_row;
-                       }
-                       no_trump = TRUE;
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¥«¥ß¥«¥¼¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on several trumps at once...");
-#endif
-
-
-                       for (dummy = 2 + randint0(plev / 7); dummy > 0; dummy--)
-                       {
-                               bool pet = success; /* was (randint1(10) > 3) */
-                               u32b mode = 0L;
-                               int type;
-
-                               if (pet) mode |= PM_FORCE_PET;
-                               else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
-
-                               if (p_ptr->pclass == CLASS_BEASTMASTER)
-                               {
-                                       type = SUMMON_KAMIKAZE_LIVING;
-                               }
-                               else
-                               {
-                                       type = SUMMON_KAMIKAZE;
-                               }
-
-                               if (summon_specific((pet ? -1 : 0), y, x, summon_lev, type, mode))
-                               {
-                                       if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                               msg_print("The summoned creatures get angry!");
-#endif
-
-                                       no_trump = FALSE;
-                               }
-                       }
-                       break;
-               }
-               case 10: /* Phantasmal Servant */
-                       if (success)
-                       {
-                               if (summon_specific(-1, py, px, (summon_lev * 3) / 2, SUMMON_PHANTOM, PM_FORCE_PET))
-                               {
-#ifdef JP
-msg_print("¸æÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¸æ¼ç¿ÍÍÍ¡©");
-#else
-                                       msg_print("'Your wish, master?'");
-#endif
-
-                               }
-                               else
-                               {
-                                       no_trump = TRUE;
-                               }
-                       }
-                       break;
-               case 11: /* Speed Monster */
-                       if (success)
-                       {
-                               bool old_target_pet = target_pet;
-                               target_pet = TRUE;
-                               if (!get_aim_dir(&dir))
-                               {
-                                       target_pet = old_target_pet;
-                                       return (FALSE);
-                               }
-                               target_pet = old_target_pet;
-                               (void)speed_monster(dir);
-                       }
-                       break;
-               case 12: /* Teleport Level */
-                       if (success)
-                       {
-#ifdef JP
-                               if (!get_check("ËÜÅö¤Ë¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©")) return FALSE;
-#else
-                               if (!get_check("Are you sure? (Teleport Level)")) return FALSE;
-#endif
-                               (void)teleport_level(0);
-                       }
-                       break;
-               case 13: /* Dimension Door */
-                       if (success)
-                       {
-#ifdef JP
-msg_print("¼¡¸µ¤ÎÈ⤬³«¤¤¤¿¡£ÌÜŪÃϤòÁª¤ó¤Ç²¼¤µ¤¤¡£");
-#else
-                               msg_print("You open a dimensional gate. Choose a destination.");
-#endif
-
-                               return dimension_door();
-                       }
-                       break;
-               case 14: /* Word of Recall */
-                       if (success)
-                       {
-                               return word_of_recall();
-                       }
-                       break;
-               case 15: /* Banish */
-                       if (success)
-                       {
-                               banish_monsters(plev * 4);
-                       }
-                       break;
-               case 16: /* Swap Position */
-               {
-                       if (success)
-                       {
-                               project_length = -1;
-                               if (!get_aim_dir(&dir))
-                               {
-                                       project_length = 0;
-                                       return FALSE;
-                               }
-                               project_length = 0;
-
-                               (void)teleport_swap(dir);
-                       }
-                       break;
-               }
-               case 17: /* Trump Undead */
-               {
-                       bool pet = success; /* (randint1(10) > 3) */
-                       u32b mode = 0L;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¥¢¥ó¥Ç¥Ã¥É¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of an undead creature...");
-#endif
-
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNDEAD, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿¥¢¥ó¥Ç¥Ã¥É¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned undead creature gets angry!");
-#endif
-
-                       }
-                       else
-                       {
-                               no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               case 18: /* Trump Reptiles */
-               {
-                       bool pet = success; /* was (randint1(5) > 2) */
-                       u32b mode = 0L;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ïà¨ÃîÎà¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of a reptile...");
-#endif
-
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HYDRA, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿à¨ÃîÎà¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned reptile gets angry!");
-#endif
-
-                       }
-                       else
-                       {
-                               no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               case 19: /* Trump Monsters */
-               {
-                       no_trump = TRUE;
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¥â¥ó¥¹¥¿¡¼¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on several trumps at once...");
-#endif
-
-
-                       for (dummy = 0; dummy < 1 + ((plev - 15)/ 10); dummy++)
-                       {
-                               bool pet = success; /* was (randint1(10) > 3) */
-                               int type;
-                               u32b mode = 0L;
-
-                               if (pet) mode |= PM_FORCE_PET;
-                               else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
-
-                               if (unique_okay) mode |= PM_ALLOW_UNIQUE;
-
-                               if (p_ptr->pclass == CLASS_BEASTMASTER)
-                               {
-                                       type = SUMMON_LIVING;
-                               }
-                               else
-                               {
-                                       type = 0;
-                               }
-
-                               if (summon_specific((pet ? -1 : 0), py, px, summon_lev, type, mode))
-                               {
-                                       if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                               msg_print("The summoned creatures get angry!");
-#endif
-
-                                       no_trump = FALSE;
-                               }
-                       }
-                       break;
-               }
-               case 20: /* Trump Hounds */
-               {
-                       bool pet = success; /* was (randint1(5) > 2) */
-                       u32b mode = PM_ALLOW_GROUP;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= PM_NO_PET;
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¥Ï¥¦¥ó¥É¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of a hound...");
-#endif
-
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HOUND, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿¥Ï¥¦¥ó¥É¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned hounds get angry!");
-#endif
-
-                       }
-                       else
-                       {
-                               no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               case 21: /* Trump Branding */
-                       if (success)
-                       {
-                               brand_weapon(5);
-                       }
-                       break;
-               case 22: /* Living Trump */
-                       if (success)
-                       {
-                               if (one_in_(7))
-                                       /* Teleport control */
-                                       dummy = 12;
-                               else
-                                       /* Random teleportation (uncontrolled) */
-                                       dummy = 77;
-                               /* Gain the mutation */
-                               if (gain_random_mutation(dummy))
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤ÏÀ¸¤­¤Æ¤¤¤ë¥«¡¼¥É¤ËÊѤï¤Ã¤¿¡£");
-#else
-                                       msg_print("You have turned into a Living Trump.");
-#endif
-
-                       }
-                       break;
-               case 23: /* Trump Cyberdemon */
-               {
-                       bool pet = success; /* was (randint1(10) > 3) */
-                       u32b mode = 0L;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= PM_NO_PET;
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of a Cyberdemon...");
-#endif
-
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_CYBER, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned Cyberdemon gets angry!");
-#endif
-
-                       }
-                       else
-                       {
-                                       no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               case 24: /* Trump Divination */
-                       if (success)
-                       {
-                               (void)detect_all(DETECT_RAD_DEFAULT);
-                       }
-                       break;
-               case 25: /* Trump Lore */
-                       if (success)
-                       {
-                               return identify_fully(FALSE);
-                       }
-                       break;
-               case 26: /* Heal Monster */
-                       if (success)
-                       {
-                               bool old_target_pet = target_pet;
-                               target_pet = TRUE;
-                               if (!get_aim_dir(&dir))
-                               {
-                                       target_pet = old_target_pet;
-                                       return (FALSE);
-                               }
-                               target_pet = old_target_pet;
-
-                               (void)heal_monster(dir, p_ptr->lev * 10 + 200);
-                       }
-                       break;
-               case 27: /* Trump Dragon */
-               {
-                       bool pet = success; /* was (randint1(10) > 3) */
-                       u32b mode = 0L;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¥É¥é¥´¥ó¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of a dragon...");
-#endif
-
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DRAGON, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿¥É¥é¥´¥ó¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned dragon gets angry!");
-#endif
-
-                       }
-                       else
-                       {
-                               no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               case 28: /* Trump Meteor */
-                       if (success)
-                       {
-                               int x, y, dx, dy, i;
-                               int b = 10 + randint1(10);
-                               for (i = 0; i < b; i++)
-                               {
-                                       int count = 0, d = 0;
-
-                                       while (1)
-                                       {
-                                               count++;
-                                               if (count > 20) break;
-                                               x = px - 8 + randint0(17);
-                                               y = py - 8 + randint0(17);
-
-                                               if (!in_bounds(y, x) || !projectable(py, px, y, x)) continue;
-
-                                               dx = (px > x) ? (px - x) : (x - px);
-                                               dy = (py > y) ? (py - y) : (y - py);
-
-                                               /* Approximate distance */
-                                               d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
-                                               if (d < 9) break;
-                                       }
-
-                                       if (count > 20) continue;
-
-                                       project(0, 2, y, x, plev * 2, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
-                               }
-                       }
-                       break;
-               case 29: /* Trump Demon */
-               {
-                       bool pet = success; /* was (randint1(10) > 3) */
-                       u32b mode = 0L;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of a demon...");
-#endif
-
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DEMON, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿¥Ç¡¼¥â¥ó¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned demon gets angry!");
-#endif
-
-                       }
-                       else
-                       {
-                               no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               case 30: /* Trump Greater Undead */
-               {
-                       bool pet = success; /* was (randint1(10) > 3) */
-                       u32b mode = 0L;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
-
-                       if (unique_okay) mode |= PM_ALLOW_UNIQUE;
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¶¯ÎϤʥ¢¥ó¥Ç¥Ã¥É¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of a greater undead being...");
-#endif
-
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿¾åµé¥¢¥ó¥Ç¥Ã¥É¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned greater undead creature gets angry!");
-#endif
-
-                       }
-                       else
-                       {
-                               no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               case 31: /* Trump Ancient Dragon */
-               {
-                       bool pet = success; /* was (randint1(10) > 3) */
-                       int type;
-                       u32b mode = 0L;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
-
-                       if (unique_okay) mode |= PM_ALLOW_UNIQUE;
-
-                       if (p_ptr->pclass == CLASS_BEASTMASTER)
-                       {
-                               type = SUMMON_HI_DRAGON_LIVING;
-                       }
-                       else
-                       {
-                               type = SUMMON_HI_DRAGON;
-                       }
-
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¸ÅÂå¥É¥é¥´¥ó¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
-#else
-                       msg_print("You concentrate on the trump of an ancient dragon...");
-#endif
-
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, type, mode))
-                       {
-                               if (!pet)
-#ifdef JP
-msg_print("¾¤´­¤µ¤ì¤¿¸ÅÂå¥É¥é¥´¥ó¤ÏÅܤäƤ¤¤ë¡ª");
-#else
-                                       msg_print("The summoned ancient dragon gets angry!");
-#endif
-
-                       }
-                       else
-                       {
-                               no_trump = TRUE;
-                       }
-
-                       break;
-               }
-               default:
-#ifdef JP
-msg_format("̤ÃΤΥ«¡¼¥É¤Î¼öʸ¤Ç¤¹: %d", spell);
-#else
-                       msg_format("You cast an unknown Trump spell: %d.", spell);
-#endif
-
-                       msg_print(NULL);
-       }
-
-       if (no_trump)
-       {
-#ifdef JP
-msg_print("ï¤â¤¢¤Ê¤¿¤Î¥«¡¼¥É¤Î¸Æ¤ÓÀ¼¤ËÅú¤¨¤Ê¤¤¡£");
-#else
-               msg_print("Nobody answers to your Trump call.");
-#endif
-
-       }
-
-       return TRUE;
-}
-
-
-static bool cast_arcane_spell(int spell)
-{
-       int     dir;
-       int     beam;
-       int     plev = p_ptr->lev;
-       int     dummy = 0;
-
-       if (p_ptr->pclass == CLASS_MAGE) beam = plev;
-       else if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) beam = plev + 10;
-       else beam = plev / 2;
-
-       switch (spell)
-       {
-       case 0: /* Zap */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam - 10, GF_ELEC, dir,
-                       damroll(3 + ((plev - 1) / 5), 3));
-               break;
-       case 1: /* Wizard Lock */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)wizard_lock(dir);
-               break;
-       case 2: /* Detect Invisibility */
-               (void)detect_monsters_invis(DETECT_RAD_DEFAULT);
-               break;
-       case 3: /* Detect Monsters */
-               (void)detect_monsters_normal(DETECT_RAD_DEFAULT);
-               break;
-       case 4: /* Blink */
-               teleport_player(10, FALSE);
-               break;
-       case 5: /* Light Area */
-               (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
-               break;
-       case 6: /* Trap & Door Destruction */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)destroy_door(dir);
-               break;
-       case 7: /* Cure Light Wounds */
-               (void)hp_player(damroll(2, 8));
-               (void)set_cut(p_ptr->cut - 10);
-               break;
-       case 8: /* Detect Doors & Traps */
-               (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
-               (void)detect_doors(DETECT_RAD_DEFAULT);
-               (void)detect_stairs(DETECT_RAD_DEFAULT);
-               break;
-       case 9: /* Phlogiston */
-               phlogiston();
-               break;
-       case 10: /* Detect Treasure */
-               (void)detect_treasure(DETECT_RAD_DEFAULT);
-               (void)detect_objects_gold(DETECT_RAD_DEFAULT);
-               break;
-       case 11: /* Detect Enchantment */
-               (void)detect_objects_magic(DETECT_RAD_DEFAULT);
-               break;
-       case 12: /* Detect Objects */
-               (void)detect_objects_normal(DETECT_RAD_DEFAULT);
-               break;
-       case 13: /* Cure Poison */
-               (void)set_poisoned(0);
-               break;
-       case 14: /* Resist Cold */
-               (void)set_oppose_cold(randint1(20) + 20, FALSE);
-               break;
-       case 15: /* Resist Fire */
-               (void)set_oppose_fire(randint1(20) + 20, FALSE);
-               break;
-       case 16: /* Resist Lightning */
-               (void)set_oppose_elec(randint1(20) + 20, FALSE);
-               break;
-       case 17: /* Resist Acid */
-               (void)set_oppose_acid(randint1(20) + 20, FALSE);
-               break;
-       case 18: /* Cure Medium Wounds */
-               (void)hp_player(damroll(4, 8));
-               (void)set_cut((p_ptr->cut / 2) - 50);
-               break;
-       case 19: /* Teleport */
-               teleport_player(plev * 5, FALSE);
-               break;
-       case 20: /* Identify */
-               return ident_spell(FALSE);
-       case 21: /* Stone to Mud */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)wall_to_mud(dir);
-               break;
-       case 22: /* Ray of Light */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-#ifdef JP
-msg_print("¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£");
-#else
-               msg_print("A line of light appears.");
-#endif
-
-               (void)lite_line(dir);
-               break;
-       case 23: /* Satisfy Hunger */
-               (void)set_food(PY_FOOD_MAX - 1);
-               break;
-       case 24: /* See Invisible */
-               (void)set_tim_invis(randint1(24) + 24, FALSE);
-               break;
-       case 25: /* Conjure Elemental */
-               if (!summon_specific(-1, py, px, plev, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_FORCE_PET)))
-               {
-#ifdef JP
-                       msg_print("¥¨¥ì¥á¥ó¥¿¥ë¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
-#else
-                       msg_print("No Elementals arrive.");
-#endif
-               }
-               break;
-       case 26: /* Teleport Level */
-#ifdef JP
-               if (!get_check("ËÜÅö¤Ë¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©")) return FALSE;
-#else
-               if (!get_check("Are you sure? (Teleport Level)")) return FALSE;
-#endif
-               (void)teleport_level(0);
-               break;
-       case 27: /* Teleport Away */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)fire_beam(GF_AWAY_ALL, dir, plev);
-               break;
-       case 28: /* Elemental Ball */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               switch (randint1(4))
-               {
-                       case 1:  dummy = GF_FIRE;break;
-                       case 2:  dummy = GF_ELEC;break;
-                       case 3:  dummy = GF_COLD;break;
-                       default: dummy = GF_ACID;break;
-               }
-               fire_ball(dummy, dir, 75 + (plev), 2);
-               break;
-       case 29: /* Detection */
-               (void)detect_all(DETECT_RAD_DEFAULT);
-               break;
-       case 30: /* Word of Recall */
-               return word_of_recall();
-       case 31: /* Clairvoyance */
-               chg_virtue(V_KNOWLEDGE, 1);
-               chg_virtue(V_ENLIGHTEN, 1);
-               wiz_lite(FALSE);
-               if (!p_ptr->telepathy)
-               {
-                       (void)set_tim_esp(randint1(30) + 25, FALSE);
-               }
-               break;
-       default:
-               msg_format("You cast an unknown Arcane spell: %d.", spell);
-               msg_print(NULL);
-       }
-
-       return TRUE;
-}
-
-
-static bool cast_enchant_spell(int spell)
-{
-       int     plev = p_ptr->lev;
-       int     dummy = 0;
-
-       switch (spell)
-       {
-       case 0: /* Infravision */
-               set_tim_infra(100 + randint1(100), FALSE);
-               break;
-       case 1: /* Regeneration */
-               set_tim_regen(80 + randint1(80), FALSE);
-               break;
-       case 2: /* Satisfy Hunger */
-               (void)set_food(PY_FOOD_MAX - 1);
-               break;
-       case 3: /* Resist Cold */
-               (void)set_oppose_cold(randint1(20) + 20, FALSE);
-               break;
-       case 4: /* Resist Fire */
-               (void)set_oppose_fire(randint1(20) + 20, FALSE);
-               break;
-       case 5: /* Heroism */
-               (void)set_hero(randint1(25) + 25, FALSE);
-               (void)hp_player(10);
-               (void)set_afraid(0);
-               break;
-       case 6: /* Resist Lightning */
-               (void)set_oppose_elec(randint1(20) + 20, FALSE);
-               break;
-       case 7: /* Resist Acid */
-               (void)set_oppose_acid(randint1(20) + 20, FALSE);
-               break;
-       case 8: /* See Invisibility */
-               (void)set_tim_invis(randint1(24) + 24, FALSE);
-               break;
-       case 9: /* Remove Curse */
-               if (remove_curse())
-               {
-#ifdef JP
-                       msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
-#else
-                       msg_print("You feel as if someone is watching over you.");
-#endif
-               }
-               break;
-       case 10: /* Resist Poison */
-               (void)set_oppose_pois(randint1(20) + 20, FALSE);
-               break;
-       case 11: /* Berserk */
-               (void)set_shero(randint1(25) + 25, FALSE);
-               (void)hp_player(30);
-               (void)set_afraid(0);
-               break;
-       case 12: /* Self Knowledge */
-               (void)self_knowledge();
-               break;
-       case 13: /* Protection from Evil */
-               (void)set_protevil(randint1(25) + 3 * p_ptr->lev, FALSE);
-               break;
-       case 14: /* Healing */
-               set_poisoned(0);
-               set_stun(0);
-               set_cut(0);
-               set_image(0);
-               break;
-       case 15: /* Mana Branding */
-               return choose_ele_attack();
-       case 16: /* Telepathy */
-               (void)set_tim_esp(randint1(30) + 25, FALSE);
-               break;
-       case 17: /* Stone Skin */
-               (void)set_shield(randint1(20) + 30, FALSE);
-               break;
-       case 18: /* Resistance */
-               (void)set_oppose_acid(randint1(20) + 20, FALSE);
-               (void)set_oppose_elec(randint1(20) + 20, FALSE);
-               (void)set_oppose_fire(randint1(20) + 20, FALSE);
-               (void)set_oppose_cold(randint1(20) + 20, FALSE);
-               (void)set_oppose_pois(randint1(20) + 20, FALSE);
-               break;
-       case 19: /* Haste */
-               (void)set_fast(randint1(20 + plev) + plev, FALSE);
-               break;
-       case 20: /* Walk through Wall */
-               (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
-               break;
-       case 21: /* Pulish Shield */
-               (void)pulish_shield();
-               break;
-       case 22: /* Create Golem */
-               if (summon_specific(-1, py, px, plev, SUMMON_GOLEM, PM_FORCE_PET))
-               {
-#ifdef JP
-                       msg_print("¥´¡¼¥ì¥à¤òºî¤Ã¤¿¡£");
-#else
-                       msg_print("You make a golem.");
-#endif
-               }
-               else
-               {
-#ifdef JP
-                       msg_print("¤¦¤Þ¤¯¥´¡¼¥ì¥à¤òºî¤ì¤Ê¤«¤Ã¤¿¡£");
-#else
-                       msg_print("No Golems arrive.");
-#endif
-               }
-               break;
-       case 23: /* Magic armor */
-               (void)set_magicdef(randint1(20) + 20, FALSE);
-               break;
-       case 24: /* Remove Enchantment */
-               if (!mundane_spell(TRUE)) return FALSE;
-               break;
-       case 25: /* Remove All Curse */
-               if (remove_all_curse())
-               {
-#ifdef JP
-                       msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
-#else
-                       msg_print("You feel as if someone is watching over you.");
-#endif
-               }
-               break;
-       case 26: /* Total Knowledge */
-               return identify_fully(FALSE);
-       case 27: /* Enchant Weapon */
-               return enchant_spell(randint0(4) + 1, randint0(4) + 1, 0);
-       case 28: /* Enchant Armor */
-               return enchant_spell(0, 0, randint0(3) + 2);
-       case 29: /* Brand Weapon */
-               brand_weapon(randint0(18));
-               break;
-       case 30: /* Living Trump */
-               if (one_in_(7))
-                       /* Teleport control */
-                       dummy = 12;
-               else
-                       /* Random teleportation (uncontrolled) */
-                       dummy = 77;
-               /* Gain the mutation */
-               if (gain_random_mutation(dummy))
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤ÏÀ¸¤­¤Æ¤¤¤ë¥«¡¼¥É¤ËÊѤï¤Ã¤¿¡£");
-#else
-                       msg_print("You have turned into a Living Trump.");
-#endif
-               break;
-       case 31: /* Immune */
-               return choose_ele_immune(13 + randint1(13));
-       default:
-               msg_format("You cast an unknown Craft spell: %d.", spell);
-               msg_print(NULL);
-       }
-
-       return TRUE;
-}
-
-
-/*
- * An "item_tester_hook" for offer
- */
-static bool item_tester_offer(object_type *o_ptr)
-{
-       /* Flasks of oil are okay */
-       if (o_ptr->tval != TV_CORPSE) return (FALSE);
-
-       if (o_ptr->sval != SV_CORPSE) return (FALSE);
-
-       if (my_strchr("pht", r_info[o_ptr->pval].d_char)) return (TRUE);
-
-       /* Assume not okay */
-       return (FALSE);
-}
-
-
-static bool cast_daemon_spell(int spell)
-{
-       int     dir, beam;
-       int     plev = p_ptr->lev;
-
-       if (p_ptr->pclass == CLASS_MAGE) beam = plev;
-       else if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) beam = plev + 10;
-       else beam = plev / 2;
-
-       switch (spell)
-       {
-       case 0: /* Magic Missile */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam - 10, GF_MISSILE, dir,
-                       damroll(3 + ((plev - 1) / 5), 4));
-               break;
-       case 1: /* Detect Undead & Demons -> Unlife */
-               (void)detect_monsters_nonliving(DETECT_RAD_DEFAULT);
-               break;
-       case 2: /* Bless */
-               (void)set_blessed(randint1(12) + 12, FALSE);
-               break;
-       case 3: /* Resist Fire */
-               (void)set_oppose_fire(randint1(20) + 20, FALSE);
-               break;
-       case 4: /* Horrify */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)fear_monster(dir, plev);
-               (void)stun_monster(dir, plev);
-               break;
-       case 5: /* Nether Bolt */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam, GF_NETHER, dir,
-                   damroll(6 + ((plev - 5) / 4), 8));
-               break;
-       case 6: /* Summon monster, demon */
-               if (!summon_specific(-1, py, px, (plev * 3) / 2, SUMMON_MANES, (PM_ALLOW_GROUP | PM_FORCE_PET)))
-               {
-#ifdef JP
-msg_print("¸ÅÂå¤Î»àÎî¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
-#else
-                       msg_print("No Manes arrive.");
-#endif
-               }
-               break;
-       case 7: /* Mini Hellfire */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_HELL_FIRE, dir,
-                       (damroll(3, 6) + plev +
-                       (plev / (((p_ptr->pclass == CLASS_MAGE) ||
-                       (p_ptr->pclass == CLASS_HIGH_MAGE) ||
-                       (p_ptr->pclass == CLASS_SORCERER)) ? 2 : 4))),
-                       ((plev < 30) ? 2 : 3));
-               break;
-       case 8: /* Enslave Demon */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)control_one_demon(dir, plev);
-               break;
-       case 9: /* Vision */
-               map_area(DETECT_RAD_MAP);
-               break;
-       case 10: /* Resist Nether */
-               (void)set_tim_res_nether(randint1(20) + 20, FALSE);
-               break;
-       case 11: /* Plasma Bolt */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam, GF_PLASMA, dir,
-                   damroll(11 + ((plev - 5) / 4), 8));
-               break;
-       case 12: /* Fire Ball */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_FIRE, dir, plev + 55, 2);
-               break;
-       case 13: /* Fire Branding */
-               brand_weapon(1);
-               break;
-       case 14: /* Nether Ball */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_NETHER, dir, plev*3/2 + 100, plev / 20+2);
-               break;
-       case 15: /* Summon monster, demon */
-       {
-               bool pet = !one_in_(3);
-               u32b mode = 0L;
-
-               if (pet) mode |= PM_FORCE_PET;
-               else mode |= PM_NO_PET;
-               if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
-
-               if (summon_specific((pet ? -1 : 0), py, px, plev*2/3+randint1(plev/2), SUMMON_DEMON, mode))
-               {
-#ifdef JP
-msg_print("ⲫ¤Î°­½­¤¬½¼Ëþ¤·¤¿¡£");
-#else
-                       msg_print("The area fills with a stench of sulphur and brimstone.");
-#endif
-
-
-                       if (pet)
-#ifdef JP
-msg_print("¡Ö¤´ÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¤´¼ç¿ÍÍÍ¡×");
-#else
-                               msg_print("'What is thy bidding... Master?'");
-#endif
-
-                       else
-#ifdef JP
-msg_print("¡ÖÈܤ·¤­¼Ô¤è¡¢²æ¤ÏÆò¤Î²¼Ëͤˤ¢¤é¤º¡ª ¤ªÁ°¤Îº²¤òĺ¤¯¤¾¡ª¡×");
-#else
-                               msg_print("'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'");
-#endif
-
-               }
-               else
-               {
-#ifdef JP
-msg_print("°­Ëâ¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
-#else
-                       msg_print("No demons arrive.");
-#endif
-               }
-               break;
-       }
-       case 16: /* Telepathy */
-               (void)set_tim_esp(randint1(30) + 25, FALSE);
-               break;
-       case 17: /* Demoncloak */
-       {
-               int dur=randint1(20) + 20;
-                       
-               set_oppose_fire(dur, FALSE);
-               set_oppose_cold(dur, FALSE);
-               set_tim_sh_fire(dur, FALSE);
-               set_afraid(0);
-               break;
-       }
-       case 18: /* Rain of Lava */
-               fire_ball(GF_FIRE, 0, (55 + plev)*2, 3);
-               fire_ball_hide(GF_LAVA_FLOW, 0, 2+randint1(2), 3);
-               break;
-       case 19: /* Plasma ball */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_PLASMA, dir, plev*3/2 + 80, 2 + plev/40);
-               break;
-       case 20: /* Mimic demon */
-               (void)set_mimic(10+plev/2 + randint1(10+plev/2), MIMIC_DEMON, FALSE);
-               break;
-       case 21: /* Nether Wave == Dispel Good */
-               (void)dispel_monsters(randint1(plev * 2));
-               (void)dispel_good(randint1(plev * 2));
-               break;
-       case 22: /*  */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_NEXUS, dir, 100 + plev*2, 4);
-               break;
-       case 23: /* Hand Doom */
-               if (!get_aim_dir(&dir)) return FALSE;
-#ifdef JP
-else msg_print("<ÇËÌǤμê>¤òÊü¤Ã¤¿¡ª");
-#else
-               else msg_print("You invoke the Hand of Doom!");
-#endif
-
-               fire_ball_hide(GF_HAND_DOOM, dir, plev * 2, 0);
-               break;
-       case 24: /* Heroism */
-               (void)set_hero(randint1(25) + 25, FALSE);
-               (void)hp_player(10);
-               (void)set_afraid(0);
-               break;
-       case 25: /* Tim resist time */
-               (void)set_tim_res_time(randint1(20)+20, FALSE);
-               break;
-       case 26: /* Circle of Madness */
-               fire_ball(GF_CHAOS, 0, 50+plev, 3+plev/20);
-               fire_ball(GF_CONFUSION, 0, 50+plev, 3+plev/20);
-               fire_ball(GF_CHARM, 0, 20+plev, 3+plev/20);
-               break;
-       case 27: /* True Discharge Minion */
-               discharge_minion();
-               break;
-       case 28: /* Summon Greater Demon */
-       {
-               int item;
-               cptr q, s;
-               int summon_lev;
-               object_type *o_ptr;
-
-               item_tester_hook = item_tester_offer;
-#ifdef JP
-               q = "¤É¤Î»àÂΤòÊû¤²¤Þ¤¹¤«? ";
-               s = "Êû¤²¤é¤ì¤ë»àÂΤò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£";
-#else
-               q = "Sacrifice which corpse? ";
-               s = "You have nothing to scrifice.";
-#endif
-               if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
-
-               /* Get the item (in the pack) */
-               if (item >= 0)
-               {
-                       o_ptr = &inventory[item];
-               }
-
-               /* Get the item (on the floor) */
-               else
-               {
-                       o_ptr = &o_list[0 - item];
-               }
-
-               summon_lev = p_ptr->lev * 2 / 3 + r_info[o_ptr->pval].level;
-               if (summon_specific(-1, py, px, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET)))
-               {
-#ifdef JP
-msg_print("ⲫ¤Î°­½­¤¬½¼Ëþ¤·¤¿¡£");
-#else
-                       msg_print("The area fills with a stench of sulphur and brimstone.");
-#endif
-
-
-#ifdef JP
-msg_print("¡Ö¤´ÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¤´¼ç¿ÍÍÍ¡×");
-#else
-                       msg_print("'What is thy bidding... Master?'");
-#endif
-
-                       /* Decrease the item (from the pack) */
-                       if (item >= 0)
-                       {
-                               inven_item_increase(item, -1);
-                               inven_item_describe(item);
-                               inven_item_optimize(item);
-                       }
-
-                       /* Decrease the item (from the floor) */
-                       else
-                       {
-                               floor_item_increase(0 - item, -1);
-                               floor_item_describe(0 - item);
-                               floor_item_optimize(0 - item);
-                       }
-               }
-               else
-               {
-#ifdef JP
-msg_print("°­Ëâ¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
-#else
-                       msg_print("No Greater Demon arrive.");
-#endif
-               }
-               break;
-       }
-       case 29: /* Nether Storm */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_NETHER, dir, plev*15, plev / 5);
-               break;
-       case 30: /* Blood curse */
-       {
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball_hide(GF_BLOOD_CURSE, dir, 600, 0);
-#ifdef JP
-take_hit(DAMAGE_USELIFE, 20 + randint1(30), "·ì¤Î¼ö¤¤", -1);
-#else
-               take_hit(DAMAGE_USELIFE, 20 + randint1(30), "Blood curse", -1);
-#endif
-               break;
-       }
-       case 31: /* Mimic Demon lord */
-               (void)set_mimic(15 + randint1(15), MIMIC_DEMON_LORD, FALSE);
-               break;
-       default:
-               msg_format("You cast an unknown Daemon spell: %d.", spell);
-               msg_print(NULL);
-       }
-
-       return TRUE;
-}
-
-
-static bool cast_crusade_spell(int spell)
-{
-       int     dir;
-       int     beam;
-       int     plev = p_ptr->lev;
-
-       if (p_ptr->pclass == CLASS_MAGE) beam = plev;
-       else if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) beam = plev + 10;
-       else beam = plev / 2;
-
-       switch (spell)
-       {
-       case 0:
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_bolt_or_beam(beam - 10, GF_ELEC, dir,
-                       damroll(3 + ((plev - 1) / 5), 4));
-               break;
-       case 1:
-               (void)detect_monsters_evil(DETECT_RAD_DEFAULT);
-               break;
-       case 2: /* Remove Fear */
-               (void)set_afraid(0);
-               break;
-       case 3:
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)fear_monster(dir, plev);
-               break;
-       case 4:
-               (void)sleep_monsters_touch();
-               break;
-       case 5:
-               teleport_player(25 + plev / 2, FALSE);
-               break;
-       case 6:
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_blast(GF_LITE, dir, 3+((plev-1)/9), 2, 10, 3);
-               break;
-       case 7:
-               (void)set_cut(0);
-               (void)set_poisoned(0);
-               (void)set_stun(0);
-               break;
-       case 8:
-               if (!get_aim_dir(&dir)) return FALSE;
-               (void)fire_ball(GF_AWAY_EVIL, dir, MAX_SIGHT*5, 0);
-               break;
-       case 9: /* Holy Orb */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_HOLY_FIRE, dir,
-                         (damroll(3, 6) + plev +
-                         (plev / ((p_ptr->pclass == CLASS_PRIEST ||
-                            p_ptr->pclass == CLASS_HIGH_MAGE ||
-                            p_ptr->pclass == CLASS_SORCERER) ? 2 : 4))),
-                         ((plev < 30) ? 2 : 3));
-
-               break;
-       case 10: /* Exorcism */
-               (void)dispel_undead(randint1(plev));
-               (void)dispel_demons(randint1(plev));
-               (void)turn_evil(plev);
-               break;
-       case 11: /* Remove Curse */
-               if (remove_curse())
-               {
-#ifdef JP
-                       msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
-#else
-                       msg_print("You feel as if someone is watching over you.");
-#endif
-               }
-               break;
-       case 12: /* Sense Unseen */
-               (void)set_tim_invis(randint1(24) + 24, FALSE);
-               break;
-       case 13: /* Protection from Evil */
-               (void)set_protevil(randint1(25) + 3 * p_ptr->lev, FALSE);
-               break;
-       case 14:
-               if (!get_aim_dir(&dir)) return FALSE;
-               (void)fire_bolt(GF_ELEC, dir, plev*5);
-               break;
-       case 15: /* Holy Word */
-               (void)dispel_evil(randint1(plev * 6));
-               (void)hp_player(100);
-               (void)set_afraid(0);
-               (void)set_poisoned(0);
-               (void)set_stun(0);
-               (void)set_cut(0);
-               break;
-       case 16:
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               (void)destroy_door(dir);
-               break;
-       case 17:
-               if (!get_aim_dir(&dir)) return FALSE;
-               (void)stasis_evil(dir);
-               break;
-       case 18:
-               set_tim_sh_holy(randint1(20)+20, FALSE);
-               break;
-       case 19: /* Dispel Undead + Demons */
-               (void)dispel_undead(randint1(plev * 4));
-               (void)dispel_demons(randint1(plev * 4));
-               break;
-       case 20: /* Dispel Evil */
-               (void)dispel_evil(randint1(plev * 4));
-               break;
-       case 21:
-               brand_weapon(13);
-               break;
-       case 22: /* Star Burst */
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               fire_ball(GF_LITE, dir, 100+plev*2, 4);
-               break;
-       case 23: /* Summon monster, angel */
-               {
-                       bool pet = !one_in_(3);
-                       u32b mode = 0L;
-
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= PM_NO_PET;
-                       if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
-
-                       if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, SUMMON_ANGEL, mode))
-                       {
-                               if (pet)
-#ifdef JP
-msg_print("¡Ö¤´ÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¤´¼ç¿ÍÍÍ¡×");
-#else
-                                       msg_print("'What is thy bidding... Master?'");
-#endif
-
-                               else
-#ifdef JP
-msg_print("¡Ö²æ¤ÏÆò¤Î²¼Ëͤˤ¢¤é¤º¡ª °­¹Ô¼Ô¤è¡¢²ù¤¤²þ¤á¤è¡ª¡×");
-#else
-                                       msg_print("Mortal! Repent of thy impiousness.");
-#endif
-
-                       }
-                       break;
-               }
-       case 24: /* Heroism */
-               (void)set_hero(randint1(25) + 25, FALSE);
-               (void)hp_player(10);
-               (void)set_afraid(0);
-               break;
-       case 25: /* Remove All Curse */
-               if (remove_all_curse())
-               {
-#ifdef JP
-                       msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
-#else
-                       msg_print("You feel as if someone is watching over you.");
-#endif
-               }
-               break;
-       case 26: /* Banishment */
-               if (banish_evil(100))
-               {
-#ifdef JP
-msg_print("¿ÀÀ»¤ÊÎϤ¬¼Ù°­¤òÂǤÁʧ¤Ã¤¿¡ª");
-#else
-                       msg_print("The holy power banishes evil!");
-#endif
-
-               }
-               break;
-       case 27: /* Word of Destruction */
-               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
-               break;
-       case 28: /* Eye for an Eye */
-               set_tim_eyeeye(randint1(10)+10, FALSE);
-               break;
-       case 29:
-               {
-                       int x, y, tx, ty;
-                       int nx, ny;
-                       int dir, i;
-                       int b = 10 + randint1(10);
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-
-                       /* Use the given direction */
-                       tx = px + 99 * ddx[dir];
-                       ty = py + 99 * ddy[dir];
-
-                       /* Hack -- Use an actual "target" */
-                       if ((dir == 5) && target_okay())
-                       {
-                               tx = target_col;
-                               ty = target_row;
-                       }
-
-                       x = px;
-                       y = py;
-
-                       while (1)
-                       {
-                               /* Hack -- Stop at the target */
-                               if ((y == ty) && (x == tx)) break;
-
-                               ny = y;
-                               nx = x;
-                               mmove2(&ny, &nx, py, px, ty, tx);
-
-                               /* Stop at maximum range */
-                               if (MAX_RANGE <= distance(py, px, ny, nx)) break;
-
-                               /* Stopped by walls/doors */
-                               if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
-
-                               /* Stopped by monsters */
-                               if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
-
-                               /* Save the new location */
-                               x = nx;
-                               y = ny;
-                       }
-                       tx = x;
-                       ty = y;
-
-                       for (i = 0; i < b; i++)
-                       {
-                               int count = 20, d = 0;
-
-                               while (count--)
-                               {
-                                       int dx, dy;
-
-                                       x = tx - 5 + randint0(11);
-                                       y = ty - 5 + randint0(11);
-
-                                       dx = (tx > x) ? (tx - x) : (x - tx);
-                                       dy = (ty > y) ? (ty - y) : (y - ty);
-
-                                       /* Approximate distance */
-                                       d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
-                                       /* Within the radius */
-                                       if (d < 5) break;
-                               }
-
-                               if (count < 0) continue;
-
-                               /* Cannot penetrate perm walls */
-                               if (!in_bounds(y,x) ||
-                                   cave_stop_disintegration(y,x) ||
-                                   !in_disintegration_range(ty, tx, y, x))
-                                       continue;
-
-                               project(0, 2, y, x, plev * 3+25, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
-                       }
-               }
-               break;
-       case 30: /* Divine Intervention */
-               project(0, 1, py, px, plev*11, GF_HOLY_FIRE, PROJECT_KILL, -1);
-               dispel_monsters(plev * 4);
-               slow_monsters();
-               stun_monsters(plev * 4);
-               confuse_monsters(plev * 4);
-               turn_monsters(plev * 4);
-               stasis_monsters(plev * 4);
-               (void)hp_player(100);
-               break;
-       case 31:
-       {
-               int i;
-               (void)crusade();
-               for (i = 0; i < 12; i++)
-               {
-                       int attempt = 10;
-                       int my, mx;
-
-                       while (attempt--)
-                       {
-                               scatter(&my, &mx, py, px, 4, 0);
-
-                               /* Require empty grids */
-                               if (cave_empty_bold2(my, mx)) break;
-                       }
-                       if (attempt < 0) continue;
-                       summon_specific(-1, my, mx, plev, SUMMON_KNIGHTS, (PM_ALLOW_GROUP | PM_FORCE_PET | PM_HASTE));
-               }
-               (void)set_hero(randint1(25) + 25, FALSE);
-               (void)set_blessed(randint1(25) + 25, FALSE);
-               (void)set_fast(randint1(20 + plev) + plev, FALSE);
-               (void)set_protevil(randint1(25) + 25, FALSE);
-               (void)set_afraid(0);
-               break;
-       }
-       default:
-#ifdef JP
-msg_format("¤¢¤Ê¤¿¤ÏÉÔÌÀ¤ÊÇ˼٤μöʸ %d ¤ò¾§¤¨¤¿¡£", spell);
-#else
-               msg_format("You cast an unknown crusade spell: %d.", spell);
-#endif
-
-               msg_print(NULL);
-       }
-
-       return TRUE;
-}
-
-
-
-void stop_singing(void)
-{
-       if (p_ptr->pclass != CLASS_BARD) return;
-
-       if (p_ptr->magic_num1[1])
-       {
-               p_ptr->magic_num1[1] = 0;
-               return;
-       }
-       if (!p_ptr->magic_num1[0]) return;
-
-       /* Hack -- if called from set_action(), avoid recursive loop */
-       if (p_ptr->action == ACTION_SING) set_action(ACTION_NONE);
-
-       switch(p_ptr->magic_num1[0])
-       {
-               case MUSIC_BLESS:
-                       if (!p_ptr->blessed)
-#ifdef JP
-msg_print("¹â·é¤Êµ¤Ê¬¤¬¾Ã¤¨¼º¤»¤¿¡£");
-#else
-                               msg_print("The prayer has expired.");
-#endif
-                       break;
-               case MUSIC_HERO:
-                       if (!p_ptr->hero)
-                       {
-#ifdef JP
-msg_print("¥Ò¡¼¥í¡¼¤Îµ¤Ê¬¤¬¾Ã¤¨¼º¤»¤¿¡£");
-#else
-                               msg_print("The heroism wears off.");
-#endif
-                               /* Recalculate hitpoints */
-                               p_ptr->update |= (PU_HP);
-                       }
-                       break;
-               case MUSIC_MIND:
-                       if (!p_ptr->tim_esp)
-                       {
-#ifdef JP
-msg_print("°Õ¼±¤Ï¸µ¤ËÌá¤Ã¤¿¡£");
-#else
-                               msg_print("Your consciousness contracts again.");
-#endif
-                               /* Update the monsters */
-                               p_ptr->update |= (PU_MONSTERS);
-                       }
-                       break;
-               case MUSIC_STEALTH:
-                       if (!p_ptr->tim_stealth)
-#ifdef JP
-msg_print("»Ñ¤¬¤Ï¤Ã¤­¤ê¤È¸«¤¨¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
-#else
-                               msg_print("You are no longer hided.");
-#endif
-                       break;
-               case MUSIC_RESIST:
-                       if (!p_ptr->oppose_acid)
-#ifdef JP
-msg_print("»À¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
-#else
-                               msg_print("You feel less resistant to acid.");
-#endif
-                       if (!p_ptr->oppose_elec)
-#ifdef JP
-msg_print("ÅÅ·â¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
-#else
-                               msg_print("You feel less resistant to elec.");
-#endif
-                       if (!p_ptr->oppose_fire)
-#ifdef JP
-msg_print("²Ð¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
-#else
-                               msg_print("You feel less resistant to fire.");
-#endif
-                       if (!p_ptr->oppose_cold)
-#ifdef JP
-msg_print("Î䵤¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
-#else
-                               msg_print("You feel less resistant to cold.");
-#endif
-                       if (!p_ptr->oppose_pois)
-#ifdef JP
-msg_print("ÆǤؤÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
-#else
-                               msg_print("You feel less resistant to pois.");
-#endif
-                       break;
-               case MUSIC_SPEED:
-                       if (!p_ptr->fast)
-#ifdef JP
-msg_print("Æ°¤­¤ÎÁÇÁᤵ¤¬¤Ê¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£");
-#else
-                               msg_print("You feel yourself slow down.");
-#endif
-                       break;
-               case MUSIC_SHERO:
-                       if (!p_ptr->hero)
-                       {
-#ifdef JP
-msg_print("¥Ò¡¼¥í¡¼¤Îµ¤Ê¬¤¬¾Ã¤¨¼º¤»¤¿¡£");
-#else
-                               msg_print("The heroism wears off.");
-#endif
-                               /* Recalculate hitpoints */
-                               p_ptr->update |= (PU_HP);
-                       }
-
-                       if (!p_ptr->fast)
-#ifdef JP
-msg_print("Æ°¤­¤ÎÁÇÁᤵ¤¬¤Ê¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£");
-#else
-                               msg_print("You feel yourself slow down.");
-#endif
-                       break;
-               case MUSIC_INVULN:
-                       if (!p_ptr->invuln)
-                       {
-#ifdef JP
-msg_print("̵Ũ¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
-#else
-                               msg_print("The invulnerability wears off.");
-#endif
-                               /* Redraw map */
-                               p_ptr->redraw |= (PR_MAP);
-
-                               /* Update monsters */
-                               p_ptr->update |= (PU_MONSTERS);
-
-                               /* Window stuff */
-                               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-                       }
-                       break;
-       }
-       p_ptr->magic_num1[0] = MUSIC_NONE;
-       p_ptr->magic_num2[0] = 0;
-
-       /* Recalculate bonuses */
-       p_ptr->update |= (PU_BONUS | PU_HP);
-
-       /* Redraw status bar */
-       p_ptr->redraw |= (PR_STATUS);
-}
-
-
-static bool cast_music_spell(int spell)
-{
-       int     plev = p_ptr->lev;
-       int dir;
-
-       if(p_ptr->magic_num1[0])
-       {
-               stop_singing();
-       }
-
-       p_ptr->magic_num2[0] = spell;
-
-       switch (spell)
-       {
-       case 0: /* Song of Holding ÃÙÆߤβΠ*/
-#ifdef JP
-               msg_print("¤æ¤Ã¤¯¤ê¤È¤·¤¿¥á¥í¥Ç¥£¤ò¸ý¤º¤µ¤ß»Ï¤á¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You start humming a slow, steady melody...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_SLOW;
-               break;
-       case 1:  /* Song of Blessing ½ËÊ¡¤Î²Î */
-#ifdef JP
-               msg_print("¸·¤«¤Ê¥á¥í¥Ç¥£¤òÁդǻϤ᤿¡¥¡¥¡¥");
-#else
-               msg_print("The holy power of the Music of the Ainur enters you...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_BLESS;
-               break;
-               
-       case 2:  /* Wrecking Note Êø²õ¤Î²»¿§ */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt(GF_SOUND, dir,
-                         damroll(4 + ((plev - 1) / 5), 4));
-               break;
-       case 3:  /* Stun Pattern Û¯Û°¤ÎÀûΧ */
-#ifdef JP
-               msg_print("âÁÏǤµ¤»¤ë¥á¥í¥Ç¥£¤òÁդǻϤ᤿¡¥¡¥¡¥");
-#else
-               msg_print("You weave a pattern of sounds to bewilder and daze...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_STUN;
-               break;
-       case 4:  /* Flow of life À¸Ì¿¤Îή¤ì */
-#ifdef JP
-               msg_print("²Î¤òÄ̤·¤ÆÂΤ˳赤¤¬Ìá¤Ã¤Æ¤­¤¿¡¥¡¥¡¥");
-#else
-               msg_print("Life flows through you as you sing a song of healing...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_L_LIFE;
-               break;
-       case 5:  /* Song of the Sun ÂÀÍۤβΠ*/
-#ifdef JP
-               msg_print("¸÷¤êµ±¤¯²Î¤¬ÊÕ¤ê¤ò¾È¤é¤·¤¿¡£");
-#else
-               msg_print("Your uplifting song brings brightness to dark places...");
-#endif
-               (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
-               break;
-       case 6:  /* Song of fear ¶²ÉݤβΠ*/
-#ifdef JP
-               msg_print("¤ª¤É¤í¤ª¤É¤í¤·¤¤¥á¥í¥Ç¥£¤òÁդǻϤ᤿¡¥¡¥¡¥");
-#else
-               msg_print("You start weaving a fearful pattern...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_FEAR;
-               break;
-       case 7:  /* Heroic Ballad À襤¤Î²Î */
-#ifdef JP
-               msg_print("·ã¤·¤¤À襤¤Î²Î¤ò²Î¤Ã¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You start singing a song of intense fighting...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_HERO;
-               break;
-       case 8:  /* Clairaudience ÎîŪÃγР*/
-#ifdef JP
-               msg_print("ÀŤ«¤Ê²»³Ú¤¬´¶³Ð¤ò¸¦¤®À¡¤Þ¤µ¤»¤¿¡¥¡¥¡¥");
-#else
-               msg_print("Your quiet music sharpens your sense of hearing...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_DETECT;
-               break;
-       case 9: /* º²¤Î²Î */
-#ifdef JP
-               msg_print("Àº¿À¤òDZ¤¸¶Ê¤²¤ë²Î¤ò²Î¤Ã¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You start singing a song of soul in pain...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_PSI;
-               break;
-       case 10:  /* Song of Lore Ãμ±¤Î²Î */
-#ifdef JP
-               msg_print("¤³¤ÎÀ¤³¦¤ÎÃ챤¬Î®¤ì¹þ¤ó¤Ç¤­¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You recall the rich lore of the world...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_ID;
-               break;
-       case 11:  /* hidding song ±£ÆۤβΠ*/
-#ifdef JP
-               msg_print("¤¢¤Ê¤¿¤Î»Ñ¤¬·Ê¿§¤Ë¤È¤±¤³¤ó¤Ç¤¤¤Ã¤¿¡¥¡¥¡¥");
-#else
-               msg_print("Your song carries you beyond the sight of mortal eyes...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_STEALTH;
-               break;
-       case 12:  /* Illusion Pattern ¸¸±Æ¤ÎÀûΧ */
-#ifdef JP
-               msg_print("ÊÕ¤ê°ìÌ̤˸¸±Æ¤¬¸½¤ì¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You weave a pattern of sounds to beguile and confuse...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_CONF;
-               break;
-       case 13:  /* Doomcall (vibration song) ÇËÌǤζ«¤Ó */
-#ifdef JP
-               msg_print("¹ì²»¤¬¶Á¤¤¤¿¡¥¡¥¡¥");
-#else
-               msg_print("The fury of the Downfall of Numenor lashes out...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_SOUND;
+       switch (randint1(spell) + randint1(8) + 1)
+       {
+       case 1:
+       case 2:
+       case 3:
+               teleport_player(10, TELEPORT_PASSIVE);
                break;
-       case 14:  /* Firiel's Song (song of the Undeads) ¥Õ¥£¥ê¥¨¥ë¤Î²Î */
-#ifdef JP
-               msg_print("À¸Ì¿¤ÈÉü³è¤Î¥Æ¡¼¥Þ¤òÁդǻϤ᤿¡¥¡¥¡¥");
-#else
-               msg_print("The themes of life and revival are woven into your song...");
-#endif
-               animate_dead(0, py, px);
+       case 4:
+       case 5:
+       case 6:
+               teleport_player(100, TELEPORT_PASSIVE);
                break;
-       case 15:  /* Fellowship Chant (charming song) Î¹¤ÎÃç´Ö */
-#ifdef JP
-               msg_print("°Â¤é¤«¤Ê¥á¥í¥Ç¥£¤òÁդǻϤ᤿¡¥¡¥¡¥");
-#else
-               msg_print("You weave a slow, soothing melody of imploration...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_CHARM;
+       case 7:
+       case 8:
+               teleport_player(200, TELEPORT_PASSIVE);
                break;
-       case 16:  /* (wall breaking song) Ê¬²ò²»ÇÈ */
-#ifdef JP
-               msg_print("Ê´ºÕ¤¹¤ë¥á¥í¥Ç¥£¤òÁդǻϤ᤿¡¥¡¥¡¥");
-#else
-               msg_print("You weave a violent pattern of sounds to break wall.");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_WALL;
-               project(0, 0, py, px,
-                       0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
+       case 9:
+       case 10:
+       case 11:
+               unlite_area(10, 3);
                break;
-       case 17:  /* Finrod's Resistance (song of resistance) ¸µÁÇÂÑÀ­ */
-#ifdef JP
-               msg_print("¸µÁǤÎÎϤËÂФ¹¤ëǦÂѤβΤò²Î¤Ã¤¿¡£");
-#else
-               msg_print("You sing a song of perseverance against powers...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_RESIST;
+       case 12:
+       case 13:
+       case 14:
+               lite_area(damroll(2, 3), 2);
                break;
-       case 18:  /* Hobbit Melodies (song of time) ¥Û¥Ó¥Ã¥È¤Î¥á¥í¥Ç¥£ */
-#ifdef JP
-               msg_print("·Ú²÷¤Ê²Î¤ò¸ý¤º¤µ¤ß»Ï¤á¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You start singing joyful pop song...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_SPEED;
+       case 15:
+               destroy_doors_touch();
                break;
-       case 19:  /* World Contortion ÏĤó¤ÀÀ¤³¦ */
-#ifdef JP
-               msg_print("²Î¤¬¶õ´Ö¤òÏĤ᤿¡¥¡¥¡¥");
-#else
-               msg_print("Reality whirls wildly as you sing a dizzying melody...");
-#endif
-               project(0, plev/15 + 1, py, px, plev * 3 + 1, GF_AWAY_ALL , PROJECT_KILL, -1);
+       case 16: case 17:
+               wall_breaker();
+       case 18:
+               sleep_monsters_touch();
                break;
-       case 20: /* Â໶¤Î²Î */
-#ifdef JP
-               msg_print("ÂѤ¨¤é¤ì¤Ê¤¤ÉÔ¶¨Ï²»¤¬Å¨¤òÀÕ¤áΩ¤Æ¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You cry out in an ear-wracking voice...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_DISPEL;
+       case 19:
+       case 20:
+               trap_creation(py, px);
                break;
-       case 21: /* The Voice of Saruman ¥µ¥ë¥Þ¥ó¤Î´Å¸À */
-#ifdef JP
-               msg_print("Í¥¤·¤¯¡¢Ì¥ÎÏŪ¤Ê²Î¤ò¸ý¤º¤µ¤ß»Ï¤á¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You start humming a gentle and attractive song...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_SARUMAN;
+       case 21:
+       case 22:
+               door_creation();
                break;
-       case 22:  /* Song of Tempest (song of death) Íò¤Î²»¿§ */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_beam(GF_SOUND, dir,
-                         damroll(15 + ((plev - 1) / 2), 10));
+       case 23:
+       case 24:
+       case 25:
+               aggravate_monsters(0);
                break;
-       case 23:  /* (song of disruption) ¤â¤¦°ì¤Ä¤ÎÀ¤³¦ */
-#ifdef JP
-               msg_print("¼þ°Ï¤¬ÊѲ½¤·»Ï¤á¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You sing of the primeval shaping of Middle-earth...");
-#endif
-               alter_reality();
+       case 26:
+               earthquake(py, px, 5);
                break;
-       case 24:  /* Wrecking Pattern (destruction shriek) Ç˲õ¤ÎÀûΧ */
-#ifdef JP
-               msg_print("Ç˲õŪ¤Ê²Î¤¬¶Á¤­¤ï¤¿¤Ã¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You weave a pattern of sounds to contort and shatter...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_QUAKE;
+       case 27:
+       case 28:
+               (void)gain_random_mutation(0);
                break;
-       case 25: /* ÄäÂڤβΠ */
-#ifdef JP
-               msg_print("¤æ¤Ã¤¯¤ê¤È¤·¤¿¥á¥í¥Ç¥£¤òÁդǻϤ᤿¡¥¡¥¡¥");
-#else
-               msg_print("You weave a very slow pattern which is almost likely to stop...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_STASIS;
+       case 29:
+       case 30:
+               apply_disenchant(1);
                break;
-       case 26: /* ¼é¤ê¤Î²Î */
-#ifdef JP
-               msg_print("²Î¤¬¿ÀÀ»¤Ê¾ì¤òºî¤ê½Ð¤·¤¿¡¥¡¥¡¥");
-#else
-               msg_print("The holy power of the Music is creating sacred field...");
-#endif
-               warding_glyph();
+       case 31:
+               lose_all_info();
                break;
-       case 27: /* ±Ñͺ¤Î»í */
-#ifdef JP
-               msg_print("±Ñͺ¤Î²Î¤ò¸ý¤º¤µ¤ó¤À¡¥¡¥¡¥");
-#else
-               msg_print("You chant a powerful, heroic call to arms...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_SHERO;
-               (void)hp_player(10);
-               (void)set_afraid(0);
+       case 32:
+               fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
                break;
-       case 28: /* ¥ä¥ô¥¡¥ó¥Ê¤Î½õ¤± */
-#ifdef JP
-               msg_print("²Î¤òÄ̤·¤ÆÂΤ˳赤¤¬Ìá¤Ã¤Æ¤­¤¿¡¥¡¥¡¥");
-#else
-               msg_print("Life flows through you as you sing the song...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_H_LIFE;
+       case 33:
+               wall_stone();
                break;
-       case 29: /* ºÆÀ¸¤Î²Î */
-#ifdef JP
-               msg_print("°Å¹õ¤ÎÃæ¤Ë¸÷¤ÈÈþ¤ò¤Õ¤ê¤Þ¤¤¤¿¡£ÂΤ¬¸µ¤Î³èÎϤò¼è¤êÌᤷ¤¿¡£");
-#else
-               msg_print("You strewed light and beauty in the dark as you sing. You feel refreshed.");
-#endif
-               (void)do_res_stat(A_STR);
-               (void)do_res_stat(A_INT);
-               (void)do_res_stat(A_WIS);
-               (void)do_res_stat(A_DEX);
-               (void)do_res_stat(A_CON);
-               (void)do_res_stat(A_CHR);
-               (void)restore_level();
+       case 34:
+       case 35:
+               while (counter++ < 8)
+               {
+                       (void)summon_specific(0, py, px, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
+               }
                break;
-       case 30:  /* shriek of death ¥µ¥¦¥í¥ó¤ÎËâ½Ñ */
-               if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_SOUND, dir, damroll(50 + plev, 10), 0);
+       case 36:
+       case 37:
+               activate_hi_summon(py, px, FALSE);
                break;
-       case 31:  /* song of liberty ¥Õ¥£¥ó¥´¥ë¥Õ¥£¥ó¤ÎÄ©Àï */
-#ifdef JP
-               msg_print("¥Õ¥£¥ó¥´¥ë¥Õ¥£¥ó¤Î̽²¦¤Ø¤ÎÄ©Àï¤ò²Î¤Ã¤¿¡¥¡¥¡¥");
-#else
-               msg_print("You recall the valor of Fingolfin's challenge to the Dark Lord...");
-#endif
-               p_ptr->magic_num1[0] = MUSIC_INVULN;
-               
-               /* Redraw map */
-               p_ptr->redraw |= (PR_MAP);
-               
-               /* Update monsters */
-               p_ptr->update |= (PU_MONSTERS);
-               
-               /* Window stuff */
-               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+       case 38:
+               (void)summon_cyber(-1, py, px);
                break;
        default:
-#ifdef JP
-               msg_format("̤ÃΤβÎ(%d)¤ò²Î¤Ã¤¿¡£", spell);
-#else
-               msg_format("You sing an unknown song: %d.", spell);
-#endif
-               msg_print(NULL);
+               {
+                       int count = 0;
+                       (void)activate_ty_curse(FALSE, &count);
+                       break;
+               }
        }
 
-       if (p_ptr->magic_num1[0]) set_action(ACTION_SING);
-
-       /* Recalculate bonuses */
-       p_ptr->update |= (PU_BONUS | PU_HP);
-
-       /* Redraw status bar */
-       p_ptr->redraw |= (PR_STATUS);
-       return TRUE;
+       return;
 }
 
 
@@ -4657,7 +1096,6 @@ void do_cmd_cast(void)
        int     increment = 0;
        int     use_realm;
        int     need_mana;
-       bool cast;
 
        cptr prayer;
 
@@ -4671,7 +1109,7 @@ void do_cmd_cast(void)
        if (!p_ptr->realm1 && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE))
        {
 #ifdef JP
-msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
+               msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
 #else
                msg_print("You cannot cast spells!");
 #endif
@@ -4682,15 +1120,16 @@ msg_print("
        /* Require lite */
        if (p_ptr->blind || no_lite())
        {
+               if (p_ptr->pclass == CLASS_FORCETRAINER) confirm_use_force(FALSE);
+               else
+               {
 #ifdef JP
-msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
+                       msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
 #else
-               msg_print("You cannot see!");
+                       msg_print("You cannot see!");
 #endif
-               if (p_ptr->pclass == CLASS_FORCETRAINER)
-                   do_cmd_mind();
-               else
                        flush();
+               }
                return;
        }
 
@@ -4698,7 +1137,7 @@ msg_print("
        if (p_ptr->confused)
        {
 #ifdef JP
-msg_print("º®Í𤷤Ƥ¤¤Æ¾§¤¨¤é¤ì¤Ê¤¤¡ª");
+               msg_print("º®Í𤷤Ƥ¤¤Æ¾§¤¨¤é¤ì¤Ê¤¤¡ª");
 #else
                msg_print("You are too confused!");
 #endif
@@ -4706,6 +1145,16 @@ msg_print("
                return;
        }
 
+       if (p_ptr->pclass == CLASS_FORCETRAINER)
+       {
+               if (player_has_no_spellbooks())
+               {
+                       confirm_use_force(FALSE);
+                       return;
+               }
+               select_the_force = TRUE;
+       }
+
        prayer = spell_category_name(mp_ptr->spell_book);
 
        /* Restrict choices to spell books */
@@ -4713,31 +1162,32 @@ msg_print("
 
        /* Get an item */
 #ifdef JP
-q = "¤É¤Î¼öʸ½ñ¤ò»È¤¤¤Þ¤¹¤«? ";
+       q = "¤É¤Î¼öʸ½ñ¤ò»È¤¤¤Þ¤¹¤«? ";
 #else
        q = "Use which book? ";
 #endif
 
 #ifdef JP
-s = "¼öʸ½ñ¤¬¤Ê¤¤¡ª";
+       s = "¼öʸ½ñ¤¬¤Ê¤¤¡ª";
 #else
        s = "You have no spell books!";
 #endif
 
-       if (p_ptr->pclass == CLASS_FORCETRAINER)
-               select_the_force = TRUE;
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))){
-           select_the_force = FALSE;
-           return;
+       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
+       {
+               select_the_force = FALSE;
+               return;
        }
        select_the_force = FALSE;
 
-       if (item == INVEN_FORCE) { /* the_force */
-           do_cmd_mind();
-           return;
-       } else
+       if (item == INVEN_FORCE) /* the_force */
+       {
+               do_cmd_mind();
+               return;
+       }
+
        /* Get the item (in the pack) */
-       if (item >= 0)
+       else if (item >= 0)
        {
                o_ptr = &inventory[item];
        }
@@ -4807,7 +1257,7 @@ s = "
                /* Warning */
 #ifdef JP
 msg_format("¤½¤Î%s¤ò%s¤Î¤Ë½½Ê¬¤Ê¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È¤¬¤Ê¤¤¡£",prayer,
-((mp_ptr->spell_book == TV_LIFE_BOOK) ? "±Ó¾§¤¹¤ë" : (mp_ptr->spell_book == TV_LIFE_BOOK) ? "²Î¤¦" : "¾§¤¨¤ë"));
+ ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "±Ó¾§¤¹¤ë" : (mp_ptr->spell_book == TV_LIFE_BOOK) ? "²Î¤¦" : "¾§¤¨¤ë"));
 #else
                msg_format("You do not have enough mana to %s this %s.",
                        ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
@@ -4865,11 +1315,11 @@ msg_format("%s
                        break;
                }
 
-               if (realm == REALM_TRUMP)
-               {
-                       cast_trump_spell(spell, FALSE);
-               }
-               else if ((o_ptr->tval == TV_CHAOS_BOOK) && (randint1(100) < spell))
+               /* Failure casting may activate some side effect */
+               do_spell(realm, spell, SPELL_FAIL);
+
+
+               if ((o_ptr->tval == TV_CHAOS_BOOK) && (randint1(100) < spell))
                {
 #ifdef JP
 msg_print("¥«¥ª¥¹Åª¤Ê¸ú²Ì¤òȯÀ¸¤·¤¿¡ª");
@@ -4920,50 +1370,8 @@ msg_print("An infernal sound echoed.");
        /* Process spell */
        else
        {
-               /* Spells.  */
-               switch (realm)
-               {
-               case REALM_LIFE: /* * LIFE * */
-                       cast = cast_life_spell(spell);
-                       break;
-               case REALM_SORCERY: /* * SORCERY * */
-                       cast = cast_sorcery_spell(spell);
-                       break;
-               case REALM_NATURE: /* * NATURE * */
-                       cast = cast_nature_spell(spell);
-                       break;
-               case REALM_CHAOS: /* * CHAOS * */
-                       cast = cast_chaos_spell(spell);
-                       break;
-               case REALM_DEATH: /* * DEATH * */
-                       cast = cast_death_spell(spell);
-                       break;
-               case REALM_TRUMP: /* TRUMP */
-                       cast = cast_trump_spell(spell, TRUE);
-                       break;
-               case REALM_ARCANE: /* ARCANE */
-                       cast = cast_arcane_spell(spell);
-                       break;
-               case REALM_ENCHANT: /* ENCHANT */
-                       cast = cast_enchant_spell(spell);
-                       break;
-               case REALM_DAEMON: /* DAEMON */
-                       cast = cast_daemon_spell(spell);
-                       break;
-               case REALM_CRUSADE: /* CRUSADE */
-                       cast = cast_crusade_spell(spell);
-                       break;
-               case REALM_MUSIC: /* MUSIC */
-                       cast = cast_music_spell(spell);
-                       break;
-               default:
-                       cast = FALSE;
-                       msg_format("You cast a spell from an unknown realm: realm %d, spell %d.", realm, spell);
-                       msg_print(NULL);
-               }
-
                /* Canceled spells cost neither a turn nor mana */
-               if (!cast) return;
+               if (!do_spell(realm, spell, SPELL_CAST)) return;
 
                if (randint1(100) < chance)
                        chg_virtue(V_CHANCE,1);
@@ -5164,14 +1572,6 @@ msg_print("
 }
 
 
-/*
- * Pray a prayer -- Unused in Hengband
- */
-void do_cmd_pray(void)
-{
-       msg_print("Praying is not used in Hengband. Use magic spell casting instead.");
-}
-
 static bool ang_sort_comp_pet_dismiss(vptr u, vptr v, int a, int b)
 {
        u16b *who = (u16b*)(u);
@@ -5208,14 +1608,35 @@ static bool ang_sort_comp_pet_dismiss(vptr u, vptr v, int a, int b)
        return w1 <= w2;
 }
 
+void check_pets_num_and_align(monster_type *m_ptr, bool inc)
+{
+       s32b old_friend_align = friend_align;
+       monster_race *r_ptr = &r_info[m_ptr->r_idx];
+
+       if (inc)
+       {
+               total_friends++;
+               if (r_ptr->flags3 & RF3_GOOD) friend_align += r_ptr->level;
+               if (r_ptr->flags3 & RF3_EVIL) friend_align -= r_ptr->level;
+       }
+       else
+       {
+               total_friends--;
+               if (r_ptr->flags3 & RF3_GOOD) friend_align -= r_ptr->level;
+               if (r_ptr->flags3 & RF3_EVIL) friend_align += r_ptr->level;
+       }
+
+       if (old_friend_align != friend_align) p_ptr->update |= (PU_BONUS);
+}
+
 int calculate_upkeep(void)
 {
        s32b old_friend_align = friend_align;
        int m_idx;
        bool have_a_unique = FALSE;
+       s32b total_friend_levels = 0;
 
        total_friends = 0;
-       total_friend_levels = 0;
        friend_align = 0;
 
        for (m_idx = m_max - 1; m_idx >=1; m_idx--)
@@ -5324,9 +1745,9 @@ void do_cmd_pet_dismiss(void)
                        handle_stuff();
 
 #ifdef JP
-                       sprintf(buf, "%s¤òÊü¤·¤Þ¤¹¤«¡© [Yes/No/Unnamed (%dɤ)]", friend_name, max_pet-i);
+                       sprintf(buf, "%s¤òÊü¤·¤Þ¤¹¤«¡© [Yes/No/Unnamed (%dÂÎ)]", friend_name, max_pet - i);
 #else
-                       sprintf(buf, "Dismiss %s? [Yes/No/Unnamed (%d remain)]", friend_name, max_pet-i);
+                       sprintf(buf, "Dismiss %s? [Yes/No/Unnamed (%d remain)]", friend_name, max_pet - i);
 #endif
                        prt(buf, 0, 0);
 
@@ -5374,7 +1795,7 @@ void do_cmd_pet_dismiss(void)
                                char m_name[80];
 
                                monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                               do_cmd_write_nikki(NIKKI_NAMED_PET, 2, m_name);
+                               do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
                        }
 
                        if (pet_ctr == p_ptr->riding)
@@ -5414,7 +1835,7 @@ void do_cmd_pet_dismiss(void)
        C_KILL(who, max_m_idx, u16b);
 
 #ifdef JP
-       msg_format("%d ɤ¤Î¥Ú¥Ã¥È¤òÊü¤·¤Þ¤·¤¿¡£", Dismissed);
+       msg_format("%d ÂΤΥڥåȤòÊü¤·¤Þ¤·¤¿¡£", Dismissed);
 #else
        msg_format("You have dismissed %d pet%s.", Dismissed,
                   (Dismissed == 1 ? "" : "s"));
@@ -5626,6 +2047,8 @@ bool do_riding(bool force)
        x = px + ddx[dir];
        c_ptr = &cave[y][x];
 
+       if (p_ptr->special_defense & KATA_MUSOU) set_action(ACTION_NONE);
+
        if (p_ptr->riding)
        {
                /* Skip non-empty grids */
@@ -5739,11 +2162,11 @@ bool do_riding(bool force)
                        return FALSE;
                }
 
-               if (m_ptr->csleep)
+               if (MON_CSLEEP(m_ptr))
                {
                        char m_name[80];
                        monster_desc(m_name, m_ptr, 0);
-                       m_ptr->csleep = 0;
+                       (void)set_monster_csleep(c_ptr->m_idx, 0);
 #ifdef JP
                        msg_format("%s¤òµ¯¤³¤·¤¿¡£", m_name);
 #else
@@ -5751,6 +2174,8 @@ bool do_riding(bool force)
 #endif
                }
 
+               if (p_ptr->action == ACTION_KAMAE) set_action(ACTION_NONE);
+
                p_ptr->riding = c_ptr->m_idx;
 
                /* Hack -- remove tracked monster */
@@ -5854,7 +2279,7 @@ static void do_name_pet(void)
                                        char m_name[80];
 
                                        monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                                       do_cmd_write_nikki(NIKKI_NAMED_PET, 0, m_name);
+                                       do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_NAME, m_name);
                                }
                        }
                        else
@@ -5864,7 +2289,7 @@ static void do_name_pet(void)
                                        char m_name[80];
 
                                        monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                                       do_cmd_write_nikki(NIKKI_NAMED_PET, 1, m_name);
+                                       do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_UNNAME, m_name);
                                }
                                m_ptr->nickname = 0;
                        }
@@ -5890,11 +2315,11 @@ void do_cmd_pet(void)
 
        int mode = 0;
 
-       byte y = 1, x = 0;
-       int ctr = 0;
        char buf[160];
        char target_buf[160];
 
+       int menu_line = use_menu ? 1 : 0;
+
        num = 0;
 
 #ifdef JP
@@ -5906,18 +2331,18 @@ void do_cmd_pet(void)
        powers[num++] = PET_DISMISS;
 
 #ifdef JP
-       sprintf(target_buf,"¥Ú¥Ã¥È¤Î¥¿¡¼¥²¥Ã¥È¤ò»ØÄê (¸½ºß¡§%s)",
-               (pet_t_m_idx ? r_name + r_info[m_list[pet_t_m_idx].r_idx].name : "»ØÄê¤Ê¤·"));
+       sprintf(target_buf, "¥Ú¥Ã¥È¤Î¥¿¡¼¥²¥Ã¥È¤ò»ØÄê (¸½ºß¡§%s)",
+               (pet_t_m_idx ? (p_ptr->image ? "²¿¤«´ñ̯¤Êʪ" : (r_name + r_info[m_list[pet_t_m_idx].ap_r_idx].name)) : "»ØÄê¤Ê¤·"));
 #else
-       sprintf(target_buf,"specify a targert of pet (now:%s)",
-               (pet_t_m_idx ? r_name + r_info[m_list[pet_t_m_idx].r_idx].name : "nothing"));
+       sprintf(target_buf, "specify a target of pet (now:%s)",
+               (pet_t_m_idx ? (p_ptr->image ? "something strange" : (r_name + r_info[m_list[pet_t_m_idx].ap_r_idx].name)) : "nothing"));
 #endif
        power_desc[num] = target_buf;
 
        powers[num++] = PET_TARGET;
 
 #ifdef JP
-power_desc[num] = "¶á¤¯¤Ë¤¤¤í";
+       power_desc[num] = "¶á¤¯¤Ë¤¤¤í";
 #else
        power_desc[num] = "stay close";
 #endif
@@ -5935,7 +2360,7 @@ power_desc[num] = "
        powers[num++] = PET_FOLLOW_ME;
 
 #ifdef JP
-power_desc[num] = "Ũ¤ò¸«¤Ä¤±¤ÆÅݤ»";
+       power_desc[num] = "Ũ¤ò¸«¤Ä¤±¤ÆÅݤ»";
 #else
        power_desc[num] = "seek and destroy";
 #endif
@@ -5944,7 +2369,7 @@ power_desc[num] = "Ũ
        powers[num++] = PET_SEEK_AND_DESTROY;
 
 #ifdef JP
-power_desc[num] = "¾¯¤·Î¥¤ì¤Æ¤¤¤í";
+       power_desc[num] = "¾¯¤·Î¥¤ì¤Æ¤¤¤í";
 #else
        power_desc[num] = "give me space";
 #endif
@@ -5953,7 +2378,7 @@ power_desc[num] = "
        powers[num++] = PET_ALLOW_SPACE;
 
 #ifdef JP
-power_desc[num] = "Î¥¤ì¤Æ¤¤¤í";
+       power_desc[num] = "Î¥¤ì¤Æ¤¤¤í";
 #else
        power_desc[num] = "stay away";
 #endif
@@ -5968,7 +2393,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "pets open doors (now On)";
 #endif
-
        }
        else
        {
@@ -5977,7 +2401,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "pets open doors (now Off)";
 #endif
-
        }
        powers[num++] = PET_OPEN_DOORS;
 
@@ -5988,7 +2411,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "pets pick up items (now On)";
 #endif
-
        }
        else
        {
@@ -5997,7 +2419,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "pets pick up items (now Off)";
 #endif
-
        }
        powers[num++] = PET_TAKE_ITEMS;
 
@@ -6008,7 +2429,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "allow teleport (now On)";
 #endif
-
        }
        else
        {
@@ -6017,7 +2437,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "allow teleport (now Off)";
 #endif
-
        }
        powers[num++] = PET_TELEPORT;
 
@@ -6028,7 +2447,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "allow cast attack spell (now On)";
 #endif
-
        }
        else
        {
@@ -6037,7 +2455,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "allow cast attack spell (now Off)";
 #endif
-
        }
        powers[num++] = PET_ATTACK_SPELL;
 
@@ -6048,7 +2465,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "allow cast summon spell (now On)";
 #endif
-
        }
        else
        {
@@ -6057,7 +2473,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "allow cast summon spell (now Off)";
 #endif
-
        }
        powers[num++] = PET_SUMMON_SPELL;
 
@@ -6068,7 +2483,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "allow involve player in area spell (now On)";
 #endif
-
        }
        else
        {
@@ -6077,7 +2491,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "allow involve player in area spell (now Off)";
 #endif
-
        }
        powers[num++] = PET_BALL_SPELL;
 
@@ -6088,7 +2501,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "get off a pet";
 #endif
-
        }
        else
        {
@@ -6097,7 +2509,6 @@ power_desc[num] = "Υ
 #else
                power_desc[num] = "ride a pet";
 #endif
-
        }
        powers[num++] = PET_RIDING;
 
@@ -6189,91 +2600,126 @@ power_desc[num] = "Υ
                }
        }
 
+#ifdef ALLOW_REPEAT
+       if (!(repeat_pull(&i) && (i >= 0) && (i < num)))
+       {
+#endif /* ALLOW_REPEAT */
+
        /* Nothing chosen yet */
        flag = FALSE;
 
-       /* Build a prompt (accept all spells) */
-       if (num <= 26)
+       /* No redraw yet */
+       redraw = FALSE;
+
+       if (use_menu)
        {
-               /* Build a prompt (accept all spells) */
+               /* Save the screen */
+               screen_save();
+
+               /* Build a prompt */
 #ifdef JP
-strnfmt(out_val, 78, "(¥³¥Þ¥ó¥É %c-%c¡¢'*'=°ìÍ÷¡¢ESC=½ªÎ») ¥³¥Þ¥ó¥É¤òÁª¤ó¤Ç¤¯¤À¤µ¤¤:",
+               strnfmt(out_val, 78, "(¥³¥Þ¥ó¥É¡¢ESC=½ªÎ») ¥³¥Þ¥ó¥É¤òÁª¤ó¤Ç¤¯¤À¤µ¤¤:");
 #else
-               strnfmt(out_val, 78, "(Command %c-%c, *=List, ESC=exit) Select a command: ",
+               strnfmt(out_val, 78, "(Command, ESC=exit) Choose command from menu.");
 #endif
-
-                       I2A(0), I2A(num - 1));
        }
        else
        {
+               /* Build a prompt */
+               strnfmt(out_val, 78,
 #ifdef JP
-strnfmt(out_val, 78, "(¥³¥Þ¥ó¥É %c-%c¡¢'*'=°ìÍ÷¡¢ESC=½ªÎ») ¥³¥Þ¥ó¥É¤òÁª¤ó¤Ç¤¯¤À¤µ¤¤:",
+                       "(¥³¥Þ¥ó¥É %c-%c¡¢'*'=°ìÍ÷¡¢ESC=½ªÎ») ¥³¥Þ¥ó¥É¤òÁª¤ó¤Ç¤¯¤À¤µ¤¤:",
 #else
-               strnfmt(out_val, 78, "(Command %c-%c, *=List, ESC=exit) Select a command: ",
+                       "(Command %c-%c, *=List, ESC=exit) Select a command: ",
 #endif
-
-                       I2A(0), '0' + num - 27);
+                       I2A(0), I2A(num - 1));
        }
 
-       /* Show list */
-       redraw = TRUE;
+       choice = (always_show_list || use_menu) ? ESCAPE : 1;
 
-       /* Save the screen */
-       Term_save();
+       /* Get a command from the user */
+       while (!flag)
+       {
+               if (choice == ESCAPE) choice = ' ';
+               else if (!get_com(out_val, &choice, TRUE)) break;
 
-       prt("", y++, x);
+               if (use_menu && (choice != ' '))
+               {
+                       switch (choice)
+                       {
+                       case '0':
+                               screen_load();
+                               return;
 
-       while (ctr < num)
-       {
-               prt(format("%s%c) %s", (ctr == mode) ? "*" : " ", I2A(ctr), power_desc[ctr]), y + ctr, x);
-               ctr++;
-       }
+                       case '8':
+                       case 'k':
+                       case 'K':
+                               menu_line += (num - 1);
+                               break;
 
-       if (ctr < 17)
-       {
-               prt("", y + ctr, x);
-       }
-       else
-       {
-               prt("", y + 17, x);
-       }
+                       case '2':
+                       case 'j':
+                       case 'J':
+                               menu_line++;
+                               break;
+
+                       case '4':
+                       case 'h':
+                       case 'H':
+                               menu_line = 1;
+                               break;
+
+                       case '6':
+                       case 'l':
+                       case 'L':
+                               menu_line = num;
+                               break;
+
+                       case 'x':
+                       case 'X':
+                       case '\r':
+                       case '\n':
+                               i = menu_line - 1;
+                               ask = FALSE;
+                               break;
+                       }
+                       if (menu_line > num) menu_line -= num;
+               }
 
-       /* Get a command from the user */
-       while (!flag && get_com(out_val, &choice, TRUE))
-       {
                /* Request redraw */
-               if ((choice == ' ') || (choice == '*') || (choice == '?'))
+               if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
                {
                        /* Show the list */
-                       if (!redraw)
+                       if (!redraw || use_menu)
                        {
-                               y = 1;
-                               x = 0;
-                               ctr = 0;
+                               byte y = 1, x = 0;
+                               int ctr = 0;
 
                                /* Show list */
                                redraw = TRUE;
 
                                /* Save the screen */
-                               Term_save();
+                               if (!use_menu) screen_save();
 
                                prt("", y++, x);
 
-                               while (ctr < num)
+                               /* Print list */
+                               for (ctr = 0; ctr < num; ctr++)
                                {
-                                       sprintf(buf, "%s%c) %s", (ctr == mode) ? "*" : " ", I2A(ctr), power_desc[ctr]);
+                                       /* Letter/number for power selection */
+#ifdef JP
+                                       if (use_menu) sprintf(buf, "%c%s ", (ctr == mode) ? '*' : ' ', (ctr == (menu_line - 1)) ? "¡Õ" : "  ");
+#else
+                                       if (use_menu) sprintf(buf, "%c%s ", (ctr == mode) ? '*' : ' ', (ctr == (menu_line - 1)) ? "> " : "  ");
+#endif
+                                       else sprintf(buf, "%c%c) ", (ctr == mode) ? '*' : ' ', I2A(ctr));
+
+                                       strcat(buf, power_desc[ctr]);
+
                                        prt(buf, y + ctr, x);
-                                       ctr++;
                                }
 
-                               if (ctr < 17)
-                               {
-                                       prt("", y + ctr, x);
-                               }
-                               else
-                               {
-                                       prt("", y + 17, x);
-                               }
+                               prt("", y + MIN(ctr, 17), x);
                        }
 
                        /* Hide the list */
@@ -6283,14 +2729,14 @@ strnfmt(out_val, 78, "(
                                redraw = FALSE;
 
                                /* Restore the screen */
-                               Term_load();
+                               screen_load();
                        }
 
                        /* Redo asking */
                        continue;
                }
 
-               if (isalpha(choice))
+               if (!use_menu)
                {
                        /* Note verify */
                        ask = (isupper(choice));
@@ -6301,12 +2747,6 @@ strnfmt(out_val, 78, "(
                        /* Extract request */
                        i = (islower(choice) ? A2I(choice) : -1);
                }
-               else
-               {
-                       ask = FALSE; /* Can't uppercase digits */
-
-                       i = choice - '0' + 26;
-               }
 
                /* Totally Illegal */
                if ((i < 0) || (i >= num))
@@ -6325,7 +2765,6 @@ strnfmt(out_val, 78, "(
                        strnfmt(buf, 78, "Use %s? ", power_desc[i]);
 #endif
 
-
                        /* Belay that order */
                        if (!get_check(buf)) continue;
                }
@@ -6335,7 +2774,7 @@ strnfmt(out_val, 78, "(
        }
 
        /* Restore the screen */
-       if (redraw) Term_load();
+       if (redraw) screen_load();
 
        /* Abort if needed */
        if (!flag)
@@ -6344,6 +2783,11 @@ strnfmt(out_val, 78, "(
                return;
        }
 
+#ifdef ALLOW_REPEAT
+       repeat_push(i);
+       }
+#endif /* ALLOW_REPEAT */
+
        switch (powers[i])
        {
                case PET_DISMISS: /* Dismiss pets */