StarRailDamageCal
StarRailDamageCal 是一个基于崩坏:星穹铁道角色面板数据的伤害计算库。
当前仓库主要提供三类能力:
- 将 Mihomo / 米游社角色数据转换为统一的内部模型
- 基于角色、光锥、遗器与命座信息计算技能伤害
- 更新本地 Excel / 映射资源文件
环境要求
- Python
3.11+
安装
使用 uv:
uv sync --group test --group lint
使用 pdm:
pdm install -G test -G lint
快速使用
按 UID 读取公开展示柜并计算指定角色:
import asyncio
from starrail_damage_cal import DamageCal
async def main() -> None:
data = await DamageCal.get_damage_data_by_uid(
uid="100086290",
avatar_name="镜流",
)
print(data)
asyncio.run(main())
直接使用 Mihomo 原始数据:
import asyncio
import json
from pathlib import Path
from starrail_damage_cal import DamageCal
async def main() -> None:
mihomo_raw = json.loads(Path("test/test.json").read_text(encoding="utf-8"))
data = await DamageCal.get_damage_data_by_mihomo_raw(
mihomo_raw=mihomo_raw,
avatar_name="镜流",
)
print(data)
asyncio.run(main())
更新资源文件
项目内置了资源更新接口,会将新版本数据覆盖到库包所在目录:
import asyncio
from starrail_damage_cal.update import update_resource
async def main() -> None:
print(await update_resource())
asyncio.run(main())
资源文件目录由 starrail_damage_cal 库包位置决定,不读取环境变量。
测试
python -m pytest
测试默认使用仓库内的离线样例数据,不依赖在线 UID。
当前限制
- 角色、光锥、遗器的部分条件性效果仍然采用静态假设,而不是完整战斗时序模拟
- 如果游戏新角色尚未接入对应伤害模型,会显式抛出
UnsupportedAvatarError - 在线 UID 计算依赖外部数据源的可用性
Metadata
Release files for starrail_damage_cal 4.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| starrail_damage_cal-4.2.0.tar.gz | 286.8 kB | Without provenance | Details for starrail_damage_cal-4.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| starrail_damage_cal-4.2.0-py3-none-any.whl | Python 3 | none | any | Details for starrail_damage_cal-4.2.0-py3-none-any.whl |
Total release size: 609.3 kB
Release files / starrail_damage_cal-4.2.0.tar.gz
| Download URL | starrail_damage_cal-4.2.0.tar.gz |
|---|---|
| Size | 286.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
334920e3723d9e7d61c1814e9f4f2757e53d7418a6e9dc31c7c54edfb77cfb8c
|
|
BLAKE2b-256 checksum How to use checksums |
e78041a8a64ca2087d798de8708ebf8daebe1db070ef3b26910e6f223b2af25c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.26.8 CPython/3.10.20 Linux/6.17.0-1010-azure
|
Release files / starrail_damage_cal-4.2.0-py3-none-any.whl
| Download URL | starrail_damage_cal-4.2.0-py3-none-any.whl |
|---|---|
| Size | 322.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7cb61ad6225b74e53942a7da9bbc6b49df2c1eee1cd18eca5d21ad0c6f78931b
|
|
BLAKE2b-256 checksum How to use checksums |
7aae4e7a4d0ab2d932fbac18777fd5bdc952e50902b88219b7cec6bc684ebddb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.26.8 CPython/3.10.20 Linux/6.17.0-1010-azure
|
Security for starrail_damage_cal 4.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.