OSDN Git Service

[Refactor] #37287 #37353 型の置換。 / Type replacement.
[hengband/hengband.git] / src / racial.c
index 4b0aaec..2599e49 100644 (file)
  */
 
 #include "angband.h"
+#include "cmd-magiceat.h"
+#include "cmd-zapwand.h"
+#include "cmd-pet.h"
 
-/*!
- * @brief 対象のアイテムが矢やクロスボウの矢の材料になるかを返す。/
- * Hook to determine if an object is contertible in an arrow/bolt
- * @param o_ptr オブジェクトの構造体の参照ポインタ。
- * @return 材料にできるならTRUEを返す
- */
-static bool item_tester_hook_convertible(object_type *o_ptr)
-{
-       if((o_ptr->tval==TV_JUNK) || (o_ptr->tval==TV_SKELETON)) return TRUE;
-
-       if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON)) return TRUE;
-       /* Assume not */
-       return (FALSE);
-}
+#include "object-hook.h"
 
 /*!
  * @brief レイシャル「弾/矢の製造」処理 / do_cmd_cast calls this function if the player's class is 'archer'.
@@ -90,7 +80,8 @@ static bool do_cmd_archer(void)
        /**********Create shots*********/
        if (ext == 1)
        {
-               int x,y, dir;
+               POSITION x, y;
+               DIRECTION dir;
                cave_type *c_ptr;
 
                if (!get_rep_dir(&dir, FALSE)) return FALSE;
@@ -602,12 +593,12 @@ typedef struct power_desc_type power_desc_type;
  */
 struct power_desc_type
 {
-       char name[40];
+       char name[80];
        PLAYER_LEVEL level;
-       int  cost;
-       int  stat;
-       int  fail;
-       int  number;
+       int cost;
+       int stat;
+       int fail;
+       int number;
 };
 
 
@@ -748,15 +739,6 @@ static int racial_aux(power_desc_type *pd_ptr)
        return -1;
 }
 
-/*!
- * @brief レイシャル・パワー発動時に口を使う継続的な詠唱処理を中断する
- * @return なし
- */
-void ratial_stop_mouth(void)
-{
-       if (music_singing_any()) stop_singing();
-       if (hex_spelling_any()) stop_hex_spell_all();
-}
 
 /*!
  * @brief レイシャル・パワー発動処理
@@ -824,23 +806,7 @@ static bool cmd_racial_power_aux(s32b command)
                }
                case CLASS_ROGUE:
                {
-                       int x, y;
-
-                       if (!get_rep_dir(&dir, FALSE)) return FALSE;
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
-                       if (cave[y][x].m_idx)
-                       {
-                               py_attack(y, x, 0);
-                               if (randint0(p_ptr->skill_dis) < 7)
-                                       msg_print(_("うまく逃げられなかった。", "You are failed to run away."));
-                               else teleport_player(30, 0L);
-                       }
-                       else
-                       {
-                               msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
-                               msg_print(NULL);
-                       }
+                       if(!panic_hit()) return FALSE;
                        break;
                }
                case CLASS_RANGER:
@@ -925,7 +891,7 @@ static bool cmd_racial_power_aux(s32b command)
                        }
                        else if (command == -4)
                        {
-                               int x, y;
+                               POSITION x, y;
 
                                if (!get_rep_dir(&dir, FALSE)) return FALSE;
                                y = p_ptr->y + ddy[dir];
@@ -1001,11 +967,11 @@ static bool cmd_racial_power_aux(s32b command)
                        if (command == -3)
                        {
                                if (!get_aim_dir(&dir)) return FALSE;
-                               (void)fire_ball_hide(GF_CONTROL_LIVING, dir, p_ptr->lev, 0);
+                               (void)fire_ball_hide(GF_CHARM_LIVING, dir, p_ptr->lev, 0);
                        }
                        else if (command == -4)
                        {
-                               project_hack(GF_CONTROL_LIVING, p_ptr->lev);
+                               project_hack(GF_CHARM_LIVING, p_ptr->lev);
                        }
                        break;
                }
@@ -1226,62 +1192,18 @@ static bool cmd_racial_power_aux(s32b command)
                {
                        int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
                        if (!get_aim_dir(&dir)) return FALSE;
-                       ratial_stop_mouth();
+                       stop_mouth();
 #ifdef JP
                        msg_format("あなたは%sのブレスを吐いた。",((type == GF_NETHER) ? "地獄" : "火炎"));
 #else
                        msg_format("You breathe %s.",((type == GF_NETHER) ? "nether" : "fire"));
 #endif
 
-                       fire_ball(type, dir, plev * 3, -(plev / 15) - 1);
+                       fire_breath(type, dir, plev * 3, (plev / 15) + 1);
                        break;
                }
                case MIMIC_VAMPIRE:
-                       if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
-                       {
-                               msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
-                               return FALSE;
-                       }
-                       else
-                       {
-                               int y, x, dummy = 0;
-                               cave_type *c_ptr;
-
-                               /* Only works on adjacent monsters */
-                               if (!get_rep_dir(&dir, FALSE)) return FALSE;   /* was get_aim_dir */
-                               y = p_ptr->y + ddy[dir];
-                               x = p_ptr->x + ddx[dir];
-                               c_ptr = &cave[y][x];
-
-                               ratial_stop_mouth();
-
-                               if (!c_ptr->m_idx)
-                               {
-                                       msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
-                                       break;
-                               }
-
-                               msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
-                               dummy = plev + randint1(plev) * MAX(1, plev / 10);   /* Dmg */
-                               if (drain_life(dir, dummy))
-                               {
-                                       if (p_ptr->food < PY_FOOD_FULL)
-                                               /* No heal if we are "full" */
-                                               (void)hp_player(dummy);
-                                       else
-                                               msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
-
-                                       /* Gain nutritional sustenance: 150/hp drained */
-                                       /* A Food ration gives 5000 food points (by contrast) */
-                                       /* Don't ever get more than "Full" this way */
-                                       /* But if we ARE Gorged,  it won't cure us */
-                                       dummy = p_ptr->food + MIN(5000, 100 * dummy);
-                                       if (p_ptr->food < PY_FOOD_MAX)   /* Not gorged already */
-                                               (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
-                               }
-                               else
-                                       msg_print(_("げぇ。ひどい味だ。", "Yechh. That tastes foul."));
-                       }
+                       vampirism();
                        break;
                }
        }
@@ -1327,9 +1249,7 @@ static bool cmd_racial_power_aux(s32b command)
 
                case RACE_HALF_TROLL:
                        msg_print(_("うがぁぁ!", "RAAAGH!"));
-                       (void)set_afraid(0);
-                       (void)set_shero(10 + randint1(plev), FALSE);
-                       (void)hp_player(30);
+                       (void)berserk(10 + randint1(plev));
                        break;
 
                case RACE_AMBERITE:
@@ -1342,27 +1262,15 @@ static bool cmd_racial_power_aux(s32b command)
                        {
                                msg_print(_("あなたは「パターン」を心に描いてその上を歩いた...", "You picture the Pattern in your mind and walk it..."));
 
-                               (void)set_poisoned(0);
-                               (void)set_image(0);
-                               (void)set_stun(0);
-                               (void)set_cut(0);
-                               (void)set_blind(0);
-                               (void)set_afraid(0);
-                               (void)do_res_stat(A_STR);
-                               (void)do_res_stat(A_INT);
-                               (void)do_res_stat(A_WIS);
-                               (void)do_res_stat(A_DEX);
-                               (void)do_res_stat(A_CON);
-                               (void)do_res_stat(A_CHR);
+                               (void)true_healing(0);
+                               (void)restore_all_status();
                                (void)restore_level();
                        }
                        break;
 
                case RACE_BARBARIAN:
                        msg_print(_("うぉぉおお!", "Raaagh!"));
-                       (void)set_afraid(0);
-                       (void)set_shero(10 + randint1(plev), FALSE);
-                       (void)hp_player(30);
+                       (void)berserk(10 + randint1(plev));
                        break;
 
                case RACE_HALF_OGRE:
@@ -1388,14 +1296,14 @@ static bool cmd_racial_power_aux(s32b command)
 
                case RACE_YEEK:
                        if (!get_aim_dir(&dir)) return FALSE;
-                       ratial_stop_mouth();
+                       stop_mouth();
                        msg_print(_("身の毛もよだつ叫び声を上げた!", "You make a horrible scream!"));
                        (void)fear_monster(dir, plev);
                        break;
 
                case RACE_KLACKON:
                        if (!get_aim_dir(&dir)) return FALSE;
-                       ratial_stop_mouth();
+                       stop_mouth();
                        msg_print(_("酸を吐いた。", "You spit acid."));
                        if (plev < 25) fire_bolt(GF_ACID, dir, plev);
                        else fire_ball(GF_ACID, dir, plev, 2);
@@ -1552,11 +1460,10 @@ static bool cmd_racial_power_aux(s32b command)
                                        }
                                }
 
-                               ratial_stop_mouth();
+                               stop_mouth();
                                msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
 
-                               fire_ball(Type, dir, plev * 2,
-                                   -(plev / 15) - 1);
+                               fire_breath(Type, dir, plev * 2, (plev / 15) + 1);
                        }
                        break;
 
@@ -1591,56 +1498,12 @@ static bool cmd_racial_power_aux(s32b command)
                        break;
 
                case RACE_VAMPIRE:
-                       if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
-                       {
-                               msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
-                               return FALSE;
-                       }
-                       else
-                       {
-                               int y, x, dummy = 0;
-                               cave_type *c_ptr;
-
-                               /* Only works on adjacent monsters */
-                               if (!get_rep_dir(&dir,FALSE)) return FALSE;   /* was get_aim_dir */
-                               y = p_ptr->y + ddy[dir];
-                               x = p_ptr->x + ddx[dir];
-                               c_ptr = &cave[y][x];
-
-                               ratial_stop_mouth();
-
-                               if (!c_ptr->m_idx)
-                               {
-                                       msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
-                                       break;
-                               }
-
-                               msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
-                               dummy = plev + randint1(plev) * MAX(1, plev / 10);   /* Dmg */
-                               if (drain_life(dir, dummy))
-                               {
-                                       if (p_ptr->food < PY_FOOD_FULL)
-                                               /* No heal if we are "full" */
-                                               (void)hp_player(dummy);
-                                       else
-                                               msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
-
-                                       /* Gain nutritional sustenance: 150/hp drained */
-                                       /* A Food ration gives 5000 food points (by contrast) */
-                                       /* Don't ever get more than "Full" this way */
-                                       /* But if we ARE Gorged,  it won't cure us */
-                                       dummy = p_ptr->food + MIN(5000, 100 * dummy);
-                                       if (p_ptr->food < PY_FOOD_MAX)   /* Not gorged already */
-                                               (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
-                               }
-                               else
-                                       msg_print(_("げぇ。ひどい味だ。", "Yechh. That tastes foul."));
-                       }
+                       vampirism();
                        break;
 
                case RACE_SPECTRE:
                        if (!get_aim_dir(&dir)) return FALSE;
-                       ratial_stop_mouth();
+                       stop_mouth();
                        msg_print(_("あなたはおどろおどろしい叫び声をあげた!", "You emit an eldritch howl!"));
                        (void)fear_monster(dir, plev);
                        break;
@@ -1655,14 +1518,14 @@ static bool cmd_racial_power_aux(s32b command)
                        {
                                int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
                                if (!get_aim_dir(&dir)) return FALSE;
-                               ratial_stop_mouth();
+                               stop_mouth();
 #ifdef JP
                                msg_format("あなたは%sのブレスを吐いた。",((type == GF_NETHER) ? "地獄" : "火炎"));
 #else
                                msg_format("You breathe %s.",((type == GF_NETHER) ? "nether" : "fire"));
 #endif
 
-                               fire_ball(type, dir, plev * 3, -(plev / 15) - 1);
+                               fire_breath(type, dir, plev * 3, (plev / 15) + 1);
                        }
                        break;
 
@@ -2093,7 +1956,7 @@ void do_cmd_racial_power(void)
                        power_desc[num++].number = -1;
                        break;
                case MIMIC_VAMPIRE:
-                       strcpy(power_desc[num].name, _("生命力吸収", "Drain Life"));
+                       strcpy(power_desc[num].name, _("吸血", "Vampiric Drain"));
                        power_desc[num].level = 2;
                        power_desc[num].cost = 1 + (lvl / 3);
                        power_desc[num].stat = A_CON;
@@ -2291,7 +2154,7 @@ void do_cmd_racial_power(void)
                        power_desc[num++].number = -1;
                        break;
                case RACE_VAMPIRE:
-                       strcpy(power_desc[num].name, _("生命力吸収", "Drain Life"));
+                       strcpy(power_desc[num].name, _("吸血", "Vampiric Drain"));
                        power_desc[num].level = 2;
                        power_desc[num].cost = 1 + (lvl / 3);
                        power_desc[num].stat = A_CON;
@@ -2442,7 +2305,7 @@ void do_cmd_racial_power(void)
 
                if (p_ptr->muta1 & MUT1_VAMPIRISM)
                {
-                       strcpy(power_desc[num].name, _("吸血ドレイン", "Vampiric Drain"));
+                       strcpy(power_desc[num].name, _("吸血", "Vampiric Drain"));
                        power_desc[num].level = 2;
                        power_desc[num].cost = (1 + (lvl / 3));
                        power_desc[num].stat = A_CON;