Commit ca016a56 by krkane

Add new file

parent 96912b00
Showing with 75 additions and 0 deletions
#include "Header.h"
#include <stdio.h>
int main(void)
{
srand(time(NULL));
int choice;
PrintWelcomeMessage();
printf("Vajutage 1, et mängida!\n"
"Vajutage 2, et lugeda mängu reegleid!\n"
"Vajutage 0, et väljuda!\n");
do
{
scanf("%d", &choice);
if (choice != 1 && choice != 0 && choice != 2)
{
printf("Palun valige õige valik...\n");
}
} while (choice != 1 && choice != 0 && choice != 2);
if (choice == 0)
{
printf("\nVäljun...\n");
return 0;
}
else if (choice == 2)
{
DisplayGameRules();
}
else if (choice == 1)
{
int gameState = 1;
Player player = CreatePlayer();
int defeatedEnemies = 0;
while (gameState == 1)
{
if (defeatedEnemies < NUM_HENCHMEN)
{
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)
{
return 0;
}
defeatedEnemies++;
levelUp(&player);
gameState = Move(defeatedEnemies);
if (gameState == 0)
{
return 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