Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: damage console messages #3043

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
12 changes: 6 additions & 6 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7271,7 +7271,7 @@ bool Game::combatChangeHealth(const std::shared_ptr<Creature> &attacker, const s
}
}

std::string attackMsg = fmt::format("{} attack", damage.critical ? "critical " : " ");
std::string attackMsg = fmt::format("{} attack", damage.critical ? " critical" : "");
std::stringstream ss;

if (target->hasCondition(CONDITION_MANASHIELD) && damage.primary.type != COMBAT_UNDEFINEDDAMAGE) {
Expand Down Expand Up @@ -7325,7 +7325,7 @@ bool Game::combatChangeHealth(const std::shared_ptr<Creature> &attacker, const s

if (tmpPlayer == attackerPlayer && attackerPlayer != targetPlayer) {
ss.str({});
ss << ucfirst(target->getNameDescription()) << " loses " << damageString + " mana due to your " << attackMsg << ".";
ss << ucfirst(target->getNameDescription()) << " loses " << damageString + " mana due to your" << attackMsg << ".";

if (!damage.exString.empty()) {
ss << " (" << damage.exString << ")";
Expand All @@ -7340,7 +7340,7 @@ bool Game::combatChangeHealth(const std::shared_ptr<Creature> &attacker, const s
} else if (targetPlayer == attackerPlayer) {
ss << " due to your own " << attackMsg << ".";
} else {
ss << " due to an " << attackMsg << " by " << attacker->getNameDescription() << '.';
ss << " due to an" << attackMsg << " by " << attacker->getNameDescription() << '.';
}
message.type = MESSAGE_DAMAGE_RECEIVED;
message.text = ss.str();
Expand All @@ -7353,7 +7353,7 @@ bool Game::combatChangeHealth(const std::shared_ptr<Creature> &attacker, const s
if (attacker == target) {
ss << (targetPlayer ? targetPlayer->getPossessivePronoun() : "its") << " own attack";
} else {
ss << "an " << attackMsg << " by " << attacker->getNameDescription();
ss << "an" << attackMsg << " by " << attacker->getNameDescription();
}
}
ss << '.';
Expand Down Expand Up @@ -7572,7 +7572,7 @@ void Game::buildMessageAsSpectator(
ss << "its own " << attackMsg << "attack";
}
} else {
ss << article << " " << attackMsg << "attack by " << attacker->getNameDescription();
ss << article << "" << attackMsg << "attack by " << attacker->getNameDescription();
}
}
ss << '.';
Expand Down Expand Up @@ -7614,7 +7614,7 @@ void Game::buildMessageAsAttacker(
std::stringstream &ss, const std::string &damageString
) const {
ss.str({});
ss << ucfirst(target->getNameDescription()) << " loses " << damageString << " due to your " << (damage.critical ? "critical " : " ") << "attack.";
ss << ucfirst(target->getNameDescription()) << " loses " << damageString << " due to your" << (damage.critical ? " critical" : "") << " attack.";
if (damage.extension) {
ss << " " << damage.exString;
}
Expand Down
Loading