diff options
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 ae6c6c1f4b..3d5fe9d31e 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3599,6 +3599,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) @@ -3629,15 +3632,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) { @@ -3697,7 +3714,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 } @@ -3923,13 +3941,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) @@ -4896,6 +4918,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.", @@ -4978,6 +5015,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 @@ -5158,9 +5197,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 |