change code

This commit is contained in:
2026-09-28 05:34:15 +03:00
parent 3d73e14c39
commit 480a055bef
+52 -11
View File
@@ -1,14 +1,55 @@
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
fun main() { fun main() {
val name = "Kotlin" print("Введите текущее HP: ")
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text val currentHpInput = readln().toInt()
// to see how IntelliJ IDEA suggests fixing it. print("Введите кол-во карт энергии: ")
println("Hello, " + name + "!") val energyAttachedInput = readln().toInt()
println()
for (i in 1..5) { if (currentHpInput <= 0) println("Покемон в нокауте!") else println("Покемон готов к бою!")
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint if (energyAttachedInput >= 3) println("Giga Impact!") else println("Не хватает ресурсов на Giga Impact!")
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>. println()
println("i = $i") println("=== РОЗЫГРЫШ КАРТЫ ТРЕНЕРА ===")
print("Введите название карты Тренера: ")
val trainerCardInput = readln().toString()
when (trainerCardInput) {
"Potion" -> println("Эффект: Лечение +30 HP.")
"Professor's Research" -> println("Эффект: Добор 7 карт из колоды.")
"Switch" -> println("Эффект: Замена активного Покемона.")
else -> println("Эффект: Неизвестная карта.")
}
println("=== РАСЧЕТ СТИХИЙНОГО МНОЖИТЕЛЯ ===")
print("Введите стихию Покемона (Fire, Water, Grass): ")
val elementInput = readln().toString()
val weaknessMultiplier: Double = when (elementInput) {
"Water" -> {
println("[Слабость к Электричеству]")
2.0
}
"Fire" -> {
println("[Слабость к Воде]")
1.5
}
"Grass" -> {
println("[Слабость к Огню]")
1.2
}
else -> {
println("[Базовый коэффициент]")
1.0
} }
} }
println()
print("Введите текущий % HP (0-100): ")
val hpPrecent = readln().toInt()
val healthState: String = when {
hpPrecent == 0 -> "Нокаут!"
hpPrecent in 1..20 -> "Критическое состояние"
hpPrecent in 21..70 -> "Поврежден"
else -> "Отличное состояние"
}
println()
println("========================================")
println("ИТОГОВЫЙ СТАТУС БОЯ:")
println("Множитель урона: x$weaknessMultiplier")
println("Категория здоровья: $healthState")
println("========================================")
}