summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.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/beam.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/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc49
1 files changed, 14 insertions, 35 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index f8aa4e2ded..36c47d85b8 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -33,6 +33,7 @@
#include "effects.h"
#include "env.h"
#include "enum.h"
+#include "godabil.h"
#include "map_knowledge.h"
#include "fprop.h"
#include "fight.h"
@@ -4485,41 +4486,6 @@ void bolt::tracer_enchantment_affect_monster(monsters* mon)
bool bolt::determine_damage(monsters* mon, int& preac, int& postac, int& final,
std::vector<std::string>& messages)
{
- // Fedhas worshippers can fire through monsters of the same
- // alignment. This means Fedhas-worshipping players can fire through
- // allied plants, and also means that Fedhas-worshipping oklob plants
- // can fire through plants with the same attitude.
- bool originator_worships_fedhas = false;
-
- // Checking beam_source to decide whether the player or a monster
- // fired the beam (so we can check their religion). This is
- // complicated by the fact that this beam may in fact be an
- // explosion caused by a miscast effect. In that case, the value of
- // beam_source may be negative (god-induced miscast) or greater than
- // NON_MONSTER (various other miscast sources). So we check whether
- // or not this is an explosion, and also the range of beam_source
- // before attempting to reference env.mons with it. -cao
- if (!is_explosion && beam_source == NON_MONSTER)
- originator_worships_fedhas = (you.religion == GOD_FEDHAS);
- else if (!is_explosion && beam_source >= 0 && beam_source < MAX_MONSTERS)
- originator_worships_fedhas = (env.mons[beam_source].god == GOD_FEDHAS);
-
- if (!is_enchantment()
- && attitude == mon->attitude
- && originator_worships_fedhas
- && fedhas_protects(mon))
- {
- if (!is_tracer)
- {
- // FIXME: Could use a better message, something about
- // dodging that doesn't sound excessively weird would be
- // nice.
- mprf(MSGCH_GOD, "Fedhas protects %s plant from harm.",
- attitude == ATT_FRIENDLY ? "your" : "a");
- }
- return (false);
- }
-
// preac: damage before AC modifier
// postac: damage after AC modifier
// final: damage after AC and resists
@@ -4901,6 +4867,19 @@ void bolt::affect_monster(monsters* mon)
apply_hit_funcs(mon, 0);
return;
}
+ if (fedhas_shoot_through(*this, mon))
+ {
+ apply_hit_funcs(mon, 0);
+ if (!is_tracer)
+ {
+ // FIXME: Could use a better message, something about
+ // dodging that doesn't sound excessively weird would be
+ // nice.
+ mprf(MSGCH_GOD, "Fedhas protects %s plant from harm.",
+ attitude == ATT_FRIENDLY ? "your" : "a");
+ }
+ return;
+ }
// Fire storm creates these, so we'll avoid affecting them
if (name == "great blast of fire" && mon->type == MONS_FIRE_VORTEX)