Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
krkane
/
Rüütli Vaev
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
746bcccb
authored
May 01, 2024
by
grlabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace Header.h
parent
4ba8d006
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
42 deletions
Library/Header.h
Library/Header.h
View file @
746bcccb
#ifndef
GAME_
HEADER_H
#ifndef HEADER_H
#define
GAME_
HEADER_H
#define HEADER_H
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <string.h>
#include <time.h>
#define NUM_HENCHMEN 5
// Constants
#define INPUT_MIN 0
#define INPUT_MAX 3
#define NUM_HENCHMEN 4
#define LOSE_HP 10
#define LOSE_HP 10
#define SPECIAL_DAMAGE 15
#define POTION 25
#define POTION 25
#define INPUT_MIN 0
#define TRAP_SCENARIO 2
#define INPUT_MAX 3
#define SAVE_GAME 2
#define ELF_BASE_DAMAGE 10
//Players base values
#define PLAYER_BASE_HEALTH 100
#define PLAYER_BASE_DAMAGE 10
#define POT_COUNT 10
//Players level up macros
#define LEVEL_UP_HP 20
#define LEVEL_UP_ATTACK 5
//Different enemies base values
#define ELF_BASE_DAMAGE 10
#define ORK_BASE_DAMAGE 15
#define ORK_BASE_DAMAGE 15
#define SMURF_BASE_DAMAGE 20
#define SMURF_BASE_DAMAGE 20
#define DEEMON_BASE_DAMAGE 25
#define DEEMON_BASE_DAMAGE 25
#define BANDIIT_BASE_DAMAGE 30
#define BANDIIT_BASE_DAMAGE 30
#define SPECIAL_DAMAGE 40
#define BOSS_HEALTH 200
#define BOSS_HEALTH 100
#define BOSS_DAMAGE 30
#define BOSS_DAMAGE 20
#define PLAYER_BASE_HEALTH 100
#define PLAYER_BASE_DAMAGE 20
#define POT_COUNT 3
#define LEVEL_UP_HP 20
#define LEVEL_UP_ATTACK 5
#define GAIN_POTION 1
#define GAIN_POTION_COUNT 1
//Game save value
// Structures
#define SAVE_GAME 2
typedef
struct
{
#define STATS_ROW_LEN 2
typedef
struct
{
int
health
;
int
health
;
int
attack
;
int
attack
;
int
potionCount
;
int
potionCount
;
}
Player
;
}
Player
;
typedef
struct
typedef
struct
{
{
int
health
;
int
health
;
int
attack
;
int
attack
;
char
type
[
20
];
char
type
[
20
];
}
Enemy
;
}
Enemy
;
typedef
struct
typedef
struct
{
{
int
health
;
int
health
;
int
attack
;
int
attack
;
char
type
[
20
];
char
type
[
20
];
}
FinalBoss
;
}
FinalBoss
;
// Function prototypes
void
PrintWelcomeMessage
(
void
);
void
DisplayGameRules
(
void
);
Player
CreatePlayer
();
Player
CreatePlayer
();
int
Move
(
int
defeated_enemies
);
int
Move
(
int
correctChoice
);
int
fight
(
Player
*
p
,
Enemy
*
e
);
int
fight
(
Player
*
p
,
Enemy
*
e
);
int
bossFight
(
Player
*
p
,
FinalBoss
*
boss
);
int
bossFight
(
Player
*
p
,
FinalBoss
*
boss
);
int
usePotion
(
Player
*
p
,
int
initialHealth
,
int
currentHealth
);
int
usePotion
(
Player
*
p
,
int
initialHealth
,
int
currentHealth
);
void
levelUp
(
Player
*
p
);
void
levelUp
(
Player
*
p
);
Enemy
CreateEnemy
(
int
defeated_enemies
);
Enemy
CreateEnemy
(
int
defeated_enemies
);
FinalBoss
CreateFinalBoss
(
int
defeated_enemies
);
FinalBoss
CreateFinalBoss
(
int
defeated_enemies
);
int
Menu
(
void
);
void
PrintWelcomeMessage
();
void
DisplayGameRules
();
int
Menu
();
int
GetIntInRange
(
int
min
,
int
max
);
int
GetIntInRange
(
int
min
,
int
max
);
int
SaveGame
(
char
*
file
,
Player
*
p
,
int
enemiesDefeated
);
void
handleTrap
(
Player
*
player
);
void
LoadGame
(
char
*
file
,
Player
*
p
,
int
*
enemies
);
#endif //
GAME_
HEADER_H
#endif //
HEADER_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment