OSDN Git Service

[Refactor] #37353 monster_desc() の宣言を monster.h に移動。
[hengband/hengband.git] / src / spells-status.c
index 4b9dfdd..a347462 100644 (file)
@@ -4,6 +4,7 @@
 #include "spells-status.h"
 #include "projection.h"
 #include "spells.h"
+#include "monster.h"
 
 /*!
  * @brief モンスター回復処理
@@ -406,10 +407,10 @@ bool fishing(player_type *creature_ptr)
                msg_print(_("そこは水辺ではない。", "There is no fishing place."));
                return FALSE;
        }
-       else if (current_floor->grid_array[y][x].m_idx)
+       else if (current_floor_ptr->grid_array[y][x].m_idx)
        {
                GAME_TEXT m_name[MAX_NLEN];
-               monster_desc(m_name, &m_list[current_floor->grid_array[y][x].m_idx], 0);
+               monster_desc(m_name, &current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
                msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
                free_turn(creature_ptr);
                return FALSE;
@@ -433,15 +434,13 @@ bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr)
        {
                if (o_ptr == &inventory[inv]) break;
        }
-
-       /* Paranoia */
        if (inv > INVEN_FEET) return FALSE;
 
        object_copy(&forge, o_ptr);
        inven_item_increase(inv, (0 - o_ptr->number));
        inven_item_optimize(inv);
        o_idx = drop_near(&forge, 0, creature_ptr->y, creature_ptr->x);
-       o_ptr = &o_list[o_idx];
+       o_ptr = &current_floor_ptr->o_list[o_idx];
 
        object_desc(o_name, o_ptr, OD_NAME_ONLY);
        msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
@@ -465,3 +464,83 @@ bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr)
 
        return TRUE;
 }
+
+
+/*!
+ * @brief プレイヤーの因果混乱処理 / Apply Nexus
+ * @param m_ptr 因果混乱をプレイヤーに与えたモンスターの情報参照ポインタ
+ * @return なし
+ */
+void apply_nexus(monster_type *m_ptr)
+{
+       switch (randint1(7))
+       {
+       case 1: case 2: case 3:
+       {
+               teleport_player(200, TELEPORT_PASSIVE);
+               break;
+       }
+
+       case 4: case 5:
+       {
+               teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
+               break;
+       }
+
+       case 6:
+       {
+               if (randint0(100) < p_ptr->skill_sav)
+               {
+                       msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
+                       break;
+               }
+               teleport_level(0);
+               break;
+       }
+
+       case 7:
+       {
+               if (randint0(100) < p_ptr->skill_sav)
+               {
+                       msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
+                       break;
+               }
+
+               msg_print(_("体がねじれ始めた...", "Your body starts to scramble..."));
+               status_shuffle();
+               break;
+       }
+       }
+}
+
+/*!
+ * @brief プレイヤーのステータスシャッフル処理
+ * @return なし
+ */
+void status_shuffle(void)
+{
+       BASE_STATUS max1, cur1, max2, cur2;
+       int ii, jj, i;
+
+       /* Pick a pair of stats */
+       ii = randint0(A_MAX);
+       for (jj = ii; jj == ii; jj = randint0(A_MAX)) /* loop */;
+
+       max1 = p_ptr->stat_max[ii];
+       cur1 = p_ptr->stat_cur[ii];
+       max2 = p_ptr->stat_max[jj];
+       cur2 = p_ptr->stat_cur[jj];
+
+       p_ptr->stat_max[ii] = max2;
+       p_ptr->stat_cur[ii] = cur2;
+       p_ptr->stat_max[jj] = max1;
+       p_ptr->stat_cur[jj] = cur1;
+
+       for (i = 0; i < A_MAX; i++)
+       {
+               if (p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
+               if (p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
+       }
+
+       p_ptr->update |= (PU_BONUS);
+}