From a825726eed2e6f9387c495d6858170aa22983bed Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Tue, 1 Dec 2009 12:29:48 +0100 Subject: Simplify passwall. Treatment of entry point and later obstacles is unified. It doesn't work as "detect secret door" anymore. This also means that you can now passwall into statues -- before, you could passwall through them but not start with one. --- crawl-ref/source/spells4.cc | 83 ++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 46 deletions(-) (limited to 'crawl-ref/source/spells4.cc') diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 242d8c6c9e..eea4f514e8 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -898,67 +898,58 @@ int make_a_normal_cloud(coord_def where, int pow, int spread_rate, return 1; } -bool cast_passwall(const coord_def& delta, int pow) +bool _feat_is_passwallable(dungeon_feature_type feat) { - int howdeep = 0; - bool done = false; - int shallow = 1 + (you.skills[SK_EARTH_MAGIC] / 8); - coord_def n = you.pos() + delta; - - // Irony: you can start on a secret door but not a door. + // Irony: you can passwall through 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 // even allow statues (should be contiguous rock). -- bwr - // XXX: Allow statues as entry points? - if (grd(n) != DNGN_ROCK_WALL && grd(n) != DNGN_CLEAR_ROCK_WALL) + switch (feat) { - mpr("That's not a passable wall."); + case DNGN_ROCK_WALL: + case DNGN_CLEAR_ROCK_WALL: + case DNGN_ORCISH_IDOL: + case DNGN_GRANITE_STATUE: + case DNGN_SECRET_DOOR: + return (true); + default: return (false); } +} - // Below here, failing to cast yields information to the - // player, so we don't make the spell abort (return true). +bool cast_passwall(const coord_def& delta, int pow) +{ + int shallow = 1 + (you.skills[SK_EARTH_MAGIC] / 8); + int range = shallow + random2(pow) / 25; + int maxrange = shallow + pow / 25; - while (!done) + coord_def n = you.pos() + delta; + if (!_feat_is_passwallable(grid_appearance(n))) { - if (!in_bounds(n)) - { - mpr("You sense an overwhelming volume of rock."); - return (true); - } - - switch (grd(n)) - { - default: - if (feat_is_solid(grd(n))) - { - mpr("Something is blocking your path through the rock."); - return (true); - } - done = true; - break; - - case DNGN_ROCK_WALL: - case DNGN_CLEAR_ROCK_WALL: - case DNGN_ORCISH_IDOL: - case DNGN_GRANITE_STATUE: - case DNGN_SECRET_DOOR: - n += delta; - howdeep++; - break; - } + mpr("That's not a passable wall."); + return (false); } - int range = shallow + random2(pow) / 25; - int maxrange = shallow + pow / 25; + // Below here, failing to cast yields information to the + // player, so we don't make the spell abort (return true). - if (howdeep >= maxrange) - mprf("This rock feels extremely deep."); + int howdeep; + for (howdeep = 1; in_bounds(n) && _feat_is_passwallable(grd(n)); + n += delta, howdeep++); + + if (!in_bounds(n)) + mpr("You sense an overwhelming volume of rock."); + else if (feat_is_solid(grd(n))) + mpr("Something is blocking your path through the rock."); + else if (howdeep > maxrange) + mpr("This rock feels extremely deep."); else if (howdeep > range) - mprf("You fail to penetrate the rock."); - else // Passwall delay is reduced, and the delay cannot be interrupted. + mpr("You fail to penetrate the rock."); + else + { + // Passwall delay is reduced, and the delay cannot be interrupted. start_delay(DELAY_PASSWALL, 1 + howdeep, n.x, n.y); - + } return (true); } -- cgit v1.2.3-54-g00ecf