User Tools

Site Tools


designer_workshop:proposed:factory_caps

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
designer_workshop:proposed:factory_caps [2013/09/07 14:30]
M57
designer_workshop:proposed:factory_caps [2013/10/26 09:33] (current)
Line 1: Line 1:
 ====== Factory Caps ====== ====== Factory Caps ======
-The normal bonus is calculated for the factory.  If applying that bonus to the territory would leave you over the limit, then you set the bonus to the larger of the amount needed to leave you at the limit, and 0.  Then (presumably) that factory bonus is added to the territory, and you move on to the next.+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.
  
-So if the cap is 5, the factory gives +3 and the territory has units, then the factoryBonus is set to 3.  But because 5 < + 3 it is reduced to max(- 3, 0) which is 2.  And then 2 units are added to that territoryleaving it at 5 troops, and you move on to the next factory.+Here are cases.  Suppose that a +3 factory has a cap of 5.  If you have 1 or 2 units, you just add more.  If you have 3-4 units, you'll add to the cap at 5.  And with 5+ units the bonus is 0so no change.
  
-The only case of potential interest which is not addressed is the case of negative factory with a cap.  The intent if someone tries that is presumably to drain troops until you hit the cap.  However the mechanic being offered here will always work out to a factory bonus of 0.  Whether that somewhat separate mechanic should be covered by this feature is a decision that should be made.+A negative cap works similarly.  Suppose that the above factory was -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.
 <code> <code>
 if (factoryBonus + territoryUnits) > factoryMax: if (factoryBonus + territoryUnits) > factoryMax:
-   factoryBonus max(factoryMax-territoryUnits,0)+   factory_bonus mid(factoryBonus, 0, factoryCap - territoryTroops)
 </code> </code>
designer_workshop/proposed/factory_caps.1378578650.txt.gz · Last modified: 2013/10/26 09:33 (external edit)