diff options
author | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-11 17:12:07 +0530 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-11 17:12:07 +0530 |
commit | 40b5e8b46a50b9f3f23099983f3799534ff7e211 (patch) | |
tree | 088420d917e2d3bd1089f16bff71617b03653aca /crawl-ref/source/religion.cc | |
parent | 577f5d3f5ae46c69a2064405db110d6988a5c9a4 (diff) | |
parent | 00abd7f656ea920f8d69d57de0d5f2ecfd9a8f3a (diff) | |
download | crawl-ref-40b5e8b46a50b9f3f23099983f3799534ff7e211.tar.gz crawl-ref-40b5e8b46a50b9f3f23099983f3799534ff7e211.zip |
Merge branch 'amulet-refactoring'
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r-- | crawl-ref/source/religion.cc | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index aba33ed8b4..0c79623409 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3603,6 +3603,9 @@ static void _dock_piety(int piety_loss, int penance) if (piety_loss <= 0 && penance <= 0) return; + piety_loss = piety_scale(piety_loss); + penance = piety_scale(penance); + if (piety_loss) { if (last_piety_lecture != you.num_turns) @@ -3633,15 +3636,29 @@ static void _dock_piety(int piety_loss, int penance) } } -void gain_piety(int pgn) +// Scales a piety number, applying boosters (amulet of faith). +int piety_scale(int piety) { - if (pgn <= 0) + if (piety < 0) + return (-piety_scale(-piety)); + + if (wearing_amulet(AMU_FAITH)) + return (piety + div_rand_round(piety, 3)); + + return (piety); +} + +void gain_piety(int original_gain) +{ + if (original_gain <= 0) return; // Xom uses piety differently... if (you.religion == GOD_NO_GOD || you.religion == GOD_XOM) return; + int pgn = piety_scale(original_gain); + // check to see if we owe anything first if (you.penance[you.religion] > 0) { @@ -3701,7 +3718,8 @@ void gain_piety(int pgn) #if DEBUG_PIETY mprf(MSGCH_DIAGNOSTICS, "Piety increasing by %d (and %d taken from " - "hysteresis)", pgn, pgn_borrowed); + "hysteresis, %d original)", + pgn, pgn_borrowed, original_gain); #endif } @@ -3927,13 +3945,17 @@ void lose_piety(int pgn) redraw_skill(you.your_name, player_title()); if (you.religion == GOD_ZIN) - simple_god_message(" is no longer ready to cure all your mutations."); + simple_god_message( + " is no longer ready to cure all your mutations."); else if (you.religion == GOD_SHINING_ONE) - simple_god_message(" is no longer ready to bless your weapon."); + simple_god_message( + " is no longer ready to bless your weapon."); else if (you.religion == GOD_KIKUBAAQUDGHA) - simple_god_message(" is no longer ready to enhance your necromancy."); + simple_god_message( + " is no longer ready to enhance your necromancy."); else if (you.religion == GOD_LUGONU) - simple_god_message(" is no longer ready to corrupt your weapon."); + simple_god_message( + " is no longer ready to corrupt your weapon."); } for (int i = 0; i < MAX_GOD_ABILITIES; ++i) @@ -4900,6 +4922,21 @@ bool player_can_join_god(god_type which_god) return (true); } +// Identify any interesting equipment when the player signs up with a +// new Service Pro^W^Wdeity. +void god_welcome_identify_gear() +{ + // Check for amulets of faith. + item_def *amulet = you.slot_item(EQ_AMULET); + if (amulet && amulet->sub_type == AMU_FAITH) + { + // The flash happens independent of item id. + mpr("Your amulet flashes!", MSGCH_GOD); + flash_view_delay(god_colour(you.religion), 300); + set_ident_type(*amulet, ID_KNOWN_TYPE); + } +} + void god_pitch(god_type which_god) { mprf("You %s the altar of %s.", @@ -4982,6 +5019,8 @@ void god_pitch(god_type which_god) you.worshipped[which_god] ? " back" : "").c_str()); more(); + god_welcome_identify_gear(); + // When you start worshipping a good god, you make all non-hostile // unholy and evil beings hostile; when you start worshipping Zin, // you make all non-hostile unclean and chaotic beings hostile; and @@ -5162,9 +5201,10 @@ harm_protection_type god_protects_from_harm(god_type god, bool actual) { const int min_piety = piety_breakpoint(0); bool praying = (you.duration[DUR_PRAYER] - && random2(you.piety) >= min_piety); + && random2(piety_scale(you.piety)) >= min_piety); bool reliable = (you.piety > 130); - bool anytime = (one_chance_in(10) || x_chance_in_y(you.piety, 1000)); + bool anytime = (one_chance_in(10) || + x_chance_in_y(piety_scale(you.piety), 1000)); bool penance = (you.penance[god] > 0); // If actual is true, return HPT_NONE if the given god can protect |