mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
fixed and cleanup
This commit is contained in:
parent
4f14f22d3a
commit
7bf8c9bd69
@ -710,9 +710,8 @@ void CPlayerInterface::battleStacksHealedRes(const std::vector<std::pair<ui32, u
|
||||
battleInt->displayEffect(52, attacker->position); //TODO: transparency
|
||||
CCS->soundh->playSound(soundBase::DRAINLIF);
|
||||
|
||||
int textID = CGI->generaltexth->pluralText(361, attacker->getCount());
|
||||
MetaString text;
|
||||
text.addTxt(MetaString::GENERAL_TXT, textID);
|
||||
attacker->addText(text, MetaString::GENERAL_TXT, 361);
|
||||
attacker->addNameReplacement(text, false);
|
||||
text.addReplacement(healedStacks[0].second);
|
||||
defender->addNameReplacement(text, true);
|
||||
|
@ -1365,18 +1365,18 @@ void CBattleInterface::battleStacksEffectsSet(const SetStackEffect & sse)
|
||||
{
|
||||
//defensive stance
|
||||
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());
|
||||
|
||||
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();
|
||||
|
||||
MetaString text;
|
||||
text.addTxt(MetaString::GENERAL_TXT, textId);
|
||||
stack->addNameReplacement(text);
|
||||
text.addReplacement(val);
|
||||
console->addText(text.toString());
|
||||
MetaString text;
|
||||
stack->addText(text, MetaString::GENERAL_TXT, 120);
|
||||
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
|
||||
{
|
||||
MetaString text;
|
||||
text.addTxt(MetaString::GENERAL_TXT, CGI->generaltexth->pluralText(376, attacker->getCount()));
|
||||
attacker->addText(text, MetaString::GENERAL_TXT, 376);
|
||||
attacker->addNameReplacement(text);
|
||||
text.addReplacement(dmg);
|
||||
formattedText = text.toString();
|
||||
|
@ -515,7 +515,7 @@ int32_t CGeneralTextHandler::pluralText(const int32_t textIndex, const int32_t c
|
||||
return 0;
|
||||
else if(textIndex < 0)
|
||||
return -textIndex;
|
||||
else if(count == 1)
|
||||
else if(count == 1)
|
||||
return textIndex;
|
||||
else
|
||||
return textIndex + 1;
|
||||
|
@ -90,11 +90,11 @@ TBonusListPtr CBonusProxy::get() const
|
||||
{
|
||||
if(CBonusSystemNode::treeChanged != cachedLast || !data)
|
||||
{
|
||||
data = target->getAllBonuses(selector, nullptr);
|
||||
data->eliminateDuplicates();
|
||||
cachedLast = CBonusSystemNode::treeChanged;
|
||||
//TODO: support limiters
|
||||
data = target->getAllBonuses(selector, nullptr);
|
||||
data->eliminateDuplicates();
|
||||
cachedLast = CBonusSystemNode::treeChanged;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
BattleAttackInfo::BattleAttackInfo(const CStack * Attacker, const CStack * Defender, bool Shooting):
|
||||
attackerHealth(Attacker), defenderHealth(Defender) //todo: copy
|
||||
attackerHealth(Attacker->health), defenderHealth(Defender->health)
|
||||
{
|
||||
attacker = Attacker;
|
||||
defender = Defender;
|
||||
|
Loading…
Reference in New Issue
Block a user