summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.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/player.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/player.cc')
-rw-r--r--crawl-ref/source/player.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index e1fc214bcb..082f504a07 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -308,6 +308,32 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
if (trap_def* ptrap = find_trap(you.pos()))
ptrap->trigger(you, !stepped); // blinking makes it hard to evade
+ command_type stair_dir = grid_stair_direction(new_grid);
+
+ if (stepped && stair_dir != CMD_NO_CMD
+ && you.duration[DUR_REPEL_STAIRS_MOVE])
+ {
+ int pct;
+ if (you.duration[DUR_REPEL_STAIRS_CLIMB])
+ pct = 29;
+ else
+ pct = 50;
+
+ if (x_chance_in_y(pct, 100))
+ {
+ if (slide_feature_over(you.pos(), coord_def(-1, -1), false))
+ {
+ std::string stair_str =
+ feature_description(new_grid, NUM_TRAPS, false,
+ DESC_CAP_THE, false);
+ std::string prep = grid_preposition(new_grid, true, &you);
+
+ mprf("%s slides away as you move %s it!", stair_str.c_str(),
+ prep.c_str());
+ }
+ }
+ }
+
return (true);
}