Skip to content

Commit

Permalink
fix: message when get hits nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipePaluco committed Jan 18, 2025
1 parent 4bfd4ee commit 9dc0f2a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7635,15 +7635,12 @@ void Game::buildMessageAsTarget(
const std::string &damageString
) const {
ss.str({});
const auto &monster = attacker->getMonster();
const auto &monster = attacker ? attacker->getMonster() : nullptr;
bool handleSoulPit = monster ? monster->getSoulPit() && monster->getForgeStack() == 40 : false;

std::string attackMsg = "";
std::string article = "an";
if (!handleSoulPit && damage.critical) {
attackMsg = "critical";
article = "a";
}
std::string attackMsg = damage.critical && !handleSoulPit ? "critical " : "";
std::string article = damage.critical && !handleSoulPit ? "a" : "an";

ss << "You lose " << damageString;
if (!attacker) {
ss << '.';
Expand Down

0 comments on commit 9dc0f2a

Please sign in to comment.