summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.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/misc.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/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc31
1 files changed, 22 insertions, 9 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 0c3ae915f3..b28934a945 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1242,11 +1242,9 @@ void search_around( bool only_adjacent )
// Traps and doors stepdown skill:
// skill/(2x-1) for squares at distance x
int max_dist = (you.skills[SK_TRAPS_DOORS] + 1) / 2;
- if ( max_dist > 5 )
+ if (max_dist > 5)
max_dist = 5;
- if ( max_dist > 1 && only_adjacent )
- max_dist = 1;
- if ( max_dist < 1 )
+ if (only_adjacent && max_dist > 1 || max_dist < 1)
max_dist = 1;
for (radius_iterator ri(you.pos(), max_dist); ri; ++ri )
@@ -1297,21 +1295,36 @@ void search_around( bool only_adjacent )
}
}
-void merfolk_start_swimming(void)
+bool merfolk_change_is_safe(bool quiet)
+{
+ // If already transformed, no subsequent transformation necessary.
+ if (!player_is_airborne() && grid_is_water(grd(you.pos())))
+ return (true);
+
+ std::set<equipment_type> r;
+ r.insert(EQ_BOOTS);
+ if (!player_light_armour())
+ r.insert(EQ_BODY_ARMOUR);
+
+ if (check_transformation_stat_loss(r, quiet))
+ return (false);
+
+ return (true);
+}
+
+void merfolk_start_swimming()
{
if (you.attribute[ATTR_TRANSFORMATION] != TRAN_NONE)
untransform();
- std::set<equipment_type> removed;
- removed.insert(EQ_BOOTS);
+ remove_one_equip(EQ_BOOTS);
// Perhaps a bit to easy for the player, but we allow merfolk
// to slide out of heavy body armour freely when entering water,
// rather than handling emcumbered swimming. -- bwr
if (!player_light_armour())
- removed.insert(EQ_BODY_ARMOUR);
+ remove_one_equip(EQ_BODY_ARMOUR, false);
- remove_equipment(removed);
you.redraw_evasion = true;
}