Skip to content

Commit

Permalink
#58 补充事件
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorReid committed Aug 18, 2024
1 parent 68f995b commit 81057d2
Show file tree
Hide file tree
Showing 19 changed files with 150 additions and 32 deletions.
2 changes: 1 addition & 1 deletion assets/game_data/hollow_zero/normal_event/奇货.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "奇货"
event_name: "事件人工自动贩卖机"
event_name: "人工自动贩卖机"
lcs_percent: 0.6
options:
- option_name: "拆开贩卖机一探究竞"
Expand Down
2 changes: 1 addition & 1 deletion assets/game_data/hollow_zero/normal_event/房屋残骸.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "房屋残骸"
event_name: "事件坍塌的房屋"
event_name: "坍塌的房屋"
lcs_percent: 0.5
options:
- option_name: "强行拜访"
Expand Down
2 changes: 1 addition & 1 deletion assets/game_data/hollow_zero/normal_event/求救信号.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "求救信号"
event_name: "事件求救信号"
event_name: "求救信号"
options:
- option_name: "进行信号源分析"
- option_name: "直接进入"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "治安官小队"
event_name: "事件治安局预备队"
event_name: "治安局预备队"
lcs_percent: 0.5
options:
- option_name: "我一定要珍惜地使用"
Expand Down
2 changes: 1 addition & 1 deletion assets/game_data/hollow_zero/normal_event/活化结晶.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "活化结晶"
event_name: "事件活化结晶"
event_name: "活化结晶"
lcs_percent: 0.6
options:
- option_name: "加工为战斗物资"
Expand Down

This file was deleted.

24 changes: 24 additions & 0 deletions assets/game_data/hollow_zero/normal_event/精锐邦布助手.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- entry_name: "精锐邦布助手"
event_name: "武装升级"
options:
- option_name: "失去1枚A级鸣徽,获得1枚S级鸣徽"
- option_name: "失去1 枚B级鸣徽,获得1枚A级鸣徽"
- option_name: "用1枚S级鸣徽更换3个随机鸣徽"
- option_name: "离开"

- entry_name: "精锐邦布助手"
event_name: "随机交换"
options:
- option_name: "离开"
- option_name: "用所有鸣徽,交换等量鸣徽"

- entry_name: "精锐邦布助手"
event_name: "精锐邦布助手"
lcs_percent: 0.8
options:
- option_name: "我是法厄同,送我!"
desc: "压力值+50,获得0~3枚鸣徽"
- option_name: "获得基础礼包"
desc: "获得1枚B级鸣徽"
- option_name: "升级可购买物资礼包"
desc: "花费300齿轮硬币"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "紧急撤离点"
event_name: "事件紧急撤离点"
event_name: "紧急撤离点"
lcs_percent: 0.5
options:
- option_name: "不需要按下按钮"
Expand Down
2 changes: 1 addition & 1 deletion assets/game_data/hollow_zero/normal_event/裂隙.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "裂隙"
event_name: "事件裂隙"
event_name: "裂隙"
options:
- option_name: "放弃挣扎,拥抱深渊"
- option_name: "物品遗失"
Expand Down
2 changes: 1 addition & 1 deletion assets/game_data/hollow_zero/normal_event/调查员.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "调查员"
event_name: "事件老练的调查员"
event_name: "老练的调查员"
options:
- option_name: "购买"
desc: "花费400齿轮硬币,获得1枚鸣徽"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "资源回收小组"
event_name: "事件资源回收小组"
event_name: "资源回收小组"
lcs_percent: 0.6
options:
- option_name: "买1个物资箱"
Expand Down
17 changes: 15 additions & 2 deletions assets/game_data/hollow_zero/normal_event/通道.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- entry_name: "通道"
event_name: "事件前人藏宝,后人生财"
event_name: "前人藏宝,后人生财"
lcs_percent: 0.6
options:
- option_name: "看向妮可"
Expand All @@ -12,4 +12,17 @@
desc: "损失15%生命值,获得800~1400齿轮硬币"

- option_name: "拜托1号队员"
desc: "损失15%生命值,获得800~1400齿轮硬币"
desc: "损失15%生命值,获得800~1400齿轮硬币"

- entry_name: "通道"
event_name: "安全车厢"
lcs_percent: 0.6
options:
- option_name: "认真修理一番"
desc: "压力值+50,催化2枚鸣徽"

- option_name: "就修一下大门吧"
desc: "压力值+25,催化1枚鸣徽"

- option_name: "在列车中歇一歇"
desc: "压力值-30"
18 changes: 18 additions & 0 deletions assets/game_data/hollow_zero/normal_event/邂逅.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@
event_name: "篝火如家般温暖"
lcs_percent: 0.5

# 朱鸢
- entry_name: "邂逅"
event_name: "体系的力量"
options:
- option_name: "恭敬不如从命"

# 朱鸢
- entry_name: "邂逅"
event_name: "面子的力量"
options:
- option_name: "告知实情"

# 艾莲
- entry_name: "邂逅"
event_name: "休息是为了更好地工作"
lcs_percent: 0.5
Expand All @@ -35,3 +38,18 @@
- option_name: "艾莲?该出发了!"
desc: "艾莲不参加下1场战斗,归队后回复生命值并提升伤害"

# 安比
- entry_name: "邂逅"
event_name: "张驰有度,收放自如"
lcs_percent: 0.6
options:
- option_name: "听从安比的建议,体息一会儿"

# 安比
- entry_name: "邂逅"
event_name: "有备无患"
lcs_percent: 0.8
options:
- option_name: "使用抗侵蚀剂"
- option_name: "感谢安比"

12 changes: 4 additions & 8 deletions config/auto_battle/击破站场-强攻速切.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@ check_quick_interval: [0.9, 1.1]

scenes:

- triggers: [ "闪避识别-黄光" ]
- triggers: [ "闪避识别-黄光", "闪避识别-红光", "闪避识别-声音" ]
interval: 1
handlers:
- states: "[闪避识别-黄光]"
sub_states:
- state_template: "双反模板-强攻"
- state_template: "双反模板-击破"
- state_template: "双反模板-下一个"

- triggers: [ "闪避识别-红光", "闪避识别-声音" ]
interval: 1
handlers:
- states: "[闪避识别-红光] | [闪避识别-声音]"
sub_states:
- state_template: "闪A模板-全角色"
- states: "[闪避识别-红光] | [闪避识别-声音]"
sub_states:
- state_template: "闪A模板-全角色"

- triggers: [ "按键可用-快速支援" ]
interval: 1
Expand Down
1 change: 1 addition & 0 deletions src/zzz_od/hollow_zero/game_data/hollow_zero_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class HollowZeroSpecialEvent(Enum):
RESONIUM_CONFIRM_2 = HallowZeroEvent('确定')
RESONIUM_UPGRADE = HallowZeroEvent('催化')
RESONIUM_DROP = HallowZeroEvent('丢弃')
RESONIUM_SWITCH = HallowZeroEvent('交换')

SWIFT_SUPPLY_LIFE = HallowZeroEvent('回复生命值')
SWIFT_SUPPLY_COIN = HallowZeroEvent('获取齿轮硬币')
Expand Down
5 changes: 2 additions & 3 deletions src/zzz_od/operation/hollow_zero/event/drop_resonium.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ def choose_one(self) -> OperationRoundResult:
def choose_default(self):
screen = self.screenshot()
area = self.ctx.screen_loader.get_area('零号空洞-事件', '底部-选择列表')
return self.round_by_ocr_and_click(screen, '催化', area=area,
success_wait=1, retry_wait=1,
color_range=[(240, 240, 240), (255, 255, 255)])
return self.round_by_ocr_and_click(screen, '丢弃', area=area,
success_wait=1, retry_wait=1)
3 changes: 2 additions & 1 deletion src/zzz_od/operation/hollow_zero/event/event_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def check_dialog_confirm(op: ZOperation, screen: MatLike) -> Optional[str]:

def check_bottom_choose(op: ZOperation, screen: MatLike) -> Optional[str]:
"""
底部是否有 选择、确认、催化、丢弃
底部是否有 选择、确认、催化、丢弃、交换
- 鸣徽选择、催化
- 奖励确认
- 邦布选择
Expand All @@ -156,6 +156,7 @@ def check_bottom_choose(op: ZOperation, screen: MatLike) -> Optional[str]:
HollowZeroSpecialEvent.RESONIUM_CONFIRM_2.value,
HollowZeroSpecialEvent.RESONIUM_UPGRADE.value,
HollowZeroSpecialEvent.RESONIUM_DROP.value,
HollowZeroSpecialEvent.RESONIUM_SWITCH.value,
HollowZeroSpecialEvent.SWIFT_SUPPLY_LIFE.value,
HollowZeroSpecialEvent.SWIFT_SUPPLY_COIN.value,
HollowZeroSpecialEvent.SWIFT_SUPPLY_PRESS.value
Expand Down
72 changes: 72 additions & 0 deletions src/zzz_od/operation/hollow_zero/event/switch_resonium.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import time

from typing import List

from cv2.typing import MatLike

from one_dragon.base.matcher.match_result import MatchResultList, MatchResult
from one_dragon.base.operation.operation_edge import node_from
from one_dragon.base.operation.operation_node import operation_node
from one_dragon.base.operation.operation_round_result import OperationRoundResult
from one_dragon.utils import cv2_utils, str_utils
from one_dragon.utils.i18_utils import gt
from zzz_od.context.zzz_context import ZContext
from zzz_od.operation.hollow_zero.event import resonium_utils
from zzz_od.operation.zzz_operation import ZOperation


class SwitchResonium(ZOperation):

def __init__(self, ctx: ZContext):
"""
在选择鸣徽的画面了 选择一个
:param ctx:
"""
ZOperation.__init__(
self, ctx,
op_name=gt('交换鸣徽')
)

@operation_node(name='选择', is_start_node=True)
def choose_one(self) -> OperationRoundResult:
screen = self.screenshot()

item_list = resonium_utils.get_to_choose_list(self.ctx, screen, '交换')
if len(item_list) == 0:
return self.round_retry(status='识别不到选项', wait=0.5)

idx_list = resonium_utils.choose_resonium_by_priority([i.data for i in item_list],
self.ctx.hollow_zero_challenge_config.resonium_priority)
if len(idx_list) == 0:
return self.round_retry(status='优先级无返回', wait=0.5)

mr = item_list[idx_list[0]]
self.ctx.controller.click(mr.center)
time.sleep(0.1)
return self.round_by_click_area('零号空洞-事件', '空白', success_wait=0.9)

@node_from(from_name='选择', success=False) # 防止识别有问题 兜底随便选一个
@operation_node(name='兜底选择')
def choose_default(self):
screen = self.screenshot()
area = self.ctx.screen_loader.get_area('零号空洞-事件', '底部-选择列表')
return self.round_by_ocr_and_click(screen, '交换', area=area,
success_wait=1, retry_wait=1,
color_range=[(240, 240, 240), (255, 255, 255)])






def __debug():
ctx = ZContext()
ctx.init_by_config()
ctx.start_running()
ctx.ocr.init_model()
op = ChooseResonium(ctx)
op.execute()


if __name__ == '__main__':
__debug()
5 changes: 3 additions & 2 deletions src/zzz_od/operation/hollow_zero/hollow_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
from one_dragon.base.operation.operation_node import operation_node
from one_dragon.base.operation.operation_round_result import OperationRoundResult
from one_dragon.utils.i18_utils import gt
from one_dragon.utils.log_utils import log
from zzz_od.context.zzz_context import ZContext
from zzz_od.hollow_zero.game_data.hollow_zero_event import HollowZeroSpecialEvent
from zzz_od.hollow_zero.hollow_map.hollow_zero_map import HollowZeroMapNode, HollowZeroMap
from zzz_od.operation.hollow_zero import hollow_utils
from zzz_od.operation.hollow_zero.event.bamboo_merchant import BambooMerchant
from zzz_od.operation.hollow_zero.event.call_for_support import CallForSupport
from zzz_od.operation.hollow_zero.event.choose_resonium import ChooseResonium
from zzz_od.operation.hollow_zero.event.confirm_resonium import ConfirmResonium
from zzz_od.operation.hollow_zero.event.critical_stage import CriticalStage
from zzz_od.operation.hollow_zero.event.drop_resonium import DropResonium
from zzz_od.operation.hollow_zero.event.normal_event_handler import NormalEventHandler
from zzz_od.operation.hollow_zero.event.remove_corruption import RemoveCorruption
from zzz_od.operation.hollow_zero.event.bamboo_merchant import BambooMerchant
from zzz_od.operation.hollow_zero.event.swift_supply import SwiftSupply
from zzz_od.operation.hollow_zero.event.switch_resonium import SwitchResonium
from zzz_od.operation.hollow_zero.event.upgrade_resonium import UpgradeResonium
from zzz_od.operation.hollow_zero.hollow_battle import HollowBattle
from zzz_od.operation.zzz_operation import ZOperation
Expand All @@ -46,6 +46,7 @@ def __init__(self, ctx: ZContext):
HollowZeroSpecialEvent.RESONIUM_CONFIRM_2.value.event_name: ConfirmResonium,
HollowZeroSpecialEvent.RESONIUM_UPGRADE.value.event_name: UpgradeResonium,
HollowZeroSpecialEvent.RESONIUM_DROP.value.event_name: DropResonium,
HollowZeroSpecialEvent.RESONIUM_SWITCH.value.event_name: SwitchResonium,
HollowZeroSpecialEvent.SWIFT_SUPPLY_LIFE.value.event_name: SwiftSupply,
HollowZeroSpecialEvent.SWIFT_SUPPLY_COIN.value.event_name: SwiftSupply,
HollowZeroSpecialEvent.SWIFT_SUPPLY_PRESS.value.event_name: SwiftSupply,
Expand Down

0 comments on commit 81057d2

Please sign in to comment.