<ClCompile Include="..\..\src\cmd\dump-util.c" />\r
<ClCompile Include="..\..\src\effect\effect-feature.c" />\r
<ClCompile Include="..\..\src\effect\effect-item.c" />\r
+ <ClCompile Include="..\..\src\effect\effect-monster-charm.c" />\r
<ClCompile Include="..\..\src\effect\effect-monster-domination.c" />\r
<ClCompile Include="..\..\src\effect\effect-monster-oldies.c" />\r
<ClCompile Include="..\..\src\effect\effect-monster-psi.c" />\r
<ClInclude Include="..\..\src\cmd\dump-util.h" />\r
<ClInclude Include="..\..\src\effect\effect-feature.h" />\r
<ClInclude Include="..\..\src\effect\effect-item.h" />\r
+ <ClInclude Include="..\..\src\effect\effect-monster-charm.h" />\r
<ClInclude Include="..\..\src\effect\effect-monster-domination.h" />\r
<ClInclude Include="..\..\src\effect\effect-monster-oldies.h" />\r
<ClInclude Include="..\..\src\effect\effect-monster-psi.h" />\r
<ClCompile Include="..\..\src\effect\effect-monster-oldies.c">
<Filter>effect</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\effect\effect-monster-charm.c">
+ <Filter>effect</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\gamevalue.h" />
<ClInclude Include="..\..\src\effect\effect-monster-oldies.h">
<Filter>effect</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\effect\effect-monster-charm.h">
+ <Filter>effect</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
--- /dev/null
+#include "angband.h"
+#include "effect/effect-monster-util.h"
+#include "effect/effect-monster-charm.h"
+#include "avatar.h"
+#include "spells-diceroll.h"
+#include "monsterrace-hook.h"
+
+static void effect_monster_charm_resist(player_type *caster_ptr, effect_monster_type *em_ptr)
+{
+ if (common_saving_throw_charm(caster_ptr, em_ptr->dam, em_ptr->m_ptr))
+ {
+ em_ptr->note = _("には効果がなかった。", " is unaffected.");
+ em_ptr->obvious = FALSE;
+
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else if (caster_ptr->cursed & TRC_AGGRAVATE)
+ {
+ em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else
+ {
+ em_ptr->note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
+ set_pet(caster_ptr, em_ptr->m_ptr);
+
+ chg_virtue(caster_ptr, V_INDIVIDUALISM, -1);
+ if (em_ptr->r_ptr->flags3 & RF3_ANIMAL)
+ chg_virtue(caster_ptr, V_NATURE, 1);
+ }
+}
+
+
+gf_switch_result effect_monster_charm(player_type *caster_ptr, effect_monster_type *em_ptr)
+{
+ int vir = virtue_number(caster_ptr, V_HARMONY);
+ if (vir)
+ {
+ em_ptr->dam += caster_ptr->virtues[vir - 1] / 10;
+ }
+
+ vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
+ if (vir)
+ {
+ em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
+ }
+
+ if (em_ptr->seen) em_ptr->obvious = TRUE;
+
+ effect_monster_charm_resist(caster_ptr, em_ptr);
+ em_ptr->dam = 0;
+ return GF_SWITCH_CONTINUE;
+}
+
+
+gf_switch_result effect_monster_control_undead(player_type *caster_ptr, effect_monster_type *em_ptr)
+{
+ if (em_ptr->seen) em_ptr->obvious = TRUE;
+
+ int vir = virtue_number(caster_ptr, V_UNLIFE);
+ if (vir)
+ {
+ em_ptr->dam += caster_ptr->virtues[vir - 1] / 10;
+ }
+
+ vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
+ if (vir)
+ {
+ em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
+ }
+
+ if (common_saving_throw_control(caster_ptr, em_ptr->dam, em_ptr->m_ptr) ||
+ !(em_ptr->r_ptr->flags3 & RF3_UNDEAD))
+ {
+ em_ptr->note = _("には効果がなかった。", " is unaffected.");
+ em_ptr->obvious = FALSE;
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else if (caster_ptr->cursed & TRC_AGGRAVATE)
+ {
+ em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else
+ {
+ em_ptr->note = _("は既にあなたの奴隷だ!", " is in your thrall!");
+ set_pet(caster_ptr, em_ptr->m_ptr);
+ }
+
+ em_ptr->dam = 0;
+ return GF_SWITCH_CONTINUE;
+}
+
+
+gf_switch_result effect_monster_control_demon(player_type *caster_ptr, effect_monster_type *em_ptr)
+{
+ if (em_ptr->seen) em_ptr->obvious = TRUE;
+
+ int vir = virtue_number(caster_ptr, V_UNLIFE);
+ if (vir)
+ {
+ em_ptr->dam += caster_ptr->virtues[vir - 1] / 10;
+ }
+
+ vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
+ if (vir)
+ {
+ em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
+ }
+
+ if (common_saving_throw_control(caster_ptr, em_ptr->dam, em_ptr->m_ptr) ||
+ !(em_ptr->r_ptr->flags3 & RF3_DEMON))
+ {
+ em_ptr->note = _("には効果がなかった。", " is unaffected.");
+ em_ptr->obvious = FALSE;
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else if (caster_ptr->cursed & TRC_AGGRAVATE)
+ {
+ em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else
+ {
+ em_ptr->note = _("は既にあなたの奴隷だ!", " is in your thrall!");
+ set_pet(caster_ptr, em_ptr->m_ptr);
+ }
+
+ em_ptr->dam = 0;
+ return GF_SWITCH_CONTINUE;
+}
+
+
+gf_switch_result effect_monster_control_animal(player_type *caster_ptr, effect_monster_type *em_ptr)
+{
+ if (em_ptr->seen) em_ptr->obvious = TRUE;
+
+ int vir = virtue_number(caster_ptr, V_NATURE);
+ if (vir)
+ {
+ em_ptr->dam += caster_ptr->virtues[vir - 1] / 10;
+ }
+
+ vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
+ if (vir)
+ {
+ em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
+ }
+
+ if (common_saving_throw_control(caster_ptr, em_ptr->dam, em_ptr->m_ptr) ||
+ !(em_ptr->r_ptr->flags3 & RF3_ANIMAL))
+ {
+ em_ptr->note = _("には効果がなかった。", " is unaffected.");
+ em_ptr->obvious = FALSE;
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else if (caster_ptr->cursed & TRC_AGGRAVATE)
+ {
+ em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else
+ {
+ em_ptr->note = _("はなついた。", " is tamed!");
+ set_pet(caster_ptr, em_ptr->m_ptr);
+ if (em_ptr->r_ptr->flags3 & RF3_ANIMAL)
+ chg_virtue(caster_ptr, V_NATURE, 1);
+ }
+
+ em_ptr->dam = 0;
+ return GF_SWITCH_CONTINUE;
+}
+
+
+gf_switch_result effect_monster_charm_living(player_type *caster_ptr, effect_monster_type *em_ptr)
+{
+ int vir = virtue_number(caster_ptr, V_UNLIFE);
+ if (em_ptr->seen) em_ptr->obvious = TRUE;
+
+ vir = virtue_number(caster_ptr, V_UNLIFE);
+ if (vir)
+ {
+ em_ptr->dam -= caster_ptr->virtues[vir - 1] / 10;
+ }
+
+ vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
+ if (vir)
+ {
+ em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
+ }
+
+ msg_format(_("%sを見つめた。", "You stare into %s."), em_ptr->m_name);
+
+ if (common_saving_throw_charm(caster_ptr, em_ptr->dam, em_ptr->m_ptr) ||
+ !monster_living(em_ptr->m_ptr->r_idx))
+ {
+ em_ptr->note = _("には効果がなかった。", " is unaffected.");
+ em_ptr->obvious = FALSE;
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else if (caster_ptr->cursed & TRC_AGGRAVATE)
+ {
+ em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
+ if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
+ }
+ else
+ {
+ em_ptr->note = _("を支配した。", " is tamed!");
+ set_pet(caster_ptr, em_ptr->m_ptr);
+ if (em_ptr->r_ptr->flags3 & RF3_ANIMAL)
+ chg_virtue(caster_ptr, V_NATURE, 1);
+ }
+
+ em_ptr->dam = 0;
+ return GF_SWITCH_CONTINUE;
+}
--- /dev/null
+#pragma once
+
+gf_switch_result effect_monster_charm(player_type *caster_ptr, effect_monster_type *em_ptr);
+gf_switch_result effect_monster_control_undead(player_type *caster_ptr, effect_monster_type *em_ptr);
+gf_switch_result effect_monster_control_demon(player_type *caster_ptr, effect_monster_type *em_ptr);
+gf_switch_result effect_monster_control_animal(player_type *caster_ptr, effect_monster_type *em_ptr);
+gf_switch_result effect_monster_charm_living(player_type *caster_ptr, effect_monster_type *em_ptr);
em_ptr->dam = 0;
return GF_SWITCH_CONTINUE;
}
+
+
+gf_switch_result effect_monster_old_conf(player_type *caster_ptr, effect_monster_type *em_ptr)
+{
+ if (em_ptr->seen) em_ptr->obvious = TRUE;
+
+ em_ptr->do_conf = damroll(3, (em_ptr->dam / 2)) + 1;
+ if ((em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
+ (em_ptr->r_ptr->flags3 & (RF3_NO_CONF)) ||
+ (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
+ {
+ if (em_ptr->r_ptr->flags3 & (RF3_NO_CONF))
+ {
+ if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_NO_CONF);
+ }
+
+ em_ptr->do_conf = 0;
+ em_ptr->note = _("には効果がなかった。", " is unaffected.");
+ em_ptr->obvious = FALSE;
+ }
+
+ em_ptr->dam = 0;
+ return GF_SWITCH_CONTINUE;
+}
gf_switch_result effect_monster_old_speed(player_type *caster_ptr, effect_monster_type *em_ptr);
gf_switch_result effect_monster_old_slow(player_type *caster_ptr, effect_monster_type *em_ptr);
gf_switch_result effect_monster_old_sleep(player_type *caster_ptr, effect_monster_type *em_ptr);
+gf_switch_result effect_monster_old_conf(player_type *caster_ptr, effect_monster_type *em_ptr);
#include "monster-status.h"
#include "effect/spells-effect-util.h"
#include "player-effects.h"
-#include "spells-diceroll.h"
#include "monsterrace-hook.h"
#include "combat/melee.h"
#include "cmd/cmd-pet.h" // 暫定、後で消すかも.
#include "effect/effect-monster-psi.h"
#include "effect/effect-monster-domination.h"
#include "effect/effect-monster-oldies.h"
+#include "effect/effect-monster-charm.h"
gf_switch_result effect_monster_hypodynamia(player_type *caster_ptr, effect_monster_type *em_ptr)
{
}
+// todo リファクタリング前のコード時点で、単に耐性があるだけでもダメージ0だった.
gf_switch_result effect_monster_death_ray(player_type *caster_ptr, effect_monster_type *em_ptr)
{
if (em_ptr->seen) em_ptr->obvious = TRUE;
}
-static void effect_monster_charm_resist(player_type *caster_ptr, effect_monster_type *em_ptr)
-{
- if (common_saving_throw_charm(caster_ptr, em_ptr->dam, em_ptr->m_ptr))
- {
- em_ptr->note = _("には効果がなかった。", " is unaffected.");
- em_ptr->obvious = FALSE;
-
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else if (caster_ptr->cursed & TRC_AGGRAVATE)
- {
- em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else
- {
- em_ptr->note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
- set_pet(caster_ptr, em_ptr->m_ptr);
-
- chg_virtue(caster_ptr, V_INDIVIDUALISM, -1);
- if (em_ptr->r_ptr->flags3 & RF3_ANIMAL)
- chg_virtue(caster_ptr, V_NATURE, 1);
- }
-}
-
-
-gf_switch_result effect_monster_charm(player_type *caster_ptr, effect_monster_type *em_ptr)
-{
- int vir = virtue_number(caster_ptr, V_HARMONY);
- if (vir)
- {
- em_ptr->dam += caster_ptr->virtues[vir - 1] / 10;
- }
-
- vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
- if (vir)
- {
- em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
- }
-
- if (em_ptr->seen) em_ptr->obvious = TRUE;
-
- effect_monster_charm_resist(caster_ptr, em_ptr);
- em_ptr->dam = 0;
- return GF_SWITCH_CONTINUE;
-}
-
-
-gf_switch_result effect_monster_control_undead(player_type *caster_ptr, effect_monster_type *em_ptr)
-{
- if (em_ptr->seen) em_ptr->obvious = TRUE;
-
- int vir = virtue_number(caster_ptr, V_UNLIFE);
- if (vir)
- {
- em_ptr->dam += caster_ptr->virtues[vir - 1] / 10;
- }
-
- vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
- if (vir)
- {
- em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
- }
-
- if (common_saving_throw_control(caster_ptr, em_ptr->dam, em_ptr->m_ptr) ||
- !(em_ptr->r_ptr->flags3 & RF3_UNDEAD))
- {
- em_ptr->note = _("には効果がなかった。", " is unaffected.");
- em_ptr->obvious = FALSE;
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else if (caster_ptr->cursed & TRC_AGGRAVATE)
- {
- em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else
- {
- em_ptr->note = _("は既にあなたの奴隷だ!", " is in your thrall!");
- set_pet(caster_ptr, em_ptr->m_ptr);
- }
-
- em_ptr->dam = 0;
- return GF_SWITCH_CONTINUE;
-}
-
-
-gf_switch_result effect_monster_control_demon(player_type *caster_ptr, effect_monster_type *em_ptr)
-{
- if (em_ptr->seen) em_ptr->obvious = TRUE;
-
- int vir = virtue_number(caster_ptr, V_UNLIFE);
- if (vir)
- {
- em_ptr->dam += caster_ptr->virtues[vir - 1] / 10;
- }
-
- vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
- if (vir)
- {
- em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
- }
-
- if (common_saving_throw_control(caster_ptr, em_ptr->dam, em_ptr->m_ptr) ||
- !(em_ptr->r_ptr->flags3 & RF3_DEMON))
- {
- em_ptr->note = _("には効果がなかった。", " is unaffected.");
- em_ptr->obvious = FALSE;
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else if (caster_ptr->cursed & TRC_AGGRAVATE)
- {
- em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else
- {
- em_ptr->note = _("は既にあなたの奴隷だ!", " is in your thrall!");
- set_pet(caster_ptr, em_ptr->m_ptr);
- }
-
- em_ptr->dam = 0;
- return GF_SWITCH_CONTINUE;
-}
-
-
-gf_switch_result effect_monster_control_animal(player_type *caster_ptr, effect_monster_type *em_ptr)
-{
- if (em_ptr->seen) em_ptr->obvious = TRUE;
-
- int vir = virtue_number(caster_ptr, V_NATURE);
- if (vir)
- {
- em_ptr->dam += caster_ptr->virtues[vir - 1] / 10;
- }
-
- vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
- if (vir)
- {
- em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
- }
-
- if (common_saving_throw_control(caster_ptr, em_ptr->dam, em_ptr->m_ptr) ||
- !(em_ptr->r_ptr->flags3 & RF3_ANIMAL))
- {
- em_ptr->note = _("には効果がなかった。", " is unaffected.");
- em_ptr->obvious = FALSE;
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else if (caster_ptr->cursed & TRC_AGGRAVATE)
- {
- em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else
- {
- em_ptr->note = _("はなついた。", " is tamed!");
- set_pet(caster_ptr, em_ptr->m_ptr);
- if (em_ptr->r_ptr->flags3 & RF3_ANIMAL)
- chg_virtue(caster_ptr, V_NATURE, 1);
- }
-
- em_ptr->dam = 0;
- return GF_SWITCH_CONTINUE;
-}
-
-
-gf_switch_result effect_monster_charm_living(player_type *caster_ptr, effect_monster_type *em_ptr)
-{
- int vir = virtue_number(caster_ptr, V_UNLIFE);
- if (em_ptr->seen) em_ptr->obvious = TRUE;
-
- vir = virtue_number(caster_ptr, V_UNLIFE);
- if (vir)
- {
- em_ptr->dam -= caster_ptr->virtues[vir - 1] / 10;
- }
-
- vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
- if (vir)
- {
- em_ptr->dam -= caster_ptr->virtues[vir - 1] / 20;
- }
-
- msg_format(_("%sを見つめた。", "You stare into %s."), em_ptr->m_name);
-
- if (common_saving_throw_charm(caster_ptr, em_ptr->dam, em_ptr->m_ptr) ||
- !monster_living(em_ptr->m_ptr->r_idx))
- {
- em_ptr->note = _("には効果がなかった。", " is unaffected.");
- em_ptr->obvious = FALSE;
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else if (caster_ptr->cursed & TRC_AGGRAVATE)
- {
- em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
- if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
- }
- else
- {
- em_ptr->note = _("を支配した。", " is tamed!");
- set_pet(caster_ptr, em_ptr->m_ptr);
- if (em_ptr->r_ptr->flags3 & RF3_ANIMAL)
- chg_virtue(caster_ptr, V_NATURE, 1);
- }
-
- em_ptr->dam = 0;
- return GF_SWITCH_CONTINUE;
-}
-
-
/*!
* @brief 魔法の効果によって様々なメッセーを出力したり与えるダメージの増減を行ったりする
* @param em_ptr モンスター効果構造体への参照ポインタ
case GF_CHARM_LIVING:
return effect_monster_charm_living(caster_ptr, em_ptr);
case GF_OLD_CONF:
- {
- if (em_ptr->seen) em_ptr->obvious = TRUE;
-
- em_ptr->do_conf = damroll(3, (em_ptr->dam / 2)) + 1;
- if ((em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
- (em_ptr->r_ptr->flags3 & (RF3_NO_CONF)) ||
- (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
- {
- if (em_ptr->r_ptr->flags3 & (RF3_NO_CONF))
- {
- if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_NO_CONF);
- }
-
- em_ptr->do_conf = 0;
- em_ptr->note = _("には効果がなかった。", " is unaffected.");
- em_ptr->obvious = FALSE;
- }
-
- em_ptr->dam = 0;
- break;
- }
+ return effect_monster_old_conf(caster_ptr, em_ptr);
case GF_STUN:
{
if (em_ptr->seen) em_ptr->obvious = TRUE;