summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-22 18:14:00 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-22 22:37:07 +0200
commit78f7b9d8e5921ef3e1f64d01c802436a654c177a (patch)
tree3d58adf6061925cc6f729a819f4a2c64bccb34d9
parented4a22bce4db2328e945840901176b49d4b573e7 (diff)
downloadcrawl-ref-78f7b9d8e5921ef3e1f64d01c802436a654c177a.tar.gz
crawl-ref-78f7b9d8e5921ef3e1f64d01c802436a654c177a.zip
Move player_see_invis into player class.
-rw-r--r--crawl-ref/source/acr.cc2
-rw-r--r--crawl-ref/source/beam.cc2
-rw-r--r--crawl-ref/source/decks.cc2
-rw-r--r--crawl-ref/source/ghost.cc2
-rw-r--r--crawl-ref/source/it_use2.cc2
-rw-r--r--crawl-ref/source/mon-util.cc6
-rw-r--r--crawl-ref/source/monstuff.cc4
-rw-r--r--crawl-ref/source/output.cc2
-rw-r--r--crawl-ref/source/player.cc60
-rw-r--r--crawl-ref/source/player.h2
-rw-r--r--crawl-ref/source/spells1.cc2
-rw-r--r--crawl-ref/source/spells2.cc2
-rw-r--r--crawl-ref/source/spells3.cc2
-rw-r--r--crawl-ref/source/spells4.cc4
-rw-r--r--crawl-ref/source/view.cc4
15 files changed, 49 insertions, 49 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 35517c4de4..820bc6662f 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -2233,7 +2233,7 @@ static void _decrement_durations()
you.redraw_evasion = true;
}
- if (_decrement_a_duration(DUR_SEE_INVISIBLE) && !player_see_invis())
+ if (_decrement_a_duration(DUR_SEE_INVISIBLE) && !you.can_see_invisible())
mpr("Your eyesight blurs momentarily.", MSGCH_DURATION);
_decrement_a_duration(DUR_TELEPATHY, "You feel less empathic.");
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index ae0dadbe7c..29aa469aac 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -243,7 +243,7 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range)
pbolt.is_tracer = true;
pbolt.source = you.pos();
- pbolt.can_see_invis = player_see_invis();
+ pbolt.can_see_invis = you.can_see_invisible();
pbolt.smart_monster = true;
pbolt.attitude = ATT_FRIENDLY;
pbolt.thrower = KILL_YOU_MISSILE;
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index d1f44439c8..25f4f28038 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2723,7 +2723,7 @@ static void _summon_flying(int power, deck_rarity_type rarity)
do
result = flytypes[random2(4) + power_level];
while (friendly && mons_class_flag(result, M_INVIS)
- && !player_see_invis());
+ && !you.can_see_invisible());
for (int i = 0; i < power_level * 5 + 2; ++i)
{
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index c3fd89bbeb..cbca0a09f1 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -332,7 +332,7 @@ void ghost_demon::init_player_ghost()
if (ev > MAX_GHOST_EVASION)
ev = MAX_GHOST_EVASION;
- see_invis = player_see_invis();
+ see_invis = you.can_see_invisible();
resists.fire = player_res_fire();
resists.cold = player_res_cold();
resists.elec = player_res_electricity();
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index 5037bff610..d8df5b0b79 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -585,7 +585,7 @@ void unwear_armour(int slot)
break;
case SPARM_SEE_INVISIBLE:
- if (!player_see_invis())
+ if (!you.can_see_invisible())
mpr("You feel less perceptive.");
break;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 4ed5d9b690..8829e968cb 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3134,7 +3134,7 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
case SPELL_INVISIBILITY:
if (mon->has_ench(ENCH_INVIS)
- || mons_friendly(mon) && !player_see_invis(false))
+ || mons_friendly(mon) && !you.can_see_invisible(false))
{
ret = true;
}
@@ -7034,7 +7034,7 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
// Invisible monsters stay invisible.
if (mons_class_flag(type, M_INVIS))
add_ench(mon_enchant(ENCH_INVIS));
- else if (mons_near(this) && !player_see_invis()
+ else if (mons_near(this) && !you.can_see_invisible()
&& !has_ench(ENCH_SUBMERGED))
{
if (!quiet)
@@ -8412,7 +8412,7 @@ bool monsters::should_drink_potion(potion_type ptype) const
// We're being nice: friendlies won't go invisible if the player
// won't be able to see them.
return (!has_ench(ENCH_INVIS)
- && (player_see_invis(false) || !mons_friendly(this)));
+ && (you.can_see_invisible(false) || !mons_friendly(this)));
default:
break;
}
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 6d07e5263d..42a27dc898 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2213,7 +2213,7 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
// Messaging.
bool can_see = you.can_see(monster);
- bool can_see_new = !mons_class_flag(targetc, M_INVIS) || player_see_invis();
+ bool can_see_new = !mons_class_flag(targetc, M_INVIS) || you.can_see_invisible();
bool need_note = false;
std::string old_name = monster->full_name(DESC_CAP_A);
@@ -6690,7 +6690,7 @@ static bool _handle_wand(monsters *monster, bolt &beem)
case WAND_INVISIBILITY:
if (!monster->has_ench(ENCH_INVIS)
&& !monster->has_ench(ENCH_SUBMERGED)
- && (!mons_friendly(monster) || player_see_invis(false)))
+ && (!mons_friendly(monster) || you.can_see_invisible(false)))
{
beem.target = monster->pos();
niceWand = true;
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 2d240716c2..8f3946d49c 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -2161,7 +2161,7 @@ static std::vector<formatted_string> _get_overview_resistances(
cols.add_formatted(0, buf, false);
- const int rinvi = player_see_invis(calc_unid);
+ const int rinvi = you.can_see_invisible(calc_unid);
const int rward = wearing_amulet(AMU_WARDING, calc_unid);
const int rcons = player_item_conserve(calc_unid);
const int rcorr = player_res_acid(calc_unid);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 452c16a57c..9dbbdbeb35 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2702,40 +2702,12 @@ int player_shield_class(void) //jmf: changes for new spell
return (base_shield);
}
-int player_see_invis(bool calc_unid)
-{
- int si = 0;
-
- si += player_equip( EQ_RINGS, RING_SEE_INVISIBLE, calc_unid );
-
- // armour: (checks head armour only)
- si += player_equip_ego_type( EQ_HELMET, SPARM_SEE_INVISIBLE );
-
- if (player_mutation_level(MUT_ACUTE_VISION) > 0)
- si += player_mutation_level(MUT_ACUTE_VISION);
-
- //jmf: added see_invisible spell
- if (you.duration[DUR_SEE_INVISIBLE] > 0)
- si++;
-
- // randart wpns
- int artefacts = scan_artefacts(ARTP_EYESIGHT, calc_unid);
-
- if (artefacts > 0)
- si += artefacts;
-
- if (si > 1)
- si = 1;
-
- return (si);
-}
-
// This does NOT do line of sight! It checks the monster's visibility
// with respect to the players perception, but doesn't do walls or
// range. To find if the square the monster is in LOS, see mons_near().
bool player_monster_visible(const monsters *mon)
{
- if (!player_see_invis() && mon->invisible())
+ if (!you.can_see_invisible() && mon->invisible())
return (false);
if (!mons_is_submerged(mon))
@@ -7343,9 +7315,37 @@ bool player::sicken(int amount)
return (true);
}
+bool player::can_see_invisible(bool calc_unid) const
+{
+ int si = 0;
+
+ si += player_equip( EQ_RINGS, RING_SEE_INVISIBLE, calc_unid );
+
+ // armour: (checks head armour only)
+ si += player_equip_ego_type( EQ_HELMET, SPARM_SEE_INVISIBLE );
+
+ if (player_mutation_level(MUT_ACUTE_VISION) > 0)
+ si += player_mutation_level(MUT_ACUTE_VISION);
+
+ //jmf: added see_invisible spell
+ if (you.duration[DUR_SEE_INVISIBLE] > 0)
+ si++;
+
+ // randart wpns
+ int artefacts = scan_artefacts(ARTP_EYESIGHT, calc_unid);
+
+ if (artefacts > 0)
+ si += artefacts;
+
+ if (si > 1)
+ si = 1;
+
+ return (si);
+}
+
bool player::can_see_invisible() const
{
- return (player_see_invis() > 0);
+ return (can_see_invisible(true));
}
bool player::invisible() const
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index d37495b532..3fdf9abff8 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -300,6 +300,7 @@ public:
bool cannot_speak() const;
bool invisible() const;
bool can_see_invisible() const;
+ bool can_see_invisible(bool unid) const;
bool visible_to(const actor *looker) const;
bool see_cell(const coord_def &c) const;
bool can_see(const actor *target) const;
@@ -760,7 +761,6 @@ int slaying_bonus(char which_affected);
* items - monstuff - mon-util - mstuff2 - spells1 - spells2 -
* spells3
* *********************************************************************** */
-int player_see_invis(bool calc_unid = true);
bool player_monster_visible(const monsters *mon);
bool player_mesmerised_by(const monsters *mon);
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 739ece6593..e2c5f71e5f 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -601,7 +601,7 @@ bool stinking_cloud( int pow, bolt &beem )
{
// Fire tracer.
beem.source = you.pos();
- beem.can_see_invis = player_see_invis();
+ beem.can_see_invis = you.can_see_invisible();
beem.smart_monster = true;
beem.attitude = ATT_FRIENDLY;
beem.friend_info.count = 0;
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index cb322ebf92..66a8422b87 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -551,7 +551,7 @@ void cast_toxic_radiance()
if (affected)
_record_monster_by_name(affected_monsters, monster);
}
- else if (player_see_invis())
+ else if (you.can_see_invisible())
{
// message player re:"miss" where appropriate {dlb}
mprf("The light passes through %s.",
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index a7c00c9481..64c27c7fa1 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -1290,7 +1290,7 @@ bool cast_haunt(int pow, const coord_def& where, god_type god)
(chance > 2) ? MONS_FREEZING_WRAITH // 20%/16%
: MONS_SPECTRAL_WARRIOR); // 12%
- if ((chance == 3 || chance == 8) && player_see_invis())
+ if ((chance == 3 || chance == 8) && you.can_see_invisible())
mon = MONS_SHADOW_WRAITH; // 0%/8%
const int monster =
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 42e99068d9..0b5a5169e4 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -346,7 +346,7 @@ void cast_phase_shift(int pow)
void cast_see_invisible(int pow)
{
- if (player_see_invis())
+ if (you.can_see_invisible())
mpr("Nothing seems to happen.");
else
{
@@ -1178,7 +1178,7 @@ bool cast_evaporate(int pow, bolt& beem, int pot_idx)
// Fire tracer. FIXME: use player_tracer() here!
beem.source = you.pos();
- beem.can_see_invis = player_see_invis();
+ beem.can_see_invis = you.can_see_invisible();
beem.smart_monster = true;
beem.attitude = ATT_FRIENDLY;
beem.beam_cancelled = false;
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 9e2e9d348d..5d182b8377 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -893,7 +893,7 @@ int get_mons_colour(const monsters *mons)
}
// Backlit monsters are fuzzy and override brands.
- if (!player_see_invis() && mons->has_ench(ENCH_INVIS)
+ if (!you.can_see_invisible() && mons->has_ench(ENCH_INVIS)
&& mons->backlit())
{
col = DARKGREY;
@@ -1172,7 +1172,7 @@ void handle_monster_shouts(monsters* monster, bool force)
// false for submerged monsters, but submerged monsters will be forced
// to surface before they shout, thus removing that source of
// non-visibility.
- if (mons_near(monster) && (!monster->invisible() || player_see_invis()))
+ if (mons_near(monster) && (!monster->invisible() || you.can_see_invisible()))
suffix = " seen";
else
suffix = " unseen";