diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-19 06:42:50 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-19 06:42:50 +0000 |
commit | 4958b84b497fe729eaf14bc90b8d01874722c33d (patch) | |
tree | 12bce6e34f779166f7cdcefee95255b53d9ba8b3 /crawl-ref/source/spells1.cc | |
parent | 63318a4b57b03ffc4686e4a3b78d64b73f50b6b9 (diff) | |
download | crawl-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/spells1.cc')
-rw-r--r-- | crawl-ref/source/spells1.cc | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index bd82ad3684..b419fe0bf7 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -62,7 +62,10 @@ static bool abyss_blocks_teleport(bool cblink) return (cblink? one_chance_in(3) : !one_chance_in(3)); } -int blink(int pow, bool high_level_controlled_blink) +// If wizard_blink is set, all restriction are ignored (except for +// a monster being at the target spot), and the player gains no +// contamination. +int blink(int pow, bool high_level_controlled_blink, bool wizard_blink) { dist beam; @@ -75,14 +78,17 @@ int blink(int pow, bool high_level_controlled_blink) } // yes, there is a logic to this ordering {dlb}: - if (scan_randarts(RAP_PREVENT_TELEPORTATION)) + if (scan_randarts(RAP_PREVENT_TELEPORTATION) && !wizard_blink) mpr("You feel a weird sense of stasis."); else if (you.level_type == LEVEL_ABYSS - && abyss_blocks_teleport(high_level_controlled_blink)) + && abyss_blocks_teleport(high_level_controlled_blink) + && !wizard_blink) + { mpr("The power of the Abyss keeps you in your place!"); - else if (you.duration[DUR_CONF]) + } + else if (you.duration[DUR_CONF] && !wizard_blink) random_blink(false); - else if (!allow_control_teleport(true)) + else if (!allow_control_teleport(true) && !wizard_blink) { mpr("A powerful magic interferes with your control of the blink."); if (high_level_controlled_blink) @@ -98,7 +104,8 @@ int blink(int pow, bool high_level_controlled_blink) if (!beam.isValid || coord_def(beam.tx, beam.ty) == you.pos()) { - if (!yesno("Are you sure you want to cancel this blink?", + if (!wizard_blink && + !yesno("Are you sure you want to cancel this blink?", false, 'n')) { mesclr(); @@ -108,22 +115,37 @@ int blink(int pow, bool high_level_controlled_blink) return (-1); // early return {dlb} } - if (see_grid(beam.tx, beam.ty)) + // Wizard blink can move past translucent walls. + if (see_grid_no_trans(beam.tx, beam.ty)) break; + else if (trans_wall_blocking( beam.tx, beam.ty )) + { + // Wizard blink can move past translucent walls. + if (wizard_blink) + break; + + mesclr(); + mpr("You can't blink through translucent walls."); + } else { mesclr(); - mpr("You can't blink there!"); + mpr("You can only blink to visible locations."); } } + // Allow wizard blink to send player into walls, in case + // the user wants to alter that grid to something else. + if (grid_is_solid(grd[beam.tx][beam.ty]) && wizard_blink) + grd[beam.tx][beam.ty] = DNGN_FLOOR; + if (grid_is_solid(grd[beam.tx][beam.ty]) || mgrd[beam.tx][beam.ty] != NON_MONSTER) { mpr("Oops! Maybe something was there already."); random_blink(false); } - else if (you.level_type == LEVEL_ABYSS) + else if (you.level_type == LEVEL_ABYSS && !wizard_blink) { abyss_teleport( false ); you.pet_target = MHITNOT; @@ -142,10 +164,11 @@ int blink(int pow, bool high_level_controlled_blink) move_player_to_grid(beam.tx, beam.ty, false, true, true); // controlling teleport contaminates the player -- bwr - contaminate_player( 1 ); + if (!wizard_blink) + contaminate_player( 1 ); } - if (you.duration[DUR_CONDENSATION_SHIELD] > 0) + if (you.duration[DUR_CONDENSATION_SHIELD] > 0 && !wizard_blink) { you.duration[DUR_CONDENSATION_SHIELD] = 0; you.redraw_armour_class = 1; @@ -170,7 +193,10 @@ void random_blink(bool allow_partial_control, bool override_abyss) { mpr("The power of the Abyss keeps you in your place!"); } - else if (!random_near_space(you.x_pos, you.y_pos, tx, ty)) + // First try to find a random square not adjacent to the player, + // then one adjacent if that fails. + else if (!random_near_space(you.x_pos, you.y_pos, tx, ty) + && !random_near_space(you.x_pos, you.y_pos, tx, ty, true)) { mpr("You feel jittery for a moment."); } @@ -377,7 +403,7 @@ void cast_chain_lightning( int powc ) else if (!see_source && see_targ) mpr( "The lightning arc suddenly appears!" ); - if (!see_targ) + if (!see_grid_no_trans( tx, ty )) { // It's no longer in the caster's LOS and influence. powc = powc / 2 + 1; @@ -476,7 +502,12 @@ bool conjure_flame(int pow) return false; } - if (!see_grid(spelld.tx, spelld.ty)) + if (trans_wall_blocking(spelld.tx, spelld.ty)) + { + mpr("A translucent wall is in the way."); + return false; + } + else if (!see_grid(spelld.tx, spelld.ty)) { mpr("You can't see that place!"); continue; |