From 37ffd29a84d48b08c2ef799a271f3ab83202a03a Mon Sep 17 00:00:00 2001 From: dolorous Date: Sat, 1 Dec 2007 18:30:23 +0000 Subject: Add one more cleanup of protection from harm. Since there's more than one type of it now, expand god_protects_from_harm() to include the logic for when certain gods do it. Also, as brought up on crawl-ref-discuss, make Elyvilon do it both casually and during prayer. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2959 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/describe.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'crawl-ref/source/describe.cc') diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 87e2f4991b..c3b3a9f301 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -4276,23 +4276,27 @@ void describe_god( god_type which_god, bool give_title ) textcolor(colour); // mv: some gods can protect you from harm - // The chance for doing so is: - // one_chance_in(10) || you.piety > random2(1000) - // Note that it's not depending on penance. - // Btw. I'm not sure how to explain such divine protection - // because god isn't really protecting player - he only sometimes - // saves his life (probably it shouldn't be displayed at all). + // I'm not sure how to explain such divine protection because + // god isn't really protecting player - he only sometimes saves + // his life (probably it shouldn't be displayed at all). // What about this? bool have_any = false; - if (god_protects_from_harm(which_god)) + if (harm_protection_type hpt = + god_protects_from_harm(which_god, false)) { + const char *how = (you.piety >= 150) ? "carefully" : + (you.piety >= 90) ? "often" : + (you.piety >= 30) ? "sometimes" : + "occasionally"; + const char *when = + (hpt == HPT_PRAYING) ? " during prayer" : + (hpt == HPT_PRAYING_PLUS_ANYTIME) ? ", especially during prayer" : + ""; + have_any = true; - cprintf( "%s %s watches over you." EOL, god_name(which_god), - (you.piety >= 150) ? "carefully": - (you.piety >= 90) ? "often" : - (you.piety >= 30) ? "sometimes" : - "occasionally"); + cprintf( "%s %s watches over you%s." EOL, god_name(which_god), + how, when ); } if (which_god == GOD_ZIN && you.piety >= 30) -- cgit v1.2.3-54-g00ecf