OSDN Git Service

讚・ヤ・テ・ネ、ホシツチ」FEAT_INVIS、ックォチー、ホウォフ逾ネ・鬣テ・ラ、ネ、キ、ニホョヘム。」
[hengbandforosx/hengbandosx.git] / src / cmd5.c
index c4fe21c..4de1360 100644 (file)
@@ -78,7 +78,7 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm
        if (repeat_pull(sn))
        {
                /* Verify the spell */
-               if (spell_okay(*sn, learned, FALSE, use_realm - 1))
+               if (spell_okay(*sn, learned, FALSE, use_realm))
                {
                        /* Success */
                        return (TRUE);
@@ -110,7 +110,7 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm
        for (i = 0; i < num; i++)
        {
                /* Look for "okay" spells */
-               if (spell_okay(spells[i], learned, FALSE, use_realm - 1)) okay = TRUE;
+               if (spell_okay(spells[i], learned, FALSE, use_realm)) okay = TRUE;
        }
 
        /* No "okay" spells */
@@ -186,6 +186,7 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm
                                case 'x':
                                case 'X':
                                case '\r':
+                               case '\n':
                                {
                                        i = menu_line - 1;
                                        ask = FALSE;
@@ -194,7 +195,7 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm
                        }
                        if (menu_line > num) menu_line -= num;
                        /* Display a list of spells */
-                       print_spells(menu_line, spells, num, 1, 15, use_realm - 1);
+                       print_spells(menu_line, spells, num, 1, 15, use_realm);
                        if (ask) continue;
                }
                else
@@ -212,7 +213,7 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm
                                        screen_save();
 
                                        /* Display a list of spells */
-                                       print_spells(menu_line, spells, num, 1, 15, use_realm - 1);
+                                       print_spells(menu_line, spells, num, 1, 15, use_realm);
                                }
 
                                /* Hide the list */
@@ -253,7 +254,7 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm
                spell = spells[i];
 
                /* Require "okay" spells */
-               if (!spell_okay(spell, learned, FALSE, use_realm - 1))
+               if (!spell_okay(spell, learned, FALSE, use_realm))
                {
                        bell();
 #ifdef JP
@@ -273,11 +274,11 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm
                        /* Access the spell */
                        if (!is_magic(use_realm))
                        {
-                               s_ptr = &technic_info[use_realm - MIN_TECHNIC - 1][spell];
+                               s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
                        }
                        else
                        {
-                               s_ptr = &mp_ptr->info[use_realm - 1][spell % 32];
+                               s_ptr = &mp_ptr->info[use_realm - 1][spell];
                        }
 
                        if (use_realm == REALM_HISSATSU)
@@ -286,12 +287,8 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm
                        }
                        else
                        {
-                               if (p_ptr->pclass == CLASS_SORCERER)
-                                       shouhimana = s_ptr->smana*2200 + 2399;
-                               else if (p_ptr->pclass == CLASS_RED_MAGE)
-                                       shouhimana = s_ptr->smana*2600 + 2399;
-                               else
-                                       shouhimana = (s_ptr->smana*(3800-spell_exp[spell])+2399);
+                               /* Extract mana consumption rate */
+                               shouhimana = s_ptr->smana*(3800 - experience_of_spell(spell, use_realm)) + 2399;
                                if(p_ptr->dec_mana)
                                        shouhimana *= 3;
                                else shouhimana *= 4;
@@ -304,12 +301,12 @@ 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 % 32], shouhimana,
-                                      spell_chance(spell, use_realm -1),jverb_buf);
+                                spell_names[technic2magic(use_realm)-1][spell], shouhimana,
+                                      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 % 32], shouhimana,
-                               spell_chance(spell, use_realm - 1));
+                               prompt, spell_names[technic2magic(use_realm)-1][spell], shouhimana,
+                               spell_chance(spell, use_realm));
 #endif
 
 
@@ -360,13 +357,13 @@ static bool item_tester_learn_spell(object_type *o_ptr)
 
        if (p_ptr->pclass == CLASS_PRIEST)
        {
-               if (p_ptr->realm1 == REALM_LIFE)
+               if (is_good_realm(p_ptr->realm1))
                {
                        choices &= ~(CH_DEATH | CH_DAEMON);
                }
-               else if ((p_ptr->realm1 == REALM_DEATH) || (p_ptr->realm1 == REALM_DAEMON))
+               else
                {
-                       choices &= ~(CH_LIFE);
+                       choices &= ~(CH_LIFE | CH_CRUSADE);
                }
        }
 
@@ -512,7 +509,7 @@ s = "
                        if (spell == -1) break;
 
                        /* Display a list of spells */
-                       print_spells(0, spells, num, 1, 15, use_realm - 1);
+                       print_spells(0, spells, num, 1, 15, use_realm);
 
                        /* Notify that there's nothing to see, and wait. */
                        if (use_realm == REALM_HISSATSU)
@@ -545,7 +542,7 @@ s = "
                /* Access the spell */
                if (!is_magic(use_realm))
                {
-                       s_ptr = &technic_info[use_realm - MIN_TECHNIC - 1][spell];
+                       s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
                }
                else
                {
@@ -572,19 +569,19 @@ static void change_realm2(int next_realm)
 
        for (i = 0; i < 64; i++)
        {
-               spell_order[j] = spell_order[i];
-               if(spell_order[i] < 32) j++;
+               p_ptr->spell_order[j] = p_ptr->spell_order[i];
+               if(p_ptr->spell_order[i] < 32) j++;
        }
        for (; j < 64; j++)
-               spell_order[j] = 99;
+               p_ptr->spell_order[j] = 99;
 
        for (i = 32; i < 64; i++)
        {
-               spell_exp[i] = 0;
+               p_ptr->spell_exp[i] = 0;
        }
-       spell_learned2 = 0L;
-       spell_worked2 = 0L;
-       spell_forgotten2 = 0L;  
+       p_ptr->spell_learned2 = 0L;
+       p_ptr->spell_worked2 = 0L;
+       p_ptr->spell_forgotten2 = 0L;   
 
 #ifdef JP
        sprintf(tmp,"ËâË¡¤ÎÎΰè¤ò%s¤«¤é%s¤ËÊѹ¹¤·¤¿¡£", realm_names[p_ptr->realm2], realm_names[next_realm]);
@@ -767,7 +764,7 @@ s = "
                        {
                                /* Skip non "okay" prayers */
                                if (!spell_okay(spell, FALSE, TRUE,
-                                       (increment ? p_ptr->realm2 - 1 : p_ptr->realm1 - 1))) continue;
+                                       (increment ? p_ptr->realm2 : p_ptr->realm1))) continue;
 
                                /* Hack -- Prepare the randomizer */
                                k++;
@@ -802,19 +799,19 @@ msg_format("
        /* Learn the spell */
        if (spell < 32)
        {
-               if (spell_learned1 & (1L << spell)) learned = TRUE;
-               else spell_learned1 |= (1L << spell);
+               if (p_ptr->spell_learned1 & (1L << spell)) learned = TRUE;
+               else p_ptr->spell_learned1 |= (1L << spell);
        }
        else
        {
-               if (spell_learned2 & (1L << (spell - 32))) learned = TRUE;
-               else spell_learned2 |= (1L << (spell - 32));
+               if (p_ptr->spell_learned2 & (1L << (spell - 32))) learned = TRUE;
+               else p_ptr->spell_learned2 |= (1L << (spell - 32));
        }
 
        if (learned)
        {
                int max_exp = (spell < 32) ? 1600 : 1400;
-               int old_exp = spell_exp[spell];
+               int old_exp = p_ptr->spell_exp[spell];
                int new_rank = 0;
                cptr name = spell_names[technic2magic(increment ? p_ptr->realm2 : p_ptr->realm1)-1][spell%32];
 
@@ -837,23 +834,23 @@ msg_format("
                }
                else if (old_exp >= 1400)
                {
-                       spell_exp[spell] = 1600;
+                       p_ptr->spell_exp[spell] = 1600;
                        new_rank = 4;
                }
                else if (old_exp >= 1200)
                {
-                       if (spell >= 32) spell_exp[spell] = 1400;
-                       else spell_exp[spell] += 200;
+                       if (spell >= 32) p_ptr->spell_exp[spell] = 1400;
+                       else p_ptr->spell_exp[spell] += 200;
                        new_rank = 3;
                }
                else if (old_exp >= 900)
                {
-                       spell_exp[spell] = 1200+(old_exp-900)*2/3;
+                       p_ptr->spell_exp[spell] = 1200+(old_exp-900)*2/3;
                        new_rank = 2;
                }
                else
                {
-                       spell_exp[spell] = 900+(old_exp)/3;
+                       p_ptr->spell_exp[spell] = 900+(old_exp)/3;
                        new_rank = 1;
                }
 #ifdef JP
@@ -864,15 +861,15 @@ msg_format("
        }
        else
        {
-               /* Find the next open entry in "spell_order[]" */
+               /* Find the next open entry in "p_ptr->spell_order[]" */
                for (i = 0; i < 64; i++)
                {
                        /* Stop at the first empty space */
-                       if (spell_order[i] == 99) break;
+                       if (p_ptr->spell_order[i] == 99) break;
                }
 
                /* Add the spell to the known list */
-               spell_order[i++] = spell;
+               p_ptr->spell_order[i++] = spell;
 
                /* Mention the result */
 #ifdef JP
@@ -936,7 +933,7 @@ msg_format("
 }
 
 
-void wild_magic(int spell)
+static void wild_magic(int spell)
 {
        int counter = 0;
        int type = SUMMON_BIZARRE1 + randint0(6);
@@ -1000,7 +997,7 @@ void wild_magic(int spell)
                break;
        case 29:
        case 30:
-               apply_disenchant(0);
+               apply_disenchant(1);
                break;
        case 31:
                lose_all_info();
@@ -1015,7 +1012,7 @@ void wild_magic(int spell)
        case 35:
                while (counter++ < 8)
                {
-                       (void)summon_specific(0, py, px, (dun_level * 3) / 2, type, TRUE, FALSE, FALSE, FALSE, TRUE);
+                       (void)summon_specific(0, py, px, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
                }
                break;
        case 36:
@@ -1044,31 +1041,32 @@ static bool cast_life_spell(int spell)
 
        switch (spell)
        {
-       case 0: /* Detect Evil */
-               (void)detect_monsters_evil(DETECT_RAD_DEFAULT);
-               break;
-       case 1: /* Cure Light Wounds */
+       case 0: /* Cure Light Wounds */
                (void)hp_player(damroll(2, 10));
                (void)set_cut(p_ptr->cut - 10);
                break;
-       case 2: /* Bless */
+       case 1: /* Bless */
                (void)set_blessed(randint1(12) + 12, FALSE);
                break;
-       case 3: /* Remove Fear */
-               (void)set_afraid(0);
+       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 4: /* Call Light */
+       case 3: /* Call Light */
                (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
                break;
-       case 5: /* Detect Traps + Secret Doors */
+       case 4: /* Detect Traps + Secret Doors */
                (void)detect_traps(DETECT_RAD_DEFAULT);
                (void)detect_doors(DETECT_RAD_DEFAULT);
                (void)detect_stairs(DETECT_RAD_DEFAULT);
                break;
-       case 6: /* Cure Medium Wounds */
+       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;
@@ -1082,30 +1080,24 @@ static bool cast_life_spell(int spell)
 #endif
                }
                break;
-       case 9: /* Cure Poison */
-               (void)set_poisoned(0);
+       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: /* Sense Unseen */
-               (void)set_tim_invis(randint1(24) + 24, FALSE);
+       case 11:
+               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+               (void)set_oppose_fire(randint1(20) + 20, FALSE);
                break;
-       case 12: /* 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));
-
+       case 12:
+               map_area(DETECT_RAD_MAP);
                break;
-       case 13: /* Protection from Evil */
-               (void)set_protevil(randint1(25) + 3 * p_ptr->lev, FALSE);
+       case 13:
+               (void)turn_undead();
                break;
        case 14: /* Healing */
                (void)hp_player(300);
@@ -1115,12 +1107,7 @@ static bool cast_life_spell(int spell)
        case 15: /* Glyph of Warding */
                warding_glyph();
                break;
-       case 16: /* Exorcism */
-               (void)dispel_undead(randint1(plev));
-               (void)dispel_demons(randint1(plev));
-               (void)turn_evil(plev);
-               break;
-       case 17: /* Dispel Curse */
+       case 16: /* Dispel Curse */
                if (remove_all_curse())
                {
 #ifdef JP
@@ -1130,51 +1117,41 @@ static bool cast_life_spell(int spell)
 #endif
                }
                break;
-       case 18: /* Dispel Undead + Demons */
-               (void)dispel_undead(randint1(plev * 3));
-               (void)dispel_demons(randint1(plev * 3));
+       case 17: /* Perception */
+               return ident_spell(FALSE, 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: /* Dispel Evil */
-               (void)dispel_evil(randint1(plev * 4));
+       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: /* Banishment */
-               if (banish_evil(100))
-               {
-#ifdef JP
-msg_print("¿À¤Î¸æÎϤ¬¼Ù°­¤òÂǤÁʧ¤Ã¤¿¡ª");
-#else
-                       msg_print("The power of your god banishes evil!");
-#endif
-
-               }
+       case 21: /* Word of Recall */
+               if (!word_of_recall()) return FALSE;
                break;
-       case 22: /* Holy Word */
-               (void)dispel_evil(randint1(plev * 4));
-               (void)hp_player(1000);
-               (void)set_afraid(0);
-               (void)set_poisoned(0);
-               (void)set_stun(0);
-               (void)set_cut(0);
+       case 22: /* Alter Reality */
+               alter_reality();
                break;
        case 23: /* Warding True */
                warding_glyph();
                glyph_creation();
                break;
-       case 24: /* Heroism */
-               (void)set_hero(randint1(25) + 25, FALSE);
-               (void)hp_player(10);
-               (void)set_afraid(0);
+       case 24:
+               num_repro += MAX_REPRO;
                break;
-       case 25: /* Prayer */
-               (void)set_blessed(randint1(48) + 48, FALSE);
+       case 25: /* Detection True */
+               (void)detect_all(DETECT_RAD_DEFAULT);
                break;
-       case 26: /* Turn Undead */
+       case 26: /* Genocide Undead */
                (void)mass_genocide_undead(plev+50,TRUE);
                break;
-       case 27: /* Restoration */
+       case 27: /* Clairvoyance */
+               wiz_lite(FALSE, FALSE);
+               break;
+       case 28: /* Restoration */
                (void)do_res_stat(A_STR);
                (void)do_res_stat(A_INT);
                (void)do_res_stat(A_WIS);
@@ -1183,27 +1160,13 @@ msg_print("
                (void)do_res_stat(A_CHR);
                (void)restore_level();
                break;
-       case 28: /* Healing True */
+       case 29: /* Healing True */
                (void)hp_player(2000);
                (void)set_stun(0);
                (void)set_cut(0);
                break;
-       case 29: /* Holy Vision */
-               return identify_fully(FALSE);
-       case 30: /* Divine Intervention */
-               project(0, 1, py, px, 500, 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);
-               summon_specific(-1, py, px, plev, SUMMON_ANGEL, TRUE, TRUE, TRUE, FALSE, FALSE);
-               (void)set_hero(randint1(25) + 25, FALSE);
-               (void)hp_player(300);
-               (void)set_fast(randint1(20 + plev) + plev, FALSE);
-               (void)set_afraid(0);
-               break;
+       case 30: /* Holy Vision */
+               return identify_fully(FALSE, FALSE);
        case 31: /* Ultimate resistance */
        {
                int v = randint1(plev/2)+plev/2;
@@ -1271,7 +1234,7 @@ static bool cast_sorcery_spell(int spell)
                map_area(DETECT_RAD_MAP);
                break;
        case 9: /* Identify */
-               return ident_spell(FALSE);
+               return ident_spell(FALSE, FALSE);
        case 10: /* Slow Monster */
                if (!get_aim_dir(&dir)) return FALSE;
 
@@ -1292,7 +1255,7 @@ static bool cast_sorcery_spell(int spell)
                (void)detect_all(DETECT_RAD_DEFAULT);
                break;
        case 15: /* Identify True */
-               return identify_fully(FALSE);
+               return identify_fully(FALSE, FALSE);
        case 16: /* Detect Objects and Treasure*/
                (void)detect_objects_normal(DETECT_RAD_DEFAULT);
                (void)detect_treasure(DETECT_RAD_DEFAULT);
@@ -1477,7 +1440,7 @@ msg_print("
                slow_monsters();
                break;
        case 14: /* Summon Animals */
-               if (!(summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, TRUE, TRUE, TRUE, FALSE, FALSE)))
+               if (!(summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET))))
                        no_trump = TRUE;
                break;
        case 15: /* Herbal Healing */
@@ -1506,7 +1469,7 @@ msg_print("
                (void)charm_animals(plev * 2);
                break;
        case 21: /* Stone Tell */
-               return identify_fully(FALSE);
+               return identify_fully(FALSE, FALSE);
        case 22: /* Wall of Stone */
                (void)wall_stone();
                break;
@@ -1823,10 +1786,14 @@ msg_print("
                break;
        case 23: /* Summon monster, demon */
                {
-                       bool pet = one_in_(3);
-                       bool group = !(pet && (plev < 50));
+                       u32b mode = 0L;
+                       bool pet = !one_in_(3);
 
-                       if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
+                       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("ⲫ¤Î°­½­¤¬½¼Ëþ¤·¤¿¡£");
@@ -2095,7 +2062,7 @@ msg_print("
                                msg_print("Oh no! Mouldering forms rise from the earth around you!");
 #endif
 
-                               (void)summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, TRUE, FALSE, FALSE, TRUE, TRUE);
+                               (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)
@@ -2258,21 +2225,19 @@ msg_print("
                break;
        case 25: /* Raise the Dead */
                {
-                       bool pet = one_in_(3);
-                       bool group;
                        int type;
+                       bool pet = one_in_(3);
+                       u32b mode = 0L;
 
                        type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
-                       if (pet)
-                       {
-                               group = (((plev > 24) && one_in_(3)) ? TRUE : FALSE);
-                       }
-                       else
-                       {
-                               group = TRUE;
-                       }
 
-                       if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, type, group, FALSE, pet, (bool)(!pet), (bool)(!pet)))
+                       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("Î䤿¤¤É÷¤¬¤¢¤Ê¤¿¤Î¼þ¤ê¤Ë¿á¤­»Ï¤á¤¿¡£¤½¤ì¤ÏÉåÇÔ½­¤ò±¿¤ó¤Ç¤¤¤ë...");
@@ -2302,9 +2267,9 @@ msg_print("
                }
        case 26: /* Esoteria */
                if (randint1(50) > plev)
-                       return ident_spell(FALSE);
+                       return ident_spell(FALSE, FALSE);
                else
-                       return identify_fully(FALSE);
+                       return identify_fully(FALSE, FALSE);
                break;
        case 27: /* Mimic vampire */
                (void)set_mimic(10+plev/2 + randint1(10+plev/2), MIMIC_VAMPIRE, FALSE);
@@ -2366,6 +2331,10 @@ static bool cast_trump_spell(int spell, bool success)
                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("¤¢¤Ê¤¿¤ÏÃØéá¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -2373,8 +2342,7 @@ msg_print("
                        msg_print("You concentrate on the trump of an spider...");
 #endif
 
-
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_SPIDER, TRUE, FALSE, pet, FALSE, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_SPIDER, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -2382,7 +2350,6 @@ msg_print("
 #else
                                        msg_print("The summoned spiders get angry!");
 #endif
-
                        }
                        else
                        {
@@ -2444,7 +2411,7 @@ msg_print("
                                        msg_print("Oh no! It's the Devil!");
 #endif
 
-                                       (void)summon_specific(0, py, px, dun_level, SUMMON_DEMON, TRUE, FALSE, FALSE, TRUE, TRUE);
+                                       (void)summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                                }
                                else if (die < 18)
                                {
@@ -2486,7 +2453,7 @@ msg_print("
                                        msg_print("It's the picture of a strange monster.");
 #endif
 
-                                       if (!(summon_specific(0, py, px, (dun_level * 3) / 2, 32 + randint1(6), TRUE, FALSE, FALSE, TRUE, TRUE)))
+                                       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)
@@ -2587,7 +2554,7 @@ msg_print("ͧ
                                        msg_print("It's the picture of a friendly monster.");
 #endif
 
-                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE1, FALSE, TRUE, TRUE, FALSE, FALSE)))
+                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE1, PM_FORCE_PET)))
                                                no_trump = TRUE;
                                }
                                else if (die < 84)
@@ -2598,7 +2565,7 @@ msg_print("ͧ
                                        msg_print("It's the picture of a friendly monster.");
 #endif
 
-                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE2, FALSE, TRUE, TRUE, FALSE, FALSE)))
+                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE2, PM_FORCE_PET)))
                                                no_trump = TRUE;
                                }
                                else if (die < 86)
@@ -2609,7 +2576,7 @@ msg_print("ͧ
                                        msg_print("It's the picture of a friendly monster.");
 #endif
 
-                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE4, FALSE, TRUE, TRUE, FALSE, FALSE)))
+                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE4, PM_FORCE_PET)))
                                                no_trump = TRUE;
                                }
                                else if (die < 88)
@@ -2620,7 +2587,7 @@ msg_print("ͧ
                                        msg_print("It's the picture of a friendly monster.");
 #endif
 
-                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE5, FALSE, TRUE, TRUE, FALSE, FALSE)))
+                                       if (!(summon_specific(-1, py, px, (dun_level * 3) / 2, SUMMON_BIZARRE5, PM_FORCE_PET)))
                                                no_trump = TRUE;
                                }
                                else if (die < 96)
@@ -2730,7 +2697,10 @@ msg_print("
                {
                        bool pet = success; /* was (randint1(5) > 2) */
                        int type = (pet ? SUMMON_ANIMAL_RANGER : SUMMON_ANIMAL);
-                       bool group = (pet ? FALSE : TRUE);
+                       u32b mode = 0L;
+
+                       if (pet) mode |= PM_FORCE_PET;
+                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
 
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤Ïưʪ¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -2739,7 +2709,7 @@ msg_print("
 #endif
 
 
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, type, group, FALSE, pet, FALSE, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, type, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -2784,9 +2754,12 @@ msg_print("
                        for (dummy = 2 + randint0(plev / 7); dummy > 0; dummy--)
                        {
                                bool pet = success; /* was (randint1(10) > 3) */
-                               bool group = (pet ? FALSE : TRUE);
+                               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;
@@ -2796,7 +2769,7 @@ msg_print("
                                        type = SUMMON_KAMIKAZE;
                                }
 
-                               if (summon_specific((pet ? -1 : 0), y, x, summon_lev, type, group, FALSE, pet, FALSE, (bool)(!pet)))
+                               if (summon_specific((pet ? -1 : 0), y, x, summon_lev, type, mode))
                                {
                                        if (!pet)
 #ifdef JP
@@ -2813,7 +2786,7 @@ msg_print("
                case 10: /* Phantasmal Servant */
                        if (success)
                        {
-                               if (summon_specific(-1, py, px, (summon_lev * 3) / 2, SUMMON_PHANTOM, FALSE, TRUE, TRUE, FALSE, FALSE))
+                               if (summon_specific(-1, py, px, (summon_lev * 3) / 2, SUMMON_PHANTOM, PM_FORCE_PET))
                                {
 #ifdef JP
 msg_print("¸æÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¸æ¼ç¿ÍÍÍ¡©");
@@ -2896,7 +2869,10 @@ msg_print("
                case 17: /* Trump Undead */
                {
                        bool pet = success; /* (randint1(10) > 3) */
-                       bool group = (pet ? FALSE : TRUE);
+                       u32b mode = 0L;
+
+                       if (pet) mode |= PM_FORCE_PET;
+                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
 
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤Ï¥¢¥ó¥Ç¥Ã¥É¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -2905,7 +2881,7 @@ msg_print("
 #endif
 
 
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNDEAD, group, FALSE, pet, FALSE, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNDEAD, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -2925,7 +2901,10 @@ msg_print("
                case 18: /* Trump Reptiles */
                {
                        bool pet = success; /* was (randint1(5) > 2) */
-                       bool group = !pet;
+                       u32b mode = 0L;
+
+                       if (pet) mode |= PM_FORCE_PET;
+                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
 
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤Ïà¨ÃîÎà¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -2934,7 +2913,7 @@ msg_print("
 #endif
 
 
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HYDRA, group, FALSE, pet, FALSE, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HYDRA, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -2965,8 +2944,13 @@ msg_print("
                        for (dummy = 0; dummy < 1 + ((plev - 15)/ 10); dummy++)
                        {
                                bool pet = success; /* was (randint1(10) > 3) */
-                               bool group = (pet ? FALSE : TRUE);
                                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)
                                {
@@ -2977,7 +2961,7 @@ msg_print("
                                        type = 0;
                                }
 
-                               if (summon_specific((pet ? -1 : 0), py, px, summon_lev, type, group, FALSE, pet, unique_okay, (bool)(!pet)))
+                               if (summon_specific((pet ? -1 : 0), py, px, summon_lev, type, mode))
                                {
                                        if (!pet)
 #ifdef JP
@@ -2994,6 +2978,10 @@ msg_print("
                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("¤¢¤Ê¤¿¤Ï¥Ï¥¦¥ó¥É¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -3002,7 +2990,7 @@ msg_print("
 #endif
 
 
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HOUND, TRUE, FALSE, pet, FALSE, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HOUND, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -3047,6 +3035,10 @@ msg_print("
                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("¤¢¤Ê¤¿¤Ï¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -3055,7 +3047,7 @@ msg_print("
 #endif
 
 
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_CYBER, FALSE, FALSE, pet, FALSE, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_CYBER, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -3081,7 +3073,7 @@ msg_print("
                case 25: /* Trump Lore */
                        if (success)
                        {
-                               return identify_fully(FALSE);
+                               return identify_fully(FALSE, FALSE);
                        }
                        break;
                case 26: /* Heal Monster */
@@ -3102,7 +3094,10 @@ msg_print("
                case 27: /* Trump Dragon */
                {
                        bool pet = success; /* was (randint1(10) > 3) */
-                       bool group = (pet ? FALSE : TRUE);
+                       u32b mode = 0L;
+
+                       if (pet) mode |= PM_FORCE_PET;
+                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
 
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤Ï¥É¥é¥´¥ó¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -3111,7 +3106,7 @@ msg_print("
 #endif
 
 
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DRAGON, group, FALSE, pet, FALSE, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DRAGON, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -3163,7 +3158,10 @@ msg_print("
                case 29: /* Trump Demon */
                {
                        bool pet = success; /* was (randint1(10) > 3) */
-                       bool group = (pet ? FALSE : TRUE);
+                       u32b mode = 0L;
+
+                       if (pet) mode |= PM_FORCE_PET;
+                       else mode |= (PM_ALLOW_GROUP | PM_NO_PET);
 
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -3172,7 +3170,7 @@ msg_print("
 #endif
 
 
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DEMON, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -3192,7 +3190,12 @@ msg_print("
                case 30: /* Trump Greater Undead */
                {
                        bool pet = success; /* was (randint1(10) > 3) */
-                       bool group = (pet ? FALSE : TRUE);
+                       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("¤¢¤Ê¤¿¤Ï¶¯ÎϤʥ¢¥ó¥Ç¥Ã¥É¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -3201,7 +3204,7 @@ msg_print("
 #endif
 
 
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, group, FALSE, pet, unique_okay, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -3221,8 +3224,14 @@ msg_print("
                case 31: /* Trump Ancient Dragon */
                {
                        bool pet = success; /* was (randint1(10) > 3) */
-                       bool group = (pet ? FALSE : TRUE);
                        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;
@@ -3239,7 +3248,7 @@ msg_print("
 #endif
 
 
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, type, group, FALSE, pet, unique_okay, (bool)(!pet)))
+                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, type, mode))
                        {
                                if (!pet)
 #ifdef JP
@@ -3367,7 +3376,7 @@ static bool cast_arcane_spell(int spell)
                teleport_player(plev * 5);
                break;
        case 20: /* Identify */
-               return ident_spell(FALSE);
+               return ident_spell(FALSE, FALSE);
        case 21: /* Stone to Mud */
                if (!get_aim_dir(&dir)) return FALSE;
 
@@ -3391,7 +3400,7 @@ msg_print("
                (void)set_tim_invis(randint1(24) + 24, FALSE);
                break;
        case 25: /* Conjure Elemental */
-               if (!summon_specific(-1, py, px, plev, SUMMON_ELEMENTAL, TRUE, TRUE, TRUE, FALSE, FALSE))
+               if (!summon_specific(-1, py, px, plev, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_FORCE_PET)))
                        no_trump = TRUE;
                break;
        case 26: /* Teleport Level */
@@ -3543,7 +3552,7 @@ static bool cast_enchant_spell(int spell)
                (void)pulish_shield();
                break;
        case 22: /* Create Golem */
-               if (summon_specific(-1, py, px, plev, SUMMON_GOLEM, FALSE, TRUE, TRUE, FALSE, FALSE))
+               if (summon_specific(-1, py, px, plev, SUMMON_GOLEM, PM_FORCE_PET))
                {
 #ifdef JP
 msg_print("¥´¡¼¥ì¥à¤òºî¤Ã¤¿¡£");
@@ -3573,7 +3582,7 @@ msg_print("
                }
                break;
        case 26: /* Total Knowledge */
-               return identify_fully(FALSE);
+               return identify_fully(FALSE, FALSE);
                break;
        case 27: /* Enchant Weapon */
                return enchant_spell(randint0(4) + 1, randint0(4) + 1, 0);
@@ -3582,7 +3591,7 @@ msg_print("
                return enchant_spell(0, 0, randint0(3) + 2);
                break;
        case 29: /* Brand Weapon */
-               brand_weapon(randint0(17));
+               brand_weapon(randint0(18));
                break;
        case 30: /* Living Trump */
                if (one_in_(7))
@@ -3674,7 +3683,7 @@ static bool cast_daemon_spell(int spell)
                    damroll(6 + ((plev - 5) / 4), 8));
                break;
        case 6: /* Summon monster, demon */
-               if (!summon_specific(-1, py, px, (plev * 3) / 2, SUMMON_MANES, TRUE, FALSE, TRUE, FALSE, FALSE))
+               if (!summon_specific(-1, py, px, (plev * 3) / 2, SUMMON_MANES, (PM_ALLOW_GROUP | PM_FORCE_PET)))
                {
 #ifdef JP
 msg_print("¸ÅÂå¤Î»àÎî¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
@@ -3726,9 +3735,13 @@ msg_print("
        case 15: /* Summon monster, demon */
        {
                bool pet = !one_in_(3);
-               bool group = !(pet && (plev < 50));
+               u32b mode = 0L;
 
-               if (summon_specific((pet ? -1 : 0), py, px, plev*2/3+randint1(plev/2), SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
+               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("ⲫ¤Î°­½­¤¬½¼Ëþ¤·¤¿¡£");
@@ -3851,7 +3864,7 @@ else msg_print("<
                }
 
                summon_lev = p_ptr->lev * 2 / 3 + r_info[o_ptr->pval].level;
-               if (summon_specific(-1, py, px, summon_lev, SUMMON_HI_DEMON, TRUE, FALSE, TRUE, FALSE, FALSE))
+               if (summon_specific(-1, py, px, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET)))
                {
 #ifdef JP
 msg_print("ⲫ¤Î°­½­¤¬½¼Ëþ¤·¤¿¡£");
@@ -3921,6 +3934,316 @@ take_hit(DAMAGE_USELIFE, 20 + randint1(30), "
 }
 
 
+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);
+               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 */
+               destroy_area(py, px, 13+randint0(5), TRUE);
+               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_SIGHT*2 < distance(py, px, ny, nx)) break;
+
+                               /* Stopped by walls/doors */
+                               if (!cave_floor_bold(ny, nx)) 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;
@@ -4510,19 +4833,15 @@ s = "
 
        if (!is_magic(use_realm))
        {
-               s_ptr = &technic_info[use_realm - MIN_TECHNIC - 1][spell];
+               s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
        }
        else
        {
                s_ptr = &mp_ptr->info[realm - 1][spell];
        }
 
-       if (p_ptr->pclass == CLASS_SORCERER)
-               shouhimana = s_ptr->smana*2200 + 2399;
-       else if (p_ptr->pclass == CLASS_RED_MAGE)
-               shouhimana = s_ptr->smana*2600 + 2399;
-       else
-               shouhimana = (s_ptr->smana*(3800-spell_exp[(increment ? spell+32 : spell)])+2399);
+       /* Extract mana consumption rate */
+       shouhimana = s_ptr->smana*(3800 - experience_of_spell(spell, realm)) + 2399;
        if(p_ptr->dec_mana)
                shouhimana *= 3;
        else shouhimana *= 4;
@@ -4532,6 +4851,8 @@ s = "
        /* Verify "dangerous" spells */
        if (shouhimana > p_ptr->csp)
        {
+               if (flush_failure) flush();
+
                /* Warning */
 #ifdef JP
 msg_format("¤½¤Î%s¤ò%s¤Î¤Ë½½Ê¬¤Ê¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È¤¬¤Ê¤¤¡£",prayer,
@@ -4547,16 +4868,16 @@ msg_format("
 
                /* Verify */
 #ifdef JP
-if (!get_check("¤½¤ì¤Ç¤âÄ©À路¤Þ¤¹¤«? ")) return;
+               if (!get_check_strict("¤½¤ì¤Ç¤âÄ©À路¤Þ¤¹¤«? ", CHECK_OKAY_CANCEL)) return;
 #else
-               if (!get_check("Attempt it anyway? ")) return;
+               if (!get_check_strict("Attempt it anyway? ", CHECK_OKAY_CANCEL)) return;
 #endif
 
        }
 
 
        /* Spell failure chance */
-       chance = spell_chance(spell, use_realm - 1);
+       chance = spell_chance(spell, use_realm);
 
        /* Failed spell */
        if (randint0(100) < chance)
@@ -4574,7 +4895,7 @@ msg_format("%s
                if (realm == REALM_LIFE)
                {
                        if (randint1(100) < chance)
-                               chg_virtue(V_FAITH, -1);
+                               chg_virtue(V_VITALITY, -1);
                }
                else if (realm == REALM_DEATH)
                {
@@ -4591,6 +4912,11 @@ msg_format("%s
                        if (randint1(100) < chance)
                                chg_virtue(V_JUSTICE, 1);
                }
+               if (realm == REALM_CRUSADE)
+               {
+                       if (randint1(100) < chance)
+                               chg_virtue(V_JUSTICE, -1);
+               }
                else if (randint1(100) < chance)
                {
                        chg_virtue(V_KNOWLEDGE, -1);
@@ -4681,6 +5007,9 @@ msg_print("An infernal sound echoed.");
                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;
@@ -4698,8 +5027,8 @@ msg_print("An infernal sound echoed.");
 
                /* A spell was cast */
                if (!(increment ?
-                   (spell_worked2 & (1L << spell)) :
-                   (spell_worked1 & (1L << spell)))
+                   (p_ptr->spell_worked2 & (1L << spell)) :
+                   (p_ptr->spell_worked1 & (1L << spell)))
                    && (p_ptr->pclass != CLASS_SORCERER)
                    && (p_ptr->pclass != CLASS_RED_MAGE))
                {
@@ -4708,11 +5037,11 @@ msg_print("An infernal sound echoed.");
                        /* The spell worked */
                        if (realm == p_ptr->realm1)
                        {
-                               spell_worked1 |= (1L << spell);
+                               p_ptr->spell_worked1 |= (1L << spell);
                        }
                        else
                        {
-                               spell_worked2 |= (1L << spell);
+                               p_ptr->spell_worked2 |= (1L << spell);
                        }
 
                        /* Gain experience */
@@ -4720,10 +5049,10 @@ msg_print("An infernal sound echoed.");
 
                        if (realm == REALM_LIFE)
                        {
-                               chg_virtue(V_FAITH, 1);
+                               chg_virtue(V_TEMPERANCE, 1);
                                chg_virtue(V_COMPASSION, 1);
                                chg_virtue(V_VITALITY, 1);
-                               chg_virtue(V_HONOUR, 1);
+                               chg_virtue(V_DILIGENCE, 1);
                        }
                        else if (realm == REALM_DEATH)
                        {
@@ -4739,6 +5068,13 @@ msg_print("An infernal sound echoed.");
                                chg_virtue(V_HONOUR, -1);
                                chg_virtue(V_TEMPERANCE, -1);
                        }
+                       else if (realm == REALM_CRUSADE)
+                       {
+                               chg_virtue(V_FAITH, 1);
+                               chg_virtue(V_JUSTICE, 1);
+                               chg_virtue(V_SACRIFICE, 1);
+                               chg_virtue(V_HONOUR, 1);
+                       }
                        else if (realm == REALM_NATURE)
                        {
                                chg_virtue(V_NATURE, 1);
@@ -4749,10 +5085,10 @@ msg_print("An infernal sound echoed.");
                }
                if (realm == REALM_LIFE)
                {
-                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_TEMPERANCE, 1);
                        if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_COMPASSION, 1);
                        if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_VITALITY, 1);
-                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_DILIGENCE, 1);
                }
                else if (realm == REALM_DEATH)
                {
@@ -4768,6 +5104,13 @@ msg_print("An infernal sound echoed.");
                        if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, -1);
                        if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_TEMPERANCE, -1);
                }
+               else if (realm == REALM_CRUSADE)
+               {
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_JUSTICE, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_SACRIFICE, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, 1);
+               }
                else if (realm == REALM_NATURE)
                {
                        if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_NATURE, 1);
@@ -4775,14 +5118,27 @@ msg_print("An infernal sound echoed.");
                }
                if (mp_ptr->spell_xtra & MAGIC_GAIN_EXP)
                {
-                       if (spell_exp[(increment ? 32 : 0)+spell] < 900)
-                               spell_exp[(increment ? 32 : 0)+spell]+=60;
-                       else if(spell_exp[(increment ? 32 : 0)+spell] < 1200)
-                               {if ((dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) spell_exp[(increment ? 32 : 0)+spell]+=8;}
-                       else if(spell_exp[(increment ? 32 : 0)+spell] < 1400)
-                               {if (((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) spell_exp[(increment ? 32 : 0)+spell]+=2;}
-                       else if((spell_exp[(increment ? 32 : 0)+spell] < 1600) && !increment)
-                               {if (((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) spell_exp[(increment ? 32 : 0)+spell]+=1;}
+                       s16b cur_exp = p_ptr->spell_exp[(increment ? 32 : 0)+spell];
+                       s16b exp_gain = 0;
+
+                       if (cur_exp < 900)
+                               exp_gain+=60;
+                       else if(cur_exp < 1200)
+                       {
+                               if ((dun_level > 4) && ((dun_level + 10) > p_ptr->lev))
+                                       exp_gain = 8;
+                       }
+                       else if(cur_exp < 1400)
+                       {
+                               if (((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel))
+                                       exp_gain = 2;
+                       }
+                       else if((cur_exp < 1600) && !increment)
+                       {
+                               if (((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel))
+                                       exp_gain = 1;
+                       }
+                       p_ptr->spell_exp[(increment ? 32 : 0)+spell] += exp_gain;
                }
        }
 
@@ -4817,13 +5173,15 @@ msg_print("
                (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
 
                if (realm == REALM_LIFE)
-                       chg_virtue(V_FAITH, -10);
+                       chg_virtue(V_VITALITY, -10);
                else if (realm == REALM_DEATH)
                        chg_virtue(V_UNLIFE, -10);
                else if (realm == REALM_DAEMON)
                        chg_virtue(V_JUSTICE, 10);
                else if (realm == REALM_NATURE)
                        chg_virtue(V_NATURE, -10);
+               else if (realm == REALM_CRUSADE)
+                       chg_virtue(V_JUSTICE, -10);
                else
                        chg_virtue(V_KNOWLEDGE, -10);
 
@@ -5110,7 +5468,11 @@ void do_cmd_pet_dismiss(void)
                   (Dismissed == 1 ? "" : "s"));
 #endif
        if (Dismissed == 0 && all_pets)
+#ifdef JP
                msg_print("'U'nnamed ¤Ï¡¢¾èÇϰʳ°¤Î̾Á°¤Î¤Ê¤¤¥Ú¥Ã¥È¤À¤±¤òÁ´¤Æ²òÊü¤·¤Þ¤¹¡£");
+#else
+               msg_print("'U'nnamed means all your pets except named pets and your mount.");
+#endif
 
        p_ptr->update |= (PU_MON_LITE);
 }
@@ -5132,16 +5494,16 @@ bool rakuba(int dam, bool force)
                {
                        int level = r_ptr->level;
                        if (p_ptr->riding_ryoute) level += 20;
-                       if ((dam/2 + r_ptr->level) > (skill_exp[GINOU_RIDING]/30+10))
+                       if ((dam/2 + r_ptr->level) > (p_ptr->skill_exp[GINOU_RIDING]/30+10))
                        {
-                               if((skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && s_info[p_ptr->pclass].s_max[GINOU_RIDING] > 1000)
+                               if((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && s_info[p_ptr->pclass].s_max[GINOU_RIDING] > 1000)
                                {
-                                       if (r_ptr->level*100 > (skill_exp[GINOU_RIDING] + 1500))
-                                               skill_exp[GINOU_RIDING] += (1+(r_ptr->level - skill_exp[GINOU_RIDING]/100 - 15));
-                                       else skill_exp[GINOU_RIDING]++;
+                                       if (r_ptr->level*100 > (p_ptr->skill_exp[GINOU_RIDING] + 1500))
+                                               p_ptr->skill_exp[GINOU_RIDING] += (1+(r_ptr->level - p_ptr->skill_exp[GINOU_RIDING]/100 - 15));
+                                       else p_ptr->skill_exp[GINOU_RIDING]++;
                                }
                        }
-                       if (randint0(dam/2 + level*2) < (skill_exp[GINOU_RIDING]/30+10))
+                       if (randint0(dam/2 + level*2) < (p_ptr->skill_exp[GINOU_RIDING]/30+10))
                        {
                                if ((((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) && !p_ptr->riding_ryoute) || !one_in_(p_ptr->lev*(p_ptr->riding_ryoute ? 2 : 3)+30))
                                {
@@ -5344,7 +5706,7 @@ msg_print("
 
                        return FALSE;
                }
-               if (r_info[m_ptr->r_idx].level > randint1((skill_exp[GINOU_RIDING]/50 + p_ptr->lev/2 +20)))
+               if (r_info[m_ptr->r_idx].level > randint1((p_ptr->skill_exp[GINOU_RIDING]/50 + p_ptr->lev/2 +20)))
                {
 #ifdef JP
 msg_print("¤¦¤Þ¤¯¾è¤ì¤Ê¤«¤Ã¤¿¡£");
@@ -5414,7 +5776,7 @@ msg_format("%s
        return TRUE;
 }
 
-void do_name_pet(void)
+static void do_name_pet(void)
 {
        monster_type *m_ptr;
        char out_val[20];
@@ -5882,11 +6244,6 @@ strnfmt(out_val, 78, "(
                        continue;
                }
 
-               if (choice == '\r' && num == 1)
-               {
-                       choice = 'a';
-               }
-
                if (isalpha(choice))
                {
                        /* Note verify */