summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells4.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-19 06:42:50 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-19 06:42:50 +0000
commit4958b84b497fe729eaf14bc90b8d01874722c33d (patch)
tree12bce6e34f779166f7cdcefee95255b53d9ba8b3 /crawl-ref/source/spells4.cc
parent63318a4b57b03ffc4686e4a3b78d64b73f50b6b9 (diff)
downloadcrawl-ref-4958b84b497fe729eaf14bc90b8d01874722c33d.tar.gz
crawl-ref-4958b84b497fe729eaf14bc90b8d01874722c33d.zip
Introduces three new wall types, translucent versions of the normal
rock wall, stone wall and permanent rock wall. These are for use in vaults, and are never randomly generated. Magically translucent versions of the normal wall types are used, rather than glass, so we don't have to figure out how glass would react to things like digging and Shatter, but can re-use the code for the normal wall types. I've tried to fix all the places where the old code assumes that any square which is visible to the player has no walls between it and the player, but I've probably missed lots; this will require a lot of play testing before its ready for non-developers. viewwindow() now has two calls to losight(), the second one determining what squares would be visible if all translucent walls were made transparent, so that there's a quick way to see if there's any translucent walls between the player and a square. This second call to losight() doesn't cause any noticeable slowdown for me, but it might on an older system. Other than viewwindow() making a second call to losight(), there shouldn't be any changes to game-play or game-logic if there aren't any translucent walls around. The wizard blinking command (&b) has been changed so that it ignores all normal restrictions except for needing to see the target square and not landing on monsters; if the player lands on a wall square it's changed to floor. Wizard blinking also doesn't increase magical contamination. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2145 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells4.cc')
-rw-r--r--crawl-ref/source/spells4.cc60
1 files changed, 51 insertions, 9 deletions
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 8a7b7511d7..852ca6cb68 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -360,11 +360,13 @@ static int shatter_walls(int x, int y, int pow, int garbage)
stuff = DEBRIS_STONE;
break;
+ case DNGN_CLEAR_STONE_WALL:
case DNGN_STONE_WALL:
chance = pow / 6;
stuff = DEBRIS_STONE;
break;
+ case DNGN_CLEAR_ROCK_WALL:
case DNGN_ROCK_WALL:
chance = pow / 4;
stuff = DEBRIS_ROCK;
@@ -1622,7 +1624,7 @@ static int passwall(int x, int y, int pow, int garbage)
int shallow = 1 + (you.skills[SK_EARTH_MAGIC] / 8);
// allow statues as entry points?
- if (grd[x][y] != DNGN_ROCK_WALL)
+ if (grd[x][y] != DNGN_ROCK_WALL && grd[x][y] != DNGN_CLEAR_ROCK_WALL)
// Irony: you can start on a secret door but not a door.
// Worked stone walls are out, they're not diggable and
// are used for impassable walls... I'm not sure we should
@@ -1651,6 +1653,7 @@ static int passwall(int x, int y, int pow, int garbage)
done = true;
break;
case DNGN_ROCK_WALL:
+ case DNGN_CLEAR_ROCK_WALL:
case DNGN_ORCISH_IDOL:
case DNGN_GRANITE_STATUE:
case DNGN_SECRET_DOOR:
@@ -2516,9 +2519,11 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike
// Stone and rock terrain
//
case DNGN_ROCK_WALL:
+ case DNGN_CLEAR_ROCK_WALL:
case DNGN_SECRET_DOOR:
blast.colour = env.rock_colour;
// fall-through
+ case DNGN_CLEAR_STONE_WALL:
case DNGN_STONE_WALL:
what = "wall";
if (player_in_branch( BRANCH_HALL_OF_ZOT ))
@@ -2545,7 +2550,11 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike
&& (grid == DNGN_ORCISH_IDOL
|| grid == DNGN_GRANITE_STATUE
|| (pow >= 40 && grid == DNGN_ROCK_WALL && one_chance_in(3))
- || (pow >= 60 && grid == DNGN_STONE_WALL && one_chance_in(10))))
+ || (pow >= 40 && grid == DNGN_CLEAR_ROCK_WALL
+ && one_chance_in(3))
+ || (pow >= 60 && grid == DNGN_STONE_WALL && one_chance_in(10))
+ || (pow >= 60 && grid == DNGN_CLEAR_STONE_WALL &&
+ one_chance_in(10)) ))
{
// terrain blew up real good:
blast.ex_size = 2;
@@ -2732,6 +2741,12 @@ bool cast_portaled_projectile(int pow, bolt& beam)
return false;
}
+ if (trans_wall_blocking( beam.target_x, beam.target_y ))
+ {
+ mpr("A translucent wall is in the way.");
+ return 0;
+ }
+
const int idx = get_fire_item_index();
if ( idx == ENDOFPACK )
{
@@ -2776,6 +2791,12 @@ void cast_far_strike(int pow)
return;
}
+ if (trans_wall_blocking( targ.tx, targ.ty ))
+ {
+ mpr("A translucent wall is in the way.");
+ return;
+ }
+
// Start with weapon base damage...
const int weapon = you.equip[ EQ_WEAPON ];
@@ -2898,6 +2919,12 @@ int cast_apportation(int pow)
return (-1);
}
+ if (trans_wall_blocking( beam.tx, beam.ty ))
+ {
+ mpr("A translucent wall is in the way.");
+ return (0);
+ }
+
// Protect the player from destroying the item
const dungeon_feature_type grid = grd[ you.x_pos ][ you.y_pos ];
@@ -3074,20 +3101,35 @@ static int quadrant_blink(int x, int y, int pow, int garbage)
const int dist = random2(6) + 2; // 2-7
const int ox = you.x_pos + (x - you.x_pos) * dist;
const int oy = you.y_pos + (y - you.y_pos) * dist;
-
+
+ // This can take a while if pow is high and there's lots of translucent
+ // walls nearby.
int tx, ty;
+ bool found = false;
for ( int i = 0; i < (pow*pow) / 500 + 1; ++i )
{
- // find a space near our target...
- if ( !random_near_space(ox, oy, tx, ty) )
+ // find a space near our target... First try to find a random
+ // square not adjacent to the player, then one adjacent if
+ // that fails.
+ if ( !random_near_space(ox, oy, tx, ty) &&
+ !random_near_space(ox, oy, tx, ty, true))
return 0;
-
+
// which is close enough, and also far enough from us
- if ( distance(ox, oy, tx, ty) <= 10 &&
- distance(you.x_pos, you.y_pos, tx, ty) >= 8 )
- break;
+ if ( distance(ox, oy, tx, ty) > 10 &&
+ distance(you.x_pos, you.y_pos, tx, ty) < 8 )
+ continue;
+
+ if (!see_grid_no_trans(tx, ty))
+ continue;
+
+ found = true;
+ break;
}
+ if (!found)
+ return(0);
+
you.moveto(tx, ty);
return 1;
}