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()); in->get_command());
msg = res.msg; msg = res.msg;
if (res.msg.find('M') != std::string::npos) if (!hostile_merchants && res.msg.find('M') != std::string::npos) {
hostile_merchants = true; hostile_merchants = true;
msg += "PC has angered the merchants. ";
}
switch (res.res) { switch (res.res) {
case result::terminate: case result::terminate:

View File

@ -273,8 +273,8 @@ size_t level::what_is_at(const position &pos) const {
if (!map.is_available(pos)) if (!map.is_available(pos))
return WHAT_WALL; return WHAT_WALL;
for (size_t i = 0; i < plist.size(); ++i) for (size_t i = 0; i < elist.size(); ++i)
if (plist[i]->get_pos() == pos) if (elist[i]->get_pos() == pos)
return WHAT_ENEMY | i; return WHAT_ENEMY | i;
return WHAT_SPACE; 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, long_result player_base::throw_potion(level *lvl, std::unique_ptr<potion> p,
direction dir) { direction dir) {
if (p == nullptr) 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}; position tmp{pos};
@ -168,6 +168,7 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
return {result::thrown, return {result::thrown,
"PC tried to throw a vial of air. "}; "PC tried to throw a vial of air. "};
} else { } else {
inv.enabled = false;
return throw_potion(lvl, std::move(res.first), return throw_potion(lvl, std::move(res.first),
(direction)res.second); (direction)res.second);
} }