summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-10-06 22:27:07 -0400
committerCharles Otto <ottochar@gmail.com>2009-10-06 22:31:25 -0400
commitc2c25b5eaa191b0d26aee47359949093367154b9 (patch)
tree6ac6a73ff6053f17fce2e66e8e441978c2729d36 /crawl-ref
parent0e2154d50e2de944bb1495b6ad4a62112ee97f03 (diff)
downloadcrawl-ref-c2c25b5eaa191b0d26aee47359949093367154b9.tar.gz
crawl-ref-c2c25b5eaa191b0d26aee47359949093367154b9.zip
Implement FR 2872334 'don't auto-target neutrals' by replacing most uses of TARG_ENEMY with TARG_HOSTILE.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/abl-show.cc4
-rw-r--r--crawl-ref/source/decks.cc2
-rw-r--r--crawl-ref/source/directn.cc7
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/it_use3.cc2
-rw-r--r--crawl-ref/source/item_use.cc8
-rw-r--r--crawl-ref/source/spells2.cc2
-rw-r--r--crawl-ref/source/spl-cast.cc2
-rw-r--r--crawl-ref/source/spl-util.h2
9 files changed, 17 insertions, 14 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index d7f9e6c996..6ab2430a3e 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1304,8 +1304,8 @@ static bool _do_ability(const ability_def& abil)
const int pow = calc_spell_power(SPELL_DELAYED_FIREBALL, true);
const int fake_range = spell_range(SPELL_FIREBALL, pow, false);
- if (!spell_direction(spd, beam, DIR_NONE, TARG_ENEMY, fake_range))
- return (false);
+ if (!spell_direction(spd, beam, DIR_NONE, TARG_HOSTILE, fake_range))
+ return (false);
beam.range = spell_range(SPELL_FIREBALL, pow, true);
if (!fireball(pow, beam))
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index aec23dc2a0..190cf60ad3 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1801,7 +1801,7 @@ static bool _damaging_card(card_type card, int power, deck_rarity_type rarity)
bolt beam;
beam.range = LOS_RADIUS;
- if (spell_direction(target, beam, DIR_NONE, TARG_ENEMY,
+ if (spell_direction(target, beam, DIR_NONE, TARG_HOSTILE,
LOS_RADIUS, true, true, false, info)
&& player_tracer(ZAP_DEBUGGING_RAY, power/4, beam))
{
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 56258157f2..ed71bbebb1 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -419,7 +419,9 @@ static void _direction_again(dist& moves, targetting_type restricts,
moves.target = you.pos();
// Discard 'Y' player gave to yesno()
- if (mode == TARG_ENEMY)
+ // Changed this, was that necessary? -cao
+ //if (mode == TARG_ENEMY)
+ if (mode == TARG_ENEMY || mode == TARG_HOSTILE)
getchm();
}
else
@@ -932,7 +934,8 @@ bool _dist_ok(const dist& moves, int range, targ_mode_type mode,
return (false);
}
- if (!may_target_self && mode == TARG_ENEMY)
+ if (!may_target_self && (mode == TARG_ENEMY
+ || mode == TARG_HOSTILE))
{
if (Options.allow_self_target == CONFIRM_CANCEL)
{
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 51a8b8a3d7..1a87e9a86c 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2542,7 +2542,7 @@ void yell(bool force)
}
mpr("Gang up on whom?", MSGCH_PROMPT);
- direction(targ, DIR_TARGET, TARG_ENEMY, -1, false, false);
+ direction(targ, DIR_TARGET, TARG_HOSTILE, -1, false, false);
if (targ.isCancel)
{
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index 0df9d985a6..38944398e5 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -181,7 +181,7 @@ static bool _reaching_weapon_attack(const item_def& wpn)
mpr("Attack whom?", MSGCH_PROMPT);
- direction(beam, DIR_TARGET, TARG_ENEMY, 2);
+ direction(beam, DIR_TARGET, TARG_HOSTILE, 2);
if (!beam.isValid)
return (false);
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 052e126761..440728ac2f 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1337,7 +1337,7 @@ static bool _fire_choose_item_and_target(int& slot, dist& target,
// XXX: This stuff should be done by direction()!
message_current_target();
- direction( target, DIR_NONE, TARG_ENEMY, -1, false, !teleport, true, false,
+ direction( target, DIR_NONE, TARG_HOSTILE, -1, false, !teleport, true, false,
NULL, &beh );
if (beh.m_slot == -1)
@@ -2231,7 +2231,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
else
{
message_current_target();
- direction( thr, DIR_NONE, TARG_ENEMY );
+ direction( thr, DIR_NONE, TARG_HOSTILE);
if (!thr.isValid)
{
@@ -3864,7 +3864,7 @@ void zap_wand(int slot)
// Unless the character knows the type of the wand, the targetting
// system will default to enemies. -- [ds]
- targ_mode_type targ_mode = TARG_ENEMY;
+ targ_mode_type targ_mode = TARG_HOSTILE;
beam.obvious_effect = false;
@@ -3947,7 +3947,7 @@ void zap_wand(int slot)
break;
default:
- targ_mode = TARG_ENEMY;
+ targ_mode = TARG_HOSTILE;
break;
}
}
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index bb4402e9e8..83e14e2816 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1884,7 +1884,7 @@ bool sunlight()
bolt temp_bolt;
temp_bolt.colour = YELLOW;
- direction(spelld, DIR_TARGET, TARG_ENEMY, LOS_RADIUS, false, false,
+ direction(spelld, DIR_TARGET, TARG_HOSTILE, LOS_RADIUS, false, false,
false, true, "Select sunlight destination", NULL,
true);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 9c86bd0e9b..5add5f332e 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1175,7 +1175,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
if ((flags & SPFLAG_TARGETTING_MASK) && spell != SPELL_PORTAL_PROJECTILE)
{
targ_mode_type targ =
- (testbits(flags, SPFLAG_HELPFUL) ? TARG_FRIEND : TARG_ENEMY);
+ (testbits(flags, SPFLAG_HELPFUL) ? TARG_FRIEND : TARG_HOSTILE);
if (testbits(flags, SPFLAG_NEUTRAL))
targ = TARG_ANY;
diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h
index 4c33f33e82..6d0d66d980 100644
--- a/crawl-ref/source/spl-util.h
+++ b/crawl-ref/source/spl-util.h
@@ -109,7 +109,7 @@ void apply_area_cloud(cloud_func func, const coord_def& where,
bool spell_direction( dist &spelld, bolt &pbolt,
targetting_type restrict = DIR_NONE,
- targ_mode_type mode = TARG_ENEMY,
+ targ_mode_type mode = TARG_HOSTILE,
// pbolt.range if applicable, otherwise LOS_RADIUS
int range = 0,
bool needs_path = true, bool may_target_monster = true,