OSDN Git Service

[Refactor] #38824 get_item() を choose_object() に置換完了。 / Replaced get_item() to choose...
[hengband/hengband.git] / src / racial.c
index 9e10467..ae869d2 100644 (file)
  */
 
 #include "angband.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 "cmd-magiceat.h"
+#include "cmd-zapwand.h"
+#include "cmd-pet.h"
+#include "melee.h"
+#include "object-hook.h"
 
 /*!
  * @brief レイシャル「弾/矢の製造」処理 / do_cmd_cast calls this function if the player's class is 'archer'.
@@ -41,7 +31,7 @@ static bool do_cmd_archer(void)
        object_type     *q_ptr;
 
        char com[80];
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        q_ptr = &forge;
 
@@ -90,12 +80,13 @@ 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;
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
                c_ptr = &cave[y][x];
 
                if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_CAN_DIG))
@@ -110,12 +101,10 @@ static bool do_cmd_archer(void)
                else
                {
                        s16b slot;
-
-                       /* Get local object */
                        q_ptr = &forge;
 
                        /* Hack -- Give the player some small firestones */
-                       object_prep(q_ptr, lookup_kind(TV_SHOT, m_bonus(1, p_ptr->lev) + 1));
+                       object_prep(q_ptr, lookup_kind(TV_SHOT, (OBJECT_SUBTYPE_VALUE)m_bonus(1, p_ptr->lev) + 1));
                        q_ptr->number = (byte)rand_range(15,30);
                        object_aware(q_ptr);
                        object_known(q_ptr);
@@ -139,34 +128,21 @@ static bool do_cmd_archer(void)
        /**********Create arrows*********/
        else if (ext == 2)
        {
-               int item;
+               OBJECT_IDX item;
                cptr q, s;
                s16b slot;
 
                item_tester_hook = item_tester_hook_convertible;
 
-               /* Get an item */
                q = _("どのアイテムから作りますか? ", "Convert which item? ");
                s = _("材料を持っていない。", "You have no item to convert.");
-               if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
-
-               /* Get the item (in the pack) */
-               if (item >= 0)
-               {
-                       q_ptr = &inventory[item];
-               }
+               q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+               if (!q_ptr) return FALSE;
 
-               /* Get the item (on the floor) */
-               else
-               {
-                       q_ptr = &o_list[0 - item];
-               }
-
-               /* Get local object */
                q_ptr = &forge;
 
                /* Hack -- Give the player some small firestones */
-               object_prep(q_ptr, lookup_kind(TV_ARROW, m_bonus(1, p_ptr->lev)+ 1));
+               object_prep(q_ptr, lookup_kind(TV_ARROW, (OBJECT_SUBTYPE_VALUE)m_bonus(1, p_ptr->lev)+ 1));
                q_ptr->number = (byte)rand_range(5, 10);
                object_aware(q_ptr);
                object_known(q_ptr);
@@ -198,34 +174,22 @@ static bool do_cmd_archer(void)
        /**********Create bolts*********/
        else if (ext == 3)
        {
-               int item;
+               OBJECT_IDX item;
                cptr q, s;
                s16b slot;
 
                item_tester_hook = item_tester_hook_convertible;
 
-               /* Get an item */
                q = _("どのアイテムから作りますか? ", "Convert which item? ");
                s = _("材料を持っていない。", "You have no item to convert.");
-               if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
 
-               /* Get the item (in the pack) */
-               if (item >= 0)
-               {
-                       q_ptr = &inventory[item];
-               }
-
-               /* Get the item (on the floor) */
-               else
-               {
-                       q_ptr = &o_list[0 - item];
-               }
+               q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+               if (!q_ptr) return FALSE;
 
-               /* Get local object */
                q_ptr = &forge;
 
                /* Hack -- Give the player some small firestones */
-               object_prep(q_ptr, lookup_kind(TV_BOLT, m_bonus(1, p_ptr->lev)+1));
+               object_prep(q_ptr, lookup_kind(TV_BOLT, (OBJECT_SUBTYPE_VALUE)m_bonus(1, p_ptr->lev)+1));
                q_ptr->number = (byte)rand_range(4, 8);
                object_aware(q_ptr);
                object_known(q_ptr);
@@ -263,33 +227,21 @@ static bool do_cmd_archer(void)
  */
 bool gain_magic(void)
 {
-       int item;
-       int pval;
+       OBJECT_IDX item;
+       PARAMETER_VALUE pval;
        int ext = 0;
        cptr q, s;
        object_type *o_ptr;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        /* Only accept legal items */
        item_tester_hook = item_tester_hook_recharge;
 
-       /* Get an item */
        q = _("どのアイテムの魔力を取り込みますか? ", "Gain power of which item? ");
        s = _("魔力を取り込めるアイテムがない。", "You have nothing to gain power.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+       if (!o_ptr) return (FALSE);
 
        if (o_ptr->tval == TV_STAFF && o_ptr->sval == SV_STAFF_NOTHING)
        {
@@ -297,7 +249,6 @@ bool gain_magic(void)
                return FALSE;
        }
 
-
        if (!object_is_known(o_ptr))
        {
                msg_print(_("鑑定されていないと取り込めない。", "You need to identify before absorbing."));
@@ -318,7 +269,7 @@ bool gain_magic(void)
 
        if (o_ptr->tval == TV_ROD)
        {
-               p_ptr->magic_num2[o_ptr->sval + ext] += o_ptr->number;
+               p_ptr->magic_num2[o_ptr->sval + ext] += (MAGIC_NUM2)o_ptr->number;
                if (p_ptr->magic_num2[o_ptr->sval + ext] > 99) p_ptr->magic_num2[o_ptr->sval + ext] = 99;
        }
        else
@@ -334,7 +285,7 @@ bool gain_magic(void)
                                gain_num = (gain_num/3 + randint0(gain_num/3)) / 256;
                                if (gain_num < 1) gain_num = 1;
                        }
-                       p_ptr->magic_num2[o_ptr->sval + ext] += gain_num;
+                       p_ptr->magic_num2[o_ptr->sval + ext] += (MAGIC_NUM2)gain_num;
                        if (p_ptr->magic_num2[o_ptr->sval + ext] > 99) p_ptr->magic_num2[o_ptr->sval + ext] = 99;
                        p_ptr->magic_num1[o_ptr->sval + ext] += pval * 0x10000;
                        if (p_ptr->magic_num1[o_ptr->sval + ext] > 99 * 0x10000) p_ptr->magic_num1[o_ptr->sval + ext] = 99 * 0x10000;
@@ -344,7 +295,6 @@ bool gain_magic(void)
        }
 
        object_desc(o_name, o_ptr, 0);
-       /* Message */
        msg_format(_("%sの魔力を取り込んだ。", "You absorb magic of %s."), o_name);
 
        /* Eliminate the item (from the pack) */
@@ -362,7 +312,7 @@ bool gain_magic(void)
                floor_item_describe(0 - item);
                floor_item_optimize(0 - item);
        }
-       energy_use = 100;
+       p_ptr->energy_use = 100;
        return TRUE;
 }
 
@@ -408,8 +358,6 @@ static bool choose_kamae(void)
                msg_print(_("混乱していて構えられない!", "Too confused."));
                return FALSE;
        }
-
-       /* Save screen */
        screen_save();
        prt(_(" a) 構えをとく", " a) No form"), 2, 20);
 
@@ -513,8 +461,6 @@ static bool choose_kata(void)
                msg_print(_("体が震えて構えられない!", "You are trembling with fear!"));
                return FALSE;
        }
-
-       /* Save screen */
        screen_save();
        prt(_(" a) 型を崩す", " a) No Form"), 2, 20);
 
@@ -602,12 +548,12 @@ typedef struct power_desc_type power_desc_type;
  */
 struct power_desc_type
 {
-       char name[40];
-       int  level;
-       int  cost;
-       int  stat;
-       int  fail;
-       int  number;
+       GAME_TEXT name[MAX_NLEN];      //!<レイシャル名
+       PLAYER_LEVEL level;     //!<体得レベル
+       int cost;
+       int stat;
+       int fail;
+       int number;
 };
 
 
@@ -616,10 +562,10 @@ struct power_desc_type
  * @param pd_ptr 発動したいレイシャル・パワー情報の構造体参照ポインタ
  * @return 成功率(%)を返す
  */
-static int racial_chance(power_desc_type *pd_ptr)
+static PERCENTAGE racial_chance(power_desc_type *pd_ptr)
 {
-       s16b min_level  = pd_ptr->level;
-       int  difficulty = pd_ptr->fail;
+       PLAYER_LEVEL min_level  = pd_ptr->level;
+       int difficulty = pd_ptr->fail;
 
        int i;
        int val;
@@ -676,7 +622,7 @@ static int  racial_cost;
  */
 static int racial_aux(power_desc_type *pd_ptr)
 {
-       s16b min_level  = pd_ptr->level;
+       PLAYER_LEVEL min_level  = pd_ptr->level;
        int  use_stat   = pd_ptr->stat;
        int  difficulty = pd_ptr->fail;
        int  use_hp = 0;
@@ -692,7 +638,7 @@ static int racial_aux(power_desc_type *pd_ptr)
                msg_format(_("この能力を使用するにはレベル %d に達していなければなりません。", 
                                         "You need to attain level %d to use this power."), min_level);
 
-               energy_use = 0;
+               p_ptr->energy_use = 0;
                return 0;
        }
 
@@ -700,7 +646,7 @@ static int racial_aux(power_desc_type *pd_ptr)
        else if (p_ptr->confused)
        {
                msg_print(_("混乱していてその能力は使えない。", "You are too confused to use this power."));
-               energy_use = 0;
+               p_ptr->energy_use = 0;
                return 0;
        }
 
@@ -709,7 +655,7 @@ static int racial_aux(power_desc_type *pd_ptr)
        {
                if (!get_check(_("本当に今の衰弱した状態でこの能力を使いますか?", "Really use the power in your weakened state? ")))
                {
-                       energy_use = 0;
+                       p_ptr->energy_use = 0;
                        return 0;
                }
        }
@@ -733,11 +679,10 @@ static int racial_aux(power_desc_type *pd_ptr)
        }
 
        /* take time and pay the price */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Success? */
-       if (randint1(p_ptr->stat_cur[use_stat]) >=
-           ((difficulty / 2) + randint1(difficulty / 2)))
+       if (randint1(p_ptr->stat_cur[use_stat]) >= ((difficulty / 2) + randint1(difficulty / 2)))
        {
                return 1;
        }
@@ -748,15 +693,6 @@ static int racial_aux(power_desc_type *pd_ptr)
        return -1;
 }
 
-/*!
- * @brief レイシャル・パワー発動時に口を使う継続的な詠唱処理を中断する
- * @return なし
- */
-void ratial_stop_mouth()
-{
-       if (music_singing_any()) stop_singing();
-       if (hex_spelling_any()) stop_hex_spell_all();
-}
 
 /*!
  * @brief レイシャル・パワー発動処理
@@ -765,8 +701,8 @@ void ratial_stop_mouth()
  */
 static bool cmd_racial_power_aux(s32b command)
 {
-       s16b        plev = p_ptr->lev;
-       int         dir = 0;
+       PLAYER_LEVEL plev = p_ptr->lev;
+       DIRECTION dir = 0;
 
        if (command <= -3)
        {
@@ -774,14 +710,15 @@ static bool cmd_racial_power_aux(s32b command)
                {
                case CLASS_WARRIOR:
                {
-                       int y = 0, x = 0, i;
-                       cave_type       *c_ptr;
+                       POSITION y = 0, x = 0;
+                       int i;
+                       cave_type *c_ptr;
 
-                       for (i = 0; i < 6; i++)
+                       for (i = 0; i < A_MAX; i++)
                        {
                                dir = randint0(8);
-                               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];
 
                                /* Hack -- attack monsters */
@@ -798,7 +735,7 @@ static bool cmd_racial_power_aux(s32b command)
                if (p_ptr->realm1 == REALM_HEX)
                {
                        bool retval = stop_hex_spell();
-                       if (retval) energy_use = 10;
+                       if (retval) p_ptr->energy_use = 10;
                        return (retval);
                }
                case CLASS_MAGE:
@@ -824,23 +761,7 @@ static bool cmd_racial_power_aux(s32b command)
                }
                case CLASS_ROGUE:
                {
-                       int x, y;
-
-                       if (!get_rep_dir(&dir, FALSE)) return FALSE;
-                       y = py + ddy[dir];
-                       x = px + 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:
@@ -861,8 +782,7 @@ static bool cmd_racial_power_aux(s32b command)
                {
                        if (command == -3)
                        {
-                               int gain_sp = take_hit(DAMAGE_USELIFE, p_ptr->lev, 
-                                                               _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
+                               int gain_sp = take_hit(DAMAGE_USELIFE, p_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
                                if (gain_sp)
                                {
                                        p_ptr->csp += gain_sp;
@@ -925,11 +845,11 @@ 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 = py + ddy[dir];
-                               x = px + ddx[dir];
+                               y = p_ptr->y + ddy[dir];
+                               x = p_ptr->x + ddx[dir];
                                if (cave[y][x].m_idx)
                                {
                                        if (one_in_(2)) 
@@ -971,8 +891,6 @@ static bool cmd_racial_power_aux(s32b command)
                                p_ptr->csp = p_ptr->msp;
                                p_ptr->csp_frac = 0;
                        }
-
-                       /* Redraw mana */
                        p_ptr->redraw |= (PR_MANA);
                        break;
                }
@@ -1001,11 +919,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_all_los(GF_CHARM_LIVING, p_ptr->lev);
                        }
                        break;
                }
@@ -1027,10 +945,10 @@ static bool cmd_racial_power_aux(s32b command)
                case CLASS_BARD:
                {
                        /* Singing is already stopped */
-                       if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return FALSE;
+                       if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return FALSE;
 
                        stop_singing();
-                       energy_use = 10;
+                       p_ptr->energy_use = 10;
                        break;
                }
                case CLASS_RED_MAGE:
@@ -1067,8 +985,6 @@ static bool cmd_racial_power_aux(s32b command)
                                        p_ptr->csp = max_csp;
                                        p_ptr->csp_frac = 0;
                                }
-
-                               /* Redraw mana */
                                p_ptr->redraw |= (PR_MANA);
                        }
                        else if (command == -4)
@@ -1093,12 +1009,12 @@ static bool cmd_racial_power_aux(s32b command)
                        {
                                set_action(ACTION_LEARN);
                        }
-                       energy_use = 0;
+                       p_ptr->energy_use = 0;
                        break;
                }
                case CLASS_CAVALRY:
                {
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        monster_type *m_ptr;
                        monster_race *r_ptr;
                        int rlev;
@@ -1167,7 +1083,7 @@ static bool cmd_racial_power_aux(s32b command)
                                        msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
                                        return FALSE;
                                }
-                               if (is_mirror_grid(&cave[py][px]))
+                               if (is_mirror_grid(&cave[p_ptr->y][p_ptr->x]))
                                {
                                        msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
 
@@ -1177,8 +1093,6 @@ static bool cmd_racial_power_aux(s32b command)
                                                p_ptr->csp = p_ptr->msp;
                                                p_ptr->csp_frac = 0;
                                        }
-
-                                       /* Redraw mana */
                                        p_ptr->redraw |= (PR_MANA);
                                }
                                else
@@ -1196,7 +1110,7 @@ static bool cmd_racial_power_aux(s32b command)
                        }
                        else
                        {
-                               cave_type *c_ptr = &cave[py][px];
+                               cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
                                feature_type *f_ptr = &f_info[c_ptr->feat];
 
                                if (!have_flag(f_ptr->flags, FF_PROJECT) ||
@@ -1211,7 +1125,7 @@ static bool cmd_racial_power_aux(s32b command)
                        }
 
 
-                       energy_use = 0;
+                       p_ptr->energy_use = 0;
                        break;
                }
 
@@ -1226,62 +1140,13 @@ 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();
-#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);
+                       stop_mouth();
+                       msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."),((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
+                       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 = py + ddy[dir];
-                               x = px + 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;
                }
        }
@@ -1302,15 +1167,13 @@ static bool cmd_racial_power_aux(s32b command)
                        {
                                object_type *q_ptr;
                                object_type forge;
-
-                               /* Get local object */
                                q_ptr = &forge;
 
                                /* Create the food ration */
                                object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
 
                                /* Drop the object from heaven */
-                               (void)drop_near(q_ptr, -1, py, px);
+                               (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
                                msg_print(_("食事を料理して作った。", "You cook some food."));
                        }
                        break;
@@ -1327,9 +1190,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 +1203,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 +1237,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);
@@ -1423,12 +1272,8 @@ static bool cmd_racial_power_aux(s32b command)
 
                case RACE_DRACONIAN:
                        {
-                               int  Type = (one_in_(3) ? GF_COLD : GF_FIRE);
-#ifdef JP
-                               cptr Type_desc = ((Type == GF_COLD) ? "冷気" : "炎");
-#else
-                               cptr Type_desc = ((Type == GF_COLD) ? "cold" : "fire");
-#endif
+                               int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
+                               cptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
 
                                if (!get_aim_dir(&dir)) return FALSE;
 
@@ -1552,11 +1397,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 +1435,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 = py + ddy[dir];
-                               x = px + 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 +1455,9 @@ 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();
-#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);
+                               stop_mouth();
+                               msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."),((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
+                               fire_breath(type, dir, plev * 3, (plev / 15) + 1);
                        }
                        break;
 
@@ -1701,7 +1496,7 @@ static bool cmd_racial_power_aux(s32b command)
 
                default:
                        msg_print(_("この種族は特殊な能力を持っていません。", "This race has no bonus power."));
-                       energy_use = 0;
+                       p_ptr->energy_use = 0;
        }
        }
        return TRUE;
@@ -1714,15 +1509,17 @@ static bool cmd_racial_power_aux(s32b command)
 void do_cmd_racial_power(void)
 {
        power_desc_type power_desc[36];
-       int             num, i = 0;
-       int             ask = TRUE;
-       int             lvl = p_ptr->lev;
+       int num;
+       COMMAND_CODE i = 0;
+       int ask = TRUE;
+       PLAYER_LEVEL lvl = p_ptr->lev;
        bool            flag, redraw, cast = FALSE;
        bool            warrior = ((p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_BERSERKER) ? TRUE : FALSE);
        char            choice;
        char            out_val[160];
        int menu_line = (use_menu ? 1 : 0);
 
+       if (p_ptr->wild_mode) return;
 
        for (num = 0; num < 36; num++)
        {
@@ -1735,7 +1532,7 @@ void do_cmd_racial_power(void)
        if (p_ptr->confused)
        {
                msg_print(_("混乱していて特殊能力を使えません!", "You are too confused to use any powers!"));
-               energy_use = 0;
+               p_ptr->energy_use = 0;
                return;
        }
 
@@ -2092,7 +1889,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;
@@ -2290,7 +2087,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;
@@ -2441,7 +2238,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;
@@ -2702,9 +2499,7 @@ void do_cmd_racial_power(void)
                                _("(特殊能力 %c-%c, *'で一覧, ESCで中断) どの特殊能力を使いますか?", "(Powers %c-%c, *=List, ESC=exit) Use which power? "),
                                I2A(0), (num <= 26) ? I2A(num - 1) : '0' + num - 27);
 
-#ifdef ALLOW_REPEAT
 if (!repeat_pull(&i) || i<0 || i>=num) {
-#endif /* ALLOW_REPEAT */
        if (use_menu) screen_save();
         /* Get a spell from the user */
 
@@ -2721,7 +2516,7 @@ if (!repeat_pull(&i) || i<0 || i>=num) {
                                case '0':
                                {
                                        screen_load();
-                                       energy_use = 0;
+                                       p_ptr->energy_use = 0;
                                        return;
                                }
 
@@ -2776,14 +2571,12 @@ if (!repeat_pull(&i) || i<0 || i>=num) {
                                int ctr = 0;
                                char dummy[80];
                                char letter;
-                               int x1, y1;
+                               TERM_LEN x1, y1;
 
                                strcpy(dummy, "");
 
                                /* Show list */
                                redraw = TRUE;
-
-                               /* Save the screen */
                                if (!use_menu) screen_save();
 
                                /* Print header(s) */
@@ -2827,8 +2620,6 @@ if (!repeat_pull(&i) || i<0 || i>=num) {
                        {
                                /* Hide list */
                                redraw = FALSE;
-
-                               /* Restore the screen */
                                screen_load();
                        }
 
@@ -2849,7 +2640,7 @@ if (!repeat_pull(&i) || i<0 || i>=num) {
                                ask = (isupper(choice));
 
                                /* Lowercase */
-                               if (ask) choice = tolower(choice);
+                               if (ask) choice = (char)tolower(choice);
 
                                /* Extract request */
                                i = (islower(choice) ? A2I(choice) : -1);
@@ -2884,20 +2675,16 @@ if (!repeat_pull(&i) || i<0 || i>=num) {
                /* Stop the loop */
                flag = TRUE;
        }
-
-       /* Restore the screen */
        if (redraw) screen_load();
 
        /* Abort if needed */
        if (!flag)
        {
-               energy_use = 0;
+               p_ptr->energy_use = 0;
                return;
        }
-#ifdef ALLOW_REPEAT
        repeat_push(i);
        } /*if (!repeat_pull(&i) || ...)*/
-#endif /* ALLOW_REPEAT */
        switch (racial_aux(&power_desc[i]))
        {
        case 1:
@@ -2932,11 +2719,10 @@ if (!repeat_pull(&i) || i<0 || i>=num) {
                        /* Redraw mana and hp */
                        p_ptr->redraw |= (PR_HP | PR_MANA);
 
-                       /* Window stuff */
                        p_ptr->window |= (PW_PLAYER | PW_SPELL);
                }
        }
-       else energy_use = 0;
+       else p_ptr->energy_use = 0;
 
        /* Success */
        return;