fixed
1. enemies spawning on the same tile as the player 2. start_turn in the wrong places
This commit is contained in:
@ -109,6 +109,8 @@ game_result game::run() {
|
||||
std::to_string(curr_turn + 1) +
|
||||
" turns!"};
|
||||
|
||||
player->start_turn();
|
||||
|
||||
player->discard_level_effects();
|
||||
|
||||
++curr_level;
|
||||
@ -130,6 +132,8 @@ game_result game::run() {
|
||||
std::to_string(curr_turn + 1) +
|
||||
" turns! Coward!"};
|
||||
|
||||
player->start_turn();
|
||||
|
||||
player->discard_level_effects();
|
||||
|
||||
--curr_level;
|
||||
@ -153,6 +157,7 @@ game_result game::run() {
|
||||
return {in_game, ""};
|
||||
|
||||
default:
|
||||
player->start_turn();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,9 @@ level::level(character *player, RNG *rng, const feature enabled_features):
|
||||
player{player} {
|
||||
auto tiles = map.get_room_list();
|
||||
|
||||
for (size_t i = 0; i < tiles.size(); ++i)
|
||||
remove_from_list(tiles[i], player->get_pos());
|
||||
|
||||
for (size_t i = 0; i < tiles.size(); ++i)
|
||||
remove_from_list(tiles[i], map.get_down_stairs());
|
||||
|
||||
@ -26,6 +29,9 @@ level::level(const std::string &map_data, character *player, RNG *rng,
|
||||
map{player, map_data, rng, enabled_features}, player{player} {
|
||||
auto tiles = map.get_room_list();
|
||||
|
||||
for (size_t i = 0; i < tiles.size(); ++i)
|
||||
remove_from_list(tiles[i], player->get_pos());
|
||||
|
||||
for (size_t i = 0; i < tiles.size(); ++i)
|
||||
remove_from_list(tiles[i], map.get_down_stairs());
|
||||
|
||||
|
@ -122,9 +122,6 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
|
||||
} else if (cmd >= move_north && cmd <= move_southwest) {
|
||||
auto res = move(lvl, pos + MOVE[cmd - move_north]);
|
||||
|
||||
if (res.res == result::moved)
|
||||
start_turn();
|
||||
|
||||
gold g = get_gold_at(pos, lvl->get_glist());
|
||||
gold_cnt += g.amount;
|
||||
|
||||
@ -136,10 +133,6 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
|
||||
} else if (cmd >= apply_north && cmd <= apply_southwest) {
|
||||
auto res = apply(get_potion_at(pos + MOVE[cmd - apply_north],
|
||||
lvl->get_plist()));
|
||||
|
||||
if (res.res == result::applied)
|
||||
start_turn();
|
||||
|
||||
return res;
|
||||
} else if (cmd == apply_panic) {
|
||||
return {result::fine,
|
||||
@ -148,9 +141,6 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
|
||||
enemy_base *tmp = get_enemy_at(pos + MOVE[cmd - attack_north],
|
||||
lvl->get_elist());
|
||||
|
||||
if (tmp != nullptr)
|
||||
start_turn();
|
||||
|
||||
auto res = attack((character *)tmp);
|
||||
|
||||
if (tmp != nullptr && tmp->is_dead()) {
|
||||
@ -165,18 +155,14 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
|
||||
return res;
|
||||
} else if (cmd == up_stairs) {
|
||||
if (lvl->get_up_stairs() == pos &&
|
||||
enabled_features & FEATURE_REVISIT) {
|
||||
start_turn();
|
||||
enabled_features & FEATURE_REVISIT)
|
||||
return {go_up, "PC went up the stairs. "};
|
||||
}
|
||||
|
||||
return {result::fine,
|
||||
"PC tried to fly through the ceiling. "};
|
||||
} else if (cmd == down_stairs) {
|
||||
if (lvl->get_down_stairs() == pos) {
|
||||
start_turn();
|
||||
if (lvl->get_down_stairs() == pos)
|
||||
return {go_down, "PC went down the stairs. "};
|
||||
}
|
||||
|
||||
return {result::fine,
|
||||
"PC tried to dig through the floor. "};
|
||||
|
Reference in New Issue
Block a user