支持自定义战斗策略文件 (#3078)

* Add files via upload

* 自动修复 JSON 格式和版本号 [ci skip]

* AutoDomainCustomizable

* Delete repo/js/AutoDomainCustomizable

* Add files via upload

支持自定义战斗策略文件

* 支持自定义战斗策略文件

支持自定义战斗策略文件

---------

Co-authored-by: 影の荧 <32783366+dyxa@users.noreply.github.com>
Co-authored-by: GitHub Actions Bot <actions@github.com>
This commit is contained in:
风铃
2026-04-07 19:51:02 +08:00
committed by GitHub
parent b61a432767
commit 7088d7414d
4 changed files with 45 additions and 4 deletions

View File

@@ -23,6 +23,7 @@
* **智能队伍切换**:进本前自动切换至指定队伍。
* **全自动托管**:自动传送、进门、战斗及领奖。
* **自动处理**:支持结束后自动分解圣遗物。
* **战斗策略选择**:支持自定义战斗策略文件,可针对不同秘境/队伍配置不同的战斗逻辑。
---
@@ -87,6 +88,13 @@
* 开启后会输出更多详细日志信息,用于脚本出错时排查问题。
* **战斗策略文件名**
* **功能**:指定使用的战斗策略文件。
* **位置**:文件需放置在 `BetterGI/User/AutoFight/` 目录下。
* **用法**:填写文件名即可,无需写 `.txt` 后缀(如填写 `胡桃`,实际查找 `User/AutoFight/胡桃.txt`)。
* **留空**:使用 BetterGI 默认战斗策略。
---
## ⏰ 时区设置
@@ -114,8 +122,15 @@
---
## 👨‍💻 关于作者
## 📜 更新日志
### v0.8 - [风铃](https://github.com/zephyr-bell)
* 支持自定义战斗策略文件
---
## 💻 关于作者
* **原作者**: [huiyadanli](https://github.com/huiyadanli), iris, 霁
* **修改者**: [RJFAC](https://github.com/RJFAC)
* **辅助生成**: AI
* **修改者**: [RJFAC](https://github.com/RJFAC), [风铃](https://github.com/zephyr-bell)
* **辅助生成**: AI

View File

@@ -89,6 +89,7 @@
let pDomainName = "";
let pSundaySelectedValue = "";
let pCombatStrategyFile = userConfig.CombatStrategyFile || "";
// --- 数值读取与防呆验证 ---
let pOriginalAmount = parseInt(userConfig.OriginalResinAmount) || 0;
@@ -193,6 +194,20 @@
// =========================================================================
// 3. 执行主流程
// =========================================================================
// 处理战斗策略路径
let pCombatStrategyPath = "";
if (pCombatStrategyFile) {
// 自动补充 .txt 后缀
if (!pCombatStrategyFile.toLowerCase().endsWith(".txt")) {
pCombatStrategyFile += ".txt";
}
pCombatStrategyPath = `User/AutoFight/${pCombatStrategyFile}`;
log.info(`【战斗策略】使用战斗策略:${pCombatStrategyFile}`);
} else {
log.info(`【战斗策略】使用默认策略`);
}
while (true) {
try {
let taskParam = new AutoDomainParam(pDomainRoundNum);
@@ -201,6 +216,7 @@
taskParam.AutoArtifactSalvage = pAutoArtifactSalvage;
taskParam.MaxArtifactStar = pMaxArtifactStar;
taskParam.SundaySelectedValue = pSundaySelectedValue;
taskParam.CombatStrategyPath = pCombatStrategyPath;
taskParam.SpecifyResinUse = !pRunUntilDepleted;

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "传送并自动秘境(增强版)",
"version": "0.7",
"version": "0.8",
"bgi_version": "0.57.0",
"description": "BetterGI自带脚本的增强版用于传送后并执行自动秘境。秘境中角色死亡复活后继续回去战斗。支持自定义各项参数如树脂设置、自动废弃圣遗物、轮数设置等与周期性素材刷取。(本脚本由AI辅助生成)",
"authors": [
@@ -18,6 +18,10 @@
{
"name": "RJFAC",
"links": "https://github.com/RJFAC"
},
{
"name": "风铃",
"links": "https://github.com/zephyr-bell"
}
],
"settings_ui": "settings.json",

View File

@@ -92,6 +92,12 @@
"label": "自动切换到指定队伍 (支持正则)",
"default": ""
},
{
"name": "CombatStrategyFile",
"type": "input-text",
"label": "战斗策略",
"default": ""
},
{
"name": "RunUntilResinDepleted",
"type": "checkbox",