summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-07-30 06:59:43 -0400
committerNeil Moore <neil@s-z.org>2014-07-30 06:59:46 -0400
commit4ccbf14a0f29572fe3fb64aaada6e1450c0e90ec (patch)
treeb5ec13c5f5c9705487b5217f94ace5fbfc543e82
parentb5031071af6e5f9561cb85f8762154aca3ec4433 (diff)
downloadcrawl-ref-4ccbf14a0f29572fe3fb64aaada6e1450c0e90ec.tar.gz
crawl-ref-4ccbf14a0f29572fe3fb64aaada6e1450c0e90ec.zip
Let Qazlalites disarm traps beneath their own clouds (#8758)
All the other player-relevant checks in actor_cloud_immune care only about the cloud type, so this isn't an information leak.
-rw-r--r--crawl-ref/source/cloud.cc10
-rw-r--r--crawl-ref/source/cloud.h1
-rw-r--r--crawl-ref/source/main.cc3
3 files changed, 8 insertions, 6 deletions
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index ee05f1e751..b99fe48f11 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -806,7 +806,7 @@ static int _cloud_base_damage(const actor *act,
// Note that actor_cloud_immune may be false even if the actor will
// not be harmed by the cloud. The cloud may have positive
// side-effects on the actor.
-static bool _actor_cloud_immune(const actor *act, const cloud_struct &cloud)
+bool actor_cloud_immune(const actor *act, const cloud_struct &cloud)
{
if (is_harmless_cloud(cloud.type))
return true;
@@ -884,7 +884,7 @@ static bool _actor_cloud_immune(const actor *act, const cloud_struct &cloud)
// returns MAG_IMMUNE.
static int _actor_cloud_resist(const actor *act, const cloud_struct &cloud)
{
- if (_actor_cloud_immune(act, cloud))
+ if (actor_cloud_immune(act, cloud))
return MAG_IMMUNE;
switch (cloud.type)
{
@@ -1095,7 +1095,7 @@ static int _actor_cloud_base_damage(actor *act,
int resist,
bool maximum_damage)
{
- if (_actor_cloud_immune(act, cloud))
+ if (actor_cloud_immune(act, cloud))
return 0;
const int cloud_raw_base_damage =
@@ -1212,7 +1212,7 @@ int actor_apply_cloud(actor *act)
monster *mons = !player? act->as_monster() : NULL;
const beam_type cloud_flavour = _cloud2beam(cloud.type);
- if (_actor_cloud_immune(act, cloud))
+ if (actor_cloud_immune(act, cloud))
return 0;
const int resist = _actor_cloud_resist(act, cloud);
@@ -1267,7 +1267,7 @@ int actor_apply_cloud(actor *act)
static bool _cloud_is_harmful(actor *act, cloud_struct &cloud,
int maximum_negligible_damage)
{
- return !_actor_cloud_immune(act, cloud)
+ return !actor_cloud_immune(act, cloud)
&& (_cloud_has_negative_side_effects(cloud.type)
|| (_actor_cloud_damage(act, cloud, true) >
maximum_negligible_damage));
diff --git a/crawl-ref/source/cloud.h b/crawl-ref/source/cloud.h
index aff65061da..8e569bcee7 100644
--- a/crawl-ref/source/cloud.h
+++ b/crawl-ref/source/cloud.h
@@ -41,6 +41,7 @@ string cloud_type_name(cloud_type type, bool terse = true);
int get_cloud_colour(int cloudno);
coord_def get_cloud_originator(const coord_def& pos);
+bool actor_cloud_immune(const actor *act, const cloud_struct &cloud);
bool is_damaging_cloud(cloud_type type, bool temp = false);
bool is_harmless_cloud(cloud_type type);
bool in_what_cloud(cloud_type type);
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 39ad8b7bc6..2a9239dbf6 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -2551,7 +2551,8 @@ static bool _untrap_target(const coord_def move, bool check_confused)
{
const int cloud = env.cgrid(target);
if (cloud != EMPTY_CLOUD
- && is_damaging_cloud(env.cloud[cloud].type, true))
+ && is_damaging_cloud(env.cloud[cloud].type, true)
+ && !actor_cloud_immune(&you, env.cloud[cloud]))
{
mpr("You can't get to that trap right now.");
return true;