diff options
author | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-07 22:24:48 -0600 |
---|---|---|
committer | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-07 22:24:48 -0600 |
commit | 4915a3d61f5c92669121713d4744fb60036dac2f (patch) | |
tree | 5a35d090d5b236da9dfca1c4e5ab8ab09aac32a1 | |
parent | 6b3f882a81bae89affecdcba5e24df1fb51e8cf4 (diff) | |
download | crawl-ref-4915a3d61f5c92669121713d4744fb60036dac2f.tar.gz crawl-ref-4915a3d61f5c92669121713d4744fb60036dac2f.zip |
Remove mons_is_holy(), as it's redundant.
-rw-r--r-- | crawl-ref/source/attitude-change.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/beam.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/fight.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/misc.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/mon-act.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/monplace.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/monster.cc | 15 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 21 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/spells1.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/xom.cc | 2 |
14 files changed, 32 insertions, 40 deletions
diff --git a/crawl-ref/source/attitude-change.cc b/crawl-ref/source/attitude-change.cc index 342de10985..af2696fa9a 100644 --- a/crawl-ref/source/attitude-change.cc +++ b/crawl-ref/source/attitude-change.cc @@ -35,7 +35,7 @@ void good_god_follower_attitude_change(monsters *monster) // good neutral towards you. if (is_good_god(you.religion) && monster->foe == MHITYOU - && mons_is_holy(monster) + && monster->holiness() == MH_HOLY && !testbits(monster->flags, MF_ATT_CHANGE_ATTEMPT) && !mons_wont_attack(monster) && you.visible_to(monster) && !monster->asleep() @@ -148,7 +148,7 @@ static bool _holy_beings_on_level_attitude_change() { monsters *monster = &menv[i]; if (monster->alive() - && mons_is_holy(monster)) + && monster->holiness() == MH_HOLY) { #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Holy attitude changing: %s on level %d, branch %d", @@ -369,7 +369,7 @@ static bool _make_holy_god_gifts_on_level_good_neutral(bool seen = false) monsters *monster = &menv[i]; if (is_follower(monster) && !monster->has_ench(ENCH_CHARM) - && mons_is_holy(monster) + && monster->holiness() == MH_HOLY && mons_is_god_gift(monster, god)) { // monster changes attitude @@ -785,7 +785,7 @@ static void _print_good_god_holy_being_speech(bool neutral, // the good gods, and be made worshippers of TSO if necessary. void good_god_holy_attitude_change(monsters *holy) { - ASSERT(mons_is_holy(holy)); + ASSERT(holy->holiness() == MH_HOLY); if (you.can_see(holy)) // show reaction { @@ -813,7 +813,7 @@ void good_god_holy_attitude_change(monsters *holy) void good_god_holy_fail_attitude_change(monsters *holy) { - ASSERT(mons_is_holy(holy)); + ASSERT(holy->holiness() == MH_HOLY); if (you.can_see(holy)) // show reaction { diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 7126888288..c5c342d9ed 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -5810,7 +5810,7 @@ bool bolt::nasty_to(const monsters *mon) const // No charming holy beings! if (flavour == BEAM_CHARM) - return (mons_is_holy(mon)); + return (mon->holiness() == MH_HOLY); // Friendly and good neutral monsters don't mind being teleported. if (flavour == BEAM_TELEPORT) diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 0b51df6ad6..a928168445 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -2338,7 +2338,7 @@ void melee_attack::chaos_affects_defender() const bool immune = mon && mons_immune_magic(defender_as_monster()); const bool is_natural = mon && defender->holiness() == MH_NATURAL; const bool is_shifter = mon && mons_is_shapeshifter(defender_as_monster()); - const bool can_clone = mon && !mons_is_holy(defender_as_monster()) + const bool can_clone = mon && defender->holiness() == MH_HOLY && mons_clonable(defender_as_monster(), true); const bool can_poly = is_shifter || (defender->can_safely_mutate() && !immune); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 76b1b2af31..3c96ec0319 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -3166,7 +3166,7 @@ bool stop_attack_prompt(const monsters *mon, bool beam_attack, const bool isFriendly = mon->friendly(); const bool isNeutral = mon->neutral(); const bool isUnchivalric = is_unchivalric_attack(&you, mon); - const bool isHoly = mons_is_holy(mon) + const bool isHoly = mon->holiness() == MH_HOLY && (mon->attitude != ATT_HOSTILE || testbits(mon->flags, MF_CREATED_FRIENDLY) || testbits(mon->flags, MF_WAS_NEUTRAL)); diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index d83783f537..2547054527 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -288,7 +288,7 @@ static bool _mon_on_interesting_grid(monsters *mon) // else fall through case DNGN_ALTAR_ZIN: case DNGN_ALTAR_SHINING_ONE: - return (mons_is_holy(mon)); + return (mon->holiness() == MH_HOLY); // Orcs will tend to patrol around altars to Beogh, and guard the // stairway from and to the Orcish Mines. diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index c9994f5896..6d70c5effb 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -424,7 +424,7 @@ int mons_unusable_items(const monsters *mon) { int ret = 0; - if (mons_is_holy(mon)) + if (mon->holiness() == MH_HOLY) ret += _scan_mon_inv_items(mon, is_evil_item) > 0; else if (mon->is_unholy()) { @@ -1096,11 +1096,6 @@ const char* mons_resist_string(const monsters *mon) return "resists"; } -bool mons_is_holy(const monsters *mon) -{ - return (mon->holiness() == MH_HOLY); -} - bool mons_has_lifeforce(const monsters *mon) { const mon_holy_type holiness = mon->holiness(); diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 578d3adddc..1e4bed5614 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -630,7 +630,6 @@ bool mons_is_fleeing_sanctuary(const monsters *m); bool mons_was_seen(const monsters *m); bool mons_is_known_mimic(const monsters *m); bool mons_is_unknown_mimic(const monsters *m); -bool mons_is_holy(const monsters *mon); bool mons_is_skeletal(int mc); bool mons_class_is_slime(int mc); bool mons_is_slime(const monsters *mon); diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index c2c9d714cd..070ec3b9e1 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -2578,7 +2578,7 @@ bool player_will_anger_monster(monsters *mon, bool *holy, const bool isHoly = (is_good_god(you.religion) && mon->is_evil()); const bool isUnholy = - (is_evil_god(you.religion) && mons_is_holy(mon)); + (is_evil_god(you.religion) && mon->holiness() == MH_HOLY); const bool isLawful = (you.religion == GOD_ZIN && mon->is_chaotic()); const bool isAntimagical = diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 7896fd321b..4e79eb6a30 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -619,15 +619,12 @@ bool monsters::could_wield(const item_def &item, bool ignore_brand, // Holy monsters and monsters that are gifts of good gods won't // use evil weapons. - if ((mons_is_holy(this) || is_good_god(god)) - && is_evil_item(item)) - { + if ((holiness() == MH_HOLY || is_good_god(god)) && is_evil_item(item)) return (false); - } // Holy monsters that aren't gifts of chaotic gods and monsters // that are gifts of good gods won't use chaotic weapons. - if (((mons_is_holy(this) && !is_chaotic_god(this->god)) + if (((holiness() == MH_HOLY && !is_chaotic_god(god)) || is_good_god(god)) && is_chaotic_item(item)) { @@ -1675,7 +1672,7 @@ bool monsters::pickup_wand(item_def &item, int near) // Holy monsters and worshippers of good gods won't pick up evil // wands. - if ((mons_is_holy(this) || is_good_god(god)) && is_evil_item(item)) + if ((holiness() == MH_HOLY || is_good_god(god)) && is_evil_item(item)) return (false); // If a monster already has a charged wand, don't bother. @@ -1703,7 +1700,7 @@ bool monsters::pickup_scroll(item_def &item, int near) // Holy monsters and worshippers of good gods won't pick up evil // scrolls. - if ((mons_is_holy(this) || is_good_god(god)) && is_evil_item(item)) + if ((holiness() == MH_HOLY || is_good_god(god)) && is_evil_item(item)) return (false); return (pickup(item, MSLOT_SCROLL, near)); @@ -1734,7 +1731,7 @@ bool monsters::pickup_misc(item_def &item, int near) // Holy monsters and worshippers of good gods won't pick up evil // miscellaneous items. - if ((mons_is_holy(this) || is_good_god(god)) && is_evil_item(item)) + if ((holiness() == MH_HOLY || is_good_god(god)) && is_evil_item(item)) return (false); return (pickup(item, MSLOT_MISCELLANY, near)); @@ -3184,7 +3181,7 @@ int monsters::res_holy_energy(const actor *attacker) const return (-2); if (is_good_god(god) - || mons_is_holy(this) + || holiness() == MH_HOLY || neutral() || is_unchivalric_attack(attacker, this) || is_good_god(you.religion) && is_follower(this)) diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 24ef2ba386..a9eccfda1d 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1612,10 +1612,9 @@ int monster_die(monsters *monster, killer_type killer, monster->hit_dice, true, monster); } - // Holy kills are always noticed. - if (targ_holy == MH_HOLY) + if (mons_is_slime(monster)) { - did_god_conduct(DID_KILL_HOLY, monster->hit_dice, + did_god_conduct(DID_KILL_SLIME, monster->hit_dice, true, monster); } @@ -1625,16 +1624,17 @@ int monster_die(monsters *monster, killer_type killer, true, monster); } - if (mons_is_slime(monster)) + // Cheibriados hates fast monsters. + if (mons_is_fast(monster)) { - did_god_conduct(DID_KILL_SLIME, monster->hit_dice, + did_god_conduct(DID_KILL_FAST, monster->hit_dice, true, monster); } - // Cheibriados hates fast monsters - if (mons_is_fast(monster)) + // Holy kills are always noticed. + if (targ_holy == MH_HOLY) { - did_god_conduct(DID_KILL_FAST, monster->hit_dice, + did_god_conduct(DID_KILL_HOLY, monster->hit_dice, true, monster); } } @@ -1900,13 +1900,13 @@ int monster_die(monsters *monster, killer_type killer, } } - // Randomly bless the follower who killed. if (you.religion == GOD_BEOGH && random2(you.piety) >= piety_breakpoint(2) && !player_under_penance() && !one_chance_in(3) && !invalid_monster_index(killer_index)) { + // Randomly bless the follower who killed. bless_follower(killer_mon); } } @@ -3897,7 +3897,8 @@ std::string summoned_poof_msg(const monsters* monster, bool plural) msg = "degenerate%s into a cloud of primal chaos"; } - if (mons_is_holy(monster) && summon_type != SPELL_SHADOW_CREATURES + if (monster->holiness() == MH_HOLY + && summon_type != SPELL_SHADOW_CREATURES && summon_type != MON_SUMM_CHAOS) { msg = "dissolve%s into sparkling lights"; diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 3813727c25..0c6725c3da 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -6479,7 +6479,7 @@ int player::res_holy_energy(const actor *attacker) const if (is_unholy()) return (-2); - if (is_good_god(religion)) + if (is_good_god(religion) || holiness() == MH_HOLY) return (1); return (0); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 9dde1e6f9a..6ddc729804 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3545,7 +3545,7 @@ void set_attack_conducts(god_conduct_trigger conduct[3], const monsters *mon, _first_attack_was_unchivalric[midx] = true; } - if (mons_is_holy(mon)) + if (mon->holiness() == MH_HOLY) conduct[2].set(DID_ATTACK_HOLY, mon->hit_dice, known, mon); _first_attack_conduct[midx] = false; diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index b32934ed84..548e7491ad 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -818,7 +818,7 @@ static int _healing_spell(int healed, bool divine_ability, { did_something = true; - const bool is_holy = mons_is_holy(monster); + const bool is_holy = monster->holiness() == MH_HOLY; const bool is_summoned = monster->is_summoned(); int pgain = 0; diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 8cd082be50..121075fae4 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -952,7 +952,7 @@ static bool _choose_chaos_upgrade(const monsters* mon) // Holy beings are presumably protected by another god, unless // they're gifts from a chaotic god. - if (mons_is_holy(mon) && !is_chaotic_god(mon->god)) + if (mon->holiness() == MH_HOLY && !is_chaotic_god(mon->god)) return (false); // God gifts from good gods will be protected by their god from |