OSDN Git Service

キャラクター生成中やオプション設定中に'?'を押すとヘルプファイルの中の
[hengbandforosx/hengbandosx.git] / src / mspells1.c
index 93f2e6e..91a8d27 100644 (file)
@@ -142,9 +142,9 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 
        if (smart & SM_IMM_ACID)
        {
-               if (int_outof(r_ptr, 200)) f4 &= ~(RF4_BR_ACID);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BA_ACID);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BO_ACID);
+               f4 &= ~(RF4_BR_ACID);
+               f5 &= ~(RF5_BA_ACID);
+               f5 &= ~(RF5_BO_ACID);
        }
        else if ((smart & (SM_OPP_ACID)) && (smart & (SM_RES_ACID)))
        {
@@ -162,9 +162,9 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 
        if (smart & (SM_IMM_ELEC))
        {
-               if (int_outof(r_ptr, 200)) f4 &= ~(RF4_BR_ELEC);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BA_ELEC);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BO_ELEC);
+               f4 &= ~(RF4_BR_ELEC);
+               f5 &= ~(RF5_BA_ELEC);
+               f5 &= ~(RF5_BO_ELEC);
        }
        else if ((smart & (SM_OPP_ELEC)) && (smart & (SM_RES_ELEC)))
        {
@@ -182,9 +182,9 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 
        if (smart & (SM_IMM_FIRE))
        {
-               if (int_outof(r_ptr, 200)) f4 &= ~(RF4_BR_FIRE);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BA_FIRE);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BO_FIRE);
+               f4 &= ~(RF4_BR_FIRE);
+               f5 &= ~(RF5_BA_FIRE);
+               f5 &= ~(RF5_BO_FIRE);
        }
        else if ((smart & (SM_OPP_FIRE)) && (smart & (SM_RES_FIRE)))
        {
@@ -202,10 +202,10 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 
        if (smart & (SM_IMM_COLD))
        {
-               if (int_outof(r_ptr, 200)) f4 &= ~(RF4_BR_COLD);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BA_COLD);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BO_COLD);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BO_ICEE);
+               f4 &= ~(RF4_BR_COLD);
+               f5 &= ~(RF5_BA_COLD);
+               f5 &= ~(RF5_BO_COLD);
+               f5 &= ~(RF5_BO_ICEE);
        }
        else if ((smart & (SM_OPP_COLD)) && (smart & (SM_RES_COLD)))
        {
@@ -239,9 +239,18 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 
        if (smart & (SM_RES_NETH))
        {
-               if (int_outof(r_ptr, 20)) f4 &= ~(RF4_BR_NETH);
-               if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_NETH);
-               if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BO_NETH);
+               if (prace_is_(RACE_SPECTRE))
+               {
+                       f4 &= ~(RF4_BR_NETH);
+                       f5 &= ~(RF5_BA_NETH);
+                       f5 &= ~(RF5_BO_NETH);
+               }
+               else
+               {
+                       if (int_outof(r_ptr, 20)) f4 &= ~(RF4_BR_NETH);
+                       if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_NETH);
+                       if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BO_NETH);
+               }
        }
 
        if (smart & (SM_RES_LITE))
@@ -252,18 +261,26 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 
        if (smart & (SM_RES_DARK))
        {
-               if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_DARK);
-               if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_DARK);
+               if (prace_is_(RACE_VAMPIRE))
+               {
+                       f4 &= ~(RF4_BR_DARK);
+                       f5 &= ~(RF5_BA_DARK);
+               }
+               else
+               {
+                       if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_DARK);
+                       if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_DARK);
+               }
        }
 
        if (smart & (SM_RES_FEAR))
        {
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_SCARE);
+               f5 &= ~(RF5_SCARE);
        }
 
        if (smart & (SM_RES_CONF))
        {
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_CONF);
+               f5 &= ~(RF5_CONF);
                if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_CONF);
        }
 
@@ -280,13 +297,13 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 
        if (smart & (SM_RES_BLIND))
        {
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_BLIND);
+               f5 &= ~(RF5_BLIND);
        }
 
        if (smart & (SM_RES_NEXUS))
        {
                if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_NEXU);
-               if (int_outof(r_ptr, 200)) f6 &= ~(RF6_TELE_LEVEL);
+               f6 &= ~(RF6_TELE_LEVEL);
        }
 
        if (smart & (SM_RES_SOUND))
@@ -316,13 +333,13 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 
        if (smart & (SM_IMM_FREE))
        {
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_HOLD);
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_SLOW);
+               f5 &= ~(RF5_HOLD);
+               f5 &= ~(RF5_SLOW);
        }
 
        if (smart & (SM_IMM_MANA))
        {
-               if (int_outof(r_ptr, 200)) f5 &= ~(RF5_DRAIN_MANA);
+               f5 &= ~(RF5_DRAIN_MANA);
        }
 
        /* XXX XXX XXX No spells left? */
@@ -472,7 +489,7 @@ bool clean_shot(int y1, int x1, int y2, int x2, bool friend)
  */
 static void bolt(int m_idx, int typ, int dam_hp, int monspell, bool learnable)
 {
-       int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_PLAYER;
+       int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_PLAYER | PROJECT_REFLECTABLE;
 
        /* Target the player with a bolt attack */
        (void)project(m_idx, 0, py, px, dam_hp, typ, flg, (learnable ? monspell : -1));
@@ -480,7 +497,7 @@ static void bolt(int m_idx, int typ, int dam_hp, int monspell, bool learnable)
 
 static void beam(int m_idx, int typ, int dam_hp, int monspell, bool learnable)
 {
-       int flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_THRU | PROJECT_PLAYER | PROJECT_NO_REF;
+       int flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_THRU | PROJECT_PLAYER;
 
        /* Target the player with a bolt attack */
        (void)project(m_idx, 0, py, px, dam_hp, typ, flg, (learnable ? monspell : -1));
@@ -506,30 +523,61 @@ static void breath(int y, int x, int m_idx, int typ, int dam_hp, int rad, bool b
        if (breath) rad = 0 - rad;
 
        if (typ == GF_ROCKET) flg |= PROJECT_STOP;
+       if (typ == GF_MIND_BLAST || typ == GF_BRAIN_SMASH ||
+           typ == GF_CAUSE_1 || typ == GF_CAUSE_2 || typ == GF_CAUSE_3 ||
+           typ == GF_CAUSE_4 || typ == GF_HAND_DOOM) flg |= PROJECT_HIDE;
 
        /* Target the player with a ball attack */
        (void)project(m_idx, rad, y, x, dam_hp, typ, flg, (learnable ? monspell : -1));
 }
 
 
+u32b get_curse(int power, object_type *o_ptr)
+{
+       u32b new_curse;
+
+       while(1)
+       {
+               new_curse = (1 << (randint0(MAX_CURSE)+4));
+               if (power == 2)
+               {
+                       if (!(new_curse & TRC_HEAVY_MASK)) continue;
+               }
+               else if (power == 1)
+               {
+                       if (new_curse & TRC_SPECIAL_MASK) continue;
+               }
+               else if (power == 0)
+               {
+                       if (new_curse & TRC_HEAVY_MASK) continue;
+               }
+               if (((o_ptr->tval < TV_BOW) || (o_ptr->tval > TV_SWORD)) && (new_curse == TRC_LOW_MELEE)) continue;
+               if (((o_ptr->tval < TV_BOOTS) || (o_ptr->tval > TV_DRAG_ARMOR)) && (new_curse == TRC_LOW_AC)) continue;
+               break;
+       }
+       return new_curse;
+}
+
 void curse_equipment(int chance, int heavy_chance)
 {
        bool        changed = FALSE;
-       u32b        o1, o2, o3;
+       int         curse_power = 0;
+       u32b        new_curse;
+       u32b oflgs[TR_FLAG_SIZE];
        object_type *o_ptr = &inventory[INVEN_RARM + randint0(12)];
+       char o_name[MAX_NLEN];
 
        if (randint1(100) > chance) return;
 
        if (!o_ptr->k_idx) return;
 
-       object_flags(o_ptr, &o1, &o2, &o3);
+       object_flags(o_ptr, oflgs);
 
+       object_desc(o_name, o_ptr, FALSE, 0);
 
        /* Extra, biased saving throw for blessed items */
-       if ((o3 & TR3_BLESSED) && (randint1(888) > chance))
+       if (have_flag(oflgs, TR_BLESSED) && (randint1(888) > chance))
        {
-               char o_name[MAX_NLEN];
-               object_desc(o_name, o_ptr, FALSE, 0);
 #ifdef JP
 msg_format("%s¤Ï¼ö¤¤¤òÄ·¤ÍÊÖ¤·¤¿¡ª", o_name,
 #else
@@ -544,30 +592,38 @@ msg_format("%s
        if ((randint1(100) <= heavy_chance) &&
                (o_ptr->name1 || o_ptr->name2 || o_ptr->art_name))
        {
-               if (!(o3 & TR3_HEAVY_CURSE))
+               if (!(o_ptr->curse_flags & TRC_HEAVY_CURSE))
                        changed = TRUE;
-               o_ptr->art_flags3 |= TR3_HEAVY_CURSE;
-               o_ptr->art_flags3 |= TR3_CURSED;
-               o_ptr->ident |= IDENT_CURSED;
+               o_ptr->curse_flags |= TRC_HEAVY_CURSE;
+               o_ptr->curse_flags |= TRC_CURSED;
+               curse_power++;
        }
        else
        {
-               if (!(o_ptr->ident & IDENT_CURSED))
+               if (!cursed_p(o_ptr))
                        changed = TRUE;
-               o_ptr->art_flags3 |= TR3_CURSED;
-               o_ptr->ident |= IDENT_CURSED;
+               o_ptr->curse_flags |= TRC_CURSED;
+       }
+       if (heavy_chance >= 50) curse_power++;
+
+       new_curse = get_curse(curse_power, o_ptr);
+       if (!(o_ptr->curse_flags & new_curse))
+       {
+               changed = TRUE;
+               o_ptr->curse_flags |= new_curse;
        }
 
        if (changed)
        {
 #ifdef JP
-msg_print("°­°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤ò¤È¤ê¤Þ¤¤¤¿...");
+msg_format("°­°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
 #else
-               msg_print("There is a malignant black aura surrounding you...");
+               msg_format("There is a malignant black aura surrounding %s...", o_name);
 #endif
 
                o_ptr->feeling = FEEL_NONE;
        }
+       p_ptr->update |= (PU_BONUS);
 }
 
 
@@ -1022,7 +1078,12 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
                        case MON_BANORLUPART:
                                if (randint0(100) < 70) success = TRUE;
                                break;
-                       default: break;
+                       case MON_BANOR:
+                       case MON_LUPART:
+                                break;
+                       default:
+                                if (randint0(100) < 50) success = TRUE;
+                                break;
                }
                if (success) return (special[randint0(special_num)]);
        }
@@ -1185,6 +1246,7 @@ bool make_attack_spell(int m_idx)
        bool            no_inate = FALSE;
        bool            do_disi = FALSE;
        int             dam = 0;
+       u32b mode = 0L;
        int s_num_6 = (easy_band ? 2 : 6);
        int s_num_4 = (easy_band ? 1 : 4);
 
@@ -1447,7 +1509,7 @@ bool make_attack_spell(int m_idx)
        if (!num) return (FALSE);
 
        /* Stop if player is dead or gone */
-       if (!alive || death) return (FALSE);
+       if (!p_ptr->playing || p_ptr->is_dead) return (FALSE);
 
        /* Stop if player is leaving */
        if (p_ptr->leaving) return (FALSE);
@@ -1459,7 +1521,7 @@ bool make_attack_spell(int m_idx)
        monster_desc(m_poss, m_ptr, 0x22);
 
        /* Hack -- Get the "died from" name */
-       monster_desc(ddesc, m_ptr, 0x88);
+       monster_desc(ddesc, m_ptr, 0x288);
 
        if (stupid_monsters)
        {
@@ -1506,6 +1568,7 @@ msg_format("%^s
                }
        }
 
+
        /* Cast the spell. */
        switch (thrown_spell)
        {
@@ -1570,6 +1633,8 @@ msg_format("%^s
                        set_tim_ffall(0, TRUE);
                        set_tim_sh_touki(0, TRUE);
                        set_tim_sh_fire(0, TRUE);
+                       set_tim_sh_holy(0, TRUE);
+                       set_tim_eyeeye(0, TRUE);
                        set_magicdef(0, TRUE);
                        set_resist_magic(0, TRUE);
                        set_oppose_acid(0, TRUE);
@@ -1615,7 +1680,7 @@ msg_format("%^s
                                /* Window stuff */
                                p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
-                               p_ptr->energy -= 100;
+                               p_ptr->energy_need += ENERGY_NEED();
                        }
                        if (p_ptr->riding)
                        {
@@ -2554,43 +2619,7 @@ msg_format("%^s
                        }
 
                        dam = damroll(7, 7);
-                       if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
-                       {
-#ifdef JP
-msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
-#else
-                               msg_print("You resist the effects!");
-#endif
-                               learn_spell(MS_MIND_BLAST);
-                       }
-                       else
-                       {
-#ifdef JP
-msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
-#else
-                               msg_print("Your mind is blasted by psyonic energy.");
-#endif
-
-                               if (!p_ptr->resist_conf)
-                               {
-                                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
-                               }
-
-                               if (!p_ptr->resist_chaos && one_in_(3))
-                               {
-                                       (void)set_image(p_ptr->image + randint0(250) + 150);
-                               }
-
-                               p_ptr->csp -= 50;
-                               if (p_ptr->csp < 0)
-                               {
-                                       p_ptr->csp = 0;
-                                       p_ptr->csp_frac = 0;
-                               }
-                               p_ptr->redraw |= PR_MANA;
-
-                               take_hit(DAMAGE_ATTACK, dam, ddesc, MS_MIND_BLAST);
-                       }
+                       breath(y, x, m_idx, GF_MIND_BLAST, dam, 0, FALSE, MS_MIND_BLAST, learnable);
                        break;
                }
 
@@ -2620,56 +2649,7 @@ msg_format("%^s
                        }
 
                        dam = damroll(12, 12);
-                       if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
-                       {
-#ifdef JP
-msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
-#else
-                               msg_print("You resist the effects!");
-#endif
-                               learn_spell(MS_BRAIN_SMASH);
-                       }
-                       else
-                       {
-#ifdef JP
-msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
-#else
-                               msg_print("Your mind is blasted by psionic energy.");
-#endif
-
-                               p_ptr->csp -= 100;
-                               if (p_ptr->csp < 0)
-                               {
-                                       p_ptr->csp = 0;
-                                       p_ptr->csp_frac = 0;
-                               }
-                               p_ptr->redraw |= PR_MANA;
-
-                               take_hit(DAMAGE_ATTACK, dam, ddesc, MS_BRAIN_SMASH);
-                               if (!p_ptr->resist_blind)
-                               {
-                                       (void)set_blind(p_ptr->blind + 8 + randint0(8));
-                               }
-                               if (!p_ptr->resist_conf)
-                               {
-                                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
-                               }
-                               if (!p_ptr->free_act)
-                               {
-                                       (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
-                               }
-                               (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
-
-                               while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
-                                       (void)do_dec_stat(A_INT);
-                               while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
-                                       (void)do_dec_stat(A_WIS);
-
-                               if (!p_ptr->resist_chaos)
-                               {
-                                       (void)set_image(p_ptr->image + randint0(250) + 150);
-                               }
-                       }
+                       breath(y, x, m_idx, GF_BRAIN_SMASH, dam, 0, FALSE, MS_BRAIN_SMASH, learnable);
                        break;
                }
 
@@ -2692,20 +2672,7 @@ else msg_format("%^s
 #endif
 
                        dam = damroll(3, 8);
-                       if (randint0(100 + rlev/2) < p_ptr->skill_sav)
-                       {
-#ifdef JP
-msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
-#else
-                               msg_print("You resist the effects!");
-#endif
-                               learn_spell(MS_CAUSE_1);
-                       }
-                       else
-                       {
-                               curse_equipment(33, 0);
-                               take_hit(DAMAGE_ATTACK, dam, ddesc, MS_CAUSE_1);
-                       }
+                       breath(y, x, m_idx, GF_CAUSE_1, dam, 0, FALSE, MS_CAUSE_1, learnable);
                        break;
                }
 
@@ -2728,20 +2695,7 @@ else msg_format("%^s
 #endif
 
                        dam = damroll(8, 8);
-                       if (randint0(100 + rlev/2) < p_ptr->skill_sav)
-                       {
-#ifdef JP
-msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
-#else
-                               msg_print("You resist the effects!");
-#endif
-                               learn_spell(MS_CAUSE_2);
-                       }
-                       else
-                       {
-                               curse_equipment(50, 5);
-                               take_hit(DAMAGE_ATTACK, dam, ddesc, MS_CAUSE_2);
-                       }
+                       breath(y, x, m_idx, GF_CAUSE_2, dam, 0, FALSE, MS_CAUSE_2, learnable);
                        break;
                }
 
@@ -2764,20 +2718,7 @@ else msg_format("%^s
 #endif
 
                        dam = damroll(10, 15);
-                       if (randint0(100 + rlev/2) < p_ptr->skill_sav)
-                       {
-#ifdef JP
-msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
-#else
-                               msg_print("You resist the effects!");
-#endif
-                               learn_spell(MS_CAUSE_3);
-                       }
-                       else
-                       {
-                               curse_equipment(80, 15);
-                               take_hit(DAMAGE_ATTACK, dam, ddesc, MS_CAUSE_3);
-                       }
+                       breath(y, x, m_idx, GF_CAUSE_3, dam, 0, FALSE, MS_CAUSE_3, learnable);
                        break;
                }
 
@@ -2800,20 +2741,7 @@ else msg_format("%^s
 #endif
 
                        dam = damroll(15, 15);
-                       if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU))
-                       {
-#ifdef JP
-msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
-#else
-                               msg_print("You resist the effects!");
-#endif
-                               learn_spell(MS_CAUSE_4);
-                       }
-                       else
-                       {
-                               take_hit(DAMAGE_ATTACK, dam, ddesc, MS_CAUSE_4);
-                               (void)set_cut(p_ptr->cut + damroll(10, 10));
-                       }
+                       breath(y, x, m_idx, GF_CAUSE_4, dam, 0, FALSE, MS_CAUSE_4, learnable);
                        break;
                }
 
@@ -3341,31 +3269,8 @@ msg_format("%^s
 #else
                        msg_format("%^s invokes the Hand of Doom!", m_name);
 #endif
-
-                       if (randint0(100 + rlev/2) < p_ptr->skill_sav)
-                       {
-#ifdef JP
-msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
-#else
-                               msg_format("You resist the effects!");
-#endif
-                               learn_spell(MS_HAND_DOOM);
-
-                       }
-                       else
-                       {
-                               int dummy = (((s32b) ((40 + randint1(20)) * (p_ptr->chp))) / 100);
-#ifdef JP
-msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
-#else
-                               msg_print("Your feel your life fade away!");
-#endif
-
-                               take_hit(DAMAGE_ATTACK, dummy, m_name, MS_HAND_DOOM);
-                               curse_equipment(100, 20);
-
-                               if (p_ptr->chp < 1) p_ptr->chp = 1;
-                       }
+                       dam = (((s32b) ((40 + randint1(20)) * (p_ptr->chp))) / 100);
+                       breath(y, x, m_idx, GF_HAND_DOOM, dam, 0, FALSE, MS_HAND_DOOM, learnable);
                        break;
                }
 
@@ -3521,7 +3426,7 @@ msg_format("%^s
                case 160+5:
                {
                        int i, oldfy, oldfx;
-                       u32b f1 = 0 , f2 = 0 , f3 = 0;
+                       u32b flgs[TR_FLAG_SIZE];
                        object_type *o_ptr;
 
                        oldfy = m_ptr->fy;
@@ -3541,16 +3446,16 @@ msg_format("%^s
                                for (i=INVEN_RARM;i<INVEN_TOTAL;i++)
                                {
                                        o_ptr = &inventory[i];
-                                       if(!(o_ptr->ident & IDENT_CURSED))
+                                       if(!cursed_p(o_ptr))
                                        {
-                                               object_flags(o_ptr, &f1, &f2, &f3);
+                                               object_flags(o_ptr, flgs);
 
-                                               if((f3 & TR3_TELEPORT) || (p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR))
+                                               if((have_flag(flgs, TR_TELEPORT)) || (p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR))
                                                {
 #ifdef JP
-                                                       if(get_check_strict("¤Ä¤¤¤Æ¤¤¤­¤Þ¤¹¤«¡©", 1))
+                                                       if(get_check_strict("¤Ä¤¤¤Æ¤¤¤­¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
 #else
-                                                       if(get_check_strict("Do you follow it? ", 1))
+                                                       if(get_check_strict("Do you follow it? ", CHECK_OKAY_CANCEL))
 #endif
                                                        {
                                                                if (one_in_(3))
@@ -3563,7 +3468,7 @@ msg_format("%^s
 #endif
                                                                }
                                                                else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
-                                                               p_ptr->energy -= 100;
+                                                               p_ptr->energy_need += ENERGY_NEED();
                                                        }
                                                        break;
                                                }
@@ -3597,7 +3502,7 @@ msg_format("%^s
                                if (p_ptr->inside_arena || p_ptr->inside_battle) return FALSE;
                                for (k = 0; k < 6; k++)
                                {
-                                       count += summon_specific(m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_BIZARRE1, TRUE, FALSE, FALSE, FALSE, FALSE);
+                                       count += summon_specific(m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_BIZARRE1, PM_ALLOW_GROUP);
                                }
                                return FALSE;
                                
@@ -3610,10 +3515,10 @@ msg_format("%^s
 
                                        if (p_ptr->inside_arena || p_ptr->inside_battle || !summon_possible(m_ptr->fy, m_ptr->fx)) return FALSE;
                                        delete_monster_idx(cave[m_ptr->fy][m_ptr->fx].m_idx);
-                                       summon_named_creature(dummy_y, dummy_x, MON_BANOR, FALSE, FALSE, is_friendly(m_ptr), FALSE);
+                                       summon_named_creature(0, dummy_y, dummy_x, MON_BANOR, mode);
                                        m_list[hack_m_idx_ii].hp = dummy_hp;
                                        m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
-                                       summon_named_creature(dummy_y, dummy_x, MON_LUPART, FALSE, FALSE, is_friendly(m_ptr), FALSE);
+                                       summon_named_creature(0, dummy_y, dummy_x, MON_LUPART, mode);
                                        m_list[hack_m_idx_ii].hp = dummy_hp;
                                        m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
 
@@ -3648,7 +3553,7 @@ msg_format("%^s
                                                        delete_monster_idx(k);
                                                }
                                        }
-                                       summon_named_creature(dummy_y, dummy_x, MON_BANORLUPART, FALSE, FALSE, is_friendly(m_ptr), FALSE);
+                                       summon_named_creature(0, dummy_y, dummy_x, MON_BANORLUPART, mode);
                                        m_list[hack_m_idx_ii].hp = dummy_hp;
                                        m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
 
@@ -3660,7 +3565,79 @@ msg_format("%^s
 
                                        break;
                                }
-                               default: return FALSE;
+
+                        default:
+                                if (r_ptr->d_char == 'B')
+                                {
+                                        if (!direct) break;
+                                        disturb(1, 0);
+                                        if (one_in_(3) || x!=px || y!=py)
+                                        {
+#ifdef JP
+                                                msg_format("%^s¤ÏÆÍÁ³»ë³¦¤«¤é¾Ã¤¨¤¿!", m_name);
+#else
+                                                msg_format("%^s suddenly go out of your sight!", m_name);
+#endif
+                                                teleport_away(m_idx, 10, FALSE);
+                                                p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
+                                                break;
+                                        }
+                                        else
+                                        {
+                                                int dam = damroll(4, 8);
+                                               int get_damage = 0;
+#ifdef JP
+                                                msg_format("%^s¤¬¤¢¤Ê¤¿¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍ¤¿¡£", m_name);
+#else
+                                                msg_format("%^s holds you, and drops from the sky.", m_name);
+#endif
+                                                teleport_player_to(m_ptr->fy, m_ptr->fx, FALSE);
+
+                                                sound(SOUND_FALL);
+
+                                                if (p_ptr->ffall)
+                                                {
+#ifdef JP
+                                                        msg_print("¤¢¤Ê¤¿¤ÏÀŤ«¤ËÃåÃϤ·¤¿¡£");
+#else
+                                                        msg_print("You float gently down to the ground.");
+#endif
+                                                }
+                                                else
+                                                {
+#ifdef JP
+                                                        msg_print("¤¢¤Ê¤¿¤ÏÃÏÌ̤Ë᤭¤Ä¤±¤é¤ì¤¿¡£");
+#else
+                                                        msg_print("You crashed into the ground.");
+#endif
+                                                        dam += damroll(6, 8);
+                                                }
+
+                                               /* Mega hack -- this special action deals damage to the player. Therefore the code of "eyeeye" is necessary.
+                                                  -- henkma
+                                                */
+                                                get_damage = take_hit(DAMAGE_NOESCAPE, dam, m_name, -1);
+                                               if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
+                                               {
+#ifdef JP
+                                                       msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
+#else
+                                                       char m_name_self[80];
+               
+                                                       /* hisself */
+                                                       monster_desc(m_name_self, m_ptr, 0x23);
+
+                                                       msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
+#endif
+                                                       project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
+                                                       set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
+                                               }
+                                        }
+                                        break;
+                                }
+
+                                /* Something is wrong */
+                                else return FALSE;
                        }
                        break;
                }
@@ -3891,7 +3868,7 @@ else msg_format("%^s
                                        msg_format("%^s throws some hand grenades.", m_name);
 #endif
                        }
-                       else if (m_ptr->r_idx == MON_SERPENT)
+                       else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
                        {
 #ifdef JP
                                if (blind)
@@ -3929,17 +3906,28 @@ else msg_format("%^s
                        if(m_ptr->r_idx == MON_ROLENTO)
                        {
                                int num = 1 + randint1(3);
+
                                for (k = 0; k < num; k++)
                                {
-                                       count += summon_named_creature(y, x, MON_SHURYUUDAN, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr));
+                                       count += summon_named_creature(m_idx, y, x, MON_SHURYUUDAN, mode);
                                }
                        }
+                       else if(m_ptr->r_idx == MON_THORONDOR ||
+                                m_ptr->r_idx == MON_GWAIHIR ||
+                                m_ptr->r_idx == MON_MENELDOR)
+                        {
+                               int num = 4 + randint1(3);
+                               for (k = 0; k < num; k++)
+                               {
+                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_EAGLES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
+                               }
+                        }
                        else if(m_ptr->r_idx == MON_LOUSY)
                        {
                                int num = 2 + randint1(3);
                                for (k = 0; k < num; k++)
                                {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, TRUE, FALSE, FALSE, FALSE, FALSE);
+                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, PM_ALLOW_GROUP);
                                }
                        }
                        else if(m_ptr->r_idx == MON_BULLGATES)
@@ -3947,7 +3935,7 @@ else msg_format("%^s
                                int num = 2 + randint1(3);
                                for (k = 0; k < num; k++)
                                {
-                                       count += summon_named_creature(y, x, 921, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr));
+                                       count += summon_named_creature(m_idx, y, x, 921, mode);
                                }
                        }
                        else if (m_ptr->r_idx == MON_CALDARM)
@@ -3955,10 +3943,10 @@ else msg_format("%^s
                                int num = randint1(3);
                                for (k = 0; k < num; k++)
                                {
-                                       count += summon_named_creature(y, x, 930, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr));
+                                       count += summon_named_creature(m_idx, y, x, 930, mode);
                                }
                        }
-                       else if (m_ptr->r_idx == MON_SERPENT)
+                       else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
                        {
                                int num = 2 + randint1(3);
 
@@ -3974,7 +3962,7 @@ else msg_format("%^s
 
                                for (k = 0; k < num; k++)
                                {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, TRUE, FALSE, FALSE, TRUE, FALSE);
+                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                                }
                        }
                        else
@@ -3984,7 +3972,7 @@ else msg_format("%^s
 
                                for (k = 0; k < 4; k++)
                                {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_KIN, TRUE, FALSE, FALSE, FALSE, FALSE);
+                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_KIN, PM_ALLOW_GROUP);
                                }
                        }
 #ifdef JP
@@ -4041,7 +4029,7 @@ else msg_format("%^s
 
                        for (k = 0; k < 1; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, 0, TRUE, FALSE, FALSE, TRUE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                        }
 #ifdef JP
 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4070,7 +4058,7 @@ else msg_format("%^s
 
                        for (k = 0; k < s_num_6; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, 0, TRUE, FALSE, FALSE, TRUE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                        }
 #ifdef JP
 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4099,7 +4087,7 @@ else msg_format("%^s
 
                        for (k = 0; k < s_num_6; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_ANT, TRUE, FALSE, FALSE, FALSE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_ANT, PM_ALLOW_GROUP);
                        }
 #ifdef JP
 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4128,7 +4116,7 @@ else msg_format("%^s
 
                        for (k = 0; k < s_num_6; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_SPIDER, TRUE, FALSE, FALSE, FALSE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_SPIDER, PM_ALLOW_GROUP);
                        }
 #ifdef JP
 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4157,7 +4145,7 @@ else msg_format("%^s
 
                        for (k = 0; k < s_num_4; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_HOUND, TRUE, FALSE, FALSE, FALSE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_HOUND, PM_ALLOW_GROUP);
                        }
 #ifdef JP
 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4186,7 +4174,7 @@ else msg_format("%^s
 
                        for (k = 0; k < s_num_4; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_HYDRA, TRUE, FALSE, FALSE, FALSE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_HYDRA, PM_ALLOW_GROUP);
                        }
 #ifdef JP
 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4222,7 +4210,7 @@ else msg_format("%^s
 
                        for (k = 0; k < num; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, TRUE, FALSE, FALSE, FALSE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, PM_ALLOW_GROUP);
                        }
 
                        if (count < 2)
@@ -4263,7 +4251,7 @@ else msg_format("%^s
 
                        for (k = 0; k < 1; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_DEMON, TRUE, FALSE, FALSE, FALSE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_DEMON, PM_ALLOW_GROUP);
                        }
 #ifdef JP
 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4292,7 +4280,7 @@ else msg_format("%^s
 
                        for (k = 0; k < 1; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_UNDEAD, TRUE, FALSE, FALSE, FALSE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_UNDEAD, PM_ALLOW_GROUP);
                        }
 #ifdef JP
 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4321,7 +4309,7 @@ else msg_format("%^s
 
                        for (k = 0; k < 1; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_DRAGON, TRUE, FALSE, FALSE, FALSE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_DRAGON, PM_ALLOW_GROUP);
                        }
 #ifdef JP
 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4369,7 +4357,7 @@ else msg_format("%^s
                                        }
                                        if (!cave_floor_bold(cy, cx)) continue;
 
-                                       if (summon_named_creature(cy, cx, MON_NAZGUL, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr)))
+                                       if (summon_named_creature(m_idx, cy, cx, MON_NAZGUL, mode))
                                        {
                                                y = cy;
                                                x = cx;
@@ -4412,7 +4400,7 @@ else msg_format("%^s
 
                                for (k = 0; k < s_num_6; k++)
                                {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, TRUE, FALSE, FALSE, TRUE, FALSE);
+                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                                }
                        }
                        if (blind && count)
@@ -4445,7 +4433,7 @@ else msg_format("%^s
 
                        for (k = 0; k < s_num_4; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_DRAGON, TRUE, FALSE, FALSE, TRUE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                        }
                        if (blind && count)
                        {
@@ -4470,7 +4458,7 @@ if (blind) msg_format("%^s
 #endif
 
 #ifdef JP
-else msg_format("%^s¤¬¥¢¥ó¥Ð¡¼¤Î²¦¤ò¾¤´­¤·¤¿¡ª", m_name);
+else msg_format("%^s¤¬¥¢¥ó¥Ð¡¼¤Î²¦²¤ò¾¤´­¤·¤¿¡ª", m_name);
 #else
                        else msg_format("%^s magically summons Lords of Amber!", m_name);
 #endif
@@ -4479,7 +4467,7 @@ else msg_format("%^s
 
                        for (k = 0; k < s_num_4; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_AMBERITES, TRUE, FALSE, FALSE, TRUE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_AMBERITES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                        }
                        if (blind && count)
                        {
@@ -4511,20 +4499,20 @@ else msg_format("%^s
 
                        for (k = 0; k < s_num_4; k++)
                        {
-                               count += summon_specific(m_idx, y, x, rlev, SUMMON_UNIQUE, TRUE, FALSE, FALSE, TRUE, FALSE);
+                               count += summon_specific(m_idx, y, x, rlev, SUMMON_UNIQUE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                        }
                        if (r_ptr->flags3 & RF3_GOOD)
                        {
                                for (k = count; k < s_num_4; k++)
                                {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, TRUE, FALSE, FALSE, TRUE, FALSE);
+                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                                }
                        }
                        else
                        {
                                for (k = count; k < s_num_4; k++)
                                {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, TRUE, FALSE, FALSE, TRUE, FALSE);
+                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                                }
                        }
                        if (blind && count)
@@ -4549,19 +4537,19 @@ msg_print("¿
        {
                if (thrown_spell != 167)
                {
-                       if (mane_num == MAX_MANE)
+                       if (p_ptr->mane_num == MAX_MANE)
                        {
                                int i;
-                               mane_num--;
-                               for (i = 0;i < mane_num;i++)
+                               p_ptr->mane_num--;
+                               for (i = 0;i < p_ptr->mane_num;i++)
                                {
-                                       mane_spell[i] = mane_spell[i+1];
-                                       mane_dam[i] = mane_dam[i+1];
+                                       p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
+                                       p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
                                }
                        }
-                       mane_spell[mane_num] = thrown_spell - 96;
-                       mane_dam[mane_num] = dam;
-                       mane_num++;
+                       p_ptr->mane_spell[p_ptr->mane_num] = thrown_spell - 96;
+                       p_ptr->mane_dam[p_ptr->mane_num] = dam;
+                       p_ptr->mane_num++;
                        new_mane = TRUE;
 
                        p_ptr->redraw |= (PR_MANE);
@@ -4595,7 +4583,7 @@ msg_print("¿
 
 
        /* Always take note of monsters that kill you */
-       if (death && (r_ptr->r_deaths < MAX_SHORT))
+       if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
        {
                r_ptr->r_deaths++;
        }