1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Basic config for regular unit placement in Black Tower

This commit is contained in:
Tomasz Zieliński 2024-05-29 20:20:33 +02:00
parent d8f48f2c59
commit 3ac603767d
4 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,7 @@ void CBankInstanceConstructor::initTypeData(const JsonNode & input)
bankResetDuration = static_cast<si32>(input["resetDuration"].Float());
blockVisit = input["blockedVisitable"].Bool();
coastVisitable = input["coastVisitable"].Bool();
regularUnitPlacement = input["regularUnitPlacement"].Bool();
}
BankConfig CBankInstanceConstructor::generateConfig(IGameCallback * cb, const JsonNode & level, CRandomGenerator & rng) const
@ -57,6 +58,7 @@ void CBankInstanceConstructor::randomizeObject(CBank * bank, CRandomGenerator &
bank->resetDuration = bankResetDuration;
bank->blockVisit = blockVisit;
bank->coastVisitable = coastVisitable;
bank->regularUnitPlacement = regularUnitPlacement;
si32 totalChance = 0;
for(const auto & node : levels)

View File

@ -79,6 +79,8 @@ class CBankInstanceConstructor : public CDefaultObjectTypeHandler<CBank>
bool blockVisit;
// bank is visitable from land even when bank is on water tile
bool coastVisitable;
//If true, player units will be placed on the left and enemy on the right
bool regularUnitPlacement;
protected:
void initTypeData(const JsonNode & input) override;

View File

@ -398,7 +398,7 @@ void CBank::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) cons
if (answer)
{
if (bankConfig) // not looted bank
cb->startBattleI(hero, this, true);
cb->startBattleI(hero, this, !regularUnitPlacement);
else
doVisit(hero);
}

View File

@ -22,6 +22,7 @@ class DLL_LINKAGE CBank : public CArmedInstance
ui32 daycounter;
ui32 resetDuration;
bool coastVisitable;
bool regularUnitPlacement;
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;
void doVisit(const CGHeroInstance * hero) const;