OSDN Git Service

This commit was manufactured by cvs2svn to create tag
[hengbandforosx/hengbandosx.git] / src / effects.c
index f2caf2e..302c9b1 100644 (file)
@@ -99,7 +99,7 @@ void set_action(int typ)
 #ifdef JP
                        msg_print("Ãí°Õ¿¼¤¯Ê⤭»Ï¤á¤¿¡£");
 #else
-                       msg_print("You began to walk carefully.");
+                       msg_print("You begin to walk carefully.");
 #endif
                        p_ptr->redraw |= (PR_SPEED);
                        break;
@@ -109,7 +109,7 @@ void set_action(int typ)
 #ifdef JP
                        msg_print("³Ø½¬¤ò»Ï¤á¤¿¡£");
 #else
-                       msg_print("You began Learning");
+                       msg_print("You begin Learning");
 #endif
                        break;
                }
@@ -118,7 +118,7 @@ void set_action(int typ)
 #ifdef JP
                        msg_print("¿åÌ̤˻å¤ò¿â¤é¤·¤¿¡¥¡¥¡¥");
 #else
-                       msg_print("You began fishing...");
+                       msg_print("You begin fishing...");
 #endif
                        break;
                }
@@ -127,7 +127,7 @@ void set_action(int typ)
 #ifdef JP
                        msg_print("­¤¬±©¤Î¤è¤¦¤Ë·Ú¤¯¤Ê¤Ã¤¿¡£");
 #else
-                       msg_print("You began to walk extremely fast.");
+                       msg_print("You begin to walk extremely fast.");
 #endif
                        break;
                }
@@ -174,6 +174,8 @@ void reset_tim_flags(void)
        p_ptr->tim_ffall = 0;
        p_ptr->tim_sh_touki = 0;
        p_ptr->tim_sh_fire = 0;
+       p_ptr->tim_sh_holy = 0;
+       p_ptr->tim_eyeeye = 0;
        p_ptr->resist_magic = 0;
        p_ptr->tsuyoshi = 0;
        p_ptr->kabenuke = 0;
@@ -201,7 +203,7 @@ void reset_tim_flags(void)
        p_ptr->special_attack = 0L;
        p_ptr->special_defense = 0L;
 
-       while(p_ptr->energy > 99) p_ptr->energy -= 100;
+       while(p_ptr->energy_need < 0) p_ptr->energy_need += ENERGY_NEED();
        world_player = FALSE;
 
        if (prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) p_ptr->oppose_fire = 1;
@@ -234,7 +236,7 @@ bool set_mimic(int v, int p, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -243,14 +245,14 @@ bool set_mimic(int v, int p, bool do_dec)
                {
                        if (p_ptr->tim_mimic > v) return FALSE;
                }
-                else if ((!p_ptr->tim_mimic) || (p_ptr->mimic_form != p))
+               else if ((!p_ptr->tim_mimic) || (p_ptr->mimic_form != p))
                {
 #ifdef JP
-                        msg_print("¼«Ê¬¤ÎÂΤ¬ÊѤï¤Ã¤Æ¤æ¤¯¤Î¤ò´¶¤¸¤¿¡£");
+                       msg_print("¼«Ê¬¤ÎÂΤ¬ÊѤï¤Ã¤Æ¤æ¤¯¤Î¤ò´¶¤¸¤¿¡£");
 #else
-                        msg_print("You feel that your body change.");
+                       msg_print("You feel that your body changes.");
 #endif
-                        p_ptr->mimic_form=p;
+                       p_ptr->mimic_form=p;
                        notice = TRUE;
                }
        }
@@ -258,22 +260,22 @@ bool set_mimic(int v, int p, bool do_dec)
        /* Shut */
        else
        {
-                if (p_ptr->tim_mimic)
+               if (p_ptr->tim_mimic)
                {
 #ifdef JP
-                        msg_print("ÊѿȤ¬²ò¤±¤¿¡£");
+                       msg_print("ÊѿȤ¬²ò¤±¤¿¡£");
 #else
-                        msg_print("You are no longer transformed.");
+                       msg_print("You are no longer transformed.");
 #endif
                        if (p_ptr->mimic_form == MIMIC_DEMON) set_oppose_fire(0, TRUE);
-                        p_ptr->mimic_form=0;
+                       p_ptr->mimic_form=0;
                        notice = TRUE;
                        p = 0;
                }
        }
 
        /* Use the value */
-        p_ptr->tim_mimic = v;
+       p_ptr->tim_mimic = v;
 
        /* Nothing to notice */
        if (!notice)
@@ -283,11 +285,11 @@ bool set_mimic(int v, int p, bool do_dec)
        if (disturb_state)
                disturb(0, 0);
 
-        /* Redraw title */
-        p_ptr->redraw |= (PR_BASIC | PR_STATUS);
+       /* Redraw title */
+       p_ptr->redraw |= (PR_BASIC | PR_STATUS);
 
        /* Recalculate bonuses */
-        p_ptr->update |= (PU_BONUS | PU_HP);
+       p_ptr->update |= (PU_BONUS | PU_HP);
 
        handle_stuff();
 
@@ -310,7 +312,7 @@ bool set_blind(int v)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -404,7 +406,7 @@ bool set_confused(int v)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -417,6 +419,18 @@ msg_print("
                        msg_print("You are confused!");
 #endif
 
+                       if (p_ptr->action == ACTION_LEARN)
+                       {
+#ifdef JP
+                               msg_print("³Ø½¬¤¬Â³¤±¤é¤ì¤Ê¤¤¡ª");
+#else
+                               msg_print("You cannot continue Learning!");
+#endif
+                               new_mane = FALSE;
+
+                               p_ptr->redraw |= (PR_STATE);
+                               p_ptr->action = ACTION_NONE;
+                       }
                        if (p_ptr->action == ACTION_KAMAE)
                        {
 #ifdef JP
@@ -496,7 +510,7 @@ bool set_poisoned(int v)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -558,7 +572,7 @@ bool set_afraid(int v)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -637,7 +651,7 @@ bool set_paralyzed(int v)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -705,7 +719,7 @@ bool set_image(int v)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
 
        /* Open */
@@ -779,7 +793,7 @@ bool set_fast(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -847,7 +861,7 @@ bool set_lightspeed(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -861,7 +875,7 @@ bool set_lightspeed(int v, bool do_dec)
 #ifdef JP
 msg_print("Èó¾ï¤ËÁÇÁ᤯ư¤±¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
 #else
-                       msg_print("You feel yourself moving faster!");
+                       msg_print("You feel yourself moving extremely faster!");
 #endif
 
                        notice = TRUE;
@@ -915,7 +929,7 @@ bool set_slow(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -981,7 +995,7 @@ bool set_shield(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1051,7 +1065,7 @@ bool set_tsubureru(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1065,7 +1079,7 @@ bool set_tsubureru(int v, bool do_dec)
 #ifdef JP
 msg_print("²£¤Ë¿­¤Ó¤¿¡£");
 #else
-                       msg_print("You have expand horizontally.");
+                       msg_print("Your body expands horizontally.");
 #endif
 
                        notice = TRUE;
@@ -1080,7 +1094,7 @@ msg_print("
 #ifdef JP
 msg_print("¤â¤¦²£¤Ë¿­¤Ó¤Æ¤¤¤Ê¤¤¡£");
 #else
-                       msg_print("You are no longer expanded.");
+                       msg_print("Your body returns to normal.");
 #endif
 
                        notice = TRUE;
@@ -1121,7 +1135,7 @@ bool set_magicdef(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1135,7 +1149,7 @@ bool set_magicdef(int v, bool do_dec)
 #ifdef JP
                        msg_print("ËâË¡¤ÎËɸæÎϤ¬Áý¤·¤¿¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
 #else
-                       msg_print("You feel your magical vulnerability diminish.");
+                       msg_print("You feel more resistant to magic.");
 #endif
 
                        notice = TRUE;
@@ -1150,7 +1164,7 @@ bool set_magicdef(int v, bool do_dec)
 #ifdef JP
                        msg_print("ËâË¡¤ÎËɸæÎϤ¬¸µ¤ËÌá¤Ã¤¿¡£");
 #else
-                       msg_print("Your magical defences fall to their normal values.");
+                       msg_print("You feel less resistant to magic.");
 #endif
 
                        notice = TRUE;
@@ -1191,7 +1205,7 @@ bool set_blessed(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1260,7 +1274,7 @@ bool set_hero(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1332,7 +1346,7 @@ bool set_shero(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        if (p_ptr->pclass == CLASS_BERSERKER) v = 1;
        /* Open */
@@ -1405,7 +1419,7 @@ bool set_protevil(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1470,7 +1484,7 @@ bool set_wraith_form(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1566,7 +1580,7 @@ bool set_invuln(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1623,7 +1637,7 @@ msg_print("̵Ũ
                        /* Window stuff */
                        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
-                       p_ptr->energy -= 100;
+                       p_ptr->energy_need += ENERGY_NEED();
                }
        }
 
@@ -1660,7 +1674,7 @@ bool set_tim_esp(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1732,7 +1746,7 @@ bool set_tim_invis(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1804,7 +1818,7 @@ bool set_tim_infra(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1818,7 +1832,7 @@ bool set_tim_infra(int v, bool do_dec)
 #ifdef JP
 msg_print("Ìܤ¬¥é¥ó¥é¥ó¤Èµ±¤­»Ï¤á¤¿¡ª");
 #else
-                       msg_print("Your eyes began to tingle!");
+                       msg_print("Your eyes begin to tingle!");
 #endif
 
                        notice = TRUE;
@@ -1876,7 +1890,7 @@ bool set_tim_regen(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1890,7 +1904,7 @@ bool set_tim_regen(int v, bool do_dec)
 #ifdef JP
 msg_print("²óÉüÎϤ¬¾å¤¬¤Ã¤¿¡ª");
 #else
-                       msg_print("You began to regenerate quicker!");
+                       msg_print("You feel yourself regenerating quickly!");
 #endif
 
                        notice = TRUE;
@@ -1905,7 +1919,7 @@ msg_print("
 #ifdef JP
 msg_print("ÁÇÁ᤯²óÉü¤¹¤ë´¶¤¸¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
 #else
-                       msg_print("You no longer regenerate quicker.");
+                       msg_print("You feel yourself regenerating slowly.");
 #endif
 
                        notice = TRUE;
@@ -1945,7 +1959,7 @@ bool set_tim_stealth(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -1959,7 +1973,7 @@ bool set_tim_stealth(int v, bool do_dec)
 #ifdef JP
 msg_print("­²»¤¬¾®¤µ¤¯¤Ê¤Ã¤¿¡ª");
 #else
-                       msg_print("You began to walk silently!");
+                       msg_print("You begin to walk silently!");
 #endif
 
                        notice = TRUE;
@@ -2008,7 +2022,7 @@ bool set_superstealth(bool set)
 {
        bool notice = FALSE;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (set)
@@ -2083,7 +2097,7 @@ bool set_tim_ffall(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2097,7 +2111,7 @@ bool set_tim_ffall(int v, bool do_dec)
 #ifdef JP
 msg_print("ÂΤ¬Ãè¤ËÉ⤭»Ï¤á¤¿¡£");
 #else
-                       msg_print("You began to fly!");
+                       msg_print("You begin to fly!");
 #endif
 
                        notice = TRUE;
@@ -2112,7 +2126,7 @@ msg_print("
 #ifdef JP
 msg_print("¤â¤¦Ãè¤ËÉ⤫¤Ù¤Ê¤¯¤Ê¤Ã¤¿¡£");
 #else
-                       msg_print("You no longer flying.");
+                       msg_print("You stop flying.");
 #endif
 
                        notice = TRUE;
@@ -2152,7 +2166,7 @@ bool set_tim_sh_touki(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2166,7 +2180,7 @@ bool set_tim_sh_touki(int v, bool do_dec)
 #ifdef JP
 msg_print("ÂΤ¬Æ®µ¤¤Î¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
 #else
-                       msg_print("You have enveloped by energy aura!");
+                       msg_print("You have enveloped by the aura of the Force!");
 #endif
 
                        notice = TRUE;
@@ -2181,7 +2195,7 @@ msg_print("
 #ifdef JP
 msg_print("Æ®µ¤¤¬¾Ã¤¨¤¿¡£");
 #else
-                       msg_print("Aura of Force disappeared.");
+                       msg_print("Aura of the Force disappeared.");
 #endif
 
                        notice = TRUE;
@@ -2218,7 +2232,7 @@ bool set_tim_sh_fire(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2278,6 +2292,146 @@ msg_print("
 
 
 /*
+ * Set "p_ptr->tim_sh_holy", notice observable changes
+ */
+bool set_tim_sh_holy(int v, bool do_dec)
+{
+       bool notice = FALSE;
+
+       /* Hack -- Force good values */
+       v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+       if (p_ptr->is_dead) return FALSE;
+
+       /* Open */
+       if (v)
+       {
+               if (p_ptr->tim_sh_holy && !do_dec)
+               {
+                       if (p_ptr->tim_sh_holy > v) return FALSE;
+               }
+               else if (!p_ptr->tim_sh_holy)
+               {
+#ifdef JP
+msg_print("ÂΤ¬À»¤Ê¤ë¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
+#else
+                       msg_print("You have enveloped by holy aura!");
+#endif
+
+                       notice = TRUE;
+               }
+       }
+
+       /* Shut */
+       else
+       {
+               if (p_ptr->tim_sh_holy)
+               {
+#ifdef JP
+msg_print("À»¤Ê¤ë¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£");
+#else
+                       msg_print("Holy aura disappeared.");
+#endif
+
+                       notice = TRUE;
+               }
+       }
+
+       /* Use the value */
+       p_ptr->tim_sh_holy = v;
+
+       /* Redraw status bar */
+       p_ptr->redraw |= (PR_STATUS);
+
+       /* Nothing to notice */
+       if (!notice) return (FALSE);
+
+       /* Disturb */
+       if (disturb_state) disturb(0, 0);
+
+       /* Recalculate bonuses */
+       p_ptr->update |= (PU_BONUS);
+
+       /* Handle stuff */
+       handle_stuff();
+
+       /* Result */
+       return (TRUE);
+}
+
+
+
+/*
+ * Set "p_ptr->tim_eyeeye", notice observable changes
+ */
+bool set_tim_eyeeye(int v, bool do_dec)
+{
+       bool notice = FALSE;
+
+       /* Hack -- Force good values */
+       v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+       if (p_ptr->is_dead) return FALSE;
+
+       /* Open */
+       if (v)
+       {
+               if (p_ptr->tim_eyeeye && !do_dec)
+               {
+                       if (p_ptr->tim_eyeeye > v) return FALSE;
+               }
+               else if (!p_ptr->tim_eyeeye)
+               {
+#ifdef JP
+msg_print("Ë¡¤Î¼é¤ê¼ê¤Ë¤Ê¤Ã¤¿µ¤¤¬¤·¤¿¡ª");
+#else
+                       msg_print("You feel like a keeper of commandments!");
+#endif
+
+                       notice = TRUE;
+               }
+       }
+
+       /* Shut */
+       else
+       {
+               if (p_ptr->tim_eyeeye)
+               {
+#ifdef JP
+msg_print("Ĩȳ¤ò¼¹¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
+#else
+                       msg_print("You no longer feel like a keeper.");
+#endif
+
+                       notice = TRUE;
+               }
+       }
+
+       /* Use the value */
+       p_ptr->tim_eyeeye = v;
+
+       /* Redraw status bar */
+       p_ptr->redraw |= (PR_STATUS);
+
+       /* Nothing to notice */
+       if (!notice) return (FALSE);
+
+       /* Disturb */
+       if (disturb_state) disturb(0, 0);
+
+       /* Recalculate bonuses */
+       p_ptr->update |= (PU_BONUS);
+
+       /* Handle stuff */
+       handle_stuff();
+
+       /* Result */
+       return (TRUE);
+}
+
+
+
+/*
  * Set "p_ptr->resist_magic", notice observable changes
  */
 bool set_resist_magic(int v, bool do_dec)
@@ -2287,7 +2441,7 @@ bool set_resist_magic(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2356,7 +2510,7 @@ bool set_tim_reflect(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2425,7 +2579,7 @@ bool set_multishadow(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2494,7 +2648,7 @@ bool set_dustrobe(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2563,7 +2717,7 @@ bool set_kabenuke(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2626,7 +2780,7 @@ bool set_tsuyoshi(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2763,16 +2917,16 @@ bool set_ele_attack(u32b attack_type, int v)
                             ((attack_type == ATTACK_ACID) ? "»À" :
                              ((attack_type == ATTACK_ELEC) ? "ÅÅ·â" :
                               ((attack_type == ATTACK_FIRE) ? "²Ð±ê" : 
-                               ((attack_type == ATTACK_COLD) ? "Î䵤" : 
-                                ((attack_type == ATTACK_POIS) ? "ÆÇ" : 
+                               ((attack_type == ATTACK_COLD) ? "Î䵤" : 
+                                ((attack_type == ATTACK_POIS) ? "ÆÇ" : 
                                        "(¤Ê¤·)"))))));
 #else
                msg_format("For a while, the blows you deal will %s",
                             ((attack_type == ATTACK_ACID) ? "melt with acid!" :
                              ((attack_type == ATTACK_ELEC) ? "shock your foes!" :
                               ((attack_type == ATTACK_FIRE) ? "burn with fire!" : 
-                               ((attack_type == ATTACK_COLD) ? "chill to the bone!" : 
-                                ((attack_type == ATTACK_POIS) ? "poison your enemies!" : 
+                               ((attack_type == ATTACK_COLD) ? "chill to the bone!" : 
+                                ((attack_type == ATTACK_POIS) ? "poison your enemies!" : 
                                        "do nothing special."))))));
 #endif
        }
@@ -2862,16 +3016,16 @@ bool set_ele_immune(u32b immune_type, int v)
                             ((immune_type == DEFENSE_ACID) ? "»À" :
                              ((immune_type == DEFENSE_ELEC) ? "ÅÅ·â" :
                               ((immune_type == DEFENSE_FIRE) ? "²Ð±ê" : 
-                               ((immune_type == DEFENSE_COLD) ? "Î䵤" : 
-                                ((immune_type == DEFENSE_POIS) ? "ÆÇ" : 
+                               ((immune_type == DEFENSE_COLD) ? "Î䵤" : 
+                                ((immune_type == DEFENSE_POIS) ? "ÆÇ" : 
                                        "(¤Ê¤·)"))))));
 #else
                msg_format("For a while, You are immune to %s",
                             ((immune_type == DEFENSE_ACID) ? "acid!" :
                              ((immune_type == DEFENSE_ELEC) ? "electricity!" :
                               ((immune_type == DEFENSE_FIRE) ? "fire!" : 
-                               ((immune_type == DEFENSE_COLD) ? "cold!" : 
-                                ((immune_type == DEFENSE_POIS) ? "poison!" : 
+                               ((immune_type == DEFENSE_COLD) ? "cold!" : 
+                                ((immune_type == DEFENSE_POIS) ? "poison!" : 
                                        "do nothing special."))))));
 #endif
        }
@@ -2901,7 +3055,7 @@ bool set_oppose_acid(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -2967,7 +3121,7 @@ bool set_oppose_elec(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -3033,7 +3187,7 @@ bool set_oppose_fire(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        if ((prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1;
        /* Open */
@@ -3100,7 +3254,7 @@ bool set_oppose_cold(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -3167,7 +3321,7 @@ bool set_oppose_pois(int v, bool do_dec)
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
        if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1;
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -3237,7 +3391,7 @@ bool set_stun(int v)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        if (prace_is_(RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0;
 
@@ -3326,7 +3480,7 @@ msg_print("Ƭ
                        break;
                }
 
-               if (randint(1000) < v || randint(16) == 1)
+               if (randint1(1000) < v || one_in_(16))
                {
 #ifdef JP
 msg_print("³ä¤ì¤ë¤è¤¦¤ÊƬÄˤ¬¤¹¤ë¡£");
@@ -3334,12 +3488,12 @@ msg_print("
                        msg_print("A vicious blow hits your head.");
 #endif
 
-                       if (randint(3) == 1)
+                       if (one_in_(3))
                        {
                                if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
                                if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
                        }
-                       else if (randint(2) == 1)
+                       else if (one_in_(2))
                        {
                                if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
                        }
@@ -3425,7 +3579,7 @@ bool set_cut(int v)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        if ((p_ptr->prace == RACE_GOLEM ||
            p_ptr->prace == RACE_SKELETON ||
@@ -3610,7 +3764,7 @@ msg_print("
                /* Notice */
                notice = TRUE;
 
-               if (randint(1000) < v || randint(16) == 1)
+               if (randint1(1000) < v || one_in_(16))
                {
                        if (!p_ptr->sustain_chr)
                        {
@@ -3908,7 +4062,7 @@ msg_print("
                {
                        p_ptr->wilderness_x = px;
                        p_ptr->wilderness_y = py;
-                       p_ptr->energy = 100;
+                       p_ptr->energy_need = 0;
                        change_wild_mode();
                }
 
@@ -3957,7 +4111,7 @@ bool inc_stat(int stat)
                /* Gain one (sometimes two) points */
                if (value < 18)
                {
-                       gain = ((rand_int(100) < 75) ? 1 : 2);
+                       gain = ((randint0(100) < 75) ? 1 : 2);
                        value += gain;
                }
 
@@ -3971,7 +4125,7 @@ bool inc_stat(int stat)
                        if (gain < 1) gain = 1;
 
                        /* Apply the bonus */
-                       value += randint(gain) + gain / 2;
+                       value += randint1(gain) + gain / 2;
 
                        /* Maximal value */
                        if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
@@ -4053,7 +4207,7 @@ bool dec_stat(int stat, int amount, int permanent)
                        if (loss < 1) loss = 1;
 
                        /* Randomize the loss */
-                       loss = ((randint(loss) + loss) * amount) / 100;
+                       loss = ((randint1(loss) + loss) * amount) / 100;
 
                        /* Maximal loss */
                        if (loss < amount/2) loss = amount/2;
@@ -4095,7 +4249,7 @@ bool dec_stat(int stat, int amount, int permanent)
                        /* and one-half of the stat bonus times the percentage, with a */
                        /* minimum damage of half the percentage. -CWS */
                        loss = (((max-18) / 2 + 1) / 2 + 1);
-                       loss = ((randint(loss) + loss) * amount) / 100;
+                       loss = ((randint1(loss) + loss) * amount) / 100;
                        if (loss < amount/2) loss = amount/2;
 
                        /* Lose some points */
@@ -4119,6 +4273,9 @@ bool dec_stat(int stat, int amount, int permanent)
                p_ptr->stat_cur[stat] = cur;
                p_ptr->stat_max[stat] = max;
 
+               /* Redisplay the stats later */
+               p_ptr->redraw |= (PR_STATS);
+
                /* Recalculate bonuses */
                p_ptr->update |= (PU_BONUS);
        }
@@ -4142,6 +4299,9 @@ bool res_stat(int stat)
                /* Recalculate bonuses */
                p_ptr->update |= (PU_BONUS);
 
+               /* Redisplay the stats later */
+               p_ptr->redraw |= (PR_STATS);
+
                /* Success */
                return (TRUE);
        }
@@ -4323,7 +4483,7 @@ bool do_dec_stat(int stat)
        }
 
        /* Sustain */
-       if (sust && (!ironman_nightmare || rand_int(13)))
+       if (sust && (!ironman_nightmare || randint0(13)))
        {
                /* Message */
 #ifdef JP
@@ -4339,7 +4499,7 @@ msg_format("%s
        }
 
        /* Attempt to reduce the stat */
-       if (dec_stat(stat, 10, (ironman_nightmare && !rand_int(13))))
+       if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
        {
                /* Message */
 #ifdef JP
@@ -4529,7 +4689,7 @@ void do_poly_wounds(void)
        s16b wounds = p_ptr->cut;
        s16b hit_p = (p_ptr->mhp - p_ptr->chp);
        s16b change = damroll(p_ptr->lev, 5);
-       bool Nasty_effect = (randint(5) == 1);
+       bool Nasty_effect = one_in_(5);
 
        if (!(wounds || hit_p || Nasty_effect)) return;
 
@@ -4571,7 +4731,7 @@ msg_print("
 
        chg_virtue(V_CHANCE, 1);
 
-       if ((power > rand_int(20)) && (rand_int(3) == 1) && (p_ptr->prace != RACE_ANDROID))
+       if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
        {
                char effect_msg[80] = "";
                int new_race, expfact, goalexpfact, h_percent;
@@ -4579,7 +4739,7 @@ msg_print("
                /* Some form of racial polymorph... */
                power -= 10;
 
-               if ((power > rand_int(5)) && (rand_int(4) == 1))
+               if ((power > randint0(5)) && one_in_(4))
                {
                        /* sex change */
                        power -= 2;
@@ -4608,7 +4768,7 @@ sprintf(effect_msg, "
                        }
                }
 
-               if ((power > rand_int(30)) && (rand_int(5) == 1))
+               if ((power > randint0(30)) && one_in_(5))
                {
                        int tmp = 0;
 
@@ -4617,16 +4777,16 @@ sprintf(effect_msg, "
 
                        while (tmp < 6)
                        {
-                               if (rand_int(2) == 1)
+                               if (one_in_(2))
                                {
-                                       (void)dec_stat(tmp, randint(6) + 6, (randint(3) == 1));
+                                       (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
                                        power -= 1;
                                }
                                tmp++;
                        }
 
                        /* Deformities are discriminated against! */
-                       (void)dec_stat(A_CHR, randint(6), TRUE);
+                       (void)dec_stat(A_CHR, randint1(6), TRUE);
 
                        if (effect_msg[0])
                        {
@@ -4651,7 +4811,7 @@ sprintf(effect_msg, "
                        }
                }
 
-               while ((power > rand_int(20)) && (rand_int(10) == 1))
+               while ((power > randint0(20)) && one_in_(10))
                {
                        /* Polymorph into a less mutated form */
                        power -= 10;
@@ -4672,11 +4832,11 @@ msg_print("
                if (power < 0)
                        goalexpfact = 100;
                else
-                       goalexpfact = 100 + 3 * rand_int(power);
+                       goalexpfact = 100 + 3 * randint0(power);
 
                do
                {
-                       new_race = rand_int(MAX_RACES);
+                       new_race = randint0(MAX_RACES);
                        expfact = race_info[new_race].r_exp;
                }
                while (((new_race == p_ptr->prace) && (expfact > goalexpfact)) || (new_race == RACE_ANDROID));
@@ -4755,7 +4915,7 @@ msg_print("
                lite_spot(py, px);
        }
 
-       if ((power > rand_int(30)) && (rand_int(6) == 1))
+       if ((power > randint0(30)) && one_in_(6))
        {
                int tmp = 0;
 
@@ -4770,24 +4930,24 @@ msg_format("%s
 
                while (tmp < 6)
                {
-                       (void)dec_stat(tmp, randint(6) + 6, (randint(3) == 1));
+                       (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
                        tmp++;
                }
-               if (randint(6) == 1)
+               if (one_in_(6))
                {
 #ifdef JP
 msg_print("¸½ºß»Ñ¤ÇÀ¸¤­¤Æ¤¤¤¯¤Î¤Ïº¤Æñ¤Ê¤è¤¦¤À¡ª");
-take_hit(DAMAGE_LOSELIFE, damroll(randint(10), p_ptr->lev), "Ã×̿Ū¤ÊÆÍÁ³ÊÑ°Û", -1);
+take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "Ã×̿Ū¤ÊÆÍÁ³ÊÑ°Û", -1);
 #else
                        msg_print("You find living difficult in your present form!");
-                       take_hit(DAMAGE_LOSELIFE, damroll(randint(10), p_ptr->lev), "a lethal mutation", -1);
+                       take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "a lethal mutation", -1);
 #endif
 
                        power -= 10;
                }
        }
 
-       if ((power > rand_int(20)) && (rand_int(4) == 1))
+       if ((power > randint0(20)) && one_in_(4))
        {
                power -= 10;
 
@@ -4795,13 +4955,13 @@ take_hit(DAMAGE_LOSELIFE, damroll(randint(10), p_ptr->lev), "
                do_cmd_rerate(FALSE);
        }
 
-       while ((power > rand_int(15)) && (rand_int(3) == 1))
+       while ((power > randint0(15)) && one_in_(3))
        {
                power -= 7;
                (void)gain_random_mutation(0);
        }
 
-       if (power > rand_int(5))
+       if (power > randint0(5))
        {
                power -= 5;
                do_poly_wounds();
@@ -4825,7 +4985,7 @@ take_hit(DAMAGE_LOSELIFE, damroll(randint(10), p_ptr->lev), "
  * the game when he dies, since the "You die." message is shown before
  * setting the player to "dead".
  */
-bool take_hit(int damage_type, int damage, cptr hit_from, int monspell)
+int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
 {
        int old_chp = p_ptr->chp;
 
@@ -4835,7 +4995,7 @@ bool take_hit(int damage_type, int damage, cptr hit_from, int monspell)
        int warning = (p_ptr->mhp * hitpoint_warn / 10);
 
        /* Paranoia */
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return 0;
 
        if (p_ptr->sutemi) damage *= 2;
        if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
@@ -4867,7 +5027,7 @@ bool take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                                msg_print("The attack cuts your shield of invulnerability open!");
 #endif
                        }
-                       else if (randint(PENETRATE_INVULNERABILITY) == 1)
+                       else if (one_in_(PENETRATE_INVULNERABILITY))
                        {
 #ifdef JP
                                msg_print("̵Ũ¤Î¥Ð¥ê¥¢¤òÇˤäƹ¶·â¤µ¤ì¤¿¡ª");
@@ -4877,7 +5037,7 @@ bool take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                        }
                        else
                        {
-                               return FALSE;
+                               return 0;
                        }
                }
  
@@ -4899,7 +5059,7 @@ bool take_hit(int damage_type, int damage, cptr hit_from, int monspell)
 #else
                                msg_print("The attack hits Shadow, you are unharmed!");
 #endif
-                               return FALSE;
+                               return 0;
                        }
                }
                    
@@ -4916,14 +5076,14 @@ bool take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                        else
                        {
                                damage /= 2;
-                               if ((damage == 0) && (randint(2) == 1)) damage = 1;
+                               if ((damage == 0) && one_in_(2)) damage = 1;
                        }
                }
 
                if ((p_ptr->special_defense & KATA_MUSOU))
                {
                        damage /= 2;
-                       if ((damage == 0) && (randint(2) == 1)) damage = 1;
+                       if ((damage == 0) && one_in_(2)) damage = 1;
                }
        } /* not if LOSELIFE USELIFE */
 
@@ -4931,6 +5091,7 @@ bool take_hit(int damage_type, int damage, cptr hit_from, int monspell)
        p_ptr->chp -= damage;
        if(damage_type == DAMAGE_GENO && p_ptr->chp < 0)
        {
+               damage += p_ptr->chp;
                p_ptr->chp = 0;
        }
 
@@ -4955,7 +5116,7 @@ bool take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
 
 #ifdef JP       /* »à¤ó¤À»þ¤Ë¶¯À©½ªÎ»¤·¤Æ»à¤ò²óÈò¤Ç¤­¤Ê¤¯¤·¤Æ¤ß¤¿ by Habu */
-               if (!munchkin_death)
+               if (!cheat_save)
                        if(!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
 #endif
 
@@ -4968,16 +5129,18 @@ bool take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                p_ptr->leaving = TRUE;
 
                /* Note death */
-               death = TRUE;
+               p_ptr->is_dead = TRUE;
 
                if (p_ptr->inside_arena)
                {
+                       cptr m_name = r_name+r_info[arena_monsters[p_ptr->arena_number]].name;
 #ifdef JP
-msg_format("¤¢¤Ê¤¿¤Ï%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£", r_name+r_info[arena_monsters[p_ptr->arena_number]].name);
+                       msg_format("¤¢¤Ê¤¿¤Ï%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£", m_name);
 #else
-msg_format("You are beaten by %s.", r_name+r_info[arena_monsters[p_ptr->arena_number]].name);
+                       msg_format("You are beaten by %s.", m_name);
 #endif
                        msg_print(NULL);
+                       if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, 99, m_name);
                }
                else
                {
@@ -4987,12 +5150,14 @@ msg_format("You are beaten by %s.", r_name+r_info[arena_monsters[p_ptr->arena_nu
 #endif
 
                        /* Note cause of death */
-                       (void)strcpy(died_from, hit_from);
-
-                       if (p_ptr->image) strcat(died_from,"(?)");
+#ifdef JP
+                       sprintf(p_ptr->died_from, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "ĦÁü¾õÂÖ¤Ç":"Ëãáã¾õÂÖ¤Ç", p_ptr->image ? "¸¸³Ð¤ËÏĤó¤À" : "", hit_from);
+#else
+                       sprintf(p_ptr->died_from, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
+#endif
 
                        /* No longer a winner */
-                       total_winner = FALSE;
+                       p_ptr->total_winner = FALSE;
 
                        if (p_ptr->inside_arena)
 #ifdef JP
@@ -5004,7 +5169,7 @@ msg_format("You are beaten by %s.", r_name+r_info[arena_monsters[p_ptr->arena_nu
 #ifdef JP
                                strcpy(buf,"ÃϾå");
 #else
-                               strcpy(buf,"on The surface");
+                               strcpy(buf,"on the surface");
 #endif
                        else if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT)))
 #ifdef JP
@@ -5019,9 +5184,9 @@ msg_format("You are beaten by %s.", r_name+r_info[arena_monsters[p_ptr->arena_nu
                                sprintf(buf,"level %d", dun_level);
 #endif
 #ifdef JP
-                       sprintf(tmp,"%s¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£",buf, died_from);
+                       sprintf(tmp,"%s¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£",buf, p_ptr->died_from);
 #else
-                       sprintf(tmp,"killed by %s %s.", died_from, buf);
+                       sprintf(tmp,"killed by %s %s.", p_ptr->died_from, buf);
 #endif
                        do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
 #ifdef JP
@@ -5034,9 +5199,9 @@ msg_format("You are beaten by %s.", r_name+r_info[arena_monsters[p_ptr->arena_nu
                        flush();
 
 #ifdef JP
-if (get_check("²èÌ̤òÊݸ¤·¤Þ¤¹¤«¡©"))
+if (get_check_strict("²èÌ̤òÊݸ¤·¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
 #else
-                       if (get_check("Dump the screen? "))
+                       if (get_check_strict("Dump the screen? ", CHECK_NO_HISTORY))
 #endif
 
                        {
@@ -5058,7 +5223,7 @@ msg_format("
                        }
                        else
                        {
-                               if (streq(died_from, "Seppuku"))
+                               if (streq(p_ptr->died_from, "Seppuku"))
                                {
 #ifdef JP
                                  get_rnd_line("seppuku_j.txt", 0, death_message);
@@ -5075,11 +5240,11 @@ get_rnd_line("death_j.txt", 0, death_message);
 #endif
                                }
 #ifdef JP
-                               if (!get_string(streq(died_from, "Seppuku") ? "¼­À¤¤Î¶ç: " : "ÃÇËöËâ¤Î¶«¤Ó: ", death_message, 1024))
+                               while (!get_string(streq(p_ptr->died_from, "Seppuku") ? "¼­À¤¤Î¶ç: " : "ÃÇËöËâ¤Î¶«¤Ó: ", death_message, 1024)) ;
 #else
-                               if (!get_string("Last word: ", death_message, 1024))
+                               while (!get_string("Last word: ", death_message, 1024)) ;
 #endif
-
+                               if (death_message[0] == '\0')
                                {
 #ifdef JP
                                        strcpy(death_message, format("¤¢¤Ê¤¿¤Ï%s¤Þ¤·¤¿¡£", android ? "²õ¤ì" : "»à¤Ë"));
@@ -5087,7 +5252,7 @@ get_rnd_line("death_j.txt", 0, death_message);
                                        strcpy(death_message, android ? "You are broken." : "You die.");
 #endif
                                }
-                               if (streq(died_from, "Seppuku"))
+                               if (streq(p_ptr->died_from, "Seppuku"))
                                {
 #ifdef JP
                                  int i, len;
@@ -5102,13 +5267,13 @@ get_rnd_line("death_j.txt", 0, death_message);
 
                                  /* ºù»¶¤ë */
                                  for (i = 0; i < 40; i++) 
-                                   Term_putstr(rand_int(w / 2) * 2, rand_int(h), 2, TERM_VIOLET, "¦Ô");
+                                   Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "¦Ô");
 
                                  str = death_message;
                                  if (strncmp(str, "¡Ö", 2) == 0) str += 2;
 
                                  str2 = strstr_j(str, "¡×");
-                                 if (str2 != NULL) str2 = '\0';
+                                 if (str2 != NULL) *str2 = '\0';
 
                                  i = 0;
                                  while (i < 9)
@@ -5127,7 +5292,17 @@ get_rnd_line("death_j.txt", 0, death_message);
                                    str = str2 + 1;
                                    if (*str == 0) break;
                                  }
+
+                                 /* Hide cursor */
+                                 Term_putstr(w-1, h-1, 1, TERM_WHITE, " ");
+
                                  flush();
+#ifdef WORLD_SCORE
+                                 /* Make screen dump */
+                                 screen_dump = make_screen_dump();
+#endif
+
+                                 /* Wait a key press */
                                  (void)inkey();
 #else
                                        msg_print(death_message);
@@ -5139,7 +5314,7 @@ get_rnd_line("death_j.txt", 0, death_message);
                }
 
                /* Dead */
-               return TRUE;
+               return damage;
        }
 
        /* Hitpoint warning */
@@ -5152,6 +5327,13 @@ get_rnd_line("death_j.txt", 0, death_message);
 
                if (record_danger && (old_chp > warning))
                {
+                       if (p_ptr->image && damage_type == DAMAGE_ATTACK)
+#ifdef JP
+                               hit_from = "²¿¤«";
+#else
+                               hit_from = "something";
+#endif
+
 #ifdef JP
                        sprintf(tmp,"%s¤Ë¤è¤Ã¤Æ¥Ô¥ó¥Á¤Ë´Ù¤¤¤Ã¤¿¡£",hit_from);
 #else
@@ -5180,10 +5362,10 @@ msg_print("*** 
        {
                p_ptr->wilderness_x = px;
                p_ptr->wilderness_y = py;
-               p_ptr->energy = 100;
+               p_ptr->energy_need = 0;
                change_wild_mode();
        }
-       return TRUE;
+       return damage;
 }
 
 
@@ -5192,7 +5374,7 @@ msg_print("*** 
  */
 void gain_exp(s32b amount)
 {
-       if (death) return;
+       if (p_ptr->is_dead) return;
 
        if (p_ptr->prace == RACE_ANDROID) return;
 
@@ -5215,7 +5397,7 @@ void calc_android_exp(void)
 {
        int i;
        u32b total_exp = 0;
-       if (death) return;
+       if (p_ptr->is_dead) return;
 
        if (p_ptr->prace != RACE_ANDROID) return;
 
@@ -5235,13 +5417,12 @@ void calc_android_exp(void)
 
                object_copy(q_ptr, o_ptr);
                q_ptr->discount = 0;
-               q_ptr->ident &= ~(IDENT_CURSED);
-               q_ptr->art_flags3 &= ~(TR3_CURSED | TR3_HEAVY_CURSE | TR3_PERMA_CURSE | TR3_TY_CURSE);
+               q_ptr->curse_flags = 0L;
 
                if (o_ptr->name1)
                {
                        level = (level + MAX(a_info[o_ptr->name1].level - 8, 5)) / 2;
-                       level += MIN(20, a_info[o_ptr->name1].rarity/(a_info[o_ptr->name1].flags3 & TR3_INSTA_ART ? 10 : 3));
+                       level += MIN(20, a_info[o_ptr->name1].rarity/(a_info[o_ptr->name1].gen_flags & TRG_INSTA_ART ? 10 : 3));
                }
                else if (o_ptr->name2) level += MAX(3, (e_info[o_ptr->name2].rating - 5)/2);
                value = object_value_real(q_ptr);
@@ -5307,7 +5488,7 @@ bool set_ultimate_res(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -5372,7 +5553,7 @@ bool set_tim_res_nether(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -5437,7 +5618,7 @@ bool set_tim_res_time(int v, bool do_dec)
        /* Hack -- Force good values */
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (death) return FALSE;
+       if (p_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
@@ -5558,15 +5739,15 @@ bool choose_ele_attack(void)
        choice = inkey();
 
        if ((choice == 'a') || (choice == 'A')) 
-               set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
-               set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
-               set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
-               set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
-               set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else
        {
 #ifdef JP