OSDN Git Service

[Refactor] #40466 Separated spells-craft.c/h from player-effects.c/h
authorHourier <hourier@users.sourceforge.jp>
Mon, 29 Jun 2020 12:27:47 +0000 (21:27 +0900)
committerHourier <hourier@users.sourceforge.jp>
Mon, 29 Jun 2020 12:27:47 +0000 (21:27 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/core/magic-effects-timeout-reducer.c
src/inventory/inventory-object.c
src/player/player-effects.c
src/player/player-effects.h
src/realm/realm-craft.c
src/spell-realm/spells-craft.c [new file with mode: 0644]
src/spell-realm/spells-craft.h [new file with mode: 0644]

index c41672f..0f9a33a 100644 (file)
     <ClCompile Include="..\..\src\object-hook\hook-quest.c" />\r
     <ClCompile Include="..\..\src\object-hook\hook-weapon.c" />\r
     <ClCompile Include="..\..\src\object-hook\hook-armor.c" />\r
+    <ClCompile Include="..\..\src\spell-realm\spells-craft.c" />\r
     <ClCompile Include="..\..\src\status\bad-status-setter.c" />\r
     <ClCompile Include="..\..\src\status\buff-setter.c" />\r
     <ClCompile Include="..\..\src\player\player-realm.c" />\r
     <ClInclude Include="..\..\src\object-hook\hook-perception.h" />\r
     <ClInclude Include="..\..\src\object-hook\hook-quest.h" />\r
     <ClInclude Include="..\..\src\object-hook\hook-weapon.h" />\r
+    <ClInclude Include="..\..\src\spell-realm\spells-craft.h" />\r
     <ClInclude Include="..\..\src\status\bad-status-setter.h" />\r
     <ClInclude Include="..\..\src\status\buff-setter.h" />\r
     <ClInclude Include="..\..\src\player\player-realm.h" />\r
index 70bec8d..c924e3b 100644 (file)
     <ClCompile Include="..\..\src\wizard\wizard-messages.c">
       <Filter>wizard</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\spell-realm\spells-craft.c">
+      <Filter>spell-realm</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\wizard\wizard-messages.h">
       <Filter>wizard</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\spell-realm\spells-craft.h">
+      <Filter>spell-realm</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index fba5f33..ff42666 100644 (file)
@@ -548,6 +548,7 @@ hengband_SOURCES = \
        spell-kind/spells-teleport.c spell-kind/spells-teleport.h \
        \
        spell-realm/spells-chaos.c spell-realm/spells-chaos.h \
+       spell-realm/spells-craft.c spell-realm/spells-craft.h \
        spell-realm/spells-crusade.c spell-realm/spells-crusade.h \
        spell-realm/spells-hex.c spell-realm/spells-hex.h \
        spell-realm/spells-song.c spell-realm/spells-song.h \
index aec94a4..4a199ed 100644 (file)
@@ -2,9 +2,10 @@
 #include "game-option/birth-options.h"
 #include "mind/mind-mirror-master.h"
 #include "mind/racial-kutar.h"
+#include "player/player-effects.h"
+#include "spell-realm/spells-craft.h"
 #include "status/bad-status-setter.h"
 #include "status/buff-setter.h"
-#include "player/player-effects.h"
 #include "status/sight-setter.h"
 
 /*!
index 43fc842..7d724d5 100644 (file)
@@ -7,7 +7,7 @@
 #include "object/object-stack.h"
 #include "object/object-value.h"
 #include "object/object-info.h"
-#include "player/player-effects.h" // 暫定、相互参照している.
+#include "spell-realm/spells-craft.h"
 #include "util/object-sort.h"
 #include "view/display-messages.h"
 #include "view/object-describer.h"
index 995da7f..dd7c27a 100644 (file)
 #include "io/report.h"
 #include "io/save.h"
 #include "locale/vowel-checker.h"
-#include "mind/stances-table.h"
 #include "mind/mind-force-trainer.h"
 #include "mind/mind-mirror-master.h"
 #include "mind/mind-sniper.h"
+#include "mind/stances-table.h"
 #include "monster/monster-status.h"
 #include "mutation/mutation.h"
 #include "object-enchant/artifact.h"
@@ -51,8 +51,6 @@
 #include "object/object-value.h"
 #include "perception/object-perception.h"
 #include "player/avatar.h"
-#include "status/bad-status-setter.h"
-#include "status/buff-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-move.h"
 #include "player/race-info-table.h"
 #include "realm/realm-song-numbers.h"
 #include "spell-kind/spells-floor.h"
+#include "spell-realm/spells-craft.h"
 #include "spell-realm/spells-hex.h"
 #include "spell/spells-status.h"
+#include "status/bad-status-setter.h"
+#include "status/buff-setter.h"
 #include "status/sight-setter.h"
 #include "sv-definition/sv-armor-types.h"
 #include "sv-definition/sv-protector-types.h"
@@ -952,133 +953,6 @@ bool set_tsuyoshi(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 }
 
 /*!
- * @brief 一時的元素スレイの継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
- * @param attack_type スレイのタイプID
- * @param v 継続時間
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_ele_attack(player_type *creature_ptr, u32b attack_type, TIME_EFFECT v)
-{
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if ((creature_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID)) {
-        creature_ptr->special_attack &= ~(ATTACK_ACID);
-        msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
-    }
-
-    if ((creature_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC)) {
-        creature_ptr->special_attack &= ~(ATTACK_ELEC);
-        msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
-    }
-
-    if ((creature_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE)) {
-        creature_ptr->special_attack &= ~(ATTACK_FIRE);
-        msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
-    }
-
-    if ((creature_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD)) {
-        creature_ptr->special_attack &= ~(ATTACK_COLD);
-        msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
-    }
-
-    if ((creature_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS)) {
-        creature_ptr->special_attack &= ~(ATTACK_POIS);
-        msg_print(_("毒で攻撃できなくなった。", "Your temporary poison brand fades away."));
-    }
-
-    if ((v) && (attack_type)) {
-        creature_ptr->special_attack |= (attack_type);
-        creature_ptr->ele_attack = v;
-#ifdef JP
-        msg_format("%sで攻撃できるようになった!",
-            ((attack_type == ATTACK_ACID)
-                    ? "酸"
-                    : ((attack_type == ATTACK_ELEC)
-                            ? "電撃"
-                            : ((attack_type == ATTACK_FIRE) ? "火炎"
-                                                            : ((attack_type == ATTACK_COLD) ? "冷気" : ((attack_type == ATTACK_POIS) ? "毒" : "(なし)"))))));
-#else
-        msg_format("For a while, the blows you deal will %s",
-            ((attack_type == ATTACK_ACID)
-                    ? "melt with acid!"
-                    : ((attack_type == ATTACK_ELEC)
-                            ? "shock your foes!"
-                            : ((attack_type == ATTACK_FIRE)
-                                    ? "burn with fire!"
-                                    : ((attack_type == ATTACK_COLD) ? "chill to the bone!"
-                                                                    : ((attack_type == ATTACK_POIS) ? "poison your enemies!" : "do nothing special."))))));
-#endif
-    }
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->redraw |= (PR_STATUS);
-    creature_ptr->update |= (PU_BONUS);
-    handle_stuff(creature_ptr);
-
-    return TRUE;
-}
-
-/*!
- * @brief 一時的元素免疫の継続時間をセットする / Set a temporary elemental brand.  Clear all other brands.  Print status messages. -LM-
- * @param immune_type 免疫のタイプID
- * @param v 継続時間
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_ele_immune(player_type *creature_ptr, u32b immune_type, TIME_EFFECT v)
-{
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if ((creature_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID)) {
-        creature_ptr->special_defense &= ~(DEFENSE_ACID);
-        msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
-    }
-
-    if ((creature_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC)) {
-        creature_ptr->special_defense &= ~(DEFENSE_ELEC);
-        msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
-    }
-
-    if ((creature_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE)) {
-        creature_ptr->special_defense &= ~(DEFENSE_FIRE);
-        msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
-    }
-
-    if ((creature_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD)) {
-        creature_ptr->special_defense &= ~(DEFENSE_COLD);
-        msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
-    }
-
-    if ((creature_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS)) {
-        creature_ptr->special_defense &= ~(DEFENSE_POIS);
-        msg_print(_("毒の攻撃で傷つけられるようになった。。", "You are no longer immune to poison."));
-    }
-
-    if ((v) && (immune_type)) {
-        creature_ptr->special_defense |= (immune_type);
-        creature_ptr->ele_immune = v;
-        msg_format(_("%sの攻撃を受けつけなくなった!", "For a while, You are immune to %s"),
-            ((immune_type == DEFENSE_ACID)
-                    ? _("酸", "acid!")
-                    : ((immune_type == DEFENSE_ELEC)
-                            ? _("電撃", "electricity!")
-                            : ((immune_type == DEFENSE_FIRE)
-                                    ? _("火炎", "fire!")
-                                    : ((immune_type == DEFENSE_COLD)
-                                            ? _("冷気", "cold!")
-                                            : ((immune_type == DEFENSE_POIS) ? _("毒", "poison!") : _("(なし)", "do nothing special.")))))));
-    }
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->redraw |= (PR_STATUS);
-    creature_ptr->update |= (PU_BONUS);
-    handle_stuff(creature_ptr);
-
-    return TRUE;
-}
-
-/*!
  * @brief 一時的酸耐性の継続時間をセットする / Set "oppose_acid", notice observable changes
  * @param v 継続時間
  * @param do_dec 現在の継続時間より長い値のみ上書きする
@@ -2194,106 +2068,3 @@ bool set_tim_res_time(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
     handle_stuff(creature_ptr);
     return TRUE;
 }
-
-/*
- * Choose a warrior-mage elemental attack. -LM-
- */
-bool choose_ele_attack(player_type *creature_ptr)
-{
-    if (!has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM)) {
-        msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
-        return FALSE;
-    }
-
-    screen_save();
-    int num = (creature_ptr->lev - 20) / 5;
-    c_prt(TERM_RED, _("        a) 焼棄", "        a) Fire Brand"), 2, 14);
-
-    if (num >= 2)
-        c_prt(TERM_L_WHITE, _("        b) 凍結", "        b) Cold Brand"), 3, 14);
-    else
-        prt("", 3, 14);
-
-    if (num >= 3)
-        c_prt(TERM_GREEN, _("        c) 毒殺", "        c) Poison Brand"), 4, 14);
-    else
-        prt("", 4, 14);
-
-    if (num >= 4)
-        c_prt(TERM_L_DARK, _("        d) 溶解", "        d) Acid Brand"), 5, 14);
-    else
-        prt("", 5, 14);
-
-    if (num >= 5)
-        c_prt(TERM_BLUE, _("        e) 電撃", "        e) Elec Brand"), 6, 14);
-    else
-        prt("", 6, 14);
-
-    prt("", 7, 14);
-    prt("", 8, 14);
-    prt("", 9, 14);
-
-    prt("", 1, 0);
-    prt(_("        どの元素攻撃をしますか?", "        Choose a temporary elemental brand "), 1, 14);
-
-    char choice = inkey();
-
-    if ((choice == 'a') || (choice == 'A'))
-        set_ele_attack(creature_ptr, ATTACK_FIRE, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
-    else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
-        set_ele_attack(creature_ptr, ATTACK_COLD, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
-    else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
-        set_ele_attack(creature_ptr, ATTACK_POIS, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
-    else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
-        set_ele_attack(creature_ptr, ATTACK_ACID, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
-    else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
-        set_ele_attack(creature_ptr, ATTACK_ELEC, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
-    else {
-        msg_print(_("魔法剣を使うのをやめた。", "You cancel the temporary branding."));
-        screen_load();
-        return FALSE;
-    }
-
-    screen_load();
-    return TRUE;
-}
-
-/*
- * Choose a elemental immune. -LM-
- */
-bool choose_ele_immune(player_type *creature_ptr, TIME_EFFECT immune_turn)
-{
-    screen_save();
-
-    c_prt(TERM_RED, _("        a) 火炎", "        a) Immunity to fire"), 2, 14);
-    c_prt(TERM_L_WHITE, _("        b) 冷気", "        b) Immunity to cold"), 3, 14);
-    c_prt(TERM_L_DARK, _("        c) 酸", "        c) Immunity to acid"), 4, 14);
-    c_prt(TERM_BLUE, _("        d) 電撃", "        d) Immunity to elec"), 5, 14);
-
-    prt("", 6, 14);
-    prt("", 7, 14);
-    prt("", 8, 14);
-    prt("", 9, 14);
-
-    prt("", 1, 0);
-    prt(_("        どの元素の免疫をつけますか?", "        Choose a temporary elemental immunity "), 1, 14);
-
-    char choice = inkey();
-
-    if ((choice == 'a') || (choice == 'A'))
-        set_ele_immune(creature_ptr, DEFENSE_FIRE, immune_turn);
-    else if ((choice == 'b') || (choice == 'B'))
-        set_ele_immune(creature_ptr, DEFENSE_COLD, immune_turn);
-    else if ((choice == 'c') || (choice == 'C'))
-        set_ele_immune(creature_ptr, DEFENSE_ACID, immune_turn);
-    else if ((choice == 'd') || (choice == 'D'))
-        set_ele_immune(creature_ptr, DEFENSE_ELEC, immune_turn);
-    else {
-        msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immunity."));
-        screen_load();
-        return FALSE;
-    }
-
-    screen_load();
-    return TRUE;
-}
index f887eb5..76ed245 100644 (file)
@@ -19,8 +19,6 @@ bool set_resist_magic(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_reflect(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_kabenuke(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tsuyoshi(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_ele_attack(player_type *creature_ptr, u32b attack_type, TIME_EFFECT v);
-bool set_ele_immune(player_type *creature_ptr, u32b immune_type, TIME_EFFECT v);
 bool set_oppose_acid(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_oppose_elec(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_oppose_fire(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
@@ -45,8 +43,6 @@ void do_poly_self(player_type *creature_ptr);
 bool set_ultimate_res(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_res_nether(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_res_time(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool choose_ele_attack(player_type *creature_ptr);
-bool choose_ele_immune(player_type *creature_ptr, TIME_EFFECT turn);
 bool set_wraith_form(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 void do_poly_wounds(player_type *creature_ptr);
 void change_race(player_type *creature_ptr, player_race_type new_race, concptr effect_msg);
index 2d835fd..622baa1 100644 (file)
@@ -9,6 +9,7 @@
 #include "player/selfinfo.h"
 #include "spell-kind/spells-curse-removal.h"
 #include "spell-kind/spells-perception.h"
+#include "spell-realm/spells-craft.h"
 #include "spell/range-calc.h"
 #include "spell/spells-object.h"
 #include "spell/spells-status.h"
diff --git a/src/spell-realm/spells-craft.c b/src/spell-realm/spells-craft.c
new file mode 100644 (file)
index 0000000..b0329e1
--- /dev/null
@@ -0,0 +1,238 @@
+#include "spell-realm/spells-craft.h"
+#include "core/stuff-handler.h"
+#include "game-option/disturbance-options.h"
+#include "io/input-key-acceptor.h"
+#include "player/player-move.h"
+#include "player/special-defense-types.h"
+#include "term/screen-processor.h"
+#include "term/term-color-types.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief 一時的元素スレイの継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
+ * @param attack_type スレイのタイプID
+ * @param v 継続時間
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_ele_attack(player_type *creature_ptr, u32b attack_type, TIME_EFFECT v)
+{
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if ((creature_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID)) {
+        creature_ptr->special_attack &= ~(ATTACK_ACID);
+        msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
+    }
+
+    if ((creature_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC)) {
+        creature_ptr->special_attack &= ~(ATTACK_ELEC);
+        msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
+    }
+
+    if ((creature_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE)) {
+        creature_ptr->special_attack &= ~(ATTACK_FIRE);
+        msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
+    }
+
+    if ((creature_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD)) {
+        creature_ptr->special_attack &= ~(ATTACK_COLD);
+        msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
+    }
+
+    if ((creature_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS)) {
+        creature_ptr->special_attack &= ~(ATTACK_POIS);
+        msg_print(_("毒で攻撃できなくなった。", "Your temporary poison brand fades away."));
+    }
+
+    if ((v) && (attack_type)) {
+        creature_ptr->special_attack |= (attack_type);
+        creature_ptr->ele_attack = v;
+#ifdef JP
+        msg_format("%sで攻撃できるようになった!",
+            ((attack_type == ATTACK_ACID)
+                    ? "酸"
+                    : ((attack_type == ATTACK_ELEC)
+                            ? "電撃"
+                            : ((attack_type == ATTACK_FIRE) ? "火炎"
+                                                            : ((attack_type == ATTACK_COLD) ? "冷気" : ((attack_type == ATTACK_POIS) ? "毒" : "(なし)"))))));
+#else
+        msg_format("For a while, the blows you deal will %s",
+            ((attack_type == ATTACK_ACID)
+                    ? "melt with acid!"
+                    : ((attack_type == ATTACK_ELEC)
+                            ? "shock your foes!"
+                            : ((attack_type == ATTACK_FIRE)
+                                    ? "burn with fire!"
+                                    : ((attack_type == ATTACK_COLD) ? "chill to the bone!"
+                                                                    : ((attack_type == ATTACK_POIS) ? "poison your enemies!" : "do nothing special."))))));
+#endif
+    }
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->redraw |= (PR_STATUS);
+    creature_ptr->update |= (PU_BONUS);
+    handle_stuff(creature_ptr);
+
+    return TRUE;
+}
+
+/*!
+ * @brief 一時的元素免疫の継続時間をセットする / Set a temporary elemental brand.  Clear all other brands.  Print status messages. -LM-
+ * @param immune_type 免疫のタイプID
+ * @param v 継続時間
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_ele_immune(player_type *creature_ptr, u32b immune_type, TIME_EFFECT v)
+{
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if ((creature_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID)) {
+        creature_ptr->special_defense &= ~(DEFENSE_ACID);
+        msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
+    }
+
+    if ((creature_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC)) {
+        creature_ptr->special_defense &= ~(DEFENSE_ELEC);
+        msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
+    }
+
+    if ((creature_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE)) {
+        creature_ptr->special_defense &= ~(DEFENSE_FIRE);
+        msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
+    }
+
+    if ((creature_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD)) {
+        creature_ptr->special_defense &= ~(DEFENSE_COLD);
+        msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
+    }
+
+    if ((creature_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS)) {
+        creature_ptr->special_defense &= ~(DEFENSE_POIS);
+        msg_print(_("毒の攻撃で傷つけられるようになった。。", "You are no longer immune to poison."));
+    }
+
+    if ((v) && (immune_type)) {
+        creature_ptr->special_defense |= (immune_type);
+        creature_ptr->ele_immune = v;
+        msg_format(_("%sの攻撃を受けつけなくなった!", "For a while, You are immune to %s"),
+            ((immune_type == DEFENSE_ACID)
+                    ? _("酸", "acid!")
+                    : ((immune_type == DEFENSE_ELEC)
+                            ? _("電撃", "electricity!")
+                            : ((immune_type == DEFENSE_FIRE)
+                                    ? _("火炎", "fire!")
+                                    : ((immune_type == DEFENSE_COLD)
+                                            ? _("冷気", "cold!")
+                                            : ((immune_type == DEFENSE_POIS) ? _("毒", "poison!") : _("(なし)", "do nothing special.")))))));
+    }
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->redraw |= (PR_STATUS);
+    creature_ptr->update |= (PU_BONUS);
+    handle_stuff(creature_ptr);
+
+    return TRUE;
+}
+
+/*
+ * Choose a warrior-mage elemental attack. -LM-
+ */
+bool choose_ele_attack(player_type *creature_ptr)
+{
+    if (!has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM)) {
+        msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
+        return FALSE;
+    }
+
+    screen_save();
+    int num = (creature_ptr->lev - 20) / 5;
+    c_prt(TERM_RED, _("        a) 焼棄", "        a) Fire Brand"), 2, 14);
+
+    if (num >= 2)
+        c_prt(TERM_L_WHITE, _("        b) 凍結", "        b) Cold Brand"), 3, 14);
+    else
+        prt("", 3, 14);
+
+    if (num >= 3)
+        c_prt(TERM_GREEN, _("        c) 毒殺", "        c) Poison Brand"), 4, 14);
+    else
+        prt("", 4, 14);
+
+    if (num >= 4)
+        c_prt(TERM_L_DARK, _("        d) 溶解", "        d) Acid Brand"), 5, 14);
+    else
+        prt("", 5, 14);
+
+    if (num >= 5)
+        c_prt(TERM_BLUE, _("        e) 電撃", "        e) Elec Brand"), 6, 14);
+    else
+        prt("", 6, 14);
+
+    prt("", 7, 14);
+    prt("", 8, 14);
+    prt("", 9, 14);
+
+    prt("", 1, 0);
+    prt(_("        どの元素攻撃をしますか?", "        Choose a temporary elemental brand "), 1, 14);
+
+    char choice = inkey();
+
+    if ((choice == 'a') || (choice == 'A'))
+        set_ele_attack(creature_ptr, ATTACK_FIRE, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
+    else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
+        set_ele_attack(creature_ptr, ATTACK_COLD, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
+    else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
+        set_ele_attack(creature_ptr, ATTACK_POIS, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
+    else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
+        set_ele_attack(creature_ptr, ATTACK_ACID, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
+    else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
+        set_ele_attack(creature_ptr, ATTACK_ELEC, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
+    else {
+        msg_print(_("魔法剣を使うのをやめた。", "You cancel the temporary branding."));
+        screen_load();
+        return FALSE;
+    }
+
+    screen_load();
+    return TRUE;
+}
+/*
+ * Choose a elemental immune. -LM-
+ */
+bool choose_ele_immune(player_type *creature_ptr, TIME_EFFECT immune_turn)
+{
+    screen_save();
+
+    c_prt(TERM_RED, _("        a) 火炎", "        a) Immunity to fire"), 2, 14);
+    c_prt(TERM_L_WHITE, _("        b) 冷気", "        b) Immunity to cold"), 3, 14);
+    c_prt(TERM_L_DARK, _("        c) 酸", "        c) Immunity to acid"), 4, 14);
+    c_prt(TERM_BLUE, _("        d) 電撃", "        d) Immunity to elec"), 5, 14);
+
+    prt("", 6, 14);
+    prt("", 7, 14);
+    prt("", 8, 14);
+    prt("", 9, 14);
+
+    prt("", 1, 0);
+    prt(_("        どの元素の免疫をつけますか?", "        Choose a temporary elemental immunity "), 1, 14);
+
+    char choice = inkey();
+
+    if ((choice == 'a') || (choice == 'A'))
+        set_ele_immune(creature_ptr, DEFENSE_FIRE, immune_turn);
+    else if ((choice == 'b') || (choice == 'B'))
+        set_ele_immune(creature_ptr, DEFENSE_COLD, immune_turn);
+    else if ((choice == 'c') || (choice == 'C'))
+        set_ele_immune(creature_ptr, DEFENSE_ACID, immune_turn);
+    else if ((choice == 'd') || (choice == 'D'))
+        set_ele_immune(creature_ptr, DEFENSE_ELEC, immune_turn);
+    else {
+        msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immunity."));
+        screen_load();
+        return FALSE;
+    }
+
+    screen_load();
+    return TRUE;
+}
diff --git a/src/spell-realm/spells-craft.h b/src/spell-realm/spells-craft.h
new file mode 100644 (file)
index 0000000..e3a1071
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool set_ele_attack(player_type *creature_ptr, u32b attack_type, TIME_EFFECT v);
+bool set_ele_immune(player_type *creature_ptr, u32b immune_type, TIME_EFFECT v);
+bool choose_ele_attack(player_type *creature_ptr);
+bool choose_ele_immune(player_type *creature_ptr, TIME_EFFECT turn);