Commit fa1fb5bd by krkane

Update Main.c

parent a4db2dba
Showing with 20 additions and 23 deletions
...@@ -39,35 +39,32 @@ int main(void) ...@@ -39,35 +39,32 @@ int main(void)
while (gameState == 1) while (gameState == 1)
{ {
if (defeatedEnemies < NUM_HENCHMEN) int moveResult = Move(defeatedEnemies);
{
Enemy enemy = CreateEnemy(defeatedEnemies);
printf("\nVastane tüübiga %s, %dHP ja rünnaku tugevusega"
" %d on loodud.\n", enemy.type, enemy.health, enemy.attack);
gameState = fight(&player, &enemy);
}
else
{
// Generate the final boss
FinalBoss boss = CreateFinalBoss(defeatedEnemies);
printf("\nVastane tüübiga %s, %dHP ja rünnaku tugevusega"
" %d on loodud.\n", boss.type, boss.health, boss.attack);
gameState = bossFight(&player, &boss);
}
if (gameState == 0) if (moveResult == -10) { // Player encountered a trap
{ handleTrap(&player);
return 0; continue; // Restart the loop, allowing the player to choose the path again
} }
defeatedEnemies++; if (defeatedEnemies < NUM_HENCHMEN) {
levelUp(&player); Enemy enemy = CreateEnemy(defeatedEnemies);
gameState = Move(defeatedEnemies); printf("\nVastane tüübiga %s, %dHP ja rünnaku tugevusega"
" %d on loodud.\n", enemy.type, enemy.health, enemy.attack);
gameState = fight(&player, &enemy);
} else {
// Generate the final boss
FinalBoss boss = CreateFinalBoss(defeatedEnemies);
printf("\nVastane tüübiga %s, %dHP ja rünnaku tugevusega"
" %d on loodud.\n", boss.type, boss.health, boss.attack);
gameState = bossFight(&player, &boss);
}
if (gameState == 0) if (gameState == 0) {
{
return 0; return 0;
} }
defeatedEnemies++;
levelUp(&player);
} }
} }
......
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