Переглянути джерело

feat(move): 盟重走向传送员提速 — >4格用3013跑(2格/0.7s), 近距降回3011走防冲过

wuzilong 1 місяць тому
батько
коміт
a9951c2e5a

+ 14 - 5
pipeline_bot/scripts/run_juece13_mine_farthest.py

@@ -125,7 +125,10 @@ class MineEnterBehavior(KillBehavior):
 
 
     def _tick_tp_goto_slip(self, conn: GatewayConnection,
     def _tick_tp_goto_slip(self, conn: GatewayConnection,
                            world: WorldMirror) -> TickResult:
                            world: WorldMirror) -> TickResult:
-        """1 格步进走向传送员(342,338); 撞墙顺/逆 45° 滑行; 到达转 tp_dialog。"""
+        """跑步(2格/0.7s)走向传送员(342,338); 撞墙滑行; 到达转 tp_dialog.
+
+        距目标 >4 格用 3013 跑; ≤4 格降回 3011 走(防冲过判定圈)。
+        """
         from pbot.bot.wander import DIRS as WDIRS
         from pbot.bot.wander import DIRS as WDIRS
         from pbot.bot.kill import TELEPORTER_POS, TELEPORTER_AID
         from pbot.bot.kill import TELEPORTER_POS, TELEPORTER_AID
         me = world.me
         me = world.me
@@ -141,7 +144,10 @@ class MineEnterBehavior(KillBehavior):
             if now - self._pending_rej_t < 0.9:
             if now - self._pending_rej_t < 0.9:
                 return TickResult.RUNNING
                 return TickResult.RUNNING
             self._pending_rej = False
             self._pending_rej = False
-        if now - self._last_step_t < 0.9:
+        dist = max(abs(tx - me.x), abs(ty - me.y))
+        use_run = dist > 4
+        step_t = 0.7 if use_run else 0.9
+        if now - self._last_step_t < step_t:
             return TickResult.RUNNING
             return TickResult.RUNNING
         # 事件消费: SC1 确认清滑行锁; 仅 pull_back=真弹回才触发滑行
         # 事件消费: SC1 确认清滑行锁; 仅 pull_back=真弹回才触发滑行
         # (anchor_echo 是锚点申报回显=位置确认, 非拒绝)
         # (anchor_echo 是锚点申报回显=位置确认, 非拒绝)
@@ -164,15 +170,18 @@ class MineEnterBehavior(KillBehavior):
             _LOG.info("[盟重·滑行] want=%d blocked → dir=%d", want, d)
             _LOG.info("[盟重·滑行] want=%d blocked → dir=%d", want, d)
         self._slip_blocked = False
         self._slip_blocked = False
         dx, dy = WDIRS[d]
         dx, dy = WDIRS[d]
-        fx, fy = me.x + dx, me.y + dy
+        stride = 2 if use_run else 1
+        fx, fy = me.x + dx * stride, me.y + dy * stride
         from pbot.game.messages import protocol_map_name
         from pbot.game.messages import protocol_map_name
         mn = protocol_map_name(me.map_id, me.map_name)
         mn = protocol_map_name(me.map_id, me.map_name)
-        _ = conn.send_frame(3011, 0, d, (me.y << 16) | me.x, self._sid,
+        _ = conn.send_frame(3013 if use_run else 3011, 0, d,
+                            (me.y << 16) | me.x, self._sid,
                             mn.encode(), pre=(fy << 16) | fx)
                             mn.encode(), pre=(fy << 16) | fx)
         self._last_step_t = time.time()
         self._last_step_t = time.time()
         self._pending_rej = True
         self._pending_rej = True
         self._pending_rej_t = self._last_step_t
         self._pending_rej_t = self._last_step_t
-        _LOG.info("[盟重·走] (%d,%d) dir=%d → (%d,%d)", me.x, me.y, d, fx, fy)
+        _LOG.info("[盟重·%s] (%d,%d) dir=%d → (%d,%d)",
+                  "跑" if use_run else "走", me.x, me.y, d, fx, fy)
         return TickResult.RUNNING
         return TickResult.RUNNING
 
 
     def _dir8(self, x: int, y: int, tx: int, ty: int) -> int:
     def _dir8(self, x: int, y: int, tx: int, ty: int) -> int:

+ 15 - 4
pipeline_bot/scripts/run_juece13_wugong_farthest.py

@@ -148,7 +148,11 @@ class CaveEnterBehavior(KillBehavior):
 
 
     def _tick_tp_goto_cave(self, conn: GatewayConnection,
     def _tick_tp_goto_cave(self, conn: GatewayConnection,
                            world: WorldMirror) -> TickResult:
                            world: WorldMirror) -> TickResult:
-        """盟重 1 格步进+滑行到传送员 → 到达转自点洞穴菜单."""
+        """盟重跑步(2格/0.7s)+滑行到传送员 → 到达转自点洞穴菜单.
+
+        距目标 >4 格用 3013 跑(速度翻倍); ≤4 格降回 3011 走
+        (防冲过传送员判定圈), 弹回滑行逻辑不变。
+        """
         from pbot.bot.wander import DIRS as WDIRS
         from pbot.bot.wander import DIRS as WDIRS
         from pbot.bot.kill import TELEPORTER_POS
         from pbot.bot.kill import TELEPORTER_POS
         me = world.me
         me = world.me
@@ -165,7 +169,10 @@ class CaveEnterBehavior(KillBehavior):
             if now - self._pending_rej_t < 0.9:
             if now - self._pending_rej_t < 0.9:
                 return TickResult.RUNNING
                 return TickResult.RUNNING
             self._pending_rej = False
             self._pending_rej = False
-        if now - self._last_step_t < 0.9:
+        dist = max(abs(tx - me.x), abs(ty - me.y))
+        use_run = dist > 4
+        step_t = 0.7 if use_run else 0.9
+        if now - self._last_step_t < step_t:
             return TickResult.RUNNING
             return TickResult.RUNNING
         for e in world.events:
         for e in world.events:
             if e.kind == "self_move_confirmed":
             if e.kind == "self_move_confirmed":
@@ -185,10 +192,14 @@ class CaveEnterBehavior(KillBehavior):
             _LOG.info("[盟重·滑行] want=%d → dir=%d", want, d)
             _LOG.info("[盟重·滑行] want=%d → dir=%d", want, d)
         self._pending_rej = False
         self._pending_rej = False
         dx, dy = WDIRS[d]
         dx, dy = WDIRS[d]
+        stride = 2 if use_run else 1
         from pbot.game.messages import protocol_map_name
         from pbot.game.messages import protocol_map_name
         mn = protocol_map_name(me.map_id, me.map_name)
         mn = protocol_map_name(me.map_id, me.map_name)
-        _ = conn.send_frame(3011, 0, d, (me.y << 16) | me.x, self._sid,
-                            mn.encode(), pre=((me.y + dy) << 16) | (me.x + dx))
+        msg_id = 3013 if use_run else 3011
+        _ = conn.send_frame(msg_id, 0, d, (me.y << 16) | me.x, self._sid,
+                            mn.encode(),
+                            pre=((me.y + dy * stride) << 16)
+                            | (me.x + dx * stride))
         self._pending_rej = True
         self._pending_rej = True
         self._pending_rej_t = time.time()
         self._pending_rej_t = time.time()
         self._last_step_t = self._pending_rej_t
         self._last_step_t = self._pending_rej_t