summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-02 09:21:55 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-02 09:21:55 +0000
commit145574d7faad160fb212d68a693454ea08d59b4f (patch)
tree67a2d4fd8b2f289d9210dd428aca84c6c405a84b /crawl-ref
parent99fcce0830ca9642fdc2dd8c35d9e1ac3b788116 (diff)
downloadcrawl-ref-145574d7faad160fb212d68a693454ea08d59b4f.tar.gz
crawl-ref-145574d7faad160fb212d68a693454ea08d59b4f.zip
Fix [2481621]: positive self-targeting enchantments prompted.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8112 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/beam.cc28
-rw-r--r--crawl-ref/source/item_use.cc7
-rw-r--r--crawl-ref/source/monstuff.cc3
-rw-r--r--crawl-ref/source/mstuff2.cc6
4 files changed, 18 insertions, 26 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 451056e5d7..66185cc0c2 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1458,7 +1458,13 @@ void bolt::initialize_fire()
}
if (target == source)
- range = 0;
+ {
+ range = 0;
+ aimed_at_feet = true;
+ auto_hit = true;
+ aimed_at_spot = true;
+ use_target_as_pos = true;
+ }
if (range == -1)
{
@@ -1903,13 +1909,7 @@ void bolt::do_fire()
#endif
msg_generated = false;
- if (target == source)
- {
- auto_hit = true;
- aimed_at_spot = true;
- use_target_as_pos = true;
- }
- else
+ if (!aimed_at_feet)
{
choose_ray();
// Take *one* step, so as not to hurt the source.
@@ -3241,18 +3241,18 @@ bool bolt::harmless_to_player() const
mprf(MSGCH_DIAGNOSTICS, "beam flavour: %d", flavour);
#endif
- // Shouldn't happen anyway since enchantments are either aimed at self
- // (not prompted) or cast at monsters and don't explode or bounce.
- if (is_enchantment())
- return (false);
-
- // The others are handled here.
switch (flavour)
{
case BEAM_VISUAL:
case BEAM_DIGGING:
return (true);
+ // Positive enchantments.
+ case BEAM_HASTE:
+ case BEAM_HEALING:
+ case BEAM_INVISIBILITY:
+ return (true);
+
// Cleansing flame doesn't affect player's followers.
case BEAM_HOLY:
return (is_good_god(you.religion));
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 66a0f6c252..d2853448af 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3541,12 +3541,13 @@ void zap_wand(int slot)
beam.source = you.pos();
beam.set_target(zap_wand);
- beam.aimed_at_feet = (beam.target == you.pos());
+
+ bool aimed_at_self = (beam.target == you.pos());
// Check whether we may hit friends, use "safe" values for random effects
// and unknown wands (highest possible range, and unresistable beam
// flavour). Don't use the tracer if firing at self.
- if (!beam.aimed_at_feet)
+ if (!aimed_at_self)
{
beam.range = tracer_range;
if (!player_tracer(beam.effect_known ? type_zapped
@@ -3562,7 +3563,7 @@ void zap_wand(int slot)
// and yourself, unless there's a nearby invisible enemy and you're
// trying to hit it at random.
const bool risky = dangerous && (beam.fr_count || beam.foe_count
- || invis_enemy || beam.aimed_at_feet);
+ || invis_enemy || aimed_at_self);
if (risky && alreadyknown && wand.sub_type == WAND_RANDOM_EFFECTS)
{
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 86a37415d0..d0ebed5742 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5640,9 +5640,6 @@ static bool _handle_wand(monsters *monster, bolt &beem)
return (false);
}
- if (beem.target == monster->pos())
- beem.aimed_at_feet = true;
-
// Fire tracer, if necessary.
if (!niceWand)
{
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 883e78646f..2afda419c3 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1002,12 +1002,6 @@ void setup_mons_cast(monsters *monster, bolt &pbolt,
{
pbolt.target = monster->pos();
}
-
- if (pbolt.target == pbolt.source)
- {
- pbolt.aimed_at_feet = true;
- pbolt.range = 0;
- }
}
bool monster_random_space(const monsters *monster, coord_def& target,