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-28 14:09:26 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-28 14:09:26 +0000
commit90d0e8c3f9d3fdcd0aa0ef1a479ad178ca3ad7e2 (patch)
tree0b0c8adc8bd00bc67b00f9e76e5db073339792e0 /crawl-ref/source/player.cc
parent971e4ca792042d987cd898ae8144f849da188f2f (diff)
downloadcrawl-ref-90d0e8c3f9d3fdcd0aa0ef1a479ad178ca3ad7e2.tar.gz
crawl-ref-90d0e8c3f9d3fdcd0aa0ef1a479ad178ca3ad7e2.zip
Fix 2471146: equipment being melded due to mutations.
Fix 2426301: melding not working properly for Merfolk transformation. Colour melded equipment darkgrey on the % screen. Disallow Merfolk slipping out of their boots if doing so would kill the player due to stat loss. (Falling into water when flying will still kill them.) When this is the case, deep water is regarded as unsafe for travel. TODO: Ending a transformation should likewise be impossible if doing so would cause stat loss due to unmelding of items. Add a stat_colour option to highlight the stats when they're below a given threshold. By default, lightred at 1, red at 2-3. You could argue for setting the default to 7 but that would mean colouring almost all stats for each beginning character. (FR 2022232) Tidy up the stat colouring methods. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8004 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc85
1 files changed, 49 insertions, 36 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index ae98021ff6..526e6358eb 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -223,48 +223,64 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
// Only consider terrain if player is not levitating.
if (!player_is_airborne())
{
- // XXX: at some point we're going to need to fix the swimming
- // code to handle burden states.
- if (is_grid_dangerous(new_grid))
+ bool merfolk_check = false;
+ if (you.species == SP_MERFOLK)
{
- // lava and dangerous deep water (ie not merfolk)
- const coord_def entry = (stepped) ? you.pos() : p;
+ if (grid_is_water(new_grid))
+ merfolk_check = true;
- if (stepped && !force && !you.confused())
+ // Safer water effects.
+ if (grid_is_water(new_grid) && !grid_is_water(old_grid))
{
- canned_msg(MSG_UNTHINKING_ACT);
- return (false);
- }
-
- // Have to move now so fall_into_a_pool will work.
- you.moveto(p);
+ // Check for fatal stat loss due to transforming.
+ // Also handles the warning message.
+ if (!merfolk_change_is_safe())
+ {
+ stop_running();
+ you.turn_is_over = false;
+ return (false);
+ }
- viewwindow( true, false );
+ if (stepped)
+ mpr("Your legs become a tail as you enter the water.");
+ else
+ mpr("Your legs become a tail as you dive into the water.");
- // If true, we were shifted and so we're done.
- if (fall_into_a_pool( entry, allow_shift, new_grid ))
- return (true);
+ merfolk_start_swimming();
+ }
+ else if (!grid_is_water(new_grid) && grid_is_water(old_grid))
+ {
+ unmeld_one_equip(EQ_BOOTS);
+ you.redraw_evasion = true;
+ }
}
- else if (new_grid == DNGN_SHALLOW_WATER || new_grid == DNGN_DEEP_WATER)
+
+ if (!merfolk_check)
{
- // Safer water effects.
- if (you.species == SP_MERFOLK)
+ // XXX: at some point we're going to need to fix the swimming
+ // code to handle burden states.
+ if (is_grid_dangerous(new_grid))
{
- if (old_grid != DNGN_SHALLOW_WATER
- && old_grid != DNGN_DEEP_WATER)
- {
- if (stepped)
- mpr("Your legs become a tail as you enter the water.");
- else
- mpr("Your legs become a tail as you dive into the water.");
+ // Lava and dangerous deep water (ie not merfolk).
+ const coord_def entry = (stepped) ? you.pos() : p;
- merfolk_start_swimming();
+ if (stepped && !force && !you.confused())
+ {
+ canned_msg(MSG_UNTHINKING_ACT);
+ return (false);
}
+
+ // Have to move now so fall_into_a_pool will work.
+ you.moveto(p);
+
+ viewwindow( true, false );
+
+ // If true, we were shifted and so we're done.
+ if (fall_into_a_pool( entry, allow_shift, new_grid ))
+ return (true);
}
- else if (!player_likes_water())
+ else if (new_grid == DNGN_SHALLOW_WATER && !player_likes_water())
{
- ASSERT( new_grid != DNGN_DEEP_WATER );
-
if (!stepped)
noisy(SL_SPLASH, you.pos(), "Splash!");
@@ -283,11 +299,6 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
}
}
}
- else if (!grid_is_water(new_grid) && grid_is_water(old_grid)
- && you.species == SP_MERFOLK)
- {
- you.redraw_evasion = true;
- }
}
// Move the player to new location.
@@ -5886,7 +5897,9 @@ bool player::in_water() const
bool player::can_swim() const
{
- return (species == SP_MERFOLK);
+ // Transforming could be fatal if it would cause unequipment of
+ // stat-boosting boots or heavy armour.
+ return (species == SP_MERFOLK && merfolk_change_is_safe(true));
}
bool player::swimming() const