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.1.tar.gz
(287.1 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.1.tar.gz.
File metadata
- Download URL: starrail_damage_cal-4.2.1.tar.gz
- Upload date:
- Size: 287.1 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 |
56ebd908ab9e4e221b908c77c623e64c21852dd6871f385f2d159c3a60df854e
|
|
| MD5 |
218b25e472e2234c6b70535c0bb6bf07
|
|
| BLAKE2b-256 |
ecd637c73a59b2ec3be1112dca7133e12cee3f7642ddfaec47f67d2f65888dc3
|
File details
Details for the file starrail_damage_cal-4.2.1-py3-none-any.whl.
File metadata
- Download URL: starrail_damage_cal-4.2.1-py3-none-any.whl
- Upload date:
- Size: 322.8 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 |
1e7e8ac33304b998ff9d2c285042fc2508953d2402c8e4d1feea7bbd33ce07a8
|
|
| MD5 |
b3bd14d0fd7a4b4eeeddec8e0012726a
|
|
| BLAKE2b-256 |
56e16f20c39b25dd1ad5459b98aada2c7a962405a533ce49dc57b0b00282d106
|