Instead of making an ability with 100 levels, you could simply have 7 different abilities of
Item Attack Speed Bonus (Gloves of Haste) with 1 level each. I'd say that's much less data needed compared to having 1 ability with 100 levels. With these 7 abilities, you could possibly reach up until 127% increased attack speed (2^7 - 1). So the 7 abilities would have the following values:
Ability 7 - 64%
Ability 6 - 32%
Ability 5 - 16%
Ability 4 - 8%
Ability 3 - 4%
Ability 2 - 2%
Ability 1 - 1%
Hence, total max attack speed would be
127%. How does this work? If you know binaries, then you can skip the explanation ahead.
Now, notice that each value of the abilities are powers of 2. Ability 1 has 2^0. Ability 2 has 2^1. And so the list goes on.
So let's say you want a value of 70%. You would have Abilities
7, 3, 2 added to your hero and the rest removed (64 + 4 + 2 = 70%).
How about a value like 53%? Would be Abilities
6, 5, 3, 1 added to your hero and the rest removed (32 + 16 + 4 + 1 = 53%).
So you may understand the logic somewhat, now to convert this logic into an actual program. Essentially, what you need to do is loop the number of times equal to the number of abilities that you have. For this case, you would loop a total of 7 times. In every loop, what you would do is to take your current value and divide by the ability's value. Since it's a division between integers, you will only get a return value of 1 or 0. Recall that decimal places are truncated/cut-off for integer division. So 100/64 would be 1 and 12/16 for example would be 0. If the value is a 1, you simply add that ability to the hero. On the flip side, if it's a zero, you remove the ability from the hero. Finally, you would take your current value and minus off the ability's value, only if the division value was 1. I don't currently have my WC3 Editor with me, so will write a simple pseudo-code instead:
JASS:
int i = 6 // number of loops to be performed (including 0)
int abilityVal = 2^i // which is 64 here
int currentVal = 77 // the value which you want to set it to
// assume that we have an array of integer called ABILITIES
// set up your abilities in an array, highest index should be your highest ability value:
ABILITIES[6] = <ability id of Ability 7>
ABILITIES[5] = <ability id of Ability 6>
ABILITIES[4] = <ability id of Ability 5>
ABILITIES[3] = <ability id of Ability 4>
ABILITIES[2] = <ability id of Ability 3>
ABILITIES[1] = <ability id of Ability 2>
ABILITIES[0] = <ability id of Ability 1>
loop
if (currentVal / abilityVal == 0) then
remove ABILITIES[i] from your hero
else
add ABILITIES[i] to your hero
currentVal = currentVal - abilityVal
endif
exitwhen i == 0 // we have successfully reached the end of the loop!
i = i - 1 // decrement our loop counter by 1
abilityVal = abilityVal / 2
endloop
So let's do a step by step of the loop for let's say a value of 73% desired attack speed.
Initial:
i = 6
abilityVal = 64
currentVal = 73
Loop 1:
So we first check if
currentVal divided by
abilityVal is equal to zero. 73 / 64 = 1, hence we add Ability 7 to our hero and we minus
currentVal by
abilityVal (73 - 64). Our hero now has a total of
64% attack speed. At the end of the loop:
i = 5
currentVal = 73- 64 = 9
abilityVal = 64 / 2 = 32
Loop 2:
Same thing as the first loop, check if
currentVal divided by
abilityVal is equal to zero. 9 / 32 = 0, hence we remove Ability 6 from our hero, and our
currentVal is unchanged. Our hero still has a total of
64% attack speed. At the end of the loop:
i = 4
currentVal = 9
abilityVal = 32 / 2 = 16
Loop 3:
9 / 16 = 0, hence we remove Ability 5 from our hero, and our
currentVal is unchanged. Our hero still has a total of
64% attack speed. At the end of the loop:
i = 3
currentVal = 9
abilityVal = 16 / 2 = 8
Loop 4:
9 / 8 = 1, hence we add Ability 4 to our hero and we minus
currentVal by
abilityVal (9 - 8). Our hero now has a total of
72% (64 + 8) attack speed. At the end of the loop:
i = 2
currentVal = 9 - 8 = 1
abilityVal = 8 / 2 = 4
Loop 5:
1 / 4 = 0, hence we remove Ability 3 from our hero, and our
currentVal is unchanged. Our hero still has a total of 72
% attack speed. At the end of the loop:
i = 1
currentVal = 1
abilityVal = 4 / 2 = 2
Loop 6:
1 / 2 = 0, hence we remove Ability 2 from our hero, and our
currentVal is unchanged. Our hero still has a total of 72
% attack speed. At the end of the loop:
i = 0
currentVal = 1
abilityVal = 2 / 2 = 1
Loop 7:
1 / 1 = 1, hence we add Ability 1 to our hero and we minus
currentVal by
abilityVal (1 - 1). Our hero now has a total of
73% (64 + 8 + 1) attack speed. The loop is then exited due to the exit condition.
Although this method might be more complex than having a single ability with 100 levels, but it's way more flexible. For example, you can add another ability, Ability 8 with the value of 128 and would push the attack speed limit up to 255. With 9 Abilities, you can reach 511 attack speed, which is past the attack speed limit of Warcraft (400%). So instead of potentially having an ability with 400 levels for the attack speed cap, you could have 9 Abilities with 1 level each. Hope this helps!