1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Fixes based on review remarks

This commit is contained in:
MichalZr6 2024-08-07 19:36:16 +02:00
parent 5c6abb30c6
commit 303b0a6552
6 changed files with 34 additions and 16 deletions

View File

@ -283,9 +283,6 @@
"vcmi.adventureMap.revisitObject.hover" : "Revisit Object",
"vcmi.adventureMap.revisitObject.help" : "{Revisit Object}\n\nIf a hero currently stands on a Map Object, he can revisit the location.",
"vcmi.adventureMap.miniHillFort.notAvailableUpgrade.message" : "This building cannot upgrade creatures of level 5 and higher.",
"vcmi.adventureMap.miniHillFort.statusBar.info" : "Upgrade creatures levels 1 - 5 at double the normal price",
"vcmi.adventureMap.HillFort.statusBar.info" : "Upgrades creatures. Levels 1 - 4 are less expensive than in associated town",
"vcmi.battleWindow.pressKeyToSkipIntro" : "Press any key to start battle immediately",
"vcmi.battleWindow.damageEstimation.melee" : "Attack %CREATURE (%DAMAGE).",
@ -519,7 +516,9 @@
"core.seerhut.quest.reachDate.visit.3" : "Closed till %s.",
"core.seerhut.quest.reachDate.visit.4" : "Closed till %s.",
"core.seerhut.quest.reachDate.visit.5" : "Closed till %s.",
"mapObject.core.hillFort.object.description" : "Upgrades creatures. Levels 1 - 4 are less expensive than in associated town",
"core.bonus.ADDITIONAL_ATTACK.name": "Double Strike",
"core.bonus.ADDITIONAL_ATTACK.description": "Attacks twice",
"core.bonus.ADDITIONAL_RETALIATION.name": "Additional retaliations",

View File

@ -280,9 +280,6 @@
"vcmi.adventureMap.revisitObject.hover" : "Odwiedź obiekt ponownie",
"vcmi.adventureMap.revisitObject.help" : "{Odwiedź obiekt ponownie}\n\nJeżeli bohater aktualnie stoi na polu odwiedzającym obiekt za pomocą tego przycisku może go odwiedzić ponownie.",
"vcmi.adventureMap.miniHillFort.notAvailableUpgrade.message" : "Ten budynek nie ma możliwości ulepszenia jednostek poziomu 5 i wyższych.",
"vcmi.adventureMap.miniHillFort.statusBar.info" : "Ulepsza jednostki poziomu 1 - 5 za podwójną cenę",
"vcmi.adventureMap.HillFort.statusBar.info" : "Ulepsza jednostki. Koszt ulepszenia dla poziomów 1 - 4 są bardziej korzystne niż w mieście",
"vcmi.battleWindow.pressKeyToSkipIntro" : "Naciśnij dowolny klawisz by rozpocząć bitwę natychmiastowo",
"vcmi.battleWindow.damageEstimation.melee" : "Atakuj %CREATURE (%DAMAGE).",
@ -516,7 +513,7 @@
"core.seerhut.quest.reachDate.visit.3" : "Zamknięte do %s.",
"core.seerhut.quest.reachDate.visit.4" : "Zamknięte do %s.",
"core.seerhut.quest.reachDate.visit.5" : "Zamknięte do %s.",
"mapObject.core.hillFort.object.description" : "Ulepsza jednostki. Koszt ulepszenia dla poziomów 1 - 4 są bardziej korzystne niż w mieście",
"core.bonus.ADDITIONAL_ATTACK.name": "Podwójne Uderzenie",
"core.bonus.ADDITIONAL_ATTACK.description": "Atakuje dwa razy",
"core.bonus.ADDITIONAL_RETALIATION.name": "Dodatkowy odwet",

View File

@ -1130,10 +1130,7 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance * visitor, const CGObjectI
garr = std::make_shared<CGarrisonInt>(Point(108, 60), 18, Point(), hero, nullptr);
if(object->typeName == "miniHillFort")
statusbar->write(VLC->generaltexth->translate("vcmi.adventureMap.miniHillFort.statusBar.info"));
else if(object->typeName == "hillFort")
statusbar->write(VLC->generaltexth->translate("vcmi.adventureMap.HillFort.statusBar.info"));
statusbar->write(dynamic_cast<const HillFort *>(fort)->getDescriptionToolTip());
updateGarrisons();
}
@ -1273,7 +1270,7 @@ void CHillFortWindow::makeDeal(SlotID slot)
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[314 + offset], std::vector<std::shared_ptr<CComponent>>(), soundBase::sound_todo);
break;
case State::UNAVAILABLE:
LOCPLINT->showInfoDialog(VLC->generaltexth->translate("vcmi.adventureMap.miniHillFort.notAvailableUpgrade.message"),
LOCPLINT->showInfoDialog(dynamic_cast<const HillFort*>(fort)->getUnavailableUpgradeMessage(),
std::vector<std::shared_ptr<CComponent>>(), soundBase::sound_todo);
break;
case State::MAKE_UPGRADE:
@ -1314,10 +1311,10 @@ CHillFortWindow::State CHillFortWindow::getState(SlotID slot)
UpgradeInfo info;
LOCPLINT->cb->fillUpgradeInfo(hero, slot, info);
if (!info.newID.size())
if (info.newID.empty())
{
// new Hill Fort allows upgrades level 5 and below
if (hero->getStack(slot).type->getLevel() >= 5 && hero->getCreature(slot)->hasUpgrades())
// Hill Fort may limit level of upgradeable creatures, e.g. mini Hill Fort from HOTA
if (hero->getCreature(slot)->hasUpgrades())
return State::UNAVAILABLE;
return State::ALREADY_UPGRADED;

View File

@ -683,6 +683,7 @@
"object" : {
"index" : 0,
"aiValue" : 7000,
"description" : "",
"rmg" : {
"zoneLimit" : 1,
"value" : 7000,

View File

@ -11,17 +11,27 @@
#include "HillFortInstanceConstructor.h"
#include "../mapObjects/MiscObjects.h"
#include "../texts/CGeneralTextHandler.h"
VCMI_LIB_NAMESPACE_BEGIN
void HillFortInstanceConstructor::initTypeData(const JsonNode & config)
{
parameters = config;
VLC->generaltexth->registerString(parameters.getModScope(), TextIdentifier(getBaseTextID(), "unavailableUpgradeMessage"), parameters["unavailableUpgradeMessage"].String());
VLC->generaltexth->registerString(parameters.getModScope(), TextIdentifier(getBaseTextID(), "description"), parameters["description"].String());
}
void HillFortInstanceConstructor::initializeObject(HillFort * fort) const
{
fort->upgradeCostPercentage = parameters["upgradeCostFactor"].convertTo<std::vector<int>>();
fort->descriptionToolTip = VLC->generaltexth->translate(TextIdentifier(getBaseTextID(), "description").get());
if (fort->descriptionToolTip.empty())
fort->descriptionToolTip = parameters["description"].String();
fort->unavailableUpgradeMessage = VLC->generaltexth->translate(TextIdentifier(getBaseTextID(), "unavailableUpgradeMessage").get());
if (fort->unavailableUpgradeMessage.empty())
fort->unavailableUpgradeMessage = parameters["unavailableUpgradeMessage"].String();
}
VCMI_LIB_NAMESPACE_END

View File

@ -451,6 +451,8 @@ class DLL_LINKAGE HillFort : public CGObjectInstance, public ICreatureUpgrader
friend class HillFortInstanceConstructor;
std::vector<int> upgradeCostPercentage;
std::string descriptionToolTip;
std::string unavailableUpgradeMessage;
protected:
void onHeroVisit(const CGHeroInstance * h) const override;
@ -459,10 +461,22 @@ protected:
public:
using CGObjectInstance::CGObjectInstance;
const std::string & getDescriptionToolTip() const
{
return descriptionToolTip;
}
const std::string & getUnavailableUpgradeMessage() const
{
return unavailableUpgradeMessage;
}
template <typename Handler> void serialize(Handler &h)
{
h & static_cast<CGObjectInstance&>(*this);
h & upgradeCostPercentage;
h & descriptionToolTip;
h & unavailableUpgradeMessage;
}
};