mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Added "days since start of the game" limiter. Fixes Water Wheel
This commit is contained in:
parent
ca521fb129
commit
c793527b44
@ -184,9 +184,14 @@
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
"limiter" : { "daysPassed" : 8 },
|
||||
"message" : 164,
|
||||
"resources" : { "gold" : 1000 }
|
||||
}
|
||||
{
|
||||
"message" : 164,
|
||||
"resources" : { "gold" : 500 }
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ TRewardLimitersList CRandomRewardObjectInfo::configureSublimiters(CRewardableObj
|
||||
void CRandomRewardObjectInfo::configureLimiter(CRewardableObject * object, CRandomGenerator & rng, CRewardLimiter & limiter, const JsonNode & source) const
|
||||
{
|
||||
limiter.dayOfWeek = JsonRandom::loadValue(source["dayOfWeek"], rng);
|
||||
limiter.daysPassed = JsonRandom::loadValue(source["daysPassed"], rng);
|
||||
limiter.minLevel = JsonRandom::loadValue(source["minLevel"], rng);
|
||||
limiter.manaPercentage = JsonRandom::loadValue(source["manaPercentage"], rng);
|
||||
limiter.manaPoints = JsonRandom::loadValue(source["manaPoints"], rng);
|
||||
|
@ -30,6 +30,12 @@ bool CRewardLimiter::heroAllowed(const CGHeroInstance * hero) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if(daysPassed != 0)
|
||||
{
|
||||
if (IObjectInterface::cb->getDate(Date::DAY) < daysPassed)
|
||||
return false;
|
||||
}
|
||||
|
||||
for(auto & reqStack : creatures)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
@ -30,6 +30,7 @@ class DLL_LINKAGE CRewardLimiter
|
||||
public:
|
||||
/// day of week, unused if 0, 1-7 will test for current day of week
|
||||
si32 dayOfWeek;
|
||||
si32 daysPassed;
|
||||
|
||||
/// level that hero needs to have
|
||||
si32 minLevel;
|
||||
@ -65,6 +66,7 @@ public:
|
||||
|
||||
CRewardLimiter():
|
||||
dayOfWeek(0),
|
||||
daysPassed(0),
|
||||
minLevel(0),
|
||||
primary(4, 0)
|
||||
{}
|
||||
@ -74,6 +76,7 @@ public:
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & dayOfWeek;
|
||||
h & daysPassed;
|
||||
h & minLevel;
|
||||
h & manaPoints;
|
||||
h & manaPercentage;
|
||||
|
Loading…
x
Reference in New Issue
Block a user