|
|
@@ -0,0 +1,60 @@
|
|
|
+"""T5 — 任务指引→蜈蚣洞穴杀怪 40; 若等级<35 继续杀到 35(用户决策)。"""
|
|
|
+from __future__ import annotations
|
|
|
+
|
|
|
+import sys
|
|
|
+import time
|
|
|
+from pathlib import Path
|
|
|
+
|
|
|
+from pipeline.ctx import PipelineContext, TaskResult
|
|
|
+
|
|
|
+TASK_TITLE = "T5 蜈蚣洞穴杀怪40+至35级"
|
|
|
+
|
|
|
+KILL_TARGET = 40
|
|
|
+LEVEL_GOAL = 35
|
|
|
+WUGONG_MAP = "地牢一层东"
|
|
|
+_MAX_ROUNDS = 8
|
|
|
+_SCRIPTS = str(Path(__file__).resolve().parents[2] / "scripts")
|
|
|
+
|
|
|
+
|
|
|
+def run_task(ctx: PipelineContext) -> TaskResult:
|
|
|
+ """进蜈蚣洞穴轮次自动战斗至击杀40且等级≥35, 双条件才算成功。"""
|
|
|
+ if _SCRIPTS not in sys.path:
|
|
|
+ sys.path.insert(0, _SCRIPTS)
|
|
|
+ from run_juece13_wugong_autofight import AutoFightBehavior
|
|
|
+ from run_juece13_wugong_farthest import (
|
|
|
+ CaveEnterBehavior,
|
|
|
+ _cave_walls,
|
|
|
+ find_farthest,
|
|
|
+ )
|
|
|
+
|
|
|
+ from pbot.bot.runner import pump, run
|
|
|
+
|
|
|
+ walls = _cave_walls()
|
|
|
+ total = 0
|
|
|
+ for rnd in range(1, _MAX_ROUNDS + 1):
|
|
|
+ if ctx.world.me.map_name != WUGONG_MAP:
|
|
|
+ ctx.log.info("[T5] 第%d轮 进图(当前 %s)", rnd, ctx.world.me.map_name)
|
|
|
+ bh = CaveEnterBehavior(sid=ctx.sid, kill_target=0)
|
|
|
+ r = run(ctx.conn, ctx.world, ctx.updater, bh, duration_s=300.0)
|
|
|
+ if ctx.world.me.map_name != WUGONG_MAP:
|
|
|
+ ctx.log.warning("[T5] 传送失败 result=%s", r.value)
|
|
|
+ time.sleep(3.0)
|
|
|
+ continue
|
|
|
+ time.sleep(3.0)
|
|
|
+ _ = pump(ctx.conn, ctx.world, ctx.updater, 2.0)
|
|
|
+ need = KILL_TARGET - total
|
|
|
+ # need==0 但等级不足 → kill_goal=0 = 无上限杀满一轮冲级
|
|
|
+ af = AutoFightBehavior(sid=ctx.sid, map_name=WUGONG_MAP, walls=walls,
|
|
|
+ farthest_fn=find_farthest, kill_goal=need)
|
|
|
+ r = run(ctx.conn, ctx.world, ctx.updater, af,
|
|
|
+ duration_s=max(600.0, need * 60.0))
|
|
|
+ total += af.kills
|
|
|
+ lv = ctx.world.me.level
|
|
|
+ ctx.log.info("[T5] 第%d轮 result=%s 轮杀=%d 累计=%d/%d lv=%d",
|
|
|
+ rnd, r.value, af.kills, total, KILL_TARGET, lv)
|
|
|
+ if total >= KILL_TARGET and lv >= LEVEL_GOAL:
|
|
|
+ return TaskResult.done(f"击杀 {total}/{KILL_TARGET} 等级 {lv}")
|
|
|
+ lv = ctx.world.me.level
|
|
|
+ if total >= KILL_TARGET:
|
|
|
+ return TaskResult.fail(f"杀满 {total} 但等级 {lv}<{LEVEL_GOAL} — 轮次耗尽")
|
|
|
+ return TaskResult.fail(f"{total}/{KILL_TARGET} 轮次耗尽 lv={lv}")
|