diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-22 18:30:15 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-22 22:37:08 +0200 |
commit | fd1958001336bef983dfdfc951735c6e628d3ab7 (patch) | |
tree | f607ef458f3c05cd5eeae2cd39ab5c5a5f148037 | |
parent | 346761406bb570a727aea4d844e875a1e7cccf8b (diff) | |
download | crawl-ref-fd1958001336bef983dfdfc951735c6e628d3ab7.tar.gz crawl-ref-fd1958001336bef983dfdfc951735c6e628d3ab7.zip |
Move mons_player_visible into player::visible_to.
-rw-r--r-- | crawl-ref/source/mon-util.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 10 |
6 files changed, 16 insertions, 34 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index d15649f65f..64de62bc85 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -919,24 +919,6 @@ bool mons_monster_visible(const monsters *mon, const monsters *targ) return (true); } -// This does NOT do line of sight! It checks the player's visibility -// with respect to mon's perception, but doesn't do walls or range. -bool mons_player_visible(const monsters *mon) -{ - if (you.invisible()) - { - if (player_in_water()) - return (true); - - if (mon->can_see_invisible() || mons_sense_invis(mon)) - return (true); - - return (false); - } - - return (true); -} - unsigned mons_char(int mc) { return monster_symbols[mc].glyph; diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 1cb6f39f8d..02dab2db8c 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -516,7 +516,6 @@ mon_itemeat_type mons_itemeat(const monsters *mon); bool mons_sense_invis(const monsters *mon); bool mon_can_see_monster(const monsters *mon, const monsters *targ); bool mons_monster_visible(const monsters *mon, const monsters *targ); -bool mons_player_visible(const monsters *mon); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 42a27dc898..29cc7d5906 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -4388,7 +4388,7 @@ static void _handle_behaviour(monsters *mon) // in shallow water. if (proxPlayer && you.invisible()) { - if (!mons_player_visible( mon )) + if (!mon->can_see_invisible()) proxPlayer = false; // Must be able to see each other. else if (!see_cell(mon->pos())) @@ -4832,7 +4832,7 @@ static bool _mons_check_set_foe(monsters *mon, const coord_def& p, return (false); if (!friendly && !neutral && p == you.pos() - && mons_player_visible(mon) && !is_sanctuary(p)) + && mon->can_see_invisible() && !is_sanctuary(p)) { mon->foe = MHITYOU; return (true); @@ -5961,7 +5961,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) if (monster->has_ench(ENCH_CONFUSION)) break; - if (!mons_player_visible(monster)) + if (!monster->can_see_invisible()) break; if (coinflip()) @@ -5996,7 +5996,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) if (monster->has_ench(ENCH_CONFUSION)) break; - if (!mons_player_visible( monster )) + if (!monster->can_see_invisible()) break; if (coinflip()) @@ -6155,7 +6155,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) if (monster->has_ench(ENCH_CONFUSION)) break; - if (!mons_player_visible( monster )) + if (!monster->can_see_invisible()) break; // The fewer spikes the manticore has left, the less @@ -6231,7 +6231,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) if (monster->has_ench(ENCH_CONFUSION)) break; - if (!mons_player_visible( monster )) + if (!monster->can_see_invisible()) break; if (monster->type != MONS_HELL_HOUND && x_chance_in_y(3, 13) @@ -7077,7 +7077,7 @@ static bool _handle_spell(monsters *monster, bolt &beem) // use ME_ALERT to target (we should really have // a measure of time instead of peeking to see // if the player is still there). -- bwr - if (!mons_player_visible(monster) + if (!monster->can_see_invisible() && (monster->target != you.pos() || coinflip())) { spellOK = false; diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 9dbbdbeb35..e98289b351 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -7359,7 +7359,8 @@ bool player::visible_to(const actor *looker) const return (can_see_invisible() || !invisible()); const monsters* mon = dynamic_cast<const monsters*>(looker); - return mons_player_visible(mon); + return (!you.invisible() || player_in_water() || + mon->can_see_invisible() || mons_sense_invis(mon)); } bool player::see_cell(const coord_def &c) const diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index cffbd3de6c..96533db1b0 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -5654,7 +5654,7 @@ static bool _beogh_followers_abandon_you() { num_followers++; - if (mons_player_visible(monster) + if (monster->can_see_invisible() && !mons_is_sleeping(monster) && !mons_is_confused(monster) && !mons_cannot_act(monster)) @@ -7457,7 +7457,7 @@ int get_tension(god_type god, bool count_travelling) if (att != ATT_FRIENDLY) { - if (!mons_player_visible(mons)) + if (!mons->can_see_invisible()) exper /= 2; if (!player_monster_visible(mons)) exper *= 2; diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 5d182b8377..fb10354149 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -914,7 +914,7 @@ static void _good_god_follower_attitude_change(monsters *monster) && mons_is_holy(monster) && !testbits(monster->flags, MF_ATT_CHANGE_ATTEMPT) && !mons_wont_attack(monster) - && mons_player_visible(monster) && !mons_is_sleeping(monster) + && monster->can_see_invisible() && !mons_is_sleeping(monster) && !mons_is_confused(monster) && !mons_is_paralysed(monster)) { monster->flags |= MF_ATT_CHANGE_ATTEMPT; @@ -954,7 +954,7 @@ void beogh_follower_convert(monsters *monster, bool orc_hit) && !mons_is_shapeshifter(monster) && !testbits(monster->flags, MF_ATT_CHANGE_ATTEMPT) && !mons_friendly(monster) - && mons_player_visible(monster) && !mons_is_sleeping(monster) + && monster->can_see_invisible() && !mons_is_sleeping(monster) && !mons_is_confused(monster) && !mons_is_paralysed(monster)) { monster->flags |= MF_ATT_CHANGE_ATTEMPT; @@ -989,7 +989,7 @@ void slime_convert(monsters* monster) && !mons_neutral(monster) && !mons_friendly(monster) && !testbits(monster->flags, MF_ATT_CHANGE_ATTEMPT) - && mons_player_visible(monster) && !mons_is_sleeping(monster) + && monster->can_see_invisible() && !mons_is_sleeping(monster) && !mons_is_confused(monster) && !mons_is_paralysed(monster)) { monster->flags |= MF_ATT_CHANGE_ATTEMPT; @@ -1481,7 +1481,7 @@ bool check_awaken(monsters* monster) if (mons_is_wandering(monster) && monster->foe == MHITYOU) mons_perc += 15; - if (!mons_player_visible(monster)) + if (!monster->can_see_invisible()) { mons_perc -= 75; unnatural_stealthy = true; @@ -1506,7 +1506,7 @@ bool check_awaken(monsters* monster) // If you've been tagged with Corona or are Glowing, the glow // makes you extremely unstealthy. - if (you.backlit() && mons_player_visible(monster)) + if (you.backlit() && monster->can_see_invisible()) mons_perc += 50; if (mons_perc < 0) |