]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Objects/Person.cpp
Moved knife catching test to a method and removed hardcoded rabbittype test
[lugaru.git] / Source / Objects / Person.cpp
index 0ca911a0114ae16dc010426f0ca72150036966bd..8898cac60bba81fce30ded86d76c38b5dc9c3ea4 100644 (file)
@@ -8417,3 +8417,10 @@ void Person::doAI()
         }
     }
 }
+
+bool Person::catchKnife()
+{
+    return
+        ((PersonType::types[creature].knifeCatchingType == 0) && (Random() % 2 != 0) && (weaponactive == -1) && (aitype == attacktypecutoff)) ||
+        ((PersonType::types[creature].knifeCatchingType == 1) && (Random() % 3 != 0) && (weaponactive == -1) && (isIdle() || isRun() || animTarget == walkanim));
+}