home · contact · privacy
TCE: Refactor calc_effort.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 11 Mar 2016 21:08:23 +0000 (22:08 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 11 Mar 2016 21:08:23 +0000 (22:08 +0100)
plugins/server/TheCrawlingEater.py

index 1c7a76dace33613d51a2e1c3349de1e9ae508c14..d9b827bc3b28965879878b89300e6e397fef94d5 100644 (file)
@@ -197,11 +197,8 @@ def calc_effort(ta, t):
                                          t["T_POSY"], t["T_POSX"])
         if 1 == move_result[0]:
             pos = (move_result[1] * world_db["MAP_LENGTH"]) + move_result[2]
-            terrain = chr(world_db["MAP"][pos])
-            if terrain == "1":
-                return 2
-            elif terrain == "2":
-                return 4
+            narrowness = world_db["MAP"][pos] - ord("0")
+            return 2 ** narrowness
     return 1
 world_db["calc_effort"] = calc_effort