OSDN Git Service

[Refactor] #40653 Separated mind-priest.c/h from spells-object.c/h
authorHourier <hourier@users.sourceforge.jp>
Fri, 21 Aug 2020 05:15:54 +0000 (14:15 +0900)
committerHourier <hourier@users.sourceforge.jp>
Fri, 21 Aug 2020 05:15:54 +0000 (14:15 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/mind/mind-priest.c [new file with mode: 0644]
src/mind/mind-priest.h [new file with mode: 0644]
src/racial/racial-switcher.c
src/spell/spells-object.c
src/spell/spells-object.h

index 8de55f2..9cdb75d 100644 (file)
     <ClCompile Include="..\..\src\mind\mind-magic-resistance.c" />\r
     <ClCompile Include="..\..\src\mind\mind-monk.c" />\r
     <ClCompile Include="..\..\src\mind\mind-power-getter.c" />\r
+    <ClCompile Include="..\..\src\mind\mind-priest.c" />\r
     <ClCompile Include="..\..\src\mind\mind-weaponsmith.c" />\r
     <ClCompile Include="..\..\src\monster-floor\monster-lite-util.c" />\r
     <ClCompile Include="..\..\src\monster-floor\monster-lite.c" />\r
     <ClInclude Include="..\..\src\mind\mind-monk.h" />\r
     <ClInclude Include="..\..\src\mind\mind-numbers.h" />\r
     <ClInclude Include="..\..\src\mind\mind-power-getter.h" />\r
+    <ClInclude Include="..\..\src\mind\mind-priest.h" />\r
     <ClInclude Include="..\..\src\mind\mind-types.h" />\r
     <ClInclude Include="..\..\src\mind\mind-weaponsmith.h" />\r
     <ClInclude Include="..\..\src\monster-floor\monster-lite-util.h" />\r
index e20fd30..2ce2f0b 100644 (file)
     <ClCompile Include="..\..\src\spell-realm\spells-arcane.c">
       <Filter>spell-realm</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\mind\mind-priest.c">
+      <Filter>mind</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\combat\shoot.h">
     <ClInclude Include="..\..\src\spell-realm\spells-arcane.h">
       <Filter>spell-realm</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\mind\mind-priest.h">
+      <Filter>mind</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 79c2b85..8f0f24e 100644 (file)
@@ -436,6 +436,7 @@ hengband_SOURCES = \
        mind/mind-ninja.c mind/mind-ninja.h \
        mind/mind-numbers.h \
        mind/mind-power-getter.c mind/mind-power-getter.h \
+       mind/mind-priest.c mind/mind-priest.h \
        mind/mind-samurai.c mind/mind-samurai.h \
        mind/mind-sniper.c mind/mind-sniper.h \
        mind/mind-types.h \
diff --git a/src/mind/mind-priest.c b/src/mind/mind-priest.c
new file mode 100644 (file)
index 0000000..8e5830e
--- /dev/null
@@ -0,0 +1,139 @@
+#include "mind/mind-priest.h"
+#include "core/player-update-types.h"
+#include "core/window-redrawer.h"
+#include "flavor/flavor-describer.h"
+#include "flavor/object-flavor-types.h"
+#include "floor/floor-object.h"
+#include "object-enchant/item-feeling.h"
+#include "object-enchant/special-object-flags.h"
+#include "object-enchant/trc-types.h"
+#include "object-enchant/tr-types.h"
+#include "object-hook/hook-checker.h"
+#include "object-hook/hook-enchant.h"
+#include "object-hook/hook-weapon.h"
+#include "object/item-tester-hooker.h"
+#include "object/item-use-flags.h"
+#include "object/object-flags.h"
+#include "racial/racial-android.h"
+#include "system/object-type-definition.h"
+#include "util/bit-flags-calculator.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief \95\90\8aí\82Ì\8fj\95\9f\8f\88\97\9d /
+ * Bless a weapon
+ * @return \83^\81[\83\93\8fÁ\94ï\82ð\97v\82·\82é\8f\88\97\9d\82ð\8ds\82Á\82½\82È\82ç\82ÎTRUE\82ð\95Ô\82·
+ */
+bool bless_weapon(player_type *caster_ptr)
+{
+    item_tester_hook = object_is_weapon;
+
+    concptr q = _("\82Ç\82Ì\83A\83C\83e\83\80\82ð\8fj\95\9f\82µ\82Ü\82·\82©\81H", "Bless which weapon? ");
+    concptr s = _("\8fj\95\9f\82Å\82«\82é\95\90\8aí\82ª\82 \82è\82Ü\82¹\82ñ\81B", "You have weapon to bless.");
+
+    OBJECT_IDX item;
+    object_type *o_ptr = choose_object(caster_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, 0);
+    if (!o_ptr)
+        return FALSE;
+
+    GAME_TEXT o_name[MAX_NLEN];
+    describe_flavor(caster_ptr, o_name, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY);
+    BIT_FLAGS flgs[TR_FLAG_SIZE];
+    object_flags(caster_ptr, o_ptr, flgs);
+
+    if (object_is_cursed(o_ptr)) {
+        if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) || have_flag(flgs, TR_ADD_L_CURSE) || have_flag(flgs, TR_ADD_H_CURSE)
+            || (o_ptr->curse_flags & TRC_PERMA_CURSE)) {
+#ifdef JP
+            msg_format("%s\82ð\95¢\82¤\8d\95\82¢\83I\81[\83\89\82Í\8fj\95\9f\82ð\92µ\82Ë\95Ô\82µ\82½\81I", o_name);
+#else
+            msg_format("The black aura on %s %s disrupts the blessing!", ((item >= 0) ? "your" : "the"), o_name);
+#endif
+
+            return TRUE;
+        }
+
+#ifdef JP
+        msg_format("%s \82©\82ç\8e×\88«\82È\83I\81[\83\89\82ª\8fÁ\82¦\82½\81B", o_name);
+#else
+        msg_format("A malignant aura leaves %s %s.", ((item >= 0) ? "your" : "the"), o_name);
+#endif
+        o_ptr->curse_flags = 0L;
+        o_ptr->ident |= IDENT_SENSE;
+        o_ptr->feeling = FEEL_NONE;
+        caster_ptr->update |= PU_BONUS;
+        caster_ptr->window |= PW_EQUIP;
+    }
+
+    /*
+     * Next, we try to bless it. Artifacts have a 1/3 chance of
+     * being blessed, otherwise, the operation simply disenchants
+     * them, godly power negating the magic. Ok, the explanation
+     * is silly, but otherwise priests would always bless every
+     * artifact weapon they find. Ego weapons and normal weapons
+     * can be blessed automatically.
+     */
+    if (have_flag(flgs, TR_BLESSED)) {
+#ifdef JP
+        msg_format("%s \82Í\8aù\82É\8fj\95\9f\82³\82ê\82Ä\82¢\82é\81B", o_name);
+#else
+        msg_format("%s %s %s blessed already.", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "were" : "was"));
+#endif
+        return TRUE;
+    }
+
+    if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3)) {
+#ifdef JP
+        msg_format("%s\82Í\8bP\82¢\82½\81I", o_name);
+#else
+        msg_format("%s %s shine%s!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s"));
+#endif
+        add_flag(o_ptr->art_flags, TR_BLESSED);
+        o_ptr->discount = 99;
+    } else {
+        bool dis_happened = FALSE;
+        msg_print(_("\82»\82Ì\95\90\8aí\82Í\8fj\95\9f\82ð\8c\99\82Á\82Ä\82¢\82é\81I", "The weapon resists your blessing!"));
+
+        /* Disenchant tohit */
+        if (o_ptr->to_h > 0) {
+            o_ptr->to_h--;
+            dis_happened = TRUE;
+        }
+
+        if ((o_ptr->to_h > 5) && (randint0(100) < 33))
+            o_ptr->to_h--;
+
+        /* Disenchant todam */
+        if (o_ptr->to_d > 0) {
+            o_ptr->to_d--;
+            dis_happened = TRUE;
+        }
+
+        if ((o_ptr->to_d > 5) && (randint0(100) < 33))
+            o_ptr->to_d--;
+
+        /* Disenchant toac */
+        if (o_ptr->to_a > 0) {
+            o_ptr->to_a--;
+            dis_happened = TRUE;
+        }
+
+        if ((o_ptr->to_a > 5) && (randint0(100) < 33))
+            o_ptr->to_a--;
+
+        if (dis_happened) {
+            msg_print(_("\8eü\88Í\82ª\96}\97f\82È\95µ\88Í\8bC\82Å\96\9e\82¿\82½...", "There is a static feeling in the air..."));
+
+#ifdef JP
+            msg_format("%s \82Í\97ò\89»\82µ\82½\81I", o_name);
+#else
+            msg_format("%s %s %s disenchanted!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "were" : "was"));
+#endif
+        }
+    }
+
+    caster_ptr->update |= PU_BONUS;
+    caster_ptr->window |= PW_EQUIP | PW_PLAYER;
+    calc_android_exp(caster_ptr);
+    return TRUE;
+}
diff --git a/src/mind/mind-priest.h b/src/mind/mind-priest.h
new file mode 100644 (file)
index 0000000..09868ac
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool bless_weapon(player_type *caster_ptr);
index ee58f6d..435652e 100644 (file)
@@ -36,6 +36,7 @@
 #include "mind/mind-mirror-master.h"
 #include "mind/mind-monk.h"
 #include "mind/mind-ninja.h"
+#include "mind/mind-priest.h"
 #include "mind/mind-samurai.h"
 #include "mind/mind-warrior-mage.h"
 #include "mind/mind-warrior.h"
index 8d500ac..03df0ed 100644 (file)
@@ -423,134 +423,6 @@ bool perilous_secrets(player_type *user_ptr)
 }
 
 /*!
- * @brief 武器の祝福処理 /
- * Bless a weapon
- * @return ターン消費を要する処理を行ったならばTRUEを返す
- */
-bool bless_weapon(player_type *caster_ptr)
-{
-    /* Bless only weapons */
-    item_tester_hook = object_is_weapon;
-
-    concptr q = _("どのアイテムを祝福しますか?", "Bless which weapon? ");
-    concptr s = _("祝福できる武器がありません。", "You have weapon to bless.");
-
-    OBJECT_IDX item;
-    object_type *o_ptr;
-    o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
-    if (!o_ptr)
-        return FALSE;
-
-    GAME_TEXT o_name[MAX_NLEN];
-    describe_flavor(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-    BIT_FLAGS flgs[TR_FLAG_SIZE];
-    object_flags(caster_ptr, o_ptr, flgs);
-
-    if (object_is_cursed(o_ptr)) {
-        if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) || have_flag(flgs, TR_ADD_L_CURSE) || have_flag(flgs, TR_ADD_H_CURSE)
-            || (o_ptr->curse_flags & TRC_PERMA_CURSE)) {
-#ifdef JP
-            msg_format("%sを覆う黒いオーラは祝福を跳ね返した!", o_name);
-#else
-            msg_format("The black aura on %s %s disrupts the blessing!", ((item >= 0) ? "your" : "the"), o_name);
-#endif
-
-            return TRUE;
-        }
-
-#ifdef JP
-        msg_format("%s から邪悪なオーラが消えた。", o_name);
-#else
-        msg_format("A malignant aura leaves %s %s.", ((item >= 0) ? "your" : "the"), o_name);
-#endif
-
-        o_ptr->curse_flags = 0L;
-
-        o_ptr->ident |= (IDENT_SENSE);
-        o_ptr->feeling = FEEL_NONE;
-
-        /* Recalculate the bonuses */
-        caster_ptr->update |= (PU_BONUS);
-        caster_ptr->window |= (PW_EQUIP);
-    }
-
-    /*
-     * Next, we try to bless it. Artifacts have a 1/3 chance of
-     * being blessed, otherwise, the operation simply disenchants
-     * them, godly power negating the magic. Ok, the explanation
-     * is silly, but otherwise priests would always bless every
-     * artifact weapon they find. Ego weapons and normal weapons
-     * can be blessed automatically.
-     */
-    if (have_flag(flgs, TR_BLESSED)) {
-#ifdef JP
-        msg_format("%s は既に祝福されている。", o_name);
-#else
-        msg_format("%s %s %s blessed already.", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "were" : "was"));
-#endif
-
-        return TRUE;
-    }
-
-    if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3)) {
-#ifdef JP
-        msg_format("%sは輝いた!", o_name);
-#else
-        msg_format("%s %s shine%s!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s"));
-#endif
-
-        add_flag(o_ptr->art_flags, TR_BLESSED);
-        o_ptr->discount = 99;
-    } else {
-        bool dis_happened = FALSE;
-        msg_print(_("その武器は祝福を嫌っている!", "The weapon resists your blessing!"));
-
-        /* Disenchant tohit */
-        if (o_ptr->to_h > 0) {
-            o_ptr->to_h--;
-            dis_happened = TRUE;
-        }
-
-        if ((o_ptr->to_h > 5) && (randint0(100) < 33))
-            o_ptr->to_h--;
-
-        /* Disenchant todam */
-        if (o_ptr->to_d > 0) {
-            o_ptr->to_d--;
-            dis_happened = TRUE;
-        }
-
-        if ((o_ptr->to_d > 5) && (randint0(100) < 33))
-            o_ptr->to_d--;
-
-        /* Disenchant toac */
-        if (o_ptr->to_a > 0) {
-            o_ptr->to_a--;
-            dis_happened = TRUE;
-        }
-
-        if ((o_ptr->to_a > 5) && (randint0(100) < 33))
-            o_ptr->to_a--;
-
-        if (dis_happened) {
-            msg_print(_("周囲が凡庸な雰囲気で満ちた...", "There is a static feeling in the air..."));
-
-#ifdef JP
-            msg_format("%s は劣化した!", o_name);
-#else
-            msg_format("%s %s %s disenchanted!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "were" : "was"));
-#endif
-        }
-    }
-
-    caster_ptr->update |= (PU_BONUS);
-    caster_ptr->window |= (PW_EQUIP | PW_PLAYER);
-    calc_android_exp(caster_ptr);
-
-    return TRUE;
-}
-
-/*!
  * @brief 盾磨き処理 /
  * pulish shield
  * @return ターン消費を要する処理を行ったならばTRUEを返す
index 89d0407..b8c1476 100644 (file)
@@ -8,7 +8,6 @@ bool curse_armor(player_type *owner_ptr);
 bool curse_weapon_object(player_type *creature_ptr, bool force, object_type *o_ptr);
 void brand_bolts(player_type *caster_ptr);
 bool perilous_secrets(player_type *user_ptr);
-bool bless_weapon(player_type *caster_ptr);
 bool pulish_shield(player_type *caster_ptr);
 bool create_ration(player_type *crature_ptr);