summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorSage <SageBasilMint@gmail.com>2014-01-30 05:40:36 +0000
committerPekka Lampila <pekka.lampila@iki.fi>2014-01-30 11:10:22 +0200
commit140b27ce5d3e7d3365842c15262849edea093d52 (patch)
tree99f3662850e66ac3ad865875325482b2563b73bd /crawl-ref/source/misc.cc
parent4067f67b76575fa46cda5a7ae5f99f3278323d2d (diff)
downloadcrawl-ref-140b27ce5d3e7d3365842c15262849edea093d52.tar.gz
crawl-ref-140b27ce5d3e7d3365842c15262849edea093d52.zip
Make warnings against penance-causing attacks more prominent.
The prompt to hit an enslaved creature differs very little regardless of your god, even if it would cause penance with that god. This patch makes such attacks require yes_or_no like walking into a Zot trap instead of yesno, and explicitly states that it will cause penance with your god. For reference, only betrayal attacks under Okawaru and the good gods, attacking neutral creatures under Elyvilon or TSO, unchivalric attacks under TSO, and plant betrayal under Fedhas is affected; attacks with brands offensive to your god are not, and neither are attacks which only cause piety loss.
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc68
1 files changed, 52 insertions, 16 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 4ed88bd952..1de0372c97 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -2197,7 +2197,8 @@ int speed_to_duration(int speed)
}
bool bad_attack(const monster *mon, string& adj, string& suffix,
- coord_def attack_pos, bool check_landing_only)
+ bool& would_cause_penance, coord_def attack_pos,
+ bool check_landing_only)
{
ASSERT(!crawl_state.game_is_arena());
bool bad_landing = false;
@@ -2210,6 +2211,7 @@ bool bad_attack(const monster *mon, string& adj, string& suffix,
adj.clear();
suffix.clear();
+ would_cause_penance = false;
if (!check_landing_only
&& (is_sanctuary(mon->pos()) || is_sanctuary(attack_pos)))
@@ -2224,6 +2226,13 @@ bool bad_attack(const monster *mon, string& adj, string& suffix,
if (check_landing_only)
return bad_landing;
+ if (you_worship(GOD_JIYVA) && mons_is_slime(mon)
+ && !(mon->is_shapeshifter() && (mon->flags & MF_KNOWN_SHIFTER)))
+ {
+ would_cause_penance = true;
+ return true;
+ }
+
if (mon->friendly())
{
if (you_worship(GOD_OKAWARU))
@@ -2233,9 +2242,18 @@ 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;
+ }
+ }
return true;
}
@@ -2244,17 +2262,22 @@ bool bad_attack(const monster *mon, string& adj, string& suffix,
&& !tso_unchivalric_attack_safe_monster(mon))
{
adj += "helpless ";
+ would_cause_penance = true;
}
+
if (mon->neutral() && is_good_god(you.religion))
+ {
adj += "neutral ";
+ if (you_worship(GOD_SHINING_ONE) || you_worship(GOD_ELYVILON))
+ would_cause_penance = true;
+ }
else if (mon->wont_attack())
- adj += "non-hostile ";
-
- if (you_worship(GOD_JIYVA) && mons_is_slime(mon)
- && !(mon->is_shapeshifter() && (mon->flags & MF_KNOWN_SHIFTER)))
{
- return true;
+ adj += "non-hostile ";
+ if (you_worship(GOD_SHINING_ONE) || you_worship(GOD_ELYVILON))
+ would_cause_penance = true;
}
+
return !adj.empty() || !suffix.empty();
}
@@ -2263,6 +2286,8 @@ bool stop_attack_prompt(const monster* mon, bool beam_attack,
bool *prompted, coord_def attack_pos,
bool check_landing_only)
{
+ bool penance = false;
+
if (prompted)
*prompted = false;
@@ -2273,7 +2298,7 @@ bool stop_attack_prompt(const monster* mon, bool beam_attack,
return false;
string adj, suffix;
- if (!bad_attack(mon, adj, suffix, attack_pos, check_landing_only))
+ if (!bad_attack(mon, adj, suffix, penance, attack_pos, check_landing_only))
return false;
// Listed in the form: "your rat", "Blork the orc".
@@ -2304,13 +2329,16 @@ bool stop_attack_prompt(const monster* mon, bool beam_attack,
else
verb = "attack ";
- snprintf(info, INFO_SIZE, "Really %s%s%s?",
- verb.c_str(), mon_name.c_str(), suffix.c_str());
+ snprintf(info, INFO_SIZE, "Really %s%s%s?%s",
+ verb.c_str(), mon_name.c_str(), suffix.c_str(),
+ penance ? " This attack would place you under penance!" : "");
if (prompted)
*prompted = true;
- if (yesno(info, false, 'n'))
+ if (penance && yes_or_no("%s", info))
+ return false;
+ else if (!penance && yesno(info, false, 'n'))
return false;
else
{
@@ -2332,6 +2360,7 @@ bool stop_attack_prompt(targetter &hitfunc, const char* verb,
return false;
string adj, suffix;
+ bool penance = false;
counted_monster_list victims;
for (distance_iterator di(hitfunc.origin, false, true, LOS_RADIUS); di; ++di)
{
@@ -2343,10 +2372,13 @@ bool stop_attack_prompt(targetter &hitfunc, const char* verb,
if (affects && !affects(mon))
continue;
string adjn, suffixn;
- if (bad_attack(mon, adjn, suffixn))
+ bool penancen = false;
+ if (bad_attack(mon, adjn, suffixn, penancen))
{
- if (victims.empty()) // record the adjectives for the first listed
- adj = adjn, suffix = suffixn;
+ // record the adjectives for the first listed, or
+ // first that would cause penance
+ if (victims.empty() || penancen && !penance)
+ adj = adjn, suffix = suffixn, penance = penancen;
victims.add(mon);
}
}
@@ -2362,12 +2394,16 @@ bool stop_attack_prompt(targetter &hitfunc, const char* verb,
adj = "the " + adj;
mon_name = adj + mon_name;
- snprintf(info, INFO_SIZE, "Really %s %s%s?",
- verb, mon_name.c_str(), suffix.c_str());
+ snprintf(info, INFO_SIZE, "Really %s %s%s?%s",
+ verb, mon_name.c_str(), suffix.c_str(),
+ penance ? " This attack would place you under penance!" : "");
if (prompted)
*prompted = true;
- if (yesno(info, false, 'n'))
+
+ if (penance && yes_or_no("%s", info))
+ return false;
+ else if (!penance && yesno(info, false, 'n'))
return false;
else
{