aboutsummaryrefslogtreecommitdiff
path: root/src/game/enemy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/enemy.c')
-rw-r--r--src/game/enemy.c107
1 files changed, 107 insertions, 0 deletions
diff --git a/src/game/enemy.c b/src/game/enemy.c
new file mode 100644
index 0000000..34034ab
--- /dev/null
+++ b/src/game/enemy.c
@@ -0,0 +1,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;
+} \ No newline at end of file