#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
srand(time(0));
int playerHP = 100;
int enemyHP = 50;
int playerLevel = 1;
cout << "=== SKY FIGHT GAME ===" << endl;
cout << "Battle an enemy in the sky!" << endl << endl;
while (playerHP > 0 && enemyHP > 0) {
cout << "\n--- Your HP: " << playerHP << " | Enemy HP: " << enemyHP << " ---" << endl;
cout << "1. Attack\n2. Defend\n3. Escape" << endl;
cout << "Choose action: ";
int action;
cin >> action;
if (action == 1) {
int damage = 10 + rand() % 15;
enemyHP -= damage;
cout << "You attack for " << damage << " damage!" << endl;
} else if (action == 2) {
int damage = 5 + rand() % 8;
playerHP += 5;
cout << "You defend and recover 5 HP!" << endl;
damage = rand() % 5;
playerHP -= damage;
cout << "Enemy deals " << damage << " damage!" << endl;
continue;
} else if (action == 3) {
cout << "You escaped from the sky battle!" << endl;
return 0;
}
if (enemyHP > 0) {
int enemyDamage = 8 + rand() % 12;
playerHP -= enemyDamage;
cout << "Enemy attacks for " << enemyDamage << " damage!" << endl;
}
}
if (playerHP > 0) {
cout << "\n*** YOU WON! ***" << endl;
cout << "Victory in the sky! Level up!" << endl;
} else {
cout << "\n*** YOU LOST! ***" << endl;
cout << "Defeated in the sky battle..." << endl;
}
return 0;
}