SMUnlimited / AMAI

Advanced Melee Artificial Intelligence Mod For Warcraft 3
Other
192 stars 31 forks source link

AddUnitToAntiXX calculate improve #298

Closed jzy-chitong56 closed 2 months ago

jzy-chitong56 commented 2 months ago

you know that I like to increase the weight of technology levels for some unit, or directly use technology levels to calculate weights When its percentage becomes 0 due to a technology level of 0, the count chance still increases by 1, so I suggest not counting writes with a percentage of 0

function AddUnitToAnti%1 takes integer u, integer percent returns nothing
    if percent > 0 then
        set dyanti_%1[totalanti_%1]= u
        set dychance_%1[totalanti_%1]= percent
        set totalanti_%1 = totalanti_%1 + 1
        set totalchance_%1 = totalchance_%1 + percent
    endif
endfunction
SMUnlimited commented 2 months ago

This will rarely have caused an issue, the chance is 0 meaning the unit earlier in the list would have been picked instead of units with 0 chance. If the first ever anti unit is 0 chance, then that's the only time the 0 chance unit could have been picked.