From 65c8b944039121bd42445ecf431cb2294379ca34 Mon Sep 17 00:00:00 2001 From: DoctorReid Date: Tue, 23 Jul 2024 11:03:08 +0800 Subject: [PATCH] =?UTF-8?q?#23=20=E5=A2=9E=E5=8A=A0=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/game_data/agent/anby.yml | 4 ++ assets/game_data/agent/anton.yml | 4 ++ assets/game_data/agent/ben.yml | 4 ++ assets/game_data/agent/billy.yml | 4 ++ assets/game_data/agent/corin.yml | 4 ++ assets/game_data/agent/ellen.yml | 4 ++ assets/game_data/agent/grace.yml | 4 ++ assets/game_data/agent/koleda.yml | 4 ++ assets/game_data/agent/lucy.yml | 4 ++ assets/game_data/agent/lycaon.yml | 4 ++ assets/game_data/agent/nekomata.yml | 4 ++ assets/game_data/agent/nicole.yml | 4 ++ assets/game_data/agent/piper.yml | 4 ++ assets/game_data/agent/rina.yml | 4 ++ assets/game_data/agent/soldier_11.yml | 4 ++ assets/game_data/agent/soukaku.yml | 4 ++ src/zzz_od/game_data/agent.py | 55 ++++++++++++++++++++------- 17 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 assets/game_data/agent/anby.yml create mode 100644 assets/game_data/agent/anton.yml create mode 100644 assets/game_data/agent/ben.yml create mode 100644 assets/game_data/agent/billy.yml create mode 100644 assets/game_data/agent/corin.yml create mode 100644 assets/game_data/agent/ellen.yml create mode 100644 assets/game_data/agent/grace.yml create mode 100644 assets/game_data/agent/koleda.yml create mode 100644 assets/game_data/agent/lucy.yml create mode 100644 assets/game_data/agent/lycaon.yml create mode 100644 assets/game_data/agent/nekomata.yml create mode 100644 assets/game_data/agent/nicole.yml create mode 100644 assets/game_data/agent/piper.yml create mode 100644 assets/game_data/agent/rina.yml create mode 100644 assets/game_data/agent/soldier_11.yml create mode 100644 assets/game_data/agent/soukaku.yml diff --git a/assets/game_data/agent/anby.yml b/assets/game_data/agent/anby.yml new file mode 100644 index 00000000..21bed80f --- /dev/null +++ b/assets/game_data/agent/anby.yml @@ -0,0 +1,4 @@ +agent_name: "安比" +agent_type: "STUN" +dmg_type: "ELECTRIC" +rare_type: "A" \ No newline at end of file diff --git a/assets/game_data/agent/anton.yml b/assets/game_data/agent/anton.yml new file mode 100644 index 00000000..2cfc433d --- /dev/null +++ b/assets/game_data/agent/anton.yml @@ -0,0 +1,4 @@ +agent_name: "安东" +agent_type: "ATTACK" +dmg_type: "ELECTRIC" +rare_type: "A" \ No newline at end of file diff --git a/assets/game_data/agent/ben.yml b/assets/game_data/agent/ben.yml new file mode 100644 index 00000000..fdcea8d5 --- /dev/null +++ b/assets/game_data/agent/ben.yml @@ -0,0 +1,4 @@ +agent_name: "本" +agent_type: "DEFENSE" +dmg_type: "FIRE" +rare_type: "A" \ No newline at end of file diff --git a/assets/game_data/agent/billy.yml b/assets/game_data/agent/billy.yml new file mode 100644 index 00000000..ea651982 --- /dev/null +++ b/assets/game_data/agent/billy.yml @@ -0,0 +1,4 @@ +agent_name: "比利" +agent_type: "ATTACK" +dmg_type: "ELECTRIC" +rare_type: "A" \ No newline at end of file diff --git a/assets/game_data/agent/corin.yml b/assets/game_data/agent/corin.yml new file mode 100644 index 00000000..217f375a --- /dev/null +++ b/assets/game_data/agent/corin.yml @@ -0,0 +1,4 @@ +agent_name: "可琳" +agent_type: "ATTACK" +dmg_type: "PHYSICAL" +rare_type: "A" \ No newline at end of file diff --git a/assets/game_data/agent/ellen.yml b/assets/game_data/agent/ellen.yml new file mode 100644 index 00000000..b205de46 --- /dev/null +++ b/assets/game_data/agent/ellen.yml @@ -0,0 +1,4 @@ +agent_name: "艾莲" +agent_type: "ATTACK" +dmg_type: "ICE" +rare_type: "S" \ No newline at end of file diff --git a/assets/game_data/agent/grace.yml b/assets/game_data/agent/grace.yml new file mode 100644 index 00000000..158d773d --- /dev/null +++ b/assets/game_data/agent/grace.yml @@ -0,0 +1,4 @@ +agent_name: "格莉丝" +agent_type: "ATTACK" +dmg_type: "ELECTRIC" +rare_type: "S" \ No newline at end of file diff --git a/assets/game_data/agent/koleda.yml b/assets/game_data/agent/koleda.yml new file mode 100644 index 00000000..cbbb82d1 --- /dev/null +++ b/assets/game_data/agent/koleda.yml @@ -0,0 +1,4 @@ +agent_name: "珂蕾妲" +agent_type: "STUN" +dmg_type: "FIRE" +rare_type: "S" \ No newline at end of file diff --git a/assets/game_data/agent/lucy.yml b/assets/game_data/agent/lucy.yml new file mode 100644 index 00000000..a393b928 --- /dev/null +++ b/assets/game_data/agent/lucy.yml @@ -0,0 +1,4 @@ +agent_name: "露西" +agent_type: "SUPPORT" +dmg_type: "FIRE" +rare_type: "A" \ No newline at end of file diff --git a/assets/game_data/agent/lycaon.yml b/assets/game_data/agent/lycaon.yml new file mode 100644 index 00000000..1f4bc322 --- /dev/null +++ b/assets/game_data/agent/lycaon.yml @@ -0,0 +1,4 @@ +agent_name: "莱卡恩" +agent_type: "STUN" +dmg_type: "ICE" +rare_type: "S" \ No newline at end of file diff --git a/assets/game_data/agent/nekomata.yml b/assets/game_data/agent/nekomata.yml new file mode 100644 index 00000000..0990dc8f --- /dev/null +++ b/assets/game_data/agent/nekomata.yml @@ -0,0 +1,4 @@ +agent_name: "猫又" +agent_type: "ATTACK" +dmg_type: "PHYSICAL" +rare_type: "S" \ No newline at end of file diff --git a/assets/game_data/agent/nicole.yml b/assets/game_data/agent/nicole.yml new file mode 100644 index 00000000..e19fbf0d --- /dev/null +++ b/assets/game_data/agent/nicole.yml @@ -0,0 +1,4 @@ +agent_name: "妮可" +agent_type: "SUPPORT" +dmg_type: "ETHER" +rare_type: "A" \ No newline at end of file diff --git a/assets/game_data/agent/piper.yml b/assets/game_data/agent/piper.yml new file mode 100644 index 00000000..a210c8ac --- /dev/null +++ b/assets/game_data/agent/piper.yml @@ -0,0 +1,4 @@ +agent_name: "派派" +agent_type: "ATTACK" +dmg_type: "PHYSICAL" +rare_type: "A" \ No newline at end of file diff --git a/assets/game_data/agent/rina.yml b/assets/game_data/agent/rina.yml new file mode 100644 index 00000000..a8d609a8 --- /dev/null +++ b/assets/game_data/agent/rina.yml @@ -0,0 +1,4 @@ +agent_name: "丽娜" +agent_type: "SUPPORT" +dmg_type: "ELECTRIC" +rare_type: "S" \ No newline at end of file diff --git a/assets/game_data/agent/soldier_11.yml b/assets/game_data/agent/soldier_11.yml new file mode 100644 index 00000000..7c4d8f58 --- /dev/null +++ b/assets/game_data/agent/soldier_11.yml @@ -0,0 +1,4 @@ +agent_name: "11号" +agent_type: "ATTACK" +dmg_type: "FIRE" +rare_type: "S" \ No newline at end of file diff --git a/assets/game_data/agent/soukaku.yml b/assets/game_data/agent/soukaku.yml new file mode 100644 index 00000000..4ea7a1be --- /dev/null +++ b/assets/game_data/agent/soukaku.yml @@ -0,0 +1,4 @@ +agent_name: "苍角" +agent_type: "SUPPORT" +dmg_type: "ICE" +rare_type: "A" \ No newline at end of file diff --git a/src/zzz_od/game_data/agent.py b/src/zzz_od/game_data/agent.py index 6cc98bc8..67505ca4 100644 --- a/src/zzz_od/game_data/agent.py +++ b/src/zzz_od/game_data/agent.py @@ -8,24 +8,49 @@ from one_dragon.utils.i18_utils import gt -class AgentType: +class AgentTypeEnum(Enum): - def __init__(self, cn: str): - """ - 代理人类型 - :param cn: - """ - self.cn: str = cn + ATTACK = '强攻' + STUN = '突破' + SUPPORT = '支援' + DEFENSE = '防护' + ANOMALY = '异常' + UNKNOWN = '未知' + @classmethod + def from_name(cls, name): + if name in AgentTypeEnum.__members__: + return cls[name] + else: + return cls.UNKNOWN -class AgentTypeEnum(Enum): - SUPPORT = AgentType('支援') - UNKNOWN = AgentType('未知') +class DmgTypeEnum(Enum): + + ELECTRIC = '电属性' + ETHER = '以太' + PHYSICAL = '物理' + FIRE = '火属性' + ICE = '冰属性' + UNKNOWN = '未知' @classmethod def from_name(cls, name): - if name in AgentTypeEnum.__members__: + if name in DmgTypeEnum.__members__: + return cls[name] + else: + return cls.UNKNOWN + + +class RareTypeEnum(Enum): + + S = 'S' + A = 'A' + UNKNOWN = '未知' + + @classmethod + def from_name(cls, name): + if name in RareTypeEnum.__members__: return cls[name] else: return cls.UNKNOWN @@ -40,12 +65,14 @@ def __init__(self, agent_id: str): YamlOperator.__init__(self, get_agent_yml_path(agent_id)) self.agent_id: str = agent_id # 代理人的英文名称 self.agent_name: str = self.get('agent_name', '') # 代理人的中文名称 - agent_type_str = self.get('agent_type', '') - self.agent_type: AgentTypeEnum = AgentTypeEnum.UNKNOWN if agent_type_str not in AgentTypeEnum else AgentTypeEnum[agent_type_str] + + self.agent_type: AgentTypeEnum = AgentTypeEnum.from_name(self.get('agent_type', '')) # + self.dmg_type: DmgTypeEnum = DmgTypeEnum.from_name(self.get('dmg_type', '')) # 伤害类型 + self.rare_type: RareTypeEnum = RareTypeEnum.from_name(self.get('rare_type', '')) @property def agent_type_str(self) -> str: - return gt(self.agent_type.value.cn) + return gt(self.agent_type.value) class AgentLoader: