OSDN Git Service

[Refactor] #39963 Moved effect_monster_stasis() and effect_monster_stun() from effect...
[hengbandforosx/hengbandosx.git] / src / effect / effect-monster-switcher.c
index 66736b0..3d3621d 100644 (file)
@@ -1,4 +1,6 @@
 /*!
+ * todo どうしても「その他」に分類せざるを得ない魔法種別が残った
+ * 本ファイル内の行数はまともなレベルに落ち着いているので、一旦ここに留め置くこととする
  * @brief 魔法種別による各種処理切り替え
  * @date 2020/04/29
  * @author Hourier
 #include "effect/effect-monster-switcher.h"
 #include "player-damage.h"
 #include "avatar.h"
-#include "quest.h"
 #include "monster-status.h"
-#include "effect/spells-effect-util.h"
 #include "player-effects.h"
 #include "monsterrace-hook.h"
 #include "combat/melee.h"
-#include "cmd/cmd-pet.h" // 暫定、後で消すかも.
 #include "spell/spells-type.h"
 #include "effect/effect-monster-resist-hurt.h"
 #include "effect/effect-monster-psi.h"
@@ -30,6 +29,7 @@
 gf_switch_result effect_monster_hypodynamia(player_type *caster_ptr, effect_monster_type *em_ptr)
 {
        if (em_ptr->seen) em_ptr->obvious = TRUE;
+
        if (monster_living(em_ptr->m_ptr->r_idx))
        {
                em_ptr->do_time = (em_ptr->dam + 7) / 8;
@@ -84,49 +84,6 @@ gf_switch_result effect_monster_death_ray(player_type *caster_ptr, effect_monste
 }
 
 
-gf_switch_result effect_monster_stasis(effect_monster_type *em_ptr, bool to_evil)
-{
-       if (em_ptr->seen) em_ptr->obvious = TRUE;
-
-       int stasis_damage = (em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10);
-       bool has_resistance = (em_ptr->r_ptr->flags1 & RF1_UNIQUE) != 0;
-       has_resistance |= em_ptr->r_ptr->level > randint1(stasis_damage) + 10;
-       if (to_evil) has_resistance |= (em_ptr->r_ptr->flags3 & RF3_EVIL) == 0;
-
-       if (has_resistance)
-       {
-               em_ptr->note = _("には効果がなかった。", " is unaffected.");
-               em_ptr->obvious = FALSE;
-       }
-       else
-       {
-               em_ptr->note = _("は動けなくなった!", " is suspended!");
-               em_ptr->do_sleep = 500;
-       }
-
-       em_ptr->dam = 0;
-       return GF_SWITCH_CONTINUE;
-}
-
-
-gf_switch_result effect_monster_stun(effect_monster_type *em_ptr)
-{
-       if (em_ptr->seen) em_ptr->obvious = TRUE;
-
-       em_ptr->do_stun = damroll((em_ptr->caster_lev / 20) + 3, (em_ptr->dam)) + 1;
-       if ((em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
-               (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
-       {
-               em_ptr->do_stun = 0;
-               em_ptr->note = _("には効果がなかった。", " is unaffected.");
-               em_ptr->obvious = FALSE;
-       }
-
-       em_ptr->dam = 0;
-       return GF_SWITCH_CONTINUE;
-}
-
-
 gf_switch_result effect_monster_kill_wall(player_type *caster_ptr, effect_monster_type *em_ptr)
 {
        if ((em_ptr->r_ptr->flags3 & (RF3_HURT_ROCK)) == 0)
@@ -173,61 +130,6 @@ gf_switch_result effect_monster_hand_doom(effect_monster_type *em_ptr)
 }
 
 
-static bool effect_monster_check_capturability(player_type *caster_ptr, effect_monster_type *em_ptr, int capturable_hp)
-{
-       if (em_ptr->m_ptr->hp >= randint0(capturable_hp)) return FALSE;
-
-       if (em_ptr->m_ptr->mflag2 & MFLAG2_CHAMELEON)
-               choose_new_monster(caster_ptr, em_ptr->g_ptr->m_idx, FALSE, MON_CHAMELEON);
-
-       msg_format(_("%sを捕えた!", "You capture %^s!"), em_ptr->m_name);
-       cap_mon = em_ptr->m_ptr->r_idx;
-       cap_mspeed = em_ptr->m_ptr->mspeed;
-       cap_hp = em_ptr->m_ptr->hp;
-       cap_maxhp = em_ptr->m_ptr->max_maxhp;
-       cap_nickname = em_ptr->m_ptr->nickname;
-       if ((em_ptr->g_ptr->m_idx == caster_ptr->riding) && rakuba(caster_ptr, -1, FALSE))
-               msg_format(_("地面に落とされた。", "You have fallen from %s."), em_ptr->m_name);
-
-       delete_monster_idx(caster_ptr, em_ptr->g_ptr->m_idx);
-       return TRUE;
-}
-
-
-gf_switch_result effect_monster_capture(player_type *caster_ptr, effect_monster_type *em_ptr)
-{
-       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
-       int capturable_hp;
-       if ((floor_ptr->inside_quest && (quest[floor_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(em_ptr->m_ptr)) ||
-               (em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) || (em_ptr->r_ptr->flags7 & (RF7_NAZGUL)) || (em_ptr->r_ptr->flags7 & (RF7_UNIQUE2)) || (em_ptr->r_ptr->flags1 & RF1_QUESTOR) || em_ptr->m_ptr->parent_m_idx)
-       {
-               msg_format(_("%sには効果がなかった。", "%s is unaffected."), em_ptr->m_name);
-               em_ptr->skipped = TRUE;
-               return GF_SWITCH_CONTINUE;
-       }
-
-       if (is_pet(em_ptr->m_ptr)) capturable_hp = em_ptr->m_ptr->maxhp * 4L;
-       else if ((caster_ptr->pclass == CLASS_BEASTMASTER) && monster_living(em_ptr->m_ptr->r_idx))
-               capturable_hp = em_ptr->m_ptr->maxhp * 3 / 10;
-       else
-               capturable_hp = em_ptr->m_ptr->maxhp * 3 / 20;
-
-       if (em_ptr->m_ptr->hp >= capturable_hp)
-       {
-               msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), em_ptr->m_name);
-               em_ptr->skipped = TRUE;
-               return GF_SWITCH_CONTINUE;
-       }
-       
-       if (effect_monster_check_capturability(caster_ptr, em_ptr, capturable_hp))
-               return GF_SWITCH_TRUE;
-
-       msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), em_ptr->m_name);
-       em_ptr->skipped = TRUE;
-       return GF_SWITCH_CONTINUE;
-}
-
-
 gf_switch_result effect_monster_engetsu(player_type *caster_ptr, effect_monster_type *em_ptr)
 {
        int effect = 0;
@@ -354,63 +256,6 @@ gf_switch_result effect_monster_photo(player_type *caster_ptr, effect_monster_ty
 }
 
 
-static bool effect_monster_crusade_domination(player_type *caster_ptr, effect_monster_type *em_ptr)
-{
-       if (((em_ptr->r_ptr->flags3 & RF3_GOOD) == 0) || caster_ptr->current_floor_ptr->inside_arena)
-               return FALSE;
-
-       if (em_ptr->r_ptr->flags3 & RF3_NO_CONF) em_ptr->dam -= 50;
-       if (em_ptr->dam < 1) em_ptr->dam = 1;
-
-       if (is_pet(em_ptr->m_ptr))
-       {
-               em_ptr->note = _("の動きが速くなった。", " starts moving faster.");
-               (void)set_monster_fast(caster_ptr, em_ptr->g_ptr->m_idx, MON_FAST(em_ptr->m_ptr) + 100);
-               return TRUE;
-       }
-
-       if ((em_ptr->r_ptr->flags1 & RF1_QUESTOR) ||
-               (em_ptr->r_ptr->flags1 & RF1_UNIQUE) ||
-               (em_ptr->m_ptr->mflag2 & MFLAG2_NOPET) ||
-               (caster_ptr->cursed & TRC_AGGRAVATE) ||
-               ((em_ptr->r_ptr->level + 10) > randint1(em_ptr->dam)))
-       {
-               if (one_in_(4))
-                       em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
-
-               return FALSE;
-       }
-
-       em_ptr->note = _("を支配した。", " is tamed!");
-       set_pet(caster_ptr, em_ptr->m_ptr);
-       (void)set_monster_fast(caster_ptr, em_ptr->g_ptr->m_idx, MON_FAST(em_ptr->m_ptr) + 100);
-       if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
-               em_ptr->r_ptr->r_flags3 |= RF3_GOOD;
-
-       return TRUE;
-}
-
-
-gf_switch_result effect_monster_crusade(player_type *caster_ptr, effect_monster_type *em_ptr)
-{
-       if (em_ptr->seen) em_ptr->obvious = TRUE;
-       bool success = effect_monster_crusade_domination(caster_ptr, em_ptr);
-       if (success)
-       {
-               em_ptr->dam = 0;
-               return GF_SWITCH_CONTINUE;
-       }
-
-       if ((em_ptr->r_ptr->flags3 & RF3_NO_FEAR) == 0)
-               em_ptr->do_fear = randint1(90) + 10;
-       else if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
-               em_ptr->r_ptr->r_flags3 |= RF3_NO_FEAR;
-
-       em_ptr->dam = 0;
-       return GF_SWITCH_CONTINUE;
-}
-
-
 gf_switch_result effect_monster_wounds(effect_monster_type *em_ptr)
 {
        if (em_ptr->seen) em_ptr->obvious = TRUE;