From 6cc96a954d0f7dcb4fb5397157b0158468790169 Mon Sep 17 00:00:00 2001 From: Linus Probert Date: Tue, 14 Aug 2018 13:25:18 +0200 Subject: [PATCH] Begins #8 First boss - Introduces FIRE_DEMON behaviour - Just need to pick a sprite and adapt the lua code --- src/main.c | 5 ++++- src/monster.c | 7 ++++++- src/monster.h | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 46d94e8..5b6839f 100644 --- a/src/main.c +++ b/src/main.c @@ -498,8 +498,11 @@ check_next_level(void) } if (tile->levelExit) { mixer_play_effect(NEXT_LEVEL); - mixer_play_music(GAME_MUSIC0 + get_random(2)); ++cLevel; + if (cLevel % 5 == 0) + mixer_play_music(BOSS_MUSIC0); + else + mixer_play_music(GAME_MUSIC0 + get_random(2)); resetGame(); } } diff --git a/src/monster.c b/src/monster.c index 2cdd3c4..bc1a774 100644 --- a/src/monster.c +++ b/src/monster.c @@ -106,6 +106,7 @@ monster_behaviour_check_post_hit(Monster *m) monster_state_change(m, SCARED); break; case GUERILLA: + case FIRE_DEMON: break; default: monster_state_change(m, AGRESSIVE); @@ -118,6 +119,7 @@ monster_behaviour_check_post_attack(Monster *m) { switch (m->behaviour) { case GUERILLA: + case FIRE_DEMON: monster_state_change(m, SCARED); break; default: @@ -152,6 +154,7 @@ monster_behaviour_check(Monster *m, RoomMatrix *rm) { switch (m->behaviour) { case GUERILLA: + case FIRE_DEMON: if (m->state.stepsSinceChange > 8 && m->state.current == SCARED) { monster_state_change(m, AGRESSIVE); @@ -438,7 +441,8 @@ monster_move(Monster *m, RoomMatrix *rm, Map *map) } - if (!position_equals(&origPos, &m->sprite->pos) && rm->modifier->type == RMOD_TYPE_FIRE) { + if (!position_equals(&origPos, &m->sprite->pos) + && (rm->modifier->type == RMOD_TYPE_FIRE || m->behaviour == FIRE_DEMON)) { Object *o = object_create_fire(); o->sprite->pos = origPos; o->damage *= m->stats.lvl; @@ -600,6 +604,7 @@ monster_set_behaviour(Monster *m, MonsterBehaviour behaviour) case HOSTILE: case GUERILLA: case COWARD: + case FIRE_DEMON: m->state.current = AGRESSIVE; break; case SENTINEL: diff --git a/src/monster.h b/src/monster.h index e107643..d61078c 100644 --- a/src/monster.h +++ b/src/monster.h @@ -34,7 +34,8 @@ typedef enum { HOSTILE, GUERILLA, COWARD, - SENTINEL + SENTINEL, + FIRE_DEMON } MonsterBehaviour; typedef enum {