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,22 +770,19 @@ run_game_update(void)
map_set_current_room(gMap, &gPlayer->sprite->pos); map_set_current_room(gMap, &gPlayer->sprite->pos);
map_update(&updateData); map_update(&updateData);
bool turnSwitch = false;
if (currentTurn == PLAYER) { if (currentTurn == PLAYER) {
if (player_turn_over(gPlayer)) { if (player_turn_over(gPlayer)) {
currentTurn = MONSTER; currentTurn = MONSTER;
player_reset_steps(gPlayer); player_reset_steps(gPlayer);
map_on_new_turn(gMap); map_on_new_turn(gMap);
turnSwitch = true;
} }
} else if (currentTurn == MONSTER) { } else if (currentTurn == MONSTER) {
if (map_move_monsters(gMap, gRoomMatrix)) { if (map_move_monsters(gMap, gRoomMatrix)) {
currentTurn = PLAYER; currentTurn = PLAYER;
} }
} }
if (map_clear_expired_entities(gMap, gPlayer) || turnSwitch) map_clear_expired_entities(gMap, gPlayer);
repopulate_roommatrix(); repopulate_roommatrix();
} }

View File

@ -99,10 +99,12 @@ action_spent(Player *p)
p->stat_data.steps++; p->stat_data.steps++;
p->stat_data.total_steps++; p->stat_data.total_steps++;
if (p->stat_data.steps >= p->stats.speed) {
for (size_t i = 0; i < PLAYER_SKILL_COUNT; ++i) { for (size_t i = 0; i < PLAYER_SKILL_COUNT; ++i) {
if (p->skills[i] != NULL && p->skills[i]->resetCountdown > 0) if (p->skills[i] != NULL && p->skills[i]->resetCountdown > 0)
p->skills[i]->resetCountdown--; p->skills[i]->resetCountdown--;
} }
}
} }
static void static void

View File

@ -109,7 +109,7 @@ projectile_update(Projectile *p, UpdateData *data)
p->processedSpaces[roomPos.x][roomPos.y] = true; p->processedSpaces[roomPos.x][roomPos.y] = true;
RoomSpace *space = &data->matrix->spaces[roomPos.x][roomPos.y]; RoomSpace *space = &data->matrix->spaces[roomPos.x][roomPos.y];
if (!space->occupied) if (!space->occupied && !space->monster)
return; return;
if (space->player) if (space->player)

View File

@ -379,11 +379,12 @@ skill_trip(Skill *skill, SkillData *data)
RoomSpace *space = &data->matrix->spaces[targetPos.x][targetPos.y]; RoomSpace *space = &data->matrix->spaces[targetPos.x][targetPos.y];
mixer_play_effect(SWING0 + get_random(2)); mixer_play_effect(SWING0 + get_random(2));
if (space->monster) { 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); 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); gui_log("You trip %s causing it to fall away from you", space->monster->lclabel);
monster_hit(space->monster, dmg); monster_hit(space->monster, dmg);
player_monster_kill_check(data->player, space->monster); player_monster_kill_check(data->player, space->monster);
monster_push(space->monster, data->player, data->matrix, data->direction);
} else { } else {
gui_log("You flail at the air"); gui_log("You flail at the air");