OSDN Git Service

[Refactor] item_tester_tval をグローバル変数から排除. fix_inventory(),fix_equip() のみ未サポート化. /
[hengband/hengband.git] / src / racial.c
index 9de05e6..6d10d2f 100644 (file)
@@ -21,7 +21,6 @@
 #include "cmd-pet.h"
 #include "melee.h"
 #include "object-hook.h"
-#include "realm-song.h"
 
 #include "mutation.h"
 #include "player-race.h"
@@ -35,7 +34,7 @@
 #include "cmd-spell.h"
 #include "realm-hex.h"
 #include "targeting.h"
-#include "view-mainwindow.h"
+#include "view/display-main-window.h"
 #include "player-class.h"
 
 /*!
@@ -63,9 +62,9 @@ static bool choose_kamae(player_type *creature_ptr)
        }
 
        prt("", 1, 0);
-       prt(_("        どの構えをとりますか?", "        Choose Form: "), 1, 14);
+       prt(_("        どの構えをとりますか?", "        Choose Stance: "), 1, 14);
 
-       while(1)
+       while (TRUE)
        {
                choice = inkey();
 
@@ -81,7 +80,7 @@ static bool choose_kamae(player_type *creature_ptr)
                                set_action(creature_ptr, ACTION_NONE);
                        }
                        else
-                               msg_print(_("もともと構えていない。", "You are not assuming a posture."));
+                               msg_print(_("もともと構えていない。", "You are not in a special stance."));
                        screen_load();
                        return TRUE;
                }
@@ -110,14 +109,14 @@ static bool choose_kamae(player_type *creature_ptr)
 
        if (creature_ptr->special_defense & (KAMAE_GENBU << new_kamae))
        {
-               msg_print(_("構え直した。", "You reassume a posture."));
+               msg_print(_("構え直した。", "You reassume a stance."));
        }
        else
        {
                creature_ptr->special_defense &= ~(KAMAE_MASK);
                creature_ptr->update |= (PU_BONUS);
                creature_ptr->redraw |= (PR_STATE);
-               msg_format(_("%sの構えをとった。", "You assume a posture of %s form."),kamae_shurui[new_kamae].desc);
+               msg_format(_("%sの構えをとった。", "You assume the %s stance."), kamae_shurui[new_kamae].desc);
                creature_ptr->special_defense |= (KAMAE_GENBU << new_kamae);
        }
        creature_ptr->redraw |= PR_STATE;
@@ -156,15 +155,15 @@ static bool choose_kata(player_type *creature_ptr)
        {
                if (creature_ptr->lev >= kata_shurui[i].min_level)
                {
-                       sprintf(buf,_(" %c) %sの型    %s", " %c) Form of %-12s  %s"),I2A(i+1), kata_shurui[i].desc, kata_shurui[i].info);
+                       sprintf(buf,_(" %c) %sの型    %s", " %c) Stance of %-12s  %s"),I2A(i+1), kata_shurui[i].desc, kata_shurui[i].info);
                        prt(buf, 3+i, 20);
                }
        }
 
        prt("", 1, 0);
-       prt(_("        どの型で構えますか?", "        Choose Form: "), 1, 14);
+       prt(_("        どの型で構えますか?", "        Choose Stance: "), 1, 14);
 
-       while(1)
+       while (TRUE)
        {
                choice = inkey();
 
@@ -180,7 +179,7 @@ static bool choose_kata(player_type *creature_ptr)
                                set_action(creature_ptr, ACTION_NONE);
                        }
                        else
-                               msg_print(_("もともと構えていない。", "You are not assuming posture."));
+                               msg_print(_("もともと構えていない。", "You are not in a special stance."));
                        screen_load();
                        return TRUE;
                }
@@ -209,13 +208,13 @@ static bool choose_kata(player_type *creature_ptr)
 
        if (creature_ptr->special_defense & (KATA_IAI << new_kata))
        {
-               msg_print(_("構え直した。", "You reassume a posture."));
+               msg_print(_("構え直した。", "You reassume a stance."));
        }
        else
        {
                creature_ptr->special_defense &= ~(KATA_MASK);
                creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
-               msg_format(_("%sの型で構えた。", "You assume a posture of %s form."),kata_shurui[new_kata].desc);
+               msg_format(_("%sの型で構えた。", "You assume the %s stance."), kata_shurui[new_kata].desc);
                creature_ptr->special_defense |= (KATA_IAI << new_kata);
        }
        creature_ptr->redraw |= (PR_STATE | PR_STATUS);
@@ -225,14 +224,9 @@ static bool choose_kata(player_type *creature_ptr)
 
 
 /*!
- * @brief レイシャル・パワー情報のtypedef
- */
-typedef struct power_desc_type power_desc_type;
-
-/*!
  * @brief レイシャル・パワー情報の構造体定義
  */
-struct power_desc_type
+typedef struct power_desc_type
 {
        GAME_TEXT name[MAX_NLEN];      //!<レイシャル名
        PLAYER_LEVEL level;     //!<体得レベル
@@ -240,7 +234,7 @@ struct power_desc_type
        int stat;
        PERCENTAGE fail;
        int number;
-};
+} power_desc_type;
 
 
 /*!
@@ -261,7 +255,7 @@ static PERCENTAGE racial_chance(player_type *creature_ptr, power_desc_type *pd_p
        /* No chance for success */
        if ((creature_ptr->lev < min_level) || creature_ptr->confused)
        {
-               return (0);
+               return 0;
        }
 
        if (difficulty == 0) return 100;
@@ -380,6 +374,7 @@ static int racial_aux(player_type *creature_ptr, power_desc_type *pd_ptr)
 
 /*!
  * @brief レイシャル・パワー発動処理
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @param command 発動するレイシャルのID
  * @return 処理を実際に実行した場合はTRUE、キャンセルした場合FALSEを返す。
  */
@@ -404,6 +399,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                        if (retval) creature_ptr->energy_use = 10;
                        return (retval);
                }
+                       /* Fall through */
                case CLASS_MAGE:
                /* case CLASS_HIGH_MAGE: */
                case CLASS_SORCERER:
@@ -419,15 +415,15 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                        }
                        else
                        {
-                               (void)dispel_monsters(plev * 4);
-                               turn_monsters(plev * 4);
-                               banish_monsters(plev * 4);
+                               (void)dispel_monsters(creature_ptr, plev * 4);
+                               turn_monsters(creature_ptr, plev * 4);
+                               banish_monsters(creature_ptr, plev * 4);
                        }
                        break;
                }
                case CLASS_ROGUE:
                {
-                       if(!panic_hit()) return FALSE;
+                       if(!hit_and_away(creature_ptr)) return FALSE;
                        break;
                }
                case CLASS_RANGER:
@@ -439,7 +435,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                }
                case CLASS_PALADIN:
                {
-                       if (!get_aim_dir(&dir)) return FALSE;
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                        fire_beam(creature_ptr, is_good_realm(creature_ptr->realm1) ? GF_HOLY_FIRE : GF_HELL_FIRE,
                                  dir, plev * 3);
                        break;
@@ -465,7 +461,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                {
                        if (!(empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM))
                        {
-                               msg_print(_("素手じゃないとできません。", "You need to be bare hand."));
+                               msg_print(_("素手じゃないとできません。", "You need to be barehanded."));
                                return FALSE;
                        }
                        if (creature_ptr->riding)
@@ -494,19 +490,19 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                {
                        if (command == -3)
                        {
-                               if (!get_aim_dir(&dir)) return FALSE;
+                               if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                                project_length = 1;
                                fire_beam(creature_ptr, GF_PHOTO, dir, 1);
                        }
                        else if (command == -4)
                        {
-                               if (!identify_fully(FALSE)) return FALSE;
+                               if (!identify_fully(creature_ptr, FALSE, 0)) return FALSE;
                        }
                        break;
                }
                case CLASS_IMITATOR:
                {
-                       handle_stuff();
+                       handle_stuff(creature_ptr);
                        if (!do_cmd_mane(creature_ptr, TRUE)) return FALSE;
                        break;
                }
@@ -514,7 +510,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                {
                        if (command == -3)
                        {
-                               if (!get_aim_dir(&dir)) return FALSE;
+                               if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                                (void)fire_ball_hide(creature_ptr, GF_CHARM_LIVING, dir, creature_ptr->lev, 0);
                        }
                        else if (command == -4)
@@ -550,9 +546,9 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                case CLASS_RED_MAGE:
                {
                        if (cmd_limit_cast(creature_ptr)) return FALSE;
-                       handle_stuff();
+                       handle_stuff(creature_ptr);
                        do_cmd_cast(creature_ptr);
-                       handle_stuff();
+                       handle_stuff(creature_ptr);
                        if (!creature_ptr->paralyzed && !cmd_limit_cast(creature_ptr))
                                do_cmd_cast(creature_ptr);
                        break;
@@ -601,11 +597,11 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                {
                        if (creature_ptr->lev > 29)
                        {
-                               if (!identify_fully(TRUE)) return FALSE;
+                               if (!identify_fully(creature_ptr, TRUE, 0)) return FALSE;
                        }
                        else
                        {
-                               if (!ident_spell(creature_ptr, TRUE)) return FALSE;
+                               if (!ident_spell(creature_ptr, TRUE, 0)) return FALSE;
                        }
                        break;
                }
@@ -650,8 +646,8 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                case RACE_DWARF:
                        msg_print(_("周囲を調べた。", "You examine your surroundings."));
                        (void)detect_traps(creature_ptr, DETECT_RAD_DEFAULT, TRUE);
-                       (void)detect_doors(DETECT_RAD_DEFAULT);
-                       (void)detect_stairs(DETECT_RAD_DEFAULT);
+                       (void)detect_doors(creature_ptr, DETECT_RAD_DEFAULT);
+                       (void)detect_stairs(creature_ptr, DETECT_RAD_DEFAULT);
                        break;
 
                case RACE_HOBBIT:
@@ -696,12 +692,12 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
 
                case RACE_HALF_OGRE:
                        msg_print(_("爆発のルーンを慎重に仕掛けた...", "You carefully set an explosive rune..."));
-                       explosive_rune(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x);
+                       explosive_rune(creature_ptr, creature_ptr->y, creature_ptr->x);
                        break;
 
                case RACE_HALF_GIANT:
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       (void)wall_to_mud(dir, 20 + randint1(30));
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
+                       (void)wall_to_mud(creature_ptr, dir, 20 + randint1(30));
                        break;
 
                case RACE_HALF_TITAN:
@@ -710,20 +706,20 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                        break;
 
                case RACE_CYCLOPS:
-                       if (!get_aim_dir(&dir)) return FALSE;
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                        msg_print(_("巨大な岩を投げた。", "You throw a huge boulder."));
                        fire_bolt(creature_ptr, GF_MISSILE, dir, (3 * plev) / 2);
                        break;
 
                case RACE_YEEK:
-                       if (!get_aim_dir(&dir)) return FALSE;
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                        stop_mouth(creature_ptr);
                        msg_print(_("身の毛もよだつ叫び声を上げた!", "You make a horrible scream!"));
-                       (void)fear_monster(dir, plev);
+                       (void)fear_monster(creature_ptr, dir, plev);
                        break;
 
                case RACE_KLACKON:
-                       if (!get_aim_dir(&dir)) return FALSE;
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                        stop_mouth(creature_ptr);
                        msg_print(_("酸を吐いた。", "You spit acid."));
                        if (plev < 25) fire_bolt(creature_ptr, GF_ACID, dir, plev);
@@ -731,7 +727,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                        break;
 
                case RACE_KOBOLD:
-                       if (!get_aim_dir(&dir)) return FALSE;
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                        msg_print(_("毒のダーツを投げた。", "You throw a dart of poison."));
                        fire_bolt(creature_ptr, GF_POIS, dir, plev);
                        break;
@@ -739,14 +735,14 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                case RACE_NIBELUNG:
                        msg_print(_("周囲を調査した。", "You examine your surroundings."));
                        (void)detect_traps(creature_ptr, DETECT_RAD_DEFAULT, TRUE);
-                       (void)detect_doors(DETECT_RAD_DEFAULT);
-                       (void)detect_stairs(DETECT_RAD_DEFAULT);
+                       (void)detect_doors(creature_ptr, DETECT_RAD_DEFAULT);
+                       (void)detect_stairs(creature_ptr, DETECT_RAD_DEFAULT);
                        break;
 
                case RACE_DARK_ELF:
-                       if (!get_aim_dir(&dir)) return FALSE;
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                        msg_print(_("マジック・ミサイルを放った。", "You cast a magic missile."));
-                       fire_bolt_or_beam(10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4));
+                       fire_bolt_or_beam(creature_ptr, 10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4));
                        break;
 
                case RACE_DRACONIAN:
@@ -754,13 +750,13 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                        break;
 
                case RACE_MIND_FLAYER:
-                       if (!get_aim_dir(&dir)) return FALSE;
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                        msg_print(_("あなたは集中し、目が赤く輝いた...", "You concentrate and your eyes glow red..."));
                        fire_bolt(creature_ptr, GF_PSI, dir, plev);
                        break;
 
                case RACE_IMP:
-                       if (!get_aim_dir(&dir)) return FALSE;
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                        if (plev >= 30)
                        {
                                msg_print(_("ファイア・ボールを放った。", "You cast a ball of fire."));
@@ -788,16 +784,16 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                        break;
 
                case RACE_SPECTRE:
-                       if (!get_aim_dir(&dir)) return FALSE;
+                       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
                        stop_mouth(creature_ptr);
                        msg_print(_("あなたはおどろおどろしい叫び声をあげた!", "You emit an eldritch howl!"));
-                       (void)fear_monster(dir, plev);
+                       (void)fear_monster(creature_ptr, dir, plev);
                        break;
 
                case RACE_SPRITE:
                        msg_print(_("あなたは魔法の粉を投げつけた...", "You throw some magic dust..."));
-                       if (plev < 25) sleep_monsters_touch();
-                       else (void)sleep_monsters(plev);
+                       if (plev < 25) sleep_monsters_touch(creature_ptr);
+                       else (void)sleep_monsters(creature_ptr, plev);
                        break;
 
                case RACE_DEMON:
@@ -817,9 +813,11 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                        free_turn(creature_ptr);
        }
        }
+
        return TRUE;
 }
 
+
 /*!
  * @brief レイシャル・パワーコマンドのメインルーチン / Allow user to choose a power (racial / mutation) to activate
  * @return なし
@@ -873,7 +871,7 @@ void do_cmd_racial_power(player_type *creature_ptr)
        case CLASS_HIGH_MAGE:
                if (creature_ptr->realm1 == REALM_HEX)
                {
-                       strcpy(power_desc[num].name, _("詠唱をやめる", "Stop spelling"));
+                       strcpy(power_desc[num].name, _("詠唱をやめる", "Stop spell casting"));
                        power_desc[num].level = 1;
                        power_desc[num].cost = 0;
                        power_desc[num].stat = A_INT;
@@ -881,6 +879,7 @@ void do_cmd_racial_power(player_type *creature_ptr)
                        power_desc[num++].number = -3;
                        break;
                }
+               /* Fall through */
        case CLASS_MAGE:
                /* case CLASS_HIGH_MAGE: */
        case CLASS_SORCERER:
@@ -987,7 +986,7 @@ void do_cmd_racial_power(player_type *creature_ptr)
        }
        case CLASS_MONK:
        {
-               strcpy(power_desc[num].name, _("構える", "Assume a Posture"));
+               strcpy(power_desc[num].name, _("構える", "Assume a Stance"));
                power_desc[num].level = 25;
                power_desc[num].cost = 0;
                power_desc[num].stat = A_DEX;
@@ -1113,7 +1112,7 @@ void do_cmd_racial_power(player_type *creature_ptr)
                power_desc[num].fail = 0;
                power_desc[num++].number = -3;
 
-               strcpy(power_desc[num].name, _("型", "Assume a Posture"));
+               strcpy(power_desc[num].name, _("型", "Assume a Stance"));
                power_desc[num].level = 25;
                power_desc[num].cost = 0;
                power_desc[num].stat = A_DEX;
@@ -1733,14 +1732,14 @@ void do_cmd_racial_power(player_type *creature_ptr)
                        power_desc[num++].number = MUT1_STERILITY;
                }
 
-               if (creature_ptr->muta1 & MUT1_PANIC_HIT)
+               if (creature_ptr->muta1 & MUT1_HIT_AND_AWAY)
                {
                        strcpy(power_desc[num].name, _("ヒット&アウェイ", "Panic Hit"));
                        power_desc[num].level = 10;
                        power_desc[num].cost = 12;
                        power_desc[num].stat = A_DEX;
                        power_desc[num].fail = 14;
-                       power_desc[num++].number = MUT1_PANIC_HIT;
+                       power_desc[num++].number = MUT1_HIT_AND_AWAY;
                }
 
                if (creature_ptr->muta1 & MUT1_DAZZLE)