OSDN Git Service

[Refactor] #38993 floor_type 構造体作成。 / Create floor_type structure.
[hengbandforosx/hengbandosx.git] / src / player-status.c
index 6326dcb..0be5720 100644 (file)
@@ -1,7 +1,14 @@
 #include "angband.h"
-#include "artifact.h"
 #include "player-status.h"
+
+#include "artifact.h"
 #include "avatar.h"
+#include "spells-status.h"
+#include "object-hook.h"
+
+/* Hack, monk armour */
+static bool monk_armour_aux;
+static bool monk_notify_aux;
 
 /*
  * Return alignment title
@@ -119,7 +126,7 @@ void calc_bonuses(void)
        bool old_mighty_throw = p_ptr->mighty_throw;
 
        /* Current feature under player. */
-       feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];
+       feature_type *f_ptr = &f_info[current_floor->grid_array[p_ptr->y][p_ptr->x].feat];
 
        /* Save the old armor class */
        ARMOUR_CLASS old_dis_ac = p_ptr->dis_ac;
@@ -1446,10 +1453,7 @@ void calc_bonuses(void)
                {
                        /* Save the new value */
                        p_ptr->stat_top[i] = (s16b)top;
-
-                       /* Redisplay the stats later */
                        p_ptr->redraw |= (PR_STATS);
-
                        p_ptr->window |= (PW_PLAYER);
                }
 
@@ -1471,10 +1475,7 @@ void calc_bonuses(void)
                {
                        /* Save the new value */
                        p_ptr->stat_use[i] = (s16b)use;
-
-                       /* Redisplay the stats later */
                        p_ptr->redraw |= (PR_STATS);
-
                        p_ptr->window |= (PW_PLAYER);
                }
 
@@ -1957,93 +1958,73 @@ void calc_bonuses(void)
                        /* Analyze the class */
                        switch (p_ptr->pclass)
                        {
-                               /* Warrior */
                        case CLASS_WARRIOR:
                                num = 6; wgt = 70; mul = 5; break;
 
-                               /* Berserker */
                        case CLASS_BERSERKER:
                                num = 6; wgt = 70; mul = 7; break;
 
-                               /* Mage */
                        case CLASS_MAGE:
                        case CLASS_HIGH_MAGE:
                        case CLASS_BLUE_MAGE:
                                num = 3; wgt = 100; mul = 2; break;
 
-                               /* Priest, Mindcrafter, Magic-Eater */
                        case CLASS_PRIEST:
                        case CLASS_MAGIC_EATER:
                        case CLASS_MINDCRAFTER:
                                num = 5; wgt = 100; mul = 3; break;
 
-                               /* Rogue */
                        case CLASS_ROGUE:
                                num = 5; wgt = 40; mul = 3; break;
 
-                               /* Ranger */
                        case CLASS_RANGER:
                                num = 5; wgt = 70; mul = 4; break;
 
-                               /* Paladin */
                        case CLASS_PALADIN:
                        case CLASS_SAMURAI:
                                num = 5; wgt = 70; mul = 4; break;
 
-                               /* Weaponsmith */
                        case CLASS_SMITH:
                                num = 5; wgt = 150; mul = 5; break;
 
-                               /* Warrior-Mage */
                        case CLASS_WARRIOR_MAGE:
                        case CLASS_RED_MAGE:
                                num = 5; wgt = 70; mul = 3; break;
 
-                               /* Chaos Warrior */
                        case CLASS_CHAOS_WARRIOR:
                                num = 5; wgt = 70; mul = 4; break;
 
-                               /* Monk */
                        case CLASS_MONK:
                                num = 5; wgt = 60; mul = 3; break;
 
-                               /* Tourist */
                        case CLASS_TOURIST:
                                num = 4; wgt = 100; mul = 3; break;
 
-                               /* Imitator */
                        case CLASS_IMITATOR:
                                num = 5; wgt = 70; mul = 4; break;
 
-                               /* Beastmaster */
                        case CLASS_BEASTMASTER:
                                num = 5; wgt = 70; mul = 3; break;
 
-                               /* Cavalry */
                        case CLASS_CAVALRY:
                                if ((p_ptr->riding) && (have_flag(flgs, TR_RIDING))) { num = 5; wgt = 70; mul = 4; }
                                else { num = 5; wgt = 100; mul = 3; }
                                break;
 
-                               /* Sorcerer */
                        case CLASS_SORCERER:
                                num = 1; wgt = 1; mul = 1; break;
 
-                               /* Archer, Bard, Sniper */
                        case CLASS_ARCHER:
                        case CLASS_BARD:
                        case CLASS_SNIPER:
                                num = 4; wgt = 70; mul = 2; break;
 
-                               /* ForceTrainer */
                        case CLASS_FORCETRAINER:
                                num = 4; wgt = 60; mul = 2; break;
 
-                               /* Mirror Master */
                        case CLASS_MIRROR_MASTER:
                                num = 3; wgt = 100; mul = 3; break;
 
-                               /* Ninja */
                        case CLASS_NINJA:
                                num = 4; wgt = 20; mul = 1; break;
                        }
@@ -2663,7 +2644,7 @@ void calc_bonuses(void)
                if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE;
        }
 
-       for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
+       for (this_o_idx = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                o_ptr = &o_list[this_o_idx];
 
@@ -2836,8 +2817,8 @@ static void calc_torch(void)
        }
 
        /* max radius is 14 (was 5) without rewriting other code -- */
-       /* see cave.c:update_lite() and defines.h:LITE_MAX */
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
+       /* see current_floor->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;
 
        /*
@@ -3698,8 +3679,6 @@ void update_creature(player_type *creature_ptr)
                creature_ptr->update &= ~(PU_AUTODESTROY);
                autopick_delayed_alter();
        }
-
-       /* Combine the pack */
        if (creature_ptr->update & (PU_COMBINE))
        {
                creature_ptr->update &= ~(PU_COMBINE);
@@ -3812,3 +3791,56 @@ void update_creature(player_type *creature_ptr)
                update_monsters(FALSE);
        }
 }
+
+/*!
+ * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
+ * @return 魔道書を一冊も持っていないならTRUEを返す
+ */
+bool player_has_no_spellbooks(void)
+{
+       int i;
+       object_type *o_ptr;
+
+       for (i = 0; i < INVEN_PACK; i++)
+       {
+               o_ptr = &inventory[i];
+               if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
+       }
+
+       for (i = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
+       {
+               o_ptr = &o_list[i];
+               if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
+       }
+
+       return TRUE;
+}
+
+void take_turn(player_type *creature_ptr, PERCENTAGE need_cost)
+{
+       creature_ptr->energy_use = (ENERGY)need_cost;
+}
+
+void free_turn(player_type *creature_ptr)
+{
+       creature_ptr->energy_use = 0;
+}
+
+/*!
+ * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
+ * @param x 配置先X座標
+ * @param y 配置先Y座標
+ * @return 配置に成功したらTRUE
+ */
+bool player_place(POSITION y, POSITION x)
+{
+       /* Paranoia XXX XXX */
+       if (current_floor->grid_array[y][x].m_idx != 0) return FALSE;
+
+       /* Save player location */
+       p_ptr->y = y;
+       p_ptr->x = x;
+
+       /* Success */
+       return TRUE;
+}