summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-29 22:53:57 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-29 22:53:57 +0000
commit0eaec3460042bac94f3ef0e5538f0aa17da41b1a (patch)
treecd5efccd8c19b039cbb7fdad5b3ccc8b9db498ab
parent3a6a9408cc571b76b676e7317beea3f2d9af72e8 (diff)
downloadcrawl-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
-rw-r--r--crawl-ref/source/effects.cc27
-rw-r--r--crawl-ref/source/effects.h2
-rw-r--r--crawl-ref/source/xom.cc30
3 files changed, 41 insertions, 18 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);
}
///////////////////////////////////////////////////////////////////////
diff --git a/crawl-ref/source/effects.h b/crawl-ref/source/effects.h
index 36d6537fc3..115af95922 100644
--- a/crawl-ref/source/effects.h
+++ b/crawl-ref/source/effects.h
@@ -113,7 +113,7 @@ void torment( int caster, int tx, int ty );
int torment_monsters(int x, int y, int pow, int caster);
bool forget_inventory(bool quiet = false);
-void vitrify_area(int radius);
+bool vitrify_area(int radius);
void update_corpses(double elapsedTime);
void update_level(double elapsedTime);
void handle_time( long time_delta );
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index e6aa796b0b..e24bf35c7b 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -496,12 +496,6 @@ static bool xom_is_good(int sever)
if (random2(sever) <= 1)
{
- god_speaks(GOD_XOM, random_choose_string(
- "\"Go forth and destroy!\"",
- "\"Go forth and cause havoc, mortal!\"",
- "Xom grants you a minor favour.",
- "Xom smiles on you.", NULL));
-
potion_type type = (potion_type)random_choose(
POT_HEALING, POT_HEAL_WOUNDS, POT_SPEED, POT_MIGHT,
POT_INVISIBILITY, POT_BERSERK_RAGE, POT_EXPERIENCE, -1);
@@ -509,7 +503,18 @@ static bool xom_is_good(int sever)
if (type == POT_EXPERIENCE && !one_chance_in(6))
type = POT_BERSERK_RAGE;
if (type == POT_BERSERK_RAGE)
+ {
+ if (!you.can_go_berserk(false)) // no message
+ goto try_again;
you.berserk_penalty = NO_BERSERK_PENALTY;
+ }
+
+ god_speaks(GOD_XOM, random_choose_string(
+ "\"Go forth and destroy!\"",
+ "\"Go forth and cause havoc, mortal!\"",
+ "Xom grants you a minor favour.",
+ "Xom smiles on you.", NULL));
+
potion_effect(type, 150);
done = true;
}
@@ -524,6 +529,7 @@ static bool xom_is_good(int sever)
"\"Serve the mortal, my children!\"",
"Xom grants you some temporary aid.",
"Xom momentarily opens a gate.", NULL));
+
int numdemons = std::min(random2(random2(random2(sever+1)+1)+1)+2, 16);
for (int i = 0; i < numdemons; i++)
{
@@ -535,11 +541,15 @@ static bool xom_is_good(int sever)
}
else if (random2(sever) <= 4)
{
- const int radius = random2avg(sever/2, 3);
+ const int radius = random2avg(sever/2, 3) + 1;
+ if (!vitrify_area(radius)) // can fail with radius 1 or in open areas
+ goto try_again;
+
god_speaks(GOD_XOM, random_choose_string(
- // XXX need some more creative flavor text
+ "You feel watched.",
+ "Everything around seems to assume a strange transparency.",
+ "All the walls suddenly lose part of their structure.",
"Xom alters the dungeon around you.", NULL));
- vitrify_area(radius);
done = true;
}
else if (random2(sever) <= 5)
@@ -562,7 +572,7 @@ static bool xom_is_good(int sever)
}
else if (random2(sever) <= 7)
{
- if (! there_are_monsters_nearby())
+ if (!there_are_monsters_nearby())
goto try_again;
monsters* mon = get_random_nearby_monster();