fix: check is_stationary in _can_movement_ability (alex1729)
authoradvil <rawlins@gmail.com>
Mon, 19 Apr 2021 14:21:51 +0000 (10:21 -0400)
committeradvil <rawlins@gmail.com>
Mon, 19 Apr 2021 14:28:14 +0000 (10:28 -0400)
The practical effect is that this commit applies DUR_LOCKED_DOWN to
rolling charge and hop, where before they were exempt despite being
movement-like. I think this was just an oversight, rather than
intentional? Before this duration existed, is_stationary just checked
treeform, which would have disabled these abilities anyways.

crawl-ref/source/ability.cc

index 060e221..1ab3b8c 100644 (file)
@@ -1332,11 +1332,19 @@ bool activate_ability()
 
 static bool _can_movement_ability(bool quiet)
 {
-    if (!you.attribute[ATTR_HELD])
-        return true;
-    if (!quiet)
-        mprf("You cannot do that while %s.", held_status());
-    return false;
+    if (you.attribute[ATTR_HELD])
+    {
+        if (!quiet)
+            mprf("You cannot do that while %s.", held_status());
+        return false;
+    }
+    else if (you.is_stationary())
+    {
+        if (!quiet)
+            canned_msg(MSG_CANNOT_MOVE);
+        return false;
+    }
+    return true;
 }
 
 static bool _can_hop(bool quiet)