From 86cec12e921b5131ead5ed6b94fd37848f59a94b Mon Sep 17 00:00:00 2001 From: yueshen <106477016+HMZyueshen@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:15:21 +0800 Subject: [PATCH 1/8] =?UTF-8?q?Create=20SSS=5F=E7=BA=A6=E7=BF=B0=E8=80=81?= =?UTF-8?q?=E5=A6=88=E6=96=B0=E5=BB=BA=E5=9C=B0=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/copilot/SSS_约翰老妈新建地块 | 470 ++++++++++++++++++++++++++ 1 file changed, 470 insertions(+) create mode 100644 resource/copilot/SSS_约翰老妈新建地块 diff --git a/resource/copilot/SSS_约翰老妈新建地块 b/resource/copilot/SSS_约翰老妈新建地块 new file mode 100644 index 0000000000..401402033a --- /dev/null +++ b/resource/copilot/SSS_约翰老妈新建地块 @@ -0,0 +1,470 @@ +{ + "type": "SSS", + "stage_name": "约翰老妈新建地块", + "minimum_required": "v4.9.0", + "doc": { + "title": "约翰老妈保全(应急未测试)", + "title_color": "dark", + "details": "作者:YueShen\n约翰老妈(应急未测试)只能打到第5关,第5关还要看运气\n选战术装备整理箱\n尽量带档二先锋1技能\n要手动编队\n有问题群里找管理咕咕咕", + "details_color": "dark" + }, + "buff": "战术装备整理箱", + "equipment": [ + "A", "A", "A", "A", + "A", "A", "A", "A" + ], + "strategy": "优选策略", + "opers": [ + { + "name": "棘刺", + "skill": 3, + "skill_usage": 1 + }, + { + "name": "泥岩", + "skill": 2, + "skill_usage": 0 + }, + { + "name": "桃金娘", + "skill": 1, + "skill_usage": 1 + }, + { + "name": "煌", + "skill": 2, + "skill_usage": 0 + }, + { + "name": "塞雷娅", + "skill": 1, + "skill_usage": 0 + }, + { + "name": "伊芙利特", + "skill": 2, + "skill_usage": 0 + }, + { + "name": "铃兰", + "skill": 2, + "skill_usage": 0 + } + ], + "tool_men": { + "先锋": 1, + "近卫": 2, + "辅助": 6, + "重装": 2, + "术士": 2 + }, + "drops": [ + "重装", + "近卫", + "无需增调干员", + "术士", + "辅助", + "医疗", + "狙击", + "战备激活阀", + "改派发讯器", + "反制导能组件", + "装备扩充箱" + ], + "blacklist": [ + "罗比菈塔", + "掠风", + "白铁", + "史尔特尔", + "玛恩纳", + "龙舌兰", + "幽灵鲨", + "陈", + "耀骑士临光", + "斯卡蒂", + "赫拉格", + "宴", + "重岳", + "莫斯提马", + "远山", + "天火", + "炎熔", + "赤冬", + "炎狱炎熔", + "莱恩哈特", + "格雷伊", + "蚀清", + "梅尔", + "罗小黑", + "U-Official", + "阿米娅", + "玫兰莎" + ], + "stages": [ + { + "stage_name": "知难而进", + "strategies": [ + { + "core": "煌", + "tool_men": { + "近卫": 1 + }, + "location": [ + 5, + 5 + ], + "direction": "Up" + }, + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 7, + 1 + ], + "direction": "Down" + }, + { + "core": "塞雷娅", + "tool_men": { + "重装": 1 + }, + "location": [ + 5, + 4 + ], + "direction": "Up" + }, + { + "tool_men": { + "辅助": 100 + }, + "location": [ + 6, + 5 + ], + "direction": "Up" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "二倍速" + } + ], + "retry_times": 5 + }, + { + "stage_name": "荒地的手段", + "strategies": [ + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 2, + 1 + ], + "direction": "Right" + }, + { + "core": "棘刺", + "tool_men": { + "近卫": 2 + }, + "location": [ + 2, + 2 + ], + "direction": "Down" + }, + { + "core": "泥岩", + "tool_men": { + "重装": 2 + }, + "location": [ + 2, + 4 + ], + "direction": "Right" + }, + { + "tool_men": { + "辅助": 100 + }, + "location": [ + 5, + 3 + ], + "direction": "Left" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "二倍速" + }, + { + "type": "部署", + "name": "塞雷娅", + "location": [ + 3, + 1 + ], + "direction": "Right" + } + ], + "retry_times": 5 + }, + { + "stage_name": "麻木前行", + "strategies": [ + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 8, + 1 + ], + "direction": "Down" + }, + { + "core": "棘刺", + "tool_men": { + "近卫": 4 + }, + "location": [ + 7, + 2 + ], + "direction": "Left" + }, + { + "core": "塞雷娅", + "tool_men": { + "重装": 3, + "近卫": 2 + }, + "location": [ + 5, + 2 + ], + "direction": "Left" + }, + { + "core": "伊芙利特", + "tool_men": { + "术士": 2 + }, + "location": [ + 8, + 2 + ], + "direction": "Left" + }, + { + "core": "泥岩", + "tool_men": { + "重装": 1 + }, + "location": [ + 6, + 2 + ], + "direction": "Left" + }, + { + "tool_men": { + "辅助": 100 + }, + "location": [ + 6, + 3 + ], + "direction": "Left" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "二倍速" + }, + { + "type": "部署", + "name": "战备激活阀", + "location": [ + 5, + 3 + ], + "direction": "Up" + } + ], + "retry_times": 5 + }, + { + "stage_name": "混乱“派对”", + "strategies": [ + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 3, + 1 + ], + "direction": "Right" + }, + { + "core": "棘刺", + "tool_men": { + "近卫": 3 + }, + "location": [ + 3, + 2 + ], + "direction": "Right" + }, + { + "core": "塞雷娅", + "tool_men": { + "重装": 3 + }, + "location": [ + 4, + 2 + ], + "direction": "Right" + }, + { + "core": "泥岩", + "tool_men": { + "重装": 3 + }, + "location": [ + 4, + 3 + ], + "direction": "Right" + }, + { + "tool_men": { + "辅助": 100, + "术士": 100 + }, + "location": [ + 2, + 2 + ], + "direction": "Right" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "二倍速" + }, + { + "type": "部署", + "name": "战备激活阀", + "location": [ + 3, + 3 + ], + "direction": "Up" + } + ], + "retry_times": 5 + }, + { + "stage_name": "消息传递", + "strategies": [ + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 8, + 2 + ], + "direction": "Down" + }, + { + "core": "煌", + "tool_men": { + "近卫": 4 + }, + "location": [ + 7, + 3 + ], + "direction": "Left" + }, + { + "core": "塞雷娅", + "tool_men": { + "重装": 3, + "近卫": 2 + }, + "location": [ + 6, + 3 + ], + "direction": "Left" + }, + { + "tool_men": { + "辅助": 100, + "术士": 100 + }, + "location": [ + 7, + 2 + ], + "direction": "Left" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "CheckIfStartOver", + "name": "铃兰" + }, + { + "type": "部署", + "name": "铃兰", + "location": [ + 3, + 4 + ], + "direction": "Right" + }, + { + "type": "二倍速" + }, + { + "type": "部署", + "name": "伊芙利特", + "location": [ + 9, + 3 + ], + "direction": "Left" + }, + { + "type": "部署", + "name": "战备激活阀", + "location": [ + 7, + 4 + ], + "direction": "Up" + } + ], + "retry_times": 5 + } + ] +} From 1e908c6937054c9700a578aa53a85e37dc035e7a Mon Sep 17 00:00:00 2001 From: yueshen <106477016+HMZyueshen@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:16:49 +0800 Subject: [PATCH 2/8] =?UTF-8?q?Delete=20SSS=5F=E7=BA=A6=E7=BF=B0=E8=80=81?= =?UTF-8?q?=E5=A6=88=E6=96=B0=E5=BB=BA=E5=9C=B0=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/copilot/SSS_约翰老妈新建地块 | 470 -------------------------- 1 file changed, 470 deletions(-) delete mode 100644 resource/copilot/SSS_约翰老妈新建地块 diff --git a/resource/copilot/SSS_约翰老妈新建地块 b/resource/copilot/SSS_约翰老妈新建地块 deleted file mode 100644 index 401402033a..0000000000 --- a/resource/copilot/SSS_约翰老妈新建地块 +++ /dev/null @@ -1,470 +0,0 @@ -{ - "type": "SSS", - "stage_name": "约翰老妈新建地块", - "minimum_required": "v4.9.0", - "doc": { - "title": "约翰老妈保全(应急未测试)", - "title_color": "dark", - "details": "作者:YueShen\n约翰老妈(应急未测试)只能打到第5关,第5关还要看运气\n选战术装备整理箱\n尽量带档二先锋1技能\n要手动编队\n有问题群里找管理咕咕咕", - "details_color": "dark" - }, - "buff": "战术装备整理箱", - "equipment": [ - "A", "A", "A", "A", - "A", "A", "A", "A" - ], - "strategy": "优选策略", - "opers": [ - { - "name": "棘刺", - "skill": 3, - "skill_usage": 1 - }, - { - "name": "泥岩", - "skill": 2, - "skill_usage": 0 - }, - { - "name": "桃金娘", - "skill": 1, - "skill_usage": 1 - }, - { - "name": "煌", - "skill": 2, - "skill_usage": 0 - }, - { - "name": "塞雷娅", - "skill": 1, - "skill_usage": 0 - }, - { - "name": "伊芙利特", - "skill": 2, - "skill_usage": 0 - }, - { - "name": "铃兰", - "skill": 2, - "skill_usage": 0 - } - ], - "tool_men": { - "先锋": 1, - "近卫": 2, - "辅助": 6, - "重装": 2, - "术士": 2 - }, - "drops": [ - "重装", - "近卫", - "无需增调干员", - "术士", - "辅助", - "医疗", - "狙击", - "战备激活阀", - "改派发讯器", - "反制导能组件", - "装备扩充箱" - ], - "blacklist": [ - "罗比菈塔", - "掠风", - "白铁", - "史尔特尔", - "玛恩纳", - "龙舌兰", - "幽灵鲨", - "陈", - "耀骑士临光", - "斯卡蒂", - "赫拉格", - "宴", - "重岳", - "莫斯提马", - "远山", - "天火", - "炎熔", - "赤冬", - "炎狱炎熔", - "莱恩哈特", - "格雷伊", - "蚀清", - "梅尔", - "罗小黑", - "U-Official", - "阿米娅", - "玫兰莎" - ], - "stages": [ - { - "stage_name": "知难而进", - "strategies": [ - { - "core": "煌", - "tool_men": { - "近卫": 1 - }, - "location": [ - 5, - 5 - ], - "direction": "Up" - }, - { - "tool_men": { - "先锋": 100 - }, - "location": [ - 7, - 1 - ], - "direction": "Down" - }, - { - "core": "塞雷娅", - "tool_men": { - "重装": 1 - }, - "location": [ - 5, - 4 - ], - "direction": "Up" - }, - { - "tool_men": { - "辅助": 100 - }, - "location": [ - 6, - 5 - ], - "direction": "Up" - } - ], - "draw_as_possible": true, - "actions": [ - { - "type": "二倍速" - } - ], - "retry_times": 5 - }, - { - "stage_name": "荒地的手段", - "strategies": [ - { - "tool_men": { - "先锋": 100 - }, - "location": [ - 2, - 1 - ], - "direction": "Right" - }, - { - "core": "棘刺", - "tool_men": { - "近卫": 2 - }, - "location": [ - 2, - 2 - ], - "direction": "Down" - }, - { - "core": "泥岩", - "tool_men": { - "重装": 2 - }, - "location": [ - 2, - 4 - ], - "direction": "Right" - }, - { - "tool_men": { - "辅助": 100 - }, - "location": [ - 5, - 3 - ], - "direction": "Left" - } - ], - "draw_as_possible": true, - "actions": [ - { - "type": "二倍速" - }, - { - "type": "部署", - "name": "塞雷娅", - "location": [ - 3, - 1 - ], - "direction": "Right" - } - ], - "retry_times": 5 - }, - { - "stage_name": "麻木前行", - "strategies": [ - { - "tool_men": { - "先锋": 100 - }, - "location": [ - 8, - 1 - ], - "direction": "Down" - }, - { - "core": "棘刺", - "tool_men": { - "近卫": 4 - }, - "location": [ - 7, - 2 - ], - "direction": "Left" - }, - { - "core": "塞雷娅", - "tool_men": { - "重装": 3, - "近卫": 2 - }, - "location": [ - 5, - 2 - ], - "direction": "Left" - }, - { - "core": "伊芙利特", - "tool_men": { - "术士": 2 - }, - "location": [ - 8, - 2 - ], - "direction": "Left" - }, - { - "core": "泥岩", - "tool_men": { - "重装": 1 - }, - "location": [ - 6, - 2 - ], - "direction": "Left" - }, - { - "tool_men": { - "辅助": 100 - }, - "location": [ - 6, - 3 - ], - "direction": "Left" - } - ], - "draw_as_possible": true, - "actions": [ - { - "type": "二倍速" - }, - { - "type": "部署", - "name": "战备激活阀", - "location": [ - 5, - 3 - ], - "direction": "Up" - } - ], - "retry_times": 5 - }, - { - "stage_name": "混乱“派对”", - "strategies": [ - { - "tool_men": { - "先锋": 100 - }, - "location": [ - 3, - 1 - ], - "direction": "Right" - }, - { - "core": "棘刺", - "tool_men": { - "近卫": 3 - }, - "location": [ - 3, - 2 - ], - "direction": "Right" - }, - { - "core": "塞雷娅", - "tool_men": { - "重装": 3 - }, - "location": [ - 4, - 2 - ], - "direction": "Right" - }, - { - "core": "泥岩", - "tool_men": { - "重装": 3 - }, - "location": [ - 4, - 3 - ], - "direction": "Right" - }, - { - "tool_men": { - "辅助": 100, - "术士": 100 - }, - "location": [ - 2, - 2 - ], - "direction": "Right" - } - ], - "draw_as_possible": true, - "actions": [ - { - "type": "二倍速" - }, - { - "type": "部署", - "name": "战备激活阀", - "location": [ - 3, - 3 - ], - "direction": "Up" - } - ], - "retry_times": 5 - }, - { - "stage_name": "消息传递", - "strategies": [ - { - "tool_men": { - "先锋": 100 - }, - "location": [ - 8, - 2 - ], - "direction": "Down" - }, - { - "core": "煌", - "tool_men": { - "近卫": 4 - }, - "location": [ - 7, - 3 - ], - "direction": "Left" - }, - { - "core": "塞雷娅", - "tool_men": { - "重装": 3, - "近卫": 2 - }, - "location": [ - 6, - 3 - ], - "direction": "Left" - }, - { - "tool_men": { - "辅助": 100, - "术士": 100 - }, - "location": [ - 7, - 2 - ], - "direction": "Left" - } - ], - "draw_as_possible": true, - "actions": [ - { - "type": "CheckIfStartOver", - "name": "铃兰" - }, - { - "type": "部署", - "name": "铃兰", - "location": [ - 3, - 4 - ], - "direction": "Right" - }, - { - "type": "二倍速" - }, - { - "type": "部署", - "name": "伊芙利特", - "location": [ - 9, - 3 - ], - "direction": "Left" - }, - { - "type": "部署", - "name": "战备激活阀", - "location": [ - 7, - 4 - ], - "direction": "Up" - } - ], - "retry_times": 5 - } - ] -} From cb0a2181225c15877ce7417e401ef23d54db362f Mon Sep 17 00:00:00 2001 From: yueshen <106477016+HMZyueshen@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:17:10 +0800 Subject: [PATCH 3/8] =?UTF-8?q?Create=20SSS=5F=E7=BA=A6=E7=BF=B0=E8=80=81?= =?UTF-8?q?=E5=A6=88=E6=96=B0=E5=BB=BA=E5=9C=B0=E5=9D=97.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/copilot/SSS_约翰老妈新建地块.json | 470 +++++++++++++++++++++ 1 file changed, 470 insertions(+) create mode 100644 resource/copilot/SSS_约翰老妈新建地块.json diff --git a/resource/copilot/SSS_约翰老妈新建地块.json b/resource/copilot/SSS_约翰老妈新建地块.json new file mode 100644 index 0000000000..401402033a --- /dev/null +++ b/resource/copilot/SSS_约翰老妈新建地块.json @@ -0,0 +1,470 @@ +{ + "type": "SSS", + "stage_name": "约翰老妈新建地块", + "minimum_required": "v4.9.0", + "doc": { + "title": "约翰老妈保全(应急未测试)", + "title_color": "dark", + "details": "作者:YueShen\n约翰老妈(应急未测试)只能打到第5关,第5关还要看运气\n选战术装备整理箱\n尽量带档二先锋1技能\n要手动编队\n有问题群里找管理咕咕咕", + "details_color": "dark" + }, + "buff": "战术装备整理箱", + "equipment": [ + "A", "A", "A", "A", + "A", "A", "A", "A" + ], + "strategy": "优选策略", + "opers": [ + { + "name": "棘刺", + "skill": 3, + "skill_usage": 1 + }, + { + "name": "泥岩", + "skill": 2, + "skill_usage": 0 + }, + { + "name": "桃金娘", + "skill": 1, + "skill_usage": 1 + }, + { + "name": "煌", + "skill": 2, + "skill_usage": 0 + }, + { + "name": "塞雷娅", + "skill": 1, + "skill_usage": 0 + }, + { + "name": "伊芙利特", + "skill": 2, + "skill_usage": 0 + }, + { + "name": "铃兰", + "skill": 2, + "skill_usage": 0 + } + ], + "tool_men": { + "先锋": 1, + "近卫": 2, + "辅助": 6, + "重装": 2, + "术士": 2 + }, + "drops": [ + "重装", + "近卫", + "无需增调干员", + "术士", + "辅助", + "医疗", + "狙击", + "战备激活阀", + "改派发讯器", + "反制导能组件", + "装备扩充箱" + ], + "blacklist": [ + "罗比菈塔", + "掠风", + "白铁", + "史尔特尔", + "玛恩纳", + "龙舌兰", + "幽灵鲨", + "陈", + "耀骑士临光", + "斯卡蒂", + "赫拉格", + "宴", + "重岳", + "莫斯提马", + "远山", + "天火", + "炎熔", + "赤冬", + "炎狱炎熔", + "莱恩哈特", + "格雷伊", + "蚀清", + "梅尔", + "罗小黑", + "U-Official", + "阿米娅", + "玫兰莎" + ], + "stages": [ + { + "stage_name": "知难而进", + "strategies": [ + { + "core": "煌", + "tool_men": { + "近卫": 1 + }, + "location": [ + 5, + 5 + ], + "direction": "Up" + }, + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 7, + 1 + ], + "direction": "Down" + }, + { + "core": "塞雷娅", + "tool_men": { + "重装": 1 + }, + "location": [ + 5, + 4 + ], + "direction": "Up" + }, + { + "tool_men": { + "辅助": 100 + }, + "location": [ + 6, + 5 + ], + "direction": "Up" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "二倍速" + } + ], + "retry_times": 5 + }, + { + "stage_name": "荒地的手段", + "strategies": [ + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 2, + 1 + ], + "direction": "Right" + }, + { + "core": "棘刺", + "tool_men": { + "近卫": 2 + }, + "location": [ + 2, + 2 + ], + "direction": "Down" + }, + { + "core": "泥岩", + "tool_men": { + "重装": 2 + }, + "location": [ + 2, + 4 + ], + "direction": "Right" + }, + { + "tool_men": { + "辅助": 100 + }, + "location": [ + 5, + 3 + ], + "direction": "Left" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "二倍速" + }, + { + "type": "部署", + "name": "塞雷娅", + "location": [ + 3, + 1 + ], + "direction": "Right" + } + ], + "retry_times": 5 + }, + { + "stage_name": "麻木前行", + "strategies": [ + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 8, + 1 + ], + "direction": "Down" + }, + { + "core": "棘刺", + "tool_men": { + "近卫": 4 + }, + "location": [ + 7, + 2 + ], + "direction": "Left" + }, + { + "core": "塞雷娅", + "tool_men": { + "重装": 3, + "近卫": 2 + }, + "location": [ + 5, + 2 + ], + "direction": "Left" + }, + { + "core": "伊芙利特", + "tool_men": { + "术士": 2 + }, + "location": [ + 8, + 2 + ], + "direction": "Left" + }, + { + "core": "泥岩", + "tool_men": { + "重装": 1 + }, + "location": [ + 6, + 2 + ], + "direction": "Left" + }, + { + "tool_men": { + "辅助": 100 + }, + "location": [ + 6, + 3 + ], + "direction": "Left" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "二倍速" + }, + { + "type": "部署", + "name": "战备激活阀", + "location": [ + 5, + 3 + ], + "direction": "Up" + } + ], + "retry_times": 5 + }, + { + "stage_name": "混乱“派对”", + "strategies": [ + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 3, + 1 + ], + "direction": "Right" + }, + { + "core": "棘刺", + "tool_men": { + "近卫": 3 + }, + "location": [ + 3, + 2 + ], + "direction": "Right" + }, + { + "core": "塞雷娅", + "tool_men": { + "重装": 3 + }, + "location": [ + 4, + 2 + ], + "direction": "Right" + }, + { + "core": "泥岩", + "tool_men": { + "重装": 3 + }, + "location": [ + 4, + 3 + ], + "direction": "Right" + }, + { + "tool_men": { + "辅助": 100, + "术士": 100 + }, + "location": [ + 2, + 2 + ], + "direction": "Right" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "二倍速" + }, + { + "type": "部署", + "name": "战备激活阀", + "location": [ + 3, + 3 + ], + "direction": "Up" + } + ], + "retry_times": 5 + }, + { + "stage_name": "消息传递", + "strategies": [ + { + "tool_men": { + "先锋": 100 + }, + "location": [ + 8, + 2 + ], + "direction": "Down" + }, + { + "core": "煌", + "tool_men": { + "近卫": 4 + }, + "location": [ + 7, + 3 + ], + "direction": "Left" + }, + { + "core": "塞雷娅", + "tool_men": { + "重装": 3, + "近卫": 2 + }, + "location": [ + 6, + 3 + ], + "direction": "Left" + }, + { + "tool_men": { + "辅助": 100, + "术士": 100 + }, + "location": [ + 7, + 2 + ], + "direction": "Left" + } + ], + "draw_as_possible": true, + "actions": [ + { + "type": "CheckIfStartOver", + "name": "铃兰" + }, + { + "type": "部署", + "name": "铃兰", + "location": [ + 3, + 4 + ], + "direction": "Right" + }, + { + "type": "二倍速" + }, + { + "type": "部署", + "name": "伊芙利特", + "location": [ + 9, + 3 + ], + "direction": "Left" + }, + { + "type": "部署", + "name": "战备激活阀", + "location": [ + 7, + 4 + ], + "direction": "Up" + } + ], + "retry_times": 5 + } + ] +} From 163bdbba65f9687e265b3a136f5e4a4ab7c21000 Mon Sep 17 00:00:00 2001 From: Liam Sho Date: Tue, 18 Apr 2023 00:13:23 +0800 Subject: [PATCH 4/8] feat: config file write lock --- src/MaaWpfGui/Helper/ConfigurationHelper.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/MaaWpfGui/Helper/ConfigurationHelper.cs b/src/MaaWpfGui/Helper/ConfigurationHelper.cs index 4a0aeed92d..bada132f0a 100644 --- a/src/MaaWpfGui/Helper/ConfigurationHelper.cs +++ b/src/MaaWpfGui/Helper/ConfigurationHelper.cs @@ -27,6 +27,8 @@ namespace MaaWpfGui.Helper private static readonly ILogger _logger = Log.ForContext(); + private static readonly object _lock = new object(); + public delegate void ConfigurationUpdateEventHandler(string key, string oldValue, string newValue); public static event ConfigurationUpdateEventHandler ConfigurationUpdateEvent; @@ -91,9 +93,9 @@ namespace MaaWpfGui.Helper public static bool DeleteValue(string key) { var old = string.Empty; - if (_kvs.ContainsKey(key)) + if (_kvs.TryGetValue(key, out var kv)) { - old = _kvs[key]; + old = kv; } _kvs.Remove(key); @@ -174,7 +176,7 @@ namespace MaaWpfGui.Helper /// Save configuration file /// /// The result of saving process - public static bool Save() + private static bool Save() { if (Released) { @@ -189,7 +191,10 @@ namespace MaaWpfGui.Helper try { - File.WriteAllText(_configurationFile, jsonStr); + lock (_lock) + { + File.WriteAllText(_configurationFile, jsonStr); + } } catch (Exception e) { From 7778c4319591ccd6e0640be841e427b078f94e80 Mon Sep 17 00:00:00 2001 From: Horror Proton <107091537+horror-proton@users.noreply.github.com> Date: Sun, 16 Apr 2023 13:19:15 +0800 Subject: [PATCH 5/8] perf: reduce amout of mutex in Assistant --- src/MaaCore/Assistant.cpp | 92 +++++++++++---------------------------- src/MaaCore/Assistant.h | 37 ++++------------ 2 files changed, 33 insertions(+), 96 deletions(-) diff --git a/src/MaaCore/Assistant.cpp b/src/MaaCore/Assistant.cpp index 0c0995a504..6ce73597a4 100644 --- a/src/MaaCore/Assistant.cpp +++ b/src/MaaCore/Assistant.cpp @@ -5,7 +5,6 @@ #include #include "Config/GeneralConfig.h" -#include "Config/Miscellaneous/OcrPack.h" #include "Controller/Controller.h" #include "Status.h" #include "Task/Interface/AwardTask.h" @@ -160,16 +159,6 @@ bool asst::Assistant::ctrl_connect(const std::string& adb_path, const std::strin return ret; } -bool asst::Assistant::ctrl_click(int x, int y) -{ - return m_ctrler->click(Point(x, y)); -} - -bool asst::Assistant::ctrl_screencap() -{ - return m_ctrler->screencap(); -} - asst::Assistant::TaskId asst::Assistant::append_task(const std::string& type, const std::string& params) { Log.info(__FUNCTION__, type, params); @@ -281,23 +270,21 @@ asst::Assistant::AsyncCallId asst::Assistant::async_connect(const std::string& a { LogTraceFunction; - return append_async_call( - AsyncCallItem::Type::Connect, - AsyncCallItem::ConnectParams { .adb_path = adb_path, .address = address, .config = config }, block); + return append_async_call([=, this]() { return ctrl_connect(adb_path, address, config); }, block, "Connect"); } asst::Assistant::AsyncCallId asst::Assistant::async_click(int x, int y, bool block) { LogTraceFunction; - return append_async_call(AsyncCallItem::Type::Click, AsyncCallItem::ClickParams { .x = x, .y = y }, block); + return append_async_call([=, this]() { return m_ctrler->click(Point(x, y)); }, block, "Click"); } asst::Assistant::AsyncCallId asst::Assistant::async_screencap(bool block) { LogTraceFunction; - return append_async_call(AsyncCallItem::Type::Screencap, AsyncCallItem::ScreencapParams {}, block); + return append_async_call([this]() { return m_ctrler->screencap(); }, block, "Screencap"); } bool asst::Assistant::connected() const @@ -445,17 +432,16 @@ void Assistant::msg_proc() } } -asst::Assistant::AsyncCallId asst::Assistant::append_async_call(AsyncCallItem::Type type, AsyncCallItem::Parmas params, - bool block) +asst::Assistant::AsyncCallId asst::Assistant::append_async_call(std::function func, bool block, + std::string what) { LogTraceFunction; - AsyncCallId id = 0; + AsyncCallId id; { std::unique_lock lock(m_call_mutex); id = ++m_call_id; - AsyncCallItem item { .id = id, .type = type, .params = std::move(params) }; - + AsyncCallItem item = { id, std::move(func), std::move(what) }; m_call_queue.emplace(std::move(item)); m_call_condvar.notify_one(); } @@ -471,12 +457,9 @@ asst::Assistant::AsyncCallId asst::Assistant::append_async_call(AsyncCallItem::T bool asst::Assistant::wait_async_id(AsyncCallId id) { while (!m_thread_exit) { - std::unique_lock lock(m_completed_call_mutex); - // 需要保证队列中id一定是有序的 - if (id <= m_completed_call) { - return true; - } - m_completed_call_condvar.wait(lock); + auto old = m_completed_call.load(); + if (old >= id) return true; + m_completed_call.wait(old); } return false; } @@ -486,55 +469,30 @@ void asst::Assistant::call_proc() LogTraceFunction; while (!m_thread_exit) { - std::unique_lock lock(m_call_mutex); - if (m_call_queue.empty()) { - m_call_condvar.wait(lock); - continue; - } - - auto call_item = std::move(m_call_queue.front()); - m_call_queue.pop(); - lock.unlock(); - - auto start = std::chrono::steady_clock::now(); - bool ret = false; - std::string what; - - switch (call_item.type) { - case AsyncCallItem::Type::Connect: { - what = "Connect"; - const auto& [adb_path, address, config] = std::get(call_item.params); - ret = ctrl_connect(adb_path, address, config); - } break; - case AsyncCallItem::Type::Click: { - what = "Click"; - const auto& [x, y] = std::get(call_item.params); - ret = ctrl_click(x, y); - } break; - case AsyncCallItem::Type::Screencap: { - what = "Screencap"; - std::ignore = std::get(call_item.params); - ret = ctrl_screencap(); - } break; - default: - what = "Unknown"; - ret = false; - break; - } + AsyncCallItem old_call_item; { - std::unique_lock completed_call_lock(m_completed_call_mutex); - m_completed_call = call_item.id; - m_completed_call_condvar.notify_all(); + std::unique_lock lock(m_call_mutex); + if (m_call_queue.empty()) { + m_call_condvar.wait(lock); + continue; + } + old_call_item = std::move(m_call_queue.front()); + m_call_queue.pop(); } + auto start = std::chrono::steady_clock::now(); + bool ret = old_call_item.function(); + m_completed_call = old_call_item.id; + m_completed_call.notify_all(); + auto cost = std::chrono::duration_cast(std::chrono::steady_clock::now() - start).count(); json::value cb_info = json::object { { "uuid", m_uuid }, - { "what", what }, - { "async_call_id", call_item.id }, + { "what", old_call_item.what }, + { "async_call_id", old_call_item.id }, { "details", json::object { diff --git a/src/MaaCore/Assistant.h b/src/MaaCore/Assistant.h index 84686e0352..9a15293578 100644 --- a/src/MaaCore/Assistant.h +++ b/src/MaaCore/Assistant.h @@ -104,35 +104,18 @@ namespace asst private: struct AsyncCallItem { - enum class Type - { - Connect, - Click, - Screencap, - }; - struct ConnectParams - { - std::string adb_path; - std::string address; - std::string config; - }; - struct ClickParams - { - int x = 0; - int y = 0; - }; - struct ScreencapParams - {}; - using Parmas = std::variant; - AsyncCallId id; - Type type; - Parmas params; + std::function function; + std::string what = "Unknown"; }; - AsyncCallId append_async_call(AsyncCallItem::Type type, AsyncCallItem::Parmas params, bool block = false); + + // submit async call task to queue + asst::Assistant::AsyncCallId append_async_call(std::function func, bool block, + std::string what = "Unknown"); bool wait_async_id(AsyncCallId id); private: + // thread executing async call tasks one by one from queue void call_proc(); void working_proc(); void msg_proc(); @@ -142,8 +125,6 @@ namespace asst bool inited() const noexcept; bool ctrl_connect(const std::string& adb_path, const std::string& address, const std::string& config); - bool ctrl_click(int x, int y); - bool ctrl_screencap(); std::string m_uuid; @@ -169,9 +150,7 @@ namespace asst std::mutex m_call_mutex; std::condition_variable m_call_condvar; - AsyncCallId m_completed_call = 0; // 每个实例有自己独立的执行队列,所以不能静态 - std::mutex m_completed_call_mutex; - std::condition_variable m_completed_call_condvar; + std::atomic m_completed_call = 0; // 每个实例有自己独立的执行队列,所以不能静态 std::thread m_msg_thread; std::thread m_call_thread; From 86654334c805919be5d786284d4462cc1a282a15 Mon Sep 17 00:00:00 2001 From: Horror Proton <107091537+horror-proton@users.noreply.github.com> Date: Sun, 16 Apr 2023 19:02:25 +0800 Subject: [PATCH 6/8] feat: make sure async func args listed explicitly --- src/MaaCore/Assistant.cpp | 26 ++++++++++++++++++++------ src/MaaCore/Assistant.h | 5 +++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/MaaCore/Assistant.cpp b/src/MaaCore/Assistant.cpp index 6ce73597a4..433b626385 100644 --- a/src/MaaCore/Assistant.cpp +++ b/src/MaaCore/Assistant.cpp @@ -270,21 +270,29 @@ asst::Assistant::AsyncCallId asst::Assistant::async_connect(const std::string& a { LogTraceFunction; - return append_async_call([=, this]() { return ctrl_connect(adb_path, address, config); }, block, "Connect"); + return append_async_call( + block, "Connect", + [](Assistant* this_a, const std::string& adb_path, const std::string& address, const std::string& config) { + return this_a->ctrl_connect(adb_path, address, config); + }, + this, adb_path, address, config); } asst::Assistant::AsyncCallId asst::Assistant::async_click(int x, int y, bool block) { LogTraceFunction; - return append_async_call([=, this]() { return m_ctrler->click(Point(x, y)); }, block, "Click"); + return append_async_call( + block, "Click", [](Assistant* this_a, int x, int y) { return this_a->m_ctrler->click(Point(x, y)); }, this, x, + y); } asst::Assistant::AsyncCallId asst::Assistant::async_screencap(bool block) { LogTraceFunction; - return append_async_call([this]() { return m_ctrler->screencap(); }, block, "Screencap"); + return append_async_call( + block, "Screencap", [](Assistant* this_a) { return this_a->m_ctrler->screencap(); }, this); } bool asst::Assistant::connected() const @@ -432,16 +440,22 @@ void Assistant::msg_proc() } } -asst::Assistant::AsyncCallId asst::Assistant::append_async_call(std::function func, bool block, - std::string what) +template +asst::Assistant::AsyncCallId asst::Assistant::append_async_call(bool block, std::string what, Func&&, Args&&... args) { LogTraceFunction; + // std::function mf = [... args = std::forward(args)]() mutable { + // return std::invoke(Func {}, std::forward(args)...); + // }; + std::function mf = [args...]() mutable { // type erasure, force capture by value + return std::invoke(Func {}, args...); + }; AsyncCallId id; { std::unique_lock lock(m_call_mutex); id = ++m_call_id; - AsyncCallItem item = { id, std::move(func), std::move(what) }; + AsyncCallItem item = { id, std::move(mf), std::move(what) }; m_call_queue.emplace(std::move(item)); m_call_condvar.notify_one(); } diff --git a/src/MaaCore/Assistant.h b/src/MaaCore/Assistant.h index 9a15293578..2baaa74f08 100644 --- a/src/MaaCore/Assistant.h +++ b/src/MaaCore/Assistant.h @@ -110,8 +110,9 @@ namespace asst }; // submit async call task to queue - asst::Assistant::AsyncCallId append_async_call(std::function func, bool block, - std::string what = "Unknown"); + template + asst::Assistant::AsyncCallId append_async_call(bool block, std::string what, + Func&& lambda_with_empty_capture_list, Args&&... args); bool wait_async_id(AsyncCallId id); private: From 5f7a79acb0be3358623be2dc6651a316e771142a Mon Sep 17 00:00:00 2001 From: Horror Proton <107091537+horror-proton@users.noreply.github.com> Date: Tue, 18 Apr 2023 00:05:59 +0800 Subject: [PATCH 7/8] feat: revert using std::function in append_async_c --- src/MaaCore/Assistant.cpp | 69 +++++++++++++++++++++++++-------------- src/MaaCore/Assistant.h | 31 ++++++++++++++---- 2 files changed, 68 insertions(+), 32 deletions(-) diff --git a/src/MaaCore/Assistant.cpp b/src/MaaCore/Assistant.cpp index 433b626385..6ab1aa2790 100644 --- a/src/MaaCore/Assistant.cpp +++ b/src/MaaCore/Assistant.cpp @@ -159,6 +159,16 @@ bool asst::Assistant::ctrl_connect(const std::string& adb_path, const std::strin return ret; } +bool asst::Assistant::ctrl_click(int x, int y) +{ + return m_ctrler->click(Point(x, y)); +} + +bool asst::Assistant::ctrl_screencap() +{ + return m_ctrler->screencap(); +} + asst::Assistant::TaskId asst::Assistant::append_task(const std::string& type, const std::string& params) { Log.info(__FUNCTION__, type, params); @@ -271,28 +281,21 @@ asst::Assistant::AsyncCallId asst::Assistant::async_connect(const std::string& a LogTraceFunction; return append_async_call( - block, "Connect", - [](Assistant* this_a, const std::string& adb_path, const std::string& address, const std::string& config) { - return this_a->ctrl_connect(adb_path, address, config); - }, - this, adb_path, address, config); + AsyncCallItem::ConnectParams { .adb_path = adb_path, .address = address, .config = config }, block); } asst::Assistant::AsyncCallId asst::Assistant::async_click(int x, int y, bool block) { LogTraceFunction; - return append_async_call( - block, "Click", [](Assistant* this_a, int x, int y) { return this_a->m_ctrler->click(Point(x, y)); }, this, x, - y); + return append_async_call(AsyncCallItem::ClickParams { .x = x, .y = y }, block); } asst::Assistant::AsyncCallId asst::Assistant::async_screencap(bool block) { LogTraceFunction; - return append_async_call( - block, "Screencap", [](Assistant* this_a) { return this_a->m_ctrler->screencap(); }, this); + return append_async_call(AsyncCallItem::ScreencapParams {}, block); } bool asst::Assistant::connected() const @@ -440,22 +443,15 @@ void Assistant::msg_proc() } } -template -asst::Assistant::AsyncCallId asst::Assistant::append_async_call(bool block, std::string what, Func&&, Args&&... args) +asst::Assistant::AsyncCallId asst::Assistant::append_async_call(AsyncCallItem::Params params, bool block) { LogTraceFunction; - // std::function mf = [... args = std::forward(args)]() mutable { - // return std::invoke(Func {}, std::forward(args)...); - // }; - std::function mf = [args...]() mutable { // type erasure, force capture by value - return std::invoke(Func {}, args...); - }; AsyncCallId id; { std::unique_lock lock(m_call_mutex); id = ++m_call_id; - AsyncCallItem item = { id, std::move(mf), std::move(what) }; + AsyncCallItem item = { .id = id, .params = std::move(params) }; m_call_queue.emplace(std::move(item)); m_call_condvar.notify_one(); } @@ -484,7 +480,7 @@ void asst::Assistant::call_proc() while (!m_thread_exit) { - AsyncCallItem old_call_item; + AsyncCallItem call_item; { std::unique_lock lock(m_call_mutex); @@ -492,21 +488,44 @@ void asst::Assistant::call_proc() m_call_condvar.wait(lock); continue; } - old_call_item = std::move(m_call_queue.front()); + call_item = std::move(m_call_queue.front()); m_call_queue.pop(); } auto start = std::chrono::steady_clock::now(); - bool ret = old_call_item.function(); - m_completed_call = old_call_item.id; + bool ret = false; + std::string what = "Unknown"; + + std::visit( + [&](auto&& args) -> void { + what = args.what; + + using T = std::decay_t; + if constexpr (std::is_same_v) { + const auto& [adb_path, address, config] = args; + ret = ctrl_connect(adb_path, address, config); + } + else if constexpr (std::is_same_v) { + const auto& [x, y] = args; + ret = ctrl_click(x, y); + } + else if constexpr (std::is_same_v) { + ret = ctrl_screencap(); + } + else + static_assert(utils::always_false, "non-exhaustive visitor!"); + }, + call_item.params); + + m_completed_call = call_item.id; m_completed_call.notify_all(); auto cost = std::chrono::duration_cast(std::chrono::steady_clock::now() - start).count(); json::value cb_info = json::object { { "uuid", m_uuid }, - { "what", old_call_item.what }, - { "async_call_id", old_call_item.id }, + { "what", what }, + { "async_call_id", call_item.id }, { "details", json::object { diff --git a/src/MaaCore/Assistant.h b/src/MaaCore/Assistant.h index 2baaa74f08..3abc371dcb 100644 --- a/src/MaaCore/Assistant.h +++ b/src/MaaCore/Assistant.h @@ -104,15 +104,30 @@ namespace asst private: struct AsyncCallItem { - AsyncCallId id; - std::function function; - std::string what = "Unknown"; - }; + struct ConnectParams + { + std::string adb_path; + std::string address; + std::string config; + static constexpr std::string_view what = "Connect"; + }; + struct ClickParams + { + int x = 0; + int y = 0; + static constexpr std::string_view what = "Click"; + }; + struct ScreencapParams + { + static constexpr std::string_view what = "Screencap"; + }; + using Params = std::variant; + AsyncCallId id; + Params params; + }; // submit async call task to queue - template - asst::Assistant::AsyncCallId append_async_call(bool block, std::string what, - Func&& lambda_with_empty_capture_list, Args&&... args); + AsyncCallId append_async_call(AsyncCallItem::Params params, bool block); bool wait_async_id(AsyncCallId id); private: @@ -126,6 +141,8 @@ namespace asst bool inited() const noexcept; bool ctrl_connect(const std::string& adb_path, const std::string& address, const std::string& config); + bool ctrl_click(int x, int y); + bool ctrl_screencap(); std::string m_uuid; From 2afeaedfc8f3e70d7c333b202f16c92cbc454b14 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 18 Apr 2023 00:58:23 +0800 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=82=89=E9=B8=BD?= =?UTF-8?q?=E5=85=B3=E5=8D=A1=E5=90=8D=E8=AF=86=E5=88=AB=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #4370 --- resource/tasks.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resource/tasks.json b/resource/tasks.json index 1d51bce46b..f2665efb60 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -5908,7 +5908,12 @@ 800, 100 ], - "ocrReplace": [] + "ocrReplace": [ + [ + ".*前顾后", + "瞻前顾后" + ] + ] }, "BattleSupportUnitFormation": { "action": "ClickSelf",