summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-01 16:32:51 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-01 16:32:51 +0000
commitae2d625b606950d4224af940e14517dbc3e046d3 (patch)
tree865ec87156321457a2bfa4154f9cb2d80a8bf140 /crawl-ref/source/player.cc
parentc2a617f20f11fd539a12b5c391455fb35faf2b92 (diff)
downloadcrawl-ref-ae2d625b606950d4224af940e14517dbc3e046d3.tar.gz
crawl-ref-ae2d625b606950d4224af940e14517dbc3e046d3.zip
Make sirens draw the player in their direction. This will not actually
pull the player into deep water, but it's a scary enough effect. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7711 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc150
1 files changed, 77 insertions, 73 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index f9dac8ce42..8d5ff3a482 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -116,101 +116,105 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
|| !swapping && (mgrd(p) == NON_MONSTER
|| mons_is_submerged( &menv[ mgrd(p) ])));
- const int cloud = env.cgrid(p);
- if (cloud != EMPTY_CLOUD && !you.confused())
- {
- const cloud_type ctype = env.cloud[ cloud ].type;
- // Don't prompt if already in a cloud of the same type.
- if (is_damaging_cloud(ctype, true)
- && (env.cgrid(you.pos()) == EMPTY_CLOUD
- || ctype != env.cloud[ env.cgrid(you.pos()) ].type))
+ // Don't prompt if force is true.
+ if (!force)
+ {
+ const int cloud = env.cgrid(p);
+ if (cloud != EMPTY_CLOUD && !you.confused())
{
- std::string prompt = make_stringf(
- "Really step into that cloud of %s?",
- cloud_name(ctype).c_str());
-
- if (!yesno(prompt.c_str(), false, 'n'))
+ const cloud_type ctype = env.cloud[ cloud ].type;
+ // Don't prompt if already in a cloud of the same type.
+ if (is_damaging_cloud(ctype, true)
+ && (env.cgrid(you.pos()) == EMPTY_CLOUD
+ || ctype != env.cloud[ env.cgrid(you.pos()) ].type))
{
- canned_msg(MSG_OK);
- you.turn_is_over = false;
- return (false);
+ std::string prompt = make_stringf(
+ "Really step into that cloud of %s?",
+ cloud_name(ctype).c_str());
+
+ if (!yesno(prompt.c_str(), false, 'n'))
+ {
+ canned_msg(MSG_OK);
+ you.turn_is_over = false;
+ return (false);
+ }
}
}
- }
- // If we're walking along, give a chance to avoid traps.
- if (stepped && !force && !you.confused())
- {
- if (new_grid == DNGN_UNDISCOVERED_TRAP)
+ // If we're walking along, give a chance to avoid traps.
+ if (stepped && !you.confused())
{
- const int skill = 4 + you.skills[SK_TRAPS_DOORS]
- + player_mutation_level(MUT_ACUTE_VISION)
- - 2 * player_mutation_level(MUT_BLURRY_VISION);
-
- if (random2(skill) > 6)
+ if (new_grid == DNGN_UNDISCOVERED_TRAP)
{
- if (trap_def* ptrap = find_trap(p))
- ptrap->reveal();
+ const int skill = 4 + you.skills[SK_TRAPS_DOORS]
+ + player_mutation_level(MUT_ACUTE_VISION)
+ - 2 * player_mutation_level(MUT_BLURRY_VISION);
- viewwindow(true, false);
+ if (random2(skill) > 6)
+ {
+ if (trap_def* ptrap = find_trap(p))
+ ptrap->reveal();
- mprf( MSGCH_WARN,
- "Wait a moment, %s! Do you really want to step there?",
- you.your_name );
+ viewwindow(true, false);
- if (!you.running.is_any_travel())
- more();
+ mprf( MSGCH_WARN,
+ "Wait a moment, %s! Do you really want to step there?",
+ you.your_name );
- exercise( SK_TRAPS_DOORS, 3 );
+ if (!you.running.is_any_travel())
+ more();
- you.turn_is_over = false;
+ exercise( SK_TRAPS_DOORS, 3 );
- return (false);
+ you.turn_is_over = false;
+
+ return (false);
+ }
}
- }
- else if (new_grid == DNGN_TRAP_MAGICAL
+ else if (new_grid == DNGN_TRAP_MAGICAL
#ifdef CLUA_BINDINGS
- || new_grid == DNGN_TRAP_MECHANICAL
- && Options.trap_prompt
+ || new_grid == DNGN_TRAP_MECHANICAL
+ && Options.trap_prompt
#endif
- || new_grid == DNGN_TRAP_NATURAL)
- {
- const trap_type type = get_trap_type(p);
- if (type == TRAP_ZOT)
+ || new_grid == DNGN_TRAP_NATURAL)
{
- if (!yes_or_no("Do you really want to step into the Zot trap"))
+ const trap_type type = get_trap_type(p);
+ if (type == TRAP_ZOT)
{
- canned_msg(MSG_OK);
- stop_running();
- you.turn_is_over = false;
- return (false);
+ if (!yes_or_no("Do you really want to step into the Zot trap"))
+ {
+ canned_msg(MSG_OK);
+ stop_running();
+ you.turn_is_over = false;
+ return (false);
+ }
}
- }
- else if (new_grid != DNGN_TRAP_MAGICAL && you.airborne())
- {
- // No prompt (shaft and mechanical traps ineffective, if flying)
- }
- else
+ else if (new_grid != DNGN_TRAP_MAGICAL && you.airborne())
+ {
+ // No prompt (shaft and mechanical traps ineffective, if flying)
+ }
+ else
#ifdef CLUA_BINDINGS
- // Prompt for any trap where you might not have enough hp
- // as defined in init.txt (see trapwalk.lua)
- if (new_grid != DNGN_TRAP_MECHANICAL
- || !clua.callbooleanfn(false, "ch_cross_trap",
- "s", trap_name(p.x, p.y)))
+ // Prompt for any trap where you might not have enough hp
+ // as defined in init.txt (see trapwalk.lua)
+ if (new_grid != DNGN_TRAP_MECHANICAL
+ || !clua.callbooleanfn(false, "ch_cross_trap",
+ "s", trap_name(p.x, p.y)))
#endif
- {
- std::string prompt = make_stringf(
- "Really step %s that %s?",
- (type == TRAP_ALARM) ? "onto" : "into",
- feature_description(new_grid, type,
- false, DESC_BASENAME, false).c_str());
-
- if (!yesno(prompt.c_str(), true, 'n'))
{
- canned_msg(MSG_OK);
- stop_running();
- you.turn_is_over = false;
- return (false);
+ std::string prompt = make_stringf(
+ "Really step %s that %s?",
+ (type == TRAP_ALARM) ? "onto" : "into",
+ feature_description(new_grid, type,
+ false, DESC_BASENAME, false).c_str());
+
+ if (!yesno(prompt.c_str(), true, 'n'))
+ {
+ canned_msg(MSG_OK);
+ stop_running();
+ you.turn_is_over = false;
+ return (false);
+ }
}
}
}