OSDN Git Service

[Refactor] #39963 Separated effect-player-switcher.c/h from effect-player.c
authorHourier <hourier@users.sourceforge.jp>
Thu, 30 Apr 2020 07:20:43 +0000 (16:20 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 30 Apr 2020 07:20:43 +0000 (16:20 +0900)
Hengband_vcs2017/Hengband/Hengband.vcxproj
Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/effect/effect-player-switcher.c [new file with mode: 0644]
src/effect/effect-player-switcher.h [new file with mode: 0644]
src/effect/effect-player.c

index 2e69ee5..9620efa 100644 (file)
     <ClCompile Include="..\..\src\effect\effect-monster-switcher.c" />\r
     <ClCompile Include="..\..\src\effect\effect-monster-util.c" />\r
     <ClCompile Include="..\..\src\effect\effect-monster.c" />\r
+    <ClCompile Include="..\..\src\effect\effect-player-switcher.c" />\r
     <ClCompile Include="..\..\src\effect\effect-player.c" />\r
     <ClCompile Include="..\..\src\effect\spells-effect-util.c" />\r
     <ClCompile Include="..\..\src\io\dump-remover.c" />\r
     <ClInclude Include="..\..\src\effect\effect-monster-switcher.h" />\r
     <ClInclude Include="..\..\src\effect\effect-monster-util.h" />\r
     <ClInclude Include="..\..\src\effect\effect-monster.h" />\r
+    <ClInclude Include="..\..\src\effect\effect-player-switcher.h" />\r
     <ClInclude Include="..\..\src\effect\effect-player-util.h" />\r
     <ClInclude Include="..\..\src\effect\effect-player.h" />\r
     <ClInclude Include="..\..\src\effect\spells-effect-util.h" />\r
index 89c1461..33cd4cd 100644 (file)
     <ClCompile Include="..\..\src\effect\effect-monster-switcher.c">
       <Filter>effect</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\effect\effect-player-switcher.c">
+      <Filter>effect</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\gamevalue.h" />
     <ClInclude Include="..\..\src\effect\effect-player-util.h">
       <Filter>effect</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\effect\effect-player-switcher.h">
+      <Filter>effect</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index c8b897f..9130217 100644 (file)
@@ -173,6 +173,7 @@ hengband_SOURCES = \
        effect/effect-monster-util.c effect/effect-monster-util.h \
        effect/effect-monster-switcher.c effect/effect-monster-switcher.h \
        effect/effect-player-util.h \
+       effect/effect-player-switcher.c effect/effect-player-switcher.h \
        \
        spell/technic-info-table.c spell/technic-info-table.h \
        spell/spells-execution.c spell/spells-execution.h \
diff --git a/src/effect/effect-player-switcher.c b/src/effect/effect-player-switcher.c
new file mode 100644 (file)
index 0000000..4e7252e
--- /dev/null
@@ -0,0 +1,901 @@
+#include "angband.h"
+#include "effect-player-util.h"
+#include "effect/effect-player-switcher.h"
+#include "spell/spells-type.h"
+#include "player-damage.h"
+#include "world.h"
+#include "object-broken.h"
+#include "player-effects.h"
+#include "spells-status.h"
+#include "artifact.h"
+#include "player/mimic-info-table.h"
+#include "monster-spell.h"
+#include "mutation.h"
+#include "object-curse.h"
+
+/*!
+ * @brief \96\82\96@\82Ì\8cø\89Ê\82É\82æ\82Á\82Ä\97l\81X\82È\83\81\83b\83Z\81[\82ð\8fo\97Í\82µ\82½\82è\97^\82¦\82é\83_\83\81\81[\83W\82Ì\91\9d\8c¸\82ð\8ds\82Á\82½\82è\82·\82é
+ * @param target_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
+ * @param em_ptr \83v\83\8c\81[\83\84\81[\8cø\89Ê\8d\\91¢\91Ì\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
+ * @return \82È\82µ
+ */
+void switch_effects_player(player_type *target_ptr, effect_player_type *ep_ptr)
+{
+       switch (ep_ptr->effect_type)
+       {
+       case GF_ACID:
+       {
+               if (target_ptr->blind) msg_print(_("\8e_\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by acid!"));
+
+               ep_ptr->get_damage = acid_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
+               break;
+       }
+       case GF_FIRE:
+       {
+               if (target_ptr->blind) msg_print(_("\89Î\89\8a\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by fire!"));
+
+               ep_ptr->get_damage = fire_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
+               break;
+       }
+       case GF_COLD:
+       {
+               if (target_ptr->blind) msg_print(_("\97â\8bC\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by cold!"));
+
+               ep_ptr->get_damage = cold_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
+               break;
+       }
+       case GF_ELEC:
+       {
+               if (target_ptr->blind) msg_print(_("\93d\8c\82\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by lightning!"));
+
+               ep_ptr->get_damage = elec_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
+               break;
+       }
+       case GF_POIS:
+       {
+               bool double_resist = is_oppose_pois(target_ptr);
+               if (target_ptr->blind) msg_print(_("\93Å\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by poison!"));
+
+               if (target_ptr->resist_pois) ep_ptr->dam = (ep_ptr->dam + 2) / 3;
+               if (double_resist) ep_ptr->dam = (ep_ptr->dam + 2) / 3;
+
+               if ((!(double_resist || target_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       do_dec_stat(target_ptr, A_CON);
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+
+               if (!(double_resist || target_ptr->resist_pois) && !CHECK_MULTISHADOW(target_ptr))
+                       set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
+
+               break;
+       }
+       case GF_NUKE:
+       {
+               bool double_resist = is_oppose_pois(target_ptr);
+               if (target_ptr->blind) msg_print(_("\95ú\8eË\94\\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by radiation!"));
+
+               if (target_ptr->resist_pois) ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
+               if (double_resist) ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               if ((double_resist || target_ptr->resist_pois) || CHECK_MULTISHADOW(target_ptr))
+                       break;
+
+               set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
+
+               if (one_in_(5)) /* 6 */
+               {
+                       msg_print(_("\8aï\8c`\93I\82È\95Ï\90g\82ð\90\8b\82°\82½\81I", "You undergo a freakish metamorphosis!"));
+                       if (one_in_(4)) /* 4 */
+                               do_poly_self(target_ptr);
+                       else
+                               status_shuffle(target_ptr);
+               }
+
+               if (one_in_(6))
+               {
+                       inventory_damage(target_ptr, set_acid_destroy, 2);
+               }
+
+               break;
+       }
+       case GF_MISSILE:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_HOLY_FIRE:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
+               if (target_ptr->align > 10)
+                       ep_ptr->dam /= 2;
+               else if (target_ptr->align < -10)
+                       ep_ptr->dam *= 2;
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_HELL_FIRE:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
+               if (target_ptr->align > 10)
+                       ep_ptr->dam *= 2;
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_ARROW:
+       {
+               if (target_ptr->blind)
+               {
+                       msg_print(_("\89½\82©\89s\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something sharp!"));
+               }
+               else if ((target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
+               {
+                       msg_print(_("\96î\82ð\8ea\82è\8eÌ\82Ä\82½\81I", "You cut down the arrow!"));
+                       break;
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_PLASMA:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\82Æ\82Ä\82à\94M\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something *HOT*!"));
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+
+               if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       int plus_stun = (randint1((ep_ptr->dam > 40) ? 35 : (ep_ptr->dam * 3 / 4 + 5)));
+                       (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
+               }
+
+               if (!(target_ptr->resist_fire || is_oppose_fire(target_ptr) || target_ptr->immune_fire))
+               {
+                       inventory_damage(target_ptr, set_acid_destroy, 3);
+               }
+
+               break;
+       }
+       case GF_NETHER:
+       {
+               if (target_ptr->blind) msg_print(_("\92n\8d\96\82Ì\97Í\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by nether forces!"));
+               if (target_ptr->resist_neth)
+               {
+                       if (!PRACE_IS_(target_ptr, RACE_SPECTRE))
+                       {
+                               ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
+                       }
+               }
+               else if (!CHECK_MULTISHADOW(target_ptr)) drain_exp(target_ptr, 200 + (target_ptr->exp / 100), 200 + (target_ptr->exp / 1000), 75);
+
+               if (PRACE_IS_(target_ptr, RACE_SPECTRE) && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\8bC\95ª\82ª\82æ\82­\82È\82Á\82½\81B", "You feel invigorated!"));
+                       hp_player(target_ptr, ep_ptr->dam / 4);
+                       learn_spell(target_ptr, ep_ptr->monspell);
+               }
+               else
+               {
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               }
+
+               break;
+       }
+       case GF_WATER:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\8e¼\82Á\82½\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something wet!"));
+               if (CHECK_MULTISHADOW(target_ptr))
+               {
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+                       break;
+               }
+
+               if (!target_ptr->resist_sound && !target_ptr->resist_water)
+               {
+                       set_stun(target_ptr, target_ptr->stun + randint1(40));
+               }
+               if (!target_ptr->resist_conf && !target_ptr->resist_water)
+               {
+                       set_confused(target_ptr, target_ptr->confused + randint1(5) + 5);
+               }
+
+               if (one_in_(5) && !target_ptr->resist_water)
+               {
+                       inventory_damage(target_ptr, set_cold_destroy, 3);
+               }
+
+               if (target_ptr->resist_water) ep_ptr->get_damage /= 4;
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_CHAOS:
+       {
+               if (target_ptr->blind) msg_print(_("\96³\92\81\8f\98\82Ì\94g\93®\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by a wave of anarchy!"));
+               if (target_ptr->resist_chaos)
+               {
+                       ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
+               }
+
+               if (CHECK_MULTISHADOW(target_ptr))
+               {
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+                       break;
+               }
+
+               if (!target_ptr->resist_conf)
+               {
+                       (void)set_confused(target_ptr, target_ptr->confused + randint0(20) + 10);
+               }
+               if (!target_ptr->resist_chaos)
+               {
+                       (void)set_image(target_ptr, target_ptr->image + randint1(10));
+                       if (one_in_(3))
+                       {
+                               msg_print(_("\82 \82È\82½\82Ì\90g\91Ì\82Í\83J\83I\83X\82Ì\97Í\82Å\94P\82\8bÈ\82°\82ç\82ê\82½\81I", "Your body is twisted by chaos!"));
+                               (void)gain_mutation(target_ptr, 0);
+                       }
+               }
+               if (!target_ptr->resist_neth && !target_ptr->resist_chaos)
+               {
+                       drain_exp(target_ptr, 5000 + (target_ptr->exp / 100), 500 + (target_ptr->exp / 1000), 75);
+               }
+
+               if (!target_ptr->resist_chaos || one_in_(9))
+               {
+                       inventory_damage(target_ptr, set_elec_destroy, 2);
+                       inventory_damage(target_ptr, set_fire_destroy, 2);
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_SHARDS:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\89s\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something sharp!"));
+               if (target_ptr->resist_shard)
+               {
+                       ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
+               }
+               else if (!CHECK_MULTISHADOW(target_ptr))
+               {
+                       (void)set_cut(target_ptr, target_ptr->cut + ep_ptr->dam);
+               }
+
+               if (!target_ptr->resist_shard || one_in_(13))
+               {
+                       inventory_damage(target_ptr, set_cold_destroy, 2);
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_SOUND:
+       {
+               if (target_ptr->blind) msg_print(_("\8d\8c\89¹\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by a loud noise!"));
+               if (target_ptr->resist_sound)
+               {
+                       ep_ptr->dam *= 5; ep_ptr->dam /= (randint1(4) + 7);
+               }
+               else if (!CHECK_MULTISHADOW(target_ptr))
+               {
+                       int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
+                       (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
+               }
+
+               if (!target_ptr->resist_sound || one_in_(13))
+               {
+                       inventory_damage(target_ptr, set_cold_destroy, 2);
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_CONFUSION:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\8d¬\97\90\82·\82é\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something puzzling!"));
+               if (target_ptr->resist_conf)
+               {
+                       ep_ptr->dam *= 5; ep_ptr->dam /= (randint1(4) + 7);
+               }
+               else if (!CHECK_MULTISHADOW(target_ptr))
+               {
+                       (void)set_confused(target_ptr, target_ptr->confused + randint1(20) + 10);
+               }
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_DISENCHANT:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\82³\82¦\82È\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something static!"));
+               if (target_ptr->resist_disen)
+               {
+                       ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
+               }
+               else if (!CHECK_MULTISHADOW(target_ptr))
+               {
+                       (void)apply_disenchant(target_ptr, 0);
+               }
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_NEXUS:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\8aï\96­\82È\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something strange!"));
+               if (target_ptr->resist_nexus)
+               {
+                       ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
+               }
+               else if (!CHECK_MULTISHADOW(target_ptr))
+               {
+                       apply_nexus(ep_ptr->m_ptr, target_ptr);
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_FORCE:
+       {
+               if (target_ptr->blind) msg_print(_("\89^\93®\83G\83l\83\8b\83M\81[\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by kinetic force!"));
+               if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_ROCKET:
+       {
+               if (target_ptr->blind) msg_print(_("\94\9a\94­\82ª\82 \82Á\82½\81I", "There is an explosion!"));
+               if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
+               }
+
+               if (target_ptr->resist_shard)
+               {
+                       ep_ptr->dam /= 2;
+               }
+               else if (!CHECK_MULTISHADOW(target_ptr))
+               {
+                       (void)set_cut(target_ptr, target_ptr->cut + (ep_ptr->dam / 2));
+               }
+
+               if (!target_ptr->resist_shard || one_in_(12))
+               {
+                       inventory_damage(target_ptr, set_cold_destroy, 3);
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_INERTIAL:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\92x\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something slow!"));
+               if (!CHECK_MULTISHADOW(target_ptr)) (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_LITE:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
+               if (target_ptr->resist_lite)
+               {
+                       ep_ptr->dam *= 4; ep_ptr->dam /= (randint1(4) + 7);
+               }
+               else if (!target_ptr->blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
+               }
+
+               if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE))
+               {
+                       if (!CHECK_MULTISHADOW(target_ptr)) msg_print(_("\8cõ\82Å\93÷\91Ì\82ª\8fÅ\82ª\82³\82ê\82½\81I", "The light scorches your flesh!"));
+                       ep_ptr->dam *= 2;
+               }
+               else if (PRACE_IS_(target_ptr, RACE_S_FAIRY))
+               {
+                       ep_ptr->dam = ep_ptr->dam * 4 / 3;
+               }
+
+               if (target_ptr->wraith_form) ep_ptr->dam *= 2;
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+
+               if (!target_ptr->wraith_form || CHECK_MULTISHADOW(target_ptr))
+                       break;
+
+               target_ptr->wraith_form = 0;
+               msg_print(_("\91M\8cõ\82Ì\82½\82ß\94ñ\95¨\8e¿\93I\82È\89e\82Ì\91\8dÝ\82Å\82¢\82ç\82ê\82È\82­\82È\82Á\82½\81B",
+                       "The light forces you out of your incorporeal shadow form."));
+
+               target_ptr->redraw |= (PR_MAP | PR_STATUS);
+               target_ptr->update |= (PU_MONSTERS);
+               target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+               break;
+       }
+       case GF_DARK:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
+               if (target_ptr->resist_dark)
+               {
+                       ep_ptr->dam *= 4; ep_ptr->dam /= (randint1(4) + 7);
+
+                       if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form) ep_ptr->dam = 0;
+               }
+               else if (!target_ptr->blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_TIME:
+       {
+               if (target_ptr->blind) msg_print(_("\89ß\8b\8e\82©\82ç\82Ì\8fÕ\8c\82\82É\8dU\8c\82\82³\82ê\82½\81I", "You are hit by a blast from the past!"));
+
+               if (target_ptr->resist_time)
+               {
+                       ep_ptr->dam *= 4;
+                       ep_ptr->dam /= (randint1(4) + 7);
+                       msg_print(_("\8e\9e\8aÔ\82ª\92Ê\82è\89ß\82¬\82Ä\82¢\82­\8bC\82ª\82·\82é\81B", "You feel as if time is passing you by."));
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+                       break;
+               }
+
+               if (CHECK_MULTISHADOW(target_ptr))
+               {
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+                       break;
+               }
+
+               switch (randint1(10))
+               {
+               case 1:
+               case 2:
+               case 3:
+               case 4:
+               case 5:
+               {
+                       if (target_ptr->prace == RACE_ANDROID) break;
+
+                       msg_print(_("\90l\90\82ª\8bt\96ß\82è\82µ\82½\8bC\82ª\82·\82é\81B", "You feel like a chunk of the past has been ripped away."));
+                       lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
+                       break;
+               }
+               case 6:
+               case 7:
+               case 8:
+               case 9:
+               {
+                       int k = 0;
+                       concptr act = NULL;
+                       switch (randint1(6))
+                       {
+                       case 1: k = A_STR; act = _("\8b­\82­", "strong"); break;
+                       case 2: k = A_INT; act = _("\91\8f\96¾\82Å", "bright"); break;
+                       case 3: k = A_WIS; act = _("\8c«\96¾\82Å", "wise"); break;
+                       case 4: k = A_DEX; act = _("\8aí\97p\82Å", "agile"); break;
+                       case 5: k = A_CON; act = _("\8c\92\8dN\82Å", "hale"); break;
+                       case 6: k = A_CHR; act = _("\94ü\82µ\82­", "beautiful"); break;
+                       }
+
+                       msg_format(_("\82 \82È\82½\82Í\88È\91O\82Ù\82Ç%s\82È\82­\82È\82Á\82Ä\82µ\82Ü\82Á\82½...\81B", "You're not as %s as you used to be..."), act);
+                       target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 3) / 4;
+                       if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
+
+                       target_ptr->update |= (PU_BONUS);
+                       break;
+               }
+               case 10:
+               {
+                       msg_print(_("\82 \82È\82½\82Í\88È\91O\82Ù\82Ç\97Í\8b­\82­\82È\82­\82È\82Á\82Ä\82µ\82Ü\82Á\82½...\81B", "You're not as powerful as you used to be..."));
+                       for (int k = 0; k < A_MAX; k++)
+                       {
+                               target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
+                               if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
+                       }
+
+                       target_ptr->update |= (PU_BONUS);
+                       break;
+               }
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_GRAVITY:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\8fd\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something heavy!"));
+               msg_print(_("\8eü\95Ó\82Ì\8fd\97Í\82ª\82ä\82ª\82ñ\82¾\81B", "Gravity warps around you."));
+
+               if (!CHECK_MULTISHADOW(target_ptr))
+               {
+                       teleport_player(target_ptr, 5, TELEPORT_PASSIVE);
+                       if (!target_ptr->levitation)
+                               (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
+                       if (!(target_ptr->resist_sound || target_ptr->levitation))
+                       {
+                               int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
+                               (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
+                       }
+               }
+
+               if (target_ptr->levitation)
+               {
+                       ep_ptr->dam = (ep_ptr->dam * 2) / 3;
+               }
+
+               if (!target_ptr->levitation || one_in_(13))
+               {
+                       inventory_damage(target_ptr, set_cold_destroy, 2);
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_DISINTEGRATE:
+       {
+               if (target_ptr->blind) msg_print(_("\8f\83\90\88\82È\83G\83l\83\8b\83M\81[\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by pure energy!"));
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_OLD_HEAL:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82ç\82©\82Ì\8dU\8c\82\82É\82æ\82Á\82Ä\8bC\95ª\82ª\82æ\82­\82È\82Á\82½\81B", "You are hit by something invigorating!"));
+
+               (void)hp_player(target_ptr, ep_ptr->dam);
+               ep_ptr->dam = 0;
+               break;
+       }
+       case GF_OLD_SPEED:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
+               (void)set_fast(target_ptr, target_ptr->fast + randint1(5), FALSE);
+               ep_ptr->dam = 0;
+               break;
+       }
+       case GF_OLD_SLOW:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\92x\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something slow!"));
+               (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
+               break;
+       }
+       case GF_OLD_SLEEP:
+       {
+               if (target_ptr->free_act)  break;
+               if (target_ptr->blind) msg_print(_("\96°\82Á\82Ä\82µ\82Ü\82Á\82½\81I", "You fall asleep!"));
+
+               if (ironman_nightmare)
+               {
+                       msg_print(_("\8b°\82ë\82µ\82¢\8cõ\8ci\82ª\93ª\82É\95\82\82©\82ñ\82Å\82«\82½\81B", "A horrible vision enters your mind."));
+                       /* Have some nightmares */
+                       sanity_blast(target_ptr, NULL, FALSE);
+               }
+
+               set_paralyzed(target_ptr, target_ptr->paralyzed + ep_ptr->dam);
+               ep_ptr->dam = 0;
+               break;
+       }
+       case GF_MANA:
+       case GF_SEEKER:
+       case GF_SUPER_RAY:
+       {
+               if (target_ptr->blind) msg_print(_("\96\82\96@\82Ì\83I\81[\83\89\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by an aura of magic!"));
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_PSY_SPEAR:
+       {
+               if (target_ptr->blind) msg_print(_("\83G\83l\83\8b\83M\81[\82Ì\89ò\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by an energy!"));
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_FORCE, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_METEOR:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\82ª\8bó\82©\82ç\82 \82È\82½\82Ì\93ª\8fã\82É\97\8e\82¿\82Ä\82«\82½\81I", "Something falls from the sky on you!"));
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               if (!target_ptr->resist_shard || one_in_(13))
+               {
+                       if (!target_ptr->immune_fire) inventory_damage(target_ptr, set_fire_destroy, 2);
+                       inventory_damage(target_ptr, set_cold_destroy, 2);
+               }
+
+               break;
+       }
+       case GF_ICE:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\89s\82­\97â\82½\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something sharp and cold!"));
+
+               ep_ptr->get_damage = cold_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
+               if (CHECK_MULTISHADOW(target_ptr)) break;
+
+               if (!target_ptr->resist_shard)
+               {
+                       (void)set_cut(target_ptr, target_ptr->cut + damroll(5, 8));
+               }
+
+               if (!target_ptr->resist_sound)
+               {
+                       (void)set_stun(target_ptr, target_ptr->stun + randint1(15));
+               }
+
+               if ((!(target_ptr->resist_cold || is_oppose_cold(target_ptr))) || one_in_(12))
+               {
+                       if (!target_ptr->immune_cold) inventory_damage(target_ptr, set_cold_destroy, 3);
+               }
+
+               break;
+       }
+       case GF_DEATH_RAY:
+       {
+               if (target_ptr->blind) msg_print(_("\89½\82©\94ñ\8fí\82É\97â\82½\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something extremely cold!"));
+
+               if (target_ptr->mimic_form)
+               {
+                       if (!(mimic_info[target_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
+                               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+
+                       break;
+               }
+
+               switch (target_ptr->prace)
+               {
+               case RACE_GOLEM:
+               case RACE_SKELETON:
+               case RACE_ZOMBIE:
+               case RACE_VAMPIRE:
+               case RACE_DEMON:
+               case RACE_SPECTRE:
+               {
+                       ep_ptr->dam = 0;
+                       break;
+               }
+               default:
+               {
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+                       break;
+               }
+               }
+
+               break;
+       }
+       case GF_DRAIN_MANA:
+       {
+               if (CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\8dU\8c\82\82Í\8c\89e\82É\96½\92\86\82µ\81A\82 \82È\82½\82É\82Í\93Í\82©\82È\82©\82Á\82½\81B", "The attack hits Shadow, but you are unharmed!"));
+                       ep_ptr->dam = 0;
+                       break;
+               }
+
+               if (target_ptr->csp == 0)
+               {
+                       ep_ptr->dam = 0;
+                       break;
+               }
+
+               if (ep_ptr->who > 0)
+                       msg_format(_("%^s\82É\90¸\90_\83G\83l\83\8b\83M\81[\82ð\8bz\82¢\8eæ\82ç\82ê\82Ä\82µ\82Ü\82Á\82½\81I", "%^s draws psychic energy from you!"), ep_ptr->m_name);
+               else
+                       msg_print(_("\90¸\90_\83G\83l\83\8b\83M\81[\82ð\8bz\82¢\8eæ\82ç\82ê\82Ä\82µ\82Ü\82Á\82½\81I", "Your psychic energy is drawn!"));
+
+               if (ep_ptr->dam >= target_ptr->csp)
+               {
+                       ep_ptr->dam = target_ptr->csp;
+                       target_ptr->csp = 0;
+                       target_ptr->csp_frac = 0;
+               }
+               else
+               {
+                       target_ptr->csp -= ep_ptr->dam;
+               }
+
+               learn_spell(target_ptr, ep_ptr->monspell);
+               target_ptr->redraw |= (PR_MANA);
+               target_ptr->window |= (PW_PLAYER | PW_SPELL);
+
+               if ((ep_ptr->who <= 0) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp))
+               {
+                       ep_ptr->dam = 0;
+                       break;
+               }
+
+               ep_ptr->m_ptr->hp += ep_ptr->dam;
+               if (ep_ptr->m_ptr->hp > ep_ptr->m_ptr->maxhp) ep_ptr->m_ptr->hp = ep_ptr->m_ptr->maxhp;
+
+               if (target_ptr->health_who == ep_ptr->who) target_ptr->redraw |= (PR_HEALTH);
+               if (target_ptr->riding == ep_ptr->who) target_ptr->redraw |= (PR_UHEALTH);
+
+               if (ep_ptr->m_ptr->ml)
+               {
+                       msg_format(_("%^s\82Í\8bC\95ª\82ª\97Ç\82³\82»\82¤\82¾\81B", "%^s appears healthier."), ep_ptr->m_name);
+               }
+
+               ep_ptr->dam = 0;
+               break;
+       }
+       case GF_MIND_BLAST:
+       {
+               if ((randint0(100 + ep_ptr->rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
+                       learn_spell(target_ptr, ep_ptr->monspell);
+                       break;
+               }
+
+               if (CHECK_MULTISHADOW(target_ptr))
+               {
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+                       break;
+               }
+
+               msg_print(_("\97ì\93I\83G\83l\83\8b\83M\81[\82Å\90¸\90_\82ª\8dU\8c\82\82³\82ê\82½\81B", "Your mind is blasted by psionic energy."));
+               if (!target_ptr->resist_conf)
+               {
+                       (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
+               }
+
+               if (!target_ptr->resist_chaos && one_in_(3))
+               {
+                       (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
+               }
+
+               target_ptr->csp -= 50;
+               if (target_ptr->csp < 0)
+               {
+                       target_ptr->csp = 0;
+                       target_ptr->csp_frac = 0;
+               }
+
+               target_ptr->redraw |= PR_MANA;
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               break;
+       }
+       case GF_BRAIN_SMASH:
+       {
+               if ((randint0(100 + ep_ptr->rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
+                       learn_spell(target_ptr, ep_ptr->monspell);
+                       break;
+               }
+
+               if (!CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\97ì\93I\83G\83l\83\8b\83M\81[\82Å\90¸\90_\82ª\8dU\8c\82\82³\82ê\82½\81B", "Your mind is blasted by psionic energy."));
+
+                       target_ptr->csp -= 100;
+                       if (target_ptr->csp < 0)
+                       {
+                               target_ptr->csp = 0;
+                               target_ptr->csp_frac = 0;
+                       }
+                       target_ptr->redraw |= PR_MANA;
+               }
+
+               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               if (CHECK_MULTISHADOW(target_ptr)) break;
+
+               if (!target_ptr->resist_blind)
+               {
+                       (void)set_blind(target_ptr, target_ptr->blind + 8 + randint0(8));
+               }
+
+               if (!target_ptr->resist_conf)
+               {
+                       (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
+               }
+
+               if (!target_ptr->free_act)
+               {
+                       (void)set_paralyzed(target_ptr, target_ptr->paralyzed + randint0(4) + 4);
+               }
+
+               (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
+
+               while (randint0(100 + ep_ptr->rlev / 2) > (MAX(5, target_ptr->skill_sav)))
+                       (void)do_dec_stat(target_ptr, A_INT);
+               while (randint0(100 + ep_ptr->rlev / 2) > (MAX(5, target_ptr->skill_sav)))
+                       (void)do_dec_stat(target_ptr, A_WIS);
+
+               if (!target_ptr->resist_chaos)
+               {
+                       (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
+               }
+
+               break;
+       }
+       case GF_CAUSE_1:
+       {
+               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
+                       learn_spell(target_ptr, ep_ptr->monspell);
+               }
+               else
+               {
+                       if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 15, 0);
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               }
+               break;
+       }
+       case GF_CAUSE_2:
+       {
+               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
+                       learn_spell(target_ptr, ep_ptr->monspell);
+               }
+               else
+               {
+                       if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 25, MIN(ep_ptr->rlev / 2 - 15, 5));
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               }
+               break;
+       }
+       case GF_CAUSE_3:
+       {
+               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
+                       learn_spell(target_ptr, ep_ptr->monspell);
+               }
+               else
+               {
+                       if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 33, MIN(ep_ptr->rlev / 2 - 15, 15));
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+               }
+               break;
+       }
+       case GF_CAUSE_4:
+       {
+               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !(ep_ptr->m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\82µ\82©\82µ\94é\8dE\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
+                       learn_spell(target_ptr, ep_ptr->monspell);
+               }
+               else
+               {
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
+                       if (!CHECK_MULTISHADOW(target_ptr)) (void)set_cut(target_ptr, target_ptr->cut + damroll(10, 10));
+               }
+
+               break;
+       }
+       case GF_HAND_DOOM:
+       {
+               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
+               {
+                       msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
+                       learn_spell(target_ptr, ep_ptr->monspell);
+               }
+               else
+               {
+                       if (!CHECK_MULTISHADOW(target_ptr))
+                       {
+                               msg_print(_("\82 \82È\82½\82Í\96½\82ª\94\96\82Ü\82Á\82Ä\82¢\82­\82æ\82¤\82É\8a´\82\82½\81I", "You feel your life fade away!"));
+                               curse_equipment(target_ptr, 40, 20);
+                       }
+
+                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->m_name, ep_ptr->monspell);
+
+                       if (target_ptr->chp < 1) target_ptr->chp = 1;
+               }
+
+               break;
+       }
+       default:
+       {
+               ep_ptr->dam = 0;
+               break;
+       }
+       }
+}
diff --git a/src/effect/effect-player-switcher.h b/src/effect/effect-player-switcher.h
new file mode 100644 (file)
index 0000000..77981b0
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+void switch_effects_player(player_type *target_ptr, effect_player_type *ep_ptr);
index 96f17d4..ab329d1 100644 (file)
@@ -8,21 +8,13 @@
 #include "angband.h"
 #include "effect/effect-player-util.h"
 #include "effect/effect-player.h"
+#include "effect/effect-player-switcher.h"
 #include "main/sound-definitions-table.h"
-#include "player-damage.h"
-#include "world.h"
-#include "object-broken.h"
-#include "artifact.h"
-#include "player/mimic-info-table.h"
 #include "realm/realm-hex.h"
 #include "effect/spells-effect-util.h"
 #include "player-move.h"
-#include "player-effects.h"
-#include "spells-status.h"
-#include "monster-spell.h"
-#include "mutation.h"
-#include "object-curse.h"
 #include "spell/spells-type.h"
+#include "player-effects.h"
 
 typedef enum effect_player_check_result
 {
@@ -175,894 +167,6 @@ static void describe_effect_source(player_type *target_ptr, effect_player_type *
 
 
 /*!
- * @brief 魔法の効果によって様々なメッセーを出力したり与えるダメージの増減を行ったりする
- * @param target_ptr プレーヤーへの参照ポインタ
- * @param em_ptr プレーヤー効果構造体への参照ポインタ
- * @return なし
- */
-void switch_effects_player(player_type *target_ptr, effect_player_type *ep_ptr)
-{
-       switch (ep_ptr->effect_type)
-       {
-       case GF_ACID:
-       {
-               if (target_ptr->blind) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
-
-               ep_ptr->get_damage = acid_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
-               break;
-       }
-       case GF_FIRE:
-       {
-               if (target_ptr->blind) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
-
-               ep_ptr->get_damage = fire_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
-               break;
-       }
-       case GF_COLD:
-       {
-               if (target_ptr->blind) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
-
-               ep_ptr->get_damage = cold_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
-               break;
-       }
-       case GF_ELEC:
-       {
-               if (target_ptr->blind) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
-
-               ep_ptr->get_damage = elec_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
-               break;
-       }
-       case GF_POIS:
-       {
-               bool double_resist = is_oppose_pois(target_ptr);
-               if (target_ptr->blind) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
-
-               if (target_ptr->resist_pois) ep_ptr->dam = (ep_ptr->dam + 2) / 3;
-               if (double_resist) ep_ptr->dam = (ep_ptr->dam + 2) / 3;
-
-               if ((!(double_resist || target_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       do_dec_stat(target_ptr, A_CON);
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-
-               if (!(double_resist || target_ptr->resist_pois) && !CHECK_MULTISHADOW(target_ptr))
-                       set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
-
-               break;
-       }
-       case GF_NUKE:
-       {
-               bool double_resist = is_oppose_pois(target_ptr);
-               if (target_ptr->blind) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
-
-               if (target_ptr->resist_pois) ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
-               if (double_resist) ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               if ((double_resist || target_ptr->resist_pois) || CHECK_MULTISHADOW(target_ptr))
-                       break;
-
-               set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
-
-               if (one_in_(5)) /* 6 */
-               {
-                       msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
-                       if (one_in_(4)) /* 4 */
-                               do_poly_self(target_ptr);
-                       else
-                               status_shuffle(target_ptr);
-               }
-
-               if (one_in_(6))
-               {
-                       inventory_damage(target_ptr, set_acid_destroy, 2);
-               }
-
-               break;
-       }
-       case GF_MISSILE:
-       {
-               if (target_ptr->blind) msg_print(_("何かで攻撃された!", "You are hit by something!"));
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_HOLY_FIRE:
-       {
-               if (target_ptr->blind) msg_print(_("何かで攻撃された!", "You are hit by something!"));
-               if (target_ptr->align > 10)
-                       ep_ptr->dam /= 2;
-               else if (target_ptr->align < -10)
-                       ep_ptr->dam *= 2;
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_HELL_FIRE:
-       {
-               if (target_ptr->blind) msg_print(_("何かで攻撃された!", "You are hit by something!"));
-               if (target_ptr->align > 10)
-                       ep_ptr->dam *= 2;
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_ARROW:
-       {
-               if (target_ptr->blind)
-               {
-                       msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
-               }
-               else if ((target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
-               {
-                       msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
-                       break;
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_PLASMA:
-       {
-               if (target_ptr->blind) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-
-               if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       int plus_stun = (randint1((ep_ptr->dam > 40) ? 35 : (ep_ptr->dam * 3 / 4 + 5)));
-                       (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
-               }
-
-               if (!(target_ptr->resist_fire || is_oppose_fire(target_ptr) || target_ptr->immune_fire))
-               {
-                       inventory_damage(target_ptr, set_acid_destroy, 3);
-               }
-
-               break;
-       }
-       case GF_NETHER:
-       {
-               if (target_ptr->blind) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
-               if (target_ptr->resist_neth)
-               {
-                       if (!PRACE_IS_(target_ptr, RACE_SPECTRE))
-                       {
-                               ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
-                       }
-               }
-               else if (!CHECK_MULTISHADOW(target_ptr)) drain_exp(target_ptr, 200 + (target_ptr->exp / 100), 200 + (target_ptr->exp / 1000), 75);
-
-               if (PRACE_IS_(target_ptr, RACE_SPECTRE) && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("気分がよくなった。", "You feel invigorated!"));
-                       hp_player(target_ptr, ep_ptr->dam / 4);
-                       learn_spell(target_ptr, ep_ptr->monspell);
-               }
-               else
-               {
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               }
-
-               break;
-       }
-       case GF_WATER:
-       {
-               if (target_ptr->blind) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
-               if (CHECK_MULTISHADOW(target_ptr))
-               {
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-                       break;
-               }
-
-               if (!target_ptr->resist_sound && !target_ptr->resist_water)
-               {
-                       set_stun(target_ptr, target_ptr->stun + randint1(40));
-               }
-               if (!target_ptr->resist_conf && !target_ptr->resist_water)
-               {
-                       set_confused(target_ptr, target_ptr->confused + randint1(5) + 5);
-               }
-
-               if (one_in_(5) && !target_ptr->resist_water)
-               {
-                       inventory_damage(target_ptr, set_cold_destroy, 3);
-               }
-
-               if (target_ptr->resist_water) ep_ptr->get_damage /= 4;
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_CHAOS:
-       {
-               if (target_ptr->blind) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
-               if (target_ptr->resist_chaos)
-               {
-                       ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
-               }
-
-               if (CHECK_MULTISHADOW(target_ptr))
-               {
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-                       break;
-               }
-
-               if (!target_ptr->resist_conf)
-               {
-                       (void)set_confused(target_ptr, target_ptr->confused + randint0(20) + 10);
-               }
-               if (!target_ptr->resist_chaos)
-               {
-                       (void)set_image(target_ptr, target_ptr->image + randint1(10));
-                       if (one_in_(3))
-                       {
-                               msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
-                               (void)gain_mutation(target_ptr, 0);
-                       }
-               }
-               if (!target_ptr->resist_neth && !target_ptr->resist_chaos)
-               {
-                       drain_exp(target_ptr, 5000 + (target_ptr->exp / 100), 500 + (target_ptr->exp / 1000), 75);
-               }
-
-               if (!target_ptr->resist_chaos || one_in_(9))
-               {
-                       inventory_damage(target_ptr, set_elec_destroy, 2);
-                       inventory_damage(target_ptr, set_fire_destroy, 2);
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_SHARDS:
-       {
-               if (target_ptr->blind) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
-               if (target_ptr->resist_shard)
-               {
-                       ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
-               }
-               else if (!CHECK_MULTISHADOW(target_ptr))
-               {
-                       (void)set_cut(target_ptr, target_ptr->cut + ep_ptr->dam);
-               }
-
-               if (!target_ptr->resist_shard || one_in_(13))
-               {
-                       inventory_damage(target_ptr, set_cold_destroy, 2);
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_SOUND:
-       {
-               if (target_ptr->blind) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
-               if (target_ptr->resist_sound)
-               {
-                       ep_ptr->dam *= 5; ep_ptr->dam /= (randint1(4) + 7);
-               }
-               else if (!CHECK_MULTISHADOW(target_ptr))
-               {
-                       int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
-                       (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
-               }
-
-               if (!target_ptr->resist_sound || one_in_(13))
-               {
-                       inventory_damage(target_ptr, set_cold_destroy, 2);
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_CONFUSION:
-       {
-               if (target_ptr->blind) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
-               if (target_ptr->resist_conf)
-               {
-                       ep_ptr->dam *= 5; ep_ptr->dam /= (randint1(4) + 7);
-               }
-               else if (!CHECK_MULTISHADOW(target_ptr))
-               {
-                       (void)set_confused(target_ptr, target_ptr->confused + randint1(20) + 10);
-               }
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_DISENCHANT:
-       {
-               if (target_ptr->blind) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
-               if (target_ptr->resist_disen)
-               {
-                       ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
-               }
-               else if (!CHECK_MULTISHADOW(target_ptr))
-               {
-                       (void)apply_disenchant(target_ptr, 0);
-               }
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_NEXUS:
-       {
-               if (target_ptr->blind) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
-               if (target_ptr->resist_nexus)
-               {
-                       ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
-               }
-               else if (!CHECK_MULTISHADOW(target_ptr))
-               {
-                       apply_nexus(ep_ptr->m_ptr, target_ptr);
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_FORCE:
-       {
-               if (target_ptr->blind) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
-               if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_ROCKET:
-       {
-               if (target_ptr->blind) msg_print(_("爆発があった!", "There is an explosion!"));
-               if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
-               }
-
-               if (target_ptr->resist_shard)
-               {
-                       ep_ptr->dam /= 2;
-               }
-               else if (!CHECK_MULTISHADOW(target_ptr))
-               {
-                       (void)set_cut(target_ptr, target_ptr->cut + (ep_ptr->dam / 2));
-               }
-
-               if (!target_ptr->resist_shard || one_in_(12))
-               {
-                       inventory_damage(target_ptr, set_cold_destroy, 3);
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_INERTIAL:
-       {
-               if (target_ptr->blind) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
-               if (!CHECK_MULTISHADOW(target_ptr)) (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_LITE:
-       {
-               if (target_ptr->blind) msg_print(_("何かで攻撃された!", "You are hit by something!"));
-               if (target_ptr->resist_lite)
-               {
-                       ep_ptr->dam *= 4; ep_ptr->dam /= (randint1(4) + 7);
-               }
-               else if (!target_ptr->blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
-               }
-
-               if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE))
-               {
-                       if (!CHECK_MULTISHADOW(target_ptr)) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
-                       ep_ptr->dam *= 2;
-               }
-               else if (PRACE_IS_(target_ptr, RACE_S_FAIRY))
-               {
-                       ep_ptr->dam = ep_ptr->dam * 4 / 3;
-               }
-
-               if (target_ptr->wraith_form) ep_ptr->dam *= 2;
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-
-               if (!target_ptr->wraith_form || CHECK_MULTISHADOW(target_ptr))
-                       break;
-
-               target_ptr->wraith_form = 0;
-               msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
-                       "The light forces you out of your incorporeal shadow form."));
-
-               target_ptr->redraw |= (PR_MAP | PR_STATUS);
-               target_ptr->update |= (PU_MONSTERS);
-               target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-               break;
-       }
-       case GF_DARK:
-       {
-               if (target_ptr->blind) msg_print(_("何かで攻撃された!", "You are hit by something!"));
-               if (target_ptr->resist_dark)
-               {
-                       ep_ptr->dam *= 4; ep_ptr->dam /= (randint1(4) + 7);
-
-                       if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form) ep_ptr->dam = 0;
-               }
-               else if (!target_ptr->blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_TIME:
-       {
-               if (target_ptr->blind) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
-
-               if (target_ptr->resist_time)
-               {
-                       ep_ptr->dam *= 4;
-                       ep_ptr->dam /= (randint1(4) + 7);
-                       msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-                       break;
-               }
-
-               if (CHECK_MULTISHADOW(target_ptr))
-               {
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-                       break;
-               }
-
-               switch (randint1(10))
-               {
-               case 1:
-               case 2:
-               case 3:
-               case 4:
-               case 5:
-               {
-                       if (target_ptr->prace == RACE_ANDROID) break;
-
-                       msg_print(_("人生が逆戻りした気がする。", "You feel like a chunk of the past has been ripped away."));
-                       lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
-                       break;
-               }
-               case 6:
-               case 7:
-               case 8:
-               case 9:
-               {
-                       int k = 0;
-                       concptr act = NULL;
-                       switch (randint1(6))
-                       {
-                       case 1: k = A_STR; act = _("強く", "strong"); break;
-                       case 2: k = A_INT; act = _("聡明で", "bright"); break;
-                       case 3: k = A_WIS; act = _("賢明で", "wise"); break;
-                       case 4: k = A_DEX; act = _("器用で", "agile"); break;
-                       case 5: k = A_CON; act = _("健康で", "hale"); break;
-                       case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
-                       }
-
-                       msg_format(_("あなたは以前ほど%sなくなってしまった...。", "You're not as %s as you used to be..."), act);
-                       target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 3) / 4;
-                       if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
-
-                       target_ptr->update |= (PU_BONUS);
-                       break;
-               }
-               case 10:
-               {
-                       msg_print(_("あなたは以前ほど力強くなくなってしまった...。", "You're not as powerful as you used to be..."));
-                       for (int k = 0; k < A_MAX; k++)
-                       {
-                               target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
-                               if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
-                       }
-
-                       target_ptr->update |= (PU_BONUS);
-                       break;
-               }
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_GRAVITY:
-       {
-               if (target_ptr->blind) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
-               msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
-
-               if (!CHECK_MULTISHADOW(target_ptr))
-               {
-                       teleport_player(target_ptr, 5, TELEPORT_PASSIVE);
-                       if (!target_ptr->levitation)
-                               (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
-                       if (!(target_ptr->resist_sound || target_ptr->levitation))
-                       {
-                               int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
-                               (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
-                       }
-               }
-
-               if (target_ptr->levitation)
-               {
-                       ep_ptr->dam = (ep_ptr->dam * 2) / 3;
-               }
-
-               if (!target_ptr->levitation || one_in_(13))
-               {
-                       inventory_damage(target_ptr, set_cold_destroy, 2);
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_DISINTEGRATE:
-       {
-               if (target_ptr->blind) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_OLD_HEAL:
-       {
-               if (target_ptr->blind) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
-
-               (void)hp_player(target_ptr, ep_ptr->dam);
-               ep_ptr->dam = 0;
-               break;
-       }
-       case GF_OLD_SPEED:
-       {
-               if (target_ptr->blind) msg_print(_("何かで攻撃された!", "You are hit by something!"));
-               (void)set_fast(target_ptr, target_ptr->fast + randint1(5), FALSE);
-               ep_ptr->dam = 0;
-               break;
-       }
-       case GF_OLD_SLOW:
-       {
-               if (target_ptr->blind) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
-               (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
-               break;
-       }
-       case GF_OLD_SLEEP:
-       {
-               if (target_ptr->free_act)  break;
-               if (target_ptr->blind) msg_print(_("眠ってしまった!", "You fall asleep!"));
-
-               if (ironman_nightmare)
-               {
-                       msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
-                       /* Have some nightmares */
-                       sanity_blast(target_ptr, NULL, FALSE);
-               }
-
-               set_paralyzed(target_ptr, target_ptr->paralyzed + ep_ptr->dam);
-               ep_ptr->dam = 0;
-               break;
-       }
-       case GF_MANA:
-       case GF_SEEKER:
-       case GF_SUPER_RAY:
-       {
-               if (target_ptr->blind) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_PSY_SPEAR:
-       {
-               if (target_ptr->blind) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_FORCE, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_METEOR:
-       {
-               if (target_ptr->blind) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               if (!target_ptr->resist_shard || one_in_(13))
-               {
-                       if (!target_ptr->immune_fire) inventory_damage(target_ptr, set_fire_destroy, 2);
-                       inventory_damage(target_ptr, set_cold_destroy, 2);
-               }
-
-               break;
-       }
-       case GF_ICE:
-       {
-               if (target_ptr->blind) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
-
-               ep_ptr->get_damage = cold_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
-               if (CHECK_MULTISHADOW(target_ptr)) break;
-
-               if (!target_ptr->resist_shard)
-               {
-                       (void)set_cut(target_ptr, target_ptr->cut + damroll(5, 8));
-               }
-
-               if (!target_ptr->resist_sound)
-               {
-                       (void)set_stun(target_ptr, target_ptr->stun + randint1(15));
-               }
-
-               if ((!(target_ptr->resist_cold || is_oppose_cold(target_ptr))) || one_in_(12))
-               {
-                       if (!target_ptr->immune_cold) inventory_damage(target_ptr, set_cold_destroy, 3);
-               }
-
-               break;
-       }
-       case GF_DEATH_RAY:
-       {
-               if (target_ptr->blind) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
-
-               if (target_ptr->mimic_form)
-               {
-                       if (!(mimic_info[target_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
-                               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-
-                       break;
-               }
-
-               switch (target_ptr->prace)
-               {
-               case RACE_GOLEM:
-               case RACE_SKELETON:
-               case RACE_ZOMBIE:
-               case RACE_VAMPIRE:
-               case RACE_DEMON:
-               case RACE_SPECTRE:
-               {
-                       ep_ptr->dam = 0;
-                       break;
-               }
-               default:
-               {
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-                       break;
-               }
-               }
-
-               break;
-       }
-       case GF_DRAIN_MANA:
-       {
-               if (CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, but you are unharmed!"));
-                       ep_ptr->dam = 0;
-                       break;
-               }
-
-               if (target_ptr->csp == 0)
-               {
-                       ep_ptr->dam = 0;
-                       break;
-               }
-
-               if (ep_ptr->who > 0)
-                       msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), ep_ptr->m_name);
-               else
-                       msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
-
-               if (ep_ptr->dam >= target_ptr->csp)
-               {
-                       ep_ptr->dam = target_ptr->csp;
-                       target_ptr->csp = 0;
-                       target_ptr->csp_frac = 0;
-               }
-               else
-               {
-                       target_ptr->csp -= ep_ptr->dam;
-               }
-
-               learn_spell(target_ptr, ep_ptr->monspell);
-               target_ptr->redraw |= (PR_MANA);
-               target_ptr->window |= (PW_PLAYER | PW_SPELL);
-
-               if ((ep_ptr->who <= 0) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp))
-               {
-                       ep_ptr->dam = 0;
-                       break;
-               }
-
-               ep_ptr->m_ptr->hp += ep_ptr->dam;
-               if (ep_ptr->m_ptr->hp > ep_ptr->m_ptr->maxhp) ep_ptr->m_ptr->hp = ep_ptr->m_ptr->maxhp;
-
-               if (target_ptr->health_who == ep_ptr->who) target_ptr->redraw |= (PR_HEALTH);
-               if (target_ptr->riding == ep_ptr->who) target_ptr->redraw |= (PR_UHEALTH);
-
-               if (ep_ptr->m_ptr->ml)
-               {
-                       msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), ep_ptr->m_name);
-               }
-
-               ep_ptr->dam = 0;
-               break;
-       }
-       case GF_MIND_BLAST:
-       {
-               if ((randint0(100 + ep_ptr->rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
-                       learn_spell(target_ptr, ep_ptr->monspell);
-                       break;
-               }
-
-               if (CHECK_MULTISHADOW(target_ptr))
-               {
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-                       break;
-               }
-
-               msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psionic energy."));
-               if (!target_ptr->resist_conf)
-               {
-                       (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
-               }
-
-               if (!target_ptr->resist_chaos && one_in_(3))
-               {
-                       (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
-               }
-
-               target_ptr->csp -= 50;
-               if (target_ptr->csp < 0)
-               {
-                       target_ptr->csp = 0;
-                       target_ptr->csp_frac = 0;
-               }
-
-               target_ptr->redraw |= PR_MANA;
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               break;
-       }
-       case GF_BRAIN_SMASH:
-       {
-               if ((randint0(100 + ep_ptr->rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
-                       learn_spell(target_ptr, ep_ptr->monspell);
-                       break;
-               }
-
-               if (!CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psionic energy."));
-
-                       target_ptr->csp -= 100;
-                       if (target_ptr->csp < 0)
-                       {
-                               target_ptr->csp = 0;
-                               target_ptr->csp_frac = 0;
-                       }
-                       target_ptr->redraw |= PR_MANA;
-               }
-
-               ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               if (CHECK_MULTISHADOW(target_ptr)) break;
-
-               if (!target_ptr->resist_blind)
-               {
-                       (void)set_blind(target_ptr, target_ptr->blind + 8 + randint0(8));
-               }
-
-               if (!target_ptr->resist_conf)
-               {
-                       (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
-               }
-
-               if (!target_ptr->free_act)
-               {
-                       (void)set_paralyzed(target_ptr, target_ptr->paralyzed + randint0(4) + 4);
-               }
-
-               (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
-
-               while (randint0(100 + ep_ptr->rlev / 2) > (MAX(5, target_ptr->skill_sav)))
-                       (void)do_dec_stat(target_ptr, A_INT);
-               while (randint0(100 + ep_ptr->rlev / 2) > (MAX(5, target_ptr->skill_sav)))
-                       (void)do_dec_stat(target_ptr, A_WIS);
-
-               if (!target_ptr->resist_chaos)
-               {
-                       (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
-               }
-
-               break;
-       }
-       case GF_CAUSE_1:
-       {
-               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
-                       learn_spell(target_ptr, ep_ptr->monspell);
-               }
-               else
-               {
-                       if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 15, 0);
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               }
-               break;
-       }
-       case GF_CAUSE_2:
-       {
-               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
-                       learn_spell(target_ptr, ep_ptr->monspell);
-               }
-               else
-               {
-                       if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 25, MIN(ep_ptr->rlev / 2 - 15, 5));
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               }
-               break;
-       }
-       case GF_CAUSE_3:
-       {
-               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
-                       learn_spell(target_ptr, ep_ptr->monspell);
-               }
-               else
-               {
-                       if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 33, MIN(ep_ptr->rlev / 2 - 15, 15));
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-               }
-               break;
-       }
-       case GF_CAUSE_4:
-       {
-               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !(ep_ptr->m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
-                       learn_spell(target_ptr, ep_ptr->monspell);
-               }
-               else
-               {
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
-                       if (!CHECK_MULTISHADOW(target_ptr)) (void)set_cut(target_ptr, target_ptr->cut + damroll(10, 10));
-               }
-
-               break;
-       }
-       case GF_HAND_DOOM:
-       {
-               if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
-               {
-                       msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
-                       learn_spell(target_ptr, ep_ptr->monspell);
-               }
-               else
-               {
-                       if (!CHECK_MULTISHADOW(target_ptr))
-                       {
-                               msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
-                               curse_equipment(target_ptr, 40, 20);
-                       }
-
-                       ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->m_name, ep_ptr->monspell);
-
-                       if (target_ptr->chp < 1) target_ptr->chp = 1;
-               }
-
-               break;
-       }
-       default:
-       {
-               ep_ptr->dam = 0;
-               break;
-       }
-       }
-}
-
-
-/*!
  * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
  * @param who 魔法を発動したモンスター(0ならばプレイヤー、負値ならば自然発生) / Index of "source" monster (zero for "player")
  * @param who_name 効果を起こしたモンスターの名前