generated from admin/template
kto
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
//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 })
|
||||
}
|
||||
Reference in New Issue
Block a user