OSDN Git Service

This commit was manufactured by cvs2svn to create tag
[hengbandforosx/hengbandosx.git] / src / cmd2.c
index 2e6f317..065e371 100644 (file)
@@ -118,22 +118,27 @@ void do_cmd_go_up(void)
 
        if (autosave_l) do_cmd_save_game(TRUE);
 
-       if (p_ptr->inside_quest)
+       /* For a random quest */
+       if (p_ptr->inside_quest &&
+           quest[p_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
        {
                leave_quest_check();
 
-               if (quest[leaving_quest].type != QUEST_TYPE_RANDOM)
-               {
-                       p_ptr->inside_quest = c_ptr->special;
-                       dun_level = 0;
-               }
-               else
-               {
-                       p_ptr->inside_quest = 0;
-               }
+               p_ptr->inside_quest = 0;
+       }
+
+       /* For a fixed quest */
+       if (p_ptr->inside_quest &&
+           quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
+       {
+               leave_quest_check();
 
+               p_ptr->inside_quest = c_ptr->special;
+               dun_level = 0;
                up_num = 0;
        }
+
+       /* For normal dungeon and random quest */
        else
        {
                /* New depth */
@@ -160,7 +165,7 @@ void do_cmd_go_up(void)
 #ifdef JP
        if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "³¬Ãʤò¾å¤Ã¤¿");
 #else
-       if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "go up the stairs to");
+       if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "climbed up the stairs to");
 #endif
 
        /* Success */
@@ -299,18 +304,18 @@ void do_cmd_go_down(void)
                if (record_stair)
                {
 #ifdef JP
-                       if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "Í¸Í¤ËÍî¤Á¤¿");
+                       if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "Íî¤Ȥ·¸Í¤ËÍî¤Á¤¿");
                        else do_cmd_write_nikki(NIKKI_STAIR, down_num, "³¬Ãʤò²¼¤ê¤¿");
 #else
-                       if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "fall from trap door");
-                       else do_cmd_write_nikki(NIKKI_STAIR, down_num, "go down the stairs to");
+                       if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "fell through a trap door");
+                       else do_cmd_write_nikki(NIKKI_STAIR, down_num, "climbed down the stairs to");
 #endif
                }
 
                if (fall_trap)
                {
 #ifdef JP
-                       msg_print("¤ï¤¶¤ÈÍ¸Í¤ËÍî¤Á¤¿¡£");
+                       msg_print("¤ï¤¶¤ÈÍî¤Ȥ·¸Í¤ËÍî¤Á¤¿¡£");
 #else
                        msg_print("You deliberately jump through the trap door.");
 #endif
@@ -440,7 +445,7 @@ static void chest_death(bool scatter, int y, int x, s16b o_idx)
        int number;
 
        bool small;
-       bool great = FALSE;
+       u32b mode = AM_GOOD;
 
        object_type forge;
        object_type *q_ptr;
@@ -458,7 +463,7 @@ static void chest_death(bool scatter, int y, int x, s16b o_idx)
        {
                number = 5;
                small = FALSE;
-               great = TRUE;
+               mode |= AM_GREAT;
                object_level = o_ptr->xtra3;
        }
        else
@@ -493,7 +498,7 @@ static void chest_death(bool scatter, int y, int x, s16b o_idx)
                else
                {
                        /* Make a good object */
-                       if (!make_object(q_ptr, TRUE, great)) continue;
+                       if (!make_object(q_ptr, mode)) continue;
                }
 
                /* If chest scatters its contents, pick any floor square. */
@@ -718,7 +723,7 @@ static void chest_trap(int y, int x, s16b o_idx)
                else
                {
 #ifdef JP
-                       msg_print("±²´¬¤«¹çÂΤ·¡¢ÇËÎö¤·¤¿¡ª");
+                       msg_print("±²´¬¤¬¹çÂΤ·¡¢ÇËÎö¤·¤¿¡ª");
 #else
                        msg_print("Vortices coalesce and wreak destruction!");
 #endif
@@ -738,7 +743,7 @@ static void chest_trap(int y, int x, s16b o_idx)
 
                /* Message. */
 #ifdef JP
-               msg_print("¶²¤·¤¤À¼¤¬¶Á¤¤¤¿:  ¡Ö°Å°Ç¤¬Æò¤ò¤Ä¤Ä¤Þ¤ó¡ª¡×");
+               msg_print("¶²¤í¤·¤¤À¼¤¬¶Á¤¤¤¿:  ¡Ö°Å°Ç¤¬Æò¤ò¤Ä¤Ä¤Þ¤ó¡ª¡×");
 #else
                msg_print("Hideous voices bid:  'Let the darkness have thee!'");
 #endif
@@ -949,8 +954,8 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
                if (!(c_ptr->info & (CAVE_MARK))) continue;
 
                /* Feature code (applying "mimic" field) */
-               feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
-               
+               feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
+
                /* Not looking for this feature */
                if (!((*test)(feat))) continue;
 
@@ -1221,8 +1226,8 @@ void do_cmd_open(void)
                c_ptr = &cave[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
-               
+               feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
+
                /* Check for chest */
                o_idx = chest_check(y, x);
 
@@ -1298,7 +1303,7 @@ static bool do_cmd_close_aux(int y, int x)
        c_ptr = &cave[y][x];
 
        /* Seeing true feature code (ignore mimic) */
-               
+
        /* Broken door */
        if (c_ptr->feat == FEAT_BROKEN)
        {
@@ -1384,8 +1389,8 @@ void do_cmd_close(void)
                c_ptr = &cave[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
-               
+               feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
+
                /* Require open/broken door */
                if ((feat != FEAT_OPEN) && (feat != FEAT_BROKEN))
                {
@@ -1528,7 +1533,7 @@ static bool do_cmd_tunnel_aux(int y, int x)
        c_ptr = &cave[y][x];
 
        /* Feature code (applying "mimic" field) */
-       feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+       feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
 
        /* Sound */
        sound(SOUND_DIG);
@@ -1545,17 +1550,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
 
        }
 
-       /* No tunnelling through mountains */
-       else if (feat == FEAT_MOUNTAIN)
-       {
-#ifdef JP
-               msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤!");
-#else
-               msg_print("You can't tunnel through that!");
-#endif
-
-       }
-
        /* Map border (mimiccing Permanent wall) */
        else if ((c_ptr->feat >= FEAT_PERM_EXTRA &&
                  c_ptr->feat <= FEAT_PERM_SOLID) ||
@@ -1686,9 +1680,10 @@ static bool do_cmd_tunnel_aux(int y, int x)
 #else
                                msg_print("You have finished the tunnel.");
 #endif
-                               chg_virtue(V_DILIGENCE, 1);
-                               chg_virtue(V_NATURE, -1);
                        }
+
+                       chg_virtue(V_DILIGENCE, 1);
+                       chg_virtue(V_NATURE, -1);
                }
 
                /* Failure (quartz) */
@@ -1735,7 +1730,7 @@ static bool do_cmd_tunnel_aux(int y, int x)
                        if (randint0(100) < (15 - dun_level/2))
                        {
                                /* Create a simple object */
-                               place_object(y, x, FALSE, FALSE);
+                               place_object(y, x, 0L);
 
                                /* Observe new object */
                                if (player_can_see_bold(y, x))
@@ -1850,7 +1845,7 @@ void do_cmd_tunnel(void)
                c_ptr = &cave[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+               feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
 
                /* No tunnelling through doors */
                if (((feat >= FEAT_DOOR_HEAD) && (feat <= FEAT_DOOR_TAIL)) ||
@@ -1994,7 +1989,7 @@ bool easy_open_door(int y, int x)
                        cave_set_feat(y, x, FEAT_OPEN);
 
                        /* Update some things */
-                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS);
+                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
 
                        /* Sound */
                        sound(SOUND_OPENDOOR);
@@ -2026,7 +2021,7 @@ bool easy_open_door(int y, int x)
                cave_set_feat(y, x, FEAT_OPEN);
 
                /* Update some things */
-               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS);
+               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
 
                /* Sound */
                sound(SOUND_OPENDOOR);
@@ -2364,7 +2359,7 @@ void do_cmd_disarm(void)
                c_ptr = &cave[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+               feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
 
                /* Check for chests */
                o_idx = chest_check(y, x);
@@ -2493,7 +2488,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
                move_player(dir, FALSE, FALSE);
 
                /* Update some things */
-               p_ptr->update |= (PU_VIEW | PU_LITE);
+               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
                p_ptr->update |= (PU_DISTANCE);
        }
 
@@ -2587,7 +2582,7 @@ void do_cmd_bash(void)
                c_ptr = &cave[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+               feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
 
                /* Nothing useful */
                if (!((feat >= FEAT_DOOR_HEAD) &&
@@ -2683,7 +2678,7 @@ void do_cmd_alter(void)
                c_ptr = &cave[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+               feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
 
                /* Take a turn */
                energy_use = 100;
@@ -2812,7 +2807,7 @@ void do_cmd_spike(void)
                c_ptr = &cave[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+               feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
 
                /* Require closed door */
                if (!((feat >= FEAT_DOOR_HEAD) &&
@@ -3261,7 +3256,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
                            (r_ptr->flags3 & RF3_ANIMAL))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_ANIMAL;
                                }
@@ -3273,7 +3268,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_KILL_ANIMAL)) &&
                            (r_ptr->flags3 & RF3_ANIMAL))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_ANIMAL;
                                }
@@ -3285,7 +3280,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_SLAY_EVIL)) &&
                            (r_ptr->flags3 & RF3_EVIL))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_EVIL;
                                }
@@ -3297,7 +3292,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_KILL_EVIL)) &&
                            (r_ptr->flags3 & RF3_EVIL))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_EVIL;
                                }
@@ -3309,7 +3304,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_SLAY_HUMAN)) &&
                            (r_ptr->flags2 & RF2_HUMAN))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags2 |= RF2_HUMAN;
                                }
@@ -3321,7 +3316,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_KILL_HUMAN)) &&
                            (r_ptr->flags2 & RF2_HUMAN))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags2 |= RF2_HUMAN;
                                }
@@ -3333,7 +3328,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_SLAY_UNDEAD)) &&
                            (r_ptr->flags3 & RF3_UNDEAD))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_UNDEAD;
                                }
@@ -3345,7 +3340,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_KILL_UNDEAD)) &&
                            (r_ptr->flags3 & RF3_UNDEAD))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_UNDEAD;
                                }
@@ -3357,7 +3352,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_SLAY_DEMON)) &&
                            (r_ptr->flags3 & RF3_DEMON))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_DEMON;
                                }
@@ -3369,7 +3364,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_KILL_DEMON)) &&
                            (r_ptr->flags3 & RF3_DEMON))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_DEMON;
                                }
@@ -3381,7 +3376,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_SLAY_ORC)) &&
                            (r_ptr->flags3 & RF3_ORC))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_ORC;
                                }
@@ -3393,7 +3388,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_KILL_ORC)) &&
                            (r_ptr->flags3 & RF3_ORC))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_ORC;
                                }
@@ -3405,7 +3400,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_SLAY_TROLL)) &&
                            (r_ptr->flags3 & RF3_TROLL))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_TROLL;
                                }
@@ -3417,7 +3412,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_KILL_TROLL)) &&
                            (r_ptr->flags3 & RF3_TROLL))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_TROLL;
                                }
@@ -3429,7 +3424,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_SLAY_GIANT)) &&
                            (r_ptr->flags3 & RF3_GIANT))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_GIANT;
                                }
@@ -3441,7 +3436,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_KILL_GIANT)) &&
                            (r_ptr->flags3 & RF3_GIANT))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_GIANT;
                                }
@@ -3453,7 +3448,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_SLAY_DRAGON)) &&
                            (r_ptr->flags3 & RF3_DRAGON))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_DRAGON;
                                }
@@ -3465,7 +3460,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        if ((have_flag(flgs, TR_KILL_DRAGON)) &&
                            (r_ptr->flags3 & RF3_DRAGON))
                        {
-                               if (m_ptr->ml)
+                               if (m_ptr->ml && is_original_ap(m_ptr))
                                {
                                        r_ptr->r_flags3 |= RF3_DRAGON;
                                }
@@ -3479,14 +3474,14 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Brand (Acid) */
-                       if ((have_flag(flgs, TR_BRAND_ACID)) || (p_ptr->special_attack & (ATTACK_ACID)))
+                       if (have_flag(flgs, TR_BRAND_ACID))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_ACID)
+                               if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)
                                {
-                                       if (m_ptr->ml)
+                                       if (m_ptr->ml && is_original_ap(m_ptr))
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_ACID;
+                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK);
                                        }
                                }
 
@@ -3498,14 +3493,14 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Brand (Elec) */
-                       if ((have_flag(flgs, TR_BRAND_ELEC)) || (p_ptr->special_attack & (ATTACK_ELEC)))
+                       if (have_flag(flgs, TR_BRAND_ELEC))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_ELEC)
+                               if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
                                {
-                                       if (m_ptr->ml)
+                                       if (m_ptr->ml && is_original_ap(m_ptr))
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_ELEC;
+                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
                                        }
                                }
 
@@ -3517,51 +3512,67 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
                        }
 
                        /* Brand (Fire) */
-                       if ((have_flag(flgs, TR_BRAND_FIRE)) || (p_ptr->special_attack & (ATTACK_FIRE)))
+                       if (have_flag(flgs, TR_BRAND_FIRE))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_FIRE)
+                               if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
                                {
-                                       if (m_ptr->ml)
+                                       if (m_ptr->ml && is_original_ap(m_ptr))
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_FIRE;
+                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
                                        }
                                }
 
                                /* Otherwise, take the damage */
                                else
                                {
-                                       if (mult < 17) mult = 17;
+                                       if (r_ptr->flags3 & RF3_HURT_FIRE)
+                                       {
+                                               if (mult < 25) mult = 25;
+                                               if (m_ptr->ml && is_original_ap(m_ptr))
+                                               {
+                                                       r_ptr->r_flags3 |= RF3_HURT_FIRE;
+                                               }
+                                       }
+                                       else if (mult < 17) mult = 17;
                                }
                        }
 
                        /* Brand (Cold) */
-                       if ((have_flag(flgs, TR_BRAND_COLD)) || (p_ptr->special_attack & (ATTACK_COLD)))
+                       if (have_flag(flgs, TR_BRAND_COLD))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_COLD)
+                               if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
                                {
-                                       if (m_ptr->ml)
+                                       if (m_ptr->ml && is_original_ap(m_ptr))
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_COLD;
+                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
                                        }
                                }
                                /* Otherwise, take the damage */
                                else
                                {
-                                       if (mult < 17) mult = 17;
+                                       if (r_ptr->flags3 & RF3_HURT_COLD)
+                                       {
+                                               if (mult < 25) mult = 25;
+                                               if (m_ptr->ml && is_original_ap(m_ptr))
+                                               {
+                                                       r_ptr->r_flags3 |= RF3_HURT_COLD;
+                                               }
+                                       }
+                                       else if (mult < 17) mult = 17;
                                }
                        }
 
                        /* Brand (Poison) */
-                       if ((have_flag(flgs, TR_BRAND_POIS)) || (p_ptr->special_attack & (ATTACK_POIS)))
+                       if (have_flag(flgs, TR_BRAND_POIS))
                        {
                                /* Notice immunity */
-                               if (r_ptr->flags3 & RF3_IM_POIS)
+                               if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
                                {
-                                       if (m_ptr->ml)
+                                       if (m_ptr->ml && is_original_ap(m_ptr))
                                        {
-                                               r_ptr->r_flags3 |= RF3_IM_POIS;
+                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
                                        }
                                }
 
@@ -3695,7 +3706,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
 
                return;
        }
-       project_length = 0; /* reset to default */
 
        /* Get local object */
        q_ptr = &forge;
@@ -3745,6 +3755,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                ty = target_row;
        }
 
+       project_length = 0; /* reset to default */
 
        /* Hack -- Handle stuff */
        handle_stuff();
@@ -3821,9 +3832,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval])
                                {
                                        int amount = 0;
-                                       if (now_exp < SPELL_EXP_BEGINNER) amount = 80;
-                                       else if (now_exp < SPELL_EXP_SKILLED) amount = 25;
-                                       else if ((now_exp < SPELL_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 10;
+                                       if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
+                                       else if (now_exp < WEAPON_EXP_SKILLED) amount = 25;
+                                       else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 10;
                                        else if (p_ptr->lev > 34) amount = 2;
                                        p_ptr->weapon_exp[0][j_ptr->sval] += amount;
                                        p_ptr->update |= (PU_BONUS);
@@ -3846,40 +3857,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                        {
                                bool fear = FALSE;
 
-                               /* Assume a default death */
-#ifdef JP
-                               cptr note_dies = "¤Ï»à¤ó¤À¡£";
-#else
-                               cptr note_dies = " dies.";
-#endif
-
-                               /* Some monsters get "destroyed" */
-                               if (!monster_living(r_ptr))
-                               {
-                                       int i;
-                                       bool explode = FALSE;
-
-                                       for (i = 0; i < 4; i++)
-                                       {
-                                               if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
-                                       }
-
-                                       /* Special note at death */
-                                       if (explode)
-#ifdef JP
-note_dies = "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
-#else
-                                               note_dies = " explodes into tiny shreds.";
-#endif
-                                       else
-#ifdef JP
-                                               note_dies = "¤òÅݤ·¤¿¡£";
-#else
-                                               note_dies = " is destroyed.";
-#endif
-
-                               }
-
                                /* Handle unseen monster */
                                if (!visible)
                                {
@@ -3939,7 +3916,7 @@ note_dies = "
                                }
 
                                /* Hit the monster, check for death */
-                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, note_dies))
+                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
                                {
                                        /* Dead monster */
                                }
@@ -4231,9 +4208,9 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                return FALSE;
        }
 
-       if (p_ptr->inside_arena)
+       if (p_ptr->inside_arena && !boomerang)
        {
-               if (o_ptr->tval != 5)
+               if (o_ptr->tval != TV_SPIKE)
                {
 #ifdef JP
                        msg_print("¥¢¥ê¡¼¥Ê¤Ç¤Ï¥¢¥¤¥Æ¥à¤ò»È¤¨¤Ê¤¤¡ª");
@@ -4293,8 +4270,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                /* Get a direction (or cancel) */
                if (!get_aim_dir(&dir)) return FALSE;
 
-               project_length = 0;  /* reset to default */
-
                /* Predict the "target" location */
                tx = px + 99 * ddx[dir];
                ty = py + 99 * ddy[dir];
@@ -4305,6 +4280,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                        tx = target_col;
                        ty = target_row;
                }
+
+               project_length = 0;  /* reset to default */
        }
 
        if ((q_ptr->name1 == ART_MJOLLNIR) ||
@@ -4319,7 +4296,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                        inven_item_describe(item);
                inven_item_optimize(item);
        }
-       
+
        /* Reduce and describe floor item */
        else
        {
@@ -4331,7 +4308,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                equiped_item = TRUE;
                p_ptr->redraw |= (PR_EQUIPPY);
        }
-       
+
        /* Take a turn */
        energy_use = 100;
 
@@ -4424,42 +4401,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                        {
                                bool fear = FALSE;
 
-                               /* Assume a default death */
-#ifdef JP
-                               cptr note_dies = "¤Ï»à¤ó¤À¡£";
-#else
-                               cptr note_dies = " dies.";
-#endif
-
-
-                               /* Some monsters get "destroyed" */
-                               if (!monster_living(r_ptr))
-                               {
-                                       int i;
-                                       bool explode = FALSE;
-
-                                       for (i = 0; i < 4; i++)
-                                       {
-                                               if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
-                                       }
-
-                                       /* Special note at death */
-                                       if (explode)
-#ifdef JP
-note_dies = "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
-#else
-                                               note_dies = " explodes into tiny shreds.";
-#endif
-                                       else
-#ifdef JP
-                                               note_dies = "¤òÅݤ·¤¿¡£";
-#else
-                                               note_dies = " is destroyed.";
-#endif
-
-                               }
-
-
                                /* Handle unseen monster */
                                if (!visible)
                                {
@@ -4498,7 +4439,7 @@ note_dies = "
                                /* Hack -- Base damage from thrown object */
                                tdam = damroll(q_ptr->dd, q_ptr->ds);
                                /* Apply special damage XXX XXX XXX */
-                               tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0);
+                               tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE);
                                tdam = critical_shot(q_ptr->weight, q_ptr->to_h, tdam);
                                if (q_ptr->to_d > 0)
                                        tdam += q_ptr->to_d;
@@ -4544,7 +4485,7 @@ note_dies = "
                                }
 
                                /* Hit the monster, check for death */
-                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, note_dies))
+                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
                                {
                                        /* Dead monster */
                                }