ethtezahl/dice-roller
Composer 安装命令:
composer require ethtezahl/dice-roller
包简介
RPG rolling dice simulation
README 文档
README
Concept.
I wanted to code a program which create stats for pre-rolled characters for rpg "Call of Cthulhu". I needed a library that can simulate and give result of a roll of multiple dice (sometimes with a different number of sides). So I created this library, to make these rolls.
Installation
composer require ethtezahl/dice-roller
Basic usage
The code above will simulate the roll of two six-sided die
// First: import needed class use Ethtezahl\DiceRoller\CupFactory; // Factory allow us to create dice cup. $factory = new CupFactory(); // We create the cup that will contain the two die: $cup = $factory->newInstance('2D6'); // Display the result: echo $cup->roll();
Advanced use: with multiple types of die
Imagine you need to roll three twenty-sided die and one four-sided dice:
$cup = $factory->newInstance('3D20+D4');
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-13