Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add action_params(StopFlyingWaitTime) to stop_flying #1277

Merged
merged 3 commits into from
Mar 13, 2025

Conversation

physligl
Copy link
Member

@physligl physligl commented Mar 12, 2025

  1. feat: add action_params(StopFlyingWaitTime) to stop_flying;
  2. fix: ensure next step only proceeds after stop_flying.

测试用例:

{
  "info": {
    "name": "下落攻击等待时间测试",
    "type": "collect",
    "author": "秋云",
    "version": "1.0",
    "description": "下落攻击等待时间测试,附赠火史莱姆。",
    "bgiVersion": "0.43.1"
  },
  "positions": [
    {
      "id": 1,
      "x": 1391.01,
      "y": 515.44,
      "action": "",
      "move_mode": "walk",
      "type": "teleport"
    },
    {
      "id": 2,
      "x": 1371.81,
      "y": 530.83,
      "action": "",
      "move_mode": "walk",
      "type": "path"
    },
    {
      "id": 3,
      "x": 1394.83,
      "y": 546.72,
      "action": "",
      "move_mode": "walk",
      "type": "path"
    },
    {
      "id": 4,
      "x": 1379.88,
      "y": 593.19,
      "action": "stop_flying",
      "move_mode": "fly",
      "type": "path",
      "action_params": "1000"
    },
    {
      "id": 5,
      "x": 1379.88,
      "y": 593.19,
      "action": "fight",
      "move_mode": "walk",
      "type": "path"
    }
  ]
}

fix: ensure next step only proceeds after stop_flying.
@physligl
Copy link
Member Author

似乎由于 WaypointForTrack 强制要求 action_param 是字符串类型,所以 json 文件中要写成字符串。

@huiyadanli huiyadanli requested a review from Copilot March 12, 2025 16:32
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new action parameter "StopFlyingWaitTime" for the stop_flying action by adding a dedicated StopFlyingHandler and updating the corresponding call in PathExecutor to ensure that the next step only proceeds after stopping flying. Key changes include:

  • Adding a new StopFlyingHandler to process the stop_flying action using the provided wait time.
  • Updating PathExecutor to delegate the stop_flying action to the new handler.
  • Minor cleanup by removing an unused import in WaypointForTrack and updating the ActionFactory mapping.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
BetterGenshinImpact/GameTask/AutoPathing/Handler/StopFlyingHandler.cs New handler implementation that uses the ActionParams for stop_flying wait time.
BetterGenshinImpact/GameTask/AutoPathing/PathExecutor.cs Refactored inline stop_flying behavior to delegate to StopFlyingHandler.
BetterGenshinImpact/GameTask/AutoPathing/Model/WaypointForTrack.cs Removed unused import to clean up the file.
BetterGenshinImpact/GameTask/AutoPathing/Handler/ActionFactory.cs Updated mapping to include the new stop_flying handler.
Comments suppressed due to low confidence (1)

BetterGenshinImpact/GameTask/AutoPathing/Handler/StopFlyingHandler.cs:26

  • [nitpick] Consider renaming variable 'i' to a more descriptive name like 'attemptCount' to improve readability.
int i;

@physligl
Copy link
Member Author

测试之后没什么问题,等待时间的单位变成了毫秒,我修改一下测试用例。

@huiyadanli
Copy link
Member

顺便一提,AI提供的建议是正确的,建议使用 int.TryParse。

非UI界面的,大部分应该用毫秒,尤其是这种飞行时间基本都需要到毫秒级。浮点数有坑

@huiyadanli huiyadanli merged commit 22fe431 into babalae:main Mar 13, 2025
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants