summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorgammafunk <gammafunk@gmail.com>2014-02-17 21:36:59 -0600
committerPekka Lampila <pekka.lampila@iki.fi>2014-02-19 00:08:38 +0200
commit8afe6cab79eb3d08677824b9f11c572f52b14a81 (patch)
tree9c7fba43ece8893f612ff6c1a1e90e500d4c9e75 /crawl-ref/source/misc.cc
parent4592d88de27126115f0b8af45688d56e0dd41887 (diff)
downloadcrawl-ref-8afe6cab79eb3d08677824b9f11c572f52b14a81.tar.gz
crawl-ref-8afe6cab79eb3d08677824b9f11c572f52b14a81.zip
Fix to attack penance warnings.
Currently if you melee an "object" (according to mons_is_object()) such as a conjured ball lightning, you get a penance warning if worshiping TSO. This is a "bad attack" and should give a prompt, but will not cause penance. This commit fixes this by making the necessary call to god_hates_attacking_friend() to determine if penance would occur. This also fixes the case when you attack allies/followers under beogh, which currently doesn't give a penance warning (although it does give a bad attack warning). This commit also cleans up is_unchivalric_attack() so that attacking an object is not reported as unchivalric and attacking a friend that your god doesn't hate for you attack isn't reported as UCAT_ALLY. These seem to both be technicalities at this point, but they should avoid some confusion if conducts change or new gods appear.
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index f3fa7c61fc..550cedec55 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -2246,18 +2246,13 @@ bool bad_attack(const monster *mon, string& adj, string& suffix,
monster_info mi(mon, MILEV_NAME);
if (!mi.is(MB_NAME_UNQUALIFIED))
adj += "the ";
-
- would_cause_penance = true;
}
else
- {
adj = "your ";
- if (is_good_god(you.religion)
- || you_worship(GOD_FEDHAS) && fedhas_protects(mon))
- {
- would_cause_penance = true;
- }
- }
+
+ if (god_hates_attacking_friend(you.religion, mon))
+ would_cause_penance = true;
+
return true;
}