-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Battle.h
123 lines (73 loc) · 2.89 KB
/
Battle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// Filename: Battle.h
// Declarations specific to the battle game state should go here.
//
// Project Codename: GameB
// TODO: Come up with a better name later.
// 2020 Joseph Ryan Ries <ryanries09@gmail.com>
// My YouTube series where we program an entire video game from scratch in C.
// Watch it on YouTube: https://www.youtube.com/watch?v=3zFFrBSdBvA
// Follow along on GitHub: https://github.com/ryanries/GameB
// Find me on Twitter @JosephRyanRies
// # License
// ----------
// The source code in this project is licensed under the MIT license.
// The media assets such as artwork, custom fonts, music and sound effects are licensed under a separate license.
// A copy of that license can be found in the 'Assets' directory.
// stb_vorbis by Sean Barrett is public domain and a copy of its license can be found in the stb_vorbis.c file.
// miniz by Rich Geldreich <richgel99@gmail.com> is public domain (or possibly MIT licensed) and a copy of its license can be found in the miniz.c file.
#pragma once
typedef enum BATTLESTATE
{
BATTLESTATE_INTRO,
BATTLESTATE_PLAYERATTACKING,
BATTLESTATE_MONSTERATTACKING,
BATTLESTATE_MONSTERTHINKING,
BATTLESTATE_PLAYERTHINKING,
BATTLESTATE_PLAYERDEFENDING,
BATTLESTATE_MONSTERDEFENDING,
BATTLESTATE_PLAYERCASTINGSPELL,
BATTLESTATE_MONSTERCASTINGSPELL,
BATTLESTATE_PLAYERRUNNINGAWAY,
BATTLESTATE_MONSTERRUNNINGAWAY,
BATTLESTATE_MONSTERISDEAD,
BATTLESTATE_PLAYERISDEAD
} BATTLESTATE;
// Pretty similar stats to the player
typedef struct MONSTER
{
const char Name[13];
GAMEBITMAP* Sprite;
int MaxHP;
int HP;
int Money; // The coin that will be awarded to the player once this monster is killed
int MaxMP;
int MP; // Magic points
int XP; // The amount of xp that will be awarded to the player once this monster is killed
int Strength; // Increases the physical damage the monster can do
int Damage; // Since the monster doesn't have a weapon, we will combine this with strength to determine monster's damage dealt
int Dexterity; // Increases chance to hit.
int Luck; // Increases miscellaneous odds of things happening.
int Intelligence; // Spell damage and chance to hit.
int Evasion; // Chance to dodge, and chance to run away successfully
int Defense; // Damage mitigation.
// THESE FOUR MUST ADD UP TO 100
int AttackChance; // 95%
int RunChance; // 5% (Goes up if low on health)
int SpellChance; // 0%
int DefendChance; // 0%
int BaseDamage;
const char* Emotes[3];
const SPELL KnownSpells[8];
} MONSTER;
extern const MONSTER gSlime001;
extern const MONSTER gRat001;
extern MONSTER gCurrentMonster;
void GenerateMonster(void);
void PPI_Battle(void);
void DrawBattle(void);
void MenuItem_BattleAction_Attack(void);
void MenuItem_BattleAction_Spell(void);
void MenuItem_BattleAction_Run(void);
void MenuItem_BattleAction_Defend(void);
void MenuItem_BattleAction_Item(void);
void MonsterAttack(void);