Fixes some minor bugs caused by coding without testing

This commit is contained in:
Linus Probert 2018-09-13 23:45:33 +02:00
parent 60359d8e9c
commit 583a7d049d
4 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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--;
}
}
}

View File

@ -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)

View File

@ -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");