From 2a9689ff31d9b420120db477c7121e6d3fa114f3 Mon Sep 17 00:00:00 2001 From: dolorous Date: Thu, 13 Mar 2008 14:07:56 +0000 Subject: Clean up holiness handling, as well as a few other miscellaneous things. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3621 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/monstuff.cc | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'crawl-ref/source/monstuff.cc') diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index c030aa2b15..8a4ffc4942 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -470,7 +470,7 @@ static bool monster_avoided_death(monsters *monster, killer_type killer, int i) monster->hit_dice, you.experience_level); #endif - if (random2(you.piety) > 30 + if (random2(you.piety) > piety_breakpoint(0) && random2(you.experience_level) >= random2(monster->hit_dice) // bias beaten-up-conversion towards the stronger orcs. && random2(monster->hit_dice) > 2) @@ -482,13 +482,6 @@ static bool monster_avoided_death(monsters *monster, killer_type killer, int i) return (false); } -bool is_mons_evil_demonic_or_undead(monsters *mons) -{ - return (mons_holiness(mons) == MH_UNDEAD - || mons_holiness(mons) == MH_DEMONIC - || mons_is_evil(mons)); -} - static bool is_mons_mutator_or_rotter(monsters *mons) { if (mons->has_ench(ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER)) @@ -710,7 +703,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) || (!created_friendly && gives_xp && (you.religion == GOD_MAKHLEB || you.religion == GOD_SHINING_ONE - && is_mons_evil_demonic_or_undead(monster)) + && mons_is_evil_or_unholy(monster)) && (!player_under_penance() && random2(you.piety) >= piety_breakpoint(0)))) { @@ -725,7 +718,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) if (!created_friendly && gives_xp && (you.religion == GOD_MAKHLEB || you.religion == GOD_VEHUMET || you.religion == GOD_SHINING_ONE - && is_mons_evil_demonic_or_undead(monster)) + && mons_is_evil_or_unholy(monster)) && (!player_under_penance() && random2(you.piety) >= piety_breakpoint(0))) { @@ -807,15 +800,15 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) if (mons_class_flag( monster->type, M_EVIL )) { - notice |= - did_god_conduct( + notice |= + did_god_conduct( DID_NATURAL_EVIL_KILLED_BY_SERVANT, monster->hit_dice ); } } else if (targ_holy == MH_DEMONIC) { - notice |= did_god_conduct( DID_DEMON_KILLED_BY_SERVANT, + notice |= did_god_conduct( DID_DEMON_KILLED_BY_SERVANT, monster->hit_dice ); } else if (targ_holy == MH_UNDEAD) @@ -828,17 +821,18 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) // Angel kills are always noticed. if (targ_holy == MH_HOLY) { - notice |= did_god_conduct( DID_ANGEL_KILLED_BY_SERVANT, + notice |= did_god_conduct( DID_ANGEL_KILLED_BY_SERVANT, monster->hit_dice ); } - if (you.religion == GOD_VEHUMET + if (you.religion == GOD_VEHUMET && notice - && (!player_under_penance() && random2(you.piety) >= 30)) + && (!player_under_penance() + && random2(you.piety) >= piety_breakpoint(0))) { - /* Vehumet - only for non-undead servants (coding - convenience, no real reason except that Vehumet - prefers demons) */ + // Vehumet - only for non-undead servants (coding + // convenience, no real reason except that Vehumet + // prefers demons) if (you.magic_points < you.max_magic_points) { mpr("You feel your power returning."); @@ -847,8 +841,9 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) } if (you.religion == GOD_SHINING_ONE - && is_mons_evil_demonic_or_undead(monster) - && (!player_under_penance() && random2(you.piety) >= 30) + && mons_is_evil_or_unholy(monster) + && (!player_under_penance() + && random2(you.piety) >= piety_breakpoint(0)) && i != ANON_FRIENDLY_MONSTER && i >= 0 && i < MAX_MONSTERS) { @@ -5150,7 +5145,7 @@ static bool is_native_in_branch(const monsters *monster, // randomize potential damage static int estimated_trap_damage(trap_type trap) { - switch (trap) + switch (trap) { case TRAP_BLADE: return (10 + random2(30)); -- cgit v1.2.3-54-g00ecf