Prevent trampling a constricted actor (12432)
authorEdgar A. Bering IV <trizor@gmail.com>
Thu, 14 Jan 2021 18:07:06 +0000 (20:07 +0200)
committerEdgar A. Bering IV <trizor@gmail.com>
Thu, 14 Jan 2021 18:07:06 +0000 (20:07 +0200)
The other option would be to have constriction broken on trampling.
However, I went with this resolution because either:
 - the player is being trampled and constricted, don't make their life
   easier
 - or the player has allies and is trying to do both things to a target,
   creating an ally-micromanagement encouraging edge case

crawl-ref/source/melee-attack.cc

index 94f7aea..9200e99 100644 (file)
@@ -3251,14 +3251,24 @@ bool melee_attack::do_knockback(bool trample)
         // reaction here?
         || actor_at(new_pos)
         // Prevent trample/drown combo when flight is expiring
-        || defender->is_player() && need_expiration_warning(new_pos))
+        || defender->is_player() && need_expiration_warning(new_pos)
+        || defender->is_constricted())
     {
         if (needs_message)
         {
-            mprf("%s %s %s ground!",
-                 defender_name(false).c_str(),
-                 defender->conj_verb("hold").c_str(),
-                 defender->pronoun(PRONOUN_POSSESSIVE).c_str());
+            if (defender->is_constricted())
+            {
+                mprf("%s %s held in place!",
+                     defender_name(false).c_str(),
+                     defender->conj_verb("are").c_str());
+            }
+            else
+            {
+                mprf("%s %s %s ground!",
+                     defender_name(false).c_str(),
+                     defender->conj_verb("hold").c_str(),
+                     defender->pronoun(PRONOUN_POSSESSIVE).c_str());
+            }
         }
 
         return false;