summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-19 05:12:15 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-19 05:12:15 +0000
commit30824b7084af3c2dce35d2eae4d4600f67ab4e06 (patch)
tree852963a375c0c492fd9202bfa2d1d64842b4f285 /crawl-ref/source/misc.cc
parent10391ff4e676a29fbc2836d1494ed2aae4b112a7 (diff)
downloadcrawl-ref-30824b7084af3c2dce35d2eae4d4600f67ab4e06.tar.gz
crawl-ref-30824b7084af3c2dce35d2eae4d4600f67ab4e06.zip
Added "The Stairs" card (not yet in any deck), eventually to be the card which
re-arranges all stairs on the level, but now is just used to test the code used to move stairs in LOS away or towards the player. Added beam flavour BEAM_VISUAL for animating someting moving in a line which doesn't have any effects on its own, and removed BEAM_LINE_OF_SIGHT, which was no longer being used. Added bolt structure field "delay", which can be used to change the delay between animating each square in a beam from the default of 15 msec. For eventual use as a Xom effect added the stairs-are-avoiding-you durations DUR_REPEL_STAIRS_MOVE and DUR_REPEL_STAIRS_CLIMB. If DUR_REPEL_STAIRS_MOVE alone is set then stepping onto a stairs/portal/etc has a 50% chance of making it move away in a random direction. If DUR_REPEL_STAIRS_CLIMB alone is set then attempting to climb a stairs/etc has a 50% chance of making it move away before you can get through it (and ending your turn in the process). If both are set then moving onto it and attempting to climb each have a 29% chance of making it move, for a combined chance of 49.59% of a move-and-climb making the stairs move away. Once a stair is successfully taken there's a 50% chance of the stair on the other end moving away from the player, and then both durations are reset to 0. These can be tested by drawing The Stairs card ("&c stair"), which will set DUR_REPEL_STAIRS_CLIMB if you're on top of a stair or DUR_REPEL_STAIRS_MOVE if your'e not. Added a few wizard targetting command placeholders. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7865 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc52
1 files changed, 46 insertions, 6 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index bcfa786c16..89155a97de 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1658,6 +1658,46 @@ static bool _marker_vetoes_level_change()
return (marker_vetoes_operation("veto_level_change"));
}
+static bool _stair_moves_pre(dungeon_feature_type stair)
+{
+ if (crawl_state.prev_cmd == CMD_WIZARD)
+ return (false);
+
+ if (stair != grd(you.pos()))
+ return (false);
+
+ if (grid_stair_direction(stair) == CMD_NO_CMD)
+ return (false);
+
+ if (!you.duration[DUR_REPEL_STAIRS_CLIMB])
+ return (false);
+
+ int pct;
+ if (you.duration[DUR_REPEL_STAIRS_MOVE])
+ pct = 29;
+ else
+ pct = 50;
+
+ if (!x_chance_in_y(pct, 100))
+ return (false);
+
+ // Get feature name before sliding stair over.
+ std::string stair_str =
+ feature_description(you.pos(), false, DESC_CAP_THE, false);
+
+ if (!slide_feature_over(you.pos(), coord_def(-1, -1), false))
+ return (false);
+
+ std::string verb = stair_climb_verb(stair);
+
+ mprf("%s moves away as you attempt to %s it!", stair_str.c_str(),
+ verb.c_str());
+
+ you.turn_is_over = true;
+
+ return (true);
+}
+
void up_stairs(dungeon_feature_type force_stair,
entry_cause_type entry_cause)
{
@@ -1684,6 +1724,9 @@ void up_stairs(dungeon_feature_type force_stair,
return;
}
+ if (_stair_moves_pre(stair_find))
+ return;
+
// Since the overloaded message set turn_is_over, I'm assuming that
// the overloaded character makes an attempt... so we're doing this
// check before that one. -- bwr
@@ -2039,6 +2082,8 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
return;
}
+ if (_stair_moves_pre(stair_find))
+ return;
if (shaft)
{
@@ -2194,13 +2239,8 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
{
std::string fall_where = "down the stairs";
- if (stair_find == DNGN_ENTER_ABYSS
- || stair_find == DNGN_ENTER_PANDEMONIUM
- || stair_find == DNGN_TRANSIT_PANDEMONIUM
- || stair_find == DNGN_ENTER_PORTAL_VAULT)
- {
+ if (!grid_is_staircase(stair_find))
fall_where = "through the gate";
- }
mprf("In your confused state, you trip and fall %s.",
fall_where.c_str());