Commit fa1fb5bd by krkane

Update Main.c

parent a4db2dba
Showing with 10 additions and 13 deletions
...@@ -39,15 +39,19 @@ int main(void) ...@@ -39,15 +39,19 @@ int main(void)
while (gameState == 1) while (gameState == 1)
{ {
if (defeatedEnemies < NUM_HENCHMEN) int moveResult = Move(defeatedEnemies);
{
if (moveResult == -10) { // Player encountered a trap
handleTrap(&player);
continue; // Restart the loop, allowing the player to choose the path again
}
if (defeatedEnemies < NUM_HENCHMEN) {
Enemy enemy = CreateEnemy(defeatedEnemies); Enemy enemy = CreateEnemy(defeatedEnemies);
printf("\nVastane tüübiga %s, %dHP ja rünnaku tugevusega" printf("\nVastane tüübiga %s, %dHP ja rünnaku tugevusega"
" %d on loodud.\n", enemy.type, enemy.health, enemy.attack); " %d on loodud.\n", enemy.type, enemy.health, enemy.attack);
gameState = fight(&player, &enemy); gameState = fight(&player, &enemy);
} } else {
else
{
// Generate the final boss // Generate the final boss
FinalBoss boss = CreateFinalBoss(defeatedEnemies); FinalBoss boss = CreateFinalBoss(defeatedEnemies);
printf("\nVastane tüübiga %s, %dHP ja rünnaku tugevusega" printf("\nVastane tüübiga %s, %dHP ja rünnaku tugevusega"
...@@ -55,19 +59,12 @@ int main(void) ...@@ -55,19 +59,12 @@ int main(void)
gameState = bossFight(&player, &boss); gameState = bossFight(&player, &boss);
} }
if (gameState == 0) if (gameState == 0) {
{
return 0; return 0;
} }
defeatedEnemies++; defeatedEnemies++;
levelUp(&player); levelUp(&player);
gameState = Move(defeatedEnemies);
if (gameState == 0)
{
return 0;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment