This commit is contained in:
2025-06-16 12:35:59 +08:00
parent b063ba5d0f
commit 1669b4e220
+24 -20
View File
@@ -24,7 +24,7 @@ def get_data(prefix: str, key: int | str, func = lambda x = None: x):
try: try:
if isinstance(key, int): if isinstance(key, int):
data = [0] + list(map(lambda x: x["optionValue"].get("value" + str(key+1), 0), skill_data["levelInfo"]["rows"])) data = [0] + list(map(lambda x: x["optionValue"].get("value" + str(key+1), 0), skill_data["levelInfo"]["rows"]))
data = [ 0 if x is None else x for x in data] data = [0 if x is None or x == "-" else x for x in data]
elif key == "vps": elif key == "vps":
data = [ {"name":x["name"],"desc":x["desc"]} for x in skill_data.get("evolution",[])] data = [ {"name":x["name"],"desc":x["desc"]} for x in skill_data.get("evolution",[])]
except Exception as e: except Exception as e:
@@ -179,26 +179,30 @@ class Skill:
return True return True
def apply_association(self, type, old, new, data, skills, exceptSkills, ratio=100, weapon=[]): def apply_association(self, type, old, new, data, skills, exceptSkills, ratio=100, weapon=[]):
if (self.char.GetWeaponType()[0] not in weapon) and not (self.char.GetWeaponType()[0] is None and len(weapon) == len(self.char.武器选项)): try:
return if (self.char.GetWeaponType()[0] not in weapon) and not (self.char.GetWeaponType()[0] is None and len(weapon) == len(self.char.武器选项)):
if type.startswith('$*'): return
if 'cdReduce' in type: if type.startswith('$*'):
value = (1 - data[new] / ratio) / (1 - data[old] / ratio) if 'cdReduce' in type:
value = (1 - data[new] / ratio) / (1 - data[old] / ratio)
else:
value = (1 + data[new] / ratio) / (1 + data[old] / ratio)
eval(f'self.char.SetStatus({type[2:]}={value})')
elif type.startswith('$+'):
value = data[new] / ratio - data[old] / ratio
eval(f'self.char.SetStatus({type[2:]}={value})')
else: else:
value = (1 + data[new] / ratio) / (1 + data[old] / ratio) if skills == '*':
eval(f'self.char.SetStatus({type[2:]}={value})') skills = self.char.GetSkillNames('all', True)
elif type.startswith('$+'): for name in skills:
value = data[new] / ratio - data[old] / ratio if name in exceptSkills:
eval(f'self.char.SetStatus({type[2:]}={value})') continue
else: skill = self.char.GetSkillByName(name)
if skills == '*': if skill is not None:
skills = self.char.GetSkillNames('all', True) self.update_skill_attribute(skill, type, old, new, data, ratio, weapon)
for name in skills: except Exception as e:
if name in exceptSkills: print(f"Error applying association {type} for skill {self.name}: {e}")
continue raise e
skill = self.char.GetSkillByName(name)
if skill is not None:
self.update_skill_attribute(skill, type, old, new, data, ratio, weapon)
def update_skill_attribute(self, skill, type, old, new, data, ratio=100, weapon=[]): def update_skill_attribute(self, skill, type, old, new, data, ratio=100, weapon=[]):
if (self.char.GetWeaponType()[0] not in weapon) and not (self.char.GetWeaponType()[0] is None and len(weapon) == len(self.char.武器选项)): if (self.char.GetWeaponType()[0] not in weapon) and not (self.char.GetWeaponType()[0] is None and len(weapon) == len(self.char.武器选项)):