summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-30 04:06:15 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-30 04:06:15 +0000
commit79fa8defdabeb25d5edd3817b851b212e3a65ae7 (patch)
tree523e753eab80acaf39a85f5ce49b0ef90467987a /crawl-ref/source/fight.cc
parent3c944837cadcc17fe541fee23f6c25697694febf (diff)
downloadcrawl-ref-79fa8defdabeb25d5edd3817b851b212e3a65ae7.tar.gz
crawl-ref-79fa8defdabeb25d5edd3817b851b212e3a65ae7.zip
Don't count an attack as unchivalrous if the attacker can't see the defender,
which includes the defender being invisble, being behind opaque clouds, and being behind a wall when hit with an area attack. Before the code was only checking invisibility, which doesn't take into account LOS blocking things like opaque clouds and walls. Don't give a duplicate message when hitting a giant spore or ball lightning. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6239 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 6280043cdd..11102b8cd7 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -290,8 +290,9 @@ unchivalric_attack_type is_unchivalric_attack(const actor *attacker,
unchivalric_attack_type unchivalric = UCAT_NO_ATTACK;
// No unchivalric attacks on monsters that cannot fight (e.g.
- // plants) or invisible monsters.
- if (!defender->cannot_fight() && defender->visible_to(attacker))
+ // plants) or monsters the attacker can't see (either due to
+ // invisibility or being behind opaque clouds).
+ if (!defender->cannot_fight() && attacker->can_see(defender))
{
// Distracted (but not batty); this only applies to players.
if (attacker->atype() == ACT_PLAYER && def->foe != MHITYOU
@@ -2643,11 +2644,6 @@ bool melee_attack::player_check_monster_died()
player_monattk_hit_effects(true);
- if (def->type == MONS_GIANT_SPORE || def->type == MONS_BALL_LIGHTNING)
- {
- msg::stream << "You " << attack_verb << ' '
- << def->name(DESC_NOCAP_THE) << '.' << std::endl;
- }
monster_die(def, KILL_YOU, 0);
return (true);