OSDN Git Service

Added a "the" in the English description of the berserker detection spell in order...
[hengbandforosx/hengbandosx.git] / src / mind.c
index 2f27dd2..dd0d86e 100644 (file)
@@ -22,6 +22,9 @@
 #include "player-status.h"
 #include "spells-status.h"
 #include "cmd-spell.h"
+#include "spells-floor.h"
+#include "feature.h"
+#include "grid.h"
 
 /*! 特殊技能の一覧テーブル */
 mind_power const mind_powers[5] =
@@ -414,20 +417,20 @@ static concptr const mind_tips[5][MAX_MIND_POWERS] =
 },
 #else
 {
-       "Detects visible monsters in your vicinity and more and more. Detects traps and doors at level 5, invisible monsters at level 15, items at level 30. And magic mapping at level 20. Lights and know the whole level at level 45. Gives telepathy at level 25.",
+       "Detects visible monsters in your vicinity. Detects traps and doors at level 5, invisible monsters at level 15, and items at level 30. Gives telepathy at level 25. Magically maps the surroundings at level 20. Lights and reveals the whole level at level 45.",
        "Fires a beam or ball which inflicts PSI damage.",
-       "Teleport short distance.",
-       "Teleport long distance.",
+       "Teleports you a short distance.",
+       "Teleports you a long distance.",
        "Stuns, confuses or scares a monster. Or attempts to charm all monsters in sight at level 30.",
        "Fires a ball which hurts monsters with telekinesis.",
-       "Gives stone skin and some resistance to elements for a while. The level increased, the more number of resistances given.",
-       "Gives feeling of an item. Or identify an item at level 25.",
-       "Generate a ball centered on you which inflict monster with PSI damage. Or inflict all monsters with PSI damage at level 25.",
-       "Removes fear and stun. Gives heroism and speed. Heals HP a little unless you already have heroism and temporal speed boost.",
+       "Gives stone skin and some resistance to elements for a while. As your level increases, more resistances are given.",
+       "Gives feeling of an item. Or identifies an item at level 25.",
+       "Generates a ball centered on you which inflicts PSI damage on a monster or, at level 25 and higher, inflicts PSI damage on all monsters.",
+       "Removes fear and being stunned. Gives heroism and speed. Heals HP a little unless you already have heroism and a temporary speed boost.",
        "Pulls a distant item close to you.",
-       "Fires a ball which damages, co. Absorbing is takes more turns which from 0 to 1.5.",
-       "Fires a beam of pure energy which penetrate the invulnerability barrier.",
-       "Stops time. Consumes all of your SP. The more consumes SP, the longer duration of spell.",
+       "Fires a ball which damages. When not resisted, you gain SP. You will be occupied for 0 to 1.5 turns after casting as your mind recovers.",
+       "Fires a beam of pure energy which penetrates invulnerability barriers.",
+       "Stops time. Consumes all of your SP. The duration of the spell increases as more SP is consumed.",
        "",
        "",
        "",
@@ -442,13 +445,13 @@ static concptr const mind_tips[5][MAX_MIND_POWERS] =
        "Gives levitaion a while.",
        "Fires a short energy beam.",
        "Gives magic resistance for a while.",
-       "Improves spirit energy power temporaly. Improved spirit energy will be more and more powerfull or have longer duration. Too many improving results in uncontrollable explosion of spirit energy.",
-       "Gives aura which damages all monsters which attacked you for a while.",
-       "Damages an adjacent monster, and blow it away.",
+       "Increases your spirit energy temporarily. More spirit energy will boost the effect or duration of your force abilities. Too much spirit energy can result in an explosion.",
+       "Envelops you with a temporary aura that damages any monster which hits you in melee.",
+       "Damages an adjacent monster and blows it away.",
        "Fires a large energy ball.",
-       "Dispels all magics which is effecting a monster.",
+       "Dispels all magics which are affecting a monster.",
        "Summons ghosts.",
-       "Generates a huge ball of frame which centered on you.",
+       "Generates a huge ball of flame centered on you.",
        "Fires a long, powerful energy beam.",
        "Gives extremely fast speed.",
        "",
@@ -460,10 +463,10 @@ static concptr const mind_tips[5][MAX_MIND_POWERS] =
        "",
 },
 {
-       "Detects all monsters except mindless in your vicinity.",
-       "Attacks monster with your weapons normaly, then move through counter side of the monster.",
-       "Sets off a trap, then destroy that trap.",
-       "Shakes dungeon structure, and results in random swaping of floors and walls.",
+       "Detects all monsters except the mindless in your vicinity.",
+       "Attacks a monster with your weapons normally, then dodges to one side.",
+       "Sets off a trap, then destroys that trap.",
+       "Shakes dungeon structure, and results in random swapping of floors and walls.",
        "Attacks all adjacent monsters.",
        "",
        "",
@@ -483,50 +486,50 @@ static concptr const mind_tips[5][MAX_MIND_POWERS] =
        "",
 },
 {
-       "Detects visible monsters in your vicinity and more and more. Detects invisible monsters at level 15. Gives telepathy at level 25. Magic mapping at level 35. All of effects need 4 more levels unless on a mirror.",
+       "Detects visible monsters in your vicinity. Detects invisible monsters at level 15. Gives telepathy at level 25. Magically maps the surroundings at level 35. All of the effects need 4 more levels unless on a mirror.",
        "Makes a mirror under you.",
-       "Fires bolt of flash light. Or fires beam of light on a mirror at level 10.",
-       "Teleport short distance.",
+       "Fires bolt of light. At level ten or higher, the bolt will be a beam of light if you are on a mirror.",
+       "Teleports you a short distance.",
        "Lights up nearby area and the inside of a room permanently.",
-       "Teleport long distance.",
-       "Gives aura of shards of mirror for a while. It cause counter attack to monsters which attacks you.",
+       "Teleports you a long distance.",
+       "Gives a temporary aura of mirror shards. The aura damages any monster that hits you in melee. If you are on a mirror, the aura will teleport you a short distance if a monster hits you in melee.",
        "Teleports all monsters on the line away unless resisted.",
        "Fires a ball of shards.",
-       "Generate balls which send monsters to sleep on all mirrors in the whole level.",
-       "Fires a beam of mana. If the beam hit a mirror, it breaks that mirror and reflects toward another mirror.",
+       "Causes any mirror to lull to sleep monsters close to the mirror.",
+       "Fires a beam of mana. If the beam hits a mirror, it breaks that mirror and bounces toward another mirror.",
        "Eliminates a monster on a mirror from current dungeon level.",
-       "Gives bonus to AC. Gives reflection at level 32. Gives magic resistance at level 40.",
-       "Fires a powerful beam of mana. If the beam hit a mirror, it breaks that mirror and fires 8 beams of mana to 8 different directions from that point.",
+       "Gives bonus to AC. Gives reflection at level 32. Gives magic resistance at level 40.",
+       "Fires a powerful beam of mana. If the beam hits a mirror, it breaks that mirror and fires 8 beams of mana to 8 different directions from that point.",
        "Attempts to slow, stun, confuse, scare, freeze all monsters in sight. Gets more power on a mirror.",
        "Recreates current dungeon level. Can only be used on a mirror.",
-       "Teleport to given location.",
+       "Teleports you to a given location.",
        "Recalls player from dungeon to town, or from town to the deepest level of dungeon.",
        "Completely protects you from any attacks at one in two chance.",
-       "Generates a magical triangle which damages all monsters in the area. The vertices of the triangle is you and two mirrors in sight.",
-       "Generates barrier which completly protect you from almost all damages. Takes a few your turns when the barrier breaks or duration time is exceeded.",
+       "Generates a magical triangle which damages all monsters in the area. The vertices of the triangle are you and two mirrors in sight.",
+       "Generates a barrier which completely protects you from almost all damage. Takes a few of your turns when the barrier breaks or duration time is exceeded.",
 },
 
 {
-       "Darken nearby area and inside of a room.",
-       "Detects visible monsters in your vicinity and more and more. Detects traps, doors and stairs at level 5, items at level 15. Lights and know the whole level at level 45.",
-       "Teleport short distance.",
-       "Teleport as you recieve an attack. Might be able to teleport just before recieveing damages at higher level.",
-       "Teleport long distance.",
-       "Attack and teleport in a time.",
-       "Attempt to freeze a monster.",
+       "Darkens nearby area and inside of a room.",
+       "Detects visible monsters in your vicinity. Detects traps, doors and stairs at level 5. Detects items at level 15. Lights and reveals the whole level at level 45.",
+       "Teleports you a short distance.",
+       "Teleports you as you receive an attack. Might be able to teleport just before receiving damage at higher levels.",
+       "Teleports you a long distance.",
+       "Attacks an adjacent monster and teleports you away immediately after the attack.",
+       "Attempts to freeze a monster.",
        "Identifies an item.",
        "Gives levitation for a while.",
-       "Generate a fire ball and teleport in a time. Gives resistance to fire for a while. This resistance can be added to which from equipment for more powerful resistance.",
+       "Generates a fire ball and immediately teleports you away. Gives resistance to fire for a while. This resistance can be added to that from equipment for more powerful resistance.",
        "Steps close to a monster and attacks at a time.",
        "Shoots 8 iron Spikes in 8 random directions.",
-       "Teleport a monster to a place adjacent to you.",
+       "Teleports a monster to a place adjacent to you.",
        "Releases a confusion ball which doesn't inflict any damage.",
-       "Swaps positions of you and a monster.",
+       "Causes you and a targeted monster to exchange positions.",
        "Sets a glyph under you. The glyph will explode when a monster moves on it.",
-       "Become ethereal form which gives ability to pass walls, and gives resistance to acid for a while. This resistance can be added to which from equipment for more powerful resistance.",
-       "Generates huge balls of poison, drain life and confusion, then teleport in a time.",
+       "Makes you ethereal for a period of time. While ethereal, you can pass through walls and are resistant to acid. The resistance can be added to that from equipment for more powerful resistance.",
+       "Generates huge balls of poison, drain life and confusion. Then immediately teleports you away.",
        "Fires some number of beams of fire, nether or plasma in random directions.",
-       "Creates shadows of yourself which gives you abillity to completely evade any attacks at one in two chance for a while.",
+       "Creates shadows of yourself which gives you the ability to completely evade any attacks at one in two chance for a while.",
        "",
 },
 #endif
@@ -677,9 +680,9 @@ static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse)
        int             num = 0;
        TERM_LEN y = 1;
        TERM_LEN x = 10;
-       int             minfail = 0;
+       PERCENTAGE minfail = 0;
        PLAYER_LEVEL plev = p_ptr->lev;
-       int             chance = 0;
+       PERCENTAGE chance = 0;
        int             ask = TRUE;
        char            choice;
        char            out_val[160];
@@ -759,32 +762,32 @@ static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse)
     /* No redraw yet */
     redraw = FALSE;
 
-    for (i = 0; i < MAX_MIND_POWERS; i++)
+       for (i = 0; i < MAX_MIND_POWERS; i++)
        {
-         if (mind_ptr->info[i].min_lev <= plev)
-           {
-             num++;
-           }
+               if (mind_ptr->info[i].min_lev <= plev)
+               {
+                       num++;
+               }
        }
 
-    /* Build a prompt (accept all spells) */
-    if (only_browse)
+       /* Build a prompt (accept all spells) */
+       if (only_browse)
        {
-               (void) strnfmt(out_val, 78, 
-                                       _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
-                                      p, I2A(0), I2A(num - 1), p);
+               (void)strnfmt(out_val, 78,
+                       _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
+                       p, I2A(0), I2A(num - 1), p);
        }
        else
        {
-               (void) strnfmt(out_val, 78, 
-                                       _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
-                                               p, I2A(0), I2A(num - 1), p);
+               (void)strnfmt(out_val, 78,
+                       _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
+                       p, I2A(0), I2A(num - 1), p);
        }
 
        if (use_menu && !only_browse) screen_save();
-       /* Get a spell from the user */
 
-       choice= (always_show_list || use_menu) ? ESCAPE:1 ;
+       choice = (always_show_list || use_menu) ? ESCAPE : 1;
+
        while (!flag)
        {
                if(choice==ESCAPE) choice = ' '; 
@@ -836,8 +839,6 @@ static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse)
                        {
                                char psi_desc[80];
                                bool has_weapon[2];
-
-                               /* Show list */
                                redraw = TRUE;
                                if (!only_browse && !use_menu) screen_save();
 
@@ -1230,7 +1231,7 @@ static bool cast_force_spell(int spell)
                MONSTER_IDX m_idx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
-               m_idx = grid_array[target_row][target_col].m_idx;
+               m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
                if (!m_idx) break;
                if (!player_has_los_bold(target_row, target_col)) break;
                if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
@@ -1284,9 +1285,9 @@ static int number_of_mirrors(void)
 {
        POSITION x, y;
        int val = 0;
-       for (x = 0; x < cur_wid; x++) {
-               for (y = 0; y < cur_hgt; y++) {
-                       if (is_mirror_grid(&grid_array[y][x])) val++;
+       for (x = 0; x < current_floor_ptr->width; x++) {
+               for (y = 0; y < current_floor_ptr->height; y++) {
+                       if (is_mirror_grid(&current_floor_ptr->grid_array[y][x])) val++;
                }
        }
        return val;
@@ -1311,7 +1312,7 @@ static bool cast_mirror_spell(int spell)
        {
                /* mirror of seeing */
        case 0:
-               tmp = is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) ? 4 : 0;
+               tmp = is_mirror_grid(&current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 0;
                if (plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT);
                if (plev + tmp > 18)detect_monsters_invis(DETECT_RAD_DEFAULT);
                if (plev + tmp > 28)set_tim_esp((TIME_EFFECT)plev, FALSE);
@@ -1331,7 +1332,7 @@ static bool cast_mirror_spell(int spell)
                break;
        case 2:
                if (!get_aim_dir(&dir)) return FALSE;
-               if (plev > 9 && is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x])) {
+               if (plev > 9 && is_mirror_grid(&current_floor_ptr->grid_array[p_ptr->y][p_ptr->x])) {
                        fire_beam(GF_LITE, dir, damroll(3 + ((plev - 1) / 5), 4));
                }
                else {
@@ -1367,9 +1368,9 @@ static bool cast_mirror_spell(int spell)
                break;
                /* mirror sleeping */
        case 9:
-               for (x = 0; x < cur_wid; x++) {
-                       for (y = 0; y < cur_hgt; y++) {
-                               if (is_mirror_grid(&grid_array[y][x])) {
+               for (x = 0; x < current_floor_ptr->width; x++) {
+                       for (y = 0; y < current_floor_ptr->height; y++) {
+                               if (is_mirror_grid(&current_floor_ptr->grid_array[y][x])) {
                                        project(0, 2, y, x, (HIT_POINT)plev, GF_OLD_SLEEP, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
                                }
                        }
@@ -1398,7 +1399,7 @@ static bool cast_mirror_spell(int spell)
                break;
                /* illusion light */
        case 14:
-               tmp = is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) ? 4 : 3;
+               tmp = is_mirror_grid(&current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 3;
                slow_monsters(plev);
                stun_monsters(plev*tmp);
                confuse_monsters(plev*tmp);
@@ -1408,15 +1409,15 @@ static bool cast_mirror_spell(int spell)
                break;
                /* mirror shift */
        case 15:
-               if (!is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x])) {
-                       msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!"));
+               if (!is_mirror_grid(&current_floor_ptr->grid_array[p_ptr->y][p_ptr->x])) {
+                       msg_print(_("鏡の国の場所がわからない!", "You cannot find out where the mirror is!"));
                        break;
                }
                alter_reality();
                break;
                /* mirror tunnel */
        case 16:
-               msg_print(_("鏡の世界を通り抜け…  ", "Go through the world of mirror..."));
+               msg_print(_("鏡の世界を通り抜け…  ", "You try to enter the mirror..."));
                return mirror_tunnel();
 
                /* mirror of recall */
@@ -1474,7 +1475,7 @@ static bool cast_berserk_spell(int spell)
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
 
-               if (!grid_array[y][x].m_idx)
+               if (!current_floor_ptr->grid_array[y][x].m_idx)
                {
                        msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
                        return FALSE;
@@ -1482,13 +1483,13 @@ static bool cast_berserk_spell(int spell)
 
                py_attack(y, x, 0);
 
-               if (!player_can_enter(grid_array[y][x].feat, 0) || is_trap(grid_array[y][x].feat))
+               if (!player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(current_floor_ptr->grid_array[y][x].feat))
                        break;
 
                y += ddy[dir];
                x += ddx[dir];
 
-               if (player_can_enter(grid_array[y][x].feat, 0) && !is_trap(grid_array[y][x].feat) && !grid_array[y][x].m_idx)
+               if (player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(current_floor_ptr->grid_array[y][x].feat) && !current_floor_ptr->grid_array[y][x].m_idx)
                {
                        msg_print(NULL);
                        (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
@@ -1560,7 +1561,7 @@ static bool cast_ninja_spell(int spell)
        {
                if (!(p_ptr->special_defense & NINJA_KAWARIMI))
                {
-                       msg_print(_("敵の攻撃に対して敏感になった。", "You are now prepare to evade any attacks."));
+                       msg_print(_("敵の攻撃に対して敏感になった。", "You are now prepared to evade any attacks."));
                        p_ptr->special_defense |= NINJA_KAWARIMI;
                        p_ptr->redraw |= (PR_STATUS);
                }
@@ -1630,12 +1631,12 @@ static bool cast_ninja_spell(int spell)
                POSITION ty, tx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
-               m_idx = grid_array[target_row][target_col].m_idx;
+               m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
                if (!m_idx) break;
                if (m_idx == p_ptr->riding) break;
                if (!player_has_los_bold(target_row, target_col)) break;
                if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
-               m_ptr = &m_list[m_idx];
+               m_ptr = &current_floor_ptr->m_list[m_idx];
                monster_desc(m_name, m_ptr, 0);
                msg_format(_("%sを引き戻した。", "You pull back %s."), m_name);
                path_n = project_path(path_g, MAX_RANGE, target_row, target_col, p_ptr->y, p_ptr->x, 0);
@@ -1644,7 +1645,7 @@ static bool cast_ninja_spell(int spell)
                {
                        POSITION ny = GRID_Y(path_g[i]);
                        POSITION nx = GRID_X(path_g[i]);
-                       grid_type *g_ptr = &grid_array[ny][nx];
+                       grid_type *g_ptr = &current_floor_ptr->grid_array[ny][nx];
 
                        if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
                            !(g_ptr->info & CAVE_OBJECT) &&
@@ -1655,10 +1656,10 @@ static bool cast_ninja_spell(int spell)
                        }
                }
                /* Update the old location */
-               grid_array[target_row][target_col].m_idx = 0;
+               current_floor_ptr->grid_array[target_row][target_col].m_idx = 0;
 
                /* Update the new location */
-               grid_array[ty][tx].m_idx = m_idx;
+               current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
 
                /* Move the monster */
                m_ptr->fy = ty;
@@ -1752,8 +1753,8 @@ void do_cmd_mind(void)
 {
        SPELL_IDX n = 0;
        int b = 0;
-       int             chance;
-       int             minfail = 0;
+       PERCENTAGE chance;
+       PERCENTAGE minfail = 0;
        PLAYER_LEVEL plev = p_ptr->lev;
        int             old_csp = p_ptr->csp;
        mind_type       spell;
@@ -1764,7 +1765,6 @@ void do_cmd_mind(void)
 
        if (cmd_limit_confused(p_ptr)) return;
 
-       /* get power */
        if (!get_mind_power(&n, FALSE)) return;
 
 #ifdef JP
@@ -1953,24 +1953,24 @@ void do_cmd_mind(void)
                switch(use_mind)
                {
                case MIND_MINDCRAFTER:
-                       /* Cast the spell */
+                       
                        cast = cast_mindcrafter_spell(n);
                        break;
                case MIND_KI:
-                       /* Cast the spell */
+                       
                        cast = cast_force_spell(n);
                        break;
                case MIND_BERSERKER:
-                       /* Cast the spell */
+                       
                        cast = cast_berserk_spell(n);
                        break;
                case MIND_MIRROR_MASTER:
-                       /* Cast the spell */
-                       if( is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) )on_mirror = TRUE;
+                       
+                       if( is_mirror_grid(&current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) )on_mirror = TRUE;
                        cast = cast_mirror_spell(n);
                        break;
                case MIND_NINJUTSU:
-                       /* Cast the spell */
+                       
                        cast = cast_ninja_spell(n);
                        break;
                default:
@@ -1982,11 +1982,14 @@ void do_cmd_mind(void)
        }
 
 
-       take_turn(p_ptr, 100);
        /* teleport from mirror costs small energy */
-       if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER )
+       if(on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER)
+       {
+         if( n==3 || n==5 || n==7 || n==16 ) take_turn(p_ptr, 50);
+       }
+       else
        {
-         if( n==3 || n==5 || n==7 || n==16 ) p_ptr->energy_use = 50;
+               take_turn(p_ptr, 100);
        }
 
        if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU))
@@ -2066,7 +2069,6 @@ void do_cmd_mind_browse(void)
 
        while(1)
        {
-               /* get power */
                if (!get_mind_power(&n, TRUE))
                {
                        screen_load();