From 583a7d049d9af2de00f4c619630ac431427a13df Mon Sep 17 00:00:00 2001 From: Linus Probert Date: Thu, 13 Sep 2018 23:45:33 +0200 Subject: [PATCH] Fixes some minor bugs caused by coding without testing --- src/main.c | 7 ++----- src/player.c | 8 +++++--- src/projectile.c | 2 +- src/skill.c | 3 ++- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main.c b/src/main.c index 31dfd29..68694a5 100644 --- a/src/main.c +++ b/src/main.c @@ -770,23 +770,20 @@ run_game_update(void) map_set_current_room(gMap, &gPlayer->sprite->pos); map_update(&updateData); - bool turnSwitch = false; if (currentTurn == PLAYER) { if (player_turn_over(gPlayer)) { currentTurn = MONSTER; player_reset_steps(gPlayer); map_on_new_turn(gMap); - turnSwitch = true; } } else if (currentTurn == MONSTER) { if (map_move_monsters(gMap, gRoomMatrix)) { currentTurn = PLAYER; - } } - if (map_clear_expired_entities(gMap, gPlayer) || turnSwitch) - repopulate_roommatrix(); + map_clear_expired_entities(gMap, gPlayer); + repopulate_roommatrix(); } static void diff --git a/src/player.c b/src/player.c index c464f91..fb4ed8c 100644 --- a/src/player.c +++ b/src/player.c @@ -99,9 +99,11 @@ action_spent(Player *p) p->stat_data.steps++; p->stat_data.total_steps++; - for (size_t i = 0; i < PLAYER_SKILL_COUNT; ++i) { - if (p->skills[i] != NULL && p->skills[i]->resetCountdown > 0) - p->skills[i]->resetCountdown--; + if (p->stat_data.steps >= p->stats.speed) { + for (size_t i = 0; i < PLAYER_SKILL_COUNT; ++i) { + if (p->skills[i] != NULL && p->skills[i]->resetCountdown > 0) + p->skills[i]->resetCountdown--; + } } } diff --git a/src/projectile.c b/src/projectile.c index 04facad..d54b295 100644 --- a/src/projectile.c +++ b/src/projectile.c @@ -109,7 +109,7 @@ projectile_update(Projectile *p, UpdateData *data) p->processedSpaces[roomPos.x][roomPos.y] = true; RoomSpace *space = &data->matrix->spaces[roomPos.x][roomPos.y]; - if (!space->occupied) + if (!space->occupied && !space->monster) return; if (space->player) diff --git a/src/skill.c b/src/skill.c index 835a086..c990256 100644 --- a/src/skill.c +++ b/src/skill.c @@ -379,11 +379,12 @@ skill_trip(Skill *skill, SkillData *data) RoomSpace *space = &data->matrix->spaces[targetPos.x][targetPos.y]; mixer_play_effect(SWING0 + get_random(2)); if (space->monster) { - monster_push(space->monster, data->player, data->matrix, data->direction); + mixer_play_effect(SWORD_HIT); int dmg = stats_fight(&data->player->stats, &space->monster->stats); gui_log("You trip %s causing it to fall away from you", space->monster->lclabel); monster_hit(space->monster, dmg); player_monster_kill_check(data->player, space->monster); + monster_push(space->monster, data->player, data->matrix, data->direction); } else { gui_log("You flail at the air");