import math


def calculate_damage(sfe, damage, atutes,
                     tulutes=False, is_zero_zero=False):
    """
    Calculates the actual ep and fp damage based on:
        - The SFE of the character
        - The actual damage
        - The armour piercing of the attacking weapon
        - Whether it was a critical hit (tulutes=True) or not
        - Whether the attacker rolled 00 or not

    Returns the total ep and fp damage (if any)
    """
    if is_zero_zero:
        sfe = 0

    else:
        sfe -= atutes

        if sfe < 0:
            sfe = 0

    damage -= sfe

    if damage <= 0 and not is_zero_zero:
        return 0, 0

    if tulutes:
        ep_damage = damage
        fp_damage = damage * 2

    else:
        ep_damage = int(math.floor(damage/5))
        fp_damage = damage

    if is_zero_zero:
        ep_damage += 3
        fp_damage += 6

    return ep_damage, fp_damage