From 19bba5a5ec358bc8821bc3118add964ff303f7a9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 30 Sep 2007 15:45:57 +0000 Subject: 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 --- crawl-ref/source/abl-show.cc | 3 ++- crawl-ref/source/religion.cc | 16 ++++++---------- crawl-ref/source/religion.h | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) (limited to 'crawl-ref') 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 -- cgit v1.2.3-54-g00ecf