Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
level_dice = 3
else:
level_dice = 4
def mapper(node):
if isinstance(node, d20.ast.Dice):
node.num = level_dice
return node
dice_ast = d20.utils.tree_map(mapper, dice_ast)
if effect.higher and not autoctx.get_cast_level() == autoctx.spell.level:
higher = effect.higher.get(str(autoctx.get_cast_level()))
if higher:
higher_ast = d20.parse(higher)
dice_ast.roll = d20.ast.BinOp(dice_ast.roll, '+', higher_ast.roll)
return dice_ast
if d:
d = f"{d}+{effect_d}"
else:
d = effect_d
dice_ast = copy.copy(d20.parse(self.dice))
dice_ast = _upcast_scaled_dice(self, autoctx, dice_ast)
if not self.hidden:
# -mi # (#527)
if mi:
dice_ast = d20.utils.tree_map(_mi_mapper(mi), dice_ast)
if d:
d_ast = d20.parse(d)
dice_ast.roll = d20.ast.BinOp(dice_ast.roll, '+', d_ast.roll)
if maxdmg:
dice_ast = d20.utils.tree_map(_max_mapper, dice_ast)
rolled = roll(dice_ast)
if not self.hidden:
autoctx.meta_queue(f"**{self.name.title()}**: {rolled.result}")
d20.utils.simplify_expr(rolled.expr)
autoctx.metavars[self.name] = RerollableStringifier().stringify(rolled.expr.roll)