|
From: <gi...@cr...> - 2013-07-28 07:45:22
|
via cc0fb03b9eee93cd3fbfb7b9ea40c8b1bfa7a872 (commit)
from 772cbec2479d6b59ccb91cad149c7edf8968cf6f (commit)
-----------------------------------------------------------------------
commit cc0fb03b9eee93cd3fbfb7b9ea40c8b1bfa7a872
Author: Brendan Hickey <br...@bh...>
Date: Sun Jul 28 00:31:07 2013 -0700
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.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/abl-show.cc | 28 ++++----
crawl-ref/source/abyss.cc | 4 +-
crawl-ref/source/acquire.cc | 10 ++--
crawl-ref/source/actor.cc | 3 +-
crawl-ref/source/attitude-change.cc | 6 +-
crawl-ref/source/beam.cc | 8 +-
crawl-ref/source/chardump.cc | 4 +-
crawl-ref/source/cloud.cc | 4 +-
crawl-ref/source/decks.cc | 12 ++--
crawl-ref/source/delay.cc | 2 +-
crawl-ref/source/describe.cc | 18 +++---
crawl-ref/source/dgn-overview.cc | 2 +-
crawl-ref/source/effects.cc | 18 +++---
crawl-ref/source/food.cc | 6 +-
crawl-ref/source/godabil.cc | 18 +++---
crawl-ref/source/godconduct.cc | 78 ++++++++++++------------
crawl-ref/source/godpassive.cc | 16 +++---
crawl-ref/source/godprayer.cc | 30 +++++-----
crawl-ref/source/godwrath.cc | 14 ++--
crawl-ref/source/hints.cc | 28 ++++----
crawl-ref/source/hiscores.cc | 2 +-
crawl-ref/source/invent.cc | 3 +-
crawl-ref/source/item_use.cc | 10 ++--
crawl-ref/source/itemname.cc | 18 +++---
crawl-ref/source/itemprop.cc | 10 ++--
crawl-ref/source/items.cc | 8 +-
crawl-ref/source/main.cc | 28 ++++----
crawl-ref/source/map_knowledge.cc | 7 +-
crawl-ref/source/melee_attack.cc | 6 +-
crawl-ref/source/misc.cc | 10 ++--
crawl-ref/source/mon-abil.cc | 2 +-
crawl-ref/source/mon-act.cc | 8 +-
crawl-ref/source/mon-behv.cc | 3 +-
crawl-ref/source/mon-cast.cc | 4 +-
crawl-ref/source/mon-death.cc | 2 +-
crawl-ref/source/mon-info.cc | 2 +-
crawl-ref/source/mon-place.cc | 14 ++--
crawl-ref/source/mon-speak.cc | 2 +-
crawl-ref/source/mon-stuff.cc | 64 ++++++++++----------
crawl-ref/source/mon-transit.cc | 6 +-
crawl-ref/source/mon-util.cc | 2 +-
crawl-ref/source/mutation.cc | 10 ++--
crawl-ref/source/ng-setup.cc | 4 +-
crawl-ref/source/ouch.cc | 12 ++--
crawl-ref/source/output.cc | 12 ++--
crawl-ref/source/player-equip.cc | 18 +++---
crawl-ref/source/player.cc | 24 ++++----
crawl-ref/source/religion.cc | 115 ++++++++++++++++++-----------------
crawl-ref/source/religion.h | 1 +
crawl-ref/source/shout.cc | 2 +-
crawl-ref/source/skills2.cc | 3 +-
crawl-ref/source/spl-book.cc | 2 +-
crawl-ref/source/spl-cast.cc | 12 ++--
crawl-ref/source/spl-goditem.cc | 16 +++---
crawl-ref/source/spl-miscast.cc | 4 +-
crawl-ref/source/spl-selfench.cc | 3 +-
crawl-ref/source/spl-summoning.cc | 2 +-
crawl-ref/source/spl-util.cc | 4 +-
crawl-ref/source/sprint.cc | 3 +-
crawl-ref/source/stairs.cc | 3 +-
crawl-ref/source/stash.cc | 2 +-
crawl-ref/source/terrain.cc | 2 +-
crawl-ref/source/tilereg-cmd.cc | 4 +-
crawl-ref/source/tilereg-dgn.cc | 4 +-
crawl-ref/source/tileweb.cc | 8 +-
crawl-ref/source/transform.cc | 4 +-
crawl-ref/source/wiz-item.cc | 4 +-
crawl-ref/source/wiz-you.cc | 8 +-
crawl-ref/source/xom.cc | 16 +++---
69 files changed, 418 insertions(+), 404 deletions(-)
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 5782cc5..23db092 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 e61dc34..3053990 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 4f2df2e..8638dba 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 289901a..3cbc15f 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 d25ffd1..2b7d49a 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 240524d..012df09 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 767192c..bbc7aee 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 12dca07..80a1735 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 5b9f1aa..cb9698b 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 2403e3d..f4bda54 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 54aace7..6d97af2 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 d302299..f00b675 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 df36cbc..4ac8862 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 4d63d28..40f51dc 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 2ac526e..20929bf 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 964b270..7bb0b70 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 cd0d3ce..4560ccec 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 75b2178..ca0da61 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 297036d..949d077 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 f404411..084749c 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)
...
[truncated message content] |