1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-23 12:08:45 +02:00

fixed and cleanup

This commit is contained in:
AlexVinS 2017-07-08 21:20:38 +03:00
parent 4f14f22d3a
commit 7bf8c9bd69
5 changed files with 19 additions and 20 deletions

View File

@ -710,9 +710,8 @@ void CPlayerInterface::battleStacksHealedRes(const std::vector<std::pair<ui32, u
battleInt->displayEffect(52, attacker->position); //TODO: transparency battleInt->displayEffect(52, attacker->position); //TODO: transparency
CCS->soundh->playSound(soundBase::DRAINLIF); CCS->soundh->playSound(soundBase::DRAINLIF);
int textID = CGI->generaltexth->pluralText(361, attacker->getCount());
MetaString text; MetaString text;
text.addTxt(MetaString::GENERAL_TXT, textID); attacker->addText(text, MetaString::GENERAL_TXT, 361);
attacker->addNameReplacement(text, false); attacker->addNameReplacement(text, false);
text.addReplacement(healedStacks[0].second); text.addReplacement(healedStacks[0].second);
defender->addNameReplacement(text, true); defender->addNameReplacement(text, true);

View File

@ -1365,20 +1365,20 @@ void CBattleInterface::battleStacksEffectsSet(const SetStackEffect & sse)
{ {
//defensive stance //defensive stance
const CStack * stack = LOCPLINT->cb->battleGetStackByID(*sse.stacks.begin()); const CStack * stack = LOCPLINT->cb->battleGetStackByID(*sse.stacks.begin());
if(stack)
int textId = CGI->generaltexth->pluralText(120, stack->getCount()); {
BonusList defenseBonuses = *(stack->getBonuses(Selector::typeSubtype(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE))); BonusList defenseBonuses = *(stack->getBonuses(Selector::typeSubtype(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE)));
defenseBonuses.remove_if(Bonus::UntilGetsTurn); //remove bonuses gained from defensive stance defenseBonuses.remove_if(Bonus::UntilGetsTurn); //remove bonuses gained from defensive stance
int val = stack->Defense() - defenseBonuses.totalValue(); int val = stack->Defense() - defenseBonuses.totalValue();
MetaString text; MetaString text;
text.addTxt(MetaString::GENERAL_TXT, textId); stack->addText(text, MetaString::GENERAL_TXT, 120);
stack->addNameReplacement(text); stack->addNameReplacement(text);
text.addReplacement(val); text.addReplacement(val);
console->addText(text.toString()); console->addText(text.toString());
} }
} }
}
if(activeStack != nullptr) if(activeStack != nullptr)
redrawBackgroundWithHexes(activeStack); redrawBackgroundWithHexes(activeStack);
@ -1752,7 +1752,7 @@ void CBattleInterface::printConsoleAttacked(const CStack * defender, int dmg, in
if(attacker) //ignore if stacks were killed by spell if(attacker) //ignore if stacks were killed by spell
{ {
MetaString text; MetaString text;
text.addTxt(MetaString::GENERAL_TXT, CGI->generaltexth->pluralText(376, attacker->getCount())); attacker->addText(text, MetaString::GENERAL_TXT, 376);
attacker->addNameReplacement(text); attacker->addNameReplacement(text);
text.addReplacement(dmg); text.addReplacement(dmg);
formattedText = text.toString(); formattedText = text.toString();

View File

@ -90,11 +90,11 @@ TBonusListPtr CBonusProxy::get() const
{ {
if(CBonusSystemNode::treeChanged != cachedLast || !data) if(CBonusSystemNode::treeChanged != cachedLast || !data)
{ {
//TODO: support limiters
data = target->getAllBonuses(selector, nullptr); data = target->getAllBonuses(selector, nullptr);
data->eliminateDuplicates(); data->eliminateDuplicates();
cachedLast = CBonusSystemNode::treeChanged; cachedLast = CBonusSystemNode::treeChanged;
} }
return data; return data;
} }

View File

@ -12,7 +12,7 @@
BattleAttackInfo::BattleAttackInfo(const CStack * Attacker, const CStack * Defender, bool Shooting): BattleAttackInfo::BattleAttackInfo(const CStack * Attacker, const CStack * Defender, bool Shooting):
attackerHealth(Attacker), defenderHealth(Defender) //todo: copy attackerHealth(Attacker->health), defenderHealth(Defender->health)
{ {
attacker = Attacker; attacker = Attacker;
defender = Defender; defender = Defender;