OSDN Git Service

[Refactor] #39963 Separated spells3.h from spells1.h
[hengband/hengband.git] / src / mind.c
index 74721d8..2002ad4 100644 (file)
  */
 
 #include "angband.h"
-#include "core.h"
+#include "core/stuff-handler.h"
 #include "util.h"
+#include "main/sound-definitions-table.h"
 
 #include "mind.h"
 
-#include "floor.h"
+#include "effect/effect-characteristics.h"
 #include "melee.h"
-#include "spells.h"
 #include "spells-summon.h"
 #include "avatar.h"
 #include "player-move.h"
 #include "monster-status.h"
 #include "player-effects.h"
 #include "player-damage.h"
-#include "view-mainwindow.h"
+#include "view/display-main-window.h"
 #include "targeting.h"
-#include "realm-song.h"
+#include "realm/realm-song.h"
+#include "effect/spells-effect-util.h"
+#include "spell/spells-type.h"
+#include "spell/process-effect.h"
+#include "spell/spells2.h"
+#include "spell/spells3.h"
 
 /*! 特殊技能の一覧テーブル */
 mind_power const mind_powers[5] =
@@ -432,7 +437,7 @@ 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.",
        "Teleports you a short distance.",
        "Teleports you a long distance.",
@@ -441,11 +446,11 @@ static concptr const mind_tips[5][MAX_MIND_POWERS] =
        "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 stun. Gives heroism and speed. Heals HP a little unless you already have heroism and a temporary speed boost.",
+       "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. 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 more SP consumed, the longer the duration of spell.",
+       "Stops time. Consumes all of your SP. The more SP consumed, the longer the duration of the spell.",
        "",
        "",
        "",
@@ -457,14 +462,14 @@ static concptr const mind_tips[5][MAX_MIND_POWERS] =
 {
        "Fires a very small energy ball.",
        "Lights up nearby area and the inside of a room permanently.",
-       "Gives levitaion a while.",
+       "Gives levitation 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 blows 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 are effecting a monster.",
+       "Dispels all magics which are affecting a monster.",
        "Summons ghosts.",
        "Generates a huge ball of flame centered on you.",
        "Fires a long, powerful energy beam.",
@@ -478,8 +483,8 @@ static concptr const mind_tips[5][MAX_MIND_POWERS] =
        "",
 },
 {
-       "Detects all monsters except mindless in your vicinity.",
-       "Attacks a monster with your weapons normally, then dodges to one side.",
+       "Detects all monsters except the mindless in your vicinity.",
+       "In one action, attacks a monster with your weapons normally and then moves to the space beyond the monster if that space is not blocked.",
        "Sets off a trap, then destroys that trap.",
        "Shakes dungeon structure, and results in random swapping of floors and walls.",
        "Attacks all adjacent monsters.",
@@ -501,7 +506,7 @@ static concptr const mind_tips[5][MAX_MIND_POWERS] =
        "",
 },
 {
-       "Detects visible monsters in your vicinity. Detects invisible monsters at level 15. Gives telepathy at level 25. Magic mapping at level 35. All of the 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 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.",
@@ -518,31 +523,31 @@ static concptr const mind_tips[5][MAX_MIND_POWERS] =
        "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.",
        "Teleports you to a given location.",
-       "Recalls player from dungeon to town, or from town to the deepest level of dungeon.",
+       "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 are you and two mirrors in sight.",
-       "Generates a barrier which completely protects you from almost all damage. Takes a few your turns when the barrier breaks or duration time is exceeded.",
+       "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.",
 },
 
 {
        "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 as you recieve an attack. Might be able to teleport just before receiving damages at higher level.",
+       "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 and teleports in a time.",
+       "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.",
-       "Generates a fire ball and teleports 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.",
        "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.",
        "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 teleports in a time.",
+       "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 the ability to completely evade any attacks at one in two chance for a while.",
        "",
@@ -1075,11 +1080,11 @@ static bool cast_mindcrafter_spell(player_type *caster_ptr, int spell)
                break;
        case 2:
                /* Minor displace */
-               teleport_player(caster_ptr, 10, 0L);
+               teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
                break;
        case 3:
                /* Major displace */
-               teleport_player(caster_ptr, plev * 5, 0L);
+               teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
                break;
        case 4:
                /* Domination */
@@ -1115,7 +1120,7 @@ static bool cast_mindcrafter_spell(player_type *caster_ptr, int spell)
                if (plev < 25)
                        return psychometry(caster_ptr);
                else
-                       return ident_spell(caster_ptr, FALSE);
+                       return ident_spell(caster_ptr, FALSE, 0);
        case 8:
                /* Mindwave */
                msg_print(_("精神を捻じ曲げる波動を発生させた!", "Mind-warping forces emanate from your brain!"));
@@ -1355,7 +1360,7 @@ static bool cast_mirror_spell(player_type *caster_ptr, int spell)
                break;
                /* warped mirror */
        case 3:
-               teleport_player(caster_ptr, 10, 0L);
+               teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
                break;
                /* mirror of light */
        case 4:
@@ -1363,7 +1368,7 @@ static bool cast_mirror_spell(player_type *caster_ptr, int spell)
                break;
                /* mirror of wandering */
        case 5:
-               teleport_player(caster_ptr, plev * 5, 0L);
+               teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
                break;
                /* robe of dust */
        case 6:
@@ -1424,14 +1429,14 @@ static bool cast_mirror_spell(player_type *caster_ptr, int spell)
                /* mirror shift */
        case 15:
                if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x])) {
-                       msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!"));
+                       msg_print(_("鏡の国の場所がわからない!", "You cannot find out where the mirror is!"));
                        break;
                }
                reserve_alter_reality(caster_ptr);
                break;
                /* mirror tunnel */
        case 16:
-               msg_print(_("鏡の世界を通り抜け…  ", "Go through the world of mirror..."));
+               msg_print(_("鏡の世界を通り抜け…  ", "You try to enter the mirror..."));
                return mirror_tunnel(caster_ptr);
 
                /* mirror of recall */
@@ -1544,8 +1549,6 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
        DIRECTION dir;
        PLAYER_LEVEL plev = caster_ptr->lev;
 
-       /* spell code */
-       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
        switch (spell)
        {
        case 0:
@@ -1570,7 +1573,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                break;
        case 2:
        {
-               teleport_player(caster_ptr, 10, 0L);
+               teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
                break;
        }
        case 3:
@@ -1585,7 +1588,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
        }
        case 4:
        {
-               teleport_player(caster_ptr, caster_ptr->lev * 5, 0L);
+               teleport_player(caster_ptr, caster_ptr->lev * 5, TELEPORT_SPONTANEOUS);
                break;
        }
        case 5:
@@ -1600,13 +1603,13 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                break;
        }
        case 7:
-               return ident_spell(caster_ptr, FALSE);
+               return ident_spell(caster_ptr, FALSE, 0);
        case 8:
                set_tim_levitation(caster_ptr, randint1(20) + 20, FALSE);
                break;
        case 9:
                fire_ball(caster_ptr, GF_FIRE, 0, 50+plev, plev/10+2);
-               teleport_player(caster_ptr, 30, 0L);
+               teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS);
                set_oppose_fire(caster_ptr, (TIME_EFFECT)plev, FALSE);
                break;
        case 10:
@@ -1637,69 +1640,8 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                break;
        }
        case 12:
-       {
-               monster_type *m_ptr;
-               MONSTER_IDX m_idx;
-               GAME_TEXT m_name[MAX_NLEN];
-               int i;
-               int path_n;
-               u16b path_g[512];
-               POSITION ty, tx;
-
-               if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
-               m_idx = floor_ptr->grid_array[target_row][target_col].m_idx;
-               if (!m_idx) break;
-               if (m_idx == caster_ptr->riding) break;
-               if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
-               if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
-               m_ptr = &floor_ptr->m_list[m_idx];
-               monster_desc(caster_ptr, m_name, m_ptr, 0);
-               msg_format(_("%sを引き戻した。", "You pull back %s."), m_name);
-               path_n = project_path(caster_ptr, path_g, MAX_RANGE, target_row, target_col, caster_ptr->y, caster_ptr->x, 0);
-               ty = target_row, tx = target_col;
-               for (i = 1; i < path_n; i++)
-               {
-                       POSITION ny = GRID_Y(path_g[i]);
-                       POSITION nx = GRID_X(path_g[i]);
-                       grid_type *g_ptr = &floor_ptr->grid_array[ny][nx];
-
-                       if (in_bounds(floor_ptr, ny, nx) && is_cave_empty_bold(caster_ptr, ny, nx) &&
-                           !(g_ptr->info & CAVE_OBJECT) &&
-                               !pattern_tile(floor_ptr, ny, nx))
-                       {
-                               ty = ny;
-                               tx = nx;
-                       }
-               }
-               /* Update the old location */
-               floor_ptr->grid_array[target_row][target_col].m_idx = 0;
-
-               /* Update the new location */
-               floor_ptr->grid_array[ty][tx].m_idx = m_idx;
-
-               /* Move the monster */
-               m_ptr->fy = ty;
-               m_ptr->fx = tx;
-
-               /* Wake the monster up */
-               (void)set_monster_csleep(caster_ptr, m_idx, 0);
-
-               update_monster(caster_ptr, m_idx, TRUE);
-               lite_spot(caster_ptr, target_row, target_col);
-               lite_spot(caster_ptr, ty, tx);
-
-               if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
-                       caster_ptr->update |= (PU_MON_LITE);
-
-               if (m_ptr->ml)
-               {
-                       /* Auto-Recall if possible and visible */
-                       if (!caster_ptr->image) monster_race_track(caster_ptr, m_ptr->ap_r_idx);
-                       health_track(caster_ptr, m_idx);
-               }
-
+               (void)fetch_monster(caster_ptr);
                break;
-       }
        case 13:
                if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
                fire_ball(caster_ptr, GF_OLD_CONF, dir, plev*3, 3);
@@ -1726,7 +1668,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                fire_ball(caster_ptr, GF_POIS, 0, 75+plev*2/3, plev/5+2);
                fire_ball(caster_ptr, GF_HYPODYNAMIA, 0, 75+plev*2/3, plev/5+2);
                fire_ball(caster_ptr, GF_CONFUSION, 0, 75+plev*2/3, plev/5+2);
-               teleport_player(caster_ptr, 30, 0L);
+               teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS);
                break;
        case 18:
        {