summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/godabil.cc
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2010-01-09 21:15:06 -0500
committerCharles Otto <ottochar@gmail.com>2010-01-09 21:17:11 -0500
commit26707f530e67655adc7a59cb8b510fd3d12cd754 (patch)
tree528da5ebb874f433010d7816913e5b12161c1584 /crawl-ref/source/godabil.cc
parent19a3b09d4507b5ca6b26a0f752774c1ac595a4ad (diff)
downloadcrawl-ref-26707f530e67655adc7a59cb8b510fd3d12cd754.tar.gz
crawl-ref-26707f530e67655adc7a59cb8b510fd3d12cd754.zip
Make Fedhas' shoot through plants more lenient
Allow players to fire through neutral (as well as friendly) plants and let explosion spells (fireball etc.) pass through plants although the explosion from those spells still affects plants.
Diffstat (limited to 'crawl-ref/source/godabil.cc')
-rw-r--r--crawl-ref/source/godabil.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index f5b0d609de..f6a1d82c1d 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -326,6 +326,37 @@ bool fedhas_passthrough(const monsters * target)
|| target->attitude != ATT_HOSTILE));
}
+// Fedhas worshipers can shoot through non-hostile plants, can a
+// particular beam go through a particular monster?
+bool fedhas_shoot_through(const bolt & beam, const monsters * victim)
+{
+ actor * originator = beam.agent();
+ if (!victim || !originator)
+ return (false);
+
+ bool origin_worships_fedhas;
+ mon_attitude_type origin_attitude;
+ if (originator->atype() == ACT_PLAYER)
+ {
+ origin_worships_fedhas = you.religion == GOD_FEDHAS;
+ origin_attitude = ATT_FRIENDLY;
+ }
+ else
+ {
+ monsters * temp = dynamic_cast<monsters *> (originator);
+ if (!temp)
+ return false;
+ origin_worships_fedhas = temp->god == GOD_FEDHAS;
+ origin_attitude = temp->attitude;
+ }
+
+ return (origin_worships_fedhas
+ && fedhas_protects(victim)
+ && !beam.is_enchantment()
+ && !(beam.is_explosion && beam.in_explosion_phase)
+ && (mons_atts_aligned(victim->attitude, origin_attitude)
+ || victim->neutral() ));
+}
// Turns corpses in LOS into skeletons and grows toadstools on them.
// Can also turn zombies into skeletons and destroy ghoul-type monsters.