OSDN Git Service

[modify]スクリーンダンプで「'」と「"」のエスケープを追加
[hengband/hengband.git] / src / spells3.c
index fca0abe..24aff36 100644 (file)
@@ -350,10 +350,10 @@ bool teleport_player_aux(int dis, u32b mode)
        int total_candidates, cur_candidates;
        int y = 0, x = 0, min, pick, i;
 
-       int left = MAX(1, px - dis);
-       int right = MIN(cur_wid - 2, px + dis);
-       int top = MAX(1, py - dis);
-       int bottom = MIN(cur_hgt - 2, py + dis);
+       int left = MAX(1, p_ptr->x - dis);
+       int right = MIN(cur_wid - 2, p_ptr->x + dis);
+       int top = MAX(1, p_ptr->y - dis);
+       int bottom = MIN(cur_hgt - 2, p_ptr->y + dis);
 
        if (p_ptr->wild_mode) return FALSE;
 
@@ -382,7 +382,7 @@ bool teleport_player_aux(int dis, u32b mode)
                        if (!cave_player_teleportable_bold(y, x, mode)) continue;
 
                        /* Calculate distance */
-                       d = distance(py, px, y, x);
+                       d = distance(p_ptr->y, p_ptr->x, y, x);
 
                        /* Skip too far locations */
                        if (d > dis) continue;
@@ -421,7 +421,7 @@ bool teleport_player_aux(int dis, u32b mode)
                        if (!cave_player_teleportable_bold(y, x, mode)) continue;
 
                        /* Calculate distance */
-                       d = distance(py, px, y, x);
+                       d = distance(p_ptr->y, p_ptr->x, y, x);
 
                        /* Skip too far locations */
                        if (d > dis) continue;
@@ -445,7 +445,7 @@ bool teleport_player_aux(int dis, u32b mode)
 
 #ifdef JP
        if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-               msg_format("『こっちだぁ、%s』", player_name);
+               msg_format("『こっちだぁ、%s』", p_ptr->name);
 #endif
 
        /* Move the player */
@@ -465,8 +465,8 @@ void teleport_player(int dis, u32b mode)
        int yy, xx;
 
        /* Save the old location */
-       int oy = py;
-       int ox = px;
+       int oy = p_ptr->y;
+       int ox = p_ptr->x;
 
        if (!teleport_player_aux(dis, mode)) return;
 
@@ -487,10 +487,10 @@ void teleport_player(int dis, u32b mode)
                                 * The latter limitation is to avoid
                                 * totally unkillable suckers...
                                 */
-                               if ((r_ptr->flags6 & RF6_TPORT) &&
+                               if ((r_ptr->a_ability_flags2 & RF6_TPORT) &&
                                    !(r_ptr->flagsr & RFR_RES_TELE))
                                {
-                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, 0L);
+                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L);
                                }
                        }
                }
@@ -509,8 +509,8 @@ void teleport_player_away(int m_idx, int dis)
        int yy, xx;
 
        /* Save the old location */
-       int oy = py;
-       int ox = px;
+       int oy = p_ptr->y;
+       int ox = p_ptr->x;
 
        if (!teleport_player_aux(dis, TELEPORT_PASSIVE)) return;
 
@@ -531,10 +531,10 @@ void teleport_player_away(int m_idx, int dis)
                                 * The latter limitation is to avoid
                                 * totally unkillable suckers...
                                 */
-                               if ((r_ptr->flags6 & RF6_TPORT) &&
+                               if ((r_ptr->a_ability_flags2 & RF6_TPORT) &&
                                    !(r_ptr->flagsr & RFR_RES_TELE))
                                {
-                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, 0L);
+                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L);
                                }
                        }
                }
@@ -608,7 +608,7 @@ void teleport_away_followable(int m_idx)
 
        teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
 
-       if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && !p_ptr->inside_battle && los(py, px, oldfy, oldfx))
+       if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && !p_ptr->inside_battle && los(p_ptr->y, p_ptr->x, oldfy, oldfx))
        {
                bool follow = FALSE;
 
@@ -712,9 +712,9 @@ void teleport_level(int m_idx)
                {
                        if (!dun_level)
                        {
-                               dungeon_type = p_ptr->recall_dungeon;
-                               p_ptr->oldpy = py;
-                               p_ptr->oldpx = px;
+                               dungeon_type = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon;
+                               p_ptr->oldpy = p_ptr->y;
+                               p_ptr->oldpx = p_ptr->x;
                        }
 
                        if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
@@ -831,9 +831,10 @@ void teleport_level(int m_idx)
 
 
 /*!
- * @brief プレイヤー及びモンスターをレベルテレポートさせる /
- * Teleport the player one level up or down (random when legal)
- * @param m_idx テレポートの対象となるモンスターID(0ならばプレイヤー) / If m_idx <= 0, target is player.
+ * @brief これまでに入ったダンジョンの一覧を表示する
+ * @param note ダンジョンに施す処理記述
+ * @param y コンソールY座標
+ * @param x コンソールX座標
  * @return なし
  */
 int choose_dungeon(cptr note, int y, int x)
@@ -913,7 +914,7 @@ int choose_dungeon(cptr note, int y, int x)
 /*!
  * @brief プレイヤーの帰還発動及び中止処理 /
  * Recall the player to town or dungeon
- * @param turn 発動までのターン数
+ * @param turns 発動までのターン数
  * @return 常にTRUEを返す
  */
 bool recall_player(int turns)
@@ -964,7 +965,6 @@ bool recall_player(int turns)
 
 /*!
  * @brief 帰還用メインルーチン
- * @param turn 発動までのターン数
  * @return 常にTRUEを返す
  */
 bool word_of_recall(void)
@@ -1597,7 +1597,7 @@ void call_the_(void)
 
        for (i = 0; i < 9; i++)
        {
-               c_ptr = &cave[py + ddy_ddd[i]][px + ddx_ddd[i]];
+               c_ptr = &cave[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]];
 
                if (!cave_have_flag_grid(c_ptr, FF_PROJECT))
                {
@@ -1653,7 +1653,7 @@ void call_the_(void)
                }
                else
                {
-                       if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), FALSE))
+                       if (destroy_area(p_ptr->y, p_ptr->x, 15 + p_ptr->lev + randint0(11), FALSE))
                                msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses..."));
                        else
                                msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles."));
@@ -1680,7 +1680,7 @@ void fetch(int dir, int wgt, bool require_los)
        char            o_name[MAX_NLEN];
 
        /* Check to see if an object is already there */
-       if (cave[py][px].o_idx)
+       if (cave[p_ptr->y][p_ptr->x].o_idx)
        {
                msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something."));
                return;
@@ -1692,7 +1692,7 @@ void fetch(int dir, int wgt, bool require_los)
                tx = target_col;
                ty = target_row;
 
-               if (distance(py, px, ty, tx) > MAX_RANGE)
+               if (distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE)
                {
                        msg_print(_("そんなに遠くにある物は取れません!", "You can't fetch something that far away!"));
                        return;
@@ -1722,7 +1722,7 @@ void fetch(int dir, int wgt, bool require_los)
                                msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location."));
                                return;
                        }
-                       else if (!projectable(py, px, ty, tx))
+                       else if (!projectable(p_ptr->y, p_ptr->x, ty, tx))
                        {
                                msg_print(_("そこは壁の向こうです。", "You have no direct line of sight to that location."));
                                return;
@@ -1732,8 +1732,8 @@ void fetch(int dir, int wgt, bool require_los)
        else
        {
                /* Use a direction */
-               ty = py; /* Where to drop the item */
-               tx = px;
+               ty = p_ptr->y; /* Where to drop the item */
+               tx = p_ptr->x;
 
                do
                {
@@ -1741,7 +1741,7 @@ void fetch(int dir, int wgt, bool require_los)
                        tx += ddx[dir];
                        c_ptr = &cave[ty][tx];
 
-                       if ((distance(py, px, ty, tx) > MAX_RANGE) ||
+                       if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) ||
                                !cave_have_flag_bold(ty, tx, FF_PROJECT)) return;
                }
                while (!c_ptr->o_idx);
@@ -1758,15 +1758,15 @@ void fetch(int dir, int wgt, bool require_los)
 
        i = c_ptr->o_idx;
        c_ptr->o_idx = o_ptr->next_o_idx;
-       cave[py][px].o_idx = i; /* 'move' it */
+       cave[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */
        o_ptr->next_o_idx = 0;
-       o_ptr->iy = (byte)py;
-       o_ptr->ix = (byte)px;
+       o_ptr->iy = (byte)p_ptr->y;
+       o_ptr->ix = (byte)p_ptr->x;
 
        object_desc(o_name, o_ptr, OD_NAME_ONLY);
        msg_format(_("%^sがあなたの足元に飛んできた。", "%^s flies through the air to your feet."), o_name);
 
-       note_spot(py, px);
+       note_spot(p_ptr->y, p_ptr->x);
        p_ptr->redraw |= PR_MAP;
 }
 
@@ -1810,21 +1810,21 @@ void alter_reality(void)
 bool warding_glyph(void)
 {
        /* XXX XXX XXX */
-       if (!cave_clean_bold(py, px))
+       if (!cave_clean_bold(p_ptr->y, p_ptr->x))
        {
                msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
                return FALSE;
        }
 
        /* Create a glyph */
-       cave[py][px].info |= CAVE_OBJECT;
-       cave[py][px].mimic = feat_glyph;
+       cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
+       cave[p_ptr->y][p_ptr->x].mimic = feat_glyph;
 
        /* Notice */
-       note_spot(py, px);
+       note_spot(p_ptr->y, p_ptr->x);
 
        /* Redraw */
-       lite_spot(py, px);
+       lite_spot(p_ptr->y, p_ptr->x);
 
        return TRUE;
 }
@@ -1836,26 +1836,26 @@ bool warding_glyph(void)
 bool place_mirror(void)
 {
        /* XXX XXX XXX */
-       if (!cave_clean_bold(py, px))
+       if (!cave_clean_bold(p_ptr->y, p_ptr->x))
        {
                msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
                return FALSE;
        }
 
        /* Create a mirror */
-       cave[py][px].info |= CAVE_OBJECT;
-       cave[py][px].mimic = feat_mirror;
+       cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
+       cave[p_ptr->y][p_ptr->x].mimic = feat_mirror;
 
        /* Turn on the light */
-       cave[py][px].info |= CAVE_GLOW;
+       cave[p_ptr->y][p_ptr->x].info |= CAVE_GLOW;
 
        /* Notice */
-       note_spot(py, px);
+       note_spot(p_ptr->y, p_ptr->x);
 
        /* Redraw */
-       lite_spot(py, px);
+       lite_spot(p_ptr->y, p_ptr->x);
 
-       update_local_illumination(py, px);
+       update_local_illumination(p_ptr->y, p_ptr->x);
 
        return TRUE;
 }
@@ -1869,21 +1869,21 @@ bool place_mirror(void)
 bool explosive_rune(void)
 {
        /* XXX XXX XXX */
-       if (!cave_clean_bold(py, px))
+       if (!cave_clean_bold(p_ptr->y, p_ptr->x))
        {
                msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
                return FALSE;
        }
 
        /* Create a glyph */
-       cave[py][px].info |= CAVE_OBJECT;
-       cave[py][px].mimic = feat_explosive_rune;
+       cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
+       cave[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune;
 
        /* Notice */
-       note_spot(py, px);
+       note_spot(p_ptr->y, p_ptr->x);
        
        /* Redraw */
-       lite_spot(py, px);
+       lite_spot(p_ptr->y, p_ptr->x);
 
        return TRUE;
 }
@@ -2369,7 +2369,7 @@ msg_format("%s は明るく輝いた!",
 /*!
  * @brief アイテムが並の価値のアイテムかどうか判定する /
  * Check if an object is nameless weapon or armour
- * @param 判定するアイテムの情報参照ポインタ
+ * @param o_ptr 判定するアイテムの情報参照ポインタ
  * @return 並ならばTRUEを返す
  */
 static bool item_tester_hook_nameless_weapon_armour(object_type *o_ptr)
@@ -2506,7 +2506,15 @@ bool artifact_scroll(void)
                if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
        }
        else
+       {
+               if (record_rand_art)
+               {
+                       /* Description */
+                       object_desc(o_name, o_ptr, OD_NAME_ONLY);
+                       do_cmd_write_nikki(NIKKI_ART_SCROLL, 0, o_name);
+               }
                chg_virtue(V_ENCHANT, 1);
+       }
 
        calc_android_exp();
 
@@ -3646,9 +3654,6 @@ void display_spell_list(void)
            (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
            (p_ptr->pclass == CLASS_FORCETRAINER))
        {
-               int             i;
-               int             y = 1;
-               int             x = 1;
                int             minfail = 0;
                int             plev = p_ptr->lev;
                int             chance = 0;
@@ -3658,6 +3663,9 @@ void display_spell_list(void)
                int             use_mind;
                bool use_hp = FALSE;
 
+               y = 1;
+               x = 1;
+
                /* Display a list of spells */
                prt("", y, x);
                put_str(_("名前", "Name"), y, x + 5);
@@ -3888,7 +3896,7 @@ int mod_need_mana(int need_mana, int spell, int realm)
  * @brief 呪文の失敗率修正処理1(呪い、消費魔力減少、呪文簡易化) /
  * Modify spell fail rate
  * Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
- * @param need_mana 基本失敗率
+ * @param chance 修正前失敗率
  * @return 失敗率(%)
  * @todo 統合を検討
  */
@@ -3910,7 +3918,7 @@ int mod_spell_chance_1(int chance)
  * @brief 呪文の失敗率修正処理2(消費魔力減少、呪い、負値修正) /
  * Modify spell fail rate
  * Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
- * @param need_mana 基本失敗率
+ * @param chance 修正前失敗率
  * @return 失敗率(%)
  * Modify spell fail rate (as "suffix" process)
  * Using p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
@@ -4093,12 +4101,12 @@ bool spell_okay(int spell, bool learned, bool study_pray, int use_realm)
 /*!
  * @brief 呪文情報の表示処理 /
  * Print a list of spells (for browsing or casting or viewing)
- * @spells target_spell 呪文ID
- * @spells spells アクセス開始するスペルの参照ポイント
- * @spells num 表示する
- * @spells y 表示メッセージ左上Y座標
- * @spells x 表示メッセージ左上X座標
- * @spells use_realm 魔法領域ID
+ * @param target_spell 呪文ID
+ * @param spells アクセス開始するスペルの参照ポイント
+ * @param num 表示する
+ * @param y 表示メッセージ左上Y座標
+ * @param x 表示メッセージ左上X座標
+ * @param use_realm 魔法領域ID
  * @return なし
  */
 void print_spells(int target_spell, byte *spells, int num, int y, int x, int use_realm)
@@ -4571,7 +4579,7 @@ o_name, index_to_label(i),
                                /* Potions smash open */
                                if (object_is_potion(o_ptr))
                                {
-                                       (void)potion_smash_effect(0, py, px, o_ptr->k_idx);
+                                       (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, o_ptr->k_idx);
                                }
 
                                /* Reduce the charges of rods/wands */
@@ -4855,7 +4863,10 @@ int cold_dam(int dam, cptr kb_str, int monspell, bool aura)
        return get_damage;
 }
 
-
+/*!
+ * @brief 防具の錆止め防止処理
+ * @return ターン消費を要する処理を行ったならばTRUEを返す
+ */
 bool rustproof(void)
 {
        int         item;
@@ -4919,8 +4930,10 @@ msg_format("%sは腐食しなくなった。", o_name);
 }
 
 
-/*
+/*!
+ * @brief 防具呪縛処理 /
  * Curse the players armor
+ * @return 実際に呪縛されたらTRUEを返す
  */
 bool curse_armor(void)
 {
@@ -4993,9 +5006,12 @@ msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返し
        return (TRUE);
 }
 
-
-/*
+/*!
+ * @brief 武器呪縛処理 /
  * Curse the players weapon
+ * @param force 無条件に呪縛を行うならばTRUE
+ * @param o_ptr 呪縛する武器のアイテム情報参照ポインタ
+ * @return 実際に呪縛されたらTRUEを返す
  */
 bool curse_weapon_object(bool force, object_type *o_ptr)
 {
@@ -5061,6 +5077,13 @@ bool curse_weapon_object(bool force, object_type *o_ptr)
        return (TRUE);
 }
 
+/*!
+ * @brief 武器呪縛処理のメインルーチン /
+ * Curse the players weapon
+ * @param force 無条件に呪縛を行うならばTRUE
+ * @param slot 呪縛する武器の装備スロット
+ * @return 実際に呪縛されたらTRUEを返す
+ */
 bool curse_weapon(bool force, int slot)
 {
        /* Curse the weapon */
@@ -5068,8 +5091,10 @@ bool curse_weapon(bool force, int slot)
 }
 
 
-/*
+/*!
+ * @brief ボルトのエゴ化処理(火炎エゴのみ) /
  * Enchant some bolts
+ * @return 常にTRUEを返す
  */
 bool brand_bolts(void)
 {
@@ -5117,9 +5142,12 @@ bool brand_bolts(void)
 }
 
 
-/*
+/*!
+ * @brief 変身処理向けにモンスターの近隣レベル帯モンスターを返す /
  * Helper function -- return a "nearby" race for polymorphing
- *
+ * @param r_idx 基準となるモンスター種族ID
+ * @return 変更先のモンスター種族ID
+ * @details
  * Note that this function is one of the more "dangerous" ones...
  */
 static s16b poly_r_idx(int r_idx)
@@ -5166,7 +5194,13 @@ static s16b poly_r_idx(int r_idx)
        return (r_idx);
 }
 
-
+/*!
+ * @brief 指定座標にいるモンスターを変身させる /
+ * Helper function -- return a "nearby" race for polymorphing
+ * @param y 指定のY座標
+ * @param x 指定のX座標
+ * @return 実際に変身したらTRUEを返す
+ */
 bool polymorph_monster(int y, int x)
 {
        cave_type *c_ptr = &cave[y][x];
@@ -5264,9 +5298,12 @@ bool polymorph_monster(int y, int x)
        return polymorphed;
 }
 
-
-/*
+/*!
+ * @brief 次元の扉処理 /
  * Dimension Door
+ * @param x テレポート先のX座標
+ * @param y テレポート先のY座標
+ * @return 目標に指定通りテレポートできたならばTRUEを返す
  */
 static bool dimension_door_aux(int x, int y)
 {
@@ -5275,7 +5312,7 @@ static bool dimension_door_aux(int x, int y)
        p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
 
        if (!cave_player_teleportable_bold(y, x, 0L) ||
-           (distance(y, x, py, px) > plev / 2 + 10) ||
+           (distance(y, x, p_ptr->y, p_ptr->x) > plev / 2 + 10) ||
            (!randint0(plev / 10 + 10)))
        {
                p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
@@ -5294,8 +5331,10 @@ static bool dimension_door_aux(int x, int y)
 }
 
 
-/*
+/*!
+ * @brief 次元の扉処理のメインルーチン /
  * Dimension Door
+ * @return ターンを消費した場合TRUEを返す
  */
 bool dimension_door(void)
 {
@@ -5312,8 +5351,10 @@ bool dimension_door(void)
 }
 
 
-/*
+/*!
+ * @brief 鏡抜け処理のメインルーチン /
  * Mirror Master's Dimension Door
+ * @return ターンを消費した場合TRUEを返す
  */
 bool mirror_tunnel(void)
 {
@@ -5329,7 +5370,11 @@ bool mirror_tunnel(void)
        return TRUE;
 }
 
-
+/*!
+ * @brief 魔力食い処理
+ * @param power 基本効力
+ * @return ターンを消費した場合TRUEを返す
+ */
 bool eat_magic(int power)
 {
        object_type * o_ptr;
@@ -5603,7 +5648,14 @@ bool eat_magic(int power)
        return TRUE;
 }
 
-
+/*!
+ * @brief 同族召喚(援軍)処理
+ * @param level 召喚基準レベル
+ * @param y 召喚先Y座標
+ * @param x 召喚先X座標
+ * @param mode 召喚オプション
+ * @return ターンを消費した場合TRUEを返す
+ */
 bool summon_kin_player(int level, int y, int x, u32b mode)
 {
        bool pet = (bool)(mode & PM_FORCE_PET);
@@ -5712,7 +5764,13 @@ bool summon_kin_player(int level, int y, int x, u32b mode)
        return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);
 }
 
-void massacre(int py, int px)
+/*!
+ * @brief 皆殺し(全方向攻撃)処理
+ * @param py プレイヤーY座標
+ * @param px プレイヤーX座標
+ * @return なし
+ */
+void massacre(void)
 {
        int x, y;
        cave_type       *c_ptr;
@@ -5721,8 +5779,8 @@ void massacre(int py, int px)
 
        for (dir = 0; dir < 8; dir++)
        {
-               y = py + ddy_ddd[dir];
-               x = px + ddx_ddd[dir];
+               y = p_ptr->y + ddy_ddd[dir];
+               x = p_ptr->x + ddx_ddd[dir];
                c_ptr = &cave[y][x];
 
                /* Get the monster */