Skip to content

Commit 95c0257

Browse files
committed
fix: don't allow treeform over deep water
80ed8d6 added a check to allow transformations over dangerous terrain when the player has tempflight, but this missed an interaction with treeform. Treeform disables all sources of flight immediately, so if the player had tempflight (e.g. via !flight), this would lead to sequences like the following: You turn into a tree. Your roots penetrate the ground. You fall into the water! You can't survive in this terrain! You fly above the water, but the process is draining. Splash! You fall into the deep water. You sink to the bottom. For the duration the player is in deep water, they get emergency flight draining. (Permaflight had a correct version of this check.) To fix, move the tempflight check into `_flying_in_new_form` so the interaction with forms forbidding flight is handled correctly. Also, remove an obsolete Xom death check that looked at deep water/lava.
1 parent d37427b commit 95c0257

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

crawl-ref/source/ability.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,8 +1478,7 @@ static bool _check_ability_possible(const ability_def& abil, bool quiet = false)
14781478
// dangerous.)
14791479
if (abil.ability == ABIL_END_TRANSFORMATION)
14801480
{
1481-
if (feat_dangerous_for_form(transformation::none, env.grid(you.pos()))
1482-
&& !you.duration[DUR_FLIGHT])
1481+
if (feat_dangerous_for_form(transformation::none, env.grid(you.pos())))
14831482
{
14841483
if (!quiet)
14851484
{

crawl-ref/source/transform.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,10 @@ static bool _flying_in_new_form(transformation which_trans)
14631463
if (!you.duration[DUR_FLIGHT] && !you.attribute[ATTR_PERM_FLIGHT])
14641464
return false;
14651465

1466+
// tempflight (e.g. from potion) enabled, no need for equip check
1467+
if (you.duration[DUR_FLIGHT])
1468+
return true;
1469+
14661470
// Finally, do the calculation about what would be melded: are there equip
14671471
// sources left?
14681472
int sources = you.equip_flight();
@@ -1535,7 +1539,7 @@ static bool _transformation_is_safe(transformation which_trans,
15351539
dungeon_feature_type feat,
15361540
string *fail_reason)
15371541
{
1538-
if (!feat_dangerous_for_form(which_trans, feat) || you.duration[DUR_FLIGHT])
1542+
if (!feat_dangerous_for_form(which_trans, feat))
15391543
return true;
15401544

15411545
if (fail_reason)

crawl-ref/source/xom.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,6 @@ static monster_type _xom_random_demon(int sever)
920920
static bool _player_is_dead()
921921
{
922922
return you.hp <= 0
923-
|| is_feat_dangerous(env.grid(you.pos()))
924923
|| you.did_escape_death();
925924
}
926925

0 commit comments

Comments
 (0)