From c06d8ce894ed2758dae28915b53ce3d905ef2abc Mon Sep 17 00:00:00 2001 From: dshaligram Date: Fri, 10 Aug 2007 19:28:32 +0000 Subject: God gifts were broken for Nemelex, Zin, and Yredelemnul, fixed (thanks, cbus). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1988 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/religion.cc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 5e4833204e..5d11f80aa5 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -434,11 +434,15 @@ static bool need_missile_gift() && ammo_count(launcher) < 20 + random2(35)); } -static void do_god_gift() +static void do_god_gift(bool prayed_for) { + // Zin worshippers are the only ones that can pray to ask Zin for stuff. + if (prayed_for != (you.religion == GOD_ZIN)) + return; + // Consider a gift if we don't have a timeout and weren't // already praying when we prayed. - if (!you.penance[you.religion] + if (!player_under_penance() && (!you.gift_timeout || you.religion == GOD_ZIN)) { bool success = false; @@ -576,7 +580,8 @@ static void do_god_gift() int thing_called = random_undead_servant(GOD_YREDELEMNUL); if (create_monster( thing_called, 0, BEH_FRIENDLY, you.x_pos, you.y_pos, - you.pet_target, MAKE_ITEM_RANDOM_RACE ) != -1) + you.pet_target, MAKE_ITEM_RANDOM_RACE ) + != -1) { simple_god_message(" grants you an undead servant!"); more(); @@ -731,6 +736,7 @@ void pray() // almost all prayers take time you.turn_is_over = true; + const bool was_praying = you.duration[DUR_PRAYER]; if (you.duration[DUR_PRAYER]) { if ( yesno("Do you want to stop praying?", true, 'y') ) @@ -811,6 +817,9 @@ void pray() you.duration[DUR_PRAYER] *= 2; } + if (!was_praying) + do_god_gift(true); + #if DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "piety: %d", you.piety ); #endif @@ -1429,8 +1438,7 @@ void gain_piety(int pgn) || (you.piety > 150 && one_chance_in(3)) || (you.piety > 100 && one_chance_in(3))) { - if (you.piety > 150) - do_god_gift(); + do_god_gift(false); return; } } @@ -1441,7 +1449,7 @@ void gain_piety(int pgn) if ((you.piety > 199) || (you.piety > 150 && one_chance_in(5))) { - do_god_gift(); + do_god_gift(false); return; } } @@ -1483,8 +1491,7 @@ void gain_piety(int pgn) you.religion == GOD_LUGONU) && you.num_gifts[you.religion] == 0 ) simple_god_message( " will now bless your weapon at an altar...once."); - if (you.religion == GOD_SIF_MUNA) - do_god_gift(); + do_god_gift(false); } bool beogh_water_walk() -- cgit v1.2.3-54-g00ecf