OSDN Git Service

[Refactor] #37353 盲目時のコマンド制限処理を cmd_limit_confused() に統合。 / Integrate command limitat...
[hengband/hengband.git] / src / wizard2.c
index d3eefca..c0ec8b2 100644 (file)
 #include "angband.h"
 #include "floor.h"
 #include "selfinfo.h"
+#include "patron.h"
+#include "mutation.h"
+#include "quest.h"
+#include "artifact.h"
+#include "player-status.h"
 
-
-/*!
- * @brief プレイヤーのヒットダイスを振り直す / Roll the hitdie -- aux of do_cmd_rerate()
- * @return なし
- */
-void do_cmd_rerate_aux(void)
-{
-       /* Minimum hitpoints at highest level */
-       HIT_POINT min_value = p_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (p_ptr->hitdie + 1)) * 3 / 8;
-
-       /* Maximum hitpoints at highest level */
-       HIT_POINT max_value = p_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (p_ptr->hitdie + 1)) * 5 / 8;
-
-       int i;
-
-       /* Rerate */
-       while (1)
-       {
-               /* Pre-calculate level 1 hitdice */
-               p_ptr->player_hp[0] = (HIT_POINT)p_ptr->hitdie;
-
-               for (i = 1; i < 4; i++)
-               {
-                       p_ptr->player_hp[0] += randint1(p_ptr->hitdie);
-               }
-
-               /* Roll the hitpoint values */
-               for (i = 1; i < PY_MAX_LEVEL; i++)
-               {
-                       p_ptr->player_hp[i] = p_ptr->player_hp[i - 1] + randint1(p_ptr->hitdie);
-               }
-
-               /* Require "valid" hitpoints at highest level */
-               if ((p_ptr->player_hp[PY_MAX_LEVEL - 1] >= min_value) &&
-                   (p_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break;
-       }
-}
-
-
-/*!
- * @brief プレイヤーのヒットダイスを振り直した後明示を行う / Hack -- Rerate Hitpoints
- * @param display TRUEならば体力ランクを明示する
- * @return なし
- */
-void do_cmd_rerate(bool display)
-{
-       PERCENTAGE percent;
-
-       /* Rerate */
-       do_cmd_rerate_aux();
-
-       percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
-               (2 * p_ptr->hitdie + ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
-
-
-       /* Update and redraw hitpoints */
-       p_ptr->update |= (PU_HP);
-       p_ptr->redraw |= (PR_HP);
-       p_ptr->window |= (PW_PLAYER);
-       handle_stuff();
-
-       if (display)
-       {
-               msg_format(_("現在の体力ランクは %d/100 です。", "Your life rate is %d/100 now."), percent);
-               p_ptr->knowledge |= KNOW_HPRATE;
-       }
-       else
-       {
-               msg_print(_("体力ランクが変わった。", "Life rate is changed."));
-               p_ptr->knowledge &= ~(KNOW_HPRATE);
-       }
-}
-
+#include "spells.h"
+#include "spells-object.h"
+#include "spells-summon.h"
+#include "spells-status.h"
 
 #ifdef ALLOW_WIZARD
 
@@ -390,7 +326,7 @@ static void do_cmd_wiz_change_aux(void)
                else if (tmp_int < 3) tmp_int = 3;
 
                /* Save it */
-               p_ptr->stat_cur[i] = p_ptr->stat_max[i] = (s16b)tmp_int;
+               p_ptr->stat_cur[i] = p_ptr->stat_max[i] = (BASE_STATUS)tmp_int;
        }
 
 
@@ -975,8 +911,6 @@ static void wiz_reroll_item(object_type *o_ptr)
                /* Apply changes */
                object_copy(o_ptr, q_ptr);
                p_ptr->update |= (PU_BONUS);
-
-               /* Combine / Reorder the pack (later) */
                p_ptr->update |= (PU_COMBINE | PU_REORDER);
 
                p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
@@ -1315,8 +1249,6 @@ static void do_cmd_wiz_play(void)
                object_copy(o_ptr, q_ptr);
 
                p_ptr->update |= (PU_BONUS);
-
-               /* Combine / Reorder the pack (later) */
                p_ptr->update |= (PU_COMBINE | PU_REORDER);
 
                p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
@@ -1424,7 +1356,7 @@ static void do_cmd_wiz_jump(void)
                sprintf(ppp, "Jump which dungeon : ");
 
                /* Default */
-               sprintf(tmp_val, "%d", dungeon_type);
+               sprintf(tmp_val, "%d", p_ptr->dungeon_idx);
 
                /* Ask for a level */
                if (!get_string(ppp, tmp_val, 2)) return;
@@ -1445,12 +1377,12 @@ static void do_cmd_wiz_jump(void)
                /* Extract request */
                command_arg = (COMMAND_ARG)atoi(tmp_val);
 
-               dungeon_type = tmp_dungeon_type;
+               p_ptr->dungeon_idx = tmp_dungeon_type;
        }
 
        /* Paranoia */
-       if (command_arg < d_info[dungeon_type].mindepth) command_arg = 0;
-       if (command_arg > d_info[dungeon_type].maxdepth) command_arg = (COMMAND_ARG)d_info[dungeon_type].maxdepth;
+       if (command_arg < d_info[p_ptr->dungeon_idx].mindepth) command_arg = 0;
+       if (command_arg > d_info[p_ptr->dungeon_idx].maxdepth) command_arg = (COMMAND_ARG)d_info[p_ptr->dungeon_idx].maxdepth;
 
        /* Accept request */
        msg_format("You jump to dungeon level %d.", command_arg);
@@ -1462,7 +1394,7 @@ static void do_cmd_wiz_jump(void)
 
        prepare_change_floor_mode(CFM_RAND_PLACE);
 
-       if (!dun_level) dungeon_type = 0;
+       if (!dun_level) p_ptr->dungeon_idx = 0;
        p_ptr->inside_arena = FALSE;
        p_ptr->wild_mode = FALSE;
 
@@ -1471,7 +1403,7 @@ static void do_cmd_wiz_jump(void)
        if (record_stair) do_cmd_write_nikki(NIKKI_WIZ_TELE,0,NULL);
 
        p_ptr->inside_quest = 0;
-       p_ptr->energy_use = 0;
+       free_turn(p_ptr);
 
        /* Prevent energy_need from being too lower than 0 */
        p_ptr->energy_need = 0;
@@ -1899,7 +1831,7 @@ void do_cmd_debug(void)
 
        /* Hitpoint rerating */
        case 'h':
-               do_cmd_rerate(TRUE);
+               roll_hitdice(SPOP_DISPLAY_MES | SPOP_DEBUG);
                break;
 
        case 'H':
@@ -2165,8 +2097,8 @@ void cheat_death(player_type *creature_ptr)
        creature_ptr->inside_battle = FALSE;
        leaving_quest = 0;
        creature_ptr->inside_quest = 0;
-       if (dungeon_type) creature_ptr->recall_dungeon = dungeon_type;
-       dungeon_type = 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;