/**
 * This function calculates the damage dealt by a game character with a given damage value, multiplier, and critical chance.
 * The damage is multiplied by the multiplier and it can be further increased by a critical hit with a certain chance.
 * The function returns the final calculated damage value.
 */
fun calculateDamage(damage: Int, multiplier: Int, critChance: Float): Int {

    var finalDamage = damage

    if (multiplier != 1) { // If the multiplier is not 1
        finalDamage *= multiplier
    }

    if (critChance > 0) { // If there is a chance for a critical hit
        val critRoll = Math.random().toFloat() // Random number between 0 and 1

        if (critRoll <= critChance) { // If the random roll is within the critical chance
            finalDamage *= 2 // Double the damage
        }
    }

    return finalDamage
}
/**
 * This function calculates the damage dealt by a game character with a given damage value, multiplier, and critical chance.
 * The damage is multiplied by the multiplier and it can be further increased by a critical hit with a certain chance.
 * The function returns the final calculated damage value.
 */
fun calculateDamage(damage: Int, multiplier: Int, critChance: Float): Int {
/**
 * This function calculates the damage dealt by a game character with a given damage value, multiplier, and critical chance.
 * The damage is multiplied by the multiplier and it can be further increased by a critical hit with a certain chance.
 * The function returns the final calculated damage value.
 */
fun calculateDamage(damage: Int, multiplier: Int, critChance: Float): Int {

    var finalDamage = damage

    if (multiplier != 1) { // If the multiplier is not 1
        finalDamage *= multiplier
    }

    if (critChance > 0) { // If there is a chance for a critical hit
        val critRoll = Math.random().toFloat() // Random number between 0 and 1

        if (critRoll <= critChance) { // If the random roll is within the critical chance
            finalDamage *= 2 // Double the damage
        }
    }

    return finalDamage
}