import random


def roll_damage(dice_stacks, modifiers, critical=False):
    """
    :param dice_stacks: Stacks of Dice to apply
    :param modifiers: Total of modifiers affecting the roll
    :param critical: If is a critical damage roll
    :return: Total damage to apply.
    """
    if critical:
        for dice_stack in dice_stacks:
            dice_stack.amount *= 2

    total_dice_result = 0
    for dice_stack in dice_stacks:
        for i in range(0, dice_stack.amount):
            total_dice_result += random.randint(1, dice_stack.dice.sides)

    return total_dice_result + modifiers