1. potions being walked over
2. spawning on stairs
3. enemies walking under players
4. merchants not being aggresive
5. potions losing effect when sending pass signal (cleared by player::start_turn())’
This commit is contained in:
2024-07-15 14:41:32 -04:00
parent e561d3bbf4
commit 295b808e14
8 changed files with 72 additions and 18 deletions

View File

@ -83,11 +83,13 @@ character *game::move_enemies() {
}
game_result game::run() {
player->start_turn();
auto res = player->interpret_command(levels[curr_level].get(),
in->get_command());
msg = res.msg;
if (res.msg.find('M') != std::string::npos)
hostile_merchants = true;
switch (res.res) {
case result::terminate:
return {terminated, ""};
@ -99,14 +101,16 @@ game_result game::run() {
if (curr_level == max_level - 1)
return {won, "You won! You collected " +
std::to_string(player->get_gold()) +
" after " + std::to_string(curr_turn + 1) +
" pieces of gold after " +
std::to_string(curr_turn + 1) +
" turns!"};
player->discard_level_effects();
++curr_level;
new_level();
if (curr_level == levels.size())
new_level();
break;
}
@ -115,7 +119,8 @@ game_result game::run() {
if (curr_level == 0)
return {escaped, "You escaped the dungeon with " +
std::to_string(player->get_gold()) +
" after " + std::to_string(curr_turn + 1) +
" pieces of gold after " +
std::to_string(curr_turn + 1) +
" turns! Coward!"};
player->discard_level_effects();
@ -169,6 +174,7 @@ const position STATUS_HP{0, 26};
const position STATUS_ATK{0, 27};
const position STATUS_DEF{0, 28};
const position STATUS_ACTION{0, 29};
const std::string BLANK(DISPLAY_BUFFER_SIZE, ' ');
size_t game::get_curr_turn() const {
return curr_turn;
@ -180,6 +186,8 @@ void game::print() {
msg += "...";
}
out->print_str({0, 0}, BLANK);
levels[curr_level]->print(out);
player->print(out);