1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
This commit is contained in:
Laserlicht 2024-08-04 17:52:40 +02:00
parent 072af5bd6d
commit 47327e1642
4 changed files with 15 additions and 8 deletions

View File

@ -1060,11 +1060,9 @@ void CCastleBuildings::enterAnyThievesGuild()
void CCastleBuildings::enterBank()
{
//town
LOCPLINT->cb->triggerTownSpecialBuildingAction(town, BuildingSubID::BANK);
LOCPLINT->showInfoDialog(CGI->generaltexth->translate("vcmi.adventureMap.noTownWithTavern"));
//LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[214], onYes, onNo, components);
std::vector<std::shared_ptr<CComponent>> components;
components.push_back(std::make_shared<CComponent>(ComponentType::RESOURCE, GameResID::GOLD, 2500));
LOCPLINT->showYesNoDialog(CGI->generaltexth->translate("vcmi.adventureMap.noTownWithTavern"), [this](){ LOCPLINT->cb->triggerTownSpecialBuildingAction(town, BuildingSubID::BANK); }, nullptr, components);
}
void CCastleBuildings::enterAnyMarket()

View File

@ -619,6 +619,14 @@ void CGTownInstance::newTurn(vstd::RNG & rand) const
for(const auto * rewardableBuilding : getBonusingBuildings(BuildingSubID::CUSTOM_VISITING_REWARD))
rewardableBuilding->newTurn(rand);
if(hasBuilt(BuildingSubID::BANK) && bonusValue.second > 0)
{
TResources res;
res[EGameResID::GOLD] = -500;
cb->giveResources(getOwner(), res);
cb->setObjPropertyValue(id, ObjProperty::BONUS_VALUE_SECOND, bonusValue.second - 500);
}
}
/*
int3 CGTownInstance::getSightCenter() const

View File

@ -66,7 +66,7 @@ public:
std::vector<SpellID> possibleSpells, obligatorySpells;
std::vector<std::vector<SpellID> > spells; //spells[level] -> vector of spells, first will be available in guild
std::list<CCastleEvent> events;
std::pair<si32, si32> bonusValue;//var to store town bonuses (rampart = resources from mystic pond);
std::pair<si32, si32> bonusValue;//var to store town bonuses (rampart = resources from mystic pond, factory = save debts);
//////////////////////////////////////////////////////////////////////////
template <typename Handler> void serialize(Handler &h)

View File

@ -2481,12 +2481,13 @@ bool CGameHandler::triggerTownSpecialBuildingAction(ObjectInstanceID tid, Buildi
if(!hasBuilding)
return false;
if(sid == BuildingSubID::EBuildingSubID::BANK)
{
TResources res;
res[EGameResID::GOLD] = 2500;
giveResources(t->getOwner(), res);
setObjPropertyValue(t->id, ObjProperty::BONUS_VALUE_SECOND, 2500);
}
return true;