2022-09-09 14:50:17 +00:00
|
|
|
import os
|
2023-10-07 15:21:45 +00:00
|
|
|
from typing import Dict
|
2022-09-09 14:50:17 +00:00
|
|
|
|
2023-09-20 07:49:10 +00:00
|
|
|
from modules.playercards.fight_prop import FightPropScore, EquipmentsStats, nameToFightProp, FightProp
|
2023-05-11 15:09:39 +00:00
|
|
|
from modules.wiki.models.enums import RelicAffix
|
2022-09-09 14:50:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ArtifactStatsTheory:
|
2023-10-07 15:21:45 +00:00
|
|
|
def __init__(self, character_name: str, fight_prop_rule_data: Dict[str, Dict[str, float]]):
|
2022-09-09 14:50:17 +00:00
|
|
|
self.character_name = character_name
|
2023-09-20 07:49:10 +00:00
|
|
|
self.fight_prop_rules = fight_prop_rule_data.get(self.character_name, {})
|
|
|
|
fight_prop_rule_list = list(self.fight_prop_rules.keys())
|
2023-05-11 15:09:39 +00:00
|
|
|
self.main_prop = [nameToFightProp(fight_prop_rule) for fight_prop_rule in fight_prop_rule_list]
|
2022-09-09 14:50:17 +00:00
|
|
|
if not self.main_prop:
|
2022-10-10 11:07:28 +00:00
|
|
|
self.main_prop = [
|
2023-05-11 15:09:39 +00:00
|
|
|
RelicAffix.CriticalChanceBase,
|
|
|
|
RelicAffix.CriticalDamageBase,
|
2023-10-13 16:26:21 +00:00
|
|
|
RelicAffix.SpeedDelta,
|
2023-05-11 15:09:39 +00:00
|
|
|
RelicAffix.AttackAddedRatio,
|
2022-10-10 11:07:28 +00:00
|
|
|
]
|
2022-09-09 14:50:17 +00:00
|
|
|
|
|
|
|
def theory(self, sub_stats: EquipmentsStats) -> float:
|
2023-05-11 15:09:39 +00:00
|
|
|
"""圣遗物词条评分
|
2022-10-10 11:07:28 +00:00
|
|
|
Args:
|
|
|
|
sub_stats: 圣遗物对象
|
|
|
|
Returns:
|
|
|
|
返回得分
|
2022-09-09 14:50:17 +00:00
|
|
|
"""
|
|
|
|
score: float = 0
|
2023-05-11 15:09:39 +00:00
|
|
|
if sub_stats.prop_id in self.main_prop:
|
|
|
|
base_value = 100.0 if sub_stats.prop_value < 1 else 1.0
|
2023-09-20 07:49:10 +00:00
|
|
|
weight = self.fight_prop_rules.get(FightProp(sub_stats.prop_id), 0.0)
|
|
|
|
if weight == 0.0:
|
|
|
|
weight = FightPropScore(sub_stats.prop_id)
|
|
|
|
score = float(weight * sub_stats.prop_value * base_value)
|
2022-09-09 14:50:17 +00:00
|
|
|
return round(score, 1)
|