From ae8b9d93ae9dfe0df789c4867fbd5aeff695c6df Mon Sep 17 00:00:00 2001 From: haranp Date: Wed, 4 Jul 2007 23:02:18 +0000 Subject: Better feedback for Beogh water walking. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1751 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/externs.h | 2 +- crawl-ref/source/mutation.cc | 16 +++++++++++----- crawl-ref/source/output.cc | 8 ++++++++ crawl-ref/source/randart.cc | 5 +++-- crawl-ref/source/randart.h | 5 +++-- crawl-ref/source/religion.cc | 45 ++++++++++++++++++++++++++------------------ crawl-ref/source/religion.h | 2 ++ crawl-ref/source/tags.cc | 3 ++- 8 files changed, 57 insertions(+), 29 deletions(-) diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 095a3f3b9c..d1ad65f870 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -728,7 +728,7 @@ public: int exp_available; FixedArray item_description; - FixedVector unique_items; + FixedVector unique_items; FixedVector unique_creatures; KillMaster kills; diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 360dfe99cb..f3f001e686 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -893,11 +893,11 @@ formatted_string describe_mutations() const char *mut_title = "Innate Abilities, Weirdness & Mutations"; // center title - int i; - i = 39 - strlen(mut_title) / 2; - if (i<0) i=0; + int offset = 39 - strlen(mut_title) / 2; + if ( offset < 0 ) offset = 0; + + result += std::string(offset, ' '); - result += std::string(i, ' '); result += ""; result += mut_title; result += "" EOL EOL; @@ -1085,9 +1085,15 @@ formatted_string describe_mutations() result += ""; + if ( beogh_water_walk() ) + { + result += "You can walk on water." EOL; + have_any = true; + } + textcolor(LIGHTGREY); - for (i = 0; i < NUM_MUTATIONS; i++) + for (int i = 0; i < NUM_MUTATIONS; i++) { if (you.mutation[i] != 0) { diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 212d51df25..5f9ce21e6f 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1670,6 +1670,14 @@ std::string status_mut_abilities() have_any = true; } + if ( beogh_water_walk() ) + { + if (have_any) + text += ", "; + text += "water walking"; + have_any = true; + } + for (unsigned i = 0; i < NUM_MUTATIONS; i++) { if (!you.mutation[i]) diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 8c0f699c08..13bde58120 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -806,7 +806,7 @@ bool is_fixed_artefact( const item_def &item ) return (false); } -int get_unique_item_status( int base_type, int art ) +unique_item_status_type get_unique_item_status( int base_type, int art ) { // Note: for weapons "art" is in item.special, // for orbs it's the sub_type. @@ -827,7 +827,8 @@ int get_unique_item_status( int base_type, int art ) return (UNIQ_NOT_EXISTS); } -void set_unique_item_status( int base_type, int art, int status ) +void set_unique_item_status( int base_type, int art, + unique_item_status_type status ) { // Note: for weapons "art" is in item.special, // for orbs it's the sub_type. diff --git a/crawl-ref/source/randart.h b/crawl-ref/source/randart.h index fc8f3905d7..5af4023cf9 100644 --- a/crawl-ref/source/randart.h +++ b/crawl-ref/source/randart.h @@ -28,8 +28,9 @@ bool is_random_artefact( const item_def &item ); bool is_unrandom_artefact( const item_def &item ); bool is_fixed_artefact( const item_def &item ); -int get_unique_item_status( int base_type, int type ); -void set_unique_item_status( int base_type, int type, int status ); +unique_item_status_type get_unique_item_status( int base_type, int type ); +void set_unique_item_status( int base_type, int type, + unique_item_status_type status ); /* *********************************************************************** * called from: itemname diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index c9e62028cc..11212e6373 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -1418,9 +1418,24 @@ void gain_piety(int pgn) do_god_gift(); } +bool beogh_water_walk() +{ + return + you.religion == GOD_BEOGH && + !player_under_penance() && + you.piety >= piety_breakpoint(4); +} + +static bool need_water_walking() +{ + return + !player_is_levitating() && you.species != SP_MERFOLK && + grd[you.x_pos][you.y_pos] == DNGN_DEEP_WATER; +} + void lose_piety(int pgn) { - int old_piety = you.piety; + const int old_piety = you.piety; if (you.piety - pgn < 0) you.piety = 0; @@ -1454,19 +1469,15 @@ void lose_piety(int pgn) god_speaks(you.religion, info); } } - if (you.religion == GOD_BEOGH) - + + if ( need_water_walking() && !beogh_water_walk() ) + { + fall_into_a_pool( you.x_pos, you.y_pos, true, + grd[you.x_pos][you.y_pos] ); + } + + if ( you.religion == GOD_BEOGH ) { - // You might have lost water walking at a bad time... - if ( old_piety >= piety_breakpoint(4) && - you.piety < piety_breakpoint(4) && - grd[you.x_pos][you.y_pos] == DNGN_DEEP_WATER && - !player_is_levitating() ) - { - fall_into_a_pool( you.x_pos, you.y_pos, true, - DNGN_DEEP_WATER ); - } - // every piety level change also affects AC from // orcish gear you.redraw_armour_class = 1; @@ -2279,11 +2290,9 @@ void excommunication(void) followers_abandon_you(); // check if friendly orcs around -> hostile // You might have lost water walking at a bad time... - if ( grd[you.x_pos][you.y_pos] == DNGN_DEEP_WATER && - !player_is_levitating() ) - { - fall_into_a_pool( you.x_pos, you.y_pos, true, DNGN_DEEP_WATER ); - } + if ( need_water_walking() ) + fall_into_a_pool( you.x_pos, you.y_pos, true, + grd[you.x_pos][you.y_pos] ); // Penance has to come before retribution to prevent "mollify" inc_penance( old_god, 50 ); diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index ce70316288..9e4bbfeea8 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -44,6 +44,8 @@ void xom_is_stimulated(int maxinterestingness); void xom_acts(bool niceness, int sever); const char *describe_xom_favour(); +bool beogh_water_walk(); + inline void xom_acts(int sever) { xom_acts(xom_is_nice(), sever); diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 159b82bd05..41de4143fc 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -1214,7 +1214,8 @@ static void tag_read_you_items(struct tagHeader &th, char minorVersion) // how many unique items? count_c = unmarshallByte(th); for (j = 0; j < count_c; ++j) - you.unique_items[j] = unmarshallByte(th); + you.unique_items[j] = + static_cast(unmarshallByte(th)); // how many books? count_c = unmarshallByte(th); -- cgit v1.2.3-54-g00ecf