For random ability selection in my code I iterate over ability slots 0 through 23 and check if they can be leveled to select a valid one. Code below
CanAbilityBeUpgraded() works correctly with the exception of "Talents". It does correctly enable talents as possible upgrades starting at level 10 (not listed as upgradable before that) but it list all of them at 10.
The first three errors are:
1) At level 10, only Tier 1 talents should pass the "CanAbilityBeUpgraded()" function, not all Tiers
2) Even after picking a Tier 1 talent, the other (unchosen) Tier 1 talent passes "CanAbilityBeUpgraded()" evaluation, it should not
3) At level 11, even when selected a Tier 1 talent at 10, Tier 2-4 talents all pass the "CanAbilityBeUpgraded()" evaluation, none of them should pass until Level 15 when Tier 2 become available
Another run, my bot randomly picked a Tier 3 talent at level 10 and it consumes the "skill point" but fails to obviously level ability.
You get a `[Server] Client (account 0) tried to execute invalid order (13). Hero does not have any ability points to upgrade the ability.`
This is also a bug, if you try to "level an ability" and the selection is invalid, it should at minimum refund the ability point back.
Bug #4
4) Leveling a talent that you should not be allowed to consume the Ability Point, throws an error, but does not refund the Ability Point
Now, I realize, I can track all this and code around it locally, but I was trying really hard not to make code dependent on any custom handling of abilities.
Code:
function U.GetAbilities(hUnit, bCanLevelUp) local bCanLevelUp = bCanLevelUp or false local ret = {} -- Slots range from 0 to 23 according to Valve documentation for i=0,23 do local hAbility = hUnit:GetAbilityInSlot(i) if hAbility then if bCanLevelUp then if hAbility:CanAbilityBeUpgraded() and not hAbility:IsHidden() then --print("Adding ", hAbility:GetName()) table.insert(ret, hAbility:GetName()) end else table.insert(ret, hAbility:GetName()) end end end return ret end
The first three errors are:
1) At level 10, only Tier 1 talents should pass the "CanAbilityBeUpgraded()" function, not all Tiers
2) Even after picking a Tier 1 talent, the other (unchosen) Tier 1 talent passes "CanAbilityBeUpgraded()" evaluation, it should not
3) At level 11, even when selected a Tier 1 talent at 10, Tier 2-4 talents all pass the "CanAbilityBeUpgraded()" evaluation, none of them should pass until Level 15 when Tier 2 become available
Another run, my bot randomly picked a Tier 3 talent at level 10 and it consumes the "skill point" but fails to obviously level ability.
You get a `[Server] Client (account 0) tried to execute invalid order (13). Hero does not have any ability points to upgrade the ability.`
This is also a bug, if you try to "level an ability" and the selection is invalid, it should at minimum refund the ability point back.
Bug #4
4) Leveling a talent that you should not be allowed to consume the Ability Point, throws an error, but does not refund the Ability Point
Now, I realize, I can track all this and code around it locally, but I was trying really hard not to make code dependent on any custom handling of abilities.