예제 #1
0
 def _roll_stat(self):
     """
     The first step to creating your character is to roll 3d6 for each of the
     six attribute scores.
     """
     
     return sum(dice.roll("3d6", sorted=True))
예제 #2
0
    def _roll_stat(self):
        """
        Assumes D&D v3.5 PHB1 default rules:
        Roll 4d6, drop lowest roll, sum the
        rest of the dice for ability score
        """

        return sum(dice.discard(dice.roll("4d6", sorted=True), 1))
예제 #3
0
파일: app.py 프로젝트: cfi2017/avrae.io
def roll():
    to_roll = request.args.get('dice') or '1d20'
    adv = request.args.get('adv', 0)
    rolled = dice.roll(to_roll, adv)

    result = {
        'total': rolled.total,
        'result': rolled.result,
        'is_crit': rolled.crit,
        'dice': [part.to_dict() for part in rolled.raw_dice.parts]
    }

    return jsonify(result)