OSDN Git Service

[Refactor] #38997 take_hit() に player_type * 引数を追加.
[hengband/hengband.git] / src / player-status.c
index 1ad01e7..88ed64f 100644 (file)
 #include "angband.h"
-#include "player-status.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"
+#include "player-skill.h"
+#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 "artifact.h"
 #include "avatar.h"
+#include "spells.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 "objectkind.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
+ * @brief ELDRITCH HORROR効果時のモンスターの形容メッセージ(通常時)
+ */
+static concptr horror_desc[MAX_SAN_HORROR] =
+{
+#ifdef JP
+       "忌まわしい",
+       "底知れぬ",
+       "ぞっとする",
+       "破滅的な",
+       "冒涜的な",
+
+       "いやな",
+       "恐ろしい",
+       "不潔な",
+       "容赦のない",
+       "おぞましい",
+
+       "地獄の",
+       "身の毛もよだつ",
+       "地獄の",
+       "忌まわしい",
+       "悪夢のような",
+
+       "嫌悪を感じる",
+       "罰当たりな",
+       "恐い",
+       "不浄な",
+       "言うもおぞましい",
+#else
+       "abominable",
+       "abysmal",
+       "appalling",
+       "baleful",
+       "blasphemous",
+
+       "disgusting",
+       "dreadful",
+       "filthy",
+       "grisly",
+       "hideous",
+
+       "hellish",
+       "horrible",
+       "infernal",
+       "loathsome",
+       "nightmarish",
+
+       "repulsive",
+       "sacrilegious",
+       "terrible",
+       "unclean",
+       "unspeakable",
+#endif
+
+};
+
+/*!
+ * @var funny_desc
+ * @brief ELDRITCH HORROR効果時のモンスターの形容メッセージ(幻覚状態時)
+ */
+static concptr funny_desc[MAX_SAN_FUNNY] =
+{
+#ifdef JP
+       "間抜けな",
+       "滑稽な",
+       "ばからしい",
+       "無味乾燥な",
+       "馬鹿げた",
+
+       "笑える",
+       "ばかばかしい",
+       "ぶっとんだ",
+       "いかした",
+       "ポストモダンな",
+
+       "ファンタスティックな",
+       "ダダイズム的な",
+       "キュビズム的な",
+       "宇宙的な",
+       "卓越した",
+
+       "理解不能な",
+       "ものすごい",
+       "驚くべき",
+       "信じられない",
+       "カオティックな",
+
+       "野性的な",
+       "非常識な",
+#else
+       "silly",
+       "hilarious",
+       "absurd",
+       "insipid",
+       "ridiculous",
+
+       "laughable",
+       "ludicrous",
+       "far-out",
+       "groovy",
+       "postmodern",
+
+       "fantastic",
+       "dadaistic",
+       "cubistic",
+       "cosmic",
+       "awesome",
+
+       "incomprehensible",
+       "fabulous",
+       "amazing",
+       "incredible",
+       "chaotic",
+
+       "wild",
+       "preposterous",
+#endif
+
+};
+
+/*!
+ * @var funny_comments
+ * @brief ELDRITCH HORROR効果時の幻覚時間延長を示す錯乱表現
+ */
+static concptr funny_comments[MAX_SAN_COMMENT] =
+{
+#ifdef JP
+       /* nuke me */
+         "最高だぜ!",
+         "うひょー!",
+         "いかすぜ!",
+         "すんばらしい!",
+         "ぶっとびー!"
+  #else
+         "Wow, cosmic, man!",
+         "Rad!",
+         "Groovy!",
+         "Cool!",
+         "Far out!"
+  #endif
+
+};
+
+
+/*!
+ * @brief 基本必要経験値テーブル /
+ * Base experience levels, may be adjusted up for race and/or class
+ */
+const s32b player_exp[PY_MAX_LEVEL] =
+{
+       10,
+       25,
+       45,
+       70,
+       100,
+       140,
+       200,
+       280,
+       380,/*10*/
+       500,
+       650,
+       850,
+       1100,
+       1400,
+       1800,
+       2300,
+       2900,
+       3600,
+       4400,/*20*/
+       5400,
+       6800,
+       8400,
+       10200,
+       12500,
+       17500,
+       25000,
+       35000L,
+       50000L,
+       75000L,/*30*/
+       100000L,
+       150000L,
+       200000L,
+       275000L,
+       350000L,
+       450000L,
+       550000L,
+       700000L,
+       850000L,
+       1000000L,/*40*/
+       1250000L,
+       1500000L,
+       1800000L,
+       2100000L,
+       2400000L,
+       2700000L,
+       3000000L,
+       3500000L,
+       4000000L,
+       4500000L,/*50*/
+       5000000L
+};
+
+
+/*!
+ * @brief 基本必要強化値テーブル(アンドロイド専用)
+ */
+const s32b player_exp_a[PY_MAX_LEVEL] =
+{
+       20,
+       50,
+       100,
+       170,
+       280,
+       430,
+       650,
+       950,
+       1400,/*10*/
+       1850,
+       2300,
+       2900,
+       3600,
+       4400,
+       5400,
+       6800,
+       8400,
+       10400,
+       12500,/*20*/
+       17500,
+       25000,
+       35000,
+       50000L,
+       75000L,
+       100000L,
+       150000L,
+       200000L,
+       275000L,
+       350000L,/*30*/
+       450000L,
+       550000L,
+       650000L,
+       800000L,
+       950000L,
+       1100000L,
+       1250000L,
+       1400000L,
+       1550000L,
+       1700000L,/*40*/
+       1900000L,
+       2100000L,
+       2300000L,
+       2550000L,
+       2800000L,
+       3050000L,
+       3300000L,
+       3700000L,
+       4100000L,
+       4500000L,/*50*/
+       5000000L
+};
+
+
+/*!
+ * 知力/賢さによるレベル毎の習得可能魔法数テーブル
+ * 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+ */
+};
 
-/* Hack, monk armour */
-static bool monk_armour_aux;
-static bool monk_notify_aux;
+
+/*!
+ * 知力/賢さによる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
@@ -90,7 +1366,7 @@ int spell_exp_level(int spell_exp)
  */
 void calc_bonuses(void)
 {
-       int i, j, hold, neutral[2];
+       int i, j, hold;
        int new_speed;
        int default_hand = 0;
        int empty_hands_status = empty_hands(TRUE);
@@ -100,6 +1376,7 @@ void calc_bonuses(void)
        bool omoi = FALSE;
        bool yoiyami = FALSE;
        bool down_saving = FALSE;
+
 #if 0
        bool have_dd_s = FALSE, have_dd_t = FALSE;
 #endif
@@ -252,8 +1529,6 @@ void calc_bonuses(void)
        p_ptr->hidarite = FALSE;
        p_ptr->no_flowed = FALSE;
 
-       p_ptr->align = friend_align;
-
        if (p_ptr->mimic_form) tmp_rp_ptr = &mimic_info[p_ptr->mimic_form];
        else tmp_rp_ptr = &race_info[p_ptr->prace];
 
@@ -300,12 +1575,12 @@ void calc_bonuses(void)
        if (CAN_TWO_HANDS_WIELDING())
        {
                if (p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) &&
-                       object_allow_two_hands_wielding(&inventory[INVEN_RARM]))
+                       object_allow_two_hands_wielding(&p_ptr->inventory_list[INVEN_RARM]))
                {
                        p_ptr->ryoute = TRUE;
                }
                else if (p_ptr->hidarite && (empty_hands(FALSE) == EMPTY_HAND_RARM) &&
-                       object_allow_two_hands_wielding(&inventory[INVEN_LARM]))
+                       object_allow_two_hands_wielding(&p_ptr->inventory_list[INVEN_LARM]))
                {
                        p_ptr->ryoute = TRUE;
                }
@@ -340,7 +1615,7 @@ void calc_bonuses(void)
        {
                if (!(empty_hands_status & EMPTY_HAND_RARM))
                {
-                       set_action(ACTION_NONE);
+                       set_action(p_ptr, ACTION_NONE);
                }
        }
 
@@ -368,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;
 
@@ -416,12 +1691,12 @@ void calc_bonuses(void)
                        new_speed -= (p_ptr->lev) / 10;
                        p_ptr->skill_stl -= (p_ptr->lev) / 10;
                }
-               else if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
-                       (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
+               else if ((!p_ptr->inventory_list[INVEN_RARM].k_idx || p_ptr->migite) &&
+                       (!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;
@@ -430,8 +1705,8 @@ void calc_bonuses(void)
                        if (p_ptr->lev > 24)
                                p_ptr->free_act = TRUE;
                }
-               if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
-                       (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
+               if ((!p_ptr->inventory_list[INVEN_RARM].k_idx || p_ptr->migite) &&
+                       (!p_ptr->inventory_list[INVEN_LARM].k_idx || p_ptr->hidarite))
                {
                        p_ptr->to_a += p_ptr->lev / 2 + 5;
                        p_ptr->dis_to_a += p_ptr->lev / 2 + 5;
@@ -466,7 +1741,6 @@ void calc_bonuses(void)
                        p_ptr->redraw |= PR_STATUS;
                        p_ptr->to_a += 10;
                        p_ptr->dis_to_a += 10;
-                       p_ptr->align -= 200;
                        break;
                case MIMIC_DEMON_LORD:
                        p_ptr->hold_exp = TRUE;
@@ -490,7 +1764,6 @@ void calc_bonuses(void)
                        new_speed += 5;
                        p_ptr->to_a += 20;
                        p_ptr->dis_to_a += 20;
-                       p_ptr->align -= 200;
                        break;
                case MIMIC_VAMPIRE:
                        p_ptr->resist_dark = TRUE;
@@ -664,7 +1937,7 @@ void calc_bonuses(void)
                        break;
                case RACE_ENT:
                        /* Ents dig like maniacs, but only with their hands. */
-                       if (!inventory[INVEN_RARM].k_idx)
+                       if (!p_ptr->inventory_list[INVEN_RARM].k_idx)
                                p_ptr->skill_dig += p_ptr->lev * 10;
                        /* Ents get tougher and stronger as they age, but lose dexterity. */
                        if (p_ptr->lev > 25) p_ptr->stat_add[A_STR]++;
@@ -682,7 +1955,6 @@ void calc_bonuses(void)
                case RACE_ANGEL:
                        p_ptr->levitation = TRUE;
                        p_ptr->see_inv = TRUE;
-                       p_ptr->align += 200;
                        break;
                case RACE_DEMON:
                        p_ptr->resist_fire = TRUE;
@@ -694,7 +1966,6 @@ void calc_bonuses(void)
                                p_ptr->oppose_fire = 1;
                                p_ptr->redraw |= PR_STATUS;
                        }
-                       p_ptr->align -= 200;
                        break;
                case RACE_DUNADAN:
                        p_ptr->sustain_con = TRUE;
@@ -995,16 +2266,13 @@ void calc_bonuses(void)
                p_ptr->stat_add[A_CON] += 4;
        }
 
-       /* Scan the usable inventory */
+       /* Scan the usable p_ptr->inventory_list */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
                int bonus_to_h, bonus_to_d;
-               o_ptr = &inventory[i];
-
-               /* Skip non-objects */
+               o_ptr = &p_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
-               /* Extract the item flags */
                object_flags(o_ptr, flgs);
 
                p_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
@@ -1307,7 +2575,7 @@ void calc_bonuses(void)
        }
 
        /* Shield skill bonus */
-       if (object_is_armour(&inventory[INVEN_RARM]) || object_is_armour(&inventory[INVEN_LARM]))
+       if (object_is_armour(&p_ptr->inventory_list[INVEN_RARM]) || object_is_armour(&p_ptr->inventory_list[INVEN_LARM]))
        {
                p_ptr->ac += p_ptr->skill_exp[GINOU_SHIELD] * (1 + p_ptr->lev / 22) / 2000;
                p_ptr->dis_ac += p_ptr->skill_exp[GINOU_SHIELD] * (1 + p_ptr->lev / 22) / 2000;
@@ -1324,32 +2592,32 @@ void calc_bonuses(void)
        /* Monks get extra ac for armour _not worn_ */
        if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor())
        {
-               if (!(inventory[INVEN_BODY].k_idx))
+               if (!(p_ptr->inventory_list[INVEN_BODY].k_idx))
                {
                        p_ptr->to_a += (p_ptr->lev * 3) / 2;
                        p_ptr->dis_to_a += (p_ptr->lev * 3) / 2;
                }
-               if (!(inventory[INVEN_OUTER].k_idx) && (p_ptr->lev > 15))
+               if (!(p_ptr->inventory_list[INVEN_OUTER].k_idx) && (p_ptr->lev > 15))
                {
                        p_ptr->to_a += ((p_ptr->lev - 13) / 3);
                        p_ptr->dis_to_a += ((p_ptr->lev - 13) / 3);
                }
-               if (!(inventory[INVEN_LARM].k_idx) && (p_ptr->lev > 10))
+               if (!(p_ptr->inventory_list[INVEN_LARM].k_idx) && (p_ptr->lev > 10))
                {
                        p_ptr->to_a += ((p_ptr->lev - 8) / 3);
                        p_ptr->dis_to_a += ((p_ptr->lev - 8) / 3);
                }
-               if (!(inventory[INVEN_HEAD].k_idx) && (p_ptr->lev > 4))
+               if (!(p_ptr->inventory_list[INVEN_HEAD].k_idx) && (p_ptr->lev > 4))
                {
                        p_ptr->to_a += (p_ptr->lev - 2) / 3;
                        p_ptr->dis_to_a += (p_ptr->lev - 2) / 3;
                }
-               if (!(inventory[INVEN_HANDS].k_idx))
+               if (!(p_ptr->inventory_list[INVEN_HANDS].k_idx))
                {
                        p_ptr->to_a += (p_ptr->lev / 2);
                        p_ptr->dis_to_a += (p_ptr->lev / 2);
                }
-               if (!(inventory[INVEN_FEET].k_idx))
+               if (!(p_ptr->inventory_list[INVEN_FEET].k_idx))
                {
                        p_ptr->to_a += (p_ptr->lev / 3);
                        p_ptr->dis_to_a += (p_ptr->lev / 3);
@@ -1392,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);
@@ -1429,7 +2697,7 @@ void calc_bonuses(void)
                for (i = INVEN_RARM; i <= INVEN_FEET; i++)
                {
                        ARMOUR_CLASS ac = 0;
-                       o_ptr = &inventory[i];
+                       o_ptr = &p_ptr->inventory_list[i];
                        if (!o_ptr->k_idx) continue;
                        if (!object_is_armour(o_ptr)) continue;
                        if (!object_is_cursed(o_ptr)) continue;
@@ -1749,9 +3017,9 @@ void calc_bonuses(void)
        if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
        {
                int penalty1, penalty2;
-               penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_RARM].weight) / 8);
-               penalty2 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_LARM].weight) / 8);
-               if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN))
+               penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - p_ptr->inventory_list[INVEN_RARM].weight) / 8);
+               penalty2 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - p_ptr->inventory_list[INVEN_LARM].weight) / 8);
+               if ((p_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (p_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN))
                {
                        penalty1 = penalty1 / 2 - 5;
                        penalty2 = penalty2 / 2 - 5;
@@ -1764,12 +3032,12 @@ void calc_bonuses(void)
                        if (penalty1 > 0) penalty1 /= 2;
                        if (penalty2 > 0) penalty2 /= 2;
                }
-               else if ((inventory[INVEN_LARM].tval == TV_SWORD) && ((inventory[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (inventory[INVEN_LARM].sval == SV_WAKIZASHI)))
+               else if ((p_ptr->inventory_list[INVEN_LARM].tval == TV_SWORD) && ((p_ptr->inventory_list[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (p_ptr->inventory_list[INVEN_LARM].sval == SV_WAKIZASHI)))
                {
                        penalty1 = MAX(0, penalty1 - 10);
                        penalty2 = MAX(0, penalty2 - 10);
                }
-               if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
+               if ((p_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (p_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
                {
                        penalty1 = MIN(0, penalty1);
                        penalty2 = MIN(0, penalty2);
@@ -1778,13 +3046,13 @@ void calc_bonuses(void)
                }
                else
                {
-                       if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
+                       if ((p_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
                                penalty1 /= 2;
-                       if ((inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
+                       if ((p_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
                                penalty2 /= 2;
                }
-               if (inventory[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
-               if (inventory[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
+               if (p_ptr->inventory_list[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
+               if (p_ptr->inventory_list[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
                p_ptr->to_h[0] -= (s16b)penalty1;
                p_ptr->to_h[1] -= (s16b)penalty2;
                p_ptr->dis_to_h[0] -= (s16b)penalty1;
@@ -1880,7 +3148,7 @@ void calc_bonuses(void)
 
 
        /* Examine the "current bow" */
-       o_ptr = &inventory[INVEN_BOW];
+       o_ptr = &p_ptr->inventory_list[INVEN_BOW];
 
        /* It is hard to carholdry a heavy bow */
        p_ptr->heavy_shoot = is_heavy_shoot(o_ptr);
@@ -1917,7 +3185,7 @@ void calc_bonuses(void)
        for (i = 0; i < 2; i++)
        {
                /* Examine the "main weapon" */
-               o_ptr = &inventory[INVEN_RARM + i];
+               o_ptr = &p_ptr->inventory_list[INVEN_RARM + i];
 
                object_flags(o_ptr, flgs);
 
@@ -2304,19 +3572,19 @@ void calc_bonuses(void)
 
        if (p_ptr->riding) p_ptr->levitation = riding_levitation;
 
-       monk_armour_aux = FALSE;
+       p_ptr->monk_armour_aux = FALSE;
 
        if (heavy_armor())
        {
-               monk_armour_aux = TRUE;
+               p_ptr->monk_armour_aux = TRUE;
        }
 
        for (i = 0; i < 2; i++)
        {
                if (has_melee_weapon(INVEN_RARM + i))
                {
-                       OBJECT_TYPE_VALUE tval = inventory[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
-                       OBJECT_SUBTYPE_VALUE sval = inventory[INVEN_RARM + i].sval;
+                       OBJECT_TYPE_VALUE tval = p_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
+                       OBJECT_SUBTYPE_VALUE sval = p_ptr->inventory_list[INVEN_RARM + i].sval;
 
                        p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
                        p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
@@ -2331,7 +3599,7 @@ void calc_bonuses(void)
                        }
                        else if (p_ptr->pclass == CLASS_NINJA)
                        {
-                               if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (inventory[INVEN_LARM - i].tval == TV_SHIELD))
+                               if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (p_ptr->inventory_list[INVEN_LARM - i].tval == TV_SHIELD))
                                {
                                        p_ptr->to_h[i] -= 40;
                                        p_ptr->dis_to_h[i] -= 40;
@@ -2340,8 +3608,6 @@ void calc_bonuses(void)
                                        if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
                                }
                        }
-
-                       if (inventory[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000;
                }
        }
 
@@ -2437,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);
@@ -2464,46 +3730,9 @@ void calc_bonuses(void)
        if (p_ptr->immune_fire) p_ptr->resist_fire = TRUE;
        if (p_ptr->immune_cold) p_ptr->resist_cold = TRUE;
 
-       /* Determine player alignment */
-       for (i = 0, j = 0; i < 8; i++)
-       {
-               switch (p_ptr->vir_types[i])
-               {
-               case V_JUSTICE:
-                       p_ptr->align += p_ptr->virtues[i] * 2;
-                       break;
-               case V_CHANCE:
-                       /* Do nothing */
-                       break;
-               case V_NATURE:
-               case V_HARMONY:
-                       neutral[j++] = i;
-                       break;
-               case V_UNLIFE:
-                       p_ptr->align -= p_ptr->virtues[i];
-                       break;
-               default:
-                       p_ptr->align += p_ptr->virtues[i];
-                       break;
-               }
-       }
-
-       for (i = 0; i < j; i++)
-       {
-               if (p_ptr->align > 0)
-               {
-                       p_ptr->align -= p_ptr->virtues[neutral[i]] / 2;
-                       if (p_ptr->align < 0) p_ptr->align = 0;
-               }
-               else if (p_ptr->align < 0)
-               {
-                       p_ptr->align += p_ptr->virtues[neutral[i]] / 2;
-                       if (p_ptr->align > 0) p_ptr->align = 0;
-               }
-       }
 
        /* 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)
@@ -2512,7 +3741,7 @@ void calc_bonuses(void)
                {
                        msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
                }
-               else if (inventory[INVEN_BOW].k_idx)
+               else if (p_ptr->inventory_list[INVEN_BOW].k_idx)
                {
                        msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
                }
@@ -2576,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))
@@ -2617,14 +3846,14 @@ void calc_bonuses(void)
                p_ptr->old_riding_ryoute = p_ptr->riding_ryoute;
        }
 
-       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (monk_armour_aux != monk_notify_aux))
+       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (p_ptr->monk_armour_aux != p_ptr->monk_notify_aux))
        {
                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
@@ -2632,17 +3861,17 @@ void calc_bonuses(void)
                        msg_print(_("バランスがとれるようになった。", "You regain your balance."));
                }
 
-               monk_notify_aux = monk_armour_aux;
+               p_ptr->monk_notify_aux = p_ptr->monk_armour_aux;
        }
 
        for (i = 0; i < INVEN_PACK; i++)
        {
 #if 0
-               if ((inventory[i].tval == TV_SORCERY_BOOK) && (inventory[i].sval == 2)) have_dd_s = TRUE;
-               if ((inventory[i].tval == TV_TRUMP_BOOK) && (inventory[i].sval == 1)) have_dd_t = TRUE;
+               if ((p_ptr->inventory_list[i].tval == TV_SORCERY_BOOK) && (p_ptr->inventory_list[i].sval == 2)) have_dd_s = TRUE;
+               if ((p_ptr->inventory_list[i].tval == TV_TRUMP_BOOK) && (p_ptr->inventory_list[i].sval == 1)) have_dd_t = TRUE;
 #endif
-               if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE;
-               if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE;
+               if ((p_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (p_ptr->inventory_list[i].sval == 2)) have_sw = TRUE;
+               if ((p_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (p_ptr->inventory_list[i].sval == 2)) have_kabe = TRUE;
        }
 
        for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
@@ -2686,6 +3915,99 @@ void calc_bonuses(void)
 }
 
 
+static void calc_alignment(void)
+{
+       MONSTER_IDX m_idx;
+       p_ptr->align = 0;
+       int i, j, neutral[2];
+
+       for (m_idx = current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
+       {
+               monster_type *m_ptr;
+               monster_race *r_ptr;
+               m_ptr = &current_floor_ptr->m_list[m_idx];
+               if (!monster_is_valid(m_ptr)) continue;
+               r_ptr = &r_info[m_ptr->r_idx];
+
+               if (is_pet(m_ptr))
+               {
+                       if (r_ptr->flags3 & RF3_GOOD) p_ptr->align += r_ptr->level;
+                       if (r_ptr->flags3 & RF3_EVIL) p_ptr->align -= r_ptr->level;
+               }
+       }
+
+       if (p_ptr->mimic_form)
+       {
+               switch (p_ptr->mimic_form)
+               {
+               case MIMIC_DEMON:
+                       p_ptr->align -= 200;
+                       break;
+               case MIMIC_DEMON_LORD:
+                       p_ptr->align -= 200;
+                       break;
+               }
+       }
+       else
+       {
+               switch (p_ptr->prace)
+               {
+               case RACE_ANGEL:
+                       p_ptr->align += 200;
+                       break;
+               case RACE_DEMON:
+                       p_ptr->align -= 200;
+                       break;
+               }
+       }
+
+       for (i = 0; i < 2; i++)
+       {
+               if (has_melee_weapon(INVEN_RARM + i))
+               {
+                       if (p_ptr->inventory_list[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000;
+               }
+       }
+
+       /* Determine player alignment */
+       for (i = 0, j = 0; i < 8; i++)
+       {
+               switch (p_ptr->vir_types[i])
+               {
+               case V_JUSTICE:
+                       p_ptr->align += p_ptr->virtues[i] * 2;
+                       break;
+               case V_CHANCE:
+                       /* Do nothing */
+                       break;
+               case V_NATURE:
+               case V_HARMONY:
+                       neutral[j++] = i;
+                       break;
+               case V_UNLIFE:
+                       p_ptr->align -= p_ptr->virtues[i];
+                       break;
+               default:
+                       p_ptr->align += p_ptr->virtues[i];
+                       break;
+               }
+       }
+
+       for (i = 0; i < j; i++)
+       {
+               if (p_ptr->align > 0)
+               {
+                       p_ptr->align -= p_ptr->virtues[neutral[i]] / 2;
+                       if (p_ptr->align < 0) p_ptr->align = 0;
+               }
+               else if (p_ptr->align < 0)
+               {
+                       p_ptr->align += p_ptr->virtues[neutral[i]] / 2;
+                       if (p_ptr->align > 0) p_ptr->align = 0;
+               }
+       }
+}
+
 /*!
  * @brief プレイヤーの最大HPを計算する /
  * Calculate the players (maximal) hit points
@@ -2753,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));
                }
@@ -2763,7 +4085,6 @@ static void calc_hitpoints(void)
 
                /* Display hitpoints (later) */
                p_ptr->redraw |= (PR_HP);
-
                p_ptr->window |= (PW_PLAYER);
        }
 }
@@ -2776,7 +4097,8 @@ static void calc_hitpoints(void)
  */
 static void calc_torch(void)
 {
-       int i, rad;
+       int i;
+       POSITION rad;
        object_type *o_ptr;
        BIT_FLAGS flgs[TR_FLAG_SIZE];
 
@@ -2786,7 +4108,7 @@ static void calc_torch(void)
        /* Loop through all wielded items */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
                /* Skip empty slots */
                if (!o_ptr->k_idx) continue;
 
@@ -2812,11 +4134,10 @@ static void calc_torch(void)
                if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
                if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
                if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
-               p_ptr->cur_lite += (s16b)rad;
+               p_ptr->cur_lite += rad;
        }
 
        /* 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;
 
@@ -2841,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);
        }
 }
 
@@ -2864,17 +4185,16 @@ static void calc_spells(void)
        REALM_IDX which;
        int bonus = 0;
 
-
        concptr p;
 
        /* Hack -- must be literate */
        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))
        {
@@ -3046,11 +4366,9 @@ static void calc_spells(void)
                        }
 
 #ifdef JP
-                       msg_format("%sの%sを忘れてしまった。",
-                               do_spell(which, j % 32, SPELL_NAME), p);
+                       msg_format("%sの%sを忘れてしまった。", do_spell(which, j % 32, SPELL_NAME), p);
 #else
-                       msg_format("You have forgotten the %s of %s.", p,
-                               do_spell(which, j % 32, SPELL_NAME));
+                       msg_format("You have forgotten the %s of %s.", p, do_spell(which, j % 32, SPELL_NAME));
 #endif
 
 
@@ -3268,7 +4586,7 @@ static void calc_mana(void)
                p_ptr->cumber_glove = FALSE;
 
                /* Get the gloves */
-               o_ptr = &inventory[INVEN_HANDS];
+               o_ptr = &p_ptr->inventory_list[INVEN_HANDS];
 
                /* Examine the gloves */
                object_flags(o_ptr, flgs);
@@ -3295,13 +4613,13 @@ static void calc_mana(void)
 
        /* Weigh the armor */
        cur_wgt = 0;
-       if (inventory[INVEN_RARM].tval > TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
-       if (inventory[INVEN_LARM].tval > TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
-       cur_wgt += inventory[INVEN_BODY].weight;
-       cur_wgt += inventory[INVEN_HEAD].weight;
-       cur_wgt += inventory[INVEN_OUTER].weight;
-       cur_wgt += inventory[INVEN_HANDS].weight;
-       cur_wgt += inventory[INVEN_FEET].weight;
+       if (p_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight;
+       if (p_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight;
+       cur_wgt += p_ptr->inventory_list[INVEN_BODY].weight;
+       cur_wgt += p_ptr->inventory_list[INVEN_HEAD].weight;
+       cur_wgt += p_ptr->inventory_list[INVEN_OUTER].weight;
+       cur_wgt += p_ptr->inventory_list[INVEN_HANDS].weight;
+       cur_wgt += p_ptr->inventory_list[INVEN_FEET].weight;
 
        /* Subtract a percentage of maximum mana. */
        switch (p_ptr->pclass)
@@ -3315,8 +4633,8 @@ static void calc_mana(void)
        case CLASS_FORCETRAINER:
        case CLASS_SORCERER:
        {
-               if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
-               if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
+               if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight;
+               if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight;
                break;
        }
 
@@ -3325,8 +4643,8 @@ static void calc_mana(void)
        case CLASS_BARD:
        case CLASS_TOURIST:
        {
-               if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight * 2 / 3;
-               if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight * 2 / 3;
+               if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
+               if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
                break;
        }
 
@@ -3334,8 +4652,8 @@ static void calc_mana(void)
        case CLASS_BEASTMASTER:
        case CLASS_MIRROR_MASTER:
        {
-               if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight / 2;
-               if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight / 2;
+               if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight / 2;
+               if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight / 2;
                break;
        }
 
@@ -3345,8 +4663,8 @@ static void calc_mana(void)
        case CLASS_RED_MAGE:
        case CLASS_WARRIOR_MAGE:
        {
-               if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight / 3;
-               if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight / 3;
+               if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight / 3;
+               if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight / 3;
                break;
        }
 
@@ -3354,8 +4672,8 @@ static void calc_mana(void)
        case CLASS_PALADIN:
        case CLASS_CHAOS_WARRIOR:
        {
-               if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight / 5;
-               if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight / 5;
+               if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight / 5;
+               if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight / 5;
                break;
        }
 
@@ -3457,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));
                }
@@ -3467,14 +4785,12 @@ static void calc_mana(void)
 
                /* Display mana later */
                p_ptr->redraw |= (PR_MANA);
-
-               p_ptr->window |= (PW_PLAYER);
-               p_ptr->window |= (PW_SPELL);
+               p_ptr->window |= (PW_PLAYER | PW_SPELL);
        }
 
 
        /* 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)
@@ -3525,18 +4841,15 @@ s16b calc_num_fire(object_type *o_ptr)
        object_type *q_ptr;
        BIT_FLAGS flgs[TR_FLAG_SIZE];
 
-       /* Scan the usable inventory */
+       /* Scan the usable p_ptr->inventory_list */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               q_ptr = &inventory[i];
-
-               /* Skip non-objects */
+               q_ptr = &p_ptr->inventory_list[i];
                if (!q_ptr->k_idx) continue;
 
                /* Do not apply current equip */
                if (i == INVEN_BOW) continue;
 
-               /* Extract the item flags */
                object_flags(q_ptr, flgs);
 
                /* Boost shots */
@@ -3616,7 +4929,7 @@ WEIGHT weight_limit(void)
  */
 bool has_melee_weapon(int i)
 {
-       return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE);
+       return ((p_ptr->inventory_list[i].k_idx && object_is_melee_weapon(&p_ptr->inventory_list[i])) ? TRUE : FALSE);
 }
 
 /*!
@@ -3628,8 +4941,8 @@ BIT_FLAGS16 empty_hands(bool riding_control)
 {
        BIT_FLAGS16 status = EMPTY_HAND_NONE;
 
-       if (!inventory[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
-       if (!inventory[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
+       if (!p_ptr->inventory_list[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
+       if (!p_ptr->inventory_list[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
 
        if (riding_control && (status != EMPTY_HAND_NONE) && p_ptr->riding && !(p_ptr->pet_extra_flags & PF_RYOUTE))
        {
@@ -3652,13 +4965,13 @@ bool heavy_armor(void)
        if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE;
 
        /* Weight the armor */
-       if (inventory[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_RARM].weight;
-       if (inventory[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_LARM].weight;
-       monk_arm_wgt += inventory[INVEN_BODY].weight;
-       monk_arm_wgt += inventory[INVEN_HEAD].weight;
-       monk_arm_wgt += inventory[INVEN_OUTER].weight;
-       monk_arm_wgt += inventory[INVEN_HANDS].weight;
-       monk_arm_wgt += inventory[INVEN_FEET].weight;
+       if (p_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += p_ptr->inventory_list[INVEN_RARM].weight;
+       if (p_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += p_ptr->inventory_list[INVEN_LARM].weight;
+       monk_arm_wgt += p_ptr->inventory_list[INVEN_BODY].weight;
+       monk_arm_wgt += p_ptr->inventory_list[INVEN_HEAD].weight;
+       monk_arm_wgt += p_ptr->inventory_list[INVEN_OUTER].weight;
+       monk_arm_wgt += p_ptr->inventory_list[INVEN_HANDS].weight;
+       monk_arm_wgt += p_ptr->inventory_list[INVEN_FEET].weight;
 
        return (monk_arm_wgt > (100 + (p_ptr->lev * 4)));
 }
@@ -3694,6 +5007,7 @@ void update_creature(player_type *creature_ptr)
        if (creature_ptr->update & (PU_BONUS))
        {
                creature_ptr->update &= ~(PU_BONUS);
+               calc_alignment();
                calc_bonuses();
        }
 
@@ -3722,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))
        {
@@ -3802,7 +5116,7 @@ bool player_has_no_spellbooks(void)
 
        for (i = 0; i < INVEN_PACK; i++)
        {
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
                if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
        }
 
@@ -3863,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--)
@@ -3891,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)
        {
@@ -3909,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)
@@ -3950,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;
@@ -4060,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))
@@ -4133,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:
@@ -4150,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;
        }
@@ -4158,3 +5472,417 @@ void sanity_blast(monster_type *m_ptr, bool necro)
        p_ptr->update |= PU_BONUS;
        handle_stuff();
 }
+
+
+/*!
+ * @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
+ * Advance experience levels and print experience
+ * @return なし
+ */
+void check_experience(void)
+{
+       bool level_reward = FALSE;
+       bool level_mutation = FALSE;
+       bool level_inc_stat = FALSE;
+       bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
+       PLAYER_LEVEL old_lev = p_ptr->lev;
+
+       /* Hack -- lower limit */
+       if (p_ptr->exp < 0) p_ptr->exp = 0;
+       if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
+       if (p_ptr->max_max_exp < 0) p_ptr->max_max_exp = 0;
+
+       /* Hack -- upper limit */
+       if (p_ptr->exp > PY_MAX_EXP) p_ptr->exp = PY_MAX_EXP;
+       if (p_ptr->max_exp > PY_MAX_EXP) p_ptr->max_exp = PY_MAX_EXP;
+       if (p_ptr->max_max_exp > PY_MAX_EXP) p_ptr->max_max_exp = PY_MAX_EXP;
+
+       /* Hack -- maintain "max" experience */
+       if (p_ptr->exp > p_ptr->max_exp) p_ptr->max_exp = p_ptr->exp;
+
+       /* Hack -- maintain "max max" experience */
+       if (p_ptr->max_exp > p_ptr->max_max_exp) p_ptr->max_max_exp = p_ptr->max_exp;
+
+       /* Redraw experience */
+       p_ptr->redraw |= (PR_EXP);
+       handle_stuff();
+
+
+       /* Lose levels while possible */
+       while ((p_ptr->lev > 1) &&
+               (p_ptr->exp < ((android ? player_exp_a : player_exp)[p_ptr->lev - 2] * p_ptr->expfact / 100L)))
+       {
+               /* Lose a level */
+               p_ptr->lev--;
+               p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
+               p_ptr->redraw |= (PR_LEV | PR_TITLE);
+               p_ptr->window |= (PW_PLAYER);
+               handle_stuff();
+       }
+
+
+       /* Gain levels while possible */
+       while ((p_ptr->lev < PY_MAX_LEVEL) &&
+               (p_ptr->exp >= ((android ? player_exp_a : player_exp)[p_ptr->lev - 1] * p_ptr->expfact / 100L)))
+       {
+               /* Gain a level */
+               p_ptr->lev++;
+
+               /* Save the highest level */
+               if (p_ptr->lev > p_ptr->max_plv)
+               {
+                       p_ptr->max_plv = p_ptr->lev;
+
+                       if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
+                               (p_ptr->muta2 & MUT2_CHAOS_GIFT))
+                       {
+                               level_reward = TRUE;
+                       }
+                       if (p_ptr->prace == RACE_BEASTMAN)
+                       {
+                               if (one_in_(5)) level_mutation = TRUE;
+                       }
+                       level_inc_stat = TRUE;
+
+                       do_cmd_write_nikki(NIKKI_LEVELUP, p_ptr->lev, NULL);
+               }
+
+               sound(SOUND_LEVEL);
+
+               msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), p_ptr->lev);
+
+               p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
+               p_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
+               p_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
+
+               /* HPとMPの上昇量を表示 */
+               p_ptr->level_up_message = TRUE;
+               handle_stuff();
+
+               p_ptr->level_up_message = FALSE;
+
+               if (level_inc_stat)
+               {
+                       if (!(p_ptr->max_plv % 10))
+                       {
+                               int choice;
+                               screen_save();
+                               while (1)
+                               {
+                                       int n;
+                                       char tmp[32];
+
+                                       cnv_stat(p_ptr->stat_max[0], tmp);
+                                       prt(format(_("        a) 腕力 (現在値 %s)", "        a) Str (cur %s)"), tmp), 2, 14);
+                                       cnv_stat(p_ptr->stat_max[1], tmp);
+                                       prt(format(_("        b) 知能 (現在値 %s)", "        a) Int (cur %s)"), tmp), 3, 14);
+                                       cnv_stat(p_ptr->stat_max[2], tmp);
+                                       prt(format(_("        c) 賢さ (現在値 %s)", "        a) Wis (cur %s)"), tmp), 4, 14);
+                                       cnv_stat(p_ptr->stat_max[3], tmp);
+                                       prt(format(_("        d) 器用 (現在値 %s)", "        a) Dex (cur %s)"), tmp), 5, 14);
+                                       cnv_stat(p_ptr->stat_max[4], tmp);
+                                       prt(format(_("        e) 耐久 (現在値 %s)", "        a) Con (cur %s)"), tmp), 6, 14);
+                                       cnv_stat(p_ptr->stat_max[5], tmp);
+                                       prt(format(_("        f) 魅力 (現在値 %s)", "        a) Chr (cur %s)"), tmp), 7, 14);
+
+                                       prt("", 8, 14);
+                                       prt(_("        どの能力値を上げますか?", "        Which stat do you want to raise?"), 1, 14);
+
+                                       while (1)
+                                       {
+                                               choice = inkey();
+                                               if ((choice >= 'a') && (choice <= 'f')) break;
+                                       }
+                                       for (n = 0; n < A_MAX; n++)
+                                               if (n != choice - 'a')
+                                                       prt("", n + 2, 14);
+                                       if (get_check(_("よろしいですか?", "Are you sure? "))) break;
+                               }
+                               do_inc_stat(p_ptr, choice - 'a');
+                               screen_load();
+                       }
+                       else if (!(p_ptr->max_plv % 2))
+                               do_inc_stat(p_ptr, randint0(6));
+               }
+
+               if (level_mutation)
+               {
+                       msg_print(_("あなたは変わった気がする...", "You feel different..."));
+                       (void)gain_mutation(p_ptr, 0);
+                       level_mutation = FALSE;
+               }
+
+               /*
+                * 報酬でレベルが上ると再帰的に check_experience() が
+                * 呼ばれるので順番を最後にする。
+                */
+               if (level_reward)
+               {
+                       gain_level_reward(p_ptr, 0);
+                       level_reward = FALSE;
+               }
+
+               p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
+               p_ptr->redraw |= (PR_LEV | PR_TITLE);
+               p_ptr->window |= (PW_PLAYER | PW_SPELL);
+               handle_stuff();
+       }
+
+       /* Load an autopick preference file */
+       if (old_lev != p_ptr->lev) autopick_load_pref(FALSE);
+}
+
+/*!
+ * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
+ * @param val 能力値
+ * @param out_val 出力先文字列ポインタ
+ * @return なし
+ */
+void cnv_stat(int val, char *out_val)
+{
+       /* Above 18 */
+       if (val > 18)
+       {
+               int bonus = (val - 18);
+
+               if (bonus >= 220)
+               {
+                       sprintf(out_val, "18/%3s", "***");
+               }
+               else if (bonus >= 100)
+               {
+                       sprintf(out_val, "18/%03d", bonus);
+               }
+               else
+               {
+                       sprintf(out_val, " 18/%02d", bonus);
+               }
+       }
+
+       /* From 3 to 18 */
+       else
+       {
+               sprintf(out_val, "    %2d", val);
+       }
+}
+
+/*!
+ * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
+ * Modify a stat value by a "modifier", return new value
+ * @param value 現在値
+ * @param amount 加減算値
+ * @return 加減算後の値
+ * @details
+ * <pre>
+ * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
+ * Or even: 18/13, 18/23, 18/33, ..., 18/220
+ * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
+ * Or even: 18/13, 18/03, 18, 17, ..., 3
+ * </pre>
+ */
+s16b modify_stat_value(int value, int amount)
+{
+       int    i;
+
+       /* Reward */
+       if (amount > 0)
+       {
+               /* Apply each point */
+               for (i = 0; i < amount; i++)
+               {
+                       /* One point at a time */
+                       if (value < 18) value++;
+
+                       /* Ten "points" at a time */
+                       else value += 10;
+               }
+       }
+
+       /* Penalty */
+       else if (amount < 0)
+       {
+               /* Apply each point */
+               for (i = 0; i < (0 - amount); i++)
+               {
+                       /* Ten points at a time */
+                       if (value >= 18 + 10) value -= 10;
+
+                       /* Hack -- prevent weirdness */
+                       else if (value > 18) value = 18;
+
+                       /* One point at a time */
+                       else if (value > 3) value--;
+               }
+       }
+
+       /* Return new value */
+       return (s16b)(value);
+}
+
+
+/*!
+ * @brief スコアを計算する /
+ * Hack -- Calculates the total number of points earned                -JWT-
+ * @return なし
+ * @details
+ */
+long calc_score(void)
+{
+       int i, mult = 100;
+       DEPTH max_dl = 0;
+       u32b point, point_h, point_l;
+       int arena_win = MIN(p_ptr->arena_number, MAX_ARENA_MONS);
+
+       if (!preserve_mode) mult += 10;
+       if (!autoroller) mult += 10;
+       if (!smart_learn) mult -= 20;
+       if (smart_cheat) mult += 30;
+       if (ironman_shops) mult += 50;
+       if (ironman_small_levels) mult += 10;
+       if (ironman_empty_levels) mult += 20;
+       if (!powerup_home) mult += 50;
+       if (ironman_rooms) mult += 100;
+       if (ironman_nightmare) mult += 100;
+
+       if (mult < 5) mult = 5;
+
+       for (i = 0; i < max_d_idx; i++)
+               if (max_dlv[i] > max_dl)
+                       max_dl = max_dlv[i];
+
+       point_l = (p_ptr->max_max_exp + (100 * max_dl));
+       point_h = point_l / 0x10000L;
+       point_l = point_l % 0x10000L;
+       point_h *= mult;
+       point_l *= mult;
+       point_h += point_l / 0x10000L;
+       point_l %= 0x10000L;
+
+       point_l += ((point_h % 100) << 16);
+       point_h /= 100;
+       point_l /= 100;
+
+       point = (point_h << 16) + (point_l);
+       if (p_ptr->arena_number >= 0)
+               point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
+
+       if (ironman_downward) point *= 2;
+       if (p_ptr->pclass == CLASS_BERSERKER)
+       {
+               if (p_ptr->prace == RACE_SPECTRE)
+                       point = point / 5;
+       }
+
+       if ((p_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point)
+       {
+               point = 1;
+               if (p_ptr->total_winner) point = 2;
+       }
+       if (easy_band) point = (0 - point);
+
+       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();
+
+}