OSDN Git Service

忍者は暗闇の洞窟で地形やアイテムが丸見えだったが, モンスターがこれに
[hengband/hengband.git] / src / cmd1.c
index 58cbb74..9d5a807 100644 (file)
@@ -216,7 +216,7 @@ s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
  * Note that most brands and slays are x3, except Slay Animal (x2),
  * Slay Evil (x2), and Kill dragon (x5).
  */
-s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode)
+s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
 {
        int mult = 10;
 
@@ -460,14 +460,14 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode)
                        }
 
                        /* Brand (Acid) */
-                       if ((have_flag(flgs, TR_BRAND_ACID)) || (p_ptr->special_attack & (ATTACK_ACID)))
+                       if (have_flag(flgs, TR_BRAND_ACID) || ((p_ptr->special_attack & (ATTACK_ACID)) && !thrown))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_ACID)
+                               if (r_ptr->flags3 & RF3_EFF_IM_ACID_MASK)
                                {
                                        if (m_ptr->ml)
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_ACID;
+                                               r_ptr->r_flags3 |= (r_ptr->flags3 & RF3_EFF_IM_ACID_MASK);
                                        }
                                }
 
@@ -479,19 +479,19 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode)
                        }
 
                        /* Brand (Elec) */
-                       if ((have_flag(flgs, TR_BRAND_ELEC)) || (p_ptr->special_attack & (ATTACK_ELEC)) || (mode == HISSATSU_ELEC))
+                       if (have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown) || (mode == HISSATSU_ELEC))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_ELEC)
+                               if (r_ptr->flags3 & RF3_EFF_IM_ELEC_MASK)
                                {
                                        if (m_ptr->ml)
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_ELEC;
+                                               r_ptr->r_flags3 |= (r_ptr->flags3 & RF3_EFF_IM_ELEC_MASK);
                                        }
                                }
 
                                /* Otherwise, take the damage */
-                               else if (((have_flag(flgs, TR_BRAND_ELEC)) || (p_ptr->special_attack & (ATTACK_ELEC))) && (mode == HISSATSU_ELEC))
+                               else if ((have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown)) && (mode == HISSATSU_ELEC))
                                {
                                        if (mult < 70) mult = 70;
                                }
@@ -507,19 +507,19 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode)
                        }
 
                        /* Brand (Fire) */
-                       if ((have_flag(flgs, TR_BRAND_FIRE)) || (p_ptr->special_attack & (ATTACK_FIRE)) || (mode == HISSATSU_FIRE))
+                       if (have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown) || (mode == HISSATSU_FIRE))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_FIRE)
+                               if (r_ptr->flags3 & RF3_EFF_IM_FIRE_MASK)
                                {
                                        if (m_ptr->ml)
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_FIRE;
+                                               r_ptr->r_flags3 |= (r_ptr->flags3 & RF3_EFF_IM_FIRE_MASK);
                                        }
                                }
 
                                /* Otherwise, take the damage */
-                               else if (((have_flag(flgs, TR_BRAND_FIRE)) || (p_ptr->special_attack & (ATTACK_FIRE))) && (mode == HISSATSU_FIRE))
+                               else if ((have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown)) && (mode == HISSATSU_FIRE))
                                {
                                        if (r_ptr->flags3 & RF3_HURT_FIRE)
                                        {
@@ -546,18 +546,18 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode)
                        }
 
                        /* Brand (Cold) */
-                       if ((have_flag(flgs, TR_BRAND_COLD)) || (p_ptr->special_attack & (ATTACK_COLD)) || (mode == HISSATSU_COLD))
+                       if (have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown) || (mode == HISSATSU_COLD))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_COLD)
+                               if (r_ptr->flags3 & RF3_EFF_IM_COLD_MASK)
                                {
                                        if (m_ptr->ml)
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_COLD;
+                                               r_ptr->r_flags3 |= (r_ptr->flags3 & RF3_EFF_IM_COLD_MASK);
                                        }
                                }
                                /* Otherwise, take the damage */
-                               else if (((have_flag(flgs, TR_BRAND_COLD)) || (p_ptr->special_attack & (ATTACK_COLD))) && (mode == HISSATSU_COLD))
+                               else if ((have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown)) && (mode == HISSATSU_COLD))
                                {
                                        if (r_ptr->flags3 & RF3_HURT_COLD)
                                        {
@@ -584,19 +584,19 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode)
                        }
 
                        /* Brand (Poison) */
-                       if ((have_flag(flgs, TR_BRAND_POIS)) || (p_ptr->special_attack & (ATTACK_POIS)) || (mode == HISSATSU_POISON))
+                       if (have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown) || (mode == HISSATSU_POISON))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_POIS)
+                               if (r_ptr->flags3 & RF3_EFF_IM_POIS_MASK)
                                {
                                        if (m_ptr->ml)
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_POIS;
+                                               r_ptr->r_flags3 |= (r_ptr->flags3 & RF3_EFF_IM_POIS_MASK);
                                        }
                                }
 
                                /* Otherwise, take the damage */
-                               else if (((have_flag(flgs, TR_BRAND_POIS)) || (p_ptr->special_attack & (ATTACK_POIS))) && (mode == HISSATSU_POISON))
+                               else if ((have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown)) && (mode == HISSATSU_POISON))
                                {
                                        if (mult < 35) mult = 35;
                                }
@@ -1725,7 +1725,7 @@ static void touch_zap_player(monster_type *m_ptr)
                        aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
 
                        /* Hack -- Get the "died from" name */
-                       monster_desc(aura_dam, m_ptr, 0x288);
+                       monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
 
 #ifdef JP
                        msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
@@ -1739,7 +1739,7 @@ static void touch_zap_player(monster_type *m_ptr)
                        if (p_ptr->resist_fire) aura_damage = (aura_damage + 2) / 3;
 
                        take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
-                       r_ptr->r_flags2 |= RF2_AURA_FIRE;
+                       if (m_ptr->ml) r_ptr->r_flags2 |= RF2_AURA_FIRE;
                        handle_stuff();
                }
        }
@@ -1753,7 +1753,7 @@ static void touch_zap_player(monster_type *m_ptr)
                        aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
 
                        /* Hack -- Get the "died from" name */
-                       monster_desc(aura_dam, m_ptr, 0x288);
+                       monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
 
 #ifdef JP
                        msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª");
@@ -1766,7 +1766,7 @@ static void touch_zap_player(monster_type *m_ptr)
                        if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3;
 
                        take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
-                       r_ptr->r_flags3 |= RF3_AURA_COLD;
+                       if (m_ptr->ml) r_ptr->r_flags3 |= RF3_AURA_COLD;
                        handle_stuff();
                }
        }
@@ -1780,7 +1780,7 @@ static void touch_zap_player(monster_type *m_ptr)
                        aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
 
                        /* Hack -- Get the "died from" name */
-                       monster_desc(aura_dam, m_ptr, 0x288);
+                       monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
 
                        if (prace_is_(RACE_ANDROID)) aura_damage += aura_damage / 3;
                        if (IS_OPPOSE_ELEC()) aura_damage = (aura_damage + 2) / 3;
@@ -1793,7 +1793,7 @@ static void touch_zap_player(monster_type *m_ptr)
 #endif
 
                        take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
-                       r_ptr->r_flags2 |= RF2_AURA_ELEC;
+                       if (m_ptr->ml) r_ptr->r_flags2 |= RF2_AURA_ELEC;
                        handle_stuff();
                }
        }
@@ -2388,16 +2388,8 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                        /* Handle normal weapon */
                        else if (o_ptr->k_idx)
                        {
-                               k = damroll(o_ptr->dd, o_ptr->ds);
-                               if (p_ptr->riding)
-                               {
-                                       if((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
-                                       {
-                                               k += damroll(2, o_ptr->ds);
-                                       }
-                               }
-
-                               k = tot_dam_aux(o_ptr, k, m_ptr, mode);
+                               k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
+                               k = tot_dam_aux(o_ptr, k, m_ptr, mode, FALSE);
 
                                if (backstab)
                                {
@@ -3911,7 +3903,7 @@ msg_format("%s
                disturb(0, 0);
        }
 
-       else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY)) && !(r_info[m_list[p_ptr->riding].r_idx].flags3 & (RF3_IM_FIRE))) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
+       else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY)) && !(r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_EFF_IM_FIRE_MASK)) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
        {
 #ifdef JP
                msg_print("ÍÏ´ä¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
@@ -3980,13 +3972,23 @@ msg_format("%s
                                lite_spot(y, x);
                        }
 
+                       /* Boundary floor mimic */
+                       else if (boundary_floor_grid(c_ptr))
+                       {
+#ifdef JP
+                               msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¤è¤¦¤À¡£");
+#else
+                               msg_print("You feel you cannot go any more.");
+#endif
+                       }
+
                        /* Wall (or secret door) */
                        else
                        {
 #ifdef JP
-                               msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
+                               msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", (feat == FEAT_TREES) ? "ÌÚ" : "ÊÉ");
 #else
-                               msg_print("You feel a wall blocking your way.");
+                               msg_format("You feel a %s blocking your way.", (feat == FEAT_TREES) ? "tree" : "wall");
 #endif
 
                                c_ptr->info |= (CAVE_MARK);
@@ -4006,7 +4008,6 @@ msg_format("%s
                                msg_print("There is rubble blocking your way.");
 #endif
 
-
                                if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
                                        energy_use = 0;
 
@@ -4031,6 +4032,18 @@ msg_format("%s
                                msg_print("There is a closed door blocking your way.");
 #endif
 
+                               if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
+                                       energy_use = 0;
+                       }
+
+                       /* Boundary floor mimic */
+                       else if (boundary_floor_grid(c_ptr))
+                       {
+#ifdef JP
+                               msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¡£");
+#else
+                               msg_print("You cannot go any more.");
+#endif
 
                                if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
                                        energy_use = 0;
@@ -4040,19 +4053,18 @@ msg_format("%s
                        else
                        {
 #ifdef JP
-                               msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
+                               msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", (feat == FEAT_TREES) ? "ÌÚ" : "ÊÉ");
 #else
-                               msg_print("There is a wall blocking your way.");
+                               msg_format("There is a %s blocking your way.", (feat == FEAT_TREES) ? "tree" : "wall");
 #endif
 
-
                                if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
                                        energy_use = 0;
                        }
                }
 
                /* Sound */
-               sound(SOUND_HITWALL);
+               if (!boundary_floor_grid(c_ptr)) sound(SOUND_HITWALL);
        }
 
        /* Normal movement */
@@ -5207,7 +5219,7 @@ void run_step(int dir)
 
 #endif /* ALLOW_EASY_DISARM -- TNB */
 
-       if ((py == p_ptr->run_py) && (px == p_ptr->run_px))
+       if (player_bold(p_ptr->run_py, p_ptr->run_px))
        {
                p_ptr->run_py = 0;
                p_ptr->run_px = 0;