For StarRail Role Damage Cal
Project description
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 计算依赖外部数据源的可用性
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
starrail_damage_cal-4.2.0.tar.gz
(286.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file starrail_damage_cal-4.2.0.tar.gz.
File metadata
- Download URL: starrail_damage_cal-4.2.0.tar.gz
- Upload date:
- Size: 286.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.26.8 CPython/3.10.20 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
334920e3723d9e7d61c1814e9f4f2757e53d7418a6e9dc31c7c54edfb77cfb8c
|
|
| MD5 |
4eae688d4e9405b4c197808125caa472
|
|
| BLAKE2b-256 |
e78041a8a64ca2087d798de8708ebf8daebe1db070ef3b26910e6f223b2af25c
|
File details
Details for the file starrail_damage_cal-4.2.0-py3-none-any.whl.
File metadata
- Download URL: starrail_damage_cal-4.2.0-py3-none-any.whl
- Upload date:
- Size: 322.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.26.8 CPython/3.10.20 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cb61ad6225b74e53942a7da9bbc6b49df2c1eee1cd18eca5d21ad0c6f78931b
|
|
| MD5 |
6600dcdc43cb2a38f3b69421bd6cfc95
|
|
| BLAKE2b-256 |
7aae4e7a4d0ab2d932fbac18777fd5bdc952e50902b88219b7cec6bc684ebddb
|