mirror of
https://github.com/PaiGramTeam/StarRailDamageCal.git
synced 2024-11-27 01:55:51 +00:00
update
This commit is contained in:
parent
211cb186ec
commit
32a77d6230
@ -77,6 +77,8 @@ class AvatarInstance:
|
|||||||
self.merge_attribute_bonus(set_skill.relicSetAttribute)
|
self.merge_attribute_bonus(set_skill.relicSetAttribute)
|
||||||
|
|
||||||
def cal_avatar_eidolon_add(self):
|
def cal_avatar_eidolon_add(self):
|
||||||
|
if self.avatardamage is None:
|
||||||
|
return
|
||||||
self.merge_attribute_bonus(self.avatardamage.eidolon_attribute)
|
self.merge_attribute_bonus(self.avatardamage.eidolon_attribute)
|
||||||
self.merge_attribute_bonus(self.avatardamage.extra_ability_attribute)
|
self.merge_attribute_bonus(self.avatardamage.extra_ability_attribute)
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@ from abc import abstractmethod
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from ...logger import logger
|
from ...logger import logger
|
||||||
from ...map.model.RelicSetSkill import RelicSetStatusAdd
|
from ...map.SR_MAP_PATH import RelicSetSkill, RelicSetStatusAdd
|
||||||
from ...map.SR_MAP_PATH import RelicSetSkill
|
|
||||||
from ...model import Relic
|
from ...model import Relic
|
||||||
|
|
||||||
|
|
||||||
@ -80,12 +79,12 @@ class BaseRelicSetSkill:
|
|||||||
|
|
||||||
relic_set_attribute: Dict[str, float] = {}
|
relic_set_attribute: Dict[str, float] = {}
|
||||||
if self.pieces2:
|
if self.pieces2:
|
||||||
status_add = RelicSetSkill.RelicSet[str(self.setId)]["2"]
|
status_add = RelicSetSkill[str(self.setId)].get("2", None)
|
||||||
if status_add:
|
if status_add:
|
||||||
add_relic_set_attribute(status_add)
|
add_relic_set_attribute(status_add)
|
||||||
|
|
||||||
if self.pieces4:
|
if self.pieces4:
|
||||||
status_add = RelicSetSkill.RelicSet[str(self.setId)]["4"]
|
status_add = RelicSetSkill[str(self.setId)].get("4", None)
|
||||||
if status_add:
|
if status_add:
|
||||||
add_relic_set_attribute(status_add)
|
add_relic_set_attribute(status_add)
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ class BaseWeapon:
|
|||||||
ability_property = EquipmentID2AbilityProperty[str(self.weapon_id)]
|
ability_property = EquipmentID2AbilityProperty[str(self.weapon_id)]
|
||||||
equip_ability_property = ability_property[str(self.weapon_rank)]
|
equip_ability_property = ability_property[str(self.weapon_rank)]
|
||||||
for equip_ability in equip_ability_property:
|
for equip_ability in equip_ability_property:
|
||||||
property_type = equip_ability["PropertyType"]
|
property_type = equip_ability.PropertyType
|
||||||
value = equip_ability["Value"]["Value"]
|
value = equip_ability.Value.Value
|
||||||
if property_type in self.weapon_attribute:
|
if property_type in self.weapon_attribute:
|
||||||
self.weapon_attribute[property_type] += value
|
self.weapon_attribute[property_type] += value
|
||||||
else:
|
else:
|
||||||
|
@ -255,6 +255,7 @@ def apply_attribute_bonus(
|
|||||||
|
|
||||||
|
|
||||||
def calculate_damage_reduction(level: int):
|
def calculate_damage_reduction(level: int):
|
||||||
|
_ = level
|
||||||
enemy_damage_reduction = 0.1
|
enemy_damage_reduction = 0.1
|
||||||
return 1 - enemy_damage_reduction
|
return 1 - enemy_damage_reduction
|
||||||
|
|
||||||
@ -265,6 +266,7 @@ def calculate_resistance_area(
|
|||||||
add_skill_type: str,
|
add_skill_type: str,
|
||||||
element: str,
|
element: str,
|
||||||
):
|
):
|
||||||
|
_ = skill_type
|
||||||
enemy_status_resistance = 0.0
|
enemy_status_resistance = 0.0
|
||||||
for attr in merged_attr:
|
for attr in merged_attr:
|
||||||
if "ResistancePenetration" in attr:
|
if "ResistancePenetration" in attr:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,10 @@
|
|||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
|
|
||||||
from msgspec import Struct, convert
|
from msgspec import Struct, convert
|
||||||
|
|
||||||
from ..excel.read_excel import (
|
EXCEL = Path(__file__).parent
|
||||||
AvatarPromotion,
|
|
||||||
EquipmentPromotion,
|
|
||||||
RelicMainAffix,
|
|
||||||
RelicSubAffix,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class PromotionCost(Struct):
|
class PromotionCost(Struct):
|
||||||
@ -70,8 +67,14 @@ class SingleRelicSubAffix(Struct):
|
|||||||
StepValue: PromotionAttr
|
StepValue: PromotionAttr
|
||||||
StepNum: int
|
StepNum: int
|
||||||
|
|
||||||
|
with Path.open(EXCEL / "RelicMainAffixConfig.json", encoding="utf8") as f:
|
||||||
|
RelicMainAffixConfig = convert(json.load(f), List[SingleRelicMainAffix])
|
||||||
|
|
||||||
AvatarPromotionConfig = convert(AvatarPromotion, List[SingleAvatarPromotion])
|
with Path.open(EXCEL / "RelicSubAffixConfig.json", encoding="utf8") as f:
|
||||||
EquipmentPromotionConfig = convert(EquipmentPromotion, List[SingleEquipmentPromotion])
|
RelicSubAffixConfig = convert(json.load(f), List[SingleRelicSubAffix])
|
||||||
RelicMainAffixConfig = convert(RelicMainAffix, List[SingleRelicMainAffix])
|
|
||||||
RelicSubAffixConfig = convert(RelicSubAffix, List[SingleRelicSubAffix])
|
with Path.open(EXCEL / "AvatarPromotionConfig.json", encoding="utf8") as f:
|
||||||
|
AvatarPromotionConfig = convert(json.load(f), List[SingleAvatarPromotion])
|
||||||
|
|
||||||
|
with Path.open(EXCEL / "EquipmentPromotionConfig.json", encoding="utf8") as f:
|
||||||
|
EquipmentPromotionConfig = convert(json.load(f), List[SingleEquipmentPromotion])
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
EXCEL = Path(__file__).parent
|
|
||||||
|
|
||||||
with Path.open(EXCEL / "RelicMainAffixConfig.json", encoding="utf8") as f:
|
|
||||||
RelicMainAffix = json.load(f)
|
|
||||||
|
|
||||||
with Path.open(EXCEL / "RelicSubAffixConfig.json", encoding="utf8") as f:
|
|
||||||
RelicSubAffix = json.load(f)
|
|
||||||
|
|
||||||
with Path.open(EXCEL / "AvatarPromotionConfig.json", encoding="utf8") as f:
|
|
||||||
AvatarPromotion = json.load(f)
|
|
||||||
|
|
||||||
with Path.open(EXCEL / "EquipmentPromotionConfig.json", encoding="utf8") as f:
|
|
||||||
EquipmentPromotion = json.load(f)
|
|
||||||
|
|
||||||
with Path.open(EXCEL / "light_cone_ranks.json", encoding="utf8") as f:
|
|
||||||
light_cone_ranks = json.load(f)
|
|
@ -1,10 +1,9 @@
|
|||||||
import json
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, TypedDict, Union
|
from typing import Dict, List, TypedDict, Union
|
||||||
|
|
||||||
|
from msgspec import Struct
|
||||||
from msgspec import json as msgjson
|
from msgspec import json as msgjson
|
||||||
|
|
||||||
from ..map.model.RelicSetSkill import RelicSetSkillModel
|
|
||||||
from ..version import StarRail_version
|
from ..version import StarRail_version
|
||||||
|
|
||||||
MAP = Path(__file__).parent / "data"
|
MAP = Path(__file__).parent / "data"
|
||||||
@ -39,11 +38,50 @@ class TS(TypedDict):
|
|||||||
Icon: Dict[str, str]
|
Icon: Dict[str, str]
|
||||||
|
|
||||||
|
|
||||||
class LU(TypedDict):
|
class LU(Struct):
|
||||||
id: str
|
id: str
|
||||||
num: int
|
num: int
|
||||||
|
|
||||||
|
|
||||||
|
class TV(Struct):
|
||||||
|
type: str
|
||||||
|
value: float
|
||||||
|
|
||||||
|
|
||||||
|
class AbilityPropertyValue(Struct):
|
||||||
|
Value: float
|
||||||
|
|
||||||
|
|
||||||
|
class AbilityProperty(Struct):
|
||||||
|
PropertyType: str
|
||||||
|
Value: AbilityPropertyValue
|
||||||
|
|
||||||
|
|
||||||
|
class SkillTreeLevel(Struct):
|
||||||
|
promotion: int
|
||||||
|
level: int
|
||||||
|
properties: List[TV]
|
||||||
|
materials: List[LU]
|
||||||
|
|
||||||
|
|
||||||
|
class CharacterSkillTreeModel(Struct):
|
||||||
|
id: str
|
||||||
|
name: str
|
||||||
|
max_level: int
|
||||||
|
desc: str
|
||||||
|
params: List[List[float]]
|
||||||
|
anchor: str
|
||||||
|
pre_points: List[str]
|
||||||
|
level_up_skills: List[LU]
|
||||||
|
levels: List[SkillTreeLevel]
|
||||||
|
icon: str
|
||||||
|
|
||||||
|
|
||||||
|
class RelicSetStatusAdd(Struct):
|
||||||
|
Property: str
|
||||||
|
Value: float
|
||||||
|
|
||||||
|
|
||||||
with Path.open(MAP / avatarId2Name_fileName, encoding="UTF-8") as f:
|
with Path.open(MAP / avatarId2Name_fileName, encoding="UTF-8") as f:
|
||||||
avatarId2Name = msgjson.decode(f.read(), type=Dict[str, str])
|
avatarId2Name = msgjson.decode(f.read(), type=Dict[str, str])
|
||||||
|
|
||||||
@ -72,13 +110,15 @@ with Path.open(MAP / rankId2Name_fileName, encoding="UTF-8") as f:
|
|||||||
rankId2Name = msgjson.decode(f.read(), type=Dict[str, str])
|
rankId2Name = msgjson.decode(f.read(), type=Dict[str, str])
|
||||||
|
|
||||||
with Path.open(MAP / characterSkillTree_fileName, encoding="UTF-8") as f:
|
with Path.open(MAP / characterSkillTree_fileName, encoding="UTF-8") as f:
|
||||||
characterSkillTree = msgjson.decode(f.read(), type=Dict[str, Dict])
|
characterSkillTree = msgjson.decode(
|
||||||
|
f.read(), type=Dict[str, Dict[str, CharacterSkillTreeModel]]
|
||||||
|
)
|
||||||
|
|
||||||
with Path.open(MAP / avatarId2DamageType_fileName, encoding="UTF-8") as f:
|
with Path.open(MAP / avatarId2DamageType_fileName, encoding="UTF-8") as f:
|
||||||
avatarId2DamageType = msgjson.decode(f.read(), type=Dict[str, str])
|
avatarId2DamageType = msgjson.decode(f.read(), type=Dict[str, str])
|
||||||
|
|
||||||
with Path.open(MAP / "char_alias.json", encoding="UTF-8") as f:
|
with Path.open(MAP / "char_alias.json", encoding="UTF-8") as f:
|
||||||
alias_data = msgjson.decode(f.read(), type=Dict[str, Dict[str, List]])
|
alias_data = msgjson.decode(f.read(), type=Dict[str, Dict[str, List[str]]])
|
||||||
|
|
||||||
with Path.open(MAP / avatarId2Rarity_fileName, encoding="UTF-8") as f:
|
with Path.open(MAP / avatarId2Rarity_fileName, encoding="UTF-8") as f:
|
||||||
avatarId2Rarity = msgjson.decode(f.read(), type=Dict[str, str])
|
avatarId2Rarity = msgjson.decode(f.read(), type=Dict[str, str])
|
||||||
@ -86,11 +126,13 @@ with Path.open(MAP / avatarId2Rarity_fileName, encoding="UTF-8") as f:
|
|||||||
with Path.open(MAP / EquipmentID2AbilityProperty_fileName, encoding="UTF-8") as f:
|
with Path.open(MAP / EquipmentID2AbilityProperty_fileName, encoding="UTF-8") as f:
|
||||||
EquipmentID2AbilityProperty = msgjson.decode(
|
EquipmentID2AbilityProperty = msgjson.decode(
|
||||||
f.read(),
|
f.read(),
|
||||||
type=Dict[str, Dict[str, List]],
|
type=Dict[str, Dict[str, List[AbilityProperty]]],
|
||||||
)
|
)
|
||||||
|
|
||||||
with Path.open(MAP / RelicSetSkill_fileName, encoding="UTF-8") as f:
|
with Path.open(MAP / RelicSetSkill_fileName, encoding="UTF-8") as f:
|
||||||
RelicSetSkill = RelicSetSkillModel.from_json(json.load(f))
|
RelicSetSkill = msgjson.decode(
|
||||||
|
f.read(), type=Dict[str, Dict[str, RelicSetStatusAdd]]
|
||||||
|
)
|
||||||
|
|
||||||
with Path.open(MAP / skillId2AttackType_fileName, encoding="UTF-8") as f:
|
with Path.open(MAP / skillId2AttackType_fileName, encoding="UTF-8") as f:
|
||||||
skillId2AttackType = msgjson.decode(f.read(), type=Dict[str, str])
|
skillId2AttackType = msgjson.decode(f.read(), type=Dict[str, str])
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
"2": {
|
"2": {
|
||||||
"Property": "HealRatioBase",
|
"Property": "HealRatioBase",
|
||||||
"Value": 0.1
|
"Value": 0.1
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"102": {
|
"102": {
|
||||||
"2": {
|
"2": {
|
||||||
@ -20,54 +19,44 @@
|
|||||||
"2": {
|
"2": {
|
||||||
"Property": "DefenceAddedRatio",
|
"Property": "DefenceAddedRatio",
|
||||||
"Value": 0.15
|
"Value": 0.15
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"104": {
|
"104": {
|
||||||
"2": {
|
"2": {
|
||||||
"Property": "IceAddedRatio",
|
"Property": "IceAddedRatio",
|
||||||
"Value": 0.1
|
"Value": 0.1
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"105": {
|
"105": {
|
||||||
"2": {
|
"2": {
|
||||||
"Property": "PhysicalAddedRatio",
|
"Property": "PhysicalAddedRatio",
|
||||||
"Value": 0.1
|
"Value": 0.1
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"4": {}
|
"106": {},
|
||||||
},
|
|
||||||
"106": {
|
|
||||||
"2": {},
|
|
||||||
"4": {}
|
|
||||||
},
|
|
||||||
"107": {
|
"107": {
|
||||||
"2": {
|
"2": {
|
||||||
"Property": "FireAddedRatio",
|
"Property": "FireAddedRatio",
|
||||||
"Value": 0.1
|
"Value": 0.1
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"108": {
|
"108": {
|
||||||
"2": {
|
"2": {
|
||||||
"Property": "QuantumAddedRatio",
|
"Property": "QuantumAddedRatio",
|
||||||
"Value": 0.1
|
"Value": 0.1
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"109": {
|
"109": {
|
||||||
"2": {
|
"2": {
|
||||||
"Property": "ThunderAddedRatio",
|
"Property": "ThunderAddedRatio",
|
||||||
"Value": 0.1
|
"Value": 0.1
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"110": {
|
"110": {
|
||||||
"2": {
|
"2": {
|
||||||
"Property": "WindAddedRatio",
|
"Property": "WindAddedRatio",
|
||||||
"Value": 0.1
|
"Value": 0.1
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"111": {
|
"111": {
|
||||||
"2": {
|
"2": {
|
||||||
@ -83,8 +72,7 @@
|
|||||||
"2": {
|
"2": {
|
||||||
"Property": "ImaginaryAddedRatio",
|
"Property": "ImaginaryAddedRatio",
|
||||||
"Value": 0.1
|
"Value": 0.1
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"301": {
|
"301": {
|
||||||
"2": {
|
"2": {
|
||||||
@ -150,26 +138,20 @@
|
|||||||
"2": {
|
"2": {
|
||||||
"Property": "HPAddedRatio",
|
"Property": "HPAddedRatio",
|
||||||
"Value": 0.12
|
"Value": 0.12
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"114": {
|
"114": {
|
||||||
"2": {
|
"2": {
|
||||||
"Property": "SpeedAddedRatio",
|
"Property": "SpeedAddedRatio",
|
||||||
"Value": 0.06
|
"Value": 0.06
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"4": {}
|
"115": {},
|
||||||
},
|
|
||||||
"115": {
|
|
||||||
"2": {},
|
|
||||||
"4": {}
|
|
||||||
},
|
|
||||||
"116": {
|
"116": {
|
||||||
"2": {
|
"2": {
|
||||||
"Property": "AttackAddedRatio",
|
"Property": "AttackAddedRatio",
|
||||||
"Value": 0.12
|
"Value": 0.12
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"311": {
|
"311": {
|
||||||
"2": {
|
"2": {
|
||||||
@ -184,7 +166,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"117": {
|
"117": {
|
||||||
"2": {},
|
|
||||||
"4": {
|
"4": {
|
||||||
"Property": "CriticalChanceBase",
|
"Property": "CriticalChanceBase",
|
||||||
"Value": 0.04
|
"Value": 0.04
|
||||||
@ -194,8 +175,7 @@
|
|||||||
"2": {
|
"2": {
|
||||||
"Property": "BreakDamageAddedRatioBase",
|
"Property": "BreakDamageAddedRatioBase",
|
||||||
"Value": 0.16
|
"Value": 0.16
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"313": {
|
"313": {
|
||||||
"2": {
|
"2": {
|
||||||
@ -213,8 +193,7 @@
|
|||||||
"2": {
|
"2": {
|
||||||
"Property": "BreakDamageAddedRatioBase",
|
"Property": "BreakDamageAddedRatioBase",
|
||||||
"Value": 0.16
|
"Value": 0.16
|
||||||
},
|
}
|
||||||
"4": {}
|
|
||||||
},
|
},
|
||||||
"120": {
|
"120": {
|
||||||
"2": {
|
"2": {
|
||||||
@ -226,9 +205,7 @@
|
|||||||
"Value": 0.06
|
"Value": 0.06
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"315": {
|
"315": {},
|
||||||
"2": {}
|
|
||||||
},
|
|
||||||
"316": {
|
"316": {
|
||||||
"2": {
|
"2": {
|
||||||
"Property": "SpeedAddedRatio",
|
"Property": "SpeedAddedRatio",
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
from typing import Dict, Union
|
|
||||||
|
|
||||||
from msgspec import Struct
|
|
||||||
|
|
||||||
|
|
||||||
class RelicSetStatusAdd(Struct):
|
|
||||||
Property: str
|
|
||||||
Value: float
|
|
||||||
|
|
||||||
|
|
||||||
class RelicSetSkillModel(Struct):
|
|
||||||
RelicSet: Dict[str, Dict[str, Union[RelicSetStatusAdd, None]]]
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_json(cls, data: Dict):
|
|
||||||
return cls(
|
|
||||||
RelicSet={
|
|
||||||
str(k): {
|
|
||||||
str(k2): RelicSetStatusAdd(
|
|
||||||
Property=v2["Property"],
|
|
||||||
Value=v2["Value"],
|
|
||||||
)
|
|
||||||
if v2
|
|
||||||
else None
|
|
||||||
for k2, v2 in v.items()
|
|
||||||
}
|
|
||||||
for k, v in data.items()
|
|
||||||
},
|
|
||||||
)
|
|
@ -1,4 +1,4 @@
|
|||||||
from starrail_damage_cal.map.SR_MAP_PATH import (
|
from ..map.SR_MAP_PATH import (
|
||||||
alias_data,
|
alias_data,
|
||||||
avatarId2Name,
|
avatarId2Name,
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Mihomo.me api 包装"""
|
"""Mihomo.me api 包装"""
|
||||||
|
|
||||||
from starrail_damage_cal.mihomo.models import MihomoData
|
from ..mihomo.models import MihomoData
|
||||||
from starrail_damage_cal.mihomo.requests import get_char_card_info as requests
|
from ..mihomo.requests import get_char_card_info as requests
|
||||||
|
|
||||||
__all__ = ["requests", "MihomoData"]
|
__all__ = ["requests", "MihomoData"]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import List, Union
|
from typing import List
|
||||||
|
|
||||||
from msgspec import Struct, field
|
from msgspec import Struct, field
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from collections import Counter
|
from collections import Counter
|
||||||
from typing import List
|
from typing import Dict, List
|
||||||
|
|
||||||
from ..map.SR_MAP_PATH import (
|
from ..map.SR_MAP_PATH import (
|
||||||
EquipmentID2AbilityProperty,
|
EquipmentID2AbilityProperty,
|
||||||
@ -22,10 +22,10 @@ class Character:
|
|||||||
self.attribute_bonus = card_prop.avatarAttributeBonus
|
self.attribute_bonus = card_prop.avatarAttributeBonus
|
||||||
self.char_relic = card_prop.RelicInfo
|
self.char_relic = card_prop.RelicInfo
|
||||||
self.base_attributes = card_prop.baseAttributes
|
self.base_attributes = card_prop.baseAttributes
|
||||||
self.add_attr = {}
|
|
||||||
self.equipment = card_prop.equipmentInfo
|
self.equipment = card_prop.equipmentInfo
|
||||||
self.rarity = card_prop.avatarRarity
|
self.rarity = card_prop.avatarRarity
|
||||||
self.eidolons = card_prop.rankList
|
self.eidolons = card_prop.rankList
|
||||||
|
self.add_attr: Dict[str, float] = {}
|
||||||
|
|
||||||
async def get_equipment_info(self):
|
async def get_equipment_info(self):
|
||||||
base_attr = self.base_attributes
|
base_attr = self.base_attributes
|
||||||
@ -36,16 +36,15 @@ class Character:
|
|||||||
equip_ability_property = ability_property[str(equip_rank)]
|
equip_ability_property = ability_property[str(equip_rank)]
|
||||||
|
|
||||||
equip_add_base_attr = equip.baseAttributes
|
equip_add_base_attr = equip.baseAttributes
|
||||||
base_attr.hp = base_attr.hp + equip_add_base_attr.hp
|
base_attr.hp += equip_add_base_attr.hp
|
||||||
base_attr.attack = base_attr.attack + equip_add_base_attr.attack
|
base_attr.attack += +equip_add_base_attr.attack
|
||||||
base_attr.defence = base_attr.defence + equip_add_base_attr.defence
|
base_attr.defence += equip_add_base_attr.defence
|
||||||
self.base_attributes = base_attr
|
self.base_attributes = base_attr
|
||||||
|
|
||||||
for equip_ability in equip_ability_property:
|
for equip_ability in equip_ability_property:
|
||||||
property_type: str = equip_ability["PropertyType"]
|
property_type = equip_ability.PropertyType
|
||||||
value: float = equip_ability["Value"]["Value"]
|
value = equip_ability.Value.Value
|
||||||
self.add_attr[property_type] = value + self.add_attr.get(property_type, 0)
|
self.add_attr[property_type] = value + self.add_attr.get(property_type, 0)
|
||||||
return self.add_attr
|
|
||||||
|
|
||||||
async def get_char_attribute_bonus(self):
|
async def get_char_attribute_bonus(self):
|
||||||
attribute_bonus = self.attribute_bonus
|
attribute_bonus = self.attribute_bonus
|
||||||
@ -84,7 +83,7 @@ class Character:
|
|||||||
count = item[1]
|
count = item[1]
|
||||||
set_value = 0
|
set_value = 0
|
||||||
if count >= 2:
|
if count >= 2:
|
||||||
status_add = RelicSetSkill.RelicSet[str(set_id)]["2"]
|
status_add = RelicSetSkill[str(set_id)].get("2", None)
|
||||||
if status_add:
|
if status_add:
|
||||||
set_property = status_add.Property
|
set_property = status_add.Property
|
||||||
set_value = status_add.Value
|
set_value = status_add.Value
|
||||||
@ -94,7 +93,7 @@ class Character:
|
|||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
if count == 4:
|
if count == 4:
|
||||||
status_add = RelicSetSkill.RelicSet[str(set_id)]["4"]
|
status_add = RelicSetSkill[str(set_id)].get("4", None)
|
||||||
if status_add:
|
if status_add:
|
||||||
set_property = status_add.Property
|
set_property = status_add.Property
|
||||||
set_value = status_add.Value
|
set_value = status_add.Value
|
||||||
|
@ -175,16 +175,16 @@ async def get_data(
|
|||||||
value=0,
|
value=0,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
status_add = characterSkillTree[str(char.avatarId)][str(behavior.pointId)][
|
status_add = (
|
||||||
"levels"
|
characterSkillTree[str(char.avatarId)][str(behavior.pointId)]
|
||||||
][behavior.level - 1]["properties"]
|
.levels[behavior.level - 1]
|
||||||
if status_add:
|
.properties
|
||||||
|
)
|
||||||
|
# if status_add:
|
||||||
for property_ in status_add:
|
for property_ in status_add:
|
||||||
attribute_bonus_temp.statusAdd.property_ = property_["type"]
|
attribute_bonus_temp.statusAdd.property_ = property_.type
|
||||||
attribute_bonus_temp.statusAdd.name = Property2Name[
|
attribute_bonus_temp.statusAdd.name = Property2Name[property_.type]
|
||||||
property_["type"]
|
attribute_bonus_temp.statusAdd.value = property_.value
|
||||||
]
|
|
||||||
attribute_bonus_temp.statusAdd.value = property_["value"]
|
|
||||||
char_data.avatarAttributeBonus.append(attribute_bonus_temp)
|
char_data.avatarAttributeBonus.append(attribute_bonus_temp)
|
||||||
|
|
||||||
# 处理遗器
|
# 处理遗器
|
||||||
@ -265,8 +265,8 @@ async def get_data(
|
|||||||
level_up_skill = AvatarRankSkillUp[str(rank_id)]
|
level_up_skill = AvatarRankSkillUp[str(rank_id)]
|
||||||
if level_up_skill:
|
if level_up_skill:
|
||||||
for item in level_up_skill:
|
for item in level_up_skill:
|
||||||
skill_id = item["id"]
|
skill_id = item.id
|
||||||
skill_up_num = item["num"]
|
skill_up_num = item.num
|
||||||
# 查找skill_id在不在avatarSkill中
|
# 查找skill_id在不在avatarSkill中
|
||||||
for index, skill_item in enumerate(char_data.avatarSkill):
|
for index, skill_item in enumerate(char_data.avatarSkill):
|
||||||
if str(skill_id) == str(skill_item.skillId):
|
if str(skill_id) == str(skill_item.skillId):
|
||||||
|
1
test.py
1
test.py
@ -8,6 +8,7 @@ async def test_get_damage_data_by_uid() -> None:
|
|||||||
print(char_data)
|
print(char_data)
|
||||||
|
|
||||||
char = await cal_char_info(char_data)
|
char = await cal_char_info(char_data)
|
||||||
|
print(char.add_attr)
|
||||||
avatar = AvatarInstance(char)
|
avatar = AvatarInstance(char)
|
||||||
print(avatar.base_attr)
|
print(avatar.base_attr)
|
||||||
print(avatar.attribute_bonus)
|
print(avatar.attribute_bonus)
|
||||||
|
Loading…
Reference in New Issue
Block a user