{"record":{"id":"c6aeb7c0043607cf","repo":"babalae/better-genshin-impact","slug":"error-c6aeb7","errorCode":null,"errorMessage":"等待对方行动超时,停止自动打牌！","messagePattern":"等待对方行动超时,停止自动打牌！","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoGeniusInvokation/GeniusInvokationControl.cs","lineNumber":1031,"sourceCode":"                else\n                {\n                    // 多延迟2s // 保证被击败提示已经完成显示\n                    inMyActionCount++;\n                    if (inMyActionCount == 3)\n                    {\n                        break;\n                    }\n                }\n            }\n            else if (IsDuelEnd())\n            {\n                throw new NormalEndException(\"对战已结束,停止自动打牌！\");\n            }\n\n            retryCount++;\n            if (retryCount >= 60)\n            {\n                throw new System.Exception(\"等待对方行动超时,停止自动打牌！\");\n            }\n\n            _logger.LogInformation(\"对方仍在行动中,继续等待(次数{Count})...\", retryCount);\n            Sleep(1000);\n        }\n    }\n\n    /// <summary>\n    /// 等待对方回合 和 回合结束阶段\n    /// 我方角色可能在此期间阵亡\n    /// </summary>\n    public void WaitOpponentAction(Duel duel)\n    {\n        var rd = new Random();\n        Sleep(3000 + rd.Next(1, 1000));\n        // 判断对方行动是否已经结束\n        var retryCount = 0;\n        while (true)","sourceCodeStart":1013,"sourceCodeEnd":1049,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoGeniusInvokation/GeniusInvokationControl.cs#L1013-L1049","documentation":"Thrown by the first WaitOpponentAction loop (around line 1000) when the opponent's action has not ended after 60 retries (each with 1s sleep, ~60s total). The loop waits for IsInMyAction() to become true (with a 3-confirmation count) or IsDuelEnd(). If neither occurs within ~60s, the duel is considered stuck and aborted.","triggerScenarios":"During the opponent's action phase, the game does not transition back to the player's action phase within ~60 seconds. The loop checks IsInMyAction() and IsDuelEnd() each iteration; if neither fires, retryCount increments until 60. Causes: game frozen/crashed, extremely long opponent animation chain, network desync, or UI recognition failure where neither state is detected.","commonSituations":"Opponent has a very long action sequence (many cards/skills), game lag or hang, UI changed so IsInMyAction/IsDuelEnd recognition fails, or the game window lost focus. Also occurs if the opponent is performing actions that the recognition templates don't cover (new game content).","solutions":["Ensure the game is running smoothly without lag (close background apps, check GPU/CPU load).","Verify the game window is in focus and the capture region is correct.","If the opponent genuinely has long turns, the 60s timeout may need adjustment in source.","Check for game UI updates that may have changed the state-recognition templates (IsInMyAction, IsDuelEnd)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// The TCG automation runner should catch this at the task level\ntry\n{\n    control.WaitOpponentAction(duel);\n}\ncatch (Exception e) when (e.Message.Contains(\"等待对方行动超时\"))\n{\n    _logger.LogError(\"等待对方行动超时，停止自动打牌: {Msg}\", e.Message);\n    // Notify user — likely game lag, focus loss, or UI recognition failure\n}\ncatch (NormalEndException)\n{\n    // Expected — duel ended normally\n}","preventionTips":["Ensure the game runs without lag (monitor CPU/GPU usage).","Keep the game window in focus during TCG automation.","Verify the capture region matches the game window.","If the opponent has legitimately long turns, the 60s hardcoded timeout may need source adjustment.","Watch for game UI updates that break phase-recognition templates."],"tags":["tcg","auto-genius-invokation","timeout","opponent-wait","ocr","retry-exhausted"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}