Skip to content

Commit

Permalink
#23 增加角色配置
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorReid committed Jul 23, 2024
1 parent d3aa641 commit 65c8b94
Show file tree
Hide file tree
Showing 17 changed files with 105 additions and 14 deletions.
4 changes: 4 additions & 0 deletions assets/game_data/agent/anby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "安比"
agent_type: "STUN"
dmg_type: "ELECTRIC"
rare_type: "A"
4 changes: 4 additions & 0 deletions assets/game_data/agent/anton.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "安东"
agent_type: "ATTACK"
dmg_type: "ELECTRIC"
rare_type: "A"
4 changes: 4 additions & 0 deletions assets/game_data/agent/ben.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: ""
agent_type: "DEFENSE"
dmg_type: "FIRE"
rare_type: "A"
4 changes: 4 additions & 0 deletions assets/game_data/agent/billy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "比利"
agent_type: "ATTACK"
dmg_type: "ELECTRIC"
rare_type: "A"
4 changes: 4 additions & 0 deletions assets/game_data/agent/corin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "可琳"
agent_type: "ATTACK"
dmg_type: "PHYSICAL"
rare_type: "A"
4 changes: 4 additions & 0 deletions assets/game_data/agent/ellen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "艾莲"
agent_type: "ATTACK"
dmg_type: "ICE"
rare_type: "S"
4 changes: 4 additions & 0 deletions assets/game_data/agent/grace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "格莉丝"
agent_type: "ATTACK"
dmg_type: "ELECTRIC"
rare_type: "S"
4 changes: 4 additions & 0 deletions assets/game_data/agent/koleda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "珂蕾妲"
agent_type: "STUN"
dmg_type: "FIRE"
rare_type: "S"
4 changes: 4 additions & 0 deletions assets/game_data/agent/lucy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "露西"
agent_type: "SUPPORT"
dmg_type: "FIRE"
rare_type: "A"
4 changes: 4 additions & 0 deletions assets/game_data/agent/lycaon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "莱卡恩"
agent_type: "STUN"
dmg_type: "ICE"
rare_type: "S"
4 changes: 4 additions & 0 deletions assets/game_data/agent/nekomata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "猫又"
agent_type: "ATTACK"
dmg_type: "PHYSICAL"
rare_type: "S"
4 changes: 4 additions & 0 deletions assets/game_data/agent/nicole.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "妮可"
agent_type: "SUPPORT"
dmg_type: "ETHER"
rare_type: "A"
4 changes: 4 additions & 0 deletions assets/game_data/agent/piper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "派派"
agent_type: "ATTACK"
dmg_type: "PHYSICAL"
rare_type: "A"
4 changes: 4 additions & 0 deletions assets/game_data/agent/rina.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "丽娜"
agent_type: "SUPPORT"
dmg_type: "ELECTRIC"
rare_type: "S"
4 changes: 4 additions & 0 deletions assets/game_data/agent/soldier_11.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "11号"
agent_type: "ATTACK"
dmg_type: "FIRE"
rare_type: "S"
4 changes: 4 additions & 0 deletions assets/game_data/agent/soukaku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
agent_name: "苍角"
agent_type: "SUPPORT"
dmg_type: "ICE"
rare_type: "A"
55 changes: 41 additions & 14 deletions src/zzz_od/game_data/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 65c8b94

Please sign in to comment.