feat: Add count and step of sub affixes

Other changes:
Relic attritube
- main_property -> main_affix
- sub_properties -> sub_affixes
This commit is contained in:
KT 2023-06-11 23:04:02 +08:00
parent 4d74afe8d7
commit 2d1b9b23af
3 changed files with 47 additions and 8 deletions

View File

@ -1,7 +1,7 @@
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from .combat import Path from .combat import Path
from .stat import Attribute, Property from .stat import Attribute, MainAffix, Property, SubAffix
class LightCone(BaseModel): class LightCone(BaseModel):
@ -66,8 +66,8 @@ class Relic(BaseModel):
- set_name (`str`): The name of the relic set. - set_name (`str`): The name of the relic set.
- rarity (`int`): The rarity of the relic. - rarity (`int`): The rarity of the relic.
- level (`int`): The level of the relic. - level (`int`): The level of the relic.
- main_property (`RelicProperty`): The main property of the relic. - main_property (`MainAffix`): The main affix of the relic.
- sub_property (list[`RelicProperty`]): The list of sub properties of the relic. - sub_property (list[`SubAffix`]): The list of sub-affixes of the relic.
- icon (`str`): The relic icon. - icon (`str`): The relic icon.
""" """
@ -83,10 +83,10 @@ class Relic(BaseModel):
"""The rarity of the relic""" """The rarity of the relic"""
level: int level: int
"""The level of the relic""" """The level of the relic"""
main_property: Property = Field(..., alias="main_affix") main_affix: MainAffix
"""The main property of the relic""" """The main affix of the relic"""
sub_properties: list[Property] = Field(..., alias="sub_affix") sub_affixes: list[SubAffix] = Field([], alias="sub_affix")
"""The list of sub properties of the relic""" """The list of sub-affixes of the relic"""
icon: str icon: str
"""The relic icon""" """The relic icon"""

View File

@ -56,3 +56,42 @@ class Property(BaseModel):
"""The displayed value of the property""" """The displayed value of the property"""
is_percent: bool = Field(..., alias="percent") is_percent: bool = Field(..., alias="percent")
"""Indicates if the value is in percentage""" """Indicates if the value is in percentage"""
class MainAffix(Property):
"""
Represents a relic main affix.
Attributes:
- type (`str`): The type of the affix.
- field (`str`): The field of the affix.
- name (`str`): The name of the affix.
- icon (`str`): The affix icon image.
- value (`float`): The value of the affix.
- displayed_value (`str`): The displayed value of the affix.
- is_percent (`bool`): Indicates if the value is in percentage.
"""
...
class SubAffix(MainAffix):
"""
Represents a relic sub-affix.
Attributes:
- type (`str`): The type of the affix.
- field (`str`): The field of the affix.
- name (`str`): The name of the affix.
- icon (`str`): The affix icon image.
- value (`float`): The value of the affix.
- displayed_value (`str`): The displayed value of the affix.
- is_percent (`bool`): Indicates if the value is in percentage.
- count (`int`): The upgrade times of the affix.
- step (`int`): The additional value of the affix.
"""
count: int
"""The upgrade times of the affix"""
step: int
"""The additional value of the affix"""

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "mihomo" name = "mihomo"
version = "1.1.2" version = "1.1.3"
authors = [ authors = [
{ name="KT", email="xns77477@gmail.com" }, { name="KT", email="xns77477@gmail.com" },
] ]