diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-02-29 22:53:57 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-02-29 22:53:57 +0000 |
commit | 0eaec3460042bac94f3ef0e5538f0aa17da41b1a (patch) | |
tree | cd5efccd8c19b039cbb7fdad5b3ccc8b9db498ab /crawl-ref/source/effects.cc | |
parent | 3a6a9408cc571b76b676e7317beea3f2d9af72e8 (diff) | |
download | crawl-ref-0eaec3460042bac94f3ef0e5538f0aa17da41b1a.tar.gz crawl-ref-0eaec3460042bac94f3ef0e5538f0aa17da41b1a.zip |
Tidy up Xom effects a bit in that berserk and vitrification will only give
a message if they actually happen. Also, add some more flavour messages for
vitrification.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3494 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r-- | crawl-ref/source/effects.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index d70a41fc14..08f8fdd1cd 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1982,24 +1982,37 @@ bool forget_inventory(bool quiet) return (items_forgotten > 0); } -void vitrify_area(int radius) +// returns true if there was a visible change +bool vitrify_area(int radius) { + if (radius < 2) + return (false); + const int radius2 = radius * radius; + // this hinges on clear wall types having the same order as non-clear ones + const int clear_plus = DNGN_CLEAR_ROCK_WALL - DNGN_ROCK_WALL; + bool something_happened = false; for ( int x = X_BOUND_1; x <= X_BOUND_2; ++x ) { for ( int y = Y_BOUND_1; y <= Y_BOUND_2; ++y ) { if ( distance(x,y,you.x_pos,you.y_pos) < radius2 ) { - if ( grd[x][y] == DNGN_ROCK_WALL ) - grd[x][y] = DNGN_CLEAR_ROCK_WALL; - else if ( grd[x][y] == DNGN_STONE_WALL ) - grd[x][y] = DNGN_CLEAR_STONE_WALL; - else if ( grd[x][y] == DNGN_PERMAROCK_WALL ) - grd[x][y] = DNGN_CLEAR_PERMAROCK_WALL; + dungeon_feature_type grid = grd[x][y]; + + if (grid == DNGN_ROCK_WALL + || grid == DNGN_STONE_WALL + || grid == DNGN_PERMAROCK_WALL ) + { + grd[x][y] + = static_cast<dungeon_feature_type>(grid + clear_plus); + something_happened = true; + } } } } + + return (something_happened); } /////////////////////////////////////////////////////////////////////// |