Esempio n. 1
0
def get_defence_reroll(k: int):
    return rll.Roll(
        roll_policy=rll_pol.get_roll_policy_defence(rollable_symbols=(
            sym.Blank,
            sym.Surge,
        ), ),
        roll_limit=k,
    )
Esempio n. 2
0
def test_roll__douse():
    douse = att_dse.BlackAttackDouse()
    rerolled_douse = rll.Roll(roll_policy=rll_pol.RollPolicyAttack()).on(douse)

    crit_prob = fractions.Fraction(1, 8) * fractions.Fraction(3, 2)
    assert rerolled_douse.as_dict[dse.RolledDouse(douse,
                                                  sym.Crit())] == crit_prob

    hit_prob = fractions.Fraction(3, 8) * fractions.Fraction(3, 2)
    assert rerolled_douse.as_dict[dse.RolledDouse(douse,
                                                  sym.Hit())] == hit_prob

    blank_prob = fractions.Fraction(3, 8) * fractions.Fraction(1, 2)
    assert rerolled_douse.as_dict[dse.RolledDouse(douse,
                                                  sym.Blank())] == blank_prob
Esempio n. 3
0
def test_roll__rolled_dice_pool__aim__red_dice(symbols_before, symbols_after,
                                               prob):
    rolled_dice_pool = dce.RolledDicePool.from_rolled_dice_list([
        dse.RolledDouse(
            douse=att_dse.RedAttackDouse(),
            symbol=symbol,
        ) for symbol in symbols_before
    ])
    rerolled_dice_pool = dce.RolledDicePool.from_rolled_dice_list([
        dse.RolledDouse(
            douse=att_dse.RedAttackDouse(),
            symbol=symbol,
        ) for symbol in symbols_after
    ])
    aim = rll.Roll(
        roll_policy=rll_pol.RollPolicyAttack(),
        roll_limit=2,
    )
    reroll_prob_dist_dict = aim.copy().on(rolled_dice_pool).as_dict
    assert reroll_prob_dist_dict[rerolled_dice_pool] == prob
Esempio n. 4
0
def test_roll__rolled_douse(policy, douse_cls, symbol, target_prob_dist):
    rolled_douse = dse.RolledDouse(
        douse=douse_cls(),
        symbol=symbol,
    )
    assert rll.Roll(roll_policy=policy, ).on(rolled_douse) == target_prob_dist