OSDN Git Service

[Refactor] #38844 is_loading_now を world_type 構造体へ移動.
[hengband/hengband.git] / src / player-status.c
index 2150bf9..fb2f560 100644 (file)
@@ -1,21 +1,37 @@
 #include "angband.h"
+#include "util.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 "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 "monster.h"
 #include "monster-status.h"
 #include "monsterrace-hook.h"
 #include "mutation.h"
 #include "patron.h"
-
-/* Hack, monk armour */
-static bool monk_armour_aux;
-static bool monk_notify_aux;
-
+#include "realm-hex.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"
 
 /*!
  * @var horror_desc
@@ -163,6 +179,123 @@ static concptr funny_comments[MAX_SAN_COMMENT] =
 };
 
 
+/*!
+ * @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
+};
+
+
 /*
  * Return alignment title
  */
@@ -252,6 +385,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
@@ -450,12 +584,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;
                }
@@ -566,8 +700,8 @@ 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) ||
@@ -580,8 +714,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;
@@ -812,7 +946,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]++;
@@ -1141,16 +1275,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));
@@ -1453,7 +1584,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;
@@ -1470,32 +1601,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);
@@ -1575,7 +1706,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;
@@ -1895,9 +2026,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;
@@ -1910,12 +2041,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);
@@ -1924,13 +2055,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;
@@ -2026,7 +2157,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);
@@ -2063,7 +2194,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);
 
@@ -2450,19 +2581,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;
@@ -2477,7 +2608,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;
@@ -2619,7 +2750,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."));
                }
@@ -2683,7 +2814,7 @@ 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);
                                }
@@ -2724,12 +2855,12 @@ 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);
                        }
@@ -2739,17 +2870,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)
@@ -2799,7 +2930,7 @@ static void calc_alignment(void)
        p_ptr->align = 0;
        int i, j, neutral[2];
 
-       for (m_idx = m_max - 1; m_idx >= 1; m_idx--)
+       for (m_idx = current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
        {
                monster_type *m_ptr;
                monster_race *r_ptr;
@@ -2843,7 +2974,7 @@ static void calc_alignment(void)
        {
                if (has_melee_weapon(INVEN_RARM + i))
                {
-                       if (inventory[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000;
+                       if (p_ptr->inventory_list[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000;
                }
        }
 
@@ -2986,7 +3117,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;
 
@@ -3465,7 +3596,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);
@@ -3492,13 +3623,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)
@@ -3512,8 +3643,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;
        }
 
@@ -3522,8 +3653,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;
        }
 
@@ -3531,8 +3662,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;
        }
 
@@ -3542,8 +3673,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;
        }
 
@@ -3551,8 +3682,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;
        }
 
@@ -3720,18 +3851,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 */
@@ -3811,7 +3939,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);
 }
 
 /*!
@@ -3823,8 +3951,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))
        {
@@ -3847,13 +3975,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)));
 }
@@ -3998,7 +4126,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;
        }
 
@@ -4105,7 +4233,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)
@@ -4601,3 +4729,67 @@ s16b modify_stat_value(int value, int amount)
        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;
+}
+