diff options
author | Brendan Hickey <brendan@bhickey.net> | 2013-07-28 00:31:07 -0700 |
---|---|---|
committer | Brendan Hickey <brendan@bhickey.net> | 2013-07-28 00:37:53 -0700 |
commit | cc0fb03b9eee93cd3fbfb7b9ea40c8b1bfa7a872 (patch) | |
tree | 2534d2f5cac007ec674bc966576f0d47542d17b0 /crawl-ref/source | |
parent | 772cbec2479d6b59ccb91cad149c7edf8968cf6f (diff) | |
download | crawl-ref-cc0fb03b9eee93cd3fbfb7b9ea40c8b1bfa7a872.tar.gz crawl-ref-cc0fb03b9eee93cd3fbfb7b9ea40c8b1bfa7a872.zip |
Refactor 'you.religion' checks.
Pull 'you.religion [!=]= FOO' checks into a function: you_worship(FOO).
This change is part of a large plan to clean up religion.
Diffstat (limited to 'crawl-ref/source')
69 files changed, 418 insertions, 404 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 5782cc539d..23db0922bd 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1237,7 +1237,7 @@ void no_ability_msg() if (you.flight_mode()) mpr("You're already flying!"); } - else if (silenced(you.pos()) && you.religion != GOD_NO_GOD) + else if (silenced(you.pos()) && !you_worship(GOD_NO_GOD)) { // At the very least the player has "Renounce Religion", but // cannot use it in silence. @@ -1355,7 +1355,7 @@ static bool _check_ability_possible(const ability_def& abil, return false; } - if (silenced(you.pos()) && you.religion != GOD_NEMELEX_XOBEH) + if (silenced(you.pos()) && !you_worship(GOD_NEMELEX_XOBEH)) { talent tal = get_talent(abil.ability, false); if (tal.is_invocation) @@ -2749,7 +2749,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_CONVERT_TO_BEOGH: god_pitch(GOD_BEOGH); - if (you.religion == GOD_BEOGH) + if (you_worship(GOD_BEOGH)) { spare_beogh_convert(); break; @@ -3208,7 +3208,7 @@ vector<talent> your_talents(bool check_confused, bool include_unusable) _add_talent(talents, abilities[i], check_confused); // And finally, the ability to opt-out of your faith {dlb}: - if (you.religion != GOD_NO_GOD + if (!you_worship(GOD_NO_GOD) && (include_unusable || !silenced(you.pos()))) _add_talent(talents, ABIL_RENOUNCE_RELIGION, check_confused); @@ -3364,7 +3364,7 @@ static int _is_god_ability(ability_type abil) void set_god_ability_slots() { - ASSERT(you.religion != GOD_NO_GOD); + ASSERT(!you_worship(GOD_NO_GOD)); _set_god_ability_helper(ABIL_RENOUNCE_RELIGION, 'X'); @@ -3378,7 +3378,7 @@ void set_god_ability_slots() // Finally, add in current god's invocations in traditional slots. int num = 0; - if (you.religion == GOD_ELYVILON) + if (you_worship(GOD_ELYVILON)) { _set_god_ability_helper(ABIL_ELYVILON_LESSER_HEALING_OTHERS, 'a' + num++); @@ -3391,7 +3391,7 @@ void set_god_ability_slots() _set_god_ability_helper(god_abilities[you.religion][i], 'a' + num++); - if (you.religion == GOD_ELYVILON) + if (you_worship(GOD_ELYVILON)) { if (god_abilities[you.religion][i] == ABIL_ELYVILON_LESSER_HEALING_SELF) @@ -3405,7 +3405,7 @@ void set_god_ability_slots() 'a' + num++); } } - else if (you.religion == GOD_YREDELEMNUL) + else if (you_worship(GOD_YREDELEMNUL)) { if (god_abilities[you.religion][i] == ABIL_YRED_RECALL_UNDEAD_SLAVES) @@ -3435,7 +3435,7 @@ static int _find_ability_slot(const ability_def &abil) // Skip over a-e (invocations), a-g for Elyvilon, a-E for ZotDef int first_slot = 5; - if (you.religion == GOD_ELYVILON) + if (you_worship(GOD_ELYVILON)) first_slot = 7; if (abil.flags & ABFLAG_ZOTDEF) first_slot = 5 + 26; // capital F, for *some* memory compat. @@ -3471,9 +3471,9 @@ static int _find_ability_slot(const ability_def &abil) vector<ability_type> get_god_abilities(bool include_unusable) { vector<ability_type> abilities; - if (you.religion == GOD_TROG && (include_unusable || !silenced(you.pos()))) + if (you_worship(GOD_TROG) && (include_unusable || !silenced(you.pos()))) abilities.push_back(ABIL_TROG_BURN_SPELLBOOKS); - else if (you.religion == GOD_ELYVILON && (include_unusable || !silenced(you.pos()))) + else if (you_worship(GOD_ELYVILON) && (include_unusable || !silenced(you.pos()))) abilities.push_back(ABIL_ELYVILON_LESSER_HEALING_OTHERS); else if (you.transfer_skill_points > 0) abilities.push_back(ABIL_ASHENZARI_END_TRANSFER); @@ -3481,7 +3481,7 @@ vector<ability_type> get_god_abilities(bool include_unusable) // Remaining abilities are unusable if under penance, or if silenced if not // Nemelex abilities. if (!include_unusable && (player_under_penance() - || silenced(you.pos()) && you.religion != GOD_NEMELEX_XOBEH)) + || silenced(you.pos()) && !you_worship(GOD_NEMELEX_XOBEH))) { return abilities; } @@ -3507,13 +3507,13 @@ vector<ability_type> get_god_abilities(bool include_unusable) else if (abil == ABIL_ELYVILON_GREATER_HEALING_OTHERS) abilities.push_back(ABIL_ELYVILON_GREATER_HEALING_SELF); else if (abil == ABIL_YRED_RECALL_UNDEAD_SLAVES - || abil == ABIL_STOP_RECALL && you.religion == GOD_YREDELEMNUL) + || abil == ABIL_STOP_RECALL && you_worship(GOD_YREDELEMNUL)) { abilities.push_back(ABIL_YRED_INJURY_MIRROR); } } - if (you.religion == GOD_ZIN && !you.one_time_ability_used[GOD_ZIN] && you.piety > 160) + if (you_worship(GOD_ZIN) && !you.one_time_ability_used[GOD_ZIN] && you.piety > 160) abilities.push_back(ABIL_ZIN_CURE_ALL_MUTATIONS); return abilities; diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc index e61dc342de..3053990a39 100644 --- a/crawl-ref/source/abyss.cc +++ b/crawl-ref/source/abyss.cc @@ -170,7 +170,7 @@ static int _abyssal_rune_roll() if (you.runes[RUNE_ABYSSAL] || you.depth < ABYSSAL_RUNE_MIN_LEVEL) return -1; const bool lugonu_favoured = - (you.religion == GOD_LUGONU && !player_under_penance() + (you_worship(GOD_LUGONU) && !player_under_penance() && you.piety >= piety_breakpoint(4)); const double depth = you.depth + lugonu_favoured; @@ -1517,7 +1517,7 @@ retry: static void _increase_depth() { int delta = you.time_taken * (you.abyss_speed + 40) / 200; - if (you.religion != GOD_CHEIBRIADOS || you.penance[GOD_CHEIBRIADOS]) + if (!you_worship(GOD_CHEIBRIADOS) || you.penance[GOD_CHEIBRIADOS]) delta *= 2; if (you.duration[DUR_TELEPORT]) delta *= 5; diff --git a/crawl-ref/source/acquire.cc b/crawl-ref/source/acquire.cc index 4f2df2e5c8..8638dbab3d 100644 --- a/crawl-ref/source/acquire.cc +++ b/crawl-ref/source/acquire.cc @@ -420,7 +420,7 @@ static void _acquirement_determine_food(int& type_wanted, int& quantity, // class type is set elsewhere type_wanted = POT_BLOOD; } - else if (you.religion == GOD_FEDHAS) + else if (you_worship(GOD_FEDHAS)) { // Fedhas worshippers get fruit to use for growth and evolution type_wanted = one_chance_in(3) ? FOOD_BANANA : FOOD_ORANGE; @@ -982,7 +982,7 @@ static bool _do_book_acquirement(item_def &book, int agent) other_weights += weight; } - if (you.religion == GOD_TROG) + if (you_worship(GOD_TROG)) magic_weights = 0; // If someone has 25% or more magic skills, never give manuals. @@ -1398,7 +1398,7 @@ int acquirement_create_item(object_class_type class_wanted, init_stack_blood_potions(doodad); // Remove curse flag from item, unless worshipping Ashenzari. - if (you.religion == GOD_ASHENZARI) + if (you_worship(GOD_ASHENZARI)) do_curse_item(doodad, true); else do_uncurse_item(doodad, false); @@ -1615,7 +1615,7 @@ bool acquirement(object_class_type class_wanted, int agent, bad_class.set(OBJ_STAVES); bad_class.set(OBJ_RODS); } - bad_class.set(OBJ_FOOD, you_foodless_normally() && you.religion != GOD_FEDHAS); + bad_class.set(OBJ_FOOD, you_foodless_normally() && !you_worship(GOD_FEDHAS)); static struct { object_class_type type; const char* name; } acq_classes[] = { @@ -1631,7 +1631,7 @@ bool acquirement(object_class_type class_wanted, int agent, { OBJ_MISSILES, "Ammunition" }, }; ASSERT(acq_classes[7].type == OBJ_FOOD); - acq_classes[7].name = you.religion == GOD_FEDHAS ? "Fruit": + acq_classes[7].name = you_worship(GOD_FEDHAS) ? "Fruit": you.species == SP_VAMPIRE ? "Blood": "Food"; diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc index 289901ae67..3cbc15f2f2 100644 --- a/crawl-ref/source/actor.cc +++ b/crawl-ref/source/actor.cc @@ -15,6 +15,7 @@ #include "mon-death.h" #include "ouch.h" #include "player.h" +#include "religion.h" #include "random.h" #include "state.h" #include "stuff.h" @@ -441,7 +442,7 @@ int actor::apply_ac(int damage, int max_damage, ac_type ac_rule, bool actor_slime_wall_immune(const actor *act) { return - act->is_player() && you.religion == GOD_JIYVA && !you.penance[GOD_JIYVA] + act->is_player() && you_worship(GOD_JIYVA) && !you.penance[GOD_JIYVA] || act->res_acid() == 3; } diff --git a/crawl-ref/source/attitude-change.cc b/crawl-ref/source/attitude-change.cc index d25ffd1791..2b7d49af72 100644 --- a/crawl-ref/source/attitude-change.cc +++ b/crawl-ref/source/attitude-change.cc @@ -79,7 +79,7 @@ void beogh_follower_convert(monster* mons, bool orc_hit) return; // For followers of Beogh, decide whether orcs will join you. - if (you.religion == GOD_BEOGH + if (you_worship(GOD_BEOGH) && mons->foe == MHITYOU && mons_genus(mons->type) == MONS_ORC && !mons->is_summoned() @@ -105,7 +105,7 @@ void beogh_follower_convert(monster* mons, bool orc_hit) void slime_convert(monster* mons) { - if (you.religion == GOD_JIYVA && mons_is_slime(mons) + if (you_worship(GOD_JIYVA) && mons_is_slime(mons) && !mons->is_shapeshifter() && !mons->neutral() && !mons->friendly() @@ -124,7 +124,7 @@ void slime_convert(monster* mons) void fedhas_neutralise(monster* mons) { - if (you.religion == GOD_FEDHAS + if (you_worship(GOD_FEDHAS) && mons->attitude == ATT_HOSTILE && fedhas_neutralises(mons) && !testbits(mons->flags, MF_ATT_CHANGE_ATTEMPT) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 240524d808..012df09246 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2144,7 +2144,7 @@ bool miasma_monster(monster* mons, const actor* who) if (who && who->is_player() && is_good_god(you.religion) - && !(success && you.religion == GOD_SHINING_ONE)) // already penalized + && !(success && you_worship(GOD_SHINING_ONE))) // already penalized { did_god_conduct(DID_NECROMANCY, 5 + random2(3)); } @@ -4197,7 +4197,7 @@ void bolt::enchantment_affect_monster(monster* mon) set_attack_conducts(conducts, mon, you.can_see(mon)); - if (you.religion == GOD_BEOGH + if (you_worship(GOD_BEOGH) && mons_genus(mon->type) == MONS_ORC && mon->asleep() && !player_under_penance() && you.piety >= piety_breakpoint(2) && mons_near(mon)) @@ -4671,7 +4671,7 @@ void bolt::affect_monster(monster* mon) // goes out of scope. // // Also exempting miscast explosions from this conduct -cao - if (you.religion == GOD_FEDHAS + if (you_worship(GOD_FEDHAS) && (flavour == BEAM_SPORE || beam_source == NON_MONSTER && aux_source.find("your miscasting") != string::npos)) @@ -4766,7 +4766,7 @@ void bolt::affect_monster(monster* mon) // // FIXME: Should be a better way of doing this. For now, we are // just falsifying the death report... -cao - if (you.religion == GOD_FEDHAS && flavour == BEAM_SPORE + if (you_worship(GOD_FEDHAS) && flavour == BEAM_SPORE && fedhas_protects(mon)) { if (mon->attitude == ATT_FRIENDLY) diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc index 767192c206..bbc7aee198 100644 --- a/crawl-ref/source/chardump.cc +++ b/crawl-ref/source/chardump.cc @@ -667,7 +667,7 @@ static void _sdump_location(dump_params &par) static void _sdump_religion(dump_params &par) { string &text(par.text); - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) { if (par.se) text += "You worshipped "; @@ -676,7 +676,7 @@ static void _sdump_religion(dump_params &par) text += god_name(you.religion); text += ".\n"; - if (you.religion != GOD_XOM) + if (!you_worship(GOD_XOM)) { if (!player_under_penance()) { diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index 12dca074ce..80a1735d27 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -763,7 +763,7 @@ static bool _actor_cloud_immune(const actor *act, const cloud_struct &cloud) const bool player = act->is_player(); if (!player - && you.religion == GOD_FEDHAS + && you_worship(GOD_FEDHAS) && fedhas_protects(act->as_monster()) && (cloud.whose == KC_YOU || cloud.whose == KC_FRIENDLY) && (act->as_monster()->friendly() || act->as_monster()->neutral())) @@ -964,7 +964,7 @@ bool _actor_apply_cloud_side_effects(actor *act, } else if (mons->malmutate("mutagenic cloud")) { - if (you.religion == GOD_ZIN && cloud.whose == KC_YOU) + if (you_worship(GOD_ZIN) && cloud.whose == KC_YOU) did_god_conduct(DID_DELIBERATE_MUTATING, 5 + random2(3)); return true; } diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 5b9f1aa3af..cb9698b306 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1503,7 +1503,7 @@ static void _swap_monster_card(int power, deck_rarity_type rarity) static void _velocity_card(int power, deck_rarity_type rarity) { - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) return simple_god_message(" protects you from inadvertent hurry."); const int power_level = _get_power_level(power, rarity); @@ -1529,7 +1529,7 @@ static void _damnation_card(int power, deck_rarity_type rarity) // Calculate how many extra banishments you get. const int power_level = _get_power_level(power, rarity); int nemelex_bonus = 0; - if (you.religion == GOD_NEMELEX_XOBEH && !player_under_penance()) + if (you_worship(GOD_NEMELEX_XOBEH) && !player_under_penance()) nemelex_bonus = you.piety; int extra_targets = power_level + random2(you.skill(SK_EVOCATIONS, 20) @@ -1602,7 +1602,7 @@ static void _flight_card(int power, deck_rarity_type rarity) else if (power_level >= 1) { cast_fly(random2(power/4)); - if (you.religion != GOD_CHEIBRIADOS) + if (!you_worship(GOD_CHEIBRIADOS)) cast_swiftness(random2(power/4)); else simple_god_message(" protects you from inadvertent hurry."); @@ -1963,7 +1963,7 @@ static void _potion_card(int power, deck_rarity_type rarity) if (power_level >= 2 && coinflip()) pot = (coinflip() ? POT_SPEED : POT_RESISTANCE); - if (you.religion == GOD_CHEIBRIADOS && pot == POT_SPEED) + if (you_worship(GOD_CHEIBRIADOS) && pot == POT_SPEED) { simple_god_message(" protects you from inadvertent hurry."); return; @@ -2910,7 +2910,7 @@ static int _card_power(deck_rarity_type rarity) if (you.penance[GOD_NEMELEX_XOBEH]) result -= you.penance[GOD_NEMELEX_XOBEH]; - else if (you.religion == GOD_NEMELEX_XOBEH) + else if (you_worship(GOD_NEMELEX_XOBEH)) { result = you.piety; result *= (you.skill(SK_EVOCATIONS, 100) + 2500); @@ -2958,7 +2958,7 @@ void card_effect(card_type which_card, deck_rarity_type rarity, if (which_card == CARD_XOM && !crawl_state.is_god_acting()) { - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) { // Being a self-centered deity, Xom *always* finds this // maximally hilarious. diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 2403e3d100..f4bda54d87 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -1127,7 +1127,7 @@ static void _finish_delay(const delay_queue_item &delay) simple_god_message(" expects more respect for holy" " creatures!"); } - else if (you.religion == GOD_ZIN + else if (you_worship(GOD_ZIN) && mons_class_intel(item.mon_type) >= I_NORMAL) { simple_god_message(" expects more respect for this" diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 54aace74b9..6d97af2125 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -1986,7 +1986,7 @@ string get_item_description(const item_def &item, bool verbose, if ((god_hates_cannibalism(you.religion) && is_player_same_genus(item.mon_type)) - || (you.religion == GOD_ZIN + || (you_worship(GOD_ZIN) && mons_class_intel(item.mon_type) >= I_NORMAL) || (is_good_god(you.religion) && mons_class_holiness(item.mon_type) == MH_HOLY)) @@ -2924,7 +2924,7 @@ static int _get_spell_description(const spell_type spell, if (you.has_spell(spell)) { description += "\n(F)orget this spell by destroying the book.\n"; - if (you.religion == GOD_SIF_MUNA) + if (you_worship(GOD_SIF_MUNA)) description +="Sif Muna frowns upon the destroying of books.\n"; return BOOK_FORGET; } @@ -4358,7 +4358,7 @@ static void _detailed_god_description(god_type which_god) mouse_control mc(MOUSE_MODE_MORE); const int keyin = getchm(); - if (you.religion == GOD_NEMELEX_XOBEH + if (you_worship(GOD_NEMELEX_XOBEH) && keyin >= 'a' && keyin < 'a' + (char) NUM_NEMELEX_GIFT_TYPES) { const int num = keyin - 'a'; @@ -4404,7 +4404,7 @@ void describe_god(god_type which_god, bool give_title) cprintf("%s", get_linebreak_string(god_desc.c_str(), numcols).c_str()); // Title only shown for our own god. - if (you.religion == which_god) + if (you_worship(which_god)) { // Print title based on piety. cprintf("\nTitle - "); @@ -4425,7 +4425,7 @@ void describe_god(god_type which_god, bool give_title) //mv: Player is praying at altar without appropriate religion. // It means player isn't checking his own religion and so we only // display favour and go out. - if (you.religion != which_god) + if (!you_worship(which_god)) { textcolor(colour); int which_god_penance = you.penance[which_god]; @@ -4696,13 +4696,13 @@ string get_skill_description(skill_type skill, bool need_title) result += "\n"; result += "How on earth did you manage to pick this up?"; } - else if (you.religion == GOD_TROG) + else if (you_worship(GOD_TROG)) { result += "\n"; result += "Note that Trog doesn't use Invocations, due to its " "close connection to magic."; } - else if (you.religion == GOD_NEMELEX_XOBEH) + else if (you_worship(GOD_NEMELEX_XOBEH)) { result += "\n"; result += "Note that Nemelex uses Evocations rather than " @@ -4711,7 +4711,7 @@ string get_skill_description(skill_type skill, bool need_title) break; case SK_EVOCATIONS: - if (you.religion == GOD_NEMELEX_XOBEH) + if (you_worship(GOD_NEMELEX_XOBEH)) { result += "\n"; result += "This is the skill all of Nemelex's abilities rely on."; @@ -4719,7 +4719,7 @@ string get_skill_description(skill_type skill, bool need_title) break; case SK_SPELLCASTING: - if (you.religion == GOD_TROG) + if (you_worship(GOD_TROG)) { result += "\n"; result += "Keep in mind, though, that Trog will greatly disapprove " diff --git a/crawl-ref/source/dgn-overview.cc b/crawl-ref/source/dgn-overview.cc index d302299d99..f00b675267 100644 --- a/crawl-ref/source/dgn-overview.cc +++ b/crawl-ref/source/dgn-overview.cc @@ -481,7 +481,7 @@ static string _print_altars_for_gods(const vector<god_type>& gods, // Indicate good gods that you've abandoned, though. else if (you.penance[god]) colour = "magenta"; - else if (you.religion == god) + else if (you_worship(god)) colour = "yellow"; else if (god_likes_your_god(god) && has_altar_been_seen) colour = "brown"; diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index df36cbcfd0..4ac886297b 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -530,7 +530,7 @@ void banished(const string &who) down_stairs(DNGN_ENTER_ABYSS); // heh heh // Xom just might decide to interfere. - if (you.religion == GOD_XOM && who != "Xom" && who != "wizard command" + if (you_worship(GOD_XOM) && who != "Xom" && who != "wizard command" && who != "a distortion unwield") { xom_maybe_reverts_banishment(false, false); @@ -1250,7 +1250,7 @@ bool vitrify_area(int radius) static void _hell_effects() { - if ((you.religion == GOD_ZIN && x_chance_in_y(you.piety, MAX_PIETY)) + if ((you_worship(GOD_ZIN) && x_chance_in_y(you.piety, MAX_PIETY)) || is_sanctuary(you.pos())) { simple_god_message("'s power protects you from the chaos of Hell!"); @@ -2164,7 +2164,7 @@ void handle_time() // If Cheibriados has slowed your biology, disease might // not actually do anything. if (one_chance_in(30) - && !(you.religion == GOD_CHEIBRIADOS + && !(you_worship(GOD_CHEIBRIADOS) && you.piety >= piety_breakpoint(0) && coinflip())) { @@ -2296,7 +2296,7 @@ void handle_time() { // Update the abyss speed. This place is unstable and the speed can // fluctuate. It's not a constant increase. - if (you.religion == GOD_CHEIBRIADOS && coinflip()) + if (you_worship(GOD_CHEIBRIADOS) && coinflip()) ; // Speed change less often for Chei. else if (coinflip() && you.abyss_speed < 100) ++you.abyss_speed; @@ -2304,7 +2304,7 @@ void handle_time() --you.abyss_speed; } - if (you.religion == GOD_JIYVA && one_chance_in(10)) + if (you_worship(GOD_JIYVA) && one_chance_in(10)) { int total_jellies = 1 + random2(5); bool success = false; @@ -2347,13 +2347,13 @@ void handle_time() } } - if (you.religion == GOD_JIYVA && x_chance_in_y(you.piety / 4, MAX_PIETY) + if (you_worship(GOD_JIYVA) && x_chance_in_y(you.piety / 4, MAX_PIETY) && !player_under_penance() && one_chance_in(4)) { jiyva_stat_action(); } - if (you.religion == GOD_JIYVA && one_chance_in(25)) + if (you_worship(GOD_JIYVA) && one_chance_in(25)) jiyva_eat_offlevel_items(); if (int lev = player_mutation_level(MUT_EVOLUTION)) @@ -2952,7 +2952,7 @@ int spawn_corpse_mushrooms(item_def& corpse, // Is this square occupied by a non mushroom? if (mons && mons->mons_species() != MONS_TOADSTOOL - || player_occupant && you.religion != GOD_FEDHAS + || player_occupant && !you_worship(GOD_FEDHAS) || !can_spawn_mushrooms(current)) { continue; @@ -3203,7 +3203,7 @@ void slime_wall_damage(actor* act, int delay) if (act->is_player()) { - if (you.religion != GOD_JIYVA || you.penance[GOD_JIYVA]) + if (!you_worship(GOD_JIYVA) || you.penance[GOD_JIYVA]) { splash_with_acid(strength, NON_MONSTER, false, (walls > 1) ? "The walls burn you!" diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 4d63d28eaa..40f51dc84a 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -2417,7 +2417,7 @@ bool is_forbidden_food(const item_def &food) } // Zin doesn't like it if you eat beings with a soul. - if (you.religion == GOD_ZIN && mons_class_intel(food.mon_type) >= I_NORMAL) + if (you_worship(GOD_ZIN) && mons_class_intel(food.mon_type) >= I_NORMAL) return true; // Everything else is allowed. @@ -2768,7 +2768,7 @@ void handle_starvation() stop_running(); you.increase_duration(DUR_PARALYSIS, 5 + random2(8), 13); - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) xom_is_stimulated(get_tension() > 0 ? 200 : 100); } @@ -2814,7 +2814,7 @@ static int _chunks_needed() int appetite = player_hunger_rate(false); hunger += appetite * FRESHEST_CORPSE * 2; - bool channeling = you.religion == GOD_SIF_MUNA; + bool channeling = you_worship(GOD_SIF_MUNA); for (int i = 0; i < ENDOFPACK; i++) { if (you.inv[i].defined() diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc index 2ac526ee4d..20929bf179 100644 --- a/crawl-ref/source/godabil.cc +++ b/crawl-ref/source/godabil.cc @@ -767,7 +767,7 @@ bool zin_recite_to_single_monster(const coord_def& where, recite_type prayertype) { // That's a pretty good sanity check, I guess. - if (you.religion != GOD_ZIN) + if (!you_worship(GOD_ZIN)) return false; monster* mon = monster_at(where); @@ -1493,7 +1493,7 @@ bool vehumet_supports_spell(spell_type spell) // Returns false if the invocation fails (no spellbooks in sight, etc.). bool trog_burn_spellbooks() { - if (you.religion != GOD_TROG) + if (!you_worship(GOD_TROG)) return false; god_acting gdact; @@ -1610,7 +1610,7 @@ bool trog_burn_spellbooks() bool beogh_water_walk() { - return (you.religion == GOD_BEOGH && !player_under_penance() + return (you_worship(GOD_BEOGH) && !player_under_penance() && you.piety >= piety_breakpoint(4)); } @@ -1667,14 +1667,14 @@ bool jiyva_remove_bad_mutation() bool yred_injury_mirror() { - return (you.religion == GOD_YREDELEMNUL && !player_under_penance() + return (you_worship(GOD_YREDELEMNUL) && !player_under_penance() && you.piety >= piety_breakpoint(1) && you.duration[DUR_MIRROR_DAMAGE]); } bool yred_can_animate_dead() { - return (you.religion == GOD_YREDELEMNUL && !player_under_penance() + return (you_worship(GOD_YREDELEMNUL) && !player_under_penance() && you.piety >= piety_breakpoint(2)); } @@ -1855,7 +1855,7 @@ bool kiku_receive_corpses(int pow, coord_def where) if (corpses_created) { - if (you.religion == GOD_KIKUBAAQUDGHA) + if (you_worship(GOD_KIKUBAAQUDGHA)) { simple_god_message(corpses_created > 1 ? " delivers you corpses!" : " delivers you a corpse!"); @@ -1865,7 +1865,7 @@ bool kiku_receive_corpses(int pow, coord_def where) } else { - if (you.religion == GOD_KIKUBAAQUDGHA) + if (you_worship(GOD_KIKUBAAQUDGHA)) simple_god_message(" can find no cadavers for you!"); return false; } @@ -1895,7 +1895,7 @@ bool kiku_take_corpse() bool fedhas_passthrough_class(const monster_type mc) { - return (you.religion == GOD_FEDHAS + return (you_worship(GOD_FEDHAS) && mons_class_is_plant(mc) && mons_class_is_stationary(mc) && mc != MONS_SNAPLASHER_VINE @@ -1932,7 +1932,7 @@ bool fedhas_shoot_through(const bolt& beam, const monster* victim) mon_attitude_type origin_attitude; if (originator->is_player()) { - origin_worships_fedhas = you.religion == GOD_FEDHAS; + origin_worships_fedhas = you_worship(GOD_FEDHAS); origin_attitude = ATT_FRIENDLY; } else diff --git a/crawl-ref/source/godconduct.cc b/crawl-ref/source/godconduct.cc index 964b270b7f..7bb0b70456 100644 --- a/crawl-ref/source/godconduct.cc +++ b/crawl-ref/source/godconduct.cc @@ -55,8 +55,8 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, bool retval = false; - if (you.religion != GOD_NO_GOD && you.religion != GOD_XOM - && (you.religion != GOD_LUGONU || !player_in_branch(BRANCH_ABYSS))) + if (!you_worship(GOD_NO_GOD) && !you_worship(GOD_XOM) + && (!you_worship(GOD_LUGONU) || !player_in_branch(BRANCH_ABYSS))) { int piety_change = 0; int piety_denom = 1; @@ -78,7 +78,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, "blood-drinking, just this once."); break; } - if (you.religion == GOD_SHINING_ONE) + if (you_worship(GOD_SHINING_ONE)) penance = level; piety_change = -2*level; retval = true; @@ -105,7 +105,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_CORPSE_VIOLATION: - if (you.religion == GOD_FEDHAS) + if (you_worship(GOD_FEDHAS)) { if (known) { @@ -122,7 +122,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_DESECRATE_HOLY_REMAINS: - if (you.religion == GOD_YREDELEMNUL) + if (you_worship(GOD_YREDELEMNUL)) { simple_god_message(" appreciates your desecration of holy " "remains."); @@ -157,7 +157,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, } piety_change = -level; - penance = level * ((you.religion == GOD_SHINING_ONE) ? 2 + penance = level * ((you_worship(GOD_SHINING_ONE)) ? 2 : 1); retval = true; break; @@ -167,7 +167,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_HOLY: - if (you.religion == GOD_YREDELEMNUL) + if (you_worship(GOD_YREDELEMNUL)) { if (!known) { @@ -183,7 +183,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, case DID_UNCHIVALRIC_ATTACK: case DID_POISON: - if (you.religion == GOD_SHINING_ONE) + if (you_worship(GOD_SHINING_ONE)) { if (thing_done == DID_UNCHIVALRIC_ATTACK) { @@ -205,7 +205,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_KILL_SLIME: - if (you.religion == GOD_JIYVA && !victim->is_shapeshifter()) + if (you_worship(GOD_JIYVA) && !victim->is_shapeshifter()) { retval = true; piety_change = -level; @@ -216,7 +216,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, case DID_KILL_PLANT: case DID_PLANT_KILLED_BY_SERVANT: // Piety loss but no penance for killing a plant. - if (you.religion == GOD_FEDHAS) + if (you_worship(GOD_FEDHAS)) { retval = true; piety_change = -level; @@ -282,7 +282,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, case DID_FRIEND_DIED: case DID_SOULED_FRIEND_DIED: - if (victim && you.religion != GOD_FEDHAS + if (victim && !you_worship(GOD_FEDHAS) && (mons_is_object(victim->type) || victim->holiness() == MH_PLANT)) { @@ -337,7 +337,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_BANISH: - if (you.religion != GOD_LUGONU) + if (!you_worship(GOD_LUGONU)) break; case DID_KILL_LIVING: switch (you.religion) @@ -436,7 +436,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, case DID_KILL_NATURAL_UNHOLY: case DID_KILL_NATURAL_EVIL: - if (you.religion == GOD_SHINING_ONE + if (you_worship(GOD_SHINING_ONE) && !god_hates_attacking_friend(you.religion, victim)) { simple_god_message(" accepts your kill."); @@ -448,7 +448,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, case DID_KILL_UNCLEAN: case DID_KILL_CHAOTIC: - if (you.religion == GOD_ZIN + if (you_worship(GOD_ZIN) && !god_hates_attacking_friend(you.religion, victim)) { simple_god_message(" accepts your kill."); @@ -459,7 +459,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_KILL_PRIEST: - if (you.religion == GOD_BEOGH + if (you_worship(GOD_BEOGH) && !god_hates_attacking_friend(you.religion, victim)) { simple_god_message(" appreciates your killing of a heretic " @@ -471,7 +471,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_KILL_WIZARD: - if (you.religion == GOD_TROG + if (you_worship(GOD_TROG) && !god_hates_attacking_friend(you.religion, victim)) { simple_god_message(" appreciates your killing of a magic " @@ -483,7 +483,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_KILL_FAST: - if (you.religion == GOD_CHEIBRIADOS + if (you_worship(GOD_CHEIBRIADOS) && !god_hates_attacking_friend(you.religion, victim)) { retval = true; @@ -508,7 +508,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_KILL_ARTIFICIAL: - if (you.religion == GOD_YREDELEMNUL + if (you_worship(GOD_YREDELEMNUL) && !god_hates_attacking_friend(you.religion, victim)) { simple_god_message(" accepts your kill."); @@ -554,7 +554,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, piety_denom = level + 18; piety_change = piety_denom - 3; - if (you.religion == GOD_YREDELEMNUL) + if (you_worship(GOD_YREDELEMNUL)) { simple_god_message(" appreciates your killing of a holy " "being."); @@ -744,7 +744,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, case DID_NATURAL_UNHOLY_KILLED_BY_SERVANT: case DID_NATURAL_EVIL_KILLED_BY_SERVANT: - if (you.religion == GOD_SHINING_ONE) + if (you_worship(GOD_SHINING_ONE)) { simple_god_message(" accepts your collateral kill."); retval = true; @@ -755,7 +755,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, case DID_UNCLEAN_KILLED_BY_SERVANT: case DID_CHAOTIC_KILLED_BY_SERVANT: - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) { simple_god_message(" accepts your collateral kill."); retval = true; @@ -766,7 +766,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_ARTIFICIAL_KILLED_BY_UNDEAD_SLAVE: - if (you.religion == GOD_YREDELEMNUL) + if (you_worship(GOD_YREDELEMNUL)) { simple_god_message(" accepts your slave's kill."); retval = true; @@ -781,7 +781,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_SPELL_MEMORISE: - if (you.religion == GOD_TROG) + if (you_worship(GOD_TROG)) { penance = level * 10; piety_change = -penance; @@ -790,7 +790,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_SPELL_CASTING: - if (you.religion == GOD_TROG) + if (you_worship(GOD_TROG)) { piety_change = -level; penance = level * 5; @@ -804,13 +804,13 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, // typically 10 * exercise, but may be more/less if the // skill is at 0 (INT adjustment), or if the PC's pool is // low and makes change. - if (you.religion == GOD_SIF_MUNA) + if (you_worship(GOD_SIF_MUNA)) { piety_change = level; piety_denom = 40; retval = true; } - else if (you.religion == GOD_TROG) + else if (you_worship(GOD_TROG)) { simple_god_message(" doesn't appreciate your training magic!"); piety_change = -level; @@ -820,7 +820,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_CARDS: - if (you.religion == GOD_NEMELEX_XOBEH) + if (you_worship(GOD_NEMELEX_XOBEH)) { piety_change = level; retval = true; @@ -854,7 +854,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, case DID_CAUSE_GLOWING: case DID_DELIBERATE_MUTATING: - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) { if (!known && thing_done != DID_CAUSE_GLOWING) { @@ -888,7 +888,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, // level depends on intelligence: normal -> 1, high -> 2 // cannibalism is still worse case DID_EAT_SOULED_BEING: - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) { piety_change = -level * 5; if (level > 1) @@ -898,7 +898,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_UNCLEAN: - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) { retval = true; if (!known) @@ -913,7 +913,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_CHAOS: - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) { retval = true; if (!known) @@ -928,7 +928,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_ATTACK_IN_SANCTUARY: - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) { piety_change = -level; retval = true; @@ -936,7 +936,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_DESECRATE_ORCISH_REMAINS: - if (you.religion == GOD_BEOGH) + if (you_worship(GOD_BEOGH)) { piety_change = -level; retval = true; @@ -944,7 +944,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_DESTROY_ORCISH_IDOL: - if (you.religion == GOD_BEOGH) + if (you_worship(GOD_BEOGH)) { piety_change = -level; penance = level * 3; @@ -953,7 +953,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_HASTY: - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) { if (!known) { @@ -969,7 +969,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_DESTROY_SPELLBOOK: - if (you.religion == GOD_SIF_MUNA) + if (you_worship(GOD_SIF_MUNA)) { piety_change = -level; penance = level * (known ? 2 : 1); @@ -978,7 +978,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_EXPLORATION: - if (you.religion == GOD_ASHENZARI) + if (you_worship(GOD_ASHENZARI)) { const int base_gain = 6; // base gain per dungeon level // levels: x1, x1.5, x2, x2.5, x3 @@ -989,7 +989,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; case DID_SEE_MONSTER: - if (you.religion == GOD_SHINING_ONE) + if (you_worship(GOD_SHINING_ONE)) { if (victim && (victim->is_evil() || victim->is_unholy())) break; @@ -1006,7 +1006,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, break; } - if (you.religion == GOD_OKAWARU + if (you_worship(GOD_OKAWARU) // currently no constructs and plants && (thing_done == DID_KILL_LIVING || thing_done == DID_KILL_UNDEAD diff --git a/crawl-ref/source/godpassive.cc b/crawl-ref/source/godpassive.cc index cd0d3cedab..4560ccec4d 100644 --- a/crawl-ref/source/godpassive.cc +++ b/crawl-ref/source/godpassive.cc @@ -28,7 +28,7 @@ int che_stat_boost(int piety) { - if (you.religion != GOD_CHEIBRIADOS || you.penance[GOD_CHEIBRIADOS]) + if (!you_worship(GOD_CHEIBRIADOS) || you.penance[GOD_CHEIBRIADOS]) return 0; if (piety < 30) // Since you've already begun to slow down. return 1; @@ -41,7 +41,7 @@ int che_stat_boost(int piety) void jiyva_eat_offlevel_items() { // For wizard mode 'J' command - if (you.religion != GOD_JIYVA) + if (!you_worship(GOD_JIYVA)) return; if (crawl_state.game_is_sprint()) @@ -167,7 +167,7 @@ static bool _two_handed() void ash_check_bondage(bool msg) { - if (you.religion != GOD_ASHENZARI) + if (!you_worship(GOD_ASHENZARI)) return; int cursed[NUM_ET] = {0}, slots[NUM_ET] = {0}; @@ -381,7 +381,7 @@ static bool _jewel_auto_id(const item_def& item) case RING_INTELLIGENCE: return !!item.plus; case AMU_FAITH: - return (you.religion != GOD_NO_GOD); + return (!you_worship(GOD_NO_GOD)); case AMU_THE_GOURMAND: return (you.species != SP_MUMMY && player_mutation_level(MUT_HERBIVOROUS) < 3); @@ -406,7 +406,7 @@ bool god_id_item(item_def& item, bool silent) iflags_t old_ided = item.flags & ISFLAG_IDENT_MASK; iflags_t ided = 0; - if (you.religion == GOD_ASHENZARI) + if (you_worship(GOD_ASHENZARI)) { // Don't identify runes or the orb, since this has no gameplay purpose // and might mess up other things. @@ -464,7 +464,7 @@ bool god_id_item(item_def& item, bool silent) ided |= ISFLAG_EQ_JEWELLERY_MASK; } } - else if (you.religion == GOD_ELYVILON) + else if (you_worship(GOD_ELYVILON)) { if ((item.base_type == OBJ_STAVES || item.base_type == OBJ_RODS) && (is_evil_item(item) || is_unholy_item(item))) @@ -510,7 +510,7 @@ bool god_id_item(item_def& item, bool silent) void ash_id_monster_equipment(monster* mon) { - if (you.religion != GOD_ASHENZARI) + if (!you_worship(GOD_ASHENZARI)) return; bool id = false; @@ -585,7 +585,7 @@ static bool _check_portal(coord_def where) int ash_detect_portals(bool all) { - if (you.religion != GOD_ASHENZARI) + if (!you_worship(GOD_ASHENZARI)) return 0; int portals_found = 0; diff --git a/crawl-ref/source/godprayer.cc b/crawl-ref/source/godprayer.cc index 75b21789f5..ca0da61723 100644 --- a/crawl-ref/source/godprayer.cc +++ b/crawl-ref/source/godprayer.cc @@ -205,12 +205,12 @@ static bool _altar_prayer() bool did_something = false; // donate gold to gain piety distributed over time - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) did_something = _zin_donate_gold(); // TSO blesses weapons with holy wrath, and long blades and demon // whips specially. - if (you.religion == GOD_SHINING_ONE + if (you_worship(GOD_SHINING_ONE) && !you.one_time_ability_used[GOD_SHINING_ONE] && !player_under_penance() && you.piety > 160) @@ -227,7 +227,7 @@ static bool _altar_prayer() } // Lugonu blesses weapons with distortion. - if (you.religion == GOD_LUGONU + if (you_worship(GOD_LUGONU) && !you.one_time_ability_used[GOD_LUGONU] && !player_under_penance() && you.piety > 160) @@ -239,7 +239,7 @@ static bool _altar_prayer() } // Kikubaaqudgha blesses weapons with pain, or gives you a Necronomicon. - if (you.religion == GOD_KIKUBAAQUDGHA + if (you_worship(GOD_KIKUBAAQUDGHA) && !you.one_time_ability_used[GOD_KIKUBAAQUDGHA] && !player_under_penance() && you.piety > 160) @@ -309,7 +309,7 @@ void pray() const god_type altar_god = feat_altar_god(grd(you.pos())); if (altar_god != GOD_NO_GOD) { - if (you.religion != GOD_NO_GOD && altar_god == you.religion) + if (!you_worship(GOD_NO_GOD) && altar_god == you.religion) something_happened = _altar_prayer(); else if (altar_god != GOD_NO_GOD) { @@ -327,7 +327,7 @@ void pray() } } - if (you.religion == GOD_NO_GOD) + if (you_worship(GOD_NO_GOD)) { const mon_holy_type holi = you.holiness(); @@ -342,13 +342,13 @@ void pray() mprf(MSGCH_PRAY, "You offer a prayer to %s.", god_name(you.religion).c_str()); - if (you.religion == GOD_FEDHAS && fedhas_fungal_bloom()) + if (you_worship(GOD_FEDHAS) && fedhas_fungal_bloom()) something_happened = true; // All sacrifices affect items you're standing on. something_happened |= _offer_items(); - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) mpr(getSpeakString("Xom prayer"), MSGCH_GOD); else if (player_under_penance()) simple_god_message(" demands penance!"); @@ -561,7 +561,7 @@ static bool _destroyed_valuable_weapon(int value, int type) static piety_gain_t _sac_corpse(const item_def& item) { - if (you.religion == GOD_OKAWARU) + if (you_worship(GOD_OKAWARU)) { monster dummy; dummy.type = (monster_type)(item.orig_monnum ? item.orig_monnum @@ -835,7 +835,7 @@ static bool _offer_items() } // Skip items you don't want to sacrifice right now. - if (you.religion == GOD_NEMELEX_XOBEH + if (you_worship(GOD_NEMELEX_XOBEH) && !check_nemelex_sacrificing_item_type(item)) { i = next; @@ -871,7 +871,7 @@ static bool _offer_items() num_sacced++; } - if (num_sacced > 0 && you.religion == GOD_NEMELEX_XOBEH) + if (num_sacced > 0 && you_worship(GOD_NEMELEX_XOBEH)) { const int new_leading = _leading_sacrifice_group(); if (old_leading != new_leading || one_chance_in(50)) @@ -896,17 +896,17 @@ static bool _offer_items() // sacrifices. else if (god_likes_fresh_corpses(you.religion)) simple_god_message(" only cares about fresh corpses!"); - else if (you.religion == GOD_BEOGH) + else if (you_worship(GOD_BEOGH)) simple_god_message(" only cares about orcish remains!"); - else if (you.religion == GOD_NEMELEX_XOBEH) + else if (you_worship(GOD_NEMELEX_XOBEH)) if (disliked_item->base_type == OBJ_GOLD) simple_god_message(" does not care about gold!"); else simple_god_message(" expects you to use your decks, not offer them!"); - else if (you.religion == GOD_ASHENZARI) + else if (you_worship(GOD_ASHENZARI)) simple_god_message(" can corrupt only scrolls of remove curse."); } - if (num_sacced == 0 && you.religion == GOD_ELYVILON) + if (num_sacced == 0 && you_worship(GOD_ELYVILON)) { mprf("There are no %sweapons here to destroy!", you.piety_max[GOD_ELYVILON] < piety_breakpoint(2) ? "" : "unholy or evil "); diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc index 297036d522..949d077ecd 100644 --- a/crawl-ref/source/godwrath.cc +++ b/crawl-ref/source/godwrath.cc @@ -498,7 +498,7 @@ static bool _yredelemnul_retribution() if (random2(you.experience_level) > 4) { - if (you.religion == god && coinflip() && yred_slaves_abandon_you()) + if (you_worship(god) && coinflip() && yred_slaves_abandon_you()) ; else { @@ -697,7 +697,7 @@ static bool _beogh_retribution() } case 3: // 25%, relatively harmless case 4: // in effect, only for penance - if (you.religion == god && beogh_followers_abandon_you()) + if (you_worship(god) && beogh_followers_abandon_you()) break; // else fall through default: // send orcs after you (3/8 to 5/8) @@ -1013,7 +1013,7 @@ static bool _fedhas_retribution() // We have 3 forms of retribution, but players under penance will be // spared the 'you are now surrounded by oklob plants, please die' one. - const int retribution_options = you.religion == GOD_FEDHAS ? 2 : 3; + const int retribution_options = you_worship(GOD_FEDHAS) ? 2 : 3; switch (random2(retribution_options)) { @@ -1280,13 +1280,13 @@ static bool _beogh_idol_revenge() // Beogh watches his charges closely, but for others doesn't always // notice. - if (you.religion == GOD_BEOGH + if (you_worship(GOD_BEOGH) || (player_genus(GENPC_ORCISH) && coinflip()) || one_chance_in(3)) { const char *revenge; - if (you.religion == GOD_BEOGH) + if (you_worship(GOD_BEOGH)) revenge = _get_beogh_speech("idol follower").c_str(); else if (player_genus(GENPC_ORCISH)) revenge = _get_beogh_speech("idol orc").c_str(); @@ -1305,7 +1305,7 @@ static void _tso_blasts_cleansing_flame(const char *message) { // TSO won't protect you from his own cleansing flame, and Xom is too // capricious to protect you from it. - if (you.religion != GOD_SHINING_ONE && you.religion != GOD_XOM + if (!you_worship(GOD_SHINING_ONE) && !you_worship(GOD_XOM) && !player_under_penance() && x_chance_in_y(you.piety, MAX_PIETY * 2)) { god_speaks(you.religion, @@ -1400,7 +1400,7 @@ static void _god_smites_you(god_type god, const char *message, // Your god won't protect you from his own smiting, and Xom is too // capricious to protect you from any god's smiting. - if (you.religion != god && you.religion != GOD_XOM + if (!you_worship(god) && !you_worship(GOD_XOM) && !player_under_penance() && x_chance_in_y(you.piety, MAX_PIETY * 2)) { god_speaks(you.religion, diff --git a/crawl-ref/source/hints.cc b/crawl-ref/source/hints.cc index f404411b58..084749ce3d 100644 --- a/crawl-ref/source/hints.cc +++ b/crawl-ref/source/hints.cc @@ -462,7 +462,7 @@ void hints_death_screen() { print_hint("death conjurer melee"); } - else if (you.religion == GOD_TROG && Hints.hints_berserk_counter <= 3 + else if (you_worship(GOD_TROG) && Hints.hints_berserk_counter <= 3 && !you.berserk() && !you.duration[DUR_EXHAUSTED]) { print_hint("death berserker unberserked"); @@ -649,7 +649,7 @@ static void _hints_healing_reminder() "<tiles>, or <w>click on the stat area</w> with your mouse</tiles>" "."; - if (you.hp < you.hp_max && you.religion == GOD_TROG + if (you.hp < you.hp_max && you_worship(GOD_TROG) && you.can_go_berserk()) { text += "\nAlso, berserking might help you not to lose so many " @@ -884,7 +884,7 @@ void hints_monster_seen(const monster& mon) if (mon.friendly()) learned_something_new(HINT_MONSTER_FRIENDLY, mon.pos()); - if (you.religion == GOD_TROG && you.can_go_berserk() + if (you_worship(GOD_TROG) && you.can_go_berserk() && one_chance_in(4)) { learned_something_new(HINT_CAN_BERSERK); @@ -1253,7 +1253,7 @@ void learned_something_new(hints_event_type seen_what, coord_def gc) cmd.push_back(CMD_MEMORISE_SPELL); cmd.push_back(CMD_CAST_SPELL); - if (you.religion == GOD_TROG) + if (you_worship(GOD_TROG)) { text << "\nAs a worshipper of " << god_name(GOD_TROG) @@ -1750,7 +1750,7 @@ void learned_something_new(hints_event_type seen_what, coord_def gc) "confirmation."; cmd.push_back(CMD_PRAY); - if (you.religion == GOD_NO_GOD + if (you_worship(GOD_NO_GOD) && Hints.hints_type == HINT_MAGIC_CHAR) { text << "\n\nThe best god for an unexperienced conjurer is " @@ -1848,7 +1848,7 @@ void learned_something_new(hints_event_type seen_what, coord_def gc) // A more detailed description of skills is given when you go past an // integer point. - if (you.religion == GOD_TROG) + if (you_worship(GOD_TROG)) { text << " Also, kills of demons and living creatures grant you " "favour in the eyes of Trog."; @@ -2337,7 +2337,7 @@ void learned_something_new(hints_event_type seen_what, coord_def gc) "you come back, so you might want to use a different set of " "stairs when you return."; - if (you.religion == GOD_TROG && you.can_go_berserk()) + if (you_worship(GOD_TROG) && you.can_go_berserk()) { text << "\nAlso, with " << apostrophise(god_name(you.religion)) @@ -2462,7 +2462,7 @@ void learned_something_new(hints_event_type seen_what, coord_def gc) break; case HINT_CONVERT: - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) return print_hint("HINT_CONVERT Xom"); print_hint("HINT_CONVERT"); @@ -2980,7 +2980,7 @@ void learned_something_new(hints_event_type seen_what, coord_def gc) listed.push_back("your set of mutations (<w>%</w>)"); cmd.push_back(CMD_DISPLAY_MUTATIONS); } - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) { listed.push_back("your religious standing (<w>%</w>)"); cmd.push_back(CMD_DISPLAY_RELIGION); @@ -3672,7 +3672,7 @@ void hints_describe_item(const item_def &item) } else // It's a spellbook! { - if (you.religion == GOD_TROG + if (you_worship(GOD_TROG) && (item.sub_type != BOOK_DESTRUCTION || !item_ident(item, ISFLAG_KNOW_TYPE))) { @@ -3871,7 +3871,7 @@ void hints_describe_item(const item_def &item) cmd.push_back(CMD_RESISTS_SCREEN); } - else if (you.religion == GOD_TROG) + else if (you_worship(GOD_TROG)) { ostr << "\n\nSeeing how " << god_name(GOD_TROG, false) @@ -4175,7 +4175,7 @@ static void _hints_describe_feature(int x, int y) "For other gods, you'll be able to join the faith " "by <w>p</w>raying at their altar."; } - else if (you.religion == GOD_NO_GOD) + else if (you_worship(GOD_NO_GOD)) { ostr << "This is your chance to join a religion! In " "general, the gods will help their followers, " @@ -4188,7 +4188,7 @@ static void _hints_describe_feature(int x, int y) "altar. Before taking up the responding faith " "you'll be asked for confirmation."; } - else if (you.religion == altar_god) + else if (you_worship(altar_god)) { // If we don't have anything to say, return early. return; @@ -4452,7 +4452,7 @@ void hints_describe_monster(const monster_info& mi, bool has_stat_desc) { ostr << "This might be a good time to run away"; - if (you.religion == GOD_TROG && you.can_go_berserk()) + if (you_worship(GOD_TROG) && you.can_go_berserk()) ostr << " or apply your Berserk <w>a</w>bility"; ostr << "."; } diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 599a4dea5d..b98195a6b8 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -1540,7 +1540,7 @@ void scorefile_entry::init(time_t dt) sh = player_shield_class(); god = you.religion; - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) { piety = you.piety; penance = you.penance[you.religion]; diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 7dfd61b3b6..b018553a6a 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -31,6 +31,7 @@ #include "libutil.h" #include "message.h" #include "player.h" +#include "religion.h" #include "shopping.h" #include "showsymb.h" #include "stuff.h" @@ -1695,7 +1696,7 @@ bool needs_handle_warning(const item_def &item, operation_types oper) if (oper == OPER_REMOVE && item.base_type == OBJ_JEWELLERY && item.sub_type == AMU_FAITH - && you.religion != GOD_NO_GOD) + && !you_worship(GOD_NO_GOD)) { return true; } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 179b53cc71..d3fbfd6cd6 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1873,7 +1873,7 @@ void zap_wand(int slot) break; case WAND_HEAL_WOUNDS: - if (you.religion == GOD_ELYVILON) + if (you_worship(GOD_ELYVILON)) { targ_mode = TARG_ANY; break; @@ -3022,7 +3022,7 @@ void read_scroll(int slot) break; case SCR_CURSE_ARMOUR: - if (you.religion == GOD_ASHENZARI + if (you_worship(GOD_ASHENZARI) && !any_items_to_select(OSEL_UNCURSED_WORN_ARMOUR, true)) { return; @@ -3030,7 +3030,7 @@ void read_scroll(int slot) break; case SCR_CURSE_JEWELLERY: - if (you.religion == GOD_ASHENZARI + if (you_worship(GOD_ASHENZARI) && !any_items_to_select(OSEL_UNCURSED_WORN_JEWELLERY, true)) { return; @@ -3273,7 +3273,7 @@ void read_scroll(int slot) bad_effect = true; } else - cancel_scroll = you.religion == GOD_ASHENZARI; + cancel_scroll = you_worship(GOD_ASHENZARI); break; @@ -3283,7 +3283,7 @@ void read_scroll(int slot) if (is_good_god(you.religion)) { - pow += (you.religion == GOD_SHINING_ONE) ? you.piety : + pow += (you_worship(GOD_SHINING_ONE)) ? you.piety : you.piety / 2; } diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index f1ad195f86..17d4a4c273 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -2873,7 +2873,7 @@ bool is_emergency_item(const item_def &item) switch (item.sub_type) { case WAND_HASTING: - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) return false; case WAND_HEAL_WOUNDS: case WAND_TELEPORTATION: @@ -2902,7 +2902,7 @@ bool is_emergency_item(const item_def &item) switch (item.sub_type) { case POT_SPEED: - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) return false; case POT_CURING: case POT_HEAL_WOUNDS: @@ -2965,7 +2965,7 @@ bool is_bad_item(const item_def &item, bool temp) if (you.species == SP_FELID) return false; case SCR_CURSE_JEWELLERY: - return (you.religion != GOD_ASHENZARI); + return (!you_worship(GOD_ASHENZARI)); default: return false; } @@ -3083,7 +3083,7 @@ static bool _invisibility_is_useless(const bool temp) { // If you're Corona'd or a TSO-ite, this is always useless. return (temp ? you.backlit(true) - : you.haloed() && you.religion == GOD_SHINING_ONE); + : you.haloed() && you_worship(GOD_SHINING_ONE)); } @@ -3175,7 +3175,7 @@ bool is_useless_item(const item_def &item, bool temp) case SCR_TELEPORTATION: return crawl_state.game_is_sprint(); case SCR_AMNESIA: - return (you.religion == GOD_TROG); + return (you_worship(GOD_TROG)); case SCR_RECHARGING: case SCR_CURSE_WEAPON: // for non-Ashenzari, already handled case SCR_CURSE_ARMOUR: @@ -3330,7 +3330,7 @@ bool is_useless_item(const item_def &item, bool temp) #endif case RING_WIZARDRY: - return (you.religion == GOD_TROG); + return (you_worship(GOD_TROG)); case RING_TELEPORT_CONTROL: return crawl_state.game_is_zotdef(); @@ -3356,7 +3356,7 @@ bool is_useless_item(const item_def &item, bool temp) case OBJ_STAVES: if (you.species == SP_FELID) return true; - if (you.religion == GOD_TROG) + if (you_worship(GOD_TROG)) return true; if (!item_type_known(item)) return false; @@ -3390,7 +3390,7 @@ bool is_useless_item(const item_def &item, bool temp) if (food_is_meaty(item) && you.has_spell(SPELL_SIMULACRUM)) return false; - if (is_fruit(item) && you.religion == GOD_FEDHAS) + if (is_fruit(item) && you_worship(GOD_FEDHAS)) return false; return true; @@ -3408,7 +3408,7 @@ bool is_useless_item(const item_def &item, bool temp) if (you.has_spell(SPELL_ANIMATE_DEAD) || you.has_spell(SPELL_ANIMATE_SKELETON) - || you.religion == GOD_YREDELEMNUL && !you.penance[GOD_YREDELEMNUL] + || you_worship(GOD_YREDELEMNUL) && !you.penance[GOD_YREDELEMNUL] && you.piety >= piety_breakpoint(0)) { return false; diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index d8786c4ad9..8271bf12f7 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -563,7 +563,7 @@ void do_uncurse_item(item_def &item, bool inscribe, bool no_ash, return; } - if (no_ash && you.religion == GOD_ASHENZARI) + if (no_ash && you_worship(GOD_ASHENZARI)) { simple_god_message(" preserves the curse."); return; @@ -1311,7 +1311,7 @@ bool is_enchantable_armour(const item_def &arm, bool uncurse, bool unknown) // Artefacts or highly enchanted armour cannot be enchanted, only // uncursed. if (is_artefact(arm) || arm.plus >= armour_max_enchant(arm)) - return (uncurse && arm.cursed() && you.religion != GOD_ASHENZARI); + return (uncurse && arm.cursed() && !you_worship(GOD_ASHENZARI)); return true; } @@ -1703,7 +1703,7 @@ static bool _item_is_swappable(const item_def &item, equipment_type slot, bool s if (item.base_type == OBJ_JEWELLERY) { - if (item.sub_type == AMU_FAITH && you.religion != GOD_NO_GOD) + if (item.sub_type == AMU_FAITH && !you_worship(GOD_NO_GOD)) return false; return !((item.sub_type == AMU_THE_GOURMAND && !swap_in) || item.sub_type == AMU_GUARDIAN_SPIRIT @@ -2877,10 +2877,10 @@ void seen_item(const item_def &item) } // major hack. Deconstify should be safe here, but it's still repulsive. - if (you.religion == GOD_ASHENZARI) + if (you_worship(GOD_ASHENZARI)) ((item_def*)&item)->flags |= ISFLAG_KNOW_CURSE; if (item.base_type == OBJ_GOLD && !item.plus) - ((item_def*)&item)->plus = (you.religion == GOD_ZIN) ? 2 : 1; + ((item_def*)&item)->plus = (you_worship(GOD_ZIN)) ? 2 : 1; if (item_type_has_ids(item.base_type) && !is_artefact(item) && item_ident(item, ISFLAG_KNOW_TYPE) diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index fc8c8116d0..b1a15f9d6c 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1543,7 +1543,7 @@ static void _got_gold(item_def& item, int quant, bool quiet) { you.attribute[ATTR_GOLD_FOUND] += quant; - if (you.religion == GOD_ZIN && !(item.flags & ISFLAG_THROWN)) + if (you_worship(GOD_ZIN) && !(item.flags & ISFLAG_THROWN)) quant -= zin_tithe(item, quant, quiet); if (quant <= 0) return; @@ -1761,7 +1761,7 @@ int move_item_to_player(int obj, int quant_got, bool quiet, mpr("The lords of Pandemonium are not amused. Beware!", MSGCH_WARN); - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) simple_god_message(" tells them not to hurry."); mpr("Now all you have to do is get back out of the dungeon!", MSGCH_ORB); @@ -2773,7 +2773,7 @@ static bool _interesting_explore_pickup(const item_def& item) return _item_different_than_inv(item, _similar_jewellery); case OBJ_FOOD: - if (you.religion == GOD_FEDHAS && is_fruit(item)) + if (you_worship(GOD_FEDHAS) && is_fruit(item)) return true; if (is_inedible(item)) @@ -3222,7 +3222,7 @@ bool item_def::is_greedy_sacrificeable() const if (!god_likes_items(you.religion, true)) return false; - if (you.religion == GOD_NEMELEX_XOBEH + if (you_worship(GOD_NEMELEX_XOBEH) && !check_nemelex_sacrificing_item_type(*this) || flags & (ISFLAG_DROPPED | ISFLAG_THROWN) || item_is_stationary(*this)) diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index f184c20072..33251123a2 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -574,16 +574,16 @@ static void _announce_goal_message() static void _god_greeting_message(bool game_start) { - if (you.religion == GOD_NO_GOD) + if (you_worship(GOD_NO_GOD)) return; string msg = god_name(you.religion); - if (brdepth[BRANCH_ABYSS] == -1 && you.religion == GOD_LUGONU) + if (brdepth[BRANCH_ABYSS] == -1 && you_worship(GOD_LUGONU)) msg += " welcome"; else if (game_start) msg += " newgame"; - else if (you.religion == GOD_XOM) + else if (you_worship(GOD_XOM)) { if (you.gift_timeout <= 1) msg += " bored"; @@ -791,7 +791,7 @@ static void _do_wizard_command(int wiz_command, bool silent_fail) int result = 0; do { - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) result = xom_acts(abs(you.piety - HALF_MAX_PIETY)); else result = xom_acts(coinflip(), random_range(0, HALF_MAX_PIETY)); @@ -935,7 +935,7 @@ static void _start_running(int dir, int mode) for (adjacent_iterator ai(next_pos); ai; ++ai) { if (env.grid(*ai) == DNGN_SLIMY_WALL - && (you.religion != GOD_JIYVA || you.penance[GOD_JIYVA])) + && (!you_worship(GOD_JIYVA) || you.penance[GOD_JIYVA])) { mpr("You're about to run into the slime covered wall!", MSGCH_WARN); @@ -2165,7 +2165,7 @@ static void _prep_input() if (you.seen_portals) { - ASSERT(you.religion == GOD_ASHENZARI); + ASSERT(you_worship(GOD_ASHENZARI)); if (you.seen_portals == 1) mpr("You have a vision of a gate.", MSGCH_GOD); else @@ -2717,7 +2717,7 @@ static void _decrement_durations() { // Note the beauty of Trog! They get an extra save that's at // the very least 20% and goes up to 100%. - if (you.religion == GOD_TROG && x_chance_in_y(you.piety, 150) + if (you_worship(GOD_TROG) && x_chance_in_y(you.piety, 150) && !player_under_penance()) { mpr("Trog's vigour flows through your veins."); @@ -2856,7 +2856,7 @@ static void _decrement_durations() { int resilience = 400; - if (you.religion == GOD_CHEIBRIADOS && you.piety >= piety_breakpoint(0)) + if (you_worship(GOD_CHEIBRIADOS) && you.piety >= piety_breakpoint(0)) resilience = resilience * 3 / 2; // Faster rotting when hungry. @@ -3317,7 +3317,7 @@ static void _player_reacts() update_stat_zero(); // XOM now ticks from here, to increase his reaction time to tension. - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) xom_tick(); } @@ -3332,10 +3332,10 @@ static void _player_reacts_to_monsters() manage_fire_shield(you.time_taken); // penance checked there (as you can have antennae too) - if (player_mutation_level(MUT_ANTENNAE) || you.religion == GOD_ASHENZARI) + if (player_mutation_level(MUT_ANTENNAE) || you_worship(GOD_ASHENZARI)) check_antennae_detect(); - if ((you.religion == GOD_ASHENZARI && !player_under_penance()) + if ((you_worship(GOD_ASHENZARI) && !player_under_penance()) || you.mutation[MUT_JELLY_GROWTH]) { detect_items(-1); @@ -3532,7 +3532,7 @@ void world_reacts() } #if defined(DEBUG_TENSION) || defined(DEBUG_RELIGION) - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) mprf(MSGCH_DIAGNOSTICS, "TENSION = %d", get_tension()); #endif @@ -4702,7 +4702,7 @@ static void _move_player(coord_def move) mpr("The ferocious winds and tides of the open sea thwart your progress."); else if (grd(targ) == DNGN_LAVA_SEA) mpr("The endless sea of lava is not a nice place."); - else if (feat_is_tree(grd(targ)) && you.religion == GOD_FEDHAS) + else if (feat_is_tree(grd(targ)) && you_worship(GOD_FEDHAS)) mpr("You cannot walk through the dense trees."); stop_running(); @@ -4734,7 +4734,7 @@ static void _move_player(coord_def move) apply_berserk_penalty = !attacking; - if (!attacking && you.religion == GOD_CHEIBRIADOS && one_chance_in(10) + if (!attacking && you_worship(GOD_CHEIBRIADOS) && one_chance_in(10) && you.run()) { did_god_conduct(DID_HASTY, 1, true); diff --git a/crawl-ref/source/map_knowledge.cc b/crawl-ref/source/map_knowledge.cc index d10add9505..901ea07af9 100644 --- a/crawl-ref/source/map_knowledge.cc +++ b/crawl-ref/source/map_knowledge.cc @@ -12,6 +12,7 @@ #include "mon-util.h" #include "notes.h" #include "options.h" +#include "religion.h" #include "show.h" #include "terrain.h" #ifdef USE_TILE @@ -89,8 +90,8 @@ static void _automap_from(int x, int y, int mutated) if (mutated) { magic_mapping(8 * mutated, - you.religion == GOD_ASHENZARI ? 25 + you.piety / 8 : 25, - true, you.religion == GOD_ASHENZARI, + you_worship(GOD_ASHENZARI) ? 25 + you.piety / 8 : 25, + true, you_worship(GOD_ASHENZARI), true, coord_def(x,y)); } } @@ -100,7 +101,7 @@ static int _map_quality() int passive = player_mutation_level(MUT_PASSIVE_MAPPING); // the explanation of this 51 vs max_piety of 200 is left as // an exercise to the reader - if (you.religion == GOD_ASHENZARI && !player_under_penance()) + if (you_worship(GOD_ASHENZARI) && !player_under_penance()) passive = max(passive, you.piety / 51); return passive; } diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc index 89b8696bb0..3391e5ab9d 100644 --- a/crawl-ref/source/melee_attack.cc +++ b/crawl-ref/source/melee_attack.cc @@ -530,7 +530,7 @@ bool melee_attack::handle_phase_hit() Hints.hints_melee_counter++; // TODO: Remove this (placed here so I can get rid of player_attack) - if (you.religion == GOD_BEOGH + if (you_worship(GOD_BEOGH) && mons_genus(defender->mons_species()) == MONS_ORC && !defender->is_summoned() && !defender->as_monster()->is_shapeshifter() @@ -1789,7 +1789,7 @@ int melee_attack::player_apply_weapon_bonuses(int damage) if (get_equip_race(*weapon) == ISFLAG_ORCISH && player_genus(GENPC_ORCISH)) { - if (you.religion == GOD_BEOGH && !player_under_penance()) + if (you_worship(GOD_BEOGH) && !player_under_penance()) { #ifdef DEBUG_DIAGNOSTICS const int orig_damage = damage; @@ -3846,7 +3846,7 @@ int melee_attack::calc_to_hit(bool random) mhit += (random && coinflip() ? 2 : 1); } else if (get_equip_race(*weapon) == ISFLAG_ORCISH - && you.religion == GOD_BEOGH && !player_under_penance()) + && you_worship(GOD_BEOGH) && !player_under_penance()) { mhit++; } diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 48ca1adaec..68835d3ebc 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1251,7 +1251,7 @@ void search_around() int skill = (2/(1+exp(-(base_skill+120)/325.0))-1) * 225 + (base_skill/200.0) + 15; - if (you.religion == GOD_ASHENZARI && !player_under_penance()) + if (you_worship(GOD_ASHENZARI) && !player_under_penance()) skill += you.piety * 2; if (you.duration[DUR_SWIFTNESS]) @@ -1411,7 +1411,7 @@ bool go_berserk(bool intentional, bool potion) mpr("Finesse? Hah! Time to rip out guts!"); } - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) { // Che makes berserk not speed you up. // Unintentional would be forgiven "just this once" every time. @@ -2271,7 +2271,7 @@ bool bad_attack(const monster *mon, string& adj, string& suffix) if (mon->friendly()) { - if (you.religion == GOD_OKAWARU) + if (you_worship(GOD_OKAWARU)) { adj = "your ally "; @@ -2285,7 +2285,7 @@ bool bad_attack(const monster *mon, string& adj, string& suffix) } if (is_unchivalric_attack(&you, mon) - && you.religion == GOD_SHINING_ONE + && you_worship(GOD_SHINING_ONE) && !tso_unchivalric_attack_safe_monster(mon)) { adj += "helpless "; @@ -2295,7 +2295,7 @@ bool bad_attack(const monster *mon, string& adj, string& suffix) else if (mon->wont_attack()) adj += "non-hostile "; - if (you.religion == GOD_JIYVA && mons_is_slime(mon) + if (you_worship(GOD_JIYVA) && mons_is_slime(mon) && !(mon->is_shapeshifter() && (mon->flags & MF_KNOWN_SHIFTER))) { return true; diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index eb2fe75981..7014c6067a 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -4531,7 +4531,7 @@ void activate_ballistomycetes(monster* mons, const coord_def& origin, set<position_node> visited; vector<set<position_node>::iterator > candidates; - if (you.religion == GOD_FEDHAS) + if (you_worship(GOD_FEDHAS)) { if (non_activable_count == 0 && ballisto_count == 0 diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 3953f9b37c..76d2cfddfc 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -2077,7 +2077,7 @@ void handle_monster_move(monster* mons) // Keep neutral, charmed, summoned monsters from picking up stuff. // Same for friendlies if friendly_pickup is set to "none". if ((!mons->neutral() && !mons->has_ench(ENCH_CHARM) - || (you.religion == GOD_JIYVA && mons_is_slime(mons))) + || (you_worship(GOD_JIYVA) && mons_is_slime(mons))) && !mons->is_summoned() && !mons->is_perm_summoned() && (!mons->friendly() || you.friendly_pickup != FRIENDLY_PICKUP_NONE)) @@ -2581,7 +2581,7 @@ static bool _monster_eat_item(monster* mons, bool nearby) return false; // Friendly jellies won't eat (unless worshipping Jiyva). - if (mons->friendly() && you.religion != GOD_JIYVA) + if (mons->friendly() && !you_worship(GOD_JIYVA)) return false; // Off-limit squares are off-limit. @@ -2657,7 +2657,7 @@ static bool _monster_eat_item(monster* mons, bool nearby) shown_msg = true; } - if (you.religion == GOD_JIYVA) + if (you_worship(GOD_JIYVA)) { gain = sacrifice_item_stack(*si, &js, quant); if (gain > PIETY_NONE) @@ -4038,7 +4038,7 @@ static void _heated_area(monster* mons) return; // HACK: Currently this prevents even auras not caused by lava orcs... - if (you.religion == GOD_BEOGH && mons->friendly() && mons->god == GOD_BEOGH) + if (you_worship(GOD_BEOGH) && mons->friendly() && mons->god == GOD_BEOGH) return; const int base_damage = random2(11); diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc index 9c03711a3e..7cd4581978 100644 --- a/crawl-ref/source/mon-behv.cc +++ b/crawl-ref/source/mon-behv.cc @@ -29,6 +29,7 @@ #include "mon-stuff.h" #include "ouch.h" #include "random.h" +#include "religion.h" #include "spl-summoning.h" #include "state.h" #include "terrain.h" @@ -890,7 +891,7 @@ void handle_behaviour(monster* mon) } if (mon->strict_neutral() && mons_is_slime(mon) - && you.religion == GOD_JIYVA) + && you_worship(GOD_JIYVA)) { set_random_slime_target(mon); } diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc index ce296979e5..ea4b409a21 100644 --- a/crawl-ref/source/mon-cast.cc +++ b/crawl-ref/source/mon-cast.cc @@ -2837,7 +2837,7 @@ static int _monster_abjure_square(const coord_def &pos, // TSO and Trog's abjuration protection. bool shielded = false; - if (you.religion == GOD_SHINING_ONE) + if (you_worship(GOD_SHINING_ONE)) { pow = pow * (30 - target->hit_dice) / 30; if (pow < duration) @@ -2847,7 +2847,7 @@ static int _monster_abjure_square(const coord_def &pos, shielded = true; } } - else if (you.religion == GOD_TROG) + else if (you_worship(GOD_TROG)) { pow = pow * 4 / 5; if (pow < duration) diff --git a/crawl-ref/source/mon-death.cc b/crawl-ref/source/mon-death.cc index 807cdcb9c4..4d2553bf4a 100644 --- a/crawl-ref/source/mon-death.cc +++ b/crawl-ref/source/mon-death.cc @@ -357,7 +357,7 @@ void elven_twins_pacify(monster* twin) ASSERT(!mons->neutral()); - if (you.religion == GOD_ELYVILON) + if (you_worship(GOD_ELYVILON)) gain_piety(random2(mons->max_hit_points / (2 + you.piety / 20)), 2); if (mons_near(mons)) diff --git a/crawl-ref/source/mon-info.cc b/crawl-ref/source/mon-info.cc index f76d5a595f..73517ff19d 100644 --- a/crawl-ref/source/mon-info.cc +++ b/crawl-ref/source/mon-info.cc @@ -672,7 +672,7 @@ monster_info::monster_info(const monster* m, int milev) { case ATT_NEUTRAL: case ATT_HOSTILE: - if (you.religion == GOD_SHINING_ONE + if (you_worship(GOD_SHINING_ONE) && !tso_unchivalric_attack_safe_monster(m) && is_unchivalric_attack(&you, m)) { diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc index ed81bcc72b..7fda5d1cd1 100644 --- a/crawl-ref/source/mon-place.cc +++ b/crawl-ref/source/mon-place.cc @@ -384,7 +384,7 @@ void spawn_random_monsters() rate = (you.char_direction == GDT_DESCENDING) ? _scale_spawn_parameter(rate, 6 * rate, 0) - : (you.religion == GOD_CHEIBRIADOS) ? 16 : 8; + : (you_worship(GOD_CHEIBRIADOS)) ? 16 : 8; if (rate == 0) { @@ -400,7 +400,7 @@ void spawn_random_monsters() // the player is unlikely to meet all of them and notice this. if (you.char_direction != GDT_GAME_START) rate = 5; - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) rate *= 2; } @@ -3033,7 +3033,7 @@ void mark_interesting_monst(monster* mons, beh_type behaviour) else if (behaviour == BEH_FRIENDLY) interesting = false; // Jellies are never interesting to Jiyva. - else if (mons->type == MONS_JELLY && you.religion == GOD_JIYVA) + else if (mons->type == MONS_JELLY && you_worship(GOD_JIYVA)) interesting = false; else if (mons_threat_level(mons) == MTHRT_NASTY) interesting = true; @@ -3303,7 +3303,7 @@ bool can_spawn_mushrooms(coord_def where) return true; cloud_struct &cloud = env.cloud[env.cgrid(where)]; - if (you.religion == GOD_FEDHAS + if (you_worship(GOD_FEDHAS) && (cloud.whose == KC_YOU || cloud.whose == KC_FRIENDLY)) { return true; @@ -3330,7 +3330,7 @@ conduct_type player_will_anger_monster(monster* mon) return DID_UNHOLY; if (is_good_god(you.religion) && mon->is_evil()) return DID_NECROMANCY; - if (you.religion == GOD_FEDHAS + if (you_worship(GOD_FEDHAS) && ((mon->holiness() == MH_UNDEAD && !mon->is_insubstantial()) || mon->has_corpse_violating_spell())) { @@ -3338,14 +3338,14 @@ conduct_type player_will_anger_monster(monster* mon) } if (is_evil_god(you.religion) && mon->is_holy()) return DID_HOLY; - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) { if (mon->is_unclean()) return DID_UNCLEAN; if (mon->is_chaotic()) return DID_CHAOS; } - if (you.religion == GOD_TROG && mon->is_actual_spellcaster()) + if (you_worship(GOD_TROG) && mon->is_actual_spellcaster()) return DID_SPELL_CASTING; return DID_NOTHING; diff --git a/crawl-ref/source/mon-speak.cc b/crawl-ref/source/mon-speak.cc index eac38117e5..710abc9042 100644 --- a/crawl-ref/source/mon-speak.cc +++ b/crawl-ref/source/mon-speak.cc @@ -506,7 +506,7 @@ bool mons_speaks(monster* mons) // Add Beogh to list of prefixes for orcs (hostile and friendly) if you // worship Beogh. (This assumes your being an orc, so might have odd // results in wizard mode.) Don't count charmed or summoned orcs. - if (you.religion == GOD_BEOGH && mons_genus(mons->type) == MONS_ORC) + if (you_worship(GOD_BEOGH) && mons_genus(mons->type) == MONS_ORC) { if (!mons->has_ench(ENCH_CHARM) && !mons->is_summoned()) { diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc index e60b64c0e5..19d48a7c91 100644 --- a/crawl-ref/source/mon-stuff.cc +++ b/crawl-ref/source/mon-stuff.cc @@ -109,7 +109,7 @@ bool mimic_at(const coord_def &c) bool curse_an_item(bool quiet) { // allowing these would enable mummy scumming - if (you.religion == GOD_ASHENZARI) + if (you_worship(GOD_ASHENZARI)) { if (!quiet) { @@ -566,7 +566,7 @@ static void _give_monster_experience(int experience, int killer_index) if (mon->gain_exp(experience)) { - if (you.religion != GOD_SHINING_ONE && you.religion != GOD_BEOGH + if (!you_worship(GOD_SHINING_ONE) && !you_worship(GOD_BEOGH) || player_under_penance() || !one_chance_in(3)) { @@ -574,9 +574,9 @@ static void _give_monster_experience(int experience, int killer_index) } // Randomly bless the follower who gained experience. - if (you.religion == GOD_SHINING_ONE + if (you_worship(GOD_SHINING_ONE) && random2(you.piety) >= piety_breakpoint(0) - || you.religion == GOD_BEOGH + || you_worship(GOD_BEOGH) && random2(you.piety) >= piety_breakpoint(2)) { bless_follower(mon); @@ -689,7 +689,7 @@ static void _give_player_experience(int experience, killer_type killer, if (exp_gain > 0 && !was_visible) mpr("You feel a bit more experienced."); - if (kc == KC_YOU && you.religion == GOD_BEOGH) + if (kc == KC_YOU && you_worship(GOD_BEOGH)) _beogh_spread_experience(experience / 2); } @@ -751,7 +751,7 @@ int exp_rate(int killer) // your allies. static bool _ely_protect_ally(monster* mons, killer_type killer) { - if (you.religion != GOD_ELYVILON) + if (!you_worship(GOD_ELYVILON)) return false; if (!MON_KILL(killer) && !YOU_KILL(killer)) @@ -821,7 +821,7 @@ static bool _ely_heal_monster(monster* mons, killer_type killer, int i) static bool _yred_enslave_soul(monster* mons, killer_type killer) { - if (you.religion == GOD_YREDELEMNUL && mons_enslaved_body_and_soul(mons) + if (you_worship(GOD_YREDELEMNUL) && mons_enslaved_body_and_soul(mons) && mons_near(mons) && killer != KILL_RESET && killer != KILL_DISMISSED && killer != KILL_BANISHED) @@ -838,7 +838,7 @@ static bool _yred_enslave_soul(monster* mons, killer_type killer) static bool _beogh_forcibly_convert_orc(monster* mons, killer_type killer, int i) { - if (you.religion == GOD_BEOGH + if (you_worship(GOD_BEOGH) && mons_genus(mons->type) == MONS_ORC && !mons->is_summoned() && !mons->is_shapeshifter() && !player_under_penance() && you.piety >= piety_breakpoint(2) @@ -921,7 +921,7 @@ static bool _monster_avoided_death(monster* mons, killer_type killer, int i) static void _jiyva_died() { - if (you.religion == GOD_JIYVA) + if (you_worship(GOD_JIYVA)) return; add_daction(DACT_REMOVE_JIYVA_ALTARS); @@ -1038,7 +1038,7 @@ static void _mummy_curse(monster* mons, killer_type killer, int index) && YOU_KILL(killer)) { // Kiku protects you from ordinary mummy curses. - if (you.religion == GOD_KIKUBAAQUDGHA && !player_under_penance() + if (you_worship(GOD_KIKUBAAQUDGHA) && !player_under_penance() && you.piety >= piety_breakpoint(1)) { simple_god_message(" averts the curse."); @@ -1669,7 +1669,7 @@ int monster_die(monster* mons, killer_type killer, // Various sources of berserk extension on kills. if (killer == KILL_YOU && you.berserk()) { - if (you.religion == GOD_TROG + if (you_worship(GOD_TROG) && !player_under_penance() && you.piety > random2(1000)) { const int bonus = (3 + random2avg(10, 2)) / 2; @@ -1848,8 +1848,8 @@ int monster_die(monster* mons, killer_type killer, || mons->type == MONS_ABOMINATION_LARGE || mons->type == MONS_CRAWLING_CORPSE || mons->type == MONS_MACABRE_MASS) - && (you.religion == GOD_TROG - || you.religion == GOD_KIKUBAAQUDGHA)) + && (you_worship(GOD_TROG) + || you_worship(GOD_KIKUBAAQUDGHA))) { targ_holy = MH_DEMONIC; } @@ -2009,8 +2009,8 @@ int monster_die(monster* mons, killer_type killer, // Divine health and mana restoration doesn't happen when // killing born-friendly monsters. if (good_kill - && (you.religion == GOD_MAKHLEB - || you.religion == GOD_SHINING_ONE + && (you_worship(GOD_MAKHLEB) + || you_worship(GOD_SHINING_ONE) && (mons->is_evil() || mons->is_unholy())) && !mons_is_object(mons->type) && !player_under_penance() @@ -2019,7 +2019,7 @@ int monster_die(monster* mons, killer_type killer, { if (you.hp < you.hp_max) { - int heal = (you.religion == GOD_MAKHLEB) ? + int heal = (you_worship(GOD_MAKHLEB)) ? mons->hit_dice + random2(mons->hit_dice) : random2(1 + 2 * mons->hit_dice); if (heal > 0) @@ -2029,8 +2029,8 @@ int monster_die(monster* mons, killer_type killer, } if (good_kill - && (you.religion == GOD_VEHUMET - || you.religion == GOD_SHINING_ONE + && (you_worship(GOD_VEHUMET) + || you_worship(GOD_SHINING_ONE) && (mons->is_evil() || mons->is_unholy())) && !mons_is_object(mons->type) && !player_under_penance() @@ -2040,7 +2040,7 @@ int monster_die(monster* mons, killer_type killer, you.magic_points < you.max_magic_points : you.hp < you.hp_max) { - int mana = (you.religion == GOD_VEHUMET) ? + int mana = (you_worship(GOD_VEHUMET)) ? 1 + random2(mons->hit_dice / 2) : random2(2 + mons->hit_dice / 3); if (mana > 0) @@ -2054,7 +2054,7 @@ int monster_die(monster* mons, killer_type killer, // Randomly bless a follower. if (!created_friendly && gives_xp - && (you.religion == GOD_BEOGH + && (you_worship(GOD_BEOGH) && random2(you.piety) >= piety_breakpoint(2)) && !mons_is_object(mons->type) && !player_under_penance()) @@ -2122,12 +2122,12 @@ int monster_die(monster* mons, killer_type killer, const mon_holy_type killer_holy = anon ? MH_NATURAL : killer_mon->holiness(); - if (you.religion == GOD_ZIN - || you.religion == GOD_SHINING_ONE - || you.religion == GOD_YREDELEMNUL - || you.religion == GOD_KIKUBAAQUDGHA - || you.religion == GOD_MAKHLEB - || you.religion == GOD_LUGONU + if (you_worship(GOD_ZIN) + || you_worship(GOD_SHINING_ONE) + || you_worship(GOD_YREDELEMNUL) + || you_worship(GOD_KIKUBAAQUDGHA) + || you_worship(GOD_MAKHLEB) + || you_worship(GOD_LUGONU) || !anon && mons_is_god_gift(killer_mon)) { if (killer_holy == MH_UNDEAD) @@ -2265,7 +2265,7 @@ int monster_die(monster* mons, killer_type killer, mons->hit_dice, true, mons); } - if (you.religion == GOD_SHINING_ONE + if (you_worship(GOD_SHINING_ONE) && (mons->is_evil() || mons->is_unholy()) && !player_under_penance() && random2(you.piety) >= piety_breakpoint(0) @@ -2287,7 +2287,7 @@ int monster_die(monster* mons, killer_type killer, } } - if (you.religion == GOD_BEOGH + if (you_worship(GOD_BEOGH) && random2(you.piety) >= piety_breakpoint(2) && !player_under_penance() && !one_chance_in(3) @@ -2866,7 +2866,7 @@ static bool _is_poly_power_unsuitable(poly_power_type power, static bool _jiyva_slime_target(monster_type targetc) { - return (you.religion == GOD_JIYVA + return (you_worship(GOD_JIYVA) && (targetc == MONS_DEATH_OOZE || targetc == MONS_OOZE || targetc == MONS_JELLY @@ -2966,7 +2966,7 @@ void change_monster_type(monster* mons, monster_type targetc) const god_type god = (player_will_anger_monster(real_targetc) - || (you.religion == GOD_BEOGH + || (you_worship(GOD_BEOGH) && mons_genus(real_targetc) != MONS_ORC)) ? GOD_NO_GOD : mons->god; @@ -3858,7 +3858,7 @@ static bool _mons_avoids_cloud(const monster* mons, const cloud_struct& cloud, if (!extra_careful && mons->berserk_or_insane()) return false; - if (you.religion == GOD_FEDHAS && fedhas_protects(mons) + if (you_worship(GOD_FEDHAS) && fedhas_protects(mons) && (cloud.whose == KC_YOU || cloud.whose == KC_FRIENDLY) && (mons->friendly() || mons->neutral())) { @@ -5116,7 +5116,7 @@ bool temperature_effect(int which) case LORC_PASSIVE_HEAT: return (temperature() >= TEMP_FIRE); // 13-15 case LORC_HEAT_AURA: - if (you.religion == GOD_BEOGH) + if (you_worship(GOD_BEOGH)) return false; // Deliberate fall-through. case LORC_NO_SCROLLS: diff --git a/crawl-ref/source/mon-transit.cc b/crawl-ref/source/mon-transit.cc index 1a87d98a6a..54550a6b0a 100644 --- a/crawl-ref/source/mon-transit.cc +++ b/crawl-ref/source/mon-transit.cc @@ -346,9 +346,9 @@ void follower::restore_mons_items(monster& m) static bool _is_religious_follower(const monster* mon) { - return ((you.religion == GOD_YREDELEMNUL - || you.religion == GOD_BEOGH - || you.religion == GOD_FEDHAS) + return ((you_worship(GOD_YREDELEMNUL) + || you_worship(GOD_BEOGH) + || you_worship(GOD_FEDHAS)) && is_follower(mon)); } diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 5b2f4059ee..d6137048ed 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -767,7 +767,7 @@ bool mons_is_sensed(monster_type mc) bool mons_allows_beogh(const monster* mon) { - if (!player_genus(GENPC_ORCISH) || you.religion == GOD_BEOGH) + if (!player_genus(GENPC_ORCISH) || you_worship(GOD_BEOGH)) return false; // no one else gives a damn return mons_genus(mon->type) == MONS_ORC diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index b1060eb8f4..b5018425b9 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -1501,7 +1501,7 @@ bool mutate(mutation_type which_mutation, const string &reason, bool failMsg, } // Zin's protection. - if (you.religion == GOD_ZIN + if (you_worship(GOD_ZIN) && (x_chance_in_y(you.piety, MAX_PIETY) || x_chance_in_y(you.piety, MAX_PIETY + 22))) { @@ -1721,7 +1721,7 @@ bool mutate(mutation_type which_mutation, const string &reason, bool failMsg, break; case MUT_DEMONIC_GUARDIAN: - if (you.religion == GOD_OKAWARU) + if (you_worship(GOD_OKAWARU)) { mpr("Your demonic guardian will not assist you as long as you " "worship Okawaru.", MSGCH_MUTATION); @@ -2502,7 +2502,7 @@ static bool _balance_demonic_guardian() void check_demonic_guardian() { // Don't spawn guardians with Oka, they're a huge pain. - if (you.religion == GOD_OKAWARU) + if (you_worship(GOD_OKAWARU)) return; const int mutlevel = player_mutation_level(MUT_DEMONIC_GUARDIAN); @@ -2550,7 +2550,7 @@ void check_demonic_guardian() void check_antennae_detect() { int radius = player_mutation_level(MUT_ANTENNAE) * 2; - if (you.religion == GOD_ASHENZARI && !player_under_penance()) + if (you_worship(GOD_ASHENZARI) && !player_under_penance()) radius = max(radius, you.piety / 20); if (radius <= 0) return; @@ -2583,7 +2583,7 @@ void check_antennae_detect() if (mon->friendly()) mc = MONS_SENSED_FRIENDLY; - else if (you.religion == GOD_ASHENZARI + else if (you_worship(GOD_ASHENZARI) && !player_under_penance()) { mc = ash_monster_tier(mon); diff --git a/crawl-ref/source/ng-setup.cc b/crawl-ref/source/ng-setup.cc index c1dcaff26d..96a321d53e 100644 --- a/crawl-ref/source/ng-setup.cc +++ b/crawl-ref/source/ng-setup.cc @@ -1009,11 +1009,11 @@ static void _give_items_skills(const newgame_def& ng) you.skills[SK_SHIELDS] = 0; } - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) { you.worshipped[you.religion] = 1; set_god_ability_slots(); - if (you.religion != GOD_XOM) + if (!you_worship(GOD_XOM)) you.piety_max[you.religion] = you.piety; } } diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 5e34c5f9dc..645839aae3 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -488,7 +488,7 @@ static bool _expose_invent_to_element(beam_type flavour, int strength) // Fedhas worshipers are exempt from the food destruction effect // of spores. if (flavour == BEAM_SPORE - && you.religion == GOD_FEDHAS) + && you_worship(GOD_FEDHAS)) { simple_god_message(" protects your food from the spores.", GOD_FEDHAS); @@ -530,7 +530,7 @@ static bool _expose_invent_to_element(beam_type flavour, int strength) continue; } - if (you.religion == GOD_JIYVA && !player_under_penance() + if (you_worship(GOD_JIYVA) && !player_under_penance() && x_chance_in_y(you.piety, MAX_PIETY)) { ++jiyva_block; @@ -814,7 +814,7 @@ bool drain_exp(bool announce_full, int power) static void _xom_checks_damage(kill_method_type death_type, int dam, int death_source) { - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) { if (death_type == KILLED_BY_TARGETTING || death_type == KILLED_BY_BOUNCE @@ -924,7 +924,7 @@ static void _maybe_spawn_jellies(int dam, const char* aux, // Exclude torment damage. const bool torment = aux && strstr(aux, "torment"); - if (you.religion == GOD_JIYVA && you.piety > 160 && !torment) + if (you_worship(GOD_JIYVA) && you.piety > 160 && !torment) { int how_many = 0; if (dam >= you.hp_max * 3 / 4) @@ -1211,7 +1211,7 @@ void ouch(int dam, int death_source, kill_method_type death_type, // Xom should only kill his worshippers if they're under penance // or Xom is bored. - if (you.religion == GOD_XOM && !you.penance[GOD_XOM] + if (you_worship(GOD_XOM) && !you.penance[GOD_XOM] && you.gift_timeout > 0) { return; @@ -1220,7 +1220,7 @@ void ouch(int dam, int death_source, kill_method_type death_type, // Also don't kill wizards testing Xom acts. if ((crawl_state.repeat_cmd == CMD_WIZARD || crawl_state.prev_cmd == CMD_WIZARD) - && you.religion != GOD_XOM) + && !you_worship(GOD_XOM)) { return; } diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index bd2c239111..fa0983add5 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1178,10 +1178,10 @@ static void _redraw_title(const string &your_name, const string &job_name) CGOTOXY(1, 2, GOTO_STAT); string species = species_name(you.species); NOWRAP_EOL_CPRINTF("%s", species.c_str()); - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) { string god = " of "; - god += you.religion == GOD_JIYVA ? god_name_jiyva(true) + god += you_worship(GOD_JIYVA) ? god_name_jiyva(true) : god_name(you.religion); NOWRAP_EOL_CPRINTF("%s", god.c_str()); @@ -1922,7 +1922,7 @@ static string _wiz_god_powers() static string _god_powers(bool simple) { string godpowers = simple ? "" : god_name(you.religion) ; - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) { if (!you.gift_timeout) godpowers += simple ? "- BORED" : " - BORED"; @@ -1931,7 +1931,7 @@ static string _god_powers(bool simple) return (simple ? godpowers : colour_string(godpowers, god_colour(you.religion))); } - else if (you.religion != GOD_NO_GOD) + else if (!you_worship(GOD_NO_GOD)) { if (player_under_penance()) return (simple ? "*" : colour_string("*" + godpowers, RED)); @@ -1939,7 +1939,7 @@ static string _god_powers(bool simple) { // piety rankings int prank = piety_rank() - 1; - if (prank < 0 || you.religion == GOD_XOM) + if (prank < 0 || you_worship(GOD_XOM)) prank = 0; // Careful about overflow. We erase some of the god's name @@ -2166,7 +2166,7 @@ static vector<formatted_string> _get_overview_resistances( const int rsust = player_sust_abil(calc_unid); const int rmuta = (you.rmut_from_item(calc_unid) || player_mutation_level(MUT_MUTATION_RESISTANCE) == 3 - || you.religion == GOD_ZIN && you.piety >= 150); + || you_worship(GOD_ZIN) && you.piety >= 150); const int rrott = you.res_rotting(); snprintf(buf, sizeof buf, diff --git a/crawl-ref/source/player-equip.cc b/crawl-ref/source/player-equip.cc index 8afab24228..08d90ee748 100644 --- a/crawl-ref/source/player-equip.cc +++ b/crawl-ref/source/player-equip.cc @@ -434,21 +434,21 @@ static void _unequip_artefact_effect(item_def &item, static void _equip_use_warning(const item_def& item) { - if (is_holy_item(item) && you.religion == GOD_YREDELEMNUL) + if (is_holy_item(item) && you_worship(GOD_YREDELEMNUL)) mpr("You really shouldn't be using a holy item like this."); else if (is_unholy_item(item) && is_good_god(you.religion)) mpr("You really shouldn't be using an unholy item like this."); - else if (is_corpse_violating_item(item) && you.religion == GOD_FEDHAS) + else if (is_corpse_violating_item(item) && you_worship(GOD_FEDHAS)) mpr("You really shouldn't be using a corpse-violating item like this."); else if (is_evil_item(item) && is_good_god(you.religion)) mpr("You really shouldn't be using an evil item like this."); - else if (is_unclean_item(item) && you.religion == GOD_ZIN) + else if (is_unclean_item(item) && you_worship(GOD_ZIN)) mpr("You really shouldn't be using an unclean item like this."); - else if (is_chaotic_item(item) && you.religion == GOD_ZIN) + else if (is_chaotic_item(item) && you_worship(GOD_ZIN)) mpr("You really shouldn't be using a chaotic item like this."); - else if (is_hasty_item(item) && you.religion == GOD_CHEIBRIADOS) + else if (is_hasty_item(item) && you_worship(GOD_CHEIBRIADOS)) mpr("You really shouldn't be using a hasty item like this."); - else if (is_poisoned_item(item) && you.religion == GOD_SHINING_ONE) + else if (is_poisoned_item(item) && you_worship(GOD_SHINING_ONE)) mpr("You really shouldn't be using a poisoned item like this."); } @@ -1146,8 +1146,8 @@ static void _unequip_armour_effect(item_def& item, bool meld) static void _remove_amulet_of_faith(item_def &item) { - if (you.religion != GOD_NO_GOD - && you.religion != GOD_XOM) + if (!you_worship(GOD_NO_GOD) + && !you_worship(GOD_XOM)) { simple_god_message(" seems less interested in you."); @@ -1328,7 +1328,7 @@ static void _equip_jewellery_effect(item_def &item, bool unmeld) break; case AMU_FAITH: - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) { mpr("You feel a surge of divine interest.", MSGCH_GOD); ident = ID_KNOWN_TYPE; diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 2d6a3b55b7..e868328f9b 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -489,7 +489,7 @@ bool player_can_open_doors() bool player_under_penance(void) { - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) return (you.penance[you.religion]); else return false; @@ -584,7 +584,7 @@ monster_type player_mons(bool transform) if (mons == MONS_ORC) { - if (you.religion == GOD_BEOGH) + if (you_worship(GOD_BEOGH)) mons = (you.piety >= piety_breakpoint(4)) ? MONS_ORC_HIGH_PRIEST : MONS_ORC_PRIEST; } @@ -1330,7 +1330,7 @@ int player_hunger_rate(bool temp) hunger += 4; // If Cheibriados has slowed your life processes, you will hunger less. - if (you.religion == GOD_CHEIBRIADOS && you.piety >= piety_breakpoint(0)) + if (you_worship(GOD_CHEIBRIADOS) && you.piety >= piety_breakpoint(0)) hunger--; // Moved here from main.cc... maintaining the >= 40 behaviour. @@ -1537,7 +1537,7 @@ int player_res_fire(bool calc_unid, bool temp, bool items) switch (you.form) { case TRAN_TREE: - if (you.religion == GOD_FEDHAS && !player_under_penance()) + if (you_worship(GOD_FEDHAS) && !player_under_penance()) rf++; break; case TRAN_ICE_BEAST: @@ -1611,7 +1611,7 @@ int player_res_cold(bool calc_unid, bool temp, bool items) switch (you.form) { case TRAN_TREE: - if (you.religion == GOD_FEDHAS && !player_under_penance()) + if (you_worship(GOD_FEDHAS) && !player_under_penance()) rc++; break; case TRAN_ICE_BEAST: @@ -1824,7 +1824,7 @@ int player_res_torment(bool, bool temp) // Kiku protects you from torment to a degree. int player_kiku_res_torment() { - return (you.religion == GOD_KIKUBAAQUDGHA + return (you_worship(GOD_KIKUBAAQUDGHA) && !player_under_penance() && you.piety >= piety_breakpoint(3) && !you.gift_timeout); // no protection during pain branding weapon @@ -2181,7 +2181,7 @@ int player_prot_life(bool calc_unid, bool temp, bool items) // Same here. Your piety status, and, hence, TSO's protection, is // something you can more or less control. - if (you.religion == GOD_SHINING_ONE && you.piety > pl * 50) + if (you_worship(GOD_SHINING_ONE) && you.piety > pl * 50) pl = you.piety / 50; if (temp) @@ -2282,7 +2282,7 @@ int player_movement_speed(bool ignore_burden) mv += 2 * you.wearing_ego(EQ_ALL_ARMOUR, SPARM_PONDEROUSNESS); // Cheibriados - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) mv += 2 + min(div_rand_round(you.piety, 20), 8); // Tengu can move slightly faster when flying. @@ -2351,7 +2351,7 @@ int player_speed(void) if (you.duration[DUR_SLOW]) ps = haste_mul(ps); - if (you.duration[DUR_BERSERK] && you.religion != GOD_CHEIBRIADOS) + if (you.duration[DUR_BERSERK] && !you_worship(GOD_CHEIBRIADOS)) ps = berserk_div(ps); else if (you.duration[DUR_HASTE]) ps = haste_div(ps); @@ -2437,7 +2437,7 @@ static int _player_armour_racial_bonus(const item_def& item) racial_bonus += 4; // an additional bonus for Beogh worshippers - if (you.religion == GOD_BEOGH && !player_under_penance()) + if (you_worship(GOD_BEOGH) && !player_under_penance()) { if (you.piety >= 185) racial_bonus += racial_bonus * 9 / 4; @@ -2892,7 +2892,7 @@ void forget_map(bool rot) const bool rot_resist = player_in_branch(BRANCH_LABYRINTH) && you.species == SP_MINOTAUR || player_in_branch(BRANCH_ABYSS) - && you.religion == GOD_LUGONU; + && you_worship(GOD_LUGONU); const double geometric_chance = 0.99; const int radius = (rot_resist ? 200 : 100); @@ -5014,7 +5014,7 @@ void contaminate_player(int change, bool controlled, bool msg) learned_something_new(HINT_GLOWING); // Zin doesn't like mutations or mutagenic radiation. - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) { // Whenever the glow status is first reached, give a warning message. if (old_level < 2 && new_level >= 2) diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 7bc66faef3..d2724bff85 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -995,14 +995,14 @@ void dec_penance(god_type god, int val) take_note(Note(NOTE_MOLLIFY_GOD, god)); - if (you.religion == god) + if (you_worship(god)) { // In case the best skill is Invocations, redraw the god // title. you.redraw_title = true; } - if (you.religion == god) + if (you_worship(god)) { // Orcish bonuses are now once more effective. if (god == GOD_BEOGH) @@ -1064,7 +1064,7 @@ static bool _need_water_walking() bool jiyva_is_dead() { return (you.royal_jelly_dead - && you.religion != GOD_JIYVA && !you.penance[GOD_JIYVA]); + && !you_worship(GOD_JIYVA) && !you.penance[GOD_JIYVA]); } static void _inc_penance(god_type god, int val) @@ -1132,7 +1132,7 @@ static void _inc_penance(god_type god, int val) notify_stat_change("falling into Cheibriados' penance"); } - if (you.religion == god) + if (you_worship(god)) { // In case the best skill is Invocations, redraw the god // title. @@ -1481,7 +1481,7 @@ static bool _is_plant_follower(const monster* mon) static bool _has_jelly() { - ASSERT(you.religion == GOD_JIYVA); + ASSERT(you_worship(GOD_JIYVA)); for (monster_iterator mi; mi; ++mi) if (mons_is_god_gift(*mi, GOD_JIYVA)) @@ -1491,13 +1491,13 @@ static bool _has_jelly() bool is_follower(const monster* mon) { - if (you.religion == GOD_YREDELEMNUL) + if (you_worship(GOD_YREDELEMNUL)) return is_yred_undead_slave(mon); - else if (you.religion == GOD_BEOGH) + else if (you_worship(GOD_BEOGH)) return is_orcish_follower(mon); - else if (you.religion == GOD_JIYVA) + else if (you_worship(GOD_JIYVA)) return is_fellow_slime(mon); - else if (you.religion == GOD_FEDHAS) + else if (you_worship(GOD_FEDHAS)) return _is_plant_follower(mon); else return (mon->alive() && mon->friendly()); @@ -2089,7 +2089,7 @@ static set<spell_type> _vehumet_get_spell_gifts() /////////////////////////////// bool do_god_gift(bool forced) { - ASSERT(you.religion != GOD_NO_GOD); + ASSERT(!you_worship(GOD_NO_GOD)); god_acting gdact; @@ -2135,8 +2135,8 @@ bool do_god_gift(bool forced) || (!forced && you.piety > 130 && random2(you.piety) > 120 && one_chance_in(4))) { - if (you.religion == GOD_TROG - || (you.religion == GOD_OKAWARU && coinflip())) + if (you_worship(GOD_TROG) + || (you_worship(GOD_OKAWARU) && coinflip())) { gift_type = OBJ_WEAPONS; } @@ -2159,7 +2159,7 @@ bool do_god_gift(bool forced) else { // Okawaru charges extra for armour acquirements. - if (you.religion == GOD_OKAWARU && gift_type == OBJ_ARMOUR) + if (you_worship(GOD_OKAWARU) && gift_type == OBJ_ARMOUR) _inc_gift_timeout(30 + random2avg(15, 2)); _inc_gift_timeout(30 + random2avg(19, 2)); @@ -2218,7 +2218,7 @@ bool do_god_gift(bool forced) // Kikubaaqudgha gives the lesser Necromancy books in a quick // succession. - if (you.religion == GOD_KIKUBAAQUDGHA) + if (you_worship(GOD_KIKUBAAQUDGHA)) { if (you.piety >= piety_breakpoint(0) && you.num_total_gifts[you.religion] == 0) @@ -2233,7 +2233,7 @@ bool do_god_gift(bool forced) } else if (forced || you.piety > 160 && random2(you.piety) > 100) { - if (you.religion == GOD_SIF_MUNA) + if (you_worship(GOD_SIF_MUNA)) gift = OBJ_RANDOM; } @@ -2251,7 +2251,7 @@ bool do_god_gift(bool forced) MAKE_ITEM_RANDOM_RACE, 0, 0, you.religion); // Replace a Kiku gift by a custom-random book. - if (you.religion == GOD_KIKUBAAQUDGHA) + if (you_worship(GOD_KIKUBAAQUDGHA)) { make_book_Kiku_gift(mitm[thing_created], gift == BOOK_NECROMANCY); @@ -2278,7 +2278,7 @@ bool do_god_gift(bool forced) you.num_current_gifts[you.religion]++; you.num_total_gifts[you.religion]++; // Timeouts are meaningless for Kiku. - if (you.religion != GOD_KIKUBAAQUDGHA) + if (!you_worship(GOD_KIKUBAAQUDGHA)) _inc_gift_timeout(40 + random2avg(19, 2)); take_note(Note(NOTE_GOD_GIFT, you.religion)); } @@ -2621,7 +2621,7 @@ void gain_piety(int original_gain, int denominator, bool force, bool should_scal return; // Xom uses piety differently... - if (you.religion == GOD_NO_GOD || you.religion == GOD_XOM) + if (you_worship(GOD_NO_GOD) || you_worship(GOD_XOM)) return; int pgn = should_scale_piety? piety_scale(original_gain) : original_gain; @@ -2659,7 +2659,7 @@ static void _gain_piety_point() // no longer have a piety cost for getting them. // Jiyva is an exception because there's usually a time-out and // the gifts aren't that precious. - if (!one_chance_in(4) && you.religion != GOD_JIYVA) + if (!one_chance_in(4) && !you_worship(GOD_JIYVA)) { #ifdef DEBUG_PIETY mprf(MSGCH_DIAGNOSTICS, "Piety slowdown due to gift timeout."); @@ -2669,7 +2669,7 @@ static void _gain_piety_point() } // slow down gain at upper levels of piety - if (you.religion != GOD_SIF_MUNA) + if (!you_worship(GOD_SIF_MUNA)) { if (you.piety >= MAX_PIETY || you.piety > 150 && one_chance_in(3) @@ -2723,10 +2723,10 @@ static void _gain_piety_point() learned_something_new(HINT_NEW_ABILITY_GOD); } - if (you.religion == GOD_SHINING_ONE && i == 0) + if (you_worship(GOD_SHINING_ONE) && i == 0) mpr("A divine halo surrounds you!"); - if (you.religion == GOD_ASHENZARI) + if (you_worship(GOD_ASHENZARI)) { if (i == 2) { @@ -2746,7 +2746,7 @@ static void _gain_piety_point() } } - if (you.religion == GOD_BEOGH) + if (you_worship(GOD_BEOGH)) { // Every piety level change also affects AC from orcish gear. you.redraw_armour_class = true; @@ -2754,14 +2754,14 @@ static void _gain_piety_point() update_player_symbol(); } - if (you.religion == GOD_CHEIBRIADOS + if (you_worship(GOD_CHEIBRIADOS) && che_stat_boost(old_piety) < che_stat_boost()) { simple_god_message(" raises the support of your attributes as your movement slows."); notify_stat_change("Cheibriados piety gain"); } - if (you.religion == GOD_SHINING_ONE) + if (you_worship(GOD_SHINING_ONE)) { // Piety change affects halo radius. invalidate_agrid(true); @@ -2852,22 +2852,22 @@ void lose_piety(int pgn) // title. you.redraw_title = true; - if (you.religion == GOD_ZIN) + if (you_worship(GOD_ZIN)) { simple_god_message( " is no longer ready to cure all your mutations."); } - else if (you.religion == GOD_SHINING_ONE && you.species != SP_FELID) + else if (you_worship(GOD_SHINING_ONE) && you.species != SP_FELID) { simple_god_message( " is no longer ready to bless your weapon."); } - else if (you.religion == GOD_KIKUBAAQUDGHA) + else if (you_worship(GOD_KIKUBAAQUDGHA)) { simple_god_message( " is no longer ready to enhance your necromancy."); } - else if (you.religion == GOD_LUGONU && you.species != SP_FELID) + else if (you_worship(GOD_LUGONU) && you.species != SP_FELID) { simple_god_message( " is no longer ready to corrupt your weapon."); @@ -2904,20 +2904,20 @@ void lose_piety(int pgn) if (you.piety > 0 && you.piety <= 5) learned_something_new(HINT_GOD_DISPLEASED); - if (you.religion == GOD_BEOGH) + if (you_worship(GOD_BEOGH)) { // Every piety level change also affects AC from orcish gear. you.redraw_armour_class = true; } - if (you.religion == GOD_CHEIBRIADOS + if (you_worship(GOD_CHEIBRIADOS) && che_stat_boost(old_piety) > che_stat_boost()) { simple_god_message(" reduces the support of your attributes as your movement quickens."); notify_stat_change("Cheibriados piety loss"); } - if (you.religion == GOD_SHINING_ONE) + if (you_worship(GOD_SHINING_ONE)) { // Piety change affects halo radius. invalidate_agrid(true); @@ -3314,7 +3314,7 @@ bool god_hates_attacking_friend(god_type god, const actor *fr) bool god_likes_items(god_type god, bool greedy_explore) { if (greedy_explore && (!(Options.explore_stop & ES_GREEDY_SACRIFICEABLE) - || you.religion == GOD_ASHENZARI)) + || you_worship(GOD_ASHENZARI))) // Ash's sacrifice isn't trading items for piety so it shouldn't make // explore greedy for ?RC { @@ -3447,7 +3447,7 @@ static void _god_welcome_identify_gear() set_ident_flags(*amulet, ISFLAG_KNOW_TYPE); } - if (you.religion == GOD_ASHENZARI) + if (you_worship(GOD_ASHENZARI)) { // Seemingly redundant with auto_id_inventory(), but we don't want to // announce items where the only new information is their cursedness. @@ -3464,7 +3464,7 @@ static void _god_welcome_identify_gear() } // detect evil weapons - if (you.religion == GOD_ELYVILON) + if (you_worship(GOD_ELYVILON)) auto_id_inventory(); } @@ -3555,13 +3555,13 @@ void god_pitch(god_type which_god) const int old_piety = you.piety; // Leave your prior religion first. - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) excommunication(which_god); // Welcome to the fold! you.religion = static_cast<god_type>(which_god); - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) { // Xom uses piety and gift_timeout differently. you.piety = HALF_MAX_PIETY; @@ -3594,7 +3594,7 @@ void god_pitch(god_type which_god) gain_piety(35, 1, true, false); } - if (you.religion == GOD_BEOGH) + if (you_worship(GOD_BEOGH)) { // The player's symbol depends on Beogh worship. update_player_symbol(); @@ -3604,7 +3604,7 @@ void god_pitch(god_type which_god) ash_check_bondage(); // Chei worshippers start their stat gain immediately. - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) { simple_god_message(" begins to support your attributes as your " "movement slows."); @@ -3612,7 +3612,7 @@ void god_pitch(god_type which_god) } // We disable all magical skills to avoid accidentally angering Trog. - if (you.religion == GOD_TROG) + if (you_worship(GOD_TROG)) { for (int sk = SK_SPELLCASTING; sk <= SK_LAST_MAGIC; ++sk) if (you.skills[sk]) @@ -3620,10 +3620,10 @@ void god_pitch(god_type which_god) } // Elyvilon gives you invocations immediately. - if (you.religion == GOD_ELYVILON) + if (you_worship(GOD_ELYVILON)) you.start_train.insert(SK_INVOCATIONS); - if (you.religion == GOD_OKAWARU + if (you_worship(GOD_OKAWARU) && player_mutation_level(MUT_DEMONIC_GUARDIAN)) { mpr("Your demonic guardian will not assist you as long as you worship " @@ -3642,32 +3642,32 @@ void god_pitch(god_type which_god) mpr("Your unholy and evil allies forsake you.", MSGCH_MONSTER_ENCHANT); } - if (you.religion == GOD_ZIN + if (you_worship(GOD_ZIN) && query_da_counter(DACT_ALLY_UNCLEAN_CHAOTIC)) { add_daction(DACT_ALLY_UNCLEAN_CHAOTIC); mpr("Your unclean and chaotic allies forsake you.", MSGCH_MONSTER_ENCHANT); } - else if (you.religion == GOD_TROG + else if (you_worship(GOD_TROG) && query_da_counter(DACT_ALLY_SPELLCASTER)) { add_daction(DACT_ALLY_SPELLCASTER); mpr("Your magic-using allies forsake you.", MSGCH_MONSTER_ENCHANT); } - if (you.religion == GOD_ELYVILON) + if (you_worship(GOD_ELYVILON)) { mpr("You can now call upon Elyvilon to destroy weapons lying on the " "ground.", MSGCH_GOD); mpr("You can now provide lesser healing for others.", MSGCH_GOD); } - else if (you.religion == GOD_TROG) + else if (you_worship(GOD_TROG)) { mpr("You can now call upon Trog to burn spellbooks in your " "surroundings.", MSGCH_GOD); } - else if (you.religion == GOD_FEDHAS) + else if (you_worship(GOD_FEDHAS)) { mpr("You can now call upon Fedhas to speed up the decay of corpses.", MSGCH_GOD); @@ -3737,11 +3737,11 @@ void god_pitch(god_type which_god) gain_piety(35, 1, true, false); } - if (you.religion == GOD_LUGONU && you.worshipped[GOD_LUGONU] == 1) + if (you_worship(GOD_LUGONU) && you.worshipped[GOD_LUGONU] == 1) gain_piety(20, 1, true, false); // allow instant access to first power // Complimentary jelly upon joining. - if (you.religion == GOD_JIYVA) + if (you_worship(GOD_JIYVA)) { if (!_has_jelly()) { @@ -3755,7 +3755,7 @@ void god_pitch(god_type which_god) } // Need to pay St. Peters. - if (you.religion == GOD_ZIN && you.attribute[ATTR_DONATIONS] * 9 < you.gold) + if (you_worship(GOD_ZIN) && you.attribute[ATTR_DONATIONS] * 9 < you.gold) { item_def lucre; lucre.base_type = OBJ_GOLD; @@ -3784,6 +3784,11 @@ void god_pitch(god_type which_god) learned_something_new(HINT_CONVERT); } +bool you_worship(const god_type god) +{ + return you.religion == god; +} + int had_gods() { int count = 0; @@ -3935,7 +3940,7 @@ bool god_can_protect_from_harm(god_type god) int elyvilon_lifesaving() { - if (you.religion != GOD_ELYVILON) + if (!you_worship(GOD_ELYVILON)) return 0; if (you.piety < piety_breakpoint(0)) @@ -4005,7 +4010,7 @@ void handle_god_time() } // Update the god's opinion of the player. - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) { switch (you.religion) { @@ -4214,7 +4219,7 @@ int piety_rank(int piety) if (piety < 0) piety = you.piety; - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) { const int breakpoints[] = { 20, 50, 80, 120, 180, INT_MAX }; for (unsigned int i = 0; i < ARRAYSZ(breakpoints); ++i) @@ -4483,8 +4488,8 @@ static void _place_delayed_monsters() if (mon) { - if (you.religion == GOD_YREDELEMNUL - || you.religion == GOD_BEOGH) + if (you_worship(GOD_YREDELEMNUL) + || you_worship(GOD_BEOGH)) { add_companion(mon); } diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index 75aabb2982..c5ac3d4645 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -54,6 +54,7 @@ int god_colour(god_type god); colour_t god_message_altar_colour(god_type god); bool player_can_join_god(god_type which_god); void god_pitch(god_type which_god); +bool you_worship(god_type god); int had_gods(); int piety_rank(int piety = -1); int piety_scale(int piety_change); diff --git a/crawl-ref/source/shout.cc b/crawl-ref/source/shout.cc index 480385fa0b..aa2d4c0d02 100644 --- a/crawl-ref/source/shout.cc +++ b/crawl-ref/source/shout.cc @@ -419,7 +419,7 @@ void item_noise(const item_def &item, string msg, int loudness) // replace references to player name and god msg = replace_all(msg, "@player_name@", you.your_name); msg = replace_all(msg, "@player_god@", - you.religion == GOD_NO_GOD ? "atheism" + you_worship(GOD_NO_GOD) ? "atheism" : god_name(you.religion, coinflip())); msg = replace_all(msg, "@a_player_genus@", article_a(species_name(you.species, true))); diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc index 88b7518c76..08ce9ffc79 100644 --- a/crawl-ref/source/skills2.cc +++ b/crawl-ref/source/skills2.cc @@ -23,6 +23,7 @@ #include "godabil.h" #include "libutil.h" #include "player.h" +#include "religion.h" #include "species.h" #include "skills.h" #include "skill_menu.h" @@ -506,7 +507,7 @@ bool is_useless_skill(skill_type skill) bool is_harmful_skill(skill_type skill) { - return is_magic_skill(skill) && you.religion == GOD_TROG; + return is_magic_skill(skill) && you_worship(GOD_TROG); } bool all_skills_maxed(bool inc_harmful) diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index 7bacb0e9b8..27119abdc4 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -389,7 +389,7 @@ bool player_can_memorise_from_spellbook(const item_def &book) && (you.skill(SK_SUMMONINGS) < 10 || you.skill(SK_SPELLCASTING) < 6)) || (book.sub_type == BOOK_NECRONOMICON - && you.religion != GOD_KIKUBAAQUDGHA + && !you_worship(GOD_KIKUBAAQUDGHA) && (you.skill(SK_NECROMANCY) < 10 || you.skill(SK_SPELLCASTING) < 6))) { diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 10aeeefa59..de2fcfc690 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -282,7 +282,7 @@ static int _apply_spellcasting_success_boosts(spell_type spell, int chance) int fail_reduce = 100; int wiz_factor = 87; - if (you.religion == GOD_VEHUMET + if (you_worship(GOD_VEHUMET) && !player_under_penance() && you.piety >= piety_breakpoint(2) && vehumet_supports_spell(spell)) { @@ -838,7 +838,7 @@ static void _spellcasting_side_effects(spell_type spell, int pow, god_type god) if (spell == SPELL_NECROMUTATION && is_good_god(you.religion)) excommunication(); } - if (spell == SPELL_STATUE_FORM && you.religion == GOD_YREDELEMNUL + if (spell == SPELL_STATUE_FORM && you_worship(GOD_YREDELEMNUL) && !crawl_state.is_god_acting()) { excommunication(); @@ -1239,7 +1239,7 @@ spret_type your_spells(spell_type spell, int powc, { int spfl = random2avg(100, 3); - if (you.religion != GOD_SIF_MUNA + if (!you_worship(GOD_SIF_MUNA) && you.penance[GOD_SIF_MUNA] && one_chance_in(20)) { god_speaks(GOD_SIF_MUNA, "You feel a surge of divine spite."); @@ -1248,7 +1248,7 @@ spret_type your_spells(spell_type spell, int powc, spfl = -you.penance[GOD_SIF_MUNA]; } else if (spell_typematch(spell, SPTYP_NECROMANCY) - && you.religion != GOD_KIKUBAAQUDGHA + && !you_worship(GOD_KIKUBAAQUDGHA) && you.penance[GOD_KIKUBAAQUDGHA] && one_chance_in(20)) { @@ -1262,7 +1262,7 @@ spret_type your_spells(spell_type spell, int powc, random2avg(88, 3), "the malice of Kikubaaqudgha"); } else if (vehumet_supports_spell(spell) - && you.religion != GOD_VEHUMET + && !you_worship(GOD_VEHUMET) && you.penance[GOD_VEHUMET] && one_chance_in(20)) { @@ -1308,7 +1308,7 @@ spret_type your_spells(spell_type spell, int powc, flush_input_buffer(FLUSH_ON_FAILURE); learned_something_new(HINT_SPELL_MISCAST); - if (you.religion == GOD_SIF_MUNA + if (you_worship(GOD_SIF_MUNA) && !player_under_penance() && you.piety >= 100 && x_chance_in_y(you.piety + 1, 150)) { diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc index 7c70dd8d93..f6e0f835be 100644 --- a/crawl-ref/source/spl-goditem.cc +++ b/crawl-ref/source/spl-goditem.cc @@ -136,7 +136,7 @@ static bool _mons_hostile(const monster* mon) // Returns 0, if it's possible to pacify this monster. int is_pacifiable(const monster* mon) { - if (you.religion != GOD_ELYVILON) + if (!you_worship(GOD_ELYVILON)) return -1; // I was thinking of jellies when I wrote this, but maybe we shouldn't @@ -241,7 +241,7 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability, { spd.isValid = spell_direction(spd, beam, DIR_TARGET, mode != TARG_NUM_MODES ? mode : - you.religion == GOD_ELYVILON ? + you_worship(GOD_ELYVILON) ? TARG_ANY : TARG_FRIEND, LOS_RADIUS, false, true, true, "Heal", NULL, false, NULL, _desc_mindless); @@ -282,7 +282,7 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability, // Don't divinely heal a monster you can't pacify. if (divine_ability && is_hostile - && you.religion == GOD_ELYVILON + && you_worship(GOD_ELYVILON) && can_pacify <= 0) { if (can_pacify == 0) @@ -318,7 +318,7 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability, bool did_something = false; - if (you.religion == GOD_ELYVILON + if (you_worship(GOD_ELYVILON) && can_pacify == 1 && is_hostile) { @@ -484,7 +484,7 @@ int detect_items(int pow) map_radius = 8 + random2(8) + pow; else { - if (you.religion == GOD_ASHENZARI) + if (you_worship(GOD_ASHENZARI)) { map_radius = min(you.piety / 20, LOS_RADIUS); if (map_radius <= 0) @@ -650,7 +650,7 @@ static bool _selectively_remove_curse(string *pre_msg) bool remove_curse(bool alreadyknown, string *pre_msg) { - if (you.religion == GOD_ASHENZARI && alreadyknown) + if (you_worship(GOD_ASHENZARI) && alreadyknown) { if (_selectively_remove_curse(pre_msg)) { @@ -757,7 +757,7 @@ bool curse_item(bool armour, bool alreadyknown, string *pre_msg) if (affected == EQ_WEAPON) { - if (you.religion == GOD_ASHENZARI && alreadyknown) + if (you_worship(GOD_ASHENZARI) && alreadyknown) { mprf(MSGCH_PROMPT, "You aren't wearing any piece of uncursed %s.", armour ? "armour" : "jewellery"); @@ -772,7 +772,7 @@ bool curse_item(bool armour, bool alreadyknown, string *pre_msg) return false; } - if (you.religion == GOD_ASHENZARI && alreadyknown) + if (you_worship(GOD_ASHENZARI) && alreadyknown) return _selectively_curse_item(armour, pre_msg); if (pre_msg) diff --git a/crawl-ref/source/spl-miscast.cc b/crawl-ref/source/spl-miscast.cc index ec7b243cb7..fcac3eccac 100644 --- a/crawl-ref/source/spl-miscast.cc +++ b/crawl-ref/source/spl-miscast.cc @@ -672,7 +672,7 @@ bool MiscastEffect::avoid_lethal(int dam) if (recursion_depth == MAX_RECURSE) { // Any possible miscast would kill you, now that's interesting. - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) simple_god_message(" watches you with interest."); return true; } @@ -1608,7 +1608,7 @@ void MiscastEffect::_divination_mon(int severity) void MiscastEffect::_necromancy(int severity) { - if (target->is_player() && you.religion == GOD_KIKUBAAQUDGHA + if (target->is_player() && you_worship(GOD_KIKUBAAQUDGHA) && !player_under_penance() && you.piety >= piety_breakpoint(1)) { const bool death_curse = (cause.find("death curse") != string::npos); diff --git a/crawl-ref/source/spl-selfench.cc b/crawl-ref/source/spl-selfench.cc index 57f7a55e5d..5dd04a511d 100644 --- a/crawl-ref/source/spl-selfench.cc +++ b/crawl-ref/source/spl-selfench.cc @@ -16,6 +16,7 @@ #include "libutil.h" #include "message.h" #include "misc.h" +#include "religion.h" #include "shout.h" #include "spl-cast.h" #include "spl-transloc.h" @@ -28,7 +29,7 @@ int allowed_deaths_door_hp(void) { int hp = you.skill(SK_NECROMANCY) / 2; - if (you.religion == GOD_KIKUBAAQUDGHA && !player_under_penance()) + if (you_worship(GOD_KIKUBAAQUDGHA) && !player_under_penance()) hp += you.piety / 15; return max(hp, 1); diff --git a/crawl-ref/source/spl-summoning.cc b/crawl-ref/source/spl-summoning.cc index 9f680e3fc9..3239be613a 100644 --- a/crawl-ref/source/spl-summoning.cc +++ b/crawl-ref/source/spl-summoning.cc @@ -2374,7 +2374,7 @@ spret_type cast_haunt(int pow, const coord_def& where, god_type god, bool fail) } //jmf: Kiku sometimes deflects this - if (you.religion != GOD_KIKUBAAQUDGHA + if (!you_worship(GOD_KIKUBAAQUDGHA) || player_under_penance() || you.piety < piety_breakpoint(3) || !x_chance_in_y(you.piety, MAX_PIETY)) { diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index 5f66de5c89..2b66185707 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -951,7 +951,7 @@ int spell_range(spell_type spell, int pow, bool player_spell) if (player_spell && vehumet_supports_spell(spell) - && you.religion == GOD_VEHUMET + && you_worship(GOD_VEHUMET) && spell != SPELL_STICKY_FLAME && spell != SPELL_FREEZE && !player_under_penance() @@ -1154,7 +1154,7 @@ bool spell_is_useless(spell_type spell, bool transient) // mere corona is not enough, but divine light blocks it completely if (transient && you.haloed()) return true; - if (you.religion == GOD_SHINING_ONE && !player_under_penance()) + if (you_worship(GOD_SHINING_ONE) && !player_under_penance()) return true; break; #if TAG_MAJOR_VERSION == 34 diff --git a/crawl-ref/source/sprint.cc b/crawl-ref/source/sprint.cc index 8f1234f089..3370fa8295 100644 --- a/crawl-ref/source/sprint.cc +++ b/crawl-ref/source/sprint.cc @@ -8,6 +8,7 @@ #include "monster.h" #include "mpr.h" #include "player.h" +#include "religion.h" #include "random.h" int sprint_modify_exp(int exp) @@ -22,7 +23,7 @@ int sprint_modify_exp_inverse(int exp) int sprint_modify_piety(int piety) { - if (you.religion == GOD_OKAWARU) + if (you_worship(GOD_OKAWARU)) return piety; return piety * 9; } diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc index 549b8eb783..13edbcbc27 100644 --- a/crawl-ref/source/stairs.cc +++ b/crawl-ref/source/stairs.cc @@ -31,6 +31,7 @@ #include "output.h" #include "place.h" #include "random.h" +#include "religion.h" #include "spl-clouds.h" #include "spl-damage.h" #include "spl-other.h" @@ -905,7 +906,7 @@ void down_stairs(dungeon_feature_type force_stair) mpr("You enter the Abyss!"); mpr("To return, you must find a gate leading back."); - if (you.religion == GOD_CHEIBRIADOS) + if (you_worship(GOD_CHEIBRIADOS)) { mpr("You feel Cheibriados slowing down the madness of this place.", MSGCH_GOD, GOD_CHEIBRIADOS); diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index 8b2e5402b7..aa5e796fd7 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -2116,7 +2116,7 @@ void StashTracker::update_corpses() void StashTracker::update_identification() { - if (you.religion != GOD_ASHENZARI) + if (!you_worship(GOD_ASHENZARI)) return; for (stash_levels_t::iterator iter = levels.begin(); diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index 0672c1de6f..912b822d43 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -415,7 +415,7 @@ bool feat_is_altar(dungeon_feature_type grid) bool feat_is_player_altar(dungeon_feature_type grid) { // An ugly hack, but that's what religion.cc does. - return (you.religion != GOD_NO_GOD + return (!you_worship(GOD_NO_GOD) && feat_altar_god(grid) == you.religion); } diff --git a/crawl-ref/source/tilereg-cmd.cc b/crawl-ref/source/tilereg-cmd.cc index 4143ac29cb..c274492adc 100644 --- a/crawl-ref/source/tilereg-cmd.cc +++ b/crawl-ref/source/tilereg-cmd.cc @@ -186,9 +186,9 @@ static bool _command_not_applicable(const command_type cmd, bool safe) case CMD_INTERLEVEL_TRAVEL: return (!safe); case CMD_DISPLAY_RELIGION: - return (you.religion == GOD_NO_GOD); + return (you_worship(GOD_NO_GOD)); case CMD_PRAY: - return (you.religion == GOD_NO_GOD + return (you_worship(GOD_NO_GOD) && !feat_is_altar(grd(you.pos()))); case CMD_USE_ABILITY: return (your_talents(false).empty()); diff --git a/crawl-ref/source/tilereg-dgn.cc b/crawl-ref/source/tilereg-dgn.cc index 9131c4dcba..f765124a4a 100644 --- a/crawl-ref/source/tilereg-dgn.cc +++ b/crawl-ref/source/tilereg-dgn.cc @@ -905,7 +905,7 @@ int DungeonRegion::handle_mouse(MouseEvent &event) case MouseEvent::RIGHT: if (!(event.mod & MOD_SHIFT)) return command_to_key(CMD_RESISTS_SCREEN); // Character overview. - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) return command_to_key(CMD_DISPLAY_RELIGION); // Religion screen. // fall through... @@ -1257,7 +1257,7 @@ bool tile_dungeon_tip(const coord_def &gc, string &tip) cmd.push_back(CMD_RESISTS_SCREEN); // Religion. - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) { _add_tip(tip, "[Shift + R-Click] Religion (%)"); cmd.push_back(CMD_DISPLAY_RELIGION); diff --git a/crawl-ref/source/tileweb.cc b/crawl-ref/source/tileweb.cc index 96df11bb80..1a39dfb2c0 100644 --- a/crawl-ref/source/tileweb.cc +++ b/crawl-ref/source/tileweb.cc @@ -612,21 +612,21 @@ void TilesFramework::_send_player(bool force_full) _update_string(force_full, c.species, species_name(you.species), "species"); string god = ""; - if (you.religion == GOD_JIYVA) + if (you_worship(GOD_JIYVA)) god = god_name_jiyva(true); - else if (you.religion != GOD_NO_GOD) + else if (!you_worship(GOD_NO_GOD)) god = god_name(you.religion); _update_string(force_full, c.god, god, "god"); _update_int(force_full, c.under_penance, player_under_penance(), "penance"); uint8_t prank = 0; - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) { if (!you.gift_timeout) prank = 2; else if (you.gift_timeout == 1) prank = 1; } - else if (you.religion != GOD_NO_GOD) + else if (!you_worship(GOD_NO_GOD)) prank = max(0, piety_rank() - 1); else if (you.char_class == JOB_MONK && you.species != SP_DEMIGOD && !had_gods()) diff --git a/crawl-ref/source/transform.cc b/crawl-ref/source/transform.cc index 1252abdc3b..a4bccc3aba 100644 --- a/crawl-ref/source/transform.cc +++ b/crawl-ref/source/transform.cc @@ -702,7 +702,7 @@ bool transform(int pow, transformation_type which_trans, bool force, const flight_type was_flying = you.flight_mode(); // Zin's protection. - if (!just_check && you.religion == GOD_ZIN + if (!just_check && you_worship(GOD_ZIN) && x_chance_in_y(you.piety, MAX_PIETY) && which_trans != TRAN_NONE) { simple_god_message(" protects your body from unnatural transformation!"); @@ -1038,7 +1038,7 @@ bool transform(int pow, transformation_type which_trans, bool force, break; case TRAN_TREE: - if (you.religion == GOD_FEDHAS && !player_under_penance()) + if (you_worship(GOD_FEDHAS) && !player_under_penance()) simple_god_message(" makes you hardy against extreme temperatures."); // ignore hunger_state (but don't reset hunger) you.hunger_state = HS_SATIATED; diff --git a/crawl-ref/source/wiz-item.cc b/crawl-ref/source/wiz-item.cc index ffef8ee436..5235e9cc0c 100644 --- a/crawl-ref/source/wiz-item.cc +++ b/crawl-ref/source/wiz-item.cc @@ -703,7 +703,7 @@ void wizard_make_object_randart() } // Remove curse flag from item, unless worshipping Ashenzari. - if (you.religion == GOD_ASHENZARI) + if (you_worship(GOD_ASHENZARI)) do_curse_item(item, true); else do_uncurse_item(item, false); @@ -996,7 +996,7 @@ static void _debug_acquirement_stats(FILE *ostat) // Print player species/profession. string godname = ""; - if (you.religion != GOD_NO_GOD) + if (!you_worship(GOD_NO_GOD)) godname += " of " + god_name(you.religion); fprintf(ostat, "%s the %s, Level %d %s %s%s\n\n", diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc index e69013cece..e14dbc7b5c 100644 --- a/crawl-ref/source/wiz-you.cc +++ b/crawl-ref/source/wiz-you.cc @@ -325,7 +325,7 @@ void wizard_set_hunger_state() void wizard_set_piety() { - if (you.religion == GOD_NO_GOD) + if (you_worship(GOD_NO_GOD)) { mpr("You are not religious!"); return; @@ -347,7 +347,7 @@ void wizard_set_piety() return; } - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) { you.piety = newpiety; @@ -994,7 +994,7 @@ void set_xl(const int newxl, const bool train) void wizard_get_god_gift(void) { - if (you.religion == GOD_NO_GOD) + if (you_worship(GOD_NO_GOD)) { mpr("You are not religious!"); return; @@ -1012,7 +1012,7 @@ void wizard_toggle_xray_vision() void wizard_god_wrath() { - if (you.religion == GOD_NO_GOD) + if (you_worship(GOD_NO_GOD)) { mpr("You suffer the terrible wrath of No God."); return; diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 822c824639..21cf03c5e2 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -149,7 +149,7 @@ static const char *describe_xom_mood() const string describe_xom_favour() { string favour; - if (you.religion != GOD_XOM) + if (!you_worship(GOD_XOM)) favour = "a very buggy toy of Xom."; else if (you.gift_timeout < 1) favour = "a BORING thing."; @@ -174,7 +174,7 @@ static string _get_xom_speech(const string key) static bool _xom_is_bored() { - return (you.religion == GOD_XOM && !you.gift_timeout); + return (you_worship(GOD_XOM) && !you.gift_timeout); } static bool _xom_feels_nasty() @@ -189,7 +189,7 @@ bool xom_is_nice(int tension) if (you.penance[GOD_XOM]) return false; - if (you.religion == GOD_XOM) + if (you_worship(GOD_XOM)) { // If you.gift_timeout is 0, then Xom is BORED. He HATES that. if (!you.gift_timeout) @@ -225,7 +225,7 @@ static void _xom_is_stimulated(int maxinterestingness, const char *message_array[], bool force_message) { - if (you.religion != GOD_XOM || maxinterestingness <= 0) + if (!you_worship(GOD_XOM) || maxinterestingness <= 0) return; // Xom is not directly stimulated by his own acts. @@ -273,7 +273,7 @@ void xom_is_stimulated(int maxinterestingness, xom_message_type message_type, void xom_is_stimulated(int maxinterestingness, const string& message, bool force_message) { - if (you.religion != GOD_XOM) + if (!you_worship(GOD_XOM)) return; const char *message_array[6]; @@ -3956,7 +3956,7 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) _handle_accidental_death(orig_hp, orig_stat_loss, orig_mutation); - if (you.religion == GOD_XOM && one_chance_in(5)) + if (you_worship(GOD_XOM) && one_chance_in(5)) { const string old_xom_favour = describe_xom_favour(); you.piety = random2(MAX_PIETY + 1); @@ -4043,7 +4043,7 @@ static bool _death_is_funny(const kill_method_type killed_by) void xom_death_message(const kill_method_type killed_by) { - if (you.religion != GOD_XOM && (!you.worshipped[GOD_XOM] || coinflip())) + if (!you_worship(GOD_XOM) && (!you.worshipped[GOD_XOM] || coinflip())) return; const int death_tension = get_tension(GOD_XOM); @@ -4124,7 +4124,7 @@ bool xom_saves_your_life(const int dam, const int death_source, const kill_method_type death_type, const char *aux, bool see_source) { - if (you.religion != GOD_XOM || _xom_feels_nasty()) + if (!you_worship(GOD_XOM) || _xom_feels_nasty()) return false; // If this happens, don't bother. |