From 4f153c59882bb115f43a677a85c9448dc0dafa8e Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Thu, 24 Sep 2009 13:56:29 -0500 Subject: Various religion-related fixes: Update the player's title when gaining or losing piety or penance, so that Invocations-based titles are handled properly; don't display Zin's message about mutagenic glow if the player isn't glowing; and have Zin treat all chaotic spells consistently. --- crawl-ref/source/debug.cc | 4 +-- crawl-ref/source/describe.cc | 1 + crawl-ref/source/output.cc | 2 +- crawl-ref/source/religion.cc | 84 ++++++++++++++++++++++++++++++++++---------- crawl-ref/source/skills.cc | 2 +- crawl-ref/source/spl-cast.cc | 5 ++- 6 files changed, 74 insertions(+), 24 deletions(-) diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index c008f5c1fa..41c46c1d55 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -3781,7 +3781,7 @@ void wizard_set_skill_level(void) calc_total_skill_points(); - redraw_skill( you.your_name, player_title() ); + redraw_skill(you.your_name, player_title()); switch (skill) { @@ -3851,7 +3851,7 @@ void wizard_set_all_skills(void) you.skills[i] = amount; } - redraw_skill( you.your_name, player_title() ); + redraw_skill(you.your_name, player_title()); calc_total_skill_points(); diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 4ac11ea4e9..2704a620b7 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -3764,6 +3764,7 @@ std::string get_skill_description(int skill, bool need_title) } break; } + case SK_INVOCATIONS: if (you.species == SP_DEMIGOD) { diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 759a08019a..d2215e893b 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1046,7 +1046,7 @@ void draw_border(void) { textcolor(HUD_CAPTION_COLOUR); clrscr(); - redraw_skill( you.your_name, player_title() ); + redraw_skill(you.your_name, player_title()); textcolor(Options.status_caption_colour); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 1f92826877..f32c5cea4d 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -822,7 +822,7 @@ std::string get_god_dislikes(god_type which_god, bool /*verbose*/) dislikes.push_back("you deliberately mutate yourself"); dislikes.push_back("you polymorph monsters"); dislikes.push_back("you eat the flesh of sentient beings"); - dislikes.push_back("you use weapons or missiles of chaos"); + dislikes.push_back("you use chaotic magic or items"); break; case GOD_SHINING_ONE: @@ -871,6 +871,9 @@ std::string get_god_dislikes(god_type which_god, bool /*verbose*/) void dec_penance(god_type god, int val) { + if (val <= 0) + return; + if (you.penance[god] > 0) { #if DEBUG_PIETY @@ -897,16 +900,22 @@ void dec_penance(god_type god, int val) take_note(Note(NOTE_MOLLIFY_GOD, god)); - // TSO's halo is once more available. - if (god == GOD_SHINING_ONE && you.religion == god - && you.piety >= piety_breakpoint(0)) + if (you.religion == god) { - mpr("Your divine halo returns!"); + // In case the best skill is Invocations, redraw the god + // title. + redraw_skill(you.your_name, player_title()); } // Orcish bonuses are now once more effective. if (god == GOD_BEOGH && you.religion == god) you.redraw_armour_class = true; + // TSO's halo is once more available. + else if (god == GOD_SHINING_ONE && you.religion == god + && you.piety >= piety_breakpoint(0)) + { + mpr("Your divine halo returns!"); + } // When you've worked through all your penance, you get // another chance to make hostile holy beings good neutral. @@ -1019,15 +1028,27 @@ bool remove_all_jiyva_altars() static void _inc_penance(god_type god, int val) { - if (you.penance[god] == 0 && val > 0) + if (val <= 0) + return; + + if (you.penance[god] == 0) { god_acting gdact(god, true); take_note(Note(NOTE_PENANCE, god)); + you.penance[god] += val; + you.penance[god] = std::min(MAX_PENANCE, + you.penance[god]); + // Orcish bonuses don't apply under penance. if (god == GOD_BEOGH) + { you.redraw_armour_class = true; + + if (_need_water_walking() && !beogh_water_walk()) + fall_into_a_pool(you.pos(), true, grd(you.pos())); + } // Neither does Trog's regeneration or magic resistance. else if (god == GOD_TROG) { @@ -1059,13 +1080,20 @@ static void _inc_penance(god_type god, int val) if (you.duration[DUR_DIVINE_VIGOUR]) remove_divine_vigour(); } - } - - you.penance[god] += val; - you.penance[god] = std::min(MAX_PENANCE, you.penance[god]); - if (god == GOD_BEOGH && _need_water_walking() && !beogh_water_walk()) - fall_into_a_pool( you.pos(), true, grd(you.pos()) ); + if (you.religion == god) + { + // In case the best skill is Invocations, redraw the god + // title. + redraw_skill(you.your_name, player_title()); + } + } + else + { + you.penance[god] += val; + you.penance[god] = std::min(MAX_PENANCE, + you.penance[god]); + } } static void _inc_penance(int val) @@ -3373,7 +3401,8 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, "act, just this once."); break; } - else + + if (thing_done == DID_CAUSE_GLOWING) { static long last_glowing_lecture = -1L; if (last_glowing_lecture != you.num_turns) @@ -3383,6 +3412,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, last_glowing_lecture = you.num_turns; } } + piety_change = -level; retval = true; } @@ -3582,15 +3612,15 @@ static void _dock_piety(int piety_loss, int penance) if (last_piety_lecture != you.num_turns) { // output guilt message: - mprf( "You feel%sguilty.", - (piety_loss == 1) ? " a little " : - (piety_loss < 5) ? " " : - (piety_loss < 10) ? " very " - : " extremely " ); + mprf("You feel%sguilty.", + (piety_loss == 1) ? " a little " : + (piety_loss < 5) ? " " : + (piety_loss < 10) ? " very " + : " extremely "); } last_piety_lecture = you.num_turns; - lose_piety( piety_loss ); + lose_piety(piety_loss); } if (you.piety < 1) @@ -3691,6 +3721,10 @@ void gain_piety(int pgn) { take_note(Note(NOTE_GOD_POWER, you.religion, i)); + // In case the best skill is Invocations, redraw the god + // title. + redraw_skill(you.your_name, player_title()); + const char* pmsg = god_gain_power_messages[you.religion][i]; const char first = pmsg[0]; @@ -3728,6 +3762,9 @@ void gain_piety(int pgn) if (you.piety > 160 && old_piety <= 160) { + // In case the best skill is Invocations, redraw the god title. + redraw_skill(you.your_name, player_title()); + if (!you.num_gifts[you.religion]) { if (you.religion == GOD_ZIN) @@ -4449,6 +4486,10 @@ void lose_piety(int pgn) if (you.piety <= 160 && old_piety > 160 && !you.num_gifts[you.religion]) { + // In case the best skill is Invocations, redraw the god + // title. + redraw_skill(you.your_name, player_title()); + if (you.religion == GOD_ZIN) simple_god_message(" is no longer ready to cure all your mutations."); else if (you.religion == GOD_SHINING_ONE @@ -4463,6 +4504,10 @@ void lose_piety(int pgn) if (you.piety < piety_breakpoint(i) && old_piety >= piety_breakpoint(i)) { + // In case the best skill is Invocations, redraw the god + // title. + redraw_skill(you.your_name, player_title()); + const char* pmsg = god_lose_power_messages[you.religion][i]; const char first = pmsg[0]; @@ -6588,6 +6633,7 @@ void excommunication(god_type new_god) you.religion = GOD_NO_GOD; you.piety = 0; you.piety_hysteresis = 0; + redraw_skill(you.your_name, player_title()); mpr("You have lost your religion!"); diff --git a/crawl-ref/source/skills.cc b/crawl-ref/source/skills.cc index 674cb0551d..2c7ef5e7ab 100644 --- a/crawl-ref/source/skills.cc +++ b/crawl-ref/source/skills.cc @@ -450,7 +450,7 @@ static int _exercise2(int exsk) } if (best != old_best_skill || old_best_skill == exsk) - redraw_skill( you.your_name, player_title() ); + redraw_skill(you.your_name, player_title()); if (you.weapon() && item_is_staff( *you.weapon() )) maybe_identify_staff(*you.weapon()); diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index f436f3c059..1bf3891cb3 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -939,7 +939,7 @@ static void _spellcasting_side_effects(spell_type spell, bool idonly = false) if (!_spell_is_utility_spell(spell) && !crawl_state.is_god_acting()) did_god_conduct(DID_SPELL_NONUTILITY, 10 + spell_difficulty(spell)); - if (spell_typematch(spell, SPTYP_HOLY)) + if (is_holy_spell(spell)) did_god_conduct(DID_HOLY, 10 + spell_difficulty(spell)); // Self-banishment gets a special exemption - you're there to spread @@ -951,6 +951,9 @@ static void _spellcasting_side_effects(spell_type spell, bool idonly = false) did_god_conduct(DID_UNHOLY, 10 + spell_difficulty(spell)); } + if (is_chaotic_spell(spell)) + did_god_conduct(DID_CHAOS, 10 + spell_difficulty(spell)); + // Linley says: Condensation Shield needs some disadvantages to keep // it from being a no-brainer... this isn't much, but its a start -- bwr if (spell_typematch(spell, SPTYP_FIRE)) -- cgit v1.2.3-54-g00ecf