diff options
Diffstat (limited to 'crawl-ref/source/godabil.cc')
-rw-r--r-- | crawl-ref/source/godabil.cc | 31 |
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. |