Code: Select all
Function HarvestRessource(resource, x, y, b, n, realm) Var avail_units := GetUnits(resource, x, y, realm); Var temp := avail_units / b; If (temp > n) temp := n; Endif DepleteUnits(resource, x, y, realm, temp*b); Return temp * b; Endfunction
So b can be interpreted as the cost and n is the maximum amount of such a "cost-block".
In the simplest example you want something like maximum 5 units with a cost of 1 each would need 1,5 as param. It results/depletes 0-5
Or something like get maximum 3 units with a cost of 10 each means as params 10,3. This means possible results/depletions are 0,10,20,30