summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-abil.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-05 20:50:54 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-05 22:30:03 +0100
commitdc3f573c6ef467ddcc4a837ce90ca9df3b502c2e (patch)
treef7915736d0a9bad11d83c3ff8a0263577a27e979 /crawl-ref/source/mon-abil.cc
parent31124ec682c2b826f169c23e808fa741a3033a04 (diff)
downloadcrawl-ref-dc3f573c6ef467ddcc4a837ce90ca9df3b502c2e.tar.gz
crawl-ref-dc3f573c6ef467ddcc4a837ce90ca9df3b502c2e.zip
Unify mesmerisation code.
There were several places that had copies of the same code, checking whether mesmerisation blocked movement to a given target. The various mesmerisation functions have become methods of player and were moved into behold.cc.
Diffstat (limited to 'crawl-ref/source/mon-abil.cc')
-rw-r--r--crawl-ref/source/mon-abil.cc23
1 files changed, 4 insertions, 19 deletions
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index 680c86f02d..cd5d2909ad 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -1202,7 +1202,7 @@ bool mon_special_ability(monsters *monster, bolt & beem)
break;
}
- bool already_mesmerised = player_mesmerised_by(monster);
+ bool already_mesmerised = you.beheld_by(monster);
if (one_chance_in(5)
|| monster->foe == MHITYOU && !already_mesmerised && coinflip())
@@ -1257,23 +1257,9 @@ bool mon_special_ability(monsters *monster, bolt & beem)
break;
}
- if (!you.duration[DUR_MESMERISED])
- {
- you.duration[DUR_MESMERISED] = 7;
- you.mesmerised_by.push_back(monster_index(monster));
- mprf(MSGCH_WARN, "You are mesmerised by %s!",
- monster->name(DESC_NOCAP_THE).c_str());
- }
- else
- {
- you.duration[DUR_MESMERISED] += 5;
- if (!already_mesmerised)
- you.mesmerised_by.push_back(monster_index(monster));
- }
- used = true;
+ you.add_beholder(monster);
- if (you.duration[DUR_MESMERISED] > 12)
- you.duration[DUR_MESMERISED] = 12;
+ used = true;
}
break;
}
@@ -1361,7 +1347,7 @@ void mon_nearby_ability(monsters *monster)
if (monster_can_submerge(monster, grd(monster->pos()))
&& !monster->caught() // No submerging while caught.
- && !player_mesmerised_by(monster) // No submerging if player entranced.
+ && !you.beheld_by(monster) // No submerging if player entranced.
&& !mons_is_lurking(monster) // Handled elsewhere.
&& monster->wants_submerge())
{
@@ -1369,7 +1355,6 @@ void mon_nearby_ability(monsters *monster)
monster->add_ench(ENCH_SUBMERGED);
monster->speed_increment -= ENERGY_SUBMERGE(entry);
- update_beholders(monster);
return;
}