战锤40k统计工具

warhammer-stats的Python项目详细描述


战锤属性

这是一个Python库,提供了为warhammer40000生成pmf的组件。这段代码是从https://www.warhammer-stats-engine.com/的后端提取的,并拆分成自己的包,以便其他开发人员更容易使用。在

使用

您可以使用pip获取库的最新版本。https://pypi.org/project/warhammer-stats/

pipenv install warhammer-stats

示例用法

fromwarhammer_statsimportAttack,Weapon,Target,PMFCollectionfromwarhammer_stats.modifiersimportModifierCollection,ReRollOnes# Define a re-roll ones weapon modifierweapon_mods=ModifierCollection(hit_mods=[ReRollOnes()])# Define the weapon. In this case it is a clasic boltgun hitting on a 4+weapon=Weapon(bs=4,shots=PMFCollection.static(10),strength=4,ap=0,damage=PMFCollection.static(1),modifiers=weapon_mods)# Define the target. In this case it is a space marinetarget=Target(toughness=4,save=3,invuln=7,fnp=7,wounds=1)# Create an attackattack=Attack(weapon,target)# Run the calculationresult=attack.run()# print the mean of the damage distributionprint(f'Average wounds: {result.damage_dist.mean()}')

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何使用java向dropup html/css添加项目   如何从java中的向量向量打印   Java Maven库项目模板   java使用atmosphere api还是直接使用grizzly?   java JComponent仅部分显示   如何将动态值传递给自定义注释,以从Java数据进行映射。性质   java破解已实现方法的返回类型的最佳方法?   java Netbeans在JFrame Gui布局中覆盖图像   spring java仅向登录用户显示注销按钮   java如何对com进行身份验证。谷歌。云bigquery。带有服务帐户的BigQuery`   java禁止空字符串参数和抛出RuntimeException以阻止方法继续的利弊   java分析项目中的所有JAR以获取版本和许可证信息   Java,数据库为什么要分配一个新对象,而我们可以直接将它放入数据库