Files
Alg-Prog/Laba4.1.kt
T

43 lines
1.6 KiB
Kotlin
Raw 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.
fun main() {
println("=== ЧАСТЬ 1: НАБОР СТАРТОВОЙ РУКИ ===")
var deckSize = 60
var cardsInHand = 0
print("Сколько карт взять? : ")
var targetDrawInput = readln().toInt()
var cardNum = 0
while (cardsInHand != targetDrawInput) {
deckSize --
cardsInHand ++
cardNum ++
println("[ДОБОР] Взята карта №$cardNum. В руке: $cardsInHand карт, в колоде осталось: $deckSize")
}
var energyCost = -1
while (energyCost < 0){
print("Введите стоимость: ")
energyCost = readln().toInt()
if (energyCost < 0){
println("[ОШИБКА] Стоимость атаки не может быть отрицательной! Попробуйте снова.")
}
else{
println("[УСПЕХ] Корректная стоимость атаки принята: $energyCost")
}
}
print("Начальное количество здоровья: ")
var enemyHpInput = readln().toInt()
var round = 1
while(round <= 10 && enemyHpInput > 0){
if (round % 2 == 0){
println("Раунд $round: [Эффект Защиты] Раунд пропускается.")
} else {
enemyHpInput -= 25
println("Раунд $round: Нанесено 25 урона. У противника осталось $enemyHpInput HP.")
if (enemyHpInput <= 0) {
println("Покемон противника упал без сил! Прерываем бой.")
break
}
}
round ++
}
}