fixed bugs about throwing, added anger msg for merchants
This commit is contained in:
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user