summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-30 15:45:57 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-30 15:45:57 +0000
commit19bba5a5ec358bc8821bc3118add964ff303f7a9 (patch)
treec356b9cb83081cfc9df2e0d5ed87dd4a44282fb3 /crawl-ref
parent79a54a17e3fcb38f8cc00189881bcb215cba785a (diff)
downloadcrawl-ref-19bba5a5ec358bc8821bc3118add964ff303f7a9.tar.gz
crawl-ref-19bba5a5ec358bc8821bc3118add964ff303f7a9.zip
Trog's bookburning invocation only costs a turn and food
if it's actually successful. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2262 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/abl-show.cc3
-rw-r--r--crawl-ref/source/religion.cc16
-rw-r--r--crawl-ref/source/religion.h2
3 files changed, 9 insertions, 12 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 50843db6d5..2bee608be0 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1525,7 +1525,8 @@ static bool do_ability(const ability_def& abil)
break;
case ABIL_TROG_BURN_BOOKS:
- trog_burn_books();
+ if (!trog_burn_books())
+ return (false);
break;
case ABIL_TROG_BERSERK:
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 1171c62c47..9eb3ce6ee0 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1776,10 +1776,11 @@ bool ely_destroy_weapons()
return success;
}
-void trog_burn_books()
+// returns false if invocation fails (no books in sight etc.)
+bool trog_burn_books()
{
if (you.religion != GOD_TROG)
- return;
+ return (false);
crawl_state.inc_god_acting();
@@ -1792,29 +1793,22 @@ void trog_burn_books()
&& mitm[i].sub_type != BOOK_MANUAL)
{
mpr("Burning your own feet might not be such a smart idea!");
- return;
+ return (false);
}
i = next;
}
- // From now on, it will always cost a turn, to prevent leaking
- // information about whether books exist (not that it matters much.)
-
int totalpiety = 0;
for (int xpos = you.x_pos - 8; xpos < you.x_pos + 8; xpos++)
for (int ypos = you.y_pos - 8; ypos < you.y_pos + 8; ypos++)
{
// checked above
if (xpos == you.x_pos && ypos == you.y_pos)
- {
continue;
- }
// burn only squares in sight
if (!see_grid(xpos, ypos))
- {
continue;
- }
// if a grid is blocked, books lying there will be ignored
// allow bombing of monsters
@@ -1887,6 +1881,7 @@ void trog_burn_books()
if (!totalpiety)
{
mpr("There are no books in sight to burn!");
+ return (false);
}
else
{
@@ -1894,6 +1889,7 @@ void trog_burn_books()
gain_piety(totalpiety);
}
crawl_state.dec_god_acting();
+ return (true);
}
void lose_piety(int pgn)
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 20bf075669..0a11005dfc 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -47,7 +47,7 @@ void divine_retribution(god_type god);
bool beogh_water_walk();
void beogh_idol_revenge();
bool ely_destroy_weapons();
-void trog_burn_books();
+bool trog_burn_books();
bool tso_stab_safe_monster(const actor *act);
#endif