summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-28 08:27:29 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-28 08:27:29 +0000
commit3205c9289fd9ff8bcf739903a49215f75212128e (patch)
tree6a9b4a29e9e8bd96d4e8b87934d17ce84987a8e0 /crawl-ref/source/religion.cc
parentdc3aa32db050e7923a4e802b874fccd997c1d6c6 (diff)
downloadcrawl-ref-3205c9289fd9ff8bcf739903a49215f75212128e.tar.gz
crawl-ref-3205c9289fd9ff8bcf739903a49215f75212128e.zip
crawl_state now keeps track of whether or not the current code is being
executed because of a god's actions, and if so which god (with "actions" not including god-supplied invocations). Currently only used to prevent Xom from being amused/stimulated by his own actions. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2235 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r--crawl-ref/source/religion.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 52f3f4b452..abedd6393d 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -542,6 +542,8 @@ static void do_god_gift(bool prayed_for)
if (prayed_for != (you.religion == GOD_ZIN))
return;
+ crawl_state.inc_god_acting();
+
#if DEBUG_DIAGNOSTICS || DEBUG_GIFTS
int old_gifts = you.num_gifts[ you.religion ];
#endif
@@ -816,6 +818,7 @@ static void do_god_gift(bool prayed_for)
mprf(MSGCH_DIAGNOSTICS, "Total number of gifts from this god: %d",
you.num_gifts[ you.religion ] );
#endif
+ crawl_state.dec_god_acting();
}
static bool is_risky_sacrifice(const item_def& item)
@@ -1125,6 +1128,8 @@ bool did_god_conduct( conduct_type thing_done, int level, const actor *victim )
if (you.religion == GOD_NO_GOD || you.religion == GOD_XOM)
return (false);
+ crawl_state.inc_god_acting();
+
switch (thing_done)
{
case DID_DRINK_BLOOD:
@@ -1581,6 +1586,8 @@ bool did_god_conduct( conduct_type thing_done, int level, const actor *victim )
}
#endif
+ crawl_state.dec_god_acting();
+
return (ret);
}
@@ -1703,6 +1710,8 @@ bool ely_destroy_weapons()
if (you.religion != GOD_ELYVILON)
return false;
+ crawl_state.inc_god_acting();
+
bool success = false;
int i = igrd[you.x_pos][you.y_pos];
while (i != NON_ITEM)
@@ -1745,6 +1754,8 @@ bool ely_destroy_weapons()
mpr("There are no weapons here to destroy!");
}
+ crawl_state.dec_god_acting();
+
return success;
}
@@ -1753,6 +1764,8 @@ void trog_burn_books()
if (you.religion != GOD_TROG)
return;
+ crawl_state.inc_god_acting();
+
int i = igrd[you.x_pos][you.y_pos];
while (i != NON_ITEM)
{
@@ -1863,6 +1876,7 @@ void trog_burn_books()
simple_god_message(" is delighted!", GOD_TROG);
gain_piety(totalpiety);
}
+ crawl_state.dec_god_acting();
}
void lose_piety(int pgn)
@@ -2516,6 +2530,8 @@ void divine_retribution( god_type god )
if (god == you.religion && is_good_god(god) )
return;
+ crawl_state.inc_god_acting(god, true);
+
// Just the thought of retribution (getting this far) mollifies
// the god by at least a point... the punishment might reduce
// penance further.
@@ -2566,6 +2582,7 @@ void divine_retribution( god_type god )
}
}
}
+ crawl_state.dec_god_acting(god);
}
// upon excommunication, (now ex) Beogh adepts lose their orcish followers
@@ -2658,6 +2675,8 @@ bool followers_abandon_you()
// Destroying orcish idols (a.k.a. idols of Beogh) may anger Beogh
void beogh_idol_revenge()
{
+ crawl_state.inc_god_acting(GOD_BEOGH, true);
+
// Beogh watches his charges closely, but for others doesn't always notice
if (you.religion == GOD_BEOGH
|| (you.species == SP_HILL_ORC && coinflip())
@@ -2713,12 +2732,16 @@ void beogh_idol_revenge()
did_god_conduct(DID_ATTACK_FRIEND, 8);
}
}
+
+ crawl_state.dec_god_acting(GOD_BEOGH);
}
void excommunication(void)
{
const god_type old_god = you.religion;
+ crawl_state.inc_god_acting(old_god, true);
+
take_note(Note(NOTE_LOSE_GOD, old_god));
you.duration[DUR_PRAYER] = 0;
@@ -2810,6 +2833,8 @@ void excommunication(void)
inc_penance( old_god, 25 );
break;
}
+
+ crawl_state.dec_god_acting(old_god);
} // end excommunication()
static bool bless_weapon( int god, int brand, int colour )
@@ -2872,6 +2897,8 @@ void altar_prayer(void)
if (you.religion == GOD_XOM)
return;
+ crawl_state.inc_god_acting();
+
// TSO blesses long swords with holy wrath
if (you.religion == GOD_SHINING_ONE
&& !you.num_gifts[GOD_SHINING_ONE]
@@ -2924,6 +2951,8 @@ void altar_prayer(void)
}
offer_items();
+
+ crawl_state.dec_god_acting();
} // end altar_prayer()
static bool god_likes_items(god_type god)
@@ -2970,6 +2999,8 @@ void offer_items()
if (you.religion == GOD_NO_GOD || !god_likes_items(you.religion))
return;
+ crawl_state.inc_god_acting();
+
int num_sacced = 0;
int i = igrd[you.x_pos][you.y_pos];
while (i != NON_ITEM)
@@ -3094,6 +3125,8 @@ void offer_items()
if (num_sacced > 0 && you.religion == GOD_NEMELEX_XOBEH)
show_pure_deck_chances();
#endif
+
+ crawl_state.dec_god_acting();
}
void god_pitch(god_type which_god)
@@ -3117,7 +3150,9 @@ void god_pitch(god_type which_god)
if (which_god == GOD_LUGONU && you.penance[GOD_LUGONU])
{
simple_god_message(" is most displeased with you!", which_god);
+ crawl_state.inc_god_acting(GOD_LUGONU, true);
lugonu_retribution();
+ crawl_state.dec_god_acting(GOD_LUGONU);
return;
}