summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-03 04:18:19 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-03 04:18:19 +0000
commite94caba86d3bb7fdbddceb6ad74efabeff62227b (patch)
tree1bed6a755922a4304db6da403e08c30f7f76f08e /crawl-ref/source/fight.cc
parent6a881bdc1578691139dea30e8ed1fc3d6cac20b0 (diff)
downloadcrawl-ref-e94caba86d3bb7fdbddceb6ad74efabeff62227b.tar.gz
crawl-ref-e94caba86d3bb7fdbddceb6ad74efabeff62227b.zip
Disallow unchivalric spell attacks from daevas.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5449 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 6b50831e1e..21fdbe32e9 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -291,11 +291,14 @@ unchivalric_attack_type is_unchivalric_attack(const actor *attacker,
// no unchivalric attacks on monsters that cannot fight (e.g.
// plants) or invisible monsters
- if (!defender->cannot_fight() && player_monster_visible(def))
+ if (!defender->cannot_fight() && defender->visible_to(attacker))
{
- // distracted (but not batty)
- if (def->foe != MHITYOU && !testbits(def->flags, MF_BATTY))
+ // distracted (but not batty); this only applies to players
+ if (attacker->atype() == ACT_PLAYER && def->foe != MHITYOU
+ && !testbits(def->flags, MF_BATTY))
+ {
unchivalric = UCAT_DISTRACTED;
+ }
// confused (but not perma-confused)
if (def->has_ench(ENCH_CONFUSION)
@@ -309,7 +312,7 @@ unchivalric_attack_type is_unchivalric_attack(const actor *attacker,
unchivalric = UCAT_FLEEING;
// invisible
- if (attacker->invisible() && !defender->can_see_invisible())
+ if (!attacker->visible_to(defender))
unchivalric = UCAT_INVISIBLE;
// held in a net
@@ -1198,7 +1201,7 @@ bool melee_attack::player_apply_aux_unarmed()
mprf("You %s %s%s.",
unarmed_attack.c_str(),
defender->name(DESC_NOCAP_THE).c_str(),
- player_monster_visible(def)?
+ player_monster_visible(def) ?
", but do no damage" : "");
}
@@ -1243,7 +1246,7 @@ std::string melee_attack::attack_strength_punctuation()
}
else
{
- return (damage_done < HIT_WEAK? "." : "!");
+ return (damage_done < HIT_WEAK ? "." : "!");
}
}