1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Fix double off-by-one bug with CREATURE_GROWTH bonus

This commit is contained in:
Ivan Savenko
2024-01-05 16:57:44 +02:00
parent 480a0f19c0
commit 51b7de4b98
4 changed files with 9 additions and 8 deletions

View File

@@ -1730,7 +1730,7 @@
"bonuses" : [
{
"type" : "CREATURE_GROWTH",
"subtype" : "creatureLevel1",
"subtype" : "creatureLevel2",
"val" : 5,
"propagator": "VISITED_TOWN_AND_VISITOR"
}
@@ -1743,7 +1743,7 @@
"bonuses" : [
{
"type" : "CREATURE_GROWTH",
"subtype" : "creatureLevel2",
"subtype" : "creatureLevel3",
"val" : 4,
"propagator": "VISITED_TOWN_AND_VISITOR"
}
@@ -1756,7 +1756,7 @@
"bonuses" : [
{
"type" : "CREATURE_GROWTH",
"subtype" : "creatureLevel3",
"subtype" : "creatureLevel4",
"val" : 3,
"propagator": "VISITED_TOWN_AND_VISITOR"
}
@@ -1769,7 +1769,7 @@
"bonuses" : [
{
"type" : "CREATURE_GROWTH",
"subtype" : "creatureLevel4",
"subtype" : "creatureLevel5",
"val" : 2,
"propagator": "VISITED_TOWN_AND_VISITOR"
}
@@ -1782,7 +1782,7 @@
"bonuses" : [
{
"type" : "CREATURE_GROWTH",
"subtype" : "creatureLevel5",
"subtype" : "creatureLevel6",
"val" : 1,
"propagator": "VISITED_TOWN_AND_VISITOR"
}

View File

@@ -244,7 +244,7 @@ Increased effect of spell affecting creature, ie. Aenain makes Disrupting Ray de
"subtype" : "spell.disruptingRay",
"type" : "SPECIAL_ADD_VALUE_ENCHANT"
}
``````
```
- subtype: affected spell identifier
- additionalInfo: value to add

View File

@@ -320,7 +320,7 @@ void CGDwelling::newTurn(CRandomGenerator & rand) const
creaturesAccumulate = VLC->settings()->getBoolean(EGameSettings::DWELLINGS_ACCUMULATE_WHEN_NEUTRAL);
const CCreature * cre =creatures[i].second[0].toCreature();
TQuantity amount = cre->getGrowth() * (1 + cre->valOfBonuses(BonusType::CREATURE_GROWTH_PERCENT)/100) + cre->valOfBonuses(BonusType::CREATURE_GROWTH);
TQuantity amount = cre->getGrowth() * (1 + cre->valOfBonuses(BonusType::CREATURE_GROWTH_PERCENT)/100) + cre->valOfBonuses(BonusType::CREATURE_GROWTH, BonusCustomSubtype::creatureLevel(cre->getLevel()));
if (creaturesAccumulate && ID != Obj::REFUGEE_CAMP) //camp should not try to accumulate different kinds of creatures
sac.creatures[i].first += amount;
else

View File

@@ -164,7 +164,8 @@ GrowthInfo CGTownInstance::getGrowthInfo(int level) const
}
//other *-of-legion-like bonuses (%d to growth cumulative with grail)
TConstBonusListPtr bonuses = getBonuses(Selector::typeSubtype(BonusType::CREATURE_GROWTH, BonusCustomSubtype::creatureLevel(level)));
// Note: bonus uses 1-based levels (Pikeman is level 1), town list uses 0-based (Pikeman in 0-th creatures entry)
TConstBonusListPtr bonuses = getBonuses(Selector::typeSubtype(BonusType::CREATURE_GROWTH, BonusCustomSubtype::creatureLevel(level+1)));
for(const auto & b : *bonuses)
ret.entries.emplace_back(b->val, b->Description());