summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/transform.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-04-17 20:33:41 -0700
committerShmuale Mark <shm.mark@gmail.com>2014-04-18 10:27:59 -0400
commit23e63a04bbacb042030f10488e806adb9d1b584e (patch)
treea564b28815e0aa46d4757f9b7f0b6bccea879737 /crawl-ref/source/transform.cc
parentb130e1375b16255fedb3b465bbcae9c9fe164987 (diff)
downloadcrawl-ref-23e63a04bbacb042030f10488e806adb9d1b584e.tar.gz
crawl-ref-23e63a04bbacb042030f10488e806adb9d1b584e.zip
Put an end to magically floating arachno-merplayers
feat_dangerous_for_form() let players transform into any form while over water, if it was safe for their race (e.g. merfolk, octopodes, grey draconians). Fixed that & added a doxygen comment. [Simplified a check further. --wheals]
Diffstat (limited to 'crawl-ref/source/transform.cc')
-rw-r--r--crawl-ref/source/transform.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/crawl-ref/source/transform.cc b/crawl-ref/source/transform.cc
index 71110dc2b0..59ea5bda39 100644
--- a/crawl-ref/source/transform.cc
+++ b/crawl-ref/source/transform.cc
@@ -592,6 +592,18 @@ static bool _flying_in_new_form(transformation_type which_trans)
return sources > sources_removed;
}
+/**
+ * Check if it'd be lethal for the player to enter a form in a given terrain.
+ *
+ * In addition to checking whether the feature is dangerous for the form
+ * itself (form_likes_*), the function checks to see if the player is safe
+ * due to flying or similar effects, and checks to see if they'll be killed
+ * when transforming back (treeform in deep water).
+ *
+ * @param which_trans The form being checked.
+ * @param feat The dungeon feature to be checked for danger.
+ * @return If the feat is lethal for the player in the form.
+ **/
bool feat_dangerous_for_form(transformation_type which_trans,
dungeon_feature_type feat)
{
@@ -608,12 +620,9 @@ bool feat_dangerous_for_form(transformation_type which_trans,
if (feat == DNGN_DEEP_WATER)
{
- if (beogh_water_walk()
- || species_likes_water(you.species)
- || you.racial_permanent_flight())
- {
+ if (beogh_water_walk())
return false;
- }
+
// Trees are ok with deep water, but you need means of escaping
// once the transformation expires.
if (which_trans == TRAN_TREE)