OSDN Git Service

It's not currently used in hengband, but bring over the change to mouse event handlin...
[hengbandforosx/hengbandosx.git] / src / effects.c
index 4d42011..2bb9f95 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,24 +50,24 @@ void set_action(ACTION_IDX typ)
                        }
                        case ACTION_REST:
                        {
-                               resting = 0;
+                               p_ptr->resting = 0;
                                break;
                        }
                        case ACTION_LEARN:
                        {
-                               msg_print(_("学習をやめた。", "You stop Learning"));
+                               msg_print(_("学習をやめた。", "You stop learning."));
                                new_mane = FALSE;
                                break;
                        }
                        case ACTION_KAMAE:
                        {
-                               msg_print(_("構えをといた。", "You stop assuming the posture."));
+                               msg_print(_("構えをといた。", "You stop assuming the special stance."));
                                p_ptr->special_defense &= ~(KAMAE_MASK);
                                break;
                        }
                        case ACTION_KATA:
                        {
-                               msg_print(_("型を崩した。", "You stop assuming the posture."));
+                               msg_print(_("型を崩した。", "You stop assuming the special stance."));
                                p_ptr->special_defense &= ~(KATA_MASK);
                                p_ptr->update |= (PU_MONSTERS);
                                p_ptr->redraw |= (PR_STATUS);
@@ -77,12 +81,12 @@ void set_action(ACTION_IDX typ)
                        case ACTION_HAYAGAKE:
                        {
                                msg_print(_("足が重くなった。", "You are no longer walking extremely fast."));
-                               take_turn(p_ptr, 100);;
+                               take_turn(p_ptr, 100);
                                break;
                        }
                        case ACTION_SPELL:
                        {
-                               msg_print(_("呪文の詠唱を中断した。", "You stopped spelling all spells."));
+                               msg_print(_("呪文の詠唱を中断した。", "You stopped casting."));
                                break;
                        }
                }
@@ -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)
@@ -104,7 +108,7 @@ void set_action(ACTION_IDX typ)
                }
                case ACTION_LEARN:
                {
-                       msg_print(_("学習を始めた。", "You begin Learning"));
+                       msg_print(_("学習を始めた。", "You begin learning"));
                        break;
                }
                case ACTION_FISH:
@@ -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;
@@ -267,7 +271,7 @@ void dispel_player(void)
 
        if (music_singing_any() || hex_spelling_any())
        {
-               concptr str = (music_singing_any()) ? _("歌", "singing") : _("呪文", "spelling");
+               concptr str = (music_singing_any()) ? _("歌", "singing") : _("呪文", "casting");
                INTERUPTING_SONG_EFFECT(p_ptr) = SINGING_SONG_EFFECT(p_ptr);
                SINGING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
                msg_format(_("%sが途切れた。", "Your %s is interrupted."), str);
@@ -430,7 +434,7 @@ bool set_confused(TIME_EFFECT v)
 
                        if (p_ptr->action == ACTION_LEARN)
                        {
-                               msg_print(_("学習が続けられない!", "You cannot continue Learning!"));
+                               msg_print(_("学習が続けられない!", "You cannot continue learning!"));
                                new_mane = FALSE;
 
                                p_ptr->redraw |= (PR_STATE);
@@ -438,7 +442,7 @@ bool set_confused(TIME_EFFECT v)
                        }
                        if (p_ptr->action == ACTION_KAMAE)
                        {
-                               msg_print(_("構えがとけた。", "Your posture gets loose."));
+                               msg_print(_("構えがとけた。", "You lose your stance."));
                                p_ptr->special_defense &= ~(KAMAE_MASK);
                                p_ptr->update |= (PU_BONUS);
                                p_ptr->redraw |= (PR_STATE);
@@ -446,7 +450,7 @@ bool set_confused(TIME_EFFECT v)
                        }
                        else if (p_ptr->action == ACTION_KATA)
                        {
-                               msg_print(_("型が崩れた。", "Your posture gets loose."));
+                               msg_print(_("型が崩れた。", "You lose your stance."));
                                p_ptr->special_defense &= ~(KATA_MASK);
                                p_ptr->update |= (PU_BONUS);
                                p_ptr->update |= (PU_MONSTERS);
@@ -557,7 +561,7 @@ bool set_afraid(TIME_EFFECT v)
 
                        if (p_ptr->special_defense & KATA_MASK)
                        {
-                               msg_print(_("型が崩れた。", "Your posture gets loose."));
+                               msg_print(_("型が崩れた。", "You lose your stance."));
                                p_ptr->special_defense &= ~(KATA_MASK);
                                p_ptr->update |= (PU_BONUS);
                                p_ptr->update |= (PU_MONSTERS);
@@ -778,7 +782,7 @@ bool set_lightspeed(TIME_EFFECT v, bool do_dec)
                }
                else if (!p_ptr->lightspeed)
                {
-                       msg_print(_("非常に素早く動けるようになった!", "You feel yourself moving extremely faster!"));
+                       msg_print(_("非常に素早く動けるようになった!", "You feel yourself moving extremely fast!"));
                        notice = TRUE;
                        chg_virtue(V_PATIENCE, -1);
                        chg_virtue(V_DILIGENCE, 1);
@@ -1146,7 +1150,7 @@ bool set_shero(TIME_EFFECT v, bool do_dec)
        {
                if (p_ptr->shero)
                {
-                       msg_print(_("野蛮な気持ちが消え失せた。", "You feel less Berserk."));
+                       msg_print(_("野蛮な気持ちが消え失せた。", "You feel less berserk."));
                        notice = TRUE;
                }
        }
@@ -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;
@@ -1732,7 +1736,7 @@ bool set_tim_sh_touki(TIME_EFFECT v, bool do_dec)
                }
                else if (!p_ptr->tim_sh_touki)
                {
-                       msg_print(_("体が闘気のオーラで覆われた。", "You have enveloped by the aura of the Force!"));
+                       msg_print(_("体が闘気のオーラで覆われた。", "You are enveloped by an aura of the Force!"));
                        notice = TRUE;
                }
        }
@@ -1742,7 +1746,7 @@ bool set_tim_sh_touki(TIME_EFFECT v, bool do_dec)
        {
                if (p_ptr->tim_sh_touki)
                {
-                       msg_print(_("闘気が消えた。", "Aura of the Force disappeared."));
+                       msg_print(_("闘気が消えた。", "The aura of the Force disappeared."));
                        notice = TRUE;
                }
        }
@@ -1781,7 +1785,7 @@ bool set_tim_sh_fire(TIME_EFFECT v, bool do_dec)
                }
                else if (!p_ptr->tim_sh_fire)
                {
-                       msg_print(_("体が炎のオーラで覆われた。", "You have enveloped by fiery aura!"));
+                       msg_print(_("体が炎のオーラで覆われた。", "You are enveloped by a fiery aura!"));
                        notice = TRUE;
                }
        }
@@ -1791,7 +1795,7 @@ bool set_tim_sh_fire(TIME_EFFECT v, bool do_dec)
        {
                if (p_ptr->tim_sh_fire)
                {
-                       msg_print(_("炎のオーラが消えた。", "Fiery aura disappeared."));
+                       msg_print(_("炎のオーラが消えた。", "The fiery aura disappeared."));
                        notice = TRUE;
                }
        }
@@ -1831,7 +1835,7 @@ bool set_tim_sh_holy(TIME_EFFECT v, bool do_dec)
                }
                else if (!p_ptr->tim_sh_holy)
                {
-                       msg_print(_("体が聖なるオーラで覆われた。", "You have enveloped by holy aura!"));
+                       msg_print(_("体が聖なるオーラで覆われた。", "You are enveloped by a holy aura!"));
                        notice = TRUE;
                }
        }
@@ -1841,7 +1845,7 @@ bool set_tim_sh_holy(TIME_EFFECT v, bool do_dec)
        {
                if (p_ptr->tim_sh_holy)
                {
-                       msg_print(_("聖なるオーラが消えた。", "Holy aura disappeared."));
+                       msg_print(_("聖なるオーラが消えた。", "The holy aura disappeared."));
                        notice = TRUE;
                }
        }
@@ -2130,7 +2134,7 @@ bool set_kabenuke(TIME_EFFECT v, bool do_dec)
                }
                else if (!p_ptr->kabenuke)
                {
-                       msg_print(_("体が半物質の状態になった。", "You became ethereal form."));
+                       msg_print(_("体が半物質の状態になった。", "You became ethereal."));
                        notice = TRUE;
                }
        }
@@ -2140,7 +2144,7 @@ bool set_kabenuke(TIME_EFFECT v, bool do_dec)
        {
                if (p_ptr->kabenuke)
                {
-                       msg_print(_("体が物質化した。", "You are no longer in an ethereal form."));
+                       msg_print(_("体が物質化した。", "You are no longer ethereal."));
                        notice = TRUE;
                }
        }
@@ -2191,7 +2195,7 @@ bool set_tsuyoshi(TIME_EFFECT v, bool do_dec)
        {
                if (p_ptr->tsuyoshi)
                {
-                       msg_print(_("肉体が急速にしぼんでいった。", "Your body had quickly shriveled."));
+                       msg_print(_("肉体が急速にしぼんでいった。", "Your body has quickly shriveled."));
 
                        (void)dec_stat(A_CON, 20, TRUE);
                        (void)dec_stat(A_STR, 20, TRUE);
@@ -2699,7 +2703,7 @@ bool set_stun(TIME_EFFECT v)
                }
                if (p_ptr->special_defense & KATA_MASK)
                {
-                       msg_print(_("型が崩れた。", "Your posture gets loose."));
+                       msg_print(_("型が崩れた。", "You lose your stance."));
                        p_ptr->special_defense &= ~(KATA_MASK);
                        p_ptr->update |= (PU_BONUS);
                        p_ptr->update |= (PU_MONSTERS);
@@ -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 */
@@ -3419,12 +3419,12 @@ bool hp_player(int num)
  */
 static concptr desc_stat_pos[] =
 {
-       _("強く", "strong"),
-       _("知的に", "smart"),
-       _("賢く", "wise"),
-       _("器用に", "dextrous"),
-       _("健康に", "healthy"),
-       _("美しく", "cute")
+       _("強く", "stronger"),
+       _("知的に", "smarter"),
+       _("賢く", "wiser"),
+       _("器用に", "more dextrous"),
+       _("健康に", "healthier"),
+       _("美しく", "cuter")
 };
 
 
@@ -3433,12 +3433,12 @@ static concptr desc_stat_pos[] =
  */
 static concptr desc_stat_neg[] =
 {
-       _("弱く", "weak"),
-       _("無知に", "stupid"),
-       _("愚かに", "naive"),
-       _("不器用に", "clumsy"),
-       _("不健康に", "sickly"),
-       _("醜く", "ugly")
+       _("弱く", "weaker"),
+       _("無知に", "stupider"),
+       _("愚かに", "more naive"),
+       _("不器用に", "clumsier"),
+       _("不健康に", "more sickly"),
+       _("醜く", "uglier")
 };
 
 
@@ -3473,7 +3473,7 @@ bool do_dec_stat(int stat)
        /* Attempt to reduce the stat */
        if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
        {
-               msg_format(_("ひどく%sなった気がする。", "You feel very %s."), desc_stat_neg[stat]);
+               msg_format(_("ひどく%sなった気がする。", "You feel %s."), desc_stat_neg[stat]);
 
                /* Notice effect */
                return (TRUE);
@@ -3492,7 +3492,7 @@ bool do_res_stat(int stat)
        /* Attempt to increase */
        if (res_stat(stat))
        {
-               msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
+               msg_format(_("元通りに%sなった気がする。", "You feel %s."), desc_stat_pos[stat]);
 
                return (TRUE);
        }
@@ -3528,7 +3528,7 @@ bool do_inc_stat(int stat)
                else if (stat == A_CON)
                        chg_virtue(V_VITALITY, 1);
 
-               msg_format(_("ワーオ!とても%sなった!", "Wow!  You feel very %s!"), desc_stat_pos[stat]);
+               msg_format(_("ワーオ!とても%sなった!", "Wow!  You feel %s!"), desc_stat_pos[stat]);
 
                return (TRUE);
        }
@@ -3536,7 +3536,7 @@ bool do_inc_stat(int stat)
        /* Restoration worked */
        if (res)
        {
-               msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
+               msg_format(_("元通りに%sなった気がする。", "You feel %s."), desc_stat_pos[stat]);
 
                return (TRUE);
        }
@@ -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(0L);
+       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(0L);
+               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;
                }
        }
 
@@ -3906,7 +3904,7 @@ int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
                        }
                        else if (damage_type == DAMAGE_ATTACK)
                        {
-                               msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
+                               msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, but you are unharmed!"));
                                return 0;
                        }
                }
@@ -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! ***"));
@@ -4582,10 +4578,10 @@ bool choose_ele_immune(TIME_EFFECT immune_turn)
        char choice;
        screen_save();
 
-       c_prt(TERM_RED,    _("        a) 火炎", "        a) Immune Fire"), 2, 14);
-       c_prt(TERM_L_WHITE,_("        b) 冷気", "        b) Immune Cold"), 3, 14);
-       c_prt(TERM_L_DARK, _("        c) 酸", "        c) Immune Acid"), 4, 14);
-       c_prt(TERM_BLUE,   _("        d) 電撃", "        d) Immune Elec"), 5, 14);
+       c_prt(TERM_RED,    _("        a) 火炎", "        a) Immunity to fire"), 2, 14);
+       c_prt(TERM_L_WHITE,_("        b) 冷気", "        b) Immunity to cold"), 3, 14);
+       c_prt(TERM_L_DARK, _("        c) 酸", "        c) Immunity to acid"), 4, 14);
+       c_prt(TERM_BLUE,   _("        d) 電撃", "        d) Immunity to elec"), 5, 14);
 
        prt("", 6, 14);
        prt("", 7, 14);
@@ -4593,7 +4589,7 @@ bool choose_ele_immune(TIME_EFFECT immune_turn)
        prt("", 9, 14);
 
        prt("", 1, 0);
-       prt(_("        どの元素の免疫をつけますか?", "        Choose a temporary elemental immune "), 1, 14);
+       prt(_("        どの元素の免疫をつけますか?", "        Choose a temporary elemental immunity "), 1, 14);
 
        choice = inkey();
 
@@ -4607,7 +4603,7 @@ bool choose_ele_immune(TIME_EFFECT immune_turn)
                set_ele_immune(DEFENSE_ELEC, immune_turn);
        else
        {
-               msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immune."));
+               msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immunity."));
                screen_load();
                return FALSE;
        }