From 778880771386e5f111aca28d397c5d32f3e7dca0 Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 15 May 2007 17:02:30 +0000 Subject: Nemelexites now require confirmation before offering runes, orbs, or objects marked with !p (or !*) on a non-altar square. Nothing gets offered unless the player OKs everything, so inscribing a couple of items in your stash with !p should be enough paranoia. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1476 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/religion.cc | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/religion.cc') diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index a1d7f0ff31..8701400c2a 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -41,6 +41,7 @@ #include "describe.h" #include "effects.h" #include "food.h" +#include "invent.h" #include "it_use2.h" #include "itemname.h" #include "itemprop.h" @@ -599,6 +600,30 @@ static void do_god_gift() } // end of gift giving } +static bool is_risky_sacrifice(const item_def& item) +{ + return item.base_type == OBJ_ORBS || is_rune(item); +} + +static bool confirm_pray_sacrifice() +{ + for ( int i = igrd[you.x_pos][you.y_pos]; i != NON_ITEM; + i = mitm[i].link ) + { + const item_def& item = mitm[i]; + if ( is_risky_sacrifice(item) || + has_warning_inscription(item, OPER_PRAY) ) + { + std::string prompt = "Really sacrifice "; + prompt += item.name(DESC_NOCAP_A); + prompt += '?'; + if ( !yesno(prompt.c_str(), false, 'n') ) + return false; + } + } + return true; +} + std::string god_prayer_reaction() { std::string result; @@ -683,9 +708,15 @@ void pray() return; } + // Nemelexites can abort out now instead of offering something + // they don't want to lose + if ( you.religion == GOD_NEMELEX_XOBEH && altar_god == GOD_NO_GOD && + !confirm_pray_sacrifice() ) + return; + mprf(MSGCH_PRAY, "You offer a prayer to %s.", god_name(you.religion)); - // Nemelexites can offer everywhere + // ...otherwise, they offer what they're standing on if ( you.religion == GOD_NEMELEX_XOBEH && altar_god == GOD_NO_GOD ) offer_items(); @@ -2498,7 +2529,7 @@ void offer_items() { if (you.religion == GOD_NO_GOD) return; - + int i = igrd[you.x_pos][you.y_pos]; while (i != NON_ITEM) { -- cgit v1.2.3-54-g00ecf