diff options
-rw-r--r-- | crawl-ref/source/enum.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/invent.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/invent.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/items.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 35 |
5 files changed, 38 insertions, 4 deletions
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 7b0caa19c0..fd62ec96ba 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -2669,6 +2669,7 @@ enum operation_types OPER_THROW = 't', OPER_EXAMINE = 'v', OPER_FIRE = 'f', + OPER_PRAY = 'p', OPER_ANY = 0 }; diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 17f6ad4581..d45051a80d 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -740,8 +740,8 @@ static int digit_to_index( char digit, operation_types oper ) { return -1; } -static bool has_warning_inscription(const item_def& item, - operation_types oper) +bool has_warning_inscription(const item_def& item, + operation_types oper) { const char iletter = static_cast<char>(oper); diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h index 46384eeec3..882b340a25 100644 --- a/crawl-ref/source/invent.h +++ b/crawl-ref/source/invent.h @@ -185,5 +185,6 @@ bool in_inventory(const item_def &i); std::string item_class_name(int type, bool terse = false); bool check_warning_inscriptions(const item_def& item, operation_types oper); +bool has_warning_inscription(const item_def& item, operation_types oper); #endif diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h index 2c96eab936..fbcfe4339f 100644 --- a/crawl-ref/source/items.h +++ b/crawl-ref/source/items.h @@ -149,5 +149,6 @@ bool need_to_autopickup(); void autopickup(); int find_free_slot(const item_def &i); +bool is_rune(const item_def &item); #endif 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) { |