OSDN Git Service

[Refactor] #38862 Moved feature.c/h, grid.c/h and trap.c/h to grid/
[hengband/hengband.git] / src / cmd / cmd-pet.c
index 04b7b0d..e6ed4d0 100644 (file)
@@ -1,26 +1,28 @@
-#include "angband.h"
-#include "core.h"
+#include "system/angband.h"
+#include "core/stuff-handler.h"
 #include "util.h"
 
-#include "cmd-dump.h"
-#include "floor.h"
-#include "grid.h"
+#include "io/write-diary.h"
+#include "cmd/cmd-dump.h"
+#include "floor/floor.h"
+#include "grid/grid.h"
 #include "melee.h"
 #include "sort.h"
-#include "player-move.h"
-#include "player-status.h"
-#include "player-effects.h"
-#include "player-skill.h"
-#include "player-class.h"
-#include "player-damage.h"
-#include "object-hook.h"
-#include "monster.h"
-#include "monster-status.h"
+#include "player/player-move.h"
+#include "player/player-status.h"
+#include "player/player-effects.h"
+#include "player/player-skill.h"
+#include "player/player-class.h"
+#include "player/player-damage.h"
+#include "object/object-hook.h"
+#include "monster/monster.h"
+#include "monster/monster-status.h"
 #include "cmd-pet.h"
 #include "cmd-basic.h"
-#include "view-mainwindow.h"
+#include "view/display-main-window.h"
 #include "targeting.h"
-#include "world.h"
+#include "world/world.h"
+#include "effect/spells-effect-util.h"
 
 int total_friends = 0;
 
@@ -69,64 +71,6 @@ bool player_can_ride_aux(player_type *creature_ptr, grid_type *g_ptr, bool now_r
        return p_can_enter;
 }
 
-
-/*!
-* @brief ペットの維持コスト計算
-* @return 維持コスト(%)
-*/
-PERCENTAGE calculate_upkeep(player_type *creature_ptr)
-{
-       MONSTER_IDX m_idx;
-       bool have_a_unique = FALSE;
-       DEPTH total_friend_levels = 0;
-
-       total_friends = 0;
-
-       for (m_idx = creature_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
-       {
-               monster_type *m_ptr;
-               monster_race *r_ptr;
-
-               m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
-               if (!monster_is_valid(m_ptr)) continue;
-               r_ptr = &r_info[m_ptr->r_idx];
-
-               if (is_pet(m_ptr))
-               {
-                       total_friends++;
-                       if (r_ptr->flags1 & RF1_UNIQUE)
-                       {
-                               if (creature_ptr->pclass == CLASS_CAVALRY)
-                               {
-                                       if (creature_ptr->riding == m_idx)
-                                               total_friend_levels += (r_ptr->level + 5) * 2;
-                                       else if (!have_a_unique && (r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
-                                               total_friend_levels += (r_ptr->level + 5) * 7 / 2;
-                                       else
-                                               total_friend_levels += (r_ptr->level + 5) * 10;
-                                       have_a_unique = TRUE;
-                               }
-                               else
-                                       total_friend_levels += (r_ptr->level + 5) * 10;
-                       }
-                       else
-                               total_friend_levels += r_ptr->level;
-
-               }
-       }
-
-       if (total_friends)
-       {
-               int upkeep_factor;
-               upkeep_factor = (total_friend_levels - (creature_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
-               if (upkeep_factor < 0) upkeep_factor = 0;
-               if (upkeep_factor > 1000) upkeep_factor = 1000;
-               return upkeep_factor;
-       }
-       else
-               return 0;
-}
-
 /*!
 * @brief ペットを開放するコマンドのメインルーチン
 * @return なし
@@ -173,7 +117,7 @@ void do_cmd_pet_dismiss(player_type *creature_ptr)
 
                delete_this = FALSE;
                kakunin = ((pet_ctr == creature_ptr->riding) || (m_ptr->nickname));
-               monster_desc(friend_name, m_ptr, MD_ASSUME_VISIBLE);
+               monster_desc(creature_ptr, friend_name, m_ptr, MD_ASSUME_VISIBLE);
 
                if (!all_pets)
                {
@@ -223,7 +167,7 @@ void do_cmd_pet_dismiss(player_type *creature_ptr)
                        {
                                GAME_TEXT m_name[MAX_NLEN];
 
-                               monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
+                               monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
                                exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
                        }
 
@@ -242,7 +186,7 @@ void do_cmd_pet_dismiss(player_type *creature_ptr)
                        creature_ptr->update |= (PU_BONUS);
                        creature_ptr->window |= (PW_MESSAGE);
 
-                       delete_monster_idx(pet_ctr);
+                       delete_monster_idx(creature_ptr, pet_ctr);
                        Dismissed++;
                }
        }
@@ -291,7 +235,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
                /* Skip non-empty grids */
                if (!player_can_ride_aux(creature_ptr, g_ptr, FALSE))
                {
-                       msg_print(_("そちらには降りられません。", "You cannot go to that direction."));
+                       msg_print(_("そちらには降りられません。", "You cannot go that direction."));
                        return FALSE;
                }
 
@@ -319,7 +263,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
 
                if (!g_ptr->m_idx || !m_ptr->ml)
                {
-                       msg_print(_("その場所にはモンスターはいません。", "Here is no monster."));
+                       msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
                        return FALSE;
                }
                if (!is_pet(m_ptr) && !force)
@@ -363,7 +307,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
                if (MON_CSLEEP(m_ptr))
                {
                        GAME_TEXT m_name[MAX_NLEN];
-                       monster_desc(m_name, m_ptr, 0);
+                       monster_desc(creature_ptr, m_name, m_ptr, 0);
                        (void)set_monster_csleep(creature_ptr, g_ptr->m_idx, 0);
                        msg_format(_("%sを起こした。", "You have woken %s up."), m_name);
                }
@@ -424,7 +368,7 @@ static void do_name_pet(player_type *creature_ptr)
                        msg_print(_("そのモンスターの名前は変えられない!", "You cannot change name of this monster!"));
                        return;
                }
-               monster_desc(m_name, m_ptr, 0);
+               monster_desc(creature_ptr, m_name, m_ptr, 0);
 
                msg_format(_("%sに名前をつける。", "Name %s."), m_name);
                msg_print(NULL);
@@ -449,7 +393,7 @@ static void do_name_pet(player_type *creature_ptr)
                                m_ptr->nickname = quark_add(out_val);
                                if (record_named_pet)
                                {
-                                       monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
+                                       monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
                                        exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_NAME, m_name);
                                }
                        }
@@ -457,7 +401,7 @@ static void do_name_pet(player_type *creature_ptr)
                        {
                                if (record_named_pet && old_name)
                                {
-                                       monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
+                                       monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
                                        exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_UNNAME, m_name);
                                }
                                m_ptr->nickname = 0;
@@ -609,7 +553,7 @@ void do_cmd_pet(player_type *creature_ptr)
                {
                        if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
                        {
-                               power_desc[num] = _("武器を片手で持つ", "use one hand to control a riding pet");
+                               power_desc[num] = _("武器を片手で持つ", "use one hand to control the pet you are riding");
                        }
                        else
                        {
@@ -629,7 +573,7 @@ void do_cmd_pet(player_type *creature_ptr)
                                {
                                        if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
                                        {
-                                               power_desc[num] = _("片手で格闘する", "use one hand to control a riding pet");
+                                               power_desc[num] = _("片手で格闘する", "use one hand to control the pet you are riding");
                                        }
                                        else
                                        {
@@ -642,7 +586,7 @@ void do_cmd_pet(player_type *creature_ptr)
                                {
                                        if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
                                        {
-                                               power_desc[num] = _("格闘を行わない", "use one hand to control a riding pet");
+                                               power_desc[num] = _("格闘を行わない", "use one hand to control the pet you are riding");
                                        }
                                        else
                                        {
@@ -900,7 +844,7 @@ void do_cmd_pet(player_type *creature_ptr)
 
                                if (is_pet(m_ptr))
                                {
-                                       monster_drop_carried_objects(m_ptr);
+                                       monster_drop_carried_objects(creature_ptr, m_ptr);
                                }
                        }
                }
@@ -1046,7 +990,7 @@ bool rakuba(player_type *creature_ptr, HIT_POINT dam, bool force)
                }
                if (!sn)
                {
-                       monster_desc(m_name, m_ptr, 0);
+                       monster_desc(creature_ptr, m_name, m_ptr, 0);
                        msg_format(_("%sから振り落とされそうになって、壁にぶつかった。", "You have nearly fallen from %s, but bumped into wall."), m_name);
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, r_ptr->level + 3, _("壁への衝突", "bumping into wall"), -1);
                        return FALSE;
@@ -1059,10 +1003,10 @@ bool rakuba(player_type *creature_ptr, HIT_POINT dam, bool force)
                creature_ptr->x = sx;
 
                /* Redraw the old spot */
-               lite_spot(oy, ox);
+               lite_spot(creature_ptr, oy, ox);
 
                /* Redraw the new spot */
-               lite_spot(creature_ptr->y, creature_ptr->x);
+               lite_spot(creature_ptr, creature_ptr->y, creature_ptr->x);
 
                /* Check for new panel */
                verify_panel(creature_ptr);
@@ -1084,7 +1028,7 @@ bool rakuba(player_type *creature_ptr, HIT_POINT dam, bool force)
 
        if (creature_ptr->levitation && !force)
        {
-               monster_desc(m_name, m_ptr, 0);
+               monster_desc(creature_ptr, m_name, m_ptr, 0);
                msg_format(_("%sから落ちたが、空中でうまく体勢を立て直して着地した。", "You are thrown from %s, but make a good landing."), m_name);
        }
        else