From f7426d9cf21a0e7b0035cfb8bf9a4415b87da2a2 Mon Sep 17 00:00:00 2001 From: Korlne Date: Sun, 5 Jul 2026 22:45:52 +0800 Subject: [PATCH] Fix calculation results package checkout Track the calculation results source package and whitelist it from the result file ignore rule so clean GitHub Actions checkouts can import the simulator on case-sensitive runners. --- .gitignore | 2 + .../calculation/results/__init__.py | 11 +++++ .../calculation/results/anomaly.py | 23 ++++++++++ .../calculation/results/common.py | 45 +++++++++++++++++++ .../calculation/results/regular.py | 21 +++++++++ 5 files changed, 102 insertions(+) create mode 100644 zsim/sim_progress/calculation/results/__init__.py create mode 100644 zsim/sim_progress/calculation/results/anomaly.py create mode 100644 zsim/sim_progress/calculation/results/common.py create mode 100644 zsim/sim_progress/calculation/results/regular.py diff --git a/.gitignore b/.gitignore index 99c44c91..95c26c3a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ pytest.ini result* /results/ !zsim/sim_progress/Report/result_handler.py +!zsim/sim_progress/calculation/results/ +!zsim/sim_progress/calculation/results/*.py # 开发工具和环境文件 .idea diff --git a/zsim/sim_progress/calculation/results/__init__.py b/zsim/sim_progress/calculation/results/__init__.py new file mode 100644 index 00000000..cd7693b3 --- /dev/null +++ b/zsim/sim_progress/calculation/results/__init__.py @@ -0,0 +1,11 @@ +from zsim.sim_progress.calculation.results.common import ( + AnomalyScalarResult, + DamageScalarResult, + MultiplierVector, +) + +__all__ = [ + "AnomalyScalarResult", + "DamageScalarResult", + "MultiplierVector", +] diff --git a/zsim/sim_progress/calculation/results/anomaly.py b/zsim/sim_progress/calculation/results/anomaly.py new file mode 100644 index 00000000..dd244dd6 --- /dev/null +++ b/zsim/sim_progress/calculation/results/anomaly.py @@ -0,0 +1,23 @@ +from __future__ import annotations + +from dataclasses import dataclass + +from zsim.sim_progress.calculation.inputs.common import AnomalyIdentityProfile +from zsim.sim_progress.calculation.results.common import MultiplierVector + + +@dataclass(frozen=True, slots=True) +class AnomalyDamageResult: + """带有乘区依据的标量异常伤害输出。""" + + value: float + identity: AnomalyIdentityProfile + multipliers: MultiplierVector + scaling_factor: float + cancelled_snapshot_impact: float + cancelled_snapshot_stun_bonus: float + + +__all__ = [ + "AnomalyDamageResult", +] diff --git a/zsim/sim_progress/calculation/results/common.py b/zsim/sim_progress/calculation/results/common.py new file mode 100644 index 00000000..fc157ac9 --- /dev/null +++ b/zsim/sim_progress/calculation/results/common.py @@ -0,0 +1,45 @@ +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import Iterable + +from zsim.sim_progress.calculation.inputs.common import ( + AnomalyIdentityProfile, + DamageIdentityProfile, +) + + +@dataclass(frozen=True, slots=True, init=False) +class MultiplierVector: + """公式模块返回的只读乘区标签与数值。""" + + values: tuple[float, ...] + labels: tuple[str, ...] = () + + def __init__( + self, + values: Iterable[float], + labels: Iterable[str] = (), + ) -> None: + object.__setattr__(self, "values", tuple(values)) + object.__setattr__(self, "labels", tuple(labels)) + if self.labels and len(self.labels) != len(self.values): + raise ValueError("MultiplierVector labels must match values length") + + +@dataclass(frozen=True, slots=True) +class DamageScalarResult: + """带有身份与乘区依据的标量伤害输出。""" + + value: float + identity: DamageIdentityProfile + multipliers: MultiplierVector = field(default_factory=lambda: MultiplierVector(())) + + +@dataclass(frozen=True, slots=True) +class AnomalyScalarResult: + """显式分离伤害、亲和与状态身份的标量异常输出。""" + + value: float + identity: AnomalyIdentityProfile + multipliers: MultiplierVector = field(default_factory=lambda: MultiplierVector(())) diff --git a/zsim/sim_progress/calculation/results/regular.py b/zsim/sim_progress/calculation/results/regular.py new file mode 100644 index 00000000..72bd1ab8 --- /dev/null +++ b/zsim/sim_progress/calculation/results/regular.py @@ -0,0 +1,21 @@ +from __future__ import annotations + +from dataclasses import dataclass + +from zsim.sim_progress.calculation.inputs.common import DamageIdentityProfile +from zsim.sim_progress.calculation.results.common import MultiplierVector + + +@dataclass(frozen=True, slots=True) +class RegularDamageResult: + """带有乘区依据的标量常规伤害输出。""" + + value: float + identity: DamageIdentityProfile + multipliers: MultiplierVector + mode: str + + +__all__ = [ + "RegularDamageResult", +]