Skip to content

Commit

Permalink
🐛 Fix StarRail Detail Characters skills map
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Feb 7, 2024
1 parent 98a569c commit 7e92bb1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions simnet/models/starrail/chronicle/characters.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,9 @@ class StarRailDetailCharacter(character.StarRailPartialCharacter):
def skills_map(self) -> List[List[Skill]]:
"""Map skills."""
data = []
skills = self.skills.copy()
for skill in skills.copy():
if skill.pre_point == 0:
data.append([skill])
skills.remove(skill)
for skill in filter(lambda x: x.point_type == 3, self.skills):
data.append([skill])
skills = list(filter(lambda x: x.point_type == 1 and x.pre_point, self.skills))
while True:
for skill in skills.copy():
for item in data:
Expand All @@ -143,18 +141,17 @@ def skills_map(self) -> List[List[Skill]]:
break
new_data = []
for item in data:
if len(item) < 2:
continue
new_data.append(sorted(item, key=lambda x: x.point_id))
return new_data

@property
def skills_single(self) -> List[Skill]:
"""Single skills."""
skills = list(filter(lambda x: x.point_type == 1, self.skills))
map_ids = []
for item in self.skills_map:
map_ids.extend([i.point_id for i in item])
return [i for i in self.skills if i.point_id not in map_ids][5:]
return [i for i in skills if i.point_id not in map_ids]

@property
def skills_main(self) -> List[Skill]:
Expand Down

0 comments on commit 7e92bb1

Please sign in to comment.