1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

Merge pull request #383 from godric3/text_fixes

Text fixes
This commit is contained in:
ArseniyShestakov 2017-10-06 17:20:55 +03:00 committed by GitHub
commit 185631e94a
4 changed files with 32 additions and 13 deletions

View File

@ -389,6 +389,18 @@ void MoraleLuckBox::set(const IBonusBearer *node)
text += CGI->generaltexth->arraytxt[noneTxtId];
bonusValue = 0;
}
else if(morale && node && node->hasBonusOfType(Bonus::NO_MORALE))
{
auto noMorale = node->getBonus(Selector::type(Bonus::NO_MORALE));
text += "\n" + noMorale->Description();
bonusValue = 0;
}
else if (!morale && node && node->hasBonusOfType(Bonus::NO_LUCK))
{
auto noLuck = node->getBonus(Selector::type(Bonus::NO_LUCK));
text += "\n" + noLuck->Description();
bonusValue = 0;
}
else if(modifierList->empty())
text += CGI->generaltexth->arraytxt[noneTxtId];//no modifiers
else

View File

@ -14,6 +14,7 @@
#include "../NetPacks.h"
#include "../filesystem/Filesystem.h"
#include "../mapObjects/CGTownInstance.h"
#include "../CGeneralTextHandler.h"
const CStack * BattleInfo::getNextStack() const
{
@ -561,25 +562,35 @@ BattleInfo * BattleInfo::setupBattle(int3 tile, ETerrainType terrain, BFieldType
}
case BFieldType::HOLY_GROUND:
{
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, +1, battlefieldType, 0)->addLimiter(good));
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, -1, battlefieldType, 0)->addLimiter(evil));
std::string goodArmyDesc = VLC->generaltexth->arraytxt[123];
goodArmyDesc.erase(goodArmyDesc.size() - 2, 2); //omitting hardcoded +1 in description
std::string evilArmyDesc = VLC->generaltexth->arraytxt[124];
evilArmyDesc.erase(evilArmyDesc.size() - 2, 2);
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, +1, battlefieldType, goodArmyDesc, 0)->addLimiter(good));
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, -1, battlefieldType, evilArmyDesc, 0)->addLimiter(evil));
break;
}
case BFieldType::CLOVER_FIELD:
{ //+2 luck bonus for neutral creatures
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::LUCK, Bonus::TERRAIN_OVERLAY, +2, battlefieldType, 0)->addLimiter(neutral));
std::string desc = VLC->generaltexth->arraytxt[83];
desc.erase(desc.size() - 2, 2);
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::LUCK, Bonus::TERRAIN_OVERLAY, +2, battlefieldType, desc, 0)->addLimiter(neutral));
break;
}
case BFieldType::EVIL_FOG:
{
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, -1, battlefieldType, 0)->addLimiter(good));
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, +1, battlefieldType, 0)->addLimiter(evil));
std::string goodArmyDesc = VLC->generaltexth->arraytxt[126];
goodArmyDesc.erase(goodArmyDesc.size() - 2, 2);
std::string evilArmyDesc = VLC->generaltexth->arraytxt[125];
evilArmyDesc.erase(evilArmyDesc.size() - 2, 2);
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, -1, battlefieldType, goodArmyDesc, 0)->addLimiter(good));
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, +1, battlefieldType, evilArmyDesc, 0)->addLimiter(evil));
break;
}
case BFieldType::CURSED_GROUND:
{
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::NO_MORALE, Bonus::TERRAIN_OVERLAY, 0, battlefieldType, 0));
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::NO_LUCK, Bonus::TERRAIN_OVERLAY, 0, battlefieldType, 0));
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::NO_MORALE, Bonus::TERRAIN_OVERLAY, 0, battlefieldType, VLC->generaltexth->arraytxt[112], 0));
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::NO_LUCK, Bonus::TERRAIN_OVERLAY, 0, battlefieldType, VLC->generaltexth->arraytxt[81], 0));
curB->addNewBonus(std::make_shared<Bonus>(Bonus::ONE_BATTLE, Bonus::BLOCK_MAGIC_ABOVE, Bonus::TERRAIN_OVERLAY, 1, battlefieldType, 0, Bonus::INDEPENDENT_MIN));
break;
}

View File

@ -1133,12 +1133,7 @@ bool CGTownInstance::addBonusIfBuilt(BuildingID building, Bonus::BonusType type,
if(hasBuilt(building))
{
std::ostringstream descr;
descr << town->buildings.at(building)->Name() << " ";
if(val > 0)
descr << "+";
else if(val < 0)
descr << "-";
descr << val;
descr << town->buildings.at(building)->Name();
auto b = std::make_shared<Bonus>(Bonus::PERMANENT, type, Bonus::TOWN_STRUCTURE, val, building, descr.str(), subtype);
if(prop)

View File

@ -891,6 +891,7 @@ void CGOnceVisitable::initObj(CRandomGenerator & rand)
loadRandomArtifact(rand, info[0], 10, 10, 0, 0);
info[0].limiter.numOfGrants = 1;
info[0].message.addTxt(MetaString::ADVOB_TXT, 155);
info[0].message.addReplacement(VLC->arth->artifacts[info[0].reward.artifacts.back()]->Name());
}
else if(hlp < 90) //2 - 5 of non-gold resource
{