OSDN Git Service

./bootstrap 実行時に warning が出ないよう修正。
[hengband/hengband.git] / src / melee2.c
index a4c7f92..e050863 100644 (file)
@@ -1434,7 +1434,7 @@ static bool monst_attack_monst(int m_idx, int t_idx)
        int             ap_cnt;
        int             ac, rlev, pt;
        char            m_name[80], t_name[80];
-       char            temp[80];
+       char            temp[MAX_NLEN];
        bool            blinked;
        bool            explode = FALSE, touched = FALSE, fear = FALSE;
        int             y_saver = t_ptr->fy;
@@ -2149,20 +2149,38 @@ act = "%s
        /* Blink away */
        if (blinked && m_ptr->r_idx)
        {
-               if (see_m)
+               if (teleport_barrier(m_idx))
                {
+                       if (see_m)
+                       {
 #ifdef JP
-                       msg_print("Å¥ËÀ¤Ï¾Ð¤Ã¤Æƨ¤²¤¿¡ª");
+                               msg_print("Å¥ËÀ¤Ï¾Ð¤Ã¤Æƨ¤²...¤è¤¦¤È¤·¤¿¤¬¥Ð¥ê¥¢¤ËËɤ¬¤ì¤¿¡£");
 #else
-                       msg_print("The thief flees laughing!");
+                               msg_print("The thief flees laughing...? But magic barrier obstructs it.");
 #endif
+                       }
+                       else if (known)
+                       {
+                               mon_fight = TRUE;
+                       }
                }
-               else if (known)
+               else
                {
-                       mon_fight = TRUE;
-               }
+                       if (see_m)
+                       {
+#ifdef JP
+                               msg_print("Å¥ËÀ¤Ï¾Ð¤Ã¤Æƨ¤²¤¿¡ª");
+#else
+                               msg_print("The thief flees laughing!");
+#endif
+                       }
+                       else if (known)
+                       {
+                               mon_fight = TRUE;
+                       }
 
-               teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
+                       teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
+               }
        }
 
        return TRUE;
@@ -2453,7 +2471,7 @@ static void process_monster(int m_idx)
                (void)set_monster_csleep(m_idx, 0);
 
                /* Notice the "waking up" */
-               if (see_m)
+               if (m_ptr->ml)
                {
                        char m_name[80];
 
@@ -2540,6 +2558,9 @@ static void process_monster(int m_idx)
                        }
                }
 
+               /* Hex */
+               if (multiply_barrier(m_idx)) k = 8;
+
                /* Hack -- multiply slower in crowded areas */
                if ((k < 4) && (!k || !randint0(k * MON_MULT_ADJ)))
                {
@@ -3266,8 +3287,6 @@ msg_format("%^s%s", m_name, monmessage);
                /* Creature has been allowed move */
                if (do_move)
                {
-                       s16b this_o_idx, next_o_idx;
-
                        /* Take a turn */
                        do_turn = TRUE;
 
@@ -3331,39 +3350,38 @@ msg_format("%^s%s", m_name, monmessage);
                                        disturb(0, 0);
                        }
 
-                       /* Scan all objects in the grid */
-                       for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
+                       /* Take or Kill objects on the floor */
+                       if (c_ptr->o_idx && (r_ptr->flags2 & (RF2_TAKE_ITEM | RF2_KILL_ITEM)) &&
+                           (!is_pet(m_ptr) || ((p_ptr->pet_extra_flags & PF_PICKUP_ITEMS) && (r_ptr->flags2 & RF2_TAKE_ITEM))))
                        {
-                               object_type *o_ptr;
-
-                               /* Acquire object */
-                               o_ptr = &o_list[this_o_idx];
-
-                               /* Acquire next object */
-                               next_o_idx = o_ptr->next_o_idx;
-
-                               /* Skip gold */
-                               if (o_ptr->tval == TV_GOLD) continue;
-
-                               /*
-                                * Skip "real" corpses and statues, to avoid extreme
-                                * silliness like a novice rogue pockets full of statues
-                                * and corpses.
-                                */
-                               if ((o_ptr->tval == TV_CORPSE) ||
-                                   (o_ptr->tval == TV_STATUE)) continue;
+                               s16b this_o_idx, next_o_idx;
+                               bool do_take = (r_ptr->flags2 & RF2_TAKE_ITEM) ? TRUE : FALSE;
 
-                               /* Take or Kill objects on the floor */
-                               if ((r_ptr->flags2 & (RF2_TAKE_ITEM | RF2_KILL_ITEM)) &&
-                                        (!is_pet(m_ptr) || (p_ptr->pet_extra_flags & PF_PICKUP_ITEMS)))
+                               /* Scan all objects in the grid */
+                               for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
                                {
-                                       u32b flgs[TR_FLAG_SIZE];
+                                       u32b flgs[TR_FLAG_SIZE], flg2 = 0L, flg3 = 0L, flgr = 0L;
+                                       char m_name[80], o_name[MAX_NLEN];
 
-                                       u32b flg2 = 0L;
-                                       u32b flg3 = 0L;
+                                       /* Acquire object */
+                                       object_type *o_ptr = &o_list[this_o_idx];
 
-                                       char m_name[80];
-                                       char o_name[MAX_NLEN];
+                                       /* Acquire next object */
+                                       next_o_idx = o_ptr->next_o_idx;
+
+                                       if (do_take)
+                                       {
+                                               /* Skip gold */
+                                               if (o_ptr->tval == TV_GOLD) continue;
+
+                                               /*
+                                                * Skip "real" corpses and statues, to avoid extreme
+                                                * silliness like a novice rogue pockets full of statues
+                                                * and corpses.
+                                                */
+                                               if ((o_ptr->tval == TV_CORPSE) ||
+                                                   (o_ptr->tval == TV_STATUE)) continue;
+                                       }
 
                                        /* Extract some flags */
                                        object_flags(o_ptr, flgs);
@@ -3375,12 +3393,12 @@ msg_format("%^s%s", m_name, monmessage);
                                        monster_desc(m_name, m_ptr, MD_INDEF_HIDDEN);
 
                                        /* React to objects that hurt the monster */
-                                       if (have_flag(flgs, TR_KILL_DRAGON)) flg3 |= (RF3_DRAGON);
                                        if (have_flag(flgs, TR_SLAY_DRAGON)) flg3 |= (RF3_DRAGON);
+                                       if (have_flag(flgs, TR_KILL_DRAGON)) flg3 |= (RF3_DRAGON);
                                        if (have_flag(flgs, TR_SLAY_TROLL))  flg3 |= (RF3_TROLL);
                                        if (have_flag(flgs, TR_KILL_TROLL))  flg3 |= (RF3_TROLL);
-                                       if (have_flag(flgs, TR_KILL_GIANT))  flg3 |= (RF3_GIANT);
                                        if (have_flag(flgs, TR_SLAY_GIANT))  flg3 |= (RF3_GIANT);
+                                       if (have_flag(flgs, TR_KILL_GIANT))  flg3 |= (RF3_GIANT);
                                        if (have_flag(flgs, TR_SLAY_ORC))    flg3 |= (RF3_ORC);
                                        if (have_flag(flgs, TR_KILL_ORC))    flg3 |= (RF3_ORC);
                                        if (have_flag(flgs, TR_SLAY_DEMON))  flg3 |= (RF3_DEMON);
@@ -3393,12 +3411,18 @@ msg_format("%^s%s", m_name, monmessage);
                                        if (have_flag(flgs, TR_KILL_EVIL))   flg3 |= (RF3_EVIL);
                                        if (have_flag(flgs, TR_SLAY_HUMAN))  flg2 |= (RF2_HUMAN);
                                        if (have_flag(flgs, TR_KILL_HUMAN))  flg2 |= (RF2_HUMAN);
+                                       if (have_flag(flgs, TR_BRAND_ACID))  flgr |= (RFR_IM_ACID);
+                                       if (have_flag(flgs, TR_BRAND_ELEC))  flgr |= (RFR_IM_ELEC);
+                                       if (have_flag(flgs, TR_BRAND_FIRE))  flgr |= (RFR_IM_FIRE);
+                                       if (have_flag(flgs, TR_BRAND_COLD))  flgr |= (RFR_IM_COLD);
+                                       if (have_flag(flgs, TR_BRAND_POIS))  flgr |= (RFR_IM_POIS);
 
                                        /* The object cannot be picked up by the monster */
-                                       if (object_is_artifact(o_ptr) || (r_ptr->flags3 & flg3) || (r_ptr->flags2 & flg2))
+                                       if (object_is_artifact(o_ptr) || (r_ptr->flags3 & flg3) || (r_ptr->flags2 & flg2) ||
+                                           ((~(r_ptr->flagsr) & flgr) && !(r_ptr->flagsr & RFR_RES_ALL)))
                                        {
                                                /* Only give a message for "take_item" */
-                                               if ((r_ptr->flags2 & (RF2_TAKE_ITEM)) && (r_ptr->flags2 & (RF2_STUPID)))
+                                               if (do_take && (r_ptr->flags2 & RF2_STUPID))
                                                {
                                                        /* Take note */
                                                        did_take_item = TRUE;
@@ -3417,7 +3441,7 @@ msg_format("%^s%s", m_name, monmessage);
                                        }
 
                                        /* Pick up the item */
-                                       else if (r_ptr->flags2 & RF2_TAKE_ITEM)
+                                       else if (do_take)
                                        {
                                                /* Take note */
                                                did_take_item = TRUE;
@@ -3437,7 +3461,7 @@ msg_format("%^s%s", m_name, monmessage);
                                                excise_object_idx(this_o_idx);
 
                                                /* Forget mark */
-                                               o_ptr->marked = 0;
+                                               o_ptr->marked &= OM_TOUCHED;
 
                                                /* Forget location */
                                                o_ptr->iy = o_ptr->ix = 0;
@@ -4240,7 +4264,7 @@ static void process_monsters_mtimed_aux(int m_idx, int mtimed_idx)
                                else
                                {
                                        /* Notice the "waking up" */
-                                       if (is_seen(m_ptr))
+                                       if (m_ptr->ml)
                                        {
                                                char m_name[80];