Quellcode durchsuchen

feat(pipeline): T1喝药/T2比奇杀20/T3洞穴杀20 任务文件

wuzilong vor 1 Monat
Ursprung
Commit
299dcafc30

+ 1 - 0
pipeline_bot/pipeline/tasks/__init__.py

@@ -0,0 +1 @@
+"""pipeline.tasks — 流水线任务模块包(每模块 TASK_TITLE + run_task)。"""

+ 24 - 0
pipeline_bot/pipeline/tasks/t01_heal.py

@@ -0,0 +1,24 @@
+"""T1 — 开启喝药保护(后续所有战斗任务的前置)。"""
+from __future__ import annotations
+
+import time
+
+from pipeline.ctx import PipelineContext, TaskResult
+
+TASK_TITLE = "T1 开启喝药保护"
+
+
+def run_task(ctx: PipelineContext) -> TaskResult:
+    """三轮重试开启喝药; 终态非 on 即高危失败。"""
+    from pbot.game.heal import enable_auto_heal
+    state = None
+    for i in range(3):
+        state = enable_auto_heal(ctx.conn, ctx.sid, want_on=True,
+                                 world=ctx.world)
+        if state == "on":
+            break
+        ctx.log.warning("[T1] 第%d轮 state=%s — 重试", i + 1, state)
+        time.sleep(1.0)
+    if state == "on":
+        return TaskResult.done("state=on")
+    return TaskResult.fail(f"喝药终态={state}(高危, 拒绝继续)")

+ 29 - 0
pipeline_bot/pipeline/tasks/t02_biqi_kill20.py

@@ -0,0 +1,29 @@
+"""T2 — 新手接待→比奇大城寻图杀怪 20(怪不够点【点我刷怪】NPC)。"""
+from __future__ import annotations
+
+from pipeline.ctx import PipelineContext, TaskResult
+
+TASK_TITLE = "T2 比奇大城杀怪20"
+
+BIQI_MAP = "比奇大城"
+KILL_TARGET = 20
+
+
+def run_task(ctx: PipelineContext) -> TaskResult:
+    """任务链传送比奇 → 杀满增量 20 只(全局计数取增量)。"""
+    from pbot.bot.kill import KillBehavior
+    from pbot.bot.runner import run
+
+    baseline = ctx.world.kills
+    goal = baseline + KILL_TARGET
+    bh = KillBehavior(sid=ctx.sid, kill_target=goal, renwu_act="renwu_mov,1",
+                      allow_reroll=True)
+    result = run(ctx.conn, ctx.world, ctx.updater, bh,
+                 duration_s=max(900.0, KILL_TARGET * 60.0))
+    killed = ctx.world.kills - baseline
+    ok = killed >= KILL_TARGET
+    ctx.log.info("[T2] result=%s 本段击杀=%d/%d map=%s",
+                 result.value, killed, KILL_TARGET, ctx.world.me.map_name)
+    if ok:
+        return TaskResult.done(f"击杀 {killed}/{KILL_TARGET} @比奇大城")
+    return TaskResult.fail(f"仅 {killed}/{KILL_TARGET}(result={result.value})")

+ 36 - 0
pipeline_bot/pipeline/tasks/t03_cave_kill20.py

@@ -0,0 +1,36 @@
+"""T3 — 任务指引→天然洞穴寻图杀怪 20(驻留洞穴, 不点任务跳转)。"""
+from __future__ import annotations
+
+import sys
+from pathlib import Path
+
+from pipeline.ctx import PipelineContext, TaskResult
+
+TASK_TITLE = "T3 天然洞穴杀怪20"
+
+KILL_TARGET = 20
+CAVE_MAP = "天然洞穴一层"
+_SCRIPTS = str(Path(__file__).resolve().parents[2] / "scripts")
+
+
+def run_task(ctx: PipelineContext) -> TaskResult:
+    """进洞驻留杀怪; 达标且终图在洞穴才算成功。"""
+    if _SCRIPTS not in sys.path:
+        sys.path.insert(0, _SCRIPTS)
+    from run_juece13_cave30_v2 import CaveStayKillBehavior
+
+    from pbot.bot.runner import run
+
+    baseline = ctx.world.kills
+    goal = baseline + KILL_TARGET
+    bh = CaveStayKillBehavior(sid=ctx.sid, kill_target=goal,
+                              renwu_act="renwu_mov,2", allow_reroll=True)
+    result = run(ctx.conn, ctx.world, ctx.updater, bh,
+                 duration_s=max(1500.0, KILL_TARGET * 75.0))
+    killed = ctx.world.kills - baseline
+    ok = killed >= KILL_TARGET and ctx.world.me.map_name == CAVE_MAP
+    ctx.log.info("[T3] result=%s 击杀=%d/%d map=%s", result.value, killed,
+                 KILL_TARGET, ctx.world.me.map_name)
+    if ok:
+        return TaskResult.done(f"洞穴击杀 {killed}/{KILL_TARGET}")
+    return TaskResult.fail(f"{killed}/{KILL_TARGET} map={ctx.world.me.map_name}")