From e70481a7e1e421d857655c69e678e0674dd3ceea Mon Sep 17 00:00:00 2001 From: dolorous Date: Sat, 15 Mar 2008 14:00:55 +0000 Subject: Add more holiness cleanups. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3648 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 8 ++++---- crawl-ref/source/delay.cc | 4 ++-- crawl-ref/source/fight.cc | 8 ++++---- crawl-ref/source/mon-util.cc | 9 +++++++-- crawl-ref/source/mon-util.h | 3 ++- crawl-ref/source/monstuff.cc | 2 +- crawl-ref/source/religion.cc | 9 ++++----- 7 files changed, 24 insertions(+), 19 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index f89ebc2d1c..f93d3d8016 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3774,8 +3774,8 @@ static int affect_monster(bolt &beam, monsters *mon) if (mons_friendly( mon ) && beam.flavour != BEAM_CHARM) did_god_conduct( DID_ATTACK_FRIEND, 5, true, mon ); - - if (mons_holiness( mon ) == MH_HOLY) + + if (mons_is_holy( mon )) did_god_conduct( DID_ATTACK_HOLY, mon->hit_dice, true, mon ); if (you.religion == GOD_BEOGH && mons_species(mon->type) == MONS_ORC @@ -3940,11 +3940,11 @@ static int affect_monster(bolt &beam, monsters *mon) { remove_sanctuary(true); } - + if (mons_friendly(mon)) conduct.set( DID_ATTACK_FRIEND, 5, !okay, mon ); - if (mons_holiness( mon ) == MH_HOLY) + if (mons_is_holy(mon)) conduct.set( DID_ATTACK_HOLY, mon->hit_dice, !okay, mon ); } diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index dd621a1485..d39ebc22fd 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -86,7 +86,7 @@ static int recite_to_monsters(int x, int y, int pow, int unused) return (0); int resist; - const int holiness = mons_holiness(mons); + const mon_holy_type holiness = mons_holiness(mons); if (holiness == MH_HOLY) { resist = 7 - random2(you.skills[SK_INVOCATIONS]); @@ -96,7 +96,7 @@ static int recite_to_monsters(int x, int y, int pow, int unused) else { resist = mons_resist_magic(mons); - + // much lower chances at influencing undead/demons if (holiness == MH_UNDEAD) pow -= 2 + random2(3); diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 551073571e..0faada5ee5 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -955,7 +955,7 @@ bool melee_attack::player_apply_aux_unarmed() aux_damage = hurt_monster(def, aux_damage); damage_done = aux_damage; - + if (damage_done > 0) { player_exercise_combat_skills(); @@ -965,10 +965,10 @@ bool melee_attack::player_apply_aux_unarmed() defender->name(DESC_NOCAP_THE).c_str(), debug_damage_number().c_str(), attack_strength_punctuation().c_str()); - + if (damage_brand == SPWPN_VENOM && coinflip()) poison_monster( def, KC_YOU ); - + if (mons_holiness(def) == MH_HOLY) did_god_conduct(DID_ATTACK_HOLY, 1, true, def); @@ -983,7 +983,7 @@ bool melee_attack::player_apply_aux_unarmed() { mprf( "You draw %s's blood!", def->name(DESC_NOCAP_THE, true).c_str() ); - + if (you.hp < you.hp_max) { int heal = 1 + random2(damage_done); diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 3154102d56..64b70878e4 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1014,6 +1014,11 @@ int mons_res_negative_energy( const monsters *mon ) return (u); } // end mons_res_negative_energy() +bool mons_is_holy( const monsters *mon ) +{ + return (mons_holiness( mon ) == MH_HOLY); +} + bool mons_is_evil( const monsters *mon ) { return (mons_class_flag( mon->type, M_EVIL )); @@ -1026,9 +1031,9 @@ bool mons_is_unholy( const monsters *mon ) return (holiness == MH_UNDEAD || holiness == MH_DEMONIC); } -bool mons_is_evil_or_unholy( const monsters *mons ) +bool mons_is_evil_or_unholy( const monsters *mon ) { - return (mons_is_evil(mons) || mons_is_unholy(mons)); + return (mons_is_evil(mon) || mons_is_unholy(mon)); } bool mons_has_lifeforce( const monsters *mon ) diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 739bb8c26f..4e3b7083ea 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -630,9 +630,10 @@ bool mons_is_sleeping(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 *mons ); +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 ); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index ced682c33f..ad07b566d4 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -703,7 +703,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) did_god_conduct(DID_KILL_PRIEST, monster->hit_dice, true, monster); - if (mons_holiness(monster) == MH_HOLY) + if (mons_is_holy(monster)) did_god_conduct(DID_KILL_ANGEL, monster->hit_dice, true, monster); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index e7872ba949..5bdc9c66b2 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2851,8 +2851,7 @@ static bool moral_beings_on_level_attitude_change() static_cast(you.where_are_you)); #endif - if (mons_class_holiness(monster->type) == MH_HOLY && - is_good_god(you.religion)) + if (mons_is_holy(monster) && is_good_god(you.religion)) { // If you worship a good god, you get another chance to // make hostile holy beings neutral. @@ -2868,8 +2867,8 @@ static bool moral_beings_on_level_attitude_change() // non-hostile holy beings hostile. If you do worship a // good god, you make all non-hostile evil and unholy beings // hostile. - else if ((mons_class_holiness(monster->type) == MH_HOLY && - !is_good_god(you.religion)) || + else if ((mons_is_holy(monster) && + !is_good_god(you.religion)) || (mons_is_evil_or_unholy(monster) && is_good_god(you.religion))) { @@ -3310,7 +3309,7 @@ static void beogh_orc_spontaneous_conversion_speech( void good_god_holy_attitude_change(monsters *holy) { - ASSERT(mons_class_holiness(holy->type) == MH_HOLY); + ASSERT(mons_is_holy(holy)); if (player_monster_visible(holy)) // show reaction { -- cgit v1.2.3-54-g00ecf