OSDN Git Service

ケケソキ
[hengbandforosx/hengbandosx.git] / src / mspells1.c
index bf6e093..519657c 100644 (file)
@@ -529,11 +529,40 @@ static void breath(int y, int x, int m_idx, int typ, int dam_hp, int rad, bool b
 }
 
 
+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;
+       int         curse_power = 0;
+       u32b        new_curse;
        u32b        o1, o2, o3;
        object_type *o_ptr = &inventory[INVEN_RARM + randint0(12)];
+       char o_name[MAX_NLEN];
 
        if (randint1(100) > chance) return;
 
@@ -541,12 +570,11 @@ void curse_equipment(int chance, int heavy_chance)
 
        object_flags(o_ptr, &o1, &o2, &o3);
 
+       object_desc(o_name, o_ptr, FALSE, 0);
 
        /* Extra, biased saving throw for blessed items */
        if ((o3 & TR3_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
@@ -561,30 +589,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);
 }
 
 
@@ -1202,6 +1238,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);
 
@@ -1464,7 +1501,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);
@@ -1523,6 +1560,7 @@ msg_format("%^s
                }
        }
 
+
        /* Cast the spell. */
        switch (thrown_spell)
        {
@@ -1587,6 +1625,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);
@@ -1632,7 +1672,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)
                        {
@@ -2720,7 +2760,7 @@ msg_print("
                        }
                        else
                        {
-                               curse_equipment(33, 0);
+                               curse_equipment(15, 0);
                                take_hit(DAMAGE_ATTACK, dam, ddesc, MS_CAUSE_1);
                        }
                        break;
@@ -2756,7 +2796,7 @@ msg_print("
                        }
                        else
                        {
-                               curse_equipment(50, 5);
+                               curse_equipment(25, MIN(rlev/2-15, 5));
                                take_hit(DAMAGE_ATTACK, dam, ddesc, MS_CAUSE_2);
                        }
                        break;
@@ -2792,7 +2832,7 @@ msg_print("
                        }
                        else
                        {
-                               curse_equipment(80, 15);
+                               curse_equipment(33, MIN(rlev/2-15, 15));
                                take_hit(DAMAGE_ATTACK, dam, ddesc, MS_CAUSE_3);
                        }
                        break;
@@ -3379,7 +3419,7 @@ msg_print("
 #endif
 
                                take_hit(DAMAGE_ATTACK, dummy, m_name, MS_HAND_DOOM);
-                               curse_equipment(100, 20);
+                               curse_equipment(40, 20);
 
                                if (p_ptr->chp < 1) p_ptr->chp = 1;
                        }
@@ -3558,16 +3598,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);
 
                                                if((f3 & TR3_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))
@@ -3580,7 +3620,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;
                                                }
@@ -3614,7 +3654,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;
                                
@@ -3627,10 +3667,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;
 
@@ -3665,7 +3705,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;
 
@@ -3946,9 +3986,10 @@ 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_LOUSY)
@@ -3956,7 +3997,7 @@ else msg_format("%^s
                                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)
@@ -3964,7 +4005,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)
@@ -3972,7 +4013,7 @@ 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 || m_ptr->r_idx == MON_ZOMBI_SERPENT)
@@ -3991,7 +4032,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
@@ -4001,7 +4042,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
@@ -4058,7 +4099,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("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4087,7 +4128,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("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4116,7 +4157,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("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4145,7 +4186,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("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4174,7 +4215,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("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4203,7 +4244,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("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4239,7 +4280,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)
@@ -4280,7 +4321,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("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4309,7 +4350,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("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4338,7 +4379,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("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
@@ -4386,7 +4427,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;
@@ -4429,7 +4470,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)
@@ -4462,7 +4503,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)
                        {
@@ -4496,7 +4537,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)
                        {
@@ -4528,20 +4569,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)
@@ -4566,19 +4607,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);
@@ -4612,7 +4653,7 @@ msg_print("¿
 
 
        /* Always take note of monsters that kill you */
-       if (death && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
+       if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
        {
                r_ptr->r_deaths++;
        }