Files
AntonKat 73a23955a0 Обновить Laba4.1.kt
Добавлено 4 задание
2026-09-24 12:32:39 +00:00

51 lines
1.8 KiB
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.
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 ++
}
var damageCounters = 0
val maxCounters = 5
while (damageCounters < maxCounters) {
damageCounters++
println("Наложен жетон урона №$damageCounters .")
}
}