OSDN Git Service

[Refactor] #37353 monster_name() を monster.h へ移動。
[hengband/hengband.git] / src / effects.c
index 03a1c7d..e125852 100644 (file)
 #include "player-status.h"
 #include "spells-status.h"
 #include "realm-hex.h"
+#include "object-hook.h"
+#include "wild.h"
+#include "spells-floor.h"
+#include "player-move.h"
 
 /*!
  * @brief プレイヤーの継続行動を設定する。
@@ -46,7 +50,7 @@ void set_action(ACTION_IDX typ)
                        }
                        case ACTION_REST:
                        {
-                               resting = 0;
+                               p_ptr->resting = 0;
                                break;
                        }
                        case ACTION_LEARN:
@@ -77,7 +81,7 @@ void set_action(ACTION_IDX typ)
                        case ACTION_HAYAGAKE:
                        {
                                msg_print(_("足が重くなった。", "You are no longer walking extremely fast."));
-                               p_ptr->energy_use = 100;
+                               take_turn(p_ptr, 100);
                                break;
                        }
                        case ACTION_SPELL:
@@ -91,7 +95,7 @@ void set_action(ACTION_IDX typ)
        p_ptr->action = typ;
 
        /* If we are requested other action, stop singing */
-       if (prev_typ == ACTION_SING) stop_singing();
+       if (prev_typ == ACTION_SING) stop_singing(p_ptr);
        if (prev_typ == ACTION_SPELL) stop_hex_spell();
 
        switch (p_ptr->action)
@@ -191,7 +195,7 @@ void reset_tim_flags(void)
        p_ptr->special_defense = 0L;
 
        while(p_ptr->energy_need < 0) p_ptr->energy_need += ENERGY_NEED();
-       world_player = FALSE;
+       p_ptr->timewalk = FALSE;
 
        if (prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) p_ptr->oppose_fire = 1;
        if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) p_ptr->oppose_pois = 1;
@@ -1238,7 +1242,7 @@ bool set_wraith_form(TIME_EFFECT v, bool do_dec)
                }
                else if (!p_ptr->wraith_form)
                {
-                       msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and turn into a wraith-being!"));
+                       msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and current_world_ptr->game_turn into a wraith-being!"));
                        notice = TRUE;
                        chg_virtue(V_UNLIFE, 3);
                        chg_virtue(V_HONOUR, -2);
@@ -1621,7 +1625,7 @@ bool set_superstealth(bool set)
        {
                if (!(p_ptr->special_defense & NINJA_S_STEALTH))
                {
-                       if (cave[p_ptr->y][p_ptr->x].info & CAVE_MNLT)
+                       if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_MNLT)
                        {
                                msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes."));
                                p_ptr->monlite = p_ptr->old_monlite = TRUE;
@@ -3162,8 +3166,6 @@ bool inc_stat(int stat)
                {
                        /* Approximate gain value */
                        gain = (((p_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
-
-                       /* Paranoia */
                        if (gain < 1) gain = 1;
 
                        /* Apply the bonus */
@@ -3247,8 +3249,6 @@ bool dec_stat(int stat, int amount, int permanent)
                        /* and one-half of the stat bonus times the percentage, with a */
                        /* minimum damage of half the percentage. -CWS */
                        loss = (((cur-18) / 2 + 1) / 2 + 1);
-
-                       /* Paranoia */
                        if (loss < 1) loss = 1;
 
                        /* Randomize the loss */
@@ -3652,7 +3652,7 @@ void change_race(CHARACTER_IDX new_race, concptr effect_msg)
 #ifdef JP
        msg_format("あなたは%s%sに変化した!", effect_msg, title);
 #else
-       msg_format("You turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
+       msg_format("You current_world_ptr->game_turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
 #endif
 
        chg_virtue(V_CHANCE, 2);
@@ -3687,7 +3687,7 @@ void change_race(CHARACTER_IDX new_race, concptr effect_msg)
        else
                p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
 
-       do_cmd_rerate(FALSE);
+       roll_hitdice(p_ptr, 0L);
 
        /* The experience level may be modified */
        check_experience();
@@ -3817,13 +3817,13 @@ void do_poly_self(void)
                power -= 10;
 
                get_max_stats();
-               do_cmd_rerate(FALSE);
+               roll_hitdice(p_ptr, 0L);
        }
 
        while ((power > randint0(15)) && one_in_(3))
        {
                power -= 7;
-               (void)gain_random_mutation(0);
+               (void)gain_mutation(p_ptr, 0);
        }
 
        if (power > randint0(5))
@@ -3835,7 +3835,7 @@ void do_poly_self(void)
        /* Note: earlier deductions may have left power < 0 already. */
        while (power > 0)
        {
-               mutate_player();
+               status_shuffle();
                power--;
        }
 }
@@ -3859,8 +3859,6 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
        char tmp[1024];
 
        int warning = (p_ptr->mhp * hitpoint_warn / 10);
-
-       /* Paranoia */
        if (p_ptr->is_dead) return 0;
 
        if (p_ptr->sutemi) damage *= 2;
@@ -3873,7 +3871,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
                disturb(TRUE, TRUE);
                if (auto_more)
                {
-                       now_damaged = TRUE;
+                       p_ptr->now_damaged = TRUE;
                }
        }
 
@@ -3965,8 +3963,6 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
                chg_virtue(V_SACRIFICE, 10);
 
                handle_stuff();
-
-               /* Leaving */
                p_ptr->leaving = TRUE;
 
                /* Note death */
@@ -3981,7 +3977,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
                }
                else
                {
-                       QUEST_IDX q_idx = quest_number(dun_level);
+                       QUEST_IDX q_idx = quest_number(current_floor_ptr->dun_level);
                        bool seppuku = streq(hit_from, "Seppuku");
                        bool winning_seppuku = p_ptr->total_winner && seppuku;
 
@@ -4024,13 +4020,13 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
 
                                if (p_ptr->inside_arena)
                                        strcpy(buf,_("アリーナ", "in the Arena"));
-                               else if (!dun_level)
+                               else if (!current_floor_ptr->dun_level)
                                        strcpy(buf,_("地上", "on the surface"));
                                else if (q_idx && (is_fixed_quest_idx(q_idx) &&
                                         !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
                                        strcpy(buf,_("クエスト", "in a quest"));
                                else
-                                       sprintf(buf,_("%d階", "level %d"), (int)dun_level);
+                                       sprintf(buf,_("%d階", "level %d"), (int)current_floor_ptr->dun_level);
 
                                sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, p_ptr->died_from);
                                do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
@@ -4179,7 +4175,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
                if (auto_more)
                {
                        /* stop auto_more even if DAMAGE_USELIFE */
-                       now_damaged = TRUE;
+                       p_ptr->now_damaged = TRUE;
                }
 
                msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***"));