Skip to main content

为回合制游戏计算精确的 DPS

项目描述

dpsbin

计算扩展的负二项式分布的概率质量函数,这对于在各种基于回合/tick 的游戏中进行准确的 DPS 计算至关重要。

描述

由于过度杀伤等因素,在典型的砍杀游戏中估计完成对手所需时间的常用方法是不准确的。这些粗略的计算通常足够好,但如果不是,你可以求助于这个库来获得准确的答案。

安装

dpsbin 需要 Python 3 或更高版本,并且在 PyPI 上可用。

python -m pip install dpsbin

或者,可以轻松下载最新版本并在本地安装。

git clone https://github.com/hmusgrave/dpsbin.git
cd dpsbin
python -m pip install -e .

使用 dpsbin

唯一值得注意的入口点是dpsbin.pmf. 假设你想知道你必须掷多少次 6 面骰子才能达到 40 或更多。

import dpsbin, numpy as np, math

probs = dpsbin.pmf(6, 40)

# probs[k] is the probability you need to roll k times.
assert math.isclose(np.sum(probs), 1)

# easily find out how many rolls you'll need on average.
avg = np.dot(probs, np.arange(len(probs)))

# if you have a 90% chance to miss and not deal the 1d6 damage then
# you can use with_zeros() to translate the old probability mass array
# into one that accounts for zeros. Truncate to only considering up
# to 80 rolls.
hard_to_hit = dpsbin.with_zeros(80, .9, probs)

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

dpsbin-0.0.4.tar.gz (7.2 kB 查看哈希

已上传 source

内置分布

dpsbin-0.0.4-py3-none-any.whl (19.9 kB 查看哈希

已上传 py3