fixed bugs about throwing, added anger msg for merchants

This commit is contained in:
2024-07-17 22:14:37 -04:00
parent 1db7e95649
commit 242c1fff65
3 changed files with 7 additions and 4 deletions

View File

@ -92,8 +92,10 @@ game_result game::run() {
in->get_command());
msg = res.msg;
if (res.msg.find('M') != std::string::npos)
if (!hostile_merchants && res.msg.find('M') != std::string::npos) {
hostile_merchants = true;
msg += "PC has angered the merchants. ";
}
switch (res.res) {
case result::terminate:

View File

@ -273,8 +273,8 @@ size_t level::what_is_at(const position &pos) const {
if (!map.is_available(pos))
return WHAT_WALL;
for (size_t i = 0; i < plist.size(); ++i)
if (plist[i]->get_pos() == pos)
for (size_t i = 0; i < elist.size(); ++i)
if (elist[i]->get_pos() == pos)
return WHAT_ENEMY | i;
return WHAT_SPACE;

View File

@ -128,7 +128,7 @@ void player_base::add_gold(int amount) {
long_result player_base::throw_potion(level *lvl, std::unique_ptr<potion> p,
direction dir) {
if (p == nullptr)
return {thrown, "PC tried to throw a vial of air. "};
return {fine, "PC tried to throw a vial of air. "};
position tmp{pos};
@ -168,6 +168,7 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
return {result::thrown,
"PC tried to throw a vial of air. "};
} else {
inv.enabled = false;
return throw_potion(lvl, std::move(res.first),
(direction)res.second);
}