1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-15 11:46:56 +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,18 +1365,18 @@ 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)
{
BonusList defenseBonuses = *(stack->getBonuses(Selector::typeSubtype(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE)));
defenseBonuses.remove_if(Bonus::UntilGetsTurn); //remove bonuses gained from defensive stance
int val = stack->Defense() - defenseBonuses.totalValue();
int textId = CGI->generaltexth->pluralText(120, stack->getCount()); MetaString text;
stack->addText(text, MetaString::GENERAL_TXT, 120);
BonusList defenseBonuses = *(stack->getBonuses(Selector::typeSubtype(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE))); stack->addNameReplacement(text);
defenseBonuses.remove_if(Bonus::UntilGetsTurn); //remove bonuses gained from defensive stance text.addReplacement(val);
int val = stack->Defense() - defenseBonuses.totalValue(); console->addText(text.toString());
}
MetaString text;
text.addTxt(MetaString::GENERAL_TXT, textId);
stack->addNameReplacement(text);
text.addReplacement(val);
console->addText(text.toString());
} }
} }
@ -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

@ -515,7 +515,7 @@ int32_t CGeneralTextHandler::pluralText(const int32_t textIndex, const int32_t c
return 0; return 0;
else if(textIndex < 0) else if(textIndex < 0)
return -textIndex; return -textIndex;
else if(count == 1) else if(count == 1)
return textIndex; return textIndex;
else else
return textIndex + 1; return textIndex + 1;

View File

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