예제 #1
0
def process_check(
        context: action_runtime.ActionContext,
        check: action_defs.ActionCheckSkill,
    ):

    skill = context.character.skills[check.skill_slug]
    roll = utils.dice_roll(skill.value + skill.modifier, check.difficulty)

    if roll >= 0:
        print(' (success)')
        for result in check.success:
            process_result(context, check, result, roll)
    else:
        print(' (failure)')
        for result in check.failure:
            process_result(context, check, result, -roll)
예제 #2
0
def process_check(
        context: action_runtime.ActionContext,
        check: action_defs.ActionCheckRandom,
    ):

    from random import randint
    if randint(1, 100) <= check.probability:
        skill = context.character.skills[check.skill_slug]
        roll = utils.dice_roll(skill.value + skill.modifier, check.difficulty)

        if roll >= 0:
            print(' (success)')
            for result in check.success:
                process_result(context, check, result, roll)
        else:
            print(' (failure)')
            for result in check.failure:
                process_result(context, check, result, -roll)
    else:
        print(' (not_happen)')
        for result in check.not_happen:
            process_result(context, check, result, 0)