OSDN Git Service

[Refactor] #37353 spells.hにスペルに関する共通定義を追加。。 / Add common definition to spells.h.
[hengband/hengband.git] / src / spells2.c
index 9e2dd03..62103dc 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include "angband.h"
+#include "cmd-pet.h"
 #include "grid.h"
 #include "trap.h"
 #include "monsterrace-hook.h"
@@ -24,6 +25,7 @@
 #include "avatar.h"
 
 #include "spells-status.h"
+#include "realm-hex.h"
 
 /*!
  * @brief プレイヤー周辺の地形を感知する
@@ -970,8 +972,8 @@ bool crusade(void)
 void aggravate_monsters(MONSTER_IDX who)
 {
        MONSTER_IDX i;
-       bool    sleep = FALSE;
-       bool    speed = FALSE;
+       bool sleep = FALSE;
+       bool speed = FALSE;
 
        /* Aggravate everyone nearby */
        for (i = 1; i < m_max; i++)
@@ -1039,7 +1041,6 @@ bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side,
        else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
        else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
 
-
        else
        {
                if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
@@ -2085,7 +2086,6 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
        }
 
        /* Mega-Hack -- Forget the view and lite */
-       /* Update the health bar */
        p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
        p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
@@ -2237,11 +2237,8 @@ static void cave_temp_room_lite(void)
                        }
                }
 
-               /* Note */
                note_spot(y, x);
-
                lite_spot(y, x);
-
                update_local_illumination(y, x);
        }
 
@@ -2287,8 +2284,8 @@ static void cave_temp_room_unlite(void)
                        {
                                for (j = 0; j < 9; j++)
                                {
-                                       int by = y + ddy_ddd[j];
-                                       int bx = x + ddx_ddd[j];
+                                       POSITION by = y + ddy_ddd[j];
+                                       POSITION bx = x + ddx_ddd[j];
 
                                        if (in_bounds2(by, bx))
                                        {
@@ -2312,7 +2309,6 @@ static void cave_temp_room_unlite(void)
                        {
                                /* Forget the grid */
                                if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
-
                                note_spot(y, x);
                        }
 
@@ -2323,7 +2319,6 @@ static void cave_temp_room_unlite(void)
                        }
 
                        lite_spot(y, x);
-
                        update_local_illumination(y, x);
                }
        }
@@ -4893,7 +4888,7 @@ bool panic_hit(void)
 bool psychometry(void)
 {
        OBJECT_IDX      item;
-       object_type     *o_ptr;
+       object_type *o_ptr;
        GAME_TEXT o_name[MAX_NLEN];
        byte            feel;
        concptr            q, s;
@@ -4933,18 +4928,11 @@ bool psychometry(void)
 #endif
 
 
-       /* We have "felt" it */
        o_ptr->ident |= (IDENT_SENSE);
-
-       /* "Inscribe" it */
        o_ptr->feeling = feel;
-
-       /* Player touches it */
        o_ptr->marked |= OM_TOUCHED;
 
-       /* Combine / Reorder the pack (later) */
        p_ptr->update |= (PU_COMBINE | PU_REORDER);
-
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 
        /* Valid "tval" codes */
@@ -5260,4 +5248,167 @@ bool comvert_mp_to_hp(player_type *creature_ptr)
        /* Redraw mana and hp */
        creature_ptr->redraw |= (PR_HP | PR_MANA);
        return TRUE;
-}
\ No newline at end of file
+}
+
+bool demonic_breath(player_type *creature_ptr)
+{
+       DIRECTION dir;
+       int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
+       if (!get_aim_dir(&dir)) return FALSE;
+       stop_mouth();
+       msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
+       fire_breath(type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
+       return TRUE;
+}
+
+bool mirror_concentration(player_type *creature_ptr)
+{
+       if (total_friends)
+       {
+               msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
+               return FALSE;
+       }
+       if (is_mirror_grid(&cave[creature_ptr->y][creature_ptr->x]))
+       {
+               msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
+
+               creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
+               if (creature_ptr->csp >= creature_ptr->msp)
+               {
+                       creature_ptr->csp = creature_ptr->msp;
+                       creature_ptr->csp_frac = 0;
+               }
+               creature_ptr->redraw |= (PR_MANA);
+       }
+       else
+       {
+               msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
+       }
+       return TRUE;
+}
+
+bool sword_dancing(player_type *creature_ptr)
+{
+       DIRECTION dir;
+       POSITION y = 0, x = 0;
+       int i;
+       cave_type *c_ptr;
+
+       for (i = 0; i < 6; i++)
+       {
+               dir = randint0(8);
+               y = creature_ptr->y + ddy_ddd[dir];
+               x = creature_ptr->x + ddx_ddd[dir];
+               c_ptr = &cave[y][x];
+
+               /* Hack -- attack monsters */
+               if (c_ptr->m_idx)
+                       py_attack(y, x, 0);
+               else
+               {
+                       msg_print(_("攻撃が空をきった。", "You attack the empty air."));
+               }
+       }
+       return TRUE;
+}
+
+bool confusing_light(player_type *creature_ptr)
+{
+       msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
+       slow_monsters(p_ptr->lev);
+       stun_monsters(p_ptr->lev * 4);
+       confuse_monsters(p_ptr->lev * 4);
+       turn_monsters(p_ptr->lev * 4);
+       stasis_monsters(p_ptr->lev * 4);
+       return TRUE;
+}
+
+bool rodeo(player_type *creature_ptr)
+{
+       GAME_TEXT m_name[MAX_NLEN];
+       monster_type *m_ptr;
+       monster_race *r_ptr;
+       int rlev;
+
+       if (creature_ptr->riding)
+       {
+               msg_print(_("今は乗馬中だ。", "You ARE riding."));
+               return FALSE;
+       }
+       if (!do_riding(TRUE)) return TRUE;
+
+       m_ptr = &m_list[creature_ptr->riding];
+       r_ptr = &r_info[m_ptr->r_idx];
+       monster_desc(m_name, m_ptr, 0);
+       msg_format(_("%sに乗った。", "You ride on %s."), m_name);
+
+       if (is_pet(m_ptr)) return TRUE;
+
+       rlev = r_ptr->level;
+
+       if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
+       if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
+       if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
+               && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
+               && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
+               && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
+       {
+               msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
+               set_pet(m_ptr);
+       }
+       else
+       {
+               msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
+               rakuba(1, TRUE);
+
+               /* Paranoia */
+               /* 落馬処理に失敗してもとにかく乗馬解除 */
+               creature_ptr->riding = 0;
+       }
+       return TRUE;
+}
+
+bool clear_mind(player_type *creature_ptr)
+{
+       if (total_friends)
+       {
+               msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
+               return FALSE;
+       }
+       msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
+
+       creature_ptr->csp += (3 + creature_ptr->lev / 20);
+       if (creature_ptr->csp >= creature_ptr->msp)
+       {
+               creature_ptr->csp = creature_ptr->msp;
+               creature_ptr->csp_frac = 0;
+       }
+       creature_ptr->redraw |= (PR_MANA);
+       return TRUE;
+}
+
+bool concentration(player_type *creature_ptr)
+{
+       int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
+
+       if (total_friends)
+       {
+               msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
+               return FALSE;
+       }
+       if (creature_ptr->special_defense & KATA_MASK)
+       {
+               msg_print(_("今は構えに集中している。", "You need concentration on your form."));
+               return FALSE;
+       }
+       msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
+
+       creature_ptr->csp += creature_ptr->msp / 2;
+       if (creature_ptr->csp >= max_csp)
+       {
+               creature_ptr->csp = max_csp;
+               creature_ptr->csp_frac = 0;
+       }
+       creature_ptr->redraw |= (PR_MANA);
+       return TRUE;
+}