Scale down recruitment cost

If you liked this item, please rate it up on Steam Workshop page.

Author: AlcoholV

Last revision: 5 Jul, 2019 at 18:00 UTC

File size: 63.49 KB

On Steam Workshop

Description:
Feature

It scales down a range of recruitment costs to fit min max values.

– Before (45x difference)
145 (peasant archers) – 6600 (heavy xiliang cavalry, White horse fellows, etc)

– After (22.25x difference)
145 (peasant archers) – 3300 (heavy xiliang cavalry, White horse fellows, etc)

– AI will use top tier units a little better and will also be able to redeploy them well.
It solves some of the problems of AI using only low-cost strategist and not using a high redeployment cost generals.

Using Source

Array.prototype.scaleBetween = function(scaledMin, scaledMax) {
var max = Math.max.apply(Math, this);
var min = Math.min.apply(Math, this);
return this.map(num => (scaledMax-scaledMin)*(num-min)/(max-min)+scaledMin);
}