User Tools

Site Tools


designer_workshop:proposed:factory_caps

Factory Caps

The normal bonus is calculated for the factory. If applying that bonus to the territory would push you past the limit, then you set the bonus to what will leave you at the limit. If you are already past the limit, the bonus is made 0. Then (presumably) that factory bonus is added to the territory, and you move on to the next.

Here are cases. Suppose that a +3 factory has a cap of 5. If you have 1 or 2 units, you just add 3 more. If you have 3-4 units, you'll add to the cap at 5. And with 5+ units the bonus is 0, so no change.

A negative cap works similarly. Suppose that the above factory was a -3 factory with a cap of 5. If you have less than 5 units, then nothing happens. With 6 or 7 units you're reduced to 5. And with 8+ units you're reduced by 3.

Here is slightly non-obvious code to implement this.

if (factoryBonus + territoryUnits) > factoryMax:
   factory_bonus = mid(factoryBonus, 0, factoryCap - territoryTroops)
designer_workshop/proposed/factory_caps.txt · Last modified: 2013/10/26 09:33 (external edit)