OSDN Git Service

空腹充足の巻物の記述を削除.
[hengband/hengband.git] / src / xtra2.c
index ee13ff3..ca129b2 100644 (file)
@@ -604,10 +604,10 @@ msg_print("
 
 
                /* Create stairs down */
-               cave_set_feat(y, x, FEAT_MORE);
+               cave_set_feat(y, x, feat_down_stair);
 
                /* Remember to update everything */
-               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
+               p_ptr->update |= (PU_FLOW);
        }
 
        /*
@@ -698,7 +698,7 @@ void monster_death(int m_idx, bool drop_item)
 
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-       bool visible = (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE));
+       bool visible = ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE));
 
        u32b mo_mode = 0L;
 
@@ -823,8 +823,7 @@ msg_print("
 
        /* Drop a dead corpse? */
        if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
-           ((r_ptr->flags9 & RF9_DROP_CORPSE) ||
-            (r_ptr->flags9 & RF9_DROP_SKELETON)) &&
+           (r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) &&
            !(p_ptr->inside_arena || p_ptr->inside_battle || cloned || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
        {
                /* Assume skeleton */
@@ -836,7 +835,7 @@ msg_print("
                 */
                if (!(r_ptr->flags9 & RF9_DROP_SKELETON))
                        corpse = TRUE;
-               else if ((r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags1 && RF1_UNIQUE))
+               else if ((r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags1 & RF1_UNIQUE))
                        corpse = TRUE;
 
                /* Else, a corpse is more likely unless we did a "lot" of damage */
@@ -999,6 +998,7 @@ msg_print("
                if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
                {
                        int a_idx = 0;
+                       artifact_type *a_ptr = NULL;
 
                        if (!drop_chosen_item) break;
 
@@ -1016,15 +1016,20 @@ msg_print("
                                        a_idx = ART_NAMAKE_ARMOR;
                                        break;
                                }
+
+                               a_ptr = &a_info[a_idx];
                        }
-                       while (a_info[a_idx].cur_num);
+                       while (a_ptr->cur_num);
 
-                       if (a_info[a_idx].cur_num == 0)
+                       /* Create the artifact */
+                       if (create_named_art(a_idx, y, x))
                        {
-                               /* Create the artifact */
-                               create_named_art(a_idx, y, x);
-                               a_info[a_idx].cur_num = 1;
+                               a_ptr->cur_num = 1;
+
+                               /* Hack -- Memorize location of artifact in saved floors */
+                               if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
                        }
+                       else if (!preserve_mode) a_ptr->cur_num = 1;
                }
                break;
 
@@ -1079,7 +1084,7 @@ msg_print("
        case MON_A_GOLD:
        case MON_A_SILVER:
                if (drop_chosen_item && ((m_ptr->r_idx == MON_A_GOLD) ||
-                    ((m_ptr->r_idx == MON_A_SILVER) && (r_ptr->r_pkills % 5 == 0))))
+                    ((m_ptr->r_idx == MON_A_SILVER) && (r_ptr->r_akills % 5 == 0))))
                {
                        /* Get local object */
                        q_ptr = &forge;
@@ -1178,7 +1183,7 @@ msg_print("
                                /* Activate restriction */
                                get_obj_num_hook = kind_is_hafted;
 
-                               /* Make a poleweapon */
+                               /* Make a hafted weapon */
                                make_object(q_ptr, mo_mode);
 
                                /* Drop it in the dungeon */
@@ -1387,11 +1392,19 @@ msg_print("
 
                if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
                {
-                       if (a_info[a_idx].cur_num == 0)
+                       artifact_type *a_ptr = &a_info[a_idx];
+
+                       if (!a_ptr->cur_num)
                        {
                                /* Create the artifact */
-                               create_named_art(a_idx, y, x);
-                               a_info[a_idx].cur_num = 1;
+                               if (create_named_art(a_idx, y, x))
+                               {
+                                       a_ptr->cur_num = 1;
+
+                                       /* Hack -- Memorize location of artifact in saved floors */
+                                       if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
+                               }
+                               else if (!preserve_mode) a_ptr->cur_num = 1;
                        }
                }
 
@@ -1403,11 +1416,19 @@ msg_print("
                        if (d_info[dungeon_type].final_artifact)
                        {
                                int a_idx = d_info[dungeon_type].final_artifact;
-                               if (!a_info[a_idx].cur_num)
+                               artifact_type *a_ptr = &a_info[a_idx];
+
+                               if (!a_ptr->cur_num)
                                {
                                        /* Create the artifact */
-                                       create_named_art(a_idx, y, x);
-                                       a_info[a_idx].cur_num = 1;
+                                       if (create_named_art(a_idx, y, x))
+                                       {
+                                               a_ptr->cur_num = 1;
+
+                                               /* Hack -- Memorize location of artifact in saved floors */
+                                               if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
+                                       }
+                                       else if (!preserve_mode) a_ptr->cur_num = 1;
 
                                        /* Prevent rewarding both artifact and "default" object */
                                        if (!d_info[dungeon_type].final_object) k_idx = 0;
@@ -1570,17 +1591,17 @@ int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
        if ((r_ptr->flagsr & RFR_RES_ALL) && dam > 0)
        {
                dam /= 100;
-               if((dam == 0) && one_in_(3)) dam = 1;
+               if ((dam == 0) && one_in_(3)) dam = 1;
        }
 
-       if (m_ptr->invulner)
+       if (MON_INVULNER(m_ptr))
        {
                if (is_psy_spear)
                {
                        if (!p_ptr->blind && is_seen(m_ptr))
                        {
 #ifdef JP
-msg_print("¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¤¤¿¡ª");
+                               msg_print("¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¤¤¿¡ª");
 #else
                                msg_print("The barrier is penetrated!");
 #endif
@@ -1628,9 +1649,9 @@ static void get_exp_from_mon(int dam, monster_type *m_ptr)
 
        /* Use (average maxhp * 2) as a denominator */
        if (!(r_ptr->flags1 & RF1_FORCE_MAXHP))
-               s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (r_ptr->hside + 1));
+               s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * (r_ptr->hside + 1));
        else
-               s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * r_ptr->hside * 2);
+               s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * r_ptr->hside * 2);
 
        /* Special penalty in the wilderness */
        if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
@@ -1642,7 +1663,7 @@ static void get_exp_from_mon(int dam, monster_type *m_ptr)
        /* Special penalty for mutiply-monster */
        if ((r_ptr->flags2 & RF2_MULTIPLY) || (m_ptr->r_idx == MON_DAWN))
        {
-               int monnum_penarty = r_ptr->r_pkills / 400;
+               int monnum_penarty = r_ptr->r_akills / 400;
                if (monnum_penarty > 8) monnum_penarty = 8;
 
                while (monnum_penarty--)
@@ -1715,9 +1736,7 @@ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
        if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
 
        /* Wake it up */
-       m_ptr->csleep = 0;
-
-       if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+       (void)set_monster_csleep(m_idx, 0);
 
        /* Hack - Cancel any special player stealth magics. -LM- */
        if (p_ptr->special_defense & NINJA_S_STEALTH)
@@ -1760,15 +1779,18 @@ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
                                {
                                        r_info[MON_BANORLUPART].max_num = 0;
                                        r_info[MON_BANORLUPART].r_pkills++;
+                                       r_info[MON_BANORLUPART].r_akills++;
                                        if (r_info[MON_BANORLUPART].r_tkills < MAX_SHORT) r_info[MON_BANORLUPART].r_tkills++;
                                }
                                else if (m_ptr->r_idx == MON_BANORLUPART)
                                {
                                        r_info[MON_BANOR].max_num = 0;
                                        r_info[MON_BANOR].r_pkills++;
+                                       r_info[MON_BANOR].r_akills++;
                                        if (r_info[MON_BANOR].r_tkills < MAX_SHORT) r_info[MON_BANOR].r_tkills++;
                                        r_info[MON_LUPART].max_num = 0;
                                        r_info[MON_LUPART].r_pkills++;
+                                       r_info[MON_LUPART].r_akills++;
                                        if (r_info[MON_LUPART].r_tkills < MAX_SHORT) r_info[MON_LUPART].r_tkills++;
                                }
                        }
@@ -1777,8 +1799,11 @@ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
                        else if (r_ptr->flags7 & RF7_NAZGUL) r_ptr->max_num--;
                }
 
+               /* Count all monsters killed */
+               if (r_ptr->r_akills < MAX_SHORT) r_ptr->r_akills++;
+
                /* Recall even invisible uniques or winners */
-               if (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE))
+               if ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE))
                {
                        /* Count kills this life */
                        if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
@@ -1912,7 +1937,7 @@ msg_format("%^s
                                chg_virtue(V_HONOUR, 1);
                        }
                }
-               if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_pkills > 1000) && one_in_(10))
+               if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_akills > 1000) && one_in_(10))
                {
                        chg_virtue(V_VALOUR, -1);
                }
@@ -1996,9 +2021,9 @@ msg_format("%s
                        /* Special note at death */
                        if (explode)
 #ifdef JP
-msg_format("%s¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_name);
+                               msg_format("%s¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_name);
 #else
-                               msg_format("%s explodes into tiny shreds.", m_name);
+                               msg_format("%^s explodes into tiny shreds.", m_name);
 #endif
                        else
                        {
@@ -2090,35 +2115,21 @@ msg_format("%s
 #ifdef ALLOW_FEAR
 
        /* Mega-Hack -- Pain cancels fear */
-       if (m_ptr->monfear && (dam > 0))
+       if (MON_MONFEAR(m_ptr) && (dam > 0))
        {
-               int tmp = randint1(dam);
-
-               /* Cure a little fear */
-               if (tmp < m_ptr->monfear)
+               /* Cure fear */
+               if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
                {
-                       /* Reduce fear */
-                       m_ptr->monfear -= tmp;
-               }
-
-               /* Cure all the fear */
-               else
-               {
-                       /* Cure fear */
-                       m_ptr->monfear = 0;
-
                        /* No more fear */
                        (*fear) = FALSE;
                }
        }
 
        /* Sometimes a monster gets scared by damage */
-       if (!m_ptr->monfear && !(r_ptr->flags3 & (RF3_NO_FEAR)))
+       if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & (RF3_NO_FEAR)))
        {
-               int percentage;
-
                /* Percentage of fully healthy */
-               percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
+               int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
 
                /*
                 * Run (sometimes) if at 10% or less of max hit points,
@@ -2131,9 +2142,9 @@ msg_format("%s
                        (*fear) = TRUE;
 
                        /* XXX XXX XXX Hack -- Add some timed fear */
-                       m_ptr->monfear = (randint1(10) +
+                       (void)set_monster_monfear(m_idx, (randint1(10) +
                                          (((dam >= m_ptr->hp) && (percentage > 7)) ?
-                                          20 : ((11 - percentage) * 5)));
+                                          20 : ((11 - percentage) * 5))));
                }
        }
 
@@ -2250,12 +2261,6 @@ void redraw_window(void)
 {
        /* Only if the dungeon exists */
        if (!character_dungeon) return;
-       
-       /* Hack - Activate term zero for the redraw */
-       Term_activate(&term_screen[0]);
-       
-       /* Hack -- react to changes */
-       Term_xtra(TERM_XTRA_REACT, 0);
 
        /* Window stuff */
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
@@ -2268,9 +2273,6 @@ void redraw_window(void)
 
        /* Redraw */
        Term_redraw();
-
-       /* Refresh */
-       Term_fresh();
 }
 
 
@@ -2716,7 +2718,6 @@ bool target_okay(void)
 }
 
 
-
 /*
  * Sorting hook -- comp function -- by "distance to player"
  *
@@ -2750,6 +2751,75 @@ static bool ang_sort_comp_distance(vptr u, vptr v, int a, int b)
 
 
 /*
+ * Sorting hook -- comp function -- by importance level of grids
+ *
+ * We use "u" and "v" to point to arrays of "x" and "y" positions,
+ * and sort the arrays by level of monster
+ */
+static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b)
+{
+       byte *x = (byte*)(u);
+       byte *y = (byte*)(v);
+       cave_type *ca_ptr = &cave[y[a]][x[a]];
+       cave_type *cb_ptr = &cave[y[b]][x[b]];
+       monster_type *ma_ptr = &m_list[ca_ptr->m_idx];
+       monster_type *mb_ptr = &m_list[cb_ptr->m_idx];
+       monster_race *ap_ra_ptr, *ap_rb_ptr;
+
+       /* The player grid */
+       if (y[a] == py && x[a] == px) return TRUE;
+       if (y[b] == py && x[b] == px) return FALSE;
+
+       /* Extract monster race */
+       if (ca_ptr->m_idx && ma_ptr->ml) ap_ra_ptr = &r_info[ma_ptr->ap_r_idx];
+       else ap_ra_ptr = NULL;
+       if (cb_ptr->m_idx && mb_ptr->ml) ap_rb_ptr = &r_info[mb_ptr->ap_r_idx];
+       else ap_rb_ptr = NULL;
+
+       if (ap_ra_ptr && !ap_rb_ptr) return TRUE;
+       if (!ap_ra_ptr && ap_rb_ptr) return FALSE;
+
+       /* Compare two monsters */
+       if (ap_ra_ptr && ap_rb_ptr)
+       {
+               /* Unique monsters first */
+               if ((ap_ra_ptr->flags1 & RF1_UNIQUE) && !(ap_rb_ptr->flags1 & RF1_UNIQUE)) return TRUE;
+               if (!(ap_ra_ptr->flags1 & RF1_UNIQUE) && (ap_rb_ptr->flags1 & RF1_UNIQUE)) return FALSE;
+
+               /* Shadowers first (¤¢¤ä¤·¤¤±Æ) */
+               if ((ma_ptr->mflag2 & MFLAG2_KAGE) && !(mb_ptr->mflag2 & MFLAG2_KAGE)) return TRUE;
+               if (!(ma_ptr->mflag2 & MFLAG2_KAGE) && (mb_ptr->mflag2 & MFLAG2_KAGE)) return FALSE;
+
+               /* Unknown monsters first */
+               if (!ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills) return TRUE;
+               if (ap_ra_ptr->r_tkills && !ap_rb_ptr->r_tkills) return FALSE;
+
+               /* Higher level monsters first (if known) */
+               if (ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills)
+               {
+                       if (ap_ra_ptr->level > ap_rb_ptr->level) return TRUE;
+                       if (ap_ra_ptr->level < ap_rb_ptr->level) return FALSE;
+               }
+
+               /* Sort by index if all conditions are same */
+               if (ma_ptr->ap_r_idx > mb_ptr->ap_r_idx) return TRUE;
+               if (ma_ptr->ap_r_idx < mb_ptr->ap_r_idx) return FALSE;
+       }
+
+       /* An object get higher priority */
+       if (cave[y[a]][x[a]].o_idx && !cave[y[b]][x[b]].o_idx) return TRUE;
+       if (!cave[y[a]][x[a]].o_idx && cave[y[b]][x[b]].o_idx) return FALSE;
+
+       /* Priority from the terrain */
+       if (f_info[ca_ptr->feat].priority > f_info[cb_ptr->feat].priority) return TRUE;
+       if (f_info[ca_ptr->feat].priority < f_info[cb_ptr->feat].priority) return FALSE;
+
+       /* If all conditions are same, compare distance */
+       return ang_sort_comp_distance(u, v, a, b);
+}
+
+
+/*
  * Sorting hook -- swap function -- by "distance to player"
  *
  * We use "u" and "v" to point to arrays of "x" and "y" positions,
@@ -2871,7 +2941,7 @@ static bool target_set_accept(int y, int x)
                next_o_idx = o_ptr->next_o_idx;
 
                /* Memorized object */
-               if (o_ptr->marked) return (TRUE);
+               if (o_ptr->marked & OM_FOUND) return (TRUE);
        }
 
        /* Interesting memorized features */
@@ -2926,8 +2996,18 @@ static void target_set_prepare(int mode)
        }
 
        /* Set the sort hooks */
-       ang_sort_comp = ang_sort_comp_distance;
-       ang_sort_swap = ang_sort_swap_distance;
+       if (mode & (TARGET_KILL))
+       {
+               /* Target the nearest monster for shooting */
+               ang_sort_comp = ang_sort_comp_distance;
+               ang_sort_swap = ang_sort_swap_distance;
+       }
+       else
+       {
+               /* Look important grids first in Look command */
+               ang_sort_comp = ang_sort_comp_importance;
+               ang_sort_swap = ang_sort_swap_distance;
+       }
 
        /* Sort the positions */
        ang_sort(temp_x, temp_y, temp_n);
@@ -3001,6 +3081,8 @@ static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
 }
 
 
+bool show_gold_on_floor = FALSE;
+
 /*
  * Examine a grid, return a keypress.
  *
@@ -3352,7 +3434,9 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                                screen_save();
 
                                /* Display */
+                               show_gold_on_floor = TRUE;
                                (void)show_floor(0, y, x, &min_width);
+                               show_gold_on_floor = FALSE;
 
                                /* Prompt */
 #ifdef JP
@@ -3415,7 +3499,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                next_o_idx = o_ptr->next_o_idx;
 
                /* Describe it */
-               if (o_ptr->marked)
+               if (o_ptr->marked & OM_FOUND)
                {
                        char o_name[MAX_NLEN];
 
@@ -3477,7 +3561,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
        if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
        {
                /* Forget feature */
-               feat = FEAT_NONE;
+               feat = feat_none;
        }
 
        f_ptr = &f_info[feat];
@@ -3487,10 +3571,38 @@ static int target_set_aux(int y, int x, int mode, cptr info)
        {
                cptr name;
 
+               /* Hack -- special handling for quest entrances */
+               if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
+               {
+                       /* Set the quest number temporary */
+                       int old_quest = p_ptr->inside_quest;
+                       int j;
+
+                       /* Clear the text */
+                       for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
+                       quest_text_line = 0;
+
+                       p_ptr->inside_quest = c_ptr->special;
+
+                       /* Get the quest text */
+                       init_flags = INIT_SHOW_TEXT;
+
+                       process_dungeon_file("q_info.txt", 0, 0, 0, 0);
+
+#ifdef JP
+                       name = format("¥¯¥¨¥¹¥È¡Ö%s¡×(%d³¬ÁêÅö)", quest[c_ptr->special].name, quest[c_ptr->special].level);
+#else
+                       name = format("the entrance to the quest '%s'(level %d)", quest[c_ptr->special].name, quest[c_ptr->special].level);
+#endif
+
+                       /* Reset the old quest number */
+                       p_ptr->inside_quest = old_quest;
+               }
+
                /* Hack -- special handling for building doors */
-               if (have_flag(f_ptr->flags, FF_BLDG))
+               else if (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena)
                {
-                       name = building[f_ptr->power].name;
+                       name = building[f_ptr->subtype].name;
                }
                else if (have_flag(f_ptr->flags, FF_ENTRANCE))
                {
@@ -3504,7 +3616,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                {
                        name = town[c_ptr->special].name;
                }
-               else if (p_ptr->wild_mode && (feat == FEAT_FLOOR))
+               else if (p_ptr->wild_mode && (feat == feat_floor))
                {
 #ifdef JP
                        name = "ƻ";
@@ -3533,7 +3645,8 @@ static int target_set_aux(int y, int x, int mode, cptr info)
 
                /* Hack -- special introduction for store & building doors -KMW- */
                if (have_flag(f_ptr->flags, FF_STORE) ||
-                   have_flag(f_ptr->flags, FF_BLDG) ||
+                   have_flag(f_ptr->flags, FF_QUEST_ENTER) ||
+                   (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena) ||
                    have_flag(f_ptr->flags, FF_ENTRANCE))
                {
 #ifdef JP
@@ -3559,11 +3672,16 @@ static int target_set_aux(int y, int x, int mode, cptr info)
 
                /* Display a message */
                if (p_ptr->wizard)
+               {
+                       char f_idx_str[32];
+                       if (c_ptr->mimic) sprintf(f_idx_str, "%d/%d", c_ptr->feat, c_ptr->mimic);
+                       else sprintf(f_idx_str, "%d", c_ptr->feat);
 #ifdef JP
-                       sprintf(out_val, "%s%s%s%s[%s] %x %d %d %d %d (%d,%d)", s1, name, s2, s3, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
+                       sprintf(out_val, "%s%s%s%s[%s] %x %s %d %d %d (%d,%d)", s1, name, s2, s3, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, y, x);
 #else
-                       sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
+                       sprintf(out_val, "%s%s%s%s [%s] %x %s %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, y, x);
 #endif
+               }
                else
 #ifdef JP
                        sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
@@ -4358,7 +4476,7 @@ if (!get_com("
                monster_type *m_ptr = &m_list[p_ptr->riding];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-               if (m_ptr->confused)
+               if (MON_CONFUSED(m_ptr))
                {
                        /* Standard confusion */
                        if (randint0(100) < 75)
@@ -4397,7 +4515,7 @@ msg_print("
                        monster_type *m_ptr = &m_list[p_ptr->riding];
 
                        monster_desc(m_name, m_ptr, 0);
-                       if (m_ptr->confused)
+                       if (MON_CONFUSED(m_ptr))
                        {
 #ifdef JP
 msg_format("%s¤Ïº®Í𤷤Ƥ¤¤ë¡£", m_name);
@@ -5153,7 +5271,7 @@ msg_print("
 #endif
                        break;
                case REW_CURSE_WP:
-                       if (!buki_motteruka(INVEN_RARM)) break;
+                       if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
 #ifdef JP
 msg_format("%s¤ÎÀ¼¤¬¶Á¤­ÅϤä¿:",
                                chaos_patrons[p_ptr->chaos_patron]);
@@ -5168,8 +5286,14 @@ msg_print("
                        msg_print("'Thou reliest too much on thy weapon.'");
 #endif
 
-                       object_desc(o_name, &inventory[INVEN_RARM], OD_NAME_ONLY);
-                       (void)curse_weapon(FALSE, INVEN_RARM);
+                       dummy = INVEN_RARM;
+                       if (buki_motteruka(INVEN_LARM))
+                       {
+                               dummy = INVEN_LARM;
+                               if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
+                       }
+                       object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
+                       (void)curse_weapon(FALSE, dummy);
 #ifdef JP
                        reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
 #else
@@ -5236,9 +5360,15 @@ msg_print("
                                case 3:
                                        if (one_in_(2))
                                        {
-                                               if (!buki_motteruka(INVEN_RARM)) break;
-                                               object_desc(o_name, &inventory[INVEN_RARM], OD_NAME_ONLY);
-                                               (void)curse_weapon(FALSE, INVEN_RARM);
+                                               if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
+                                               dummy = INVEN_RARM;
+                                               if (buki_motteruka(INVEN_LARM))
+                                               {
+                                                       dummy = INVEN_LARM;
+                                                       if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
+                                               }
+                                               object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
+                                               (void)curse_weapon(FALSE, dummy);
 #ifdef JP
                                                reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
 #else
@@ -5291,7 +5421,19 @@ msg_print("
                        }
                        activate_hi_summon(py, px, FALSE);
                        (void)activate_ty_curse(FALSE, &count);
-                       if (one_in_(2)) (void)curse_weapon(FALSE, INVEN_RARM);
+                       if (one_in_(2))
+                       {
+                               dummy = 0;
+
+                               if (buki_motteruka(INVEN_RARM))
+                               {
+                                       dummy = INVEN_RARM;
+                                       if (buki_motteruka(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM;
+                               }
+                               else if (buki_motteruka(INVEN_LARM)) dummy = INVEN_LARM;
+
+                               if (dummy) (void)curse_weapon(FALSE, dummy);
+                       }
                        if (one_in_(2)) (void)curse_armor();
                        break;
                case REW_DESTRUCT: