Начал делать lesson3

This commit is contained in:
328p
2026-09-10 13:52:58 +03:00
parent c33d95c1a0
commit 0287da5069
2 changed files with 76 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Kotlin ###
.kotlin
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
+44
View File
@@ -0,0 +1,44 @@
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
fun main() {
println("=== ПРОВЕРКА СОСТОЯНИЯ ПОКЕМОНА ===")
print("Введите текущее HP: ")
val currentHpInput = readln()
val currentHp = currentHpInput.toInt()
print("Введите количество энергии: ")
val energyAttachedInput = readln()
val energyAttached = energyAttachedInput.toInt()
println("")
if (currentHp <= 0) {
println("Покемон в нокауте!")
return
} else {
println("Покемон в строю и готов к бою.")
}
var attackStatus: String = ""
if (energyAttached >= 3) {
attackStatus = "Доступна атака 'Giga Impact'"
} else {
attackStatus = "Нехватает ресурсов"
return
}
println("")
println("=== РОЗЫГРЫШ КАРТЫ ТРЕНЕРА ===")
println("Введите название карты Тренера: ")
var trainerCardInput = readln()
var trainerCard = trainerCardInput.toString()
when (trainerCard) {
"Potion" -> println("лечениие на +30 HP.")
"Professor's Research" -> println("добор 7 карт из колоды.")
"Switch" -> println("замена активного Покемона.")
else -> {
println("Неизвестный тип карты")
return
}
}
println()
}