Files
2026-10-11 22:50:58 +03:00

28 lines
961 B
Kotlin
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
//fun calcDamage(power: Int, multiplier: Double = 1.0):Int = (power * multiplier).toInt()
fun checkStatus(hp:Int):String{
return if (hp > 0) {
"В строю"
} else {
"Нокаут"
}
fun printBattleLog(attacker: String, defender: String, damage: Int) {
println("$attacker Атаковал $defender и нанес ему $damage")
}
}
fun useTrainerCard(cardName: String, healAmount: Int = 20, drawCards: Int = 0) {
println("Применена карта $cardName лечение = $healAmount кол-во карт $drawCards")
}
fun processTurn(hp: Int, damage: Int, effect: (Int) -> Int): Int{
var newHp = hp-damage
return effect(newHp)
}
fun main() {
//useTrainerCard("Пикачу",drawCards = 2)
processTurn(hp = 100, damage = readln().toInt(), { hp -> hp + 15 })
}