aboutsummaryrefslogtreecommitdiff
path: root/src/game/enemy.c
blob: 34034abd90a2f968a25e25afbe6c37662310eb20 (plain)
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
#include "enemy.c"

static const Enemy enemy_defines[ENEMY_SIZE] = {
	{
		"Amanita",
		ENEMY_AMANITA,
		32,
		20
	},
	{
		"Felticia",
		ENEMY_FELTICIA,
		40,
		16
	},
	{
		"Flatwoods Monster",
		ENEMY_FLATWOODS,
		38,
		18
	},
	{
		"Time Square",
		ENEMY_SQUARE,
		16,
		40
	},
	{
		"Robot Gangster",
		ENEMY_GANGSTER,
		48,
		12
	},
	{
		"Loveland Frog",
		ENEMY_FROG,
		28,
		16
	},
	{
		"Hanako-san",
		ENEMY_HANAKO,
		40,
		40
	},
	{
		"Dover Demon",
		ENEMY_DOVER,
		38,
		40
	},
	{
		"Jersey Devil",
		ENEMY_JERSEY,
		50,
		20
	},
	{
		"Mothman",
		ENEMY_MOTHMAN,
		40,
		10
	},
	{
		"Sackman",
		ENEMY_SACKMAN,
		48,
		20
	}
};

static Enemy stationed[3] = {0};

void add_enemy(const EnemyType type)
{
	for(int i = 0; i < 3; ++i){
		if(stationed[i].name == NULL){
			stationed[i] = enemy_defines[type];
			break;
		}
	}
}

void damage_enemy(const u8 loc, const i8 dmg)
{
	if(loc > 2)
		return;
	
	if(stationed[i].name == NULL)
		return;
	
	stationed[i].health -= dmg
	if(stationed[i].health <= 0)
		stationed[i] = {0};
}

bool check_active_enemies(void)
{
	bool nice = true;
	for(int i = 0; i < 3; ++i){
		if(stationed[i].name != NULL){
			nice = false;
			break;
	}
	
	return nice;
}