diff options
-rw-r--r-- | crawl-ref/source/main.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 37 | ||||
-rw-r--r-- | crawl-ref/source/religion.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/wiz-you.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/wiz-you.h | 1 |
5 files changed, 32 insertions, 19 deletions
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index bd226dc7d8..b88c8d6862 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -542,6 +542,7 @@ static void _do_wizard_command(int wiz_command, bool silent_fail) case '@': wizard_set_stats(); break; case '^': wizard_gain_piety(); break; case '_': wizard_get_religion(); break; + case '-': wizard_get_god_gift(); break; case '\'': wizard_list_items(); break; case 'd': wizard_level_travel(true); break; case 'D': wizard_detect_creatures(); break; diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 0c79623409..c7796a09d8 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -1169,13 +1169,13 @@ static const item_def* _find_missile_launcher(int skill) return (NULL); } -static bool _need_missile_gift() +static bool _need_missile_gift(bool forced) { const int best_missile_skill = best_skill(SK_SLINGS, SK_THROWING); const item_def *launcher = _find_missile_launcher(best_missile_skill); - return (you.piety > 80 + return ((you.piety > 80 && random2( you.piety ) > 70 - && one_chance_in(8) + && one_chance_in(8) || forced) && you.skills[ best_missile_skill ] >= 8 && (launcher || best_missile_skill == SK_THROWING)); } @@ -1260,13 +1260,13 @@ static void _show_pure_deck_chances() } #endif -static void _give_nemelex_gift() +static void _give_nemelex_gift(bool forced = false) { // Nemelex will give at least one gift early. if (!you.num_gifts[GOD_NEMELEX_XOBEH] && x_chance_in_y(you.piety + 1, piety_breakpoint(1)) || one_chance_in(3) && x_chance_in_y(you.piety + 1, MAX_PIETY) - && !you.attribute[ATTR_CARD_COUNTDOWN]) + && !you.attribute[ATTR_CARD_COUNTDOWN] || forced) { misc_item_type gift_type; @@ -1995,7 +1995,7 @@ static void _delayed_gift_callback(const mgen_data &mg, int &midx, take_note(Note(NOTE_GOD_GIFT, you.religion)); } -static void _do_god_gift(bool prayed_for) +void do_god_gift(bool prayed_for, bool forced) { ASSERT(you.religion != GOD_NO_GOD); @@ -2013,7 +2013,8 @@ static void _do_god_gift(bool prayed_for) // Consider a gift if we don't have a timeout and weren't already // praying when we prayed. if (!player_under_penance() && !you.gift_timeout - || (prayed_for && you.religion == GOD_ZIN || you.religion == GOD_JIYVA)) + || (prayed_for && you.religion == GOD_ZIN || you.religion == GOD_JIYVA) + || forced) { bool success = false; @@ -2035,13 +2036,13 @@ static void _do_god_gift(bool prayed_for) break; case GOD_NEMELEX_XOBEH: - _give_nemelex_gift(); + _give_nemelex_gift(forced); break; case GOD_OKAWARU: case GOD_TROG: - if (you.piety > 130 - && random2(you.piety) > 120 + if ((you.piety > 130 + && random2(you.piety) > 120 || forced) && one_chance_in(4)) { if (you.religion == GOD_TROG @@ -2069,7 +2070,7 @@ static void _do_god_gift(bool prayed_for) break; } - if (_need_missile_gift()) + if (_need_missile_gift(forced)) { success = acquirement(OBJ_MISSILES, you.religion); if (success) @@ -2086,7 +2087,7 @@ static void _do_god_gift(bool prayed_for) break; case GOD_YREDELEMNUL: - if (random2(you.piety) >= piety_breakpoint(2) && one_chance_in(4)) + if (random2(you.piety) >= piety_breakpoint(2) && one_chance_in(4) || forced) { // The maximum threshold occurs at piety_breakpoint(5). int threshold = (you.piety - piety_breakpoint(2)) * 20 / 9; @@ -2098,7 +2099,7 @@ static void _do_god_gift(bool prayed_for) break; case GOD_JIYVA: - if (prayed_for && jiyva_grant_jelly()) + if (prayed_for && jiyva_grant_jelly() || forced) { int jelly_count = 0; for (radius_iterator ri(you.pos(), 9); ri; ++ri) @@ -2164,7 +2165,7 @@ static void _do_god_gift(bool prayed_for) && !you.had_book[BOOK_UNLIFE]) gift = BOOK_UNLIFE; } - else if (you.piety > 160 && random2(you.piety) > 100) + else if (you.piety > 160 && random2(you.piety) > 100 || forced) { if (you.religion == GOD_SIF_MUNA) gift = OBJ_RANDOM; @@ -2462,7 +2463,7 @@ void pray() } if (!was_praying) - _do_god_gift(true); + do_god_gift(true); dprf("piety: %d (-%d)", you.piety, you.piety_hysteresis ); } @@ -3690,7 +3691,7 @@ void gain_piety(int original_gain) || you.piety > 150 && one_chance_in(3) || you.piety > 100 && one_chance_in(3)) { - _do_god_gift(false); + do_god_gift(); return; } } @@ -3701,7 +3702,7 @@ void gain_piety(int original_gain) if (you.piety >= MAX_PIETY || you.piety > 150 && one_chance_in(5)) { - _do_god_gift(false); + do_god_gift(); return; } } @@ -3796,7 +3797,7 @@ void gain_piety(int original_gain) holy_beings_attitude_change(); } - _do_god_gift(false); + do_god_gift(); } // Is the destroyed weapon valuable enough to gain piety by doing so? diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index 36b09e4f5c..e5122ee2d1 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -135,5 +135,7 @@ void religion_turn_end(); int get_tension(god_type god = you.religion, bool count_travelling = true); +void do_god_gift(bool prayed_for = false, bool force = false); + std::vector<god_type> temple_god_list(); #endif diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc index dfc4d32fbb..df00ce13ab 100644 --- a/crawl-ref/source/wiz-you.cc +++ b/crawl-ref/source/wiz-you.cc @@ -881,5 +881,13 @@ void wizard_set_xl() debug_uptick_xl(newxl); } +void wizard_get_god_gift (void) +{ + if (you.religion == GOD_NO_GOD) + { + mpr("You are not religious!"); + return; + } - + do_god_gift(false, true); +} diff --git a/crawl-ref/source/wiz-you.h b/crawl-ref/source/wiz-you.h index 57696c3049..b7a3b6eb7f 100644 --- a/crawl-ref/source/wiz-you.h +++ b/crawl-ref/source/wiz-you.h @@ -21,5 +21,6 @@ bool wizard_add_mutation(); void wizard_get_religion( void ); void wizard_set_stats( void ); void wizard_edit_durations( void ); +void wizard_get_god_gift (); #endif |