diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/delay.cc | 17 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 41 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.h | 21 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/spells1.cc | 5 |
5 files changed, 40 insertions, 49 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 3353a88f9d..2755730b45 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -57,11 +57,12 @@ static void _handle_macro_delay(); static void _finish_delay(const delay_queue_item &delay); // Monsters cannot be affected in these states. -// (All results of Recite, plus friendly + stupid; +// (All results of Recite, plus stationary and friendly + stupid; // note that berserk monsters are also hasted.) static bool _recite_mons_useless(const monsters *mon) { return (mons_intel(mon->type) < I_NORMAL + || mons_is_stationary(mon) || mons_is_fleeing(mon) || mons_is_sleeping(mon) || mons_wont_attack(mon) @@ -91,31 +92,29 @@ static int _recite_to_monsters(int x, int y, int pow, int unused) int resist; const mon_holy_type holiness = mons_holiness(mons); + if (holiness == MH_HOLY) - { - resist = 7 - random2(you.skills[SK_INVOCATIONS]); - if (resist < 0) - resist = 0; - } + resist = std::max(0, 7 - random2(you.skills[SK_INVOCATIONS])); else { resist = mons_resist_magic(mons); - // much lower chances at influencing undead/demons if (holiness == MH_UNDEAD) pow -= 2 + random2(3); else if (holiness == MH_DEMONIC) pow -= 3 + random2(5); + else if (holiness != MH_NATURAL) + return (0); } pow -= resist; if (pow > 0) - pow = random2avg(pow,2); + pow = random2avg(pow, 2); if (pow <= 0) // Uh oh... { - if (one_chance_in(resist+1)) + if (one_chance_in(resist + 1)) return (0); // nothing happens, whew! if (!one_chance_in(4) && diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index e564c45fc6..3c8140893a 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -374,8 +374,8 @@ static int _scan_mon_inv_randarts( const monsters *mon, // Twisted Resurrection. static bool _mons_your_abomination(const monsters *mon) { - if ( mon->type != MONS_ABOMINATION_SMALL - && mon->type != MONS_ABOMINATION_LARGE ) + if (mon->type != MONS_ABOMINATION_SMALL + && mon->type != MONS_ABOMINATION_LARGE) { return (false); } @@ -401,8 +401,8 @@ mon_holy_type mons_class_holiness(int mc) bool mons_class_is_confusable(int mc) { return (smc->resist_magic < MAG_IMMUNE - && mons_class_holiness(mc) != MH_PLANT - && mons_class_holiness(mc) != MH_NONLIVING); + && mons_class_holiness(mc) != MH_NONLIVING + && mons_class_holiness(mc) != MH_PLANT); } bool mons_class_is_slowable(int mc) @@ -425,13 +425,6 @@ bool mons_is_stationary(const monsters *mon) return mons_class_is_stationary(mon->type); } -// Mimics can teleport, so they're not truly stationary. -// XXX: There should be a more generic way to check for this! -bool mons_is_truly_stationary(const monsters *mon) -{ - return (mons_is_stationary(mon) && !mons_is_mimic(mon->type)); -} - bool mons_is_insubstantial(int mc) { return mons_class_flag(mc, M_INSUBSTANTIAL); @@ -571,7 +564,7 @@ bool mons_is_demon(int mc) // Not every demonic monster is a demon (hell hog, hell hound, etc.) if (mons_class_holiness(mc) == MH_DEMONIC - && (isdigit( show_char ) || show_char == '&')) + && (isdigit(show_char) || show_char == '&')) { return (true); } @@ -1005,9 +998,9 @@ int mons_res_elec( const monsters *mon ) return (u); } -bool mons_res_asphyx( const monsters *mon ) +bool mons_res_asphyx(const monsters *mon) { - const mon_holy_type holiness = mons_holiness( mon ); + const mon_holy_type holiness = mons_holiness(mon); return (mons_is_unholy(mon) || holiness == MH_NONLIVING @@ -1180,7 +1173,7 @@ int mons_res_miasma( const monsters *mon ) int mons_res_negative_energy( const monsters *mon ) { int mc = mon->type; - const mon_holy_type holiness = mons_holiness( mon ); + const mon_holy_type holiness = mons_holiness(mon); if (mons_is_unholy(mon) || holiness == MH_NONLIVING @@ -1223,31 +1216,31 @@ int mons_res_negative_energy( const monsters *mon ) return (u); } // end mons_res_negative_energy() -bool mons_is_holy( const monsters *mon ) +bool mons_is_holy(const monsters *mon) { - return (mons_holiness( mon ) == MH_HOLY); + return (mons_holiness(mon) == MH_HOLY); } -bool mons_is_evil( const monsters *mon ) +bool mons_is_evil(const monsters *mon) { - return (mons_class_flag( mon->type, M_EVIL )); + return (mons_class_flag(mon->type, M_EVIL)); } -bool mons_is_unholy( const monsters *mon ) +bool mons_is_unholy(const monsters *mon) { - const mon_holy_type holiness = mons_holiness( mon ); + const mon_holy_type holiness = mons_holiness(mon); return (holiness == MH_UNDEAD || holiness == MH_DEMONIC); } -bool mons_is_evil_or_unholy( const monsters *mon ) +bool mons_is_evil_or_unholy(const monsters *mon) { return (mons_is_evil(mon) || mons_is_unholy(mon)); } -bool mons_has_lifeforce( const monsters *mon ) +bool mons_has_lifeforce(const monsters *mon) { - const mon_holy_type holiness = mons_holiness( mon ); + const mon_holy_type holiness = mons_holiness(mon); return (holiness == MH_NATURAL || holiness == MH_PLANT); } diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 22932a3677..8f87ebd267 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -480,8 +480,8 @@ bool mons_class_flag(int mc, int bf); * called from: beam - effects - fight - monstuff - mstuff2 - spells2 - * spells3 - spells4 * *********************************************************************** */ -mon_holy_type mons_class_holiness(int mclass); -mon_holy_type mons_holiness(const monsters *); +mon_holy_type mons_class_holiness(int mc); +mon_holy_type mons_holiness(const monsters *mon); bool mons_is_mimic( int mc ); bool mons_is_statue( int mc ); @@ -662,27 +662,26 @@ bool mons_is_lurking(const monsters *m); bool mons_is_batty(const monsters *m); bool mons_was_seen(const monsters *m); bool mons_is_known_mimic(const monsters *m); -bool mons_is_holy( const monsters *mon ); -bool mons_is_evil( const monsters *mon ); -bool mons_is_unholy( const monsters *mon ); -bool mons_is_evil_or_unholy( const monsters *mon ); +bool mons_is_holy(const monsters *mon); +bool mons_is_evil(const monsters *mon); +bool mons_is_unholy(const monsters *mon); +bool mons_is_evil_or_unholy(const monsters *mon); bool mons_is_icy(const monsters *mon); bool mons_is_icy(int mtype); -bool mons_has_lifeforce( const monsters *mon ); -monster_type mons_genus( int mc ); -monster_type mons_species( int mc ); +bool mons_has_lifeforce(const monsters *mon); +monster_type mons_genus(int mc); +monster_type mons_species(int mc); bool mons_looks_stabbable(const monsters *m); bool mons_looks_distracted(const monsters *m); -bool check_mons_resist_magic( const monsters *monster, int pow ); +bool check_mons_resist_magic(const monsters *monster, int pow); bool mons_class_is_confusable(int mc); bool mons_class_is_slowable(int mc); bool mons_class_is_stationary(int mc); bool mons_is_stationary(const monsters *mon); -bool mons_is_truly_stationary(const monsters *mon); bool mons_is_wall_shielded(int mc); bool mons_is_insubstantial(int mc); bool mons_has_blood(int mc); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 18f6c5a2c6..81c63c5c7b 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -3298,11 +3298,6 @@ static void _handle_behaviour(monsters *mon) return; } - // If the monster can't move (or at least teleport, as a - // mimic can), get out. - if (mons_is_truly_stationary(mon)) - break; - // If the monster isn't travelling toward someplace from // which it can leave the level, and it can move (or at // least teleport, as a mimic can), make it start doing so. diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index a6b4f48ac0..00a3fde7f6 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -620,6 +620,9 @@ static bool _can_pacify_monster(const monsters *mon, const int healed) if (mons_intel(mon->type) <= I_PLANT) // no self-awareness return false; + if (mons_is_stationary(mon)) // not able to leave the level + return false; + if (mons_is_sleeping(mon)) // not aware of what is happening return false; @@ -637,6 +640,8 @@ static bool _can_pacify_monster(const monsters *mon, const int healed) divisor++; else if (holiness == MH_DEMONIC) divisor += 2; + else if (holiness != MH_NATURAL) + return false; const int random_factor = random2(you.skills[SK_INVOCATIONS] * healed / divisor); |