Skip to content

Commit 4a70874

Browse files
authored
Merge pull request #217 from Gloaming02/feature/ctrl-combat-skill
[挂机赛琪适配] 添加了 `Ctrl+战技` 组合键功能,支持在全局技能配置中使用 Ctrl+E 组合键释放战技。
2 parents 43cfd83 + 60ddc91 commit 4a70874

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

src/char/BaseChar.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,39 @@ def send_combat_key(self, after_sleep=0, interval=-1, down_time=0.01):
5656
self._combat_available = False
5757
self.task.send_key(self.get_combat_key(), interval=interval, down_time=down_time, after_sleep=after_sleep)
5858

59+
60+
def send_combat_key_with_ctrl(self, after_sleep=0):
61+
"""发送 Ctrl + 战技组合键 (Ctrl+E)。
62+
63+
Args:
64+
after_sleep (float, optional): 发送后的休眠时间。默认为 0。
65+
interval (float, optional): 不适用没保留参数
66+
down_time (float, optional): 不适用没保留参数
67+
"""
68+
69+
self._combat_available = False
70+
71+
# 1. 按下 Ctrl (只按不放) - 使用 ok 框架支持的 "CONTROL" 键名
72+
self.task.send_key_down("CONTROL")
73+
74+
# 2. 稍微等待,确保系统/游戏识别到 Ctrl 已按住 (防止判定为单独按 E)
75+
# 不设置check_combat=False,会报错sleep check not in combat
76+
self.sleep(0.05, check_combat=False)
77+
78+
# 3. 发送战技 (按 E)
79+
# 直接调用现有的 send_combat_key 方法
80+
self.send_combat_key()
81+
82+
# 4. 稍微等待,防止释放过快
83+
self.sleep(0.05, check_combat=False)
84+
85+
# 5. 释放 Ctrl - 使用 ok 框架支持的 "CONTROL" 键名
86+
self.task.send_key_up("CONTROL")
87+
88+
# 6. 模拟ok-script,处理后续休眠
89+
if after_sleep > 0:
90+
self.sleep(after_sleep)
91+
5992
def send_ultimate_key(self, after_sleep=0, interval=-1, down_time=0.01):
6093
"""发送终结技按键。
6194

src/tasks/CommissionsTask.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ def action():
338338
after_sleep = self.commission_skill_config.get(f"技能{local_n}_释放后等待", 0.0)
339339
if skill == "战技":
340340
self.get_current_char().send_combat_key()
341+
elif skill == "Ctrl+战技(赛琪专属)":
342+
self.get_current_char().send_combat_key_with_ctrl()
341343
elif skill == "终结技":
342344
self.get_current_char().send_ultimate_key()
343345
elif skill == "魔灵支援":

src/tasks/config/CommissionSkillConfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
config_type.update({
2323
f"技能{n}": {
2424
"type": "drop_down",
25-
"options": ["不使用", "战技", "终结技", "魔灵支援", "普攻"],
25+
"options": ["不使用", "战技", "Ctrl+战技(赛琪专属)", "终结技", "魔灵支援", "普攻"],
2626
},
2727
})
2828

0 commit comments

Comments
 (0)