Ticket #2009: building-arrows.diff

File building-arrows.diff, 630 bytes (added by sanderd17, 11 years ago)
  • binaries/data/mods/public/simulation/components/BuildingAI.js

     
    237237        else
    238238        {
    239239            //Fire N arrows, 0 <= N <= Number of arrows left
    240             arrowsToFire = Math.floor(Math.random() * this.arrowsLeft);
     240            arrowsToFire = Math.min(
     241                Math.round(2*Math.random() * this.GetArrowCount()/roundCount),
     242                this.arrowsLeft
     243            );
    241244        }
    242245        if (this.targetUnits.length > 0)
    243246        {