<ClCompile Include="..\..\src\object-activation\activation-breath.c" />\r
<ClCompile Include="..\..\src\object-activation\activation-charm.c" />\r
<ClCompile Include="..\..\src\object-activation\activation-resistance.c" />\r
+ <ClCompile Include="..\..\src\object-activation\activation-util.c" />\r
+ <ClCompile Include="..\..\src\specific-object\monster-ball.c" />\r
<ClCompile Include="..\..\src\object-use\read-execution.c" />\r
<ClCompile Include="..\..\src\player\player-status-flags.c" />\r
<ClCompile Include="..\..\src\player\player-status-table.c" />\r
<ClInclude Include="..\..\src\object-activation\activation-breath.h" />\r
<ClInclude Include="..\..\src\object-activation\activation-charm.h" />\r
<ClInclude Include="..\..\src\object-activation\activation-resistance.h" />\r
+ <ClInclude Include="..\..\src\object-activation\activation-util.h" />\r
+ <ClInclude Include="..\..\src\specific-object\monster-ball.h" />\r
<ClInclude Include="..\..\src\object-use\read-execution.h" />\r
<ClInclude Include="..\..\src\player\player-status-flags.h" />\r
<ClInclude Include="..\..\src\player\player-status-table.h" />\r
<ClCompile Include="..\..\src\object-activation\activation-others.c">
<Filter>object-activation</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\specific-object\monster-ball.c">
+ <Filter>specific-object</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\object-activation\activation-util.c">
+ <Filter>object-activation</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\combat\shoot.h">
<ClInclude Include="..\..\src\object-activation\activation-others.h">
<Filter>object-activation</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\specific-object\monster-ball.h">
+ <Filter>specific-object</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\object-activation\activation-util.h">
+ <Filter>object-activation</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
specific-object/chest.c specific-object/chest.h \
specific-object/death-crimson.c specific-object/death-crimson.h \
specific-object/death-scythe.c specific-object/death-scythe.h \
+ specific-object/monster-ball.c specific-object/monster-ball.h \
specific-object/muramasa.c specific-object/muramasa.h \
specific-object/ring-of-power.c specific-object/ring-of-power.h \
specific-object/torch.c specific-object/torch.h \
#include "monster/monster-info.h"
#include "monster/monster-util.h"
#include "object-activation/activation-switcher.h"
+#include "object-activation/activation-util.h"
#include "object-enchant/object-ego.h"
#include "object-hook/hook-enchant.h"
#include "object/object-info.h"
#include "object/object-kind.h"
#include "racial/racial-android.h"
+#include "specific-object/monster-ball.h"
#include "spell-kind/spells-launcher.h"
#include "spell-kind/spells-teleport.h"
#include "spell-realm/spells-hex.h"
#include "view/display-messages.h"
#include "world/world.h"
-// Activation Execution.
-typedef struct ae_type {
- DIRECTION dir;
- bool success;
- object_type *o_ptr;
- DEPTH lev;
- int chance;
- int fail;
-} ae_type;
-
-static ae_type *initialize_ae_type(player_type *user_ptr, ae_type *ae_ptr, const INVENTORY_IDX item)
-{
- ae_ptr->o_ptr = ref_item(user_ptr, item);
- ae_ptr->lev = k_info[ae_ptr->o_ptr->k_idx].level;
- return ae_ptr;
-}
-
static void decide_activation_level(player_type *user_ptr, ae_type *ae_ptr)
{
if (object_is_fixed_artifact(ae_ptr->o_ptr)) {
return TRUE;
}
-static void inscribe_nickname(ae_type *ae_ptr)
-{
- if (!cap_nickname)
- return;
-
- concptr t;
- char *s;
- char buf[80] = "";
- if (ae_ptr->o_ptr->inscription)
- strcpy(buf, quark_str(ae_ptr->o_ptr->inscription));
-
- s = buf;
- for (s = buf; *s && (*s != '#'); s++) {
-#ifdef JP
- if (iskanji(*s))
- s++;
-#endif
- }
-
- *s = '#';
- s++;
-#ifdef JP
-#else
- *s++ = '\'';
-#endif
- t = quark_str(cap_nickname);
- while (*t) {
- *s = *t;
- s++;
- t++;
- }
-#ifdef JP
-#else
- *s++ = '\'';
-#endif
- *s = '\0';
- ae_ptr->o_ptr->inscription = quark_add(buf);
-}
-
-static bool set_activation_target(player_type *user_ptr, ae_type *ae_ptr)
-{
- bool old_target_pet = target_pet;
- target_pet = TRUE;
- if (!get_aim_dir(user_ptr, &ae_ptr->dir)) {
- target_pet = old_target_pet;
- return FALSE;
- }
-
- target_pet = old_target_pet;
- if (!fire_ball(user_ptr, GF_CAPTURE, ae_ptr->dir, 0, 0))
- return TRUE;
-
- ae_ptr->o_ptr->pval = (PARAMETER_VALUE)cap_mon;
- ae_ptr->o_ptr->xtra3 = (XTRA8)cap_mspeed;
- ae_ptr->o_ptr->xtra4 = (XTRA16)cap_hp;
- ae_ptr->o_ptr->xtra5 = (XTRA16)cap_maxhp;
- inscribe_nickname(ae_ptr);
- return TRUE;
-}
-
-static void add_quark_to_inscription(player_type *user_ptr, ae_type *ae_ptr, concptr t, char *buf)
-{
- if (!*t)
- return;
-
- char *s = buf;
- t++;
-#ifdef JP
-#else
- bool quote = FALSE;
- if (*t == '\'') {
- t++;
- quote = TRUE;
- }
-#endif
-
- while (*t) {
- *s = *t;
- t++;
- s++;
- }
-
-#ifdef JP
-#else
- if (quote && *(s - 1) == '\'')
- s--;
-#endif
-
- *s = '\0';
- user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
- t = quark_str(ae_ptr->o_ptr->inscription);
- s = buf;
- while (*t && (*t != '#')) {
- *s = *t;
- t++;
- s++;
- }
-
- *s = '\0';
- ae_ptr->o_ptr->inscription = quark_add(buf);
-}
-
-static void check_inscription_value(player_type *user_ptr, ae_type *ae_ptr)
-{
- if (ae_ptr->o_ptr->inscription == 0)
- return;
-
- char buf[80];
- concptr t = quark_str(ae_ptr->o_ptr->inscription);
- for (t = quark_str(ae_ptr->o_ptr->inscription); *t && (*t != '#'); t++) {
-#ifdef JP
- if (iskanji(*t))
- t++;
-#endif
- }
-
- add_quark_to_inscription(user_ptr, ae_ptr, t, buf);
-}
-
-static void check_monster_ball_use(player_type *user_ptr, ae_type *ae_ptr)
-{
- if (!monster_can_enter(user_ptr, user_ptr->y + ddy[ae_ptr->dir], user_ptr->x + ddx[ae_ptr->dir], &r_info[ae_ptr->o_ptr->pval], 0))
- return;
-
- if (!place_monster_aux(user_ptr, 0, user_ptr->y + ddy[ae_ptr->dir], user_ptr->x + ddx[ae_ptr->dir], ae_ptr->o_ptr->pval, PM_FORCE_PET | PM_NO_KAGE))
- return;
-
- floor_type *floor_ptr = user_ptr->current_floor_ptr;
- if (ae_ptr->o_ptr->xtra3)
- floor_ptr->m_list[hack_m_idx_ii].mspeed = ae_ptr->o_ptr->xtra3;
-
- if (ae_ptr->o_ptr->xtra5)
- floor_ptr->m_list[hack_m_idx_ii].max_maxhp = ae_ptr->o_ptr->xtra5;
-
- if (ae_ptr->o_ptr->xtra4)
- floor_ptr->m_list[hack_m_idx_ii].hp = ae_ptr->o_ptr->xtra4;
-
- floor_ptr->m_list[hack_m_idx_ii].maxhp = floor_ptr->m_list[hack_m_idx_ii].max_maxhp;
- check_inscription_value(user_ptr, ae_ptr);
- ae_ptr->o_ptr->pval = 0;
- ae_ptr->o_ptr->xtra3 = 0;
- ae_ptr->o_ptr->xtra4 = 0;
- ae_ptr->o_ptr->xtra5 = 0;
- ae_ptr->success = TRUE;
-}
-
-static bool exe_monster_capture(player_type *user_ptr, ae_type *ae_ptr)
-{
- if (ae_ptr->o_ptr->tval != TV_CAPTURE)
- return FALSE;
-
- if (ae_ptr->o_ptr->pval == 0) {
- if (!set_activation_target(user_ptr, ae_ptr))
- return TRUE;
-
- calc_android_exp(user_ptr);
- return TRUE;
- }
-
- ae_ptr->success = FALSE;
- if (!get_direction(user_ptr, &ae_ptr->dir, FALSE, FALSE))
- return TRUE;
-
- check_monster_ball_use(user_ptr, ae_ptr);
- if (!ae_ptr->success)
- msg_print(_("\82¨\82Á\82Æ\81A\89ð\95ú\82É\8e¸\94s\82µ\82½\81B", "Oops. You failed to release your pet."));
-
- calc_android_exp(user_ptr);
- return TRUE;
-}
-
/*!
* @brief \91\95\94õ\82ð\94\93®\82·\82é\83R\83}\83\93\83h\82Ì\83T\83u\83\8b\81[\83`\83\93 /
* Activate a wielded object. Wielded objects never stack.
--- /dev/null
+#include "object-activation/activation-util.h"
+#include "object/object-info.h"
+#include "object/object-kind.h"
+
+ae_type *initialize_ae_type(player_type *user_ptr, ae_type *ae_ptr, const INVENTORY_IDX item)
+{
+ ae_ptr->o_ptr = ref_item(user_ptr, item);
+ ae_ptr->lev = k_info[ae_ptr->o_ptr->k_idx].level;
+ return ae_ptr;
+}
--- /dev/null
+#pragma once
+
+#include "system/angband.h"
+
+// Activation Execution.
+typedef struct ae_type {
+ DIRECTION dir;
+ bool success;
+ object_type *o_ptr;
+ DEPTH lev;
+ int chance;
+ int fail;
+} ae_type;
+
+ae_type *initialize_ae_type(player_type *user_ptr, ae_type *ae_ptr, const INVENTORY_IDX item);
--- /dev/null
+#include "specific-object/monster-ball.h"
+#include "effect/spells-effect-util.h"
+#include "floor/geometry.h"
+#include "game-option/input-options.h"
+#include "monster-floor/monster-generator.h"
+#include "monster-floor/place-monster-types.h"
+#include "monster-race/monster-race.h"
+#include "monster/monster-info.h"
+#include "monster/monster-util.h"
+#include "object-activation/activation-util.h"
+#include "racial/racial-android.h"
+#include "spell-kind/spells-launcher.h"
+#include "spell/spell-types.h"
+#include "system/floor-type-definition.h"
+#include "system/monster-type-definition.h"
+#include "system/object-type-definition.h"
+#include "target/target-getter.h"
+#include "util/quarks.h"
+#include "view/display-messages.h"
+
+static void inscribe_nickname(ae_type *ae_ptr)
+{
+ if (!cap_nickname)
+ return;
+
+ concptr t;
+ char *s;
+ char buf[80] = "";
+ if (ae_ptr->o_ptr->inscription)
+ strcpy(buf, quark_str(ae_ptr->o_ptr->inscription));
+
+ s = buf;
+ for (s = buf; *s && (*s != '#'); s++) {
+#ifdef JP
+ if (iskanji(*s))
+ s++;
+#endif
+ }
+
+ *s = '#';
+ s++;
+#ifdef JP
+#else
+ *s++ = '\'';
+#endif
+ t = quark_str(cap_nickname);
+ while (*t) {
+ *s = *t;
+ s++;
+ t++;
+ }
+#ifdef JP
+#else
+ *s++ = '\'';
+#endif
+ *s = '\0';
+ ae_ptr->o_ptr->inscription = quark_add(buf);
+}
+
+static bool set_activation_target(player_type *user_ptr, ae_type *ae_ptr)
+{
+ bool old_target_pet = target_pet;
+ target_pet = TRUE;
+ if (!get_aim_dir(user_ptr, &ae_ptr->dir)) {
+ target_pet = old_target_pet;
+ return FALSE;
+ }
+
+ target_pet = old_target_pet;
+ if (!fire_ball(user_ptr, GF_CAPTURE, ae_ptr->dir, 0, 0))
+ return TRUE;
+
+ ae_ptr->o_ptr->pval = (PARAMETER_VALUE)cap_mon;
+ ae_ptr->o_ptr->xtra3 = (XTRA8)cap_mspeed;
+ ae_ptr->o_ptr->xtra4 = (XTRA16)cap_hp;
+ ae_ptr->o_ptr->xtra5 = (XTRA16)cap_maxhp;
+ inscribe_nickname(ae_ptr);
+ return TRUE;
+}
+
+static void add_quark_to_inscription(player_type *user_ptr, ae_type *ae_ptr, concptr t, char *buf)
+{
+ if (!*t)
+ return;
+
+ char *s = buf;
+ t++;
+#ifdef JP
+#else
+ bool quote = FALSE;
+ if (*t == '\'') {
+ t++;
+ quote = TRUE;
+ }
+#endif
+
+ while (*t) {
+ *s = *t;
+ t++;
+ s++;
+ }
+
+#ifdef JP
+#else
+ if (quote && *(s - 1) == '\'')
+ s--;
+#endif
+
+ *s = '\0';
+ user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
+ t = quark_str(ae_ptr->o_ptr->inscription);
+ s = buf;
+ while (*t && (*t != '#')) {
+ *s = *t;
+ t++;
+ s++;
+ }
+
+ *s = '\0';
+ ae_ptr->o_ptr->inscription = quark_add(buf);
+}
+
+static void check_inscription_value(player_type *user_ptr, ae_type *ae_ptr)
+{
+ if (ae_ptr->o_ptr->inscription == 0)
+ return;
+
+ char buf[80];
+ concptr t = quark_str(ae_ptr->o_ptr->inscription);
+ for (t = quark_str(ae_ptr->o_ptr->inscription); *t && (*t != '#'); t++) {
+#ifdef JP
+ if (iskanji(*t))
+ t++;
+#endif
+ }
+
+ add_quark_to_inscription(user_ptr, ae_ptr, t, buf);
+}
+
+static void check_monster_ball_use(player_type *user_ptr, ae_type *ae_ptr)
+{
+ if (!monster_can_enter(user_ptr, user_ptr->y + ddy[ae_ptr->dir], user_ptr->x + ddx[ae_ptr->dir], &r_info[ae_ptr->o_ptr->pval], 0))
+ return;
+
+ if (!place_monster_aux(user_ptr, 0, user_ptr->y + ddy[ae_ptr->dir], user_ptr->x + ddx[ae_ptr->dir], ae_ptr->o_ptr->pval, PM_FORCE_PET | PM_NO_KAGE))
+ return;
+
+ floor_type *floor_ptr = user_ptr->current_floor_ptr;
+ if (ae_ptr->o_ptr->xtra3)
+ floor_ptr->m_list[hack_m_idx_ii].mspeed = ae_ptr->o_ptr->xtra3;
+
+ if (ae_ptr->o_ptr->xtra5)
+ floor_ptr->m_list[hack_m_idx_ii].max_maxhp = ae_ptr->o_ptr->xtra5;
+
+ if (ae_ptr->o_ptr->xtra4)
+ floor_ptr->m_list[hack_m_idx_ii].hp = ae_ptr->o_ptr->xtra4;
+
+ floor_ptr->m_list[hack_m_idx_ii].maxhp = floor_ptr->m_list[hack_m_idx_ii].max_maxhp;
+ check_inscription_value(user_ptr, ae_ptr);
+ ae_ptr->o_ptr->pval = 0;
+ ae_ptr->o_ptr->xtra3 = 0;
+ ae_ptr->o_ptr->xtra4 = 0;
+ ae_ptr->o_ptr->xtra5 = 0;
+ ae_ptr->success = TRUE;
+}
+
+bool exe_monster_capture(player_type *user_ptr, ae_type *ae_ptr)
+{
+ if (ae_ptr->o_ptr->tval != TV_CAPTURE)
+ return FALSE;
+
+ if (ae_ptr->o_ptr->pval == 0) {
+ if (!set_activation_target(user_ptr, ae_ptr))
+ return TRUE;
+
+ calc_android_exp(user_ptr);
+ return TRUE;
+ }
+
+ ae_ptr->success = FALSE;
+ if (!get_direction(user_ptr, &ae_ptr->dir, FALSE, FALSE))
+ return TRUE;
+
+ check_monster_ball_use(user_ptr, ae_ptr);
+ if (!ae_ptr->success)
+ msg_print(_("\82¨\82Á\82Æ\81A\89ð\95ú\82É\8e¸\94s\82µ\82½\81B", "Oops. You failed to release your pet."));
+
+ calc_android_exp(user_ptr);
+ return TRUE;
+}
--- /dev/null
+#pragma once
+
+#include "system/angband.h"
+
+typedef struct ae_type ae_type;
+bool exe_monster_capture(player_type *user_ptr, ae_type *ae_ptr);