From 7d8adcc083db888cc5312eb98b107b2f5d1a5231 Mon Sep 17 00:00:00 2001 From: godric3 Date: Thu, 5 Oct 2017 14:52:51 +0200 Subject: [PATCH 1/4] Add missing artifact name in wagon text, fix #2763 --- lib/mapObjects/CRewardableObject.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mapObjects/CRewardableObject.cpp b/lib/mapObjects/CRewardableObject.cpp index abd673581..1bd79e9cf 100644 --- a/lib/mapObjects/CRewardableObject.cpp +++ b/lib/mapObjects/CRewardableObject.cpp @@ -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 { From 2a22d9ec12d06dbd3988d24b9369c5bb65e0344f Mon Sep 17 00:00:00 2001 From: godric3 Date: Thu, 5 Oct 2017 14:53:39 +0200 Subject: [PATCH 2/4] Add terrain overlays morale and luck bonuses description, fix #2740 --- lib/battle/BattleInfo.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/battle/BattleInfo.cpp b/lib/battle/BattleInfo.cpp index bdadb88b1..99f31758f 100644 --- a/lib/battle/BattleInfo.cpp +++ b/lib/battle/BattleInfo.cpp @@ -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::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, +1, battlefieldType, 0)->addLimiter(good)); - curB->addNewBonus(std::make_shared(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::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, +1, battlefieldType, goodArmyDesc, 0)->addLimiter(good)); + curB->addNewBonus(std::make_shared(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::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::ONE_BATTLE, Bonus::LUCK, Bonus::TERRAIN_OVERLAY, +2, battlefieldType, desc, 0)->addLimiter(neutral)); break; } case BFieldType::EVIL_FOG: { - curB->addNewBonus(std::make_shared(Bonus::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, -1, battlefieldType, 0)->addLimiter(good)); - curB->addNewBonus(std::make_shared(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::ONE_BATTLE, Bonus::MORALE, Bonus::TERRAIN_OVERLAY, -1, battlefieldType, goodArmyDesc, 0)->addLimiter(good)); + curB->addNewBonus(std::make_shared(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::ONE_BATTLE, Bonus::NO_MORALE, Bonus::TERRAIN_OVERLAY, 0, battlefieldType, 0)); - curB->addNewBonus(std::make_shared(Bonus::ONE_BATTLE, Bonus::NO_LUCK, Bonus::TERRAIN_OVERLAY, 0, battlefieldType, 0)); + curB->addNewBonus(std::make_shared(Bonus::ONE_BATTLE, Bonus::NO_MORALE, Bonus::TERRAIN_OVERLAY, 0, battlefieldType, VLC->generaltexth->arraytxt[112], 0)); + curB->addNewBonus(std::make_shared(Bonus::ONE_BATTLE, Bonus::NO_LUCK, Bonus::TERRAIN_OVERLAY, 0, battlefieldType, VLC->generaltexth->arraytxt[81], 0)); curB->addNewBonus(std::make_shared(Bonus::ONE_BATTLE, Bonus::BLOCK_MAGIC_ABOVE, Bonus::TERRAIN_OVERLAY, 1, battlefieldType, 0, Bonus::INDEPENDENT_MIN)); break; } From e3f0126e41592d4260c12d640db3be589f921aba Mon Sep 17 00:00:00 2001 From: godric3 Date: Thu, 5 Oct 2017 16:50:39 +0200 Subject: [PATCH 3/4] Removed unnecessary code, fix #2737 bonus value is added to desciption inside Bonus --- lib/mapObjects/CGTownInstance.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/mapObjects/CGTownInstance.cpp b/lib/mapObjects/CGTownInstance.cpp index c1401f296..ec787cad1 100644 --- a/lib/mapObjects/CGTownInstance.cpp +++ b/lib/mapObjects/CGTownInstance.cpp @@ -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::PERMANENT, type, Bonus::TOWN_STRUCTURE, val, building, descr.str(), subtype); if(prop) From f03a0b1151d20de53bc8093d15f1c73e2f4ca32a Mon Sep 17 00:00:00 2001 From: godric3 Date: Thu, 5 Oct 2017 17:13:49 +0200 Subject: [PATCH 4/4] fix #2731, now no morale, and no luck texts show properly --- client/widgets/MiscWidgets.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/widgets/MiscWidgets.cpp b/client/widgets/MiscWidgets.cpp index 775d196ce..5a522ca6d 100644 --- a/client/widgets/MiscWidgets.cpp +++ b/client/widgets/MiscWidgets.cpp @@ -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