OSDN Git Service

[Refactor] #37353 行動パワー消費解除を take_turn() で再定義。 / Redefine free_turn() for non-consump...
[hengband/hengband.git] / src / mutation.c
index 96cadc4..9295874 100644 (file)
  */
 
 #include "angband.h"
+#include "mutation.h"
+
 #include "selfinfo.h"
+#include "spells-summon.h"
+#include "avatar.h"
+#include "player-status.h"
 
 /*!
  * @brief プレイヤーに突然変異を与える
  */
 bool gain_random_mutation(int choose_mut)
 {
-       int     attempts_left = 20;
-       cptr    muta_desc = "";
-       bool    muta_chosen = FALSE;
-       u32b    muta_which = 0;
-       u32b    *muta_class = NULL;
+       int attempts_left = 20;
+       concptr muta_desc = "";
+       bool muta_chosen = FALSE;
+       BIT_FLAGS muta_which = 0;
+       BIT_FLAGS *muta_class = NULL;
 
        if (choose_mut) attempts_left = 1;
 
@@ -860,10 +865,10 @@ bool gain_random_mutation(int choose_mut)
 bool lose_mutation(int choose_mut)
 {
        int attempts_left = 20;
-       cptr muta_desc = "";
+       concptr muta_desc = "";
        bool muta_chosen = FALSE;
-       u32b muta_which = 0;
-       u32b *muta_class = NULL;
+       BIT_FLAGS muta_which = 0;
+       BIT_FLAGS *muta_class = NULL;
 
        if (choose_mut) attempts_left = 1;
 
@@ -2001,15 +2006,13 @@ void dump_mutations(FILE *OutFile)
 void do_cmd_knowledge_mutations(void)
 {
        FILE *fff;
-       char file_name[1024];
+       GAME_TEXT file_name[1024];
 
        /* Open a new file */
        fff = my_fopen_temp(file_name, 1024);
 
        /* Dump the mutations to file */
        if (fff) dump_mutations(fff);
-
-       /* Close the file */
        my_fclose(fff);
 
        /* Display the file contents */
@@ -2140,68 +2143,7 @@ bool mutation_power_aux(int power)
                        break;
 
                case MUT1_EAT_ROCK:
-                       {
-                               POSITION x, y;
-                               cave_type *c_ptr;
-                               feature_type *f_ptr, *mimic_f_ptr;
-
-                               if (!get_rep_dir2(&dir)) return FALSE;
-                               y = p_ptr->y + ddy[dir];
-                               x = p_ptr->x + ddx[dir];
-                               c_ptr = &cave[y][x];
-                               f_ptr = &f_info[c_ptr->feat];
-                               mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
-
-                               stop_mouth();
-
-                               if (!have_flag(mimic_f_ptr->flags, FF_HURT_ROCK))
-                               {
-                                       msg_print(_("この地形は食べられない。", "You cannot eat this feature."));
-                                       break;
-                               }
-                               else if (have_flag(f_ptr->flags, FF_PERMANENT))
-                               {
-                                       msg_format(_("いてっ!この%sはあなたの歯より硬い!", "Ouch!  This %s is harder than your teeth!"), f_name + mimic_f_ptr->name);
-                                       break;
-                               }
-                               else if (c_ptr->m_idx)
-                               {
-                                       monster_type *m_ptr = &m_list[c_ptr->m_idx];
-                                       msg_print(_("何かが邪魔しています!", "There's something in the way!"));
-
-                                       if (!m_ptr->ml || !is_pet(m_ptr)) py_attack(y, x, 0);
-                                       break;
-                               }
-                               else if (have_flag(f_ptr->flags, FF_TREE))
-                               {
-                                       msg_print(_("木の味は好きじゃない!", "You don't like the woody taste!"));
-                                       break;
-                               }
-                               else if (have_flag(f_ptr->flags, FF_GLASS))
-                               {
-                                       msg_print(_("ガラスの味は好きじゃない!", "You don't like the glassy taste!"));
-                                       break;
-                               }
-                               else if (have_flag(f_ptr->flags, FF_DOOR) || have_flag(f_ptr->flags, FF_CAN_DIG))
-                               {
-                                       (void)set_food(p_ptr->food + 3000);
-                               }
-                               else if (have_flag(f_ptr->flags, FF_MAY_HAVE_GOLD) || have_flag(f_ptr->flags, FF_HAS_GOLD))
-                               {
-                                       (void)set_food(p_ptr->food + 5000);
-                               }
-                               else
-                               {
-                                       msg_format(_("この%sはとてもおいしい!", "This %s is very filling!"), f_name + mimic_f_ptr->name);
-                                       (void)set_food(p_ptr->food + 10000);
-                               }
-
-                               /* Destroy the wall */
-                               cave_alter_feat(y, x, FF_HURT_ROCK);
-
-                               /* Move the player */
-                               (void)move_player_effect(y, x, MPE_DONT_PICKUP);
-                       }
+                       return eat_lock();
                        break;
 
                case MUT1_SWAP_POS:
@@ -2257,10 +2199,10 @@ bool mutation_power_aux(int power)
                /* Summon pet molds around the player */
                case MUT1_GROW_MOLD:
                        {
-                               int i;
+                               DIRECTION i;
                                for (i = 0; i < 8; i++)
                                {
-                                       summon_specific(-1, p_ptr->y, p_ptr->x, lvl, SUMMON_MOLD, PM_FORCE_PET);
+                                       summon_specific(-1, p_ptr->y, p_ptr->x, lvl, SUMMON_MOLD, PM_FORCE_PET, '\0');
                                }
                        }
                        break;
@@ -2332,7 +2274,7 @@ bool mutation_power_aux(int power)
                        break;
 
                case MUT1_RECALL:
-                       if (!word_of_recall()) return FALSE;
+                       if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
                        break;
 
                case MUT1_BANISH:
@@ -2341,8 +2283,7 @@ bool mutation_power_aux(int power)
                                cave_type *c_ptr;
                                monster_type *m_ptr;
                                monster_race *r_ptr;
-
-                               if (!get_rep_dir2(&dir)) return FALSE;
+                               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
                                y = p_ptr->y + ddy[dir];
                                x = p_ptr->x + ddx[dir];
                                c_ptr = &cave[y][x];
@@ -2366,12 +2307,10 @@ bool mutation_power_aux(int power)
                                {
                                        if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
                                        {
-                                               char m_name[80];
-
+                                               GAME_TEXT m_name[MAX_NLEN];
                                                monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
                                                do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
                                        }
-
                                        /* Delete the monster, rather than killing it. */
                                        delete_monster_idx(c_ptr->m_idx);
                                        msg_print(_("その邪悪なモンスターは硫黄臭い煙とともに消え去った!", "The evil creature vanishes in a puff of sulfurous smoke!"));
@@ -2389,12 +2328,10 @@ bool mutation_power_aux(int power)
                        {
                                POSITION x, y;
                                cave_type *c_ptr;
-
-                               if (!get_rep_dir2(&dir)) return FALSE;
+                               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
                                y = p_ptr->y + ddy[dir];
                                x = p_ptr->x + ddx[dir];
                                c_ptr = &cave[y][x];
-
                                if (!c_ptr->m_idx)
                                {
                                        msg_print(_("あなたは何もない場所で手を振った。", "You wave your hands in the air."));
@@ -2405,14 +2342,14 @@ bool mutation_power_aux(int power)
                        }
                        break;
 
-               /* XXX_XXX_XXX Hack!  MUT1_LAUNCHER is negative, see above */
+               /* XXX_XXX_XXX Hack! MUT1_LAUNCHER is negative, see above */
                case 3: /* MUT1_LAUNCHER */
                        /* Gives a multiplier of 2 at first, up to 3 at 40th */
                        if (!do_cmd_throw(2 + lvl / 40, FALSE, -1)) return FALSE;
                        break;
 
                default:
-                       p_ptr->energy_use = 0;
+                       free_turn(p_ptr);
                        msg_format(_("能力 %s は実装されていません。", "Power %s not implemented. Oops."), power);
        }