From: Hourier Date: Wed, 19 Aug 2020 04:46:07 +0000 (+0900) Subject: [Refactor] #40634 Separated muramasa.c/h from activation-switcher.c X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=09ac57d6d451f729394667d1c314f99a6252ec13;p=hengband%2Fhengband.git [Refactor] #40634 Separated muramasa.c/h from activation-switcher.c --- diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index 2d85f5da4..e20976312 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -364,6 +364,7 @@ + @@ -987,6 +988,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index 40eba0b67..09cf124d6 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -2051,6 +2051,9 @@ object-activation + + specific-object + @@ -4453,6 +4456,9 @@ object-activation + + specific-object + diff --git a/src/Makefile.am b/src/Makefile.am index de907660c..392b37365 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -675,6 +675,7 @@ hengband_SOURCES = \ 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/muramasa.c specific-object/muramasa.h \ specific-object/torch.c specific-object/torch.h \ \ spell/process-effect.c spell/process-effect.h \ diff --git a/src/object-activation/activation-switcher.c b/src/object-activation/activation-switcher.c index 5a1121c65..bde80c5d5 100644 --- a/src/object-activation/activation-switcher.c +++ b/src/object-activation/activation-switcher.c @@ -61,6 +61,7 @@ #include "player/special-defense-types.h" #include "racial/racial-android.h" #include "specific-object/death-crimson.h" +#include "specific-object/muramasa.h" #include "spell-kind/earthquake.h" #include "spell-kind/magic-item-recharger.h" #include "spell-kind/spells-beam.h" @@ -298,6 +299,15 @@ bool activate_escape(player_type *user_ptr) } } +bool activate_teleport_level(player_type *user_ptr) +{ + if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) + return FALSE; + + teleport_level(user_ptr, 0); + return TRUE; +} + bool switch_activation(player_type *user_ptr, object_type *o_ptr, const activation_type *const act_ptr, concptr name) { switch (act_ptr->index) { @@ -654,11 +664,7 @@ bool switch_activation(player_type *user_ptr, object_type *o_ptr, const activati (void)project(user_ptr, 0, 8, user_ptr->y, user_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1); return TRUE; case ACT_TELEPORT_LEVEL: - if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) - return FALSE; - - teleport_level(user_ptr, 0); - return TRUE; + return activate_teleport_level(user_ptr); case ACT_STRAIN_HASTE: msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name); take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1); @@ -670,20 +676,7 @@ bool switch_activation(player_type *user_ptr, object_type *o_ptr, const activati mitokohmon(user_ptr); return TRUE; case ACT_MURAMASA: - if (o_ptr->name1 != ART_MURAMASA) - return FALSE; - - if (!get_check(_("本当に使いますか?", "Are you sure?!"))) - return TRUE; - - msg_print(_("村正が震えた...", "The Muramasa pulsates...")); - do_inc_stat(user_ptr, A_STR); - if (one_in_(2)) { - msg_print(_("村正は壊れた!", "The Muramasa is destroyed!")); - curse_weapon_object(user_ptr, TRUE, o_ptr); - } - - return TRUE; + return activate_muramasa(user_ptr, o_ptr); case ACT_BLOODY_MOON: if (o_ptr->name1 != ART_BLOOD) return FALSE; diff --git a/src/specific-object/muramasa.c b/src/specific-object/muramasa.c new file mode 100644 index 000000000..0d710f8f7 --- /dev/null +++ b/src/specific-object/muramasa.c @@ -0,0 +1,25 @@ +#include "specific-object/muramasa.h" +#include "core/asking-player.h" +#include "art-definition/art-sword-types.h" +#include "spell/spells-object.h" +#include "status/base-status.h" +#include "system/object-type-definition.h" +#include "view/display-messages.h" + +bool activate_muramasa(player_type *user_ptr, object_type *o_ptr) +{ + if (o_ptr->name1 != ART_MURAMASA) + return FALSE; + + if (!get_check(_("–{“–‚ÉŽg‚¢‚Ü‚·‚©H", "Are you sure?!"))) + return TRUE; + + msg_print(_("‘º³‚ªk‚¦‚½DDD", "The Muramasa pulsates...")); + do_inc_stat(user_ptr, A_STR); + if (one_in_(2)) { + msg_print(_("‘º³‚͉ó‚ꂽI", "The Muramasa is destroyed!")); + curse_weapon_object(user_ptr, TRUE, o_ptr); + } + + return TRUE; +} diff --git a/src/specific-object/muramasa.h b/src/specific-object/muramasa.h new file mode 100644 index 000000000..2d7482196 --- /dev/null +++ b/src/specific-object/muramasa.h @@ -0,0 +1,5 @@ +#pragma once + +#include "system/angband.h" + +bool activate_muramasa(player_type *user_ptr, object_type *o_ptr);