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)
|
||||
|
||||
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.extra_ability_attribute)
|
||||
|
||||
|
@ -2,8 +2,7 @@ from abc import abstractmethod
|
||||
from typing import Dict
|
||||
|
||||
from ...logger import logger
|
||||
from ...map.model.RelicSetSkill import RelicSetStatusAdd
|
||||
from ...map.SR_MAP_PATH import RelicSetSkill
|
||||
from ...map.SR_MAP_PATH import RelicSetSkill, RelicSetStatusAdd
|
||||
from ...model import Relic
|
||||
|
||||
|
||||
@ -80,12 +79,12 @@ class BaseRelicSetSkill:
|
||||
|
||||
relic_set_attribute: Dict[str, float] = {}
|
||||
if self.pieces2:
|
||||
status_add = RelicSetSkill.RelicSet[str(self.setId)]["2"]
|
||||
status_add = RelicSetSkill[str(self.setId)].get("2", None)
|
||||
if status_add:
|
||||
add_relic_set_attribute(status_add)
|
||||
|
||||
if self.pieces4:
|
||||
status_add = RelicSetSkill.RelicSet[str(self.setId)]["4"]
|
||||
status_add = RelicSetSkill[str(self.setId)].get("4", None)
|
||||
if status_add:
|
||||
add_relic_set_attribute(status_add)
|
||||
|
||||
|
@ -43,8 +43,8 @@ class BaseWeapon:
|
||||
ability_property = EquipmentID2AbilityProperty[str(self.weapon_id)]
|
||||
equip_ability_property = ability_property[str(self.weapon_rank)]
|
||||
for equip_ability in equip_ability_property:
|
||||
property_type = equip_ability["PropertyType"]
|
||||
value = equip_ability["Value"]["Value"]
|
||||
property_type = equip_ability.PropertyType
|
||||
value = equip_ability.Value.Value
|
||||
if property_type in self.weapon_attribute:
|
||||
self.weapon_attribute[property_type] += value
|
||||
else:
|
||||
|
@ -255,6 +255,7 @@ def apply_attribute_bonus(
|
||||
|
||||
|
||||
def calculate_damage_reduction(level: int):
|
||||
_ = level
|
||||
enemy_damage_reduction = 0.1
|
||||
return 1 - enemy_damage_reduction
|
||||
|
||||
@ -265,6 +266,7 @@ def calculate_resistance_area(
|
||||
add_skill_type: str,
|
||||
element: str,
|
||||
):
|
||||
_ = skill_type
|
||||
enemy_status_resistance = 0.0
|
||||
for attr in merged_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 msgspec import Struct, convert
|
||||
|
||||
from ..excel.read_excel import (
|
||||
AvatarPromotion,
|
||||
EquipmentPromotion,
|
||||
RelicMainAffix,
|
||||
RelicSubAffix,
|
||||
)
|
||||
EXCEL = Path(__file__).parent
|
||||
|
||||
|
||||
class PromotionCost(Struct):
|
||||
@ -70,8 +67,14 @@ class SingleRelicSubAffix(Struct):
|
||||
StepValue: PromotionAttr
|
||||
StepNum: int
|
||||
|
||||
with Path.open(EXCEL / "RelicMainAffixConfig.json", encoding="utf8") as f:
|
||||
RelicMainAffixConfig = convert(json.load(f), List[SingleRelicMainAffix])
|
||||
|
||||
AvatarPromotionConfig = convert(AvatarPromotion, List[SingleAvatarPromotion])
|
||||
EquipmentPromotionConfig = convert(EquipmentPromotion, List[SingleEquipmentPromotion])
|
||||
RelicMainAffixConfig = convert(RelicMainAffix, List[SingleRelicMainAffix])
|
||||
RelicSubAffixConfig = convert(RelicSubAffix, List[SingleRelicSubAffix])
|
||||
with Path.open(EXCEL / "RelicSubAffixConfig.json", encoding="utf8") as f:
|
||||
RelicSubAffixConfig = convert(json.load(f), 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 typing import Dict, List, TypedDict, Union
|
||||
|
||||
from msgspec import Struct
|
||||
from msgspec import json as msgjson
|
||||
|
||||
from ..map.model.RelicSetSkill import RelicSetSkillModel
|
||||
from ..version import StarRail_version
|
||||
|
||||
MAP = Path(__file__).parent / "data"
|
||||
@ -39,11 +38,50 @@ class TS(TypedDict):
|
||||
Icon: Dict[str, str]
|
||||
|
||||
|
||||
class LU(TypedDict):
|
||||
class LU(Struct):
|
||||
id: str
|
||||
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:
|
||||
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])
|
||||
|
||||
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:
|
||||
avatarId2DamageType = msgjson.decode(f.read(), type=Dict[str, str])
|
||||
|
||||
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:
|
||||
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:
|
||||
EquipmentID2AbilityProperty = msgjson.decode(
|
||||
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:
|
||||
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:
|
||||
skillId2AttackType = msgjson.decode(f.read(), type=Dict[str, str])
|
||||
|
@ -3,8 +3,7 @@
|
||||
"2": {
|
||||
"Property": "HealRatioBase",
|
||||
"Value": 0.1
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"102": {
|
||||
"2": {
|
||||
@ -20,54 +19,44 @@
|
||||
"2": {
|
||||
"Property": "DefenceAddedRatio",
|
||||
"Value": 0.15
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"104": {
|
||||
"2": {
|
||||
"Property": "IceAddedRatio",
|
||||
"Value": 0.1
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"105": {
|
||||
"2": {
|
||||
"Property": "PhysicalAddedRatio",
|
||||
"Value": 0.1
|
||||
},
|
||||
"4": {}
|
||||
},
|
||||
"106": {
|
||||
"2": {},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"106": {},
|
||||
"107": {
|
||||
"2": {
|
||||
"Property": "FireAddedRatio",
|
||||
"Value": 0.1
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"108": {
|
||||
"2": {
|
||||
"Property": "QuantumAddedRatio",
|
||||
"Value": 0.1
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"109": {
|
||||
"2": {
|
||||
"Property": "ThunderAddedRatio",
|
||||
"Value": 0.1
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"110": {
|
||||
"2": {
|
||||
"Property": "WindAddedRatio",
|
||||
"Value": 0.1
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"111": {
|
||||
"2": {
|
||||
@ -83,8 +72,7 @@
|
||||
"2": {
|
||||
"Property": "ImaginaryAddedRatio",
|
||||
"Value": 0.1
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"301": {
|
||||
"2": {
|
||||
@ -150,26 +138,20 @@
|
||||
"2": {
|
||||
"Property": "HPAddedRatio",
|
||||
"Value": 0.12
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"114": {
|
||||
"2": {
|
||||
"Property": "SpeedAddedRatio",
|
||||
"Value": 0.06
|
||||
},
|
||||
"4": {}
|
||||
},
|
||||
"115": {
|
||||
"2": {},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"115": {},
|
||||
"116": {
|
||||
"2": {
|
||||
"Property": "AttackAddedRatio",
|
||||
"Value": 0.12
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"311": {
|
||||
"2": {
|
||||
@ -184,7 +166,6 @@
|
||||
}
|
||||
},
|
||||
"117": {
|
||||
"2": {},
|
||||
"4": {
|
||||
"Property": "CriticalChanceBase",
|
||||
"Value": 0.04
|
||||
@ -194,8 +175,7 @@
|
||||
"2": {
|
||||
"Property": "BreakDamageAddedRatioBase",
|
||||
"Value": 0.16
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"313": {
|
||||
"2": {
|
||||
@ -213,8 +193,7 @@
|
||||
"2": {
|
||||
"Property": "BreakDamageAddedRatioBase",
|
||||
"Value": 0.16
|
||||
},
|
||||
"4": {}
|
||||
}
|
||||
},
|
||||
"120": {
|
||||
"2": {
|
||||
@ -226,9 +205,7 @@
|
||||
"Value": 0.06
|
||||
}
|
||||
},
|
||||
"315": {
|
||||
"2": {}
|
||||
},
|
||||
"315": {},
|
||||
"316": {
|
||||
"2": {
|
||||
"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,
|
||||
avatarId2Name,
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""Mihomo.me api 包装"""
|
||||
|
||||
from starrail_damage_cal.mihomo.models import MihomoData
|
||||
from starrail_damage_cal.mihomo.requests import get_char_card_info as requests
|
||||
from ..mihomo.models import MihomoData
|
||||
from ..mihomo.requests import get_char_card_info as requests
|
||||
|
||||
__all__ = ["requests", "MihomoData"]
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import List, Union
|
||||
from typing import List
|
||||
|
||||
from msgspec import Struct, field
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
from collections import Counter
|
||||
from typing import List
|
||||
from typing import Dict, List
|
||||
|
||||
from ..map.SR_MAP_PATH import (
|
||||
EquipmentID2AbilityProperty,
|
||||
@ -22,10 +22,10 @@ class Character:
|
||||
self.attribute_bonus = card_prop.avatarAttributeBonus
|
||||
self.char_relic = card_prop.RelicInfo
|
||||
self.base_attributes = card_prop.baseAttributes
|
||||
self.add_attr = {}
|
||||
self.equipment = card_prop.equipmentInfo
|
||||
self.rarity = card_prop.avatarRarity
|
||||
self.eidolons = card_prop.rankList
|
||||
self.add_attr: Dict[str, float] = {}
|
||||
|
||||
async def get_equipment_info(self):
|
||||
base_attr = self.base_attributes
|
||||
@ -36,16 +36,15 @@ class Character:
|
||||
equip_ability_property = ability_property[str(equip_rank)]
|
||||
|
||||
equip_add_base_attr = equip.baseAttributes
|
||||
base_attr.hp = base_attr.hp + equip_add_base_attr.hp
|
||||
base_attr.attack = base_attr.attack + equip_add_base_attr.attack
|
||||
base_attr.defence = base_attr.defence + equip_add_base_attr.defence
|
||||
base_attr.hp += equip_add_base_attr.hp
|
||||
base_attr.attack += +equip_add_base_attr.attack
|
||||
base_attr.defence += equip_add_base_attr.defence
|
||||
self.base_attributes = base_attr
|
||||
|
||||
for equip_ability in equip_ability_property:
|
||||
property_type: str = equip_ability["PropertyType"]
|
||||
value: float = equip_ability["Value"]["Value"]
|
||||
property_type = equip_ability.PropertyType
|
||||
value = equip_ability.Value.Value
|
||||
self.add_attr[property_type] = value + self.add_attr.get(property_type, 0)
|
||||
return self.add_attr
|
||||
|
||||
async def get_char_attribute_bonus(self):
|
||||
attribute_bonus = self.attribute_bonus
|
||||
@ -84,7 +83,7 @@ class Character:
|
||||
count = item[1]
|
||||
set_value = 0
|
||||
if count >= 2:
|
||||
status_add = RelicSetSkill.RelicSet[str(set_id)]["2"]
|
||||
status_add = RelicSetSkill[str(set_id)].get("2", None)
|
||||
if status_add:
|
||||
set_property = status_add.Property
|
||||
set_value = status_add.Value
|
||||
@ -94,7 +93,7 @@ class Character:
|
||||
0,
|
||||
)
|
||||
if count == 4:
|
||||
status_add = RelicSetSkill.RelicSet[str(set_id)]["4"]
|
||||
status_add = RelicSetSkill[str(set_id)].get("4", None)
|
||||
if status_add:
|
||||
set_property = status_add.Property
|
||||
set_value = status_add.Value
|
||||
|
@ -175,17 +175,17 @@ async def get_data(
|
||||
value=0,
|
||||
),
|
||||
)
|
||||
status_add = characterSkillTree[str(char.avatarId)][str(behavior.pointId)][
|
||||
"levels"
|
||||
][behavior.level - 1]["properties"]
|
||||
if status_add:
|
||||
for property_ in status_add:
|
||||
attribute_bonus_temp.statusAdd.property_ = property_["type"]
|
||||
attribute_bonus_temp.statusAdd.name = Property2Name[
|
||||
property_["type"]
|
||||
]
|
||||
attribute_bonus_temp.statusAdd.value = property_["value"]
|
||||
char_data.avatarAttributeBonus.append(attribute_bonus_temp)
|
||||
status_add = (
|
||||
characterSkillTree[str(char.avatarId)][str(behavior.pointId)]
|
||||
.levels[behavior.level - 1]
|
||||
.properties
|
||||
)
|
||||
# if status_add:
|
||||
for property_ in status_add:
|
||||
attribute_bonus_temp.statusAdd.property_ = property_.type
|
||||
attribute_bonus_temp.statusAdd.name = Property2Name[property_.type]
|
||||
attribute_bonus_temp.statusAdd.value = property_.value
|
||||
char_data.avatarAttributeBonus.append(attribute_bonus_temp)
|
||||
|
||||
# 处理遗器
|
||||
if char.relicList:
|
||||
@ -265,8 +265,8 @@ async def get_data(
|
||||
level_up_skill = AvatarRankSkillUp[str(rank_id)]
|
||||
if level_up_skill:
|
||||
for item in level_up_skill:
|
||||
skill_id = item["id"]
|
||||
skill_up_num = item["num"]
|
||||
skill_id = item.id
|
||||
skill_up_num = item.num
|
||||
# 查找skill_id在不在avatarSkill中
|
||||
for index, skill_item in enumerate(char_data.avatarSkill):
|
||||
if str(skill_id) == str(skill_item.skillId):
|
||||
|
Loading…
Reference in New Issue
Block a user