OSDN Git Service

[Refactor] #38997 take_hit() に player_type * 引数を追加.
[hengband/hengband.git] / src / player-status.c
index a714010..88ed64f 100644 (file)
@@ -1,6 +1,9 @@
 #include "angband.h"
+#include "core.h"
 #include "util.h"
 
+#include "bldg.h"
+#include "quest.h"
 #include "player-move.h"
 #include "player-status.h"
 #include "player-effects.h"
@@ -8,6 +11,7 @@
 #include "player-race.h"
 #include "player-class.h"
 #include "player-personality.h"
+#include "player-damage.h"
 #include "floor.h"
 #include "floor-events.h"
 #include "feature.h"
 #include "spells-status.h"
 #include "object.h"
 #include "object-hook.h"
+#include "object-ego.h"
 #include "monster.h"
 #include "monster-status.h"
 #include "monsterrace-hook.h"
 #include "mutation.h"
 #include "patron.h"
 #include "realm-hex.h"
+#include "realm-song.h"
 #include "cmd-pet.h"
 #include "cmd-spell.h"
 #include "dungeon.h"
 #include "monsterrace.h"
 #include "autopick.h"
 #include "cmd-dump.h"
+#include "melee.h"
+#include "world.h"
+#include "view-mainwindow.h"
+#include "files.h"
+#include "cmd-magiceat.h"
+
+/*!
+ * @brief 能力値テーブル / Abbreviations of healthy stats
+ */
+const concptr stat_names[6] =
+{
+#ifdef JP
+       "腕力 :", "知能 :", "賢さ :", "器用 :", "耐久 :", "魅力 :"
+#else
+       "STR : ", "INT : ", "WIS : ", "DEX : ", "CON : ", "CHR : "
+#endif
+
+};
+
+/*!
+ * @brief 能力値テーブル(能力低下時) / Abbreviations of damaged stats
+ */
+const concptr stat_names_reduced[6] =
+{
+#ifdef JP
+       "腕力x:", "知能x:", "賢さx:", "器用x:", "耐久x:", "魅力x:"
+#else
+       "Str : ", "Int : ", "Wis : ", "Dex : ", "Con : ", "Chr : "
+#endif
+
+};
+
+/* ELDRITCH_HORRORによるsanity blast処理に関するメッセージの最大数 / Number of entries in the sanity-blast descriptions */
+#define MAX_SAN_HORROR 20 /*!< 恐ろしい対象の形容数(正常時) */
+#define MAX_SAN_FUNNY 22  /*!< 恐ろしい対象の形容数(幻覚時) */
+#define MAX_SAN_COMMENT 5 /*!< 恐ろしい対象を見たときの絶叫メッセージ数(幻覚時) */
 
 /*!
  * @var horror_desc
@@ -294,6 +336,957 @@ const s32b player_exp_a[PY_MAX_LEVEL] =
 };
 
 
+/*!
+ * 知力/賢さによるレベル毎の習得可能魔法数テーブル
+ * Stat Table (INT/WIS) -- Number of half-spells per level
+ */
+const byte adj_mag_study[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       0       /* 5 */,
+       0       /* 6 */,
+       0       /* 7 */,
+       1       /* 8 */,
+       1       /* 9 */,
+       1       /* 10 */,
+       1       /* 11 */,
+       2       /* 12 */,
+       2       /* 13 */,
+       2       /* 14 */,
+       2       /* 15 */,
+       2       /* 16 */,
+       2       /* 17 */,
+       2       /* 18/00-18/09 */,
+       2       /* 18/10-18/19 */,
+       2       /* 18/20-18/29 */,
+       2       /* 18/30-18/39 */,
+       2       /* 18/40-18/49 */,
+       3       /* 18/50-18/59 */,
+       3       /* 18/60-18/69 */,
+       3       /* 18/70-18/79 */,
+       3       /* 18/80-18/89 */,
+       4       /* 18/90-18/99 */,
+       4       /* 18/100-18/109 */,
+       4       /* 18/110-18/119 */,
+       5       /* 18/120-18/129 */,
+       5       /* 18/130-18/139 */,
+       5       /* 18/140-18/149 */,
+       5       /* 18/150-18/159 */,
+       5       /* 18/160-18/169 */,
+       5       /* 18/170-18/179 */,
+       5       /* 18/180-18/189 */,
+       5       /* 18/190-18/199 */,
+       5       /* 18/200-18/209 */,
+       6       /* 18/210-18/219 */,
+       6       /* 18/220+ */
+};
+
+
+/*!
+ * 知力/賢さによるMP修正テーブル
+ * Stat Table (INT/WIS) -- extra 1/4-mana-points per level
+ */
+const byte adj_mag_mana[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       0       /* 5 */,
+       0       /* 6 */,
+       0       /* 7 */,
+       1       /* 8 */,
+       2       /* 9 */,
+       3       /* 10 */,
+       4       /* 11 */,
+       5       /* 12 */,
+       5       /* 13 */,
+       6       /* 14 */,
+       7       /* 15 */,
+       8       /* 16 */,
+       9       /* 17 */,
+       10      /* 18/00-18/09 */,
+       11      /* 18/10-18/19 */,
+       11      /* 18/20-18/29 */,
+       12      /* 18/30-18/39 */,
+       12      /* 18/40-18/49 */,
+       13      /* 18/50-18/59 */,
+       14      /* 18/60-18/69 */,
+       15      /* 18/70-18/79 */,
+       16      /* 18/80-18/89 */,
+       17      /* 18/90-18/99 */,
+       18      /* 18/100-18/109 */,
+       19      /* 18/110-18/119 */,
+       20      /* 18/120-18/129 */,
+       21      /* 18/130-18/139 */,
+       22      /* 18/140-18/149 */,
+       23      /* 18/150-18/159 */,
+       24      /* 18/160-18/169 */,
+       25      /* 18/170-18/179 */,
+       26      /* 18/180-18/189 */,
+       27      /* 18/190-18/199 */,
+       28      /* 18/200-18/209 */,
+       29      /* 18/210-18/219 */,
+       30      /* 18/220+ */
+};
+
+
+/*!
+ * 知力/賢さによる最低魔法失敗率テーブル
+ * Stat Table (INT/WIS) -- Minimum failure rate (percentage)
+ */
+const byte adj_mag_fail[] =
+{
+       99      /* 3 */,
+       99      /* 4 */,
+       99      /* 5 */,
+       99      /* 6 */,
+       99      /* 7 */,
+       50      /* 8 */,
+       30      /* 9 */,
+       20      /* 10 */,
+       15      /* 11 */,
+       12      /* 12 */,
+       11      /* 13 */,
+       10      /* 14 */,
+       9       /* 15 */,
+       8       /* 16 */,
+       7       /* 17 */,
+       6       /* 18/00-18/09 */,
+       6       /* 18/10-18/19 */,
+       5       /* 18/20-18/29 */,
+       5       /* 18/30-18/39 */,
+       5       /* 18/40-18/49 */,
+       4       /* 18/50-18/59 */,
+       4       /* 18/60-18/69 */,
+       4       /* 18/70-18/79 */,
+       4       /* 18/80-18/89 */,
+       3       /* 18/90-18/99 */,
+       3       /* 18/100-18/109 */,
+       2       /* 18/110-18/119 */,
+       2       /* 18/120-18/129 */,
+       2       /* 18/130-18/139 */,
+       2       /* 18/140-18/149 */,
+       1       /* 18/150-18/159 */,
+       1       /* 18/160-18/169 */,
+       1       /* 18/170-18/179 */,
+       1       /* 18/180-18/189 */,
+       1       /* 18/190-18/199 */,
+       0       /* 18/200-18/209 */,
+       0       /* 18/210-18/219 */,
+       0       /* 18/220+ */
+};
+
+
+/*!
+ * 知力/賢さによる魔法失敗率修正テーブル
+ * Stat Table (INT/WIS) -- Various things
+ */
+const byte adj_mag_stat[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       0       /* 5 */,
+       0       /* 6 */,
+       0       /* 7 */,
+       1       /* 8 */,
+       1       /* 9 */,
+       1       /* 10 */,
+       1       /* 11 */,
+       1       /* 12 */,
+       1       /* 13 */,
+       1       /* 14 */,
+       2       /* 15 */,
+       2       /* 16 */,
+       2       /* 17 */,
+       3       /* 18/00-18/09 */,
+       3       /* 18/10-18/19 */,
+       3       /* 18/20-18/29 */,
+       3       /* 18/30-18/39 */,
+       3       /* 18/40-18/49 */,
+       4       /* 18/50-18/59 */,
+       4       /* 18/60-18/69 */,
+       5       /* 18/70-18/79 */,
+       6       /* 18/80-18/89 */,
+       7       /* 18/90-18/99 */,
+       8       /* 18/100-18/109 */,
+       9       /* 18/110-18/119 */,
+       10      /* 18/120-18/129 */,
+       11      /* 18/130-18/139 */,
+       12      /* 18/140-18/149 */,
+       13      /* 18/150-18/159 */,
+       14      /* 18/160-18/169 */,
+       15      /* 18/170-18/179 */,
+       16      /* 18/180-18/189 */,
+       17      /* 18/190-18/199 */,
+       18      /* 18/200-18/209 */,
+       19      /* 18/210-18/219 */,
+       20      /* 18/220+ */
+};
+
+
+/*!
+ * 魅力による店での取引修正テーブル
+ * Stat Table (CHR) -- payment percentages
+ */
+const byte adj_chr_gold[] =
+{
+       130     /* 3 */,
+       125     /* 4 */,
+       122     /* 5 */,
+       120     /* 6 */,
+       118     /* 7 */,
+       116     /* 8 */,
+       114     /* 9 */,
+       112     /* 10 */,
+       110     /* 11 */,
+       108     /* 12 */,
+       106     /* 13 */,
+       104     /* 14 */,
+       103     /* 15 */,
+       102     /* 16 */,
+       101     /* 17 */,
+       100     /* 18/00-18/09 */,
+       99      /* 18/10-18/19 */,
+       98      /* 18/20-18/29 */,
+       97      /* 18/30-18/39 */,
+       96      /* 18/40-18/49 */,
+       95      /* 18/50-18/59 */,
+       94      /* 18/60-18/69 */,
+       93      /* 18/70-18/79 */,
+       92      /* 18/80-18/89 */,
+       91      /* 18/90-18/99 */,
+       90      /* 18/100-18/109 */,
+       89      /* 18/110-18/119 */,
+       88      /* 18/120-18/129 */,
+       87      /* 18/130-18/139 */,
+       86      /* 18/140-18/149 */,
+       85      /* 18/150-18/159 */,
+       84      /* 18/160-18/169 */,
+       83      /* 18/170-18/179 */,
+       82      /* 18/180-18/189 */,
+       81      /* 18/190-18/199 */,
+       80      /* 18/200-18/209 */,
+       79      /* 18/210-18/219 */,
+       78      /* 18/220+ */
+};
+
+
+/*!
+ * 知力による魔道具使用修正テーブル
+ * Stat Table (INT) -- Magic devices
+ */
+const byte adj_int_dev[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       0       /* 5 */,
+       0       /* 6 */,
+       0       /* 7 */,
+       1       /* 8 */,
+       1       /* 9 */,
+       1       /* 10 */,
+       1       /* 11 */,
+       1       /* 12 */,
+       1       /* 13 */,
+       1       /* 14 */,
+       2       /* 15 */,
+       2       /* 16 */,
+       2       /* 17 */,
+       3       /* 18/00-18/09 */,
+       3       /* 18/10-18/19 */,
+       4       /* 18/20-18/29 */,
+       4       /* 18/30-18/39 */,
+       5       /* 18/40-18/49 */,
+       5       /* 18/50-18/59 */,
+       6       /* 18/60-18/69 */,
+       6       /* 18/70-18/79 */,
+       7       /* 18/80-18/89 */,
+       7       /* 18/90-18/99 */,
+       8       /* 18/100-18/109 */,
+       9       /* 18/110-18/119 */,
+       10      /* 18/120-18/129 */,
+       11      /* 18/130-18/139 */,
+       12      /* 18/140-18/149 */,
+       13      /* 18/150-18/159 */,
+       14      /* 18/160-18/169 */,
+       15      /* 18/170-18/179 */,
+       16      /* 18/180-18/189 */,
+       17      /* 18/190-18/199 */,
+       18      /* 18/200-18/209 */,
+       19      /* 18/210-18/219 */,
+       20      /* 18/220+ */
+};
+
+
+/*!
+ * 賢さによる魔法防御修正テーブル
+ * Stat Table (WIS) -- Saving throw
+ */
+const byte adj_wis_sav[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       0       /* 5 */,
+       0       /* 6 */,
+       0       /* 7 */,
+       1       /* 8 */,
+       1       /* 9 */,
+       1       /* 10 */,
+       1       /* 11 */,
+       1       /* 12 */,
+       1       /* 13 */,
+       1       /* 14 */,
+       2       /* 15 */,
+       2       /* 16 */,
+       2       /* 17 */,
+       3       /* 18/00-18/09 */,
+       3       /* 18/10-18/19 */,
+       3       /* 18/20-18/29 */,
+       3       /* 18/30-18/39 */,
+       3       /* 18/40-18/49 */,
+       4       /* 18/50-18/59 */,
+       4       /* 18/60-18/69 */,
+       5       /* 18/70-18/79 */,
+       5       /* 18/80-18/89 */,
+       6       /* 18/90-18/99 */,
+       7       /* 18/100-18/109 */,
+       8       /* 18/110-18/119 */,
+       9       /* 18/120-18/129 */,
+       10      /* 18/130-18/139 */,
+       11      /* 18/140-18/149 */,
+       12      /* 18/150-18/159 */,
+       13      /* 18/160-18/169 */,
+       14      /* 18/170-18/179 */,
+       15      /* 18/180-18/189 */,
+       16      /* 18/190-18/199 */,
+       17      /* 18/200-18/209 */,
+       18      /* 18/210-18/219 */,
+       19      /* 18/220+ */
+};
+
+
+/*!
+ * 器用さによるトラップ解除修正テーブル
+ * Stat Table (DEX) -- disarming
+ */
+const byte adj_dex_dis[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       0       /* 5 */,
+       0       /* 6 */,
+       0       /* 7 */,
+       0       /* 8 */,
+       0       /* 9 */,
+       0       /* 10 */,
+       0       /* 11 */,
+       0       /* 12 */,
+       1       /* 13 */,
+       1       /* 14 */,
+       1       /* 15 */,
+       2       /* 16 */,
+       2       /* 17 */,
+       4       /* 18/00-18/09 */,
+       4       /* 18/10-18/19 */,
+       4       /* 18/20-18/29 */,
+       4       /* 18/30-18/39 */,
+       5       /* 18/40-18/49 */,
+       5       /* 18/50-18/59 */,
+       5       /* 18/60-18/69 */,
+       6       /* 18/70-18/79 */,
+       6       /* 18/80-18/89 */,
+       7       /* 18/90-18/99 */,
+       8       /* 18/100-18/109 */,
+       8       /* 18/110-18/119 */,
+       8       /* 18/120-18/129 */,
+       8       /* 18/130-18/139 */,
+       8       /* 18/140-18/149 */,
+       9       /* 18/150-18/159 */,
+       9       /* 18/160-18/169 */,
+       9       /* 18/170-18/179 */,
+       9       /* 18/180-18/189 */,
+       9       /* 18/190-18/199 */,
+       10      /* 18/200-18/209 */,
+       10      /* 18/210-18/219 */,
+       10      /* 18/220+ */
+};
+
+
+/*!
+ * 知力によるトラップ解除修正テーブル
+ * Stat Table (INT) -- disarming
+ */
+const byte adj_int_dis[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       0       /* 5 */,
+       0       /* 6 */,
+       0       /* 7 */,
+       1       /* 8 */,
+       1       /* 9 */,
+       1       /* 10 */,
+       1       /* 11 */,
+       1       /* 12 */,
+       1       /* 13 */,
+       1       /* 14 */,
+       2       /* 15 */,
+       2       /* 16 */,
+       2       /* 17 */,
+       3       /* 18/00-18/09 */,
+       3       /* 18/10-18/19 */,
+       3       /* 18/20-18/29 */,
+       4       /* 18/30-18/39 */,
+       4       /* 18/40-18/49 */,
+       5       /* 18/50-18/59 */,
+       6       /* 18/60-18/69 */,
+       7       /* 18/70-18/79 */,
+       8       /* 18/80-18/89 */,
+       9       /* 18/90-18/99 */,
+       10      /* 18/100-18/109 */,
+       10      /* 18/110-18/119 */,
+       11      /* 18/120-18/129 */,
+       12      /* 18/130-18/139 */,
+       13      /* 18/140-18/149 */,
+       14      /* 18/150-18/159 */,
+       15      /* 18/160-18/169 */,
+       16      /* 18/170-18/179 */,
+       17      /* 18/180-18/189 */,
+       18      /* 18/190-18/199 */,
+       19      /* 18/200-18/209 */,
+       19      /* 18/210-18/219 */,
+       20      /* 18/220+ */
+};
+
+
+/*!
+ * 器用さによるAC修正テーブル
+ * Stat Table (DEX) -- bonus to ac (plus 128)
+ */
+const byte adj_dex_ta[] =
+{
+       128 + -4    /*  3 */,
+       128 + -3    /*  4 */,
+       128 + -2    /*  5 */,
+       128 + -1    /*  6 */,
+       128 + 0     /*  7 */,
+       128 + 0     /*  8 */,
+       128 + 0     /*  9 */,
+       128 + 0     /* 10 */,
+       128 + 0     /* 11 */,
+       128 + 0     /* 12 */,
+       128 + 0     /* 13 */,
+       128 + 0     /* 14 */,
+       128 + 1     /* 15 */,
+       128 + 1     /* 16 */,
+       128 + 1     /* 17 */,
+       128 + 2     /* 18/00-18/09 */,
+       128 + 2     /* 18/10-18/19 */,
+       128 + 2     /* 18/20-18/29 */,
+       128 + 2     /* 18/30-18/39 */,
+       128 + 2     /* 18/40-18/49 */,
+       128 + 3     /* 18/50-18/59 */,
+       128 + 3     /* 18/60-18/69 */,
+       128 + 3     /* 18/70-18/79 */,
+       128 + 4     /* 18/80-18/89 */,
+       128 + 5     /* 18/90-18/99 */,
+       128 + 6     /* 18/100-18/109 */,
+       128 + 7     /* 18/110-18/119 */,
+       128 + 8     /* 18/120-18/129 */,
+       128 + 9     /* 18/130-18/139 */,
+       128 + 9     /* 18/140-18/149 */,
+       128 + 10    /* 18/150-18/159 */,
+       128 + 11    /* 18/160-18/169 */,
+       128 + 12    /* 18/170-18/179 */,
+       128 + 13    /* 18/180-18/189 */,
+       128 + 14    /* 18/190-18/199 */,
+       128 + 15    /* 18/200-18/209 */,
+       128 + 15    /* 18/210-18/219 */,
+       128 + 16    /* 18/220+ */
+};
+
+
+/*!
+ * 腕力によるダメージ修正テーブル
+ * Stat Table (STR) -- bonus to dam (plus 128)
+ */
+const byte adj_str_td[] =
+{
+       128 + -2    /*  3 */,
+       128 + -2    /*  4 */,
+       128 + -1    /*  5 */,
+       128 + -1    /*  6 */,
+       128 + 0     /*  7 */,
+       128 + 0     /*  8 */,
+       128 + 0     /*  9 */,
+       128 + 0     /* 10 */,
+       128 + 0     /* 11 */,
+       128 + 0     /* 12 */,
+       128 + 0     /* 13 */,
+       128 + 0     /* 14 */,
+       128 + 0     /* 15 */,
+       128 + 1     /* 16 */,
+       128 + 2     /* 17 */,
+       128 + 2     /* 18/00-18/09 */,
+       128 + 2     /* 18/10-18/19 */,
+       128 + 3     /* 18/20-18/29 */,
+       128 + 3     /* 18/30-18/39 */,
+       128 + 3     /* 18/40-18/49 */,
+       128 + 3     /* 18/50-18/59 */,
+       128 + 3     /* 18/60-18/69 */,
+       128 + 4     /* 18/70-18/79 */,
+       128 + 5     /* 18/80-18/89 */,
+       128 + 5     /* 18/90-18/99 */,
+       128 + 6     /* 18/100-18/109 */,
+       128 + 7     /* 18/110-18/119 */,
+       128 + 8     /* 18/120-18/129 */,
+       128 + 9     /* 18/130-18/139 */,
+       128 + 10    /* 18/140-18/149 */,
+       128 + 11    /* 18/150-18/159 */,
+       128 + 12    /* 18/160-18/169 */,
+       128 + 13    /* 18/170-18/179 */,
+       128 + 14    /* 18/180-18/189 */,
+       128 + 15    /* 18/190-18/199 */,
+       128 + 16    /* 18/200-18/209 */,
+       128 + 18    /* 18/210-18/219 */,
+       128 + 20    /* 18/220+ */
+};
+
+
+/*!
+ * 器用度による命中修正テーブル
+ * Stat Table (DEX) -- bonus to hit (plus 128)
+ */
+const byte adj_dex_th[] =
+{
+       128 + -3        /* 3 */,
+       128 + -2        /* 4 */,
+       128 + -2        /* 5 */,
+       128 + -1        /* 6 */,
+       128 + -1        /* 7 */,
+       128 + 0 /* 8 */,
+       128 + 0 /* 9 */,
+       128 + 0 /* 10 */,
+       128 + 0 /* 11 */,
+       128 + 0 /* 12 */,
+       128 + 0 /* 13 */,
+       128 + 0 /* 14 */,
+       128 + 0 /* 15 */,
+       128 + 1 /* 16 */,
+       128 + 2 /* 17 */,
+       128 + 3 /* 18/00-18/09 */,
+       128 + 3 /* 18/10-18/19 */,
+       128 + 3 /* 18/20-18/29 */,
+       128 + 3 /* 18/30-18/39 */,
+       128 + 3 /* 18/40-18/49 */,
+       128 + 4 /* 18/50-18/59 */,
+       128 + 4 /* 18/60-18/69 */,
+       128 + 4 /* 18/70-18/79 */,
+       128 + 4 /* 18/80-18/89 */,
+       128 + 5 /* 18/90-18/99 */,
+       128 + 6 /* 18/100-18/109 */,
+       128 + 7 /* 18/110-18/119 */,
+       128 + 8 /* 18/120-18/129 */,
+       128 + 9 /* 18/130-18/139 */,
+       128 + 9 /* 18/140-18/149 */,
+       128 + 10        /* 18/150-18/159 */,
+       128 + 11        /* 18/160-18/169 */,
+       128 + 12        /* 18/170-18/179 */,
+       128 + 13        /* 18/180-18/189 */,
+       128 + 14        /* 18/190-18/199 */,
+       128 + 15        /* 18/200-18/209 */,
+       128 + 15        /* 18/210-18/219 */,
+       128 + 16        /* 18/220+ */
+};
+
+
+/*!
+ * 腕力による命中修正テーブル
+ * Stat Table (STR) -- bonus to hit (plus 128)
+ */
+const byte adj_str_th[] =
+{
+       128 + -3        /* 3 */,
+       128 + -2        /* 4 */,
+       128 + -1        /* 5 */,
+       128 + -1        /* 6 */,
+       128 + 0 /* 7 */,
+       128 + 0 /* 8 */,
+       128 + 0 /* 9 */,
+       128 + 0 /* 10 */,
+       128 + 0 /* 11 */,
+       128 + 0 /* 12 */,
+       128 + 0 /* 13 */,
+       128 + 0 /* 14 */,
+       128 + 0 /* 15 */,
+       128 + 0 /* 16 */,
+       128 + 0 /* 17 */,
+       128 + 1 /* 18/00-18/09 */,
+       128 + 1 /* 18/10-18/19 */,
+       128 + 1 /* 18/20-18/29 */,
+       128 + 1 /* 18/30-18/39 */,
+       128 + 1 /* 18/40-18/49 */,
+       128 + 1 /* 18/50-18/59 */,
+       128 + 1 /* 18/60-18/69 */,
+       128 + 2 /* 18/70-18/79 */,
+       128 + 3 /* 18/80-18/89 */,
+       128 + 4 /* 18/90-18/99 */,
+       128 + 5 /* 18/100-18/109 */,
+       128 + 6 /* 18/110-18/119 */,
+       128 + 7 /* 18/120-18/129 */,
+       128 + 8 /* 18/130-18/139 */,
+       128 + 9 /* 18/140-18/149 */,
+       128 + 10        /* 18/150-18/159 */,
+       128 + 11        /* 18/160-18/169 */,
+       128 + 12        /* 18/170-18/179 */,
+       128 + 13        /* 18/180-18/189 */,
+       128 + 14        /* 18/190-18/199 */,
+       128 + 15        /* 18/200-18/209 */,
+       128 + 15        /* 18/210-18/219 */,
+       128 + 16        /* 18/220+ */
+};
+
+
+/*!
+ * 腕力による基本所持重量値テーブル
+ * Stat Table (STR) -- weight limit in deca-pounds
+ */
+const byte adj_str_wgt[] =
+{
+       10      /* 3 */,
+       11      /* 4 */,
+       12      /* 5 */,
+       13      /* 6 */,
+       14      /* 7 */,
+       15      /* 8 */,
+       16      /* 9 */,
+       17      /* 10 */,
+       18      /* 11 */,
+       19      /* 12 */,
+       20      /* 13 */,
+       21      /* 14 */,
+       22      /* 15 */,
+       23      /* 16 */,
+       24      /* 17 */,
+       25      /* 18/00-18/09 */,
+       26      /* 18/10-18/19 */,
+       27      /* 18/20-18/29 */,
+       28      /* 18/30-18/39 */,
+       29      /* 18/40-18/49 */,
+       30      /* 18/50-18/59 */,
+       31      /* 18/60-18/69 */,
+       31      /* 18/70-18/79 */,
+       32      /* 18/80-18/89 */,
+       32      /* 18/90-18/99 */,
+       33      /* 18/100-18/109 */,
+       33      /* 18/110-18/119 */,
+       34      /* 18/120-18/129 */,
+       34      /* 18/130-18/139 */,
+       35      /* 18/140-18/149 */,
+       35      /* 18/150-18/159 */,
+       36      /* 18/160-18/169 */,
+       36      /* 18/170-18/179 */,
+       37      /* 18/180-18/189 */,
+       37      /* 18/190-18/199 */,
+       38      /* 18/200-18/209 */,
+       38      /* 18/210-18/219 */,
+       39      /* 18/220+ */
+};
+
+
+/*!
+ * 腕力による武器重量限界値テーブル
+ * Stat Table (STR) -- weapon weight limit in pounds
+ */
+const byte adj_str_hold[] =
+{
+       4       /* 3 */,
+       5       /* 4 */,
+       6       /* 5 */,
+       7       /* 6 */,
+       8       /* 7 */,
+       9       /* 8 */,
+       10      /* 9 */,
+       11      /* 10 */,
+       12      /* 11 */,
+       13      /* 12 */,
+       14      /* 13 */,
+       15      /* 14 */,
+       16      /* 15 */,
+       17      /* 16 */,
+       18      /* 17 */,
+       19      /* 18/00-18/09 */,
+       20      /* 18/10-18/19 */,
+       21      /* 18/20-18/29 */,
+       22      /* 18/30-18/39 */,
+       23      /* 18/40-18/49 */,
+       24      /* 18/50-18/59 */,
+       25      /* 18/60-18/69 */,
+       26      /* 18/70-18/79 */,
+       27      /* 18/80-18/89 */,
+       28      /* 18/90-18/99 */,
+       30      /* 18/100-18/109 */,
+       31      /* 18/110-18/119 */,
+       32      /* 18/120-18/129 */,
+       33      /* 18/130-18/139 */,
+       34      /* 18/140-18/149 */,
+       35      /* 18/150-18/159 */,
+       37      /* 18/160-18/169 */,
+       40      /* 18/170-18/179 */,
+       44      /* 18/180-18/189 */,
+       48      /* 18/190-18/199 */,
+       50     /* 18/200-18/209 */,
+       50     /* 18/210-18/219 */,
+       50     /* 18/220+ */
+};
+
+
+/*!
+ * 腕力による採掘能力修正値テーブル
+ * Stat Table (STR) -- digging value
+ */
+const byte adj_str_dig[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       1       /* 5 */,
+       2       /* 6 */,
+       3       /* 7 */,
+       4       /* 8 */,
+       4       /* 9 */,
+       5       /* 10 */,
+       5       /* 11 */,
+       6       /* 12 */,
+       6       /* 13 */,
+       7       /* 14 */,
+       7       /* 15 */,
+       8       /* 16 */,
+       8       /* 17 */,
+       9       /* 18/00-18/09 */,
+       10      /* 18/10-18/19 */,
+       12      /* 18/20-18/29 */,
+       15      /* 18/30-18/39 */,
+       20      /* 18/40-18/49 */,
+       25      /* 18/50-18/59 */,
+       30      /* 18/60-18/69 */,
+       35      /* 18/70-18/79 */,
+       40      /* 18/80-18/89 */,
+       45      /* 18/90-18/99 */,
+       50      /* 18/100-18/109 */,
+       55      /* 18/110-18/119 */,
+       60      /* 18/120-18/129 */,
+       65      /* 18/130-18/139 */,
+       70      /* 18/140-18/149 */,
+       75      /* 18/150-18/159 */,
+       80      /* 18/160-18/169 */,
+       85      /* 18/170-18/179 */,
+       90      /* 18/180-18/189 */,
+       95      /* 18/190-18/199 */,
+       100     /* 18/200-18/209 */,
+       100     /* 18/210-18/219 */,
+       100     /* 18/220+ */
+};
+
+/*!
+ * 器用さによる盗難防止&体当たり成功判定修正テーブル
+ * Stat Table (DEX) -- chance of avoiding "theft" and "falling"
+ */
+const byte adj_dex_safe[] =
+{
+       0       /* 3 */,
+       1       /* 4 */,
+       2       /* 5 */,
+       3       /* 6 */,
+       4       /* 7 */,
+       5       /* 8 */,
+       5       /* 9 */,
+       6       /* 10 */,
+       6       /* 11 */,
+       7       /* 12 */,
+       7       /* 13 */,
+       8       /* 14 */,
+       8       /* 15 */,
+       9       /* 16 */,
+       9       /* 17 */,
+       10      /* 18/00-18/09 */,
+       10      /* 18/10-18/19 */,
+       15      /* 18/20-18/29 */,
+       15      /* 18/30-18/39 */,
+       20      /* 18/40-18/49 */,
+       25      /* 18/50-18/59 */,
+       30      /* 18/60-18/69 */,
+       35      /* 18/70-18/79 */,
+       40      /* 18/80-18/89 */,
+       45      /* 18/90-18/99 */,
+       50      /* 18/100-18/109 */,
+       60      /* 18/110-18/119 */,
+       70      /* 18/120-18/129 */,
+       80      /* 18/130-18/139 */,
+       90      /* 18/140-18/149 */,
+       100     /* 18/150-18/159 */,
+       100     /* 18/160-18/169 */,
+       100     /* 18/170-18/179 */,
+       100     /* 18/180-18/189 */,
+       100     /* 18/190-18/199 */,
+       100     /* 18/200-18/209 */,
+       100     /* 18/210-18/219 */,
+       100     /* 18/220+ */
+};
+
+
+/*!
+ * 耐久による基本HP自然治癒値テーブル /
+ * Stat Table (CON) -- base regeneration rate
+ */
+const byte adj_con_fix[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       0       /* 5 */,
+       0       /* 6 */,
+       0       /* 7 */,
+       0       /* 8 */,
+       0       /* 9 */,
+       0       /* 10 */,
+       0       /* 11 */,
+       0       /* 12 */,
+       0       /* 13 */,
+       1       /* 14 */,
+       1       /* 15 */,
+       1       /* 16 */,
+       1       /* 17 */,
+       2       /* 18/00-18/09 */,
+       2       /* 18/10-18/19 */,
+       2       /* 18/20-18/29 */,
+       2       /* 18/30-18/39 */,
+       2       /* 18/40-18/49 */,
+       3       /* 18/50-18/59 */,
+       3       /* 18/60-18/69 */,
+       3       /* 18/70-18/79 */,
+       3       /* 18/80-18/89 */,
+       3       /* 18/90-18/99 */,
+       4       /* 18/100-18/109 */,
+       4       /* 18/110-18/119 */,
+       5       /* 18/120-18/129 */,
+       6       /* 18/130-18/139 */,
+       6       /* 18/140-18/149 */,
+       7       /* 18/150-18/159 */,
+       7       /* 18/160-18/169 */,
+       8       /* 18/170-18/179 */,
+       8       /* 18/180-18/189 */,
+       8       /* 18/190-18/199 */,
+       9       /* 18/200-18/209 */,
+       9       /* 18/210-18/219 */,
+       9       /* 18/220+ */
+};
+
+
+/*!
+ * 耐久による基本HP自然治癒値テーブル /
+ * Stat Table (CON) -- extra 1/4-hitpoints per level (plus 128)
+ */
+const byte adj_con_mhp[] =
+{
+       128 + -8        /* 3 */,
+       128 + -6        /* 4 */,
+       128 + -4        /* 5 */,
+       128 + -2        /* 6 */,
+       128 + -1 /* 7 */,
+       128 + 0 /* 8 */,
+       128 + 0 /* 9 */,
+       128 + 0 /* 10 */,
+       128 + 0 /* 11 */,
+       128 + 0 /* 12 */,
+       128 + 0 /* 13 */,
+       128 + 1 /* 14 */,
+       128 + 1 /* 15 */,
+       128 + 2 /* 16 */,
+       128 + 3 /* 17 */,
+       128 + 4 /* 18/00-18/09 */,
+       128 + 5 /* 18/10-18/19 */,
+       128 + 6 /* 18/20-18/29 */,
+       128 + 7 /* 18/30-18/39 */,
+       128 + 8 /* 18/40-18/49 */,
+       128 + 9 /* 18/50-18/59 */,
+       128 + 10  /* 18/60-18/69 */,
+       128 + 11 /* 18/70-18/79 */,
+       128 + 12 /* 18/80-18/89 */,
+       128 + 14 /* 18/90-18/99 */,
+       128 + 17         /* 18/100-18/109 */,
+       128 + 20        /* 18/110-18/119 */,
+       128 + 23        /* 18/120-18/129 */,
+       128 + 26        /* 18/130-18/139 */,
+       128 + 29        /* 18/140-18/149 */,
+       128 + 32        /* 18/150-18/159 */,
+       128 + 35        /* 18/160-18/169 */,
+       128 + 38        /* 18/170-18/179 */,
+       128 + 40        /* 18/180-18/189 */,
+       128 + 42        /* 18/190-18/199 */,
+       128 + 44        /* 18/200-18/209 */,
+       128 + 46        /* 18/210-18/219 */,
+       128 + 48        /* 18/220+ */
+};
+
+
+/*!
+ * 魅力による魅了能力修正テーブル /
+ * Stat Table (CHR) -- charm
+ */
+const byte adj_chr_chm[] =
+{
+       0       /* 3 */,
+       0       /* 4 */,
+       1       /* 5 */,
+       2       /* 6 */,
+       3       /* 7 */,
+       4       /* 8 */,
+       4       /* 9 */,
+       5       /* 10 */,
+       5       /* 11 */,
+       6       /* 12 */,
+       6       /* 13 */,
+       7       /* 14 */,
+       7       /* 15 */,
+       8       /* 16 */,
+       8       /* 17 */,
+       9       /* 18/00-18/09 */,
+       10      /* 18/10-18/19 */,
+       12      /* 18/20-18/29 */,
+       15      /* 18/30-18/39 */,
+       18      /* 18/40-18/49 */,
+       21      /* 18/50-18/59 */,
+       24      /* 18/60-18/69 */,
+       28      /* 18/70-18/79 */,
+       32      /* 18/80-18/89 */,
+       36      /* 18/90-18/99 */,
+       39      /* 18/100-18/109 */,
+       42      /* 18/110-18/119 */,
+       45      /* 18/120-18/129 */,
+       49      /* 18/130-18/139 */,
+       53      /* 18/140-18/149 */,
+       57      /* 18/150-18/159 */,
+       61      /* 18/160-18/169 */,
+       65      /* 18/170-18/179 */,
+       69      /* 18/180-18/189 */,
+       73      /* 18/190-18/199 */,
+       77      /* 18/200-18/209 */,
+       81      /* 18/210-18/219 */,
+       85      /* 18/220+ */
+};
+
+
+/*** Player information ***/
+
+/*
+ * Static player info record
+ */
+player_type p_body;
+
+/*
+ * Pointer to the player info
+ */
+player_type *p_ptr = &p_body;
+
 /*
  * Return alignment title
  */
@@ -622,7 +1615,7 @@ void calc_bonuses(void)
        {
                if (!(empty_hands_status & EMPTY_HAND_RARM))
                {
-                       set_action(ACTION_NONE);
+                       set_action(p_ptr, ACTION_NONE);
                }
        }
 
@@ -650,8 +1643,8 @@ void calc_bonuses(void)
                /* Unencumbered Monks become faster every 10 levels */
                if (!(heavy_armor()))
                {
-                       if (!(prace_is_(RACE_KLACKON) ||
-                               prace_is_(RACE_SPRITE) ||
+                       if (!(PRACE_IS_(p_ptr, RACE_KLACKON) ||
+                               PRACE_IS_(p_ptr, RACE_SPRITE) ||
                                (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
                                new_speed += (p_ptr->lev) / 10;
 
@@ -702,8 +1695,8 @@ void calc_bonuses(void)
                        (!p_ptr->inventory_list[INVEN_LARM].k_idx || p_ptr->hidarite))
                {
                        new_speed += 3;
-                       if (!(prace_is_(RACE_KLACKON) ||
-                               prace_is_(RACE_SPRITE) ||
+                       if (!(PRACE_IS_(p_ptr, RACE_KLACKON) ||
+                               PRACE_IS_(p_ptr, RACE_SPRITE) ||
                                (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
                                new_speed += (p_ptr->lev) / 10;
                        p_ptr->skill_stl += (p_ptr->lev) / 10;
@@ -1667,7 +2660,7 @@ void calc_bonuses(void)
        if (p_ptr->sh_fire) p_ptr->lite = TRUE;
 
        /* Golems also get an intrinsic AC bonus */
-       if (prace_is_(RACE_GOLEM) || prace_is_(RACE_ANDROID))
+       if (PRACE_IS_(p_ptr, RACE_GOLEM) || PRACE_IS_(p_ptr, RACE_ANDROID))
        {
                p_ptr->to_a += 10 + (p_ptr->lev * 2 / 5);
                p_ptr->dis_to_a += 10 + (p_ptr->lev * 2 / 5);
@@ -2710,7 +3703,7 @@ void calc_bonuses(void)
        p_ptr->skill_tht += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
 
 
-       if ((prace_is_(RACE_S_FAIRY)) && (p_ptr->pseikaku != SEIKAKU_SEXY) && (p_ptr->cursed & TRC_AGGRAVATE))
+       if ((PRACE_IS_(p_ptr, RACE_S_FAIRY)) && (p_ptr->pseikaku != SEIKAKU_SEXY) && (p_ptr->cursed & TRC_AGGRAVATE))
        {
                p_ptr->cursed &= ~(TRC_AGGRAVATE);
                p_ptr->skill_stl = MIN(p_ptr->skill_stl - 3, (p_ptr->skill_stl + 2) / 2);
@@ -2739,7 +3732,7 @@ void calc_bonuses(void)
 
 
        /* Hack -- handle "xtra" mode */
-       if (character_xtra) return;
+       if (current_world_ptr->character_xtra) return;
 
        /* Take note when "heavy bow" changes */
        if (p_ptr->old_heavy_shoot != p_ptr->heavy_shoot)
@@ -2812,9 +3805,9 @@ void calc_bonuses(void)
                        if (p_ptr->icky_wield[i])
                        {
                                msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
-                               if (is_loading_now)
+                               if (current_world_ptr->is_loading_now)
                                {
-                                       chg_virtue(V_FAITH, -1);
+                                       chg_virtue(p_ptr, V_FAITH, -1);
                                }
                        }
                        else if (has_melee_weapon(INVEN_RARM + i))
@@ -2858,9 +3851,9 @@ void calc_bonuses(void)
                if (heavy_armor())
                {
                        msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
-                       if (is_loading_now)
+                       if (current_world_ptr->is_loading_now)
                        {
-                               chg_virtue(V_HARMONY, -1);
+                               chg_virtue(p_ptr, V_HARMONY, -1);
                        }
                }
                else
@@ -3082,7 +4075,7 @@ static void calc_hitpoints(void)
 
 #ifdef JP
                /* レベルアップの時は上昇量を表示する */
-               if ((level_up == 1) && (mhp > p_ptr->mhp))
+               if (p_ptr->level_up_message && (mhp > p_ptr->mhp))
                {
                        msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - p_ptr->mhp));
                }
@@ -3145,7 +4138,6 @@ static void calc_torch(void)
        }
 
        /* max radius is 14 (was 5) without rewriting other code -- */
-       /* see current_floor_ptr->grid_array.c:update_lite() and defines.h:LITE_MAX */
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
                p_ptr->cur_lite = 1;
 
@@ -3170,7 +4162,7 @@ static void calc_torch(void)
                p_ptr->old_lite = p_ptr->cur_lite;
 
                if ((p_ptr->cur_lite > 0) && (p_ptr->special_defense & NINJA_S_STEALTH))
-                       set_superstealth(FALSE);
+                       set_superstealth(p_ptr, FALSE);
        }
 }
 
@@ -3199,10 +4191,10 @@ static void calc_spells(void)
        if (!mp_ptr->spell_book) return;
 
        /* Hack -- wait for creation */
-       if (!character_generated) return;
+       if (!current_world_ptr->character_generated) return;
 
        /* Hack -- handle "xtra" mode */
-       if (character_xtra) return;
+       if (current_world_ptr->character_xtra) return;
 
        if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
        {
@@ -3783,7 +4775,7 @@ static void calc_mana(void)
 
 #ifdef JP
                /* レベルアップの時は上昇量を表示する */
-               if ((level_up == 1) && (msp > p_ptr->msp))
+               if (p_ptr->level_up_message && (msp > p_ptr->msp))
                {
                        msg_format("最大マジック・ポイントが %d 増加した!", (msp - p_ptr->msp));
                }
@@ -3798,7 +4790,7 @@ static void calc_mana(void)
 
 
        /* Hack -- handle "xtra" mode */
-       if (character_xtra) return;
+       if (current_world_ptr->character_xtra) return;
 
        /* Take note when "glove state" changes */
        if (p_ptr->old_cumber_glove != p_ptr->cumber_glove)
@@ -4044,10 +5036,10 @@ void update_creature(player_type *creature_ptr)
        }
 
        /* Character is not ready yet, no screen updates */
-       if (!character_generated) return;
+       if (!current_world_ptr->character_generated) return;
 
        /* Character is in "icky" mode, no screen updates */
-       if (character_icky) return;
+       if (current_world_ptr->character_icky) return;
 
        if (creature_ptr->update & (PU_UN_LITE))
        {
@@ -4185,7 +5177,7 @@ void wreck_the_pattern(void)
        msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
        msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
 
-       if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
+       if (!IS_INVULN()) take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
        to_ruin = randint1(45) + 35;
 
        while (to_ruin--)
@@ -4213,7 +5205,7 @@ void sanity_blast(monster_type *m_ptr, bool necro)
 {
        int power = 100;
 
-       if (p_ptr->inside_battle || !character_dungeon) return;
+       if (p_ptr->phase_out || !current_world_ptr->character_dungeon) return;
 
        if (!necro && m_ptr)
        {
@@ -4231,7 +5223,7 @@ void sanity_blast(monster_type *m_ptr, bool necro)
                }
                else power *= 2;
 
-               if (!is_loading_now)
+               if (!current_world_ptr->is_loading_now)
                        return; /* No effect yet, just loaded... */
 
                if (!m_ptr->ml)
@@ -4272,12 +5264,12 @@ void sanity_blast(monster_type *m_ptr, bool necro)
                r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
 
                /* Demon characters are unaffected */
-               if (prace_is_(RACE_IMP) || prace_is_(RACE_DEMON) || (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) return;
+               if (PRACE_IS_(p_ptr, RACE_IMP) || PRACE_IS_(p_ptr, RACE_DEMON) || (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) return;
                if (p_ptr->wizard) return;
 
                /* Undead characters are 50% likely to be unaffected */
-               if (prace_is_(RACE_SKELETON) || prace_is_(RACE_ZOMBIE)
-                       || prace_is_(RACE_VAMPIRE) || prace_is_(RACE_SPECTRE) ||
+               if (PRACE_IS_(p_ptr, RACE_SKELETON) || PRACE_IS_(p_ptr, RACE_ZOMBIE)
+                       || PRACE_IS_(p_ptr, RACE_VAMPIRE) || PRACE_IS_(p_ptr, RACE_SPECTRE) ||
                        (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD))
                {
                        if (saving_throw(25 + p_ptr->lev)) return;
@@ -4382,11 +5374,11 @@ void sanity_blast(monster_type *m_ptr, bool necro)
        }
 
        do {
-               (void)do_dec_stat(A_INT);
+               (void)do_dec_stat(p_ptr, A_INT);
        } while (randint0(100) > p_ptr->skill_sav && one_in_(2));
 
        do {
-               (void)do_dec_stat(A_WIS);
+               (void)do_dec_stat(p_ptr, A_WIS);
        } while (randint0(100) > p_ptr->skill_sav && one_in_(2));
 
        switch (randint1(21))
@@ -4455,15 +5447,15 @@ void sanity_blast(monster_type *m_ptr, bool necro)
                /* Brain smash */
                if (!p_ptr->resist_conf)
                {
-                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
+                       (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4);
                }
                if (!p_ptr->free_act)
                {
-                       (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
+                       (void)set_paralyzed(p_ptr, p_ptr->paralyzed + randint0(4) + 4);
                }
                if (!p_ptr->resist_chaos)
                {
-                       (void)set_image(p_ptr->image + randint0(250) + 150);
+                       (void)set_image(p_ptr, p_ptr->image + randint0(250) + 150);
                }
                break;
        case 17:
@@ -4472,7 +5464,7 @@ void sanity_blast(monster_type *m_ptr, bool necro)
        case 20:
        case 21:
                /* Amnesia */
-               if (lose_all_info())
+               if (lose_all_info(p_ptr))
                        msg_print(_("あまりの恐怖に全てのことを忘れてしまった!", "You forget everything in your utmost terror!"));
                break;
        }
@@ -4564,10 +5556,10 @@ void check_experience(void)
                p_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
 
                /* HPとMPの上昇量を表示 */
-               level_up = 1;
+               p_ptr->level_up_message = TRUE;
                handle_stuff();
 
-               level_up = 0;
+               p_ptr->level_up_message = FALSE;
 
                if (level_inc_stat)
                {
@@ -4606,11 +5598,11 @@ void check_experience(void)
                                                        prt("", n + 2, 14);
                                        if (get_check(_("よろしいですか?", "Are you sure? "))) break;
                                }
-                               do_inc_stat(choice - 'a');
+                               do_inc_stat(p_ptr, choice - 'a');
                                screen_load();
                        }
                        else if (!(p_ptr->max_plv % 2))
-                               do_inc_stat(randint0(6));
+                               do_inc_stat(p_ptr, randint0(6));
                }
 
                if (level_mutation)
@@ -4626,7 +5618,7 @@ void check_experience(void)
                 */
                if (level_reward)
                {
-                       gain_level_reward(0);
+                       gain_level_reward(p_ptr, 0);
                        level_reward = FALSE;
                }
 
@@ -4791,3 +5783,106 @@ long calc_score(void)
        return point;
 }
 
+
+void cheat_death(player_type *creature_ptr)
+{
+       /* Mark social class, reset age, if needed */
+       if (creature_ptr->sc) creature_ptr->sc = creature_ptr->age = 0;
+
+       /* Increase age */
+       creature_ptr->age++;
+
+       /* Mark savefile */
+       creature_ptr->noscore |= 0x0001;
+
+       msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
+       msg_print(NULL);
+
+       (void)life_stream(FALSE, FALSE);
+
+       if (creature_ptr->pclass == CLASS_MAGIC_EATER)
+       {
+               int magic_idx;
+               for (magic_idx = 0; magic_idx < EATER_EXT * 2; magic_idx++)
+               {
+                       creature_ptr->magic_num1[magic_idx] = creature_ptr->magic_num2[magic_idx] * EATER_CHARGE;
+               }
+               for (; magic_idx < EATER_EXT * 3; magic_idx++)
+               {
+                       creature_ptr->magic_num1[magic_idx] = 0;
+               }
+       }
+
+       /* Restore spell points */
+       creature_ptr->csp = creature_ptr->msp;
+       creature_ptr->csp_frac = 0;
+
+       /* Hack -- cancel recall */
+       if (creature_ptr->word_recall)
+       {
+               msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
+               msg_print(NULL);
+
+               /* Hack -- Prevent recall */
+               creature_ptr->word_recall = 0;
+               creature_ptr->redraw |= (PR_STATUS);
+       }
+
+       /* Hack -- cancel alter */
+       if (creature_ptr->alter_reality)
+       {
+               /* Hack -- Prevent alter */
+               creature_ptr->alter_reality = 0;
+               creature_ptr->redraw |= (PR_STATUS);
+       }
+
+       /* Note cause of death */
+       (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
+
+       /* Do not die */
+       creature_ptr->is_dead = FALSE;
+
+       /* Hack -- Prevent starvation */
+       (void)set_food(p_ptr, PY_FOOD_MAX - 1);
+
+       current_floor_ptr->dun_level = 0;
+       creature_ptr->inside_arena = FALSE;
+       creature_ptr->phase_out = FALSE;
+       leaving_quest = 0;
+       creature_ptr->inside_quest = 0;
+       if (p_ptr->dungeon_idx) creature_ptr->recall_dungeon = p_ptr->dungeon_idx;
+       p_ptr->dungeon_idx = 0;
+       if (lite_town || vanilla_town)
+       {
+               creature_ptr->wilderness_y = 1;
+               creature_ptr->wilderness_x = 1;
+               if (vanilla_town)
+               {
+                       creature_ptr->oldpy = 10;
+                       creature_ptr->oldpx = 34;
+               }
+               else
+               {
+                       creature_ptr->oldpy = 33;
+                       creature_ptr->oldpx = 131;
+               }
+       }
+       else
+       {
+               creature_ptr->wilderness_y = 48;
+               creature_ptr->wilderness_x = 5;
+               creature_ptr->oldpy = 33;
+               creature_ptr->oldpx = 131;
+       }
+       creature_ptr->wild_mode = FALSE;
+       creature_ptr->leaving = TRUE;
+
+       do_cmd_write_nikki(NIKKI_BUNSHOU, 1,
+               _("                            しかし、生き返った。",
+                       "                            but revived."));
+
+       /* Prepare next floor */
+       leave_floor(p_ptr->change_floor_mode);
+       wipe_m_list();
+
+}