- Joined
- Jul 10, 2007
- Messages
- 6,306
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
boolean UnitAlive(unit) native would probably be easier and far more productive than coming up with your own forms of "optimization".But short variable names are 10x better than long onesI mean, look at all those variable names you're using in UnitIndexer, TimerQueue and even here
Why rewrite something that has already been done in the form of Earth-Fury's BonusMod and Jesus4Lyf's Status?
Off-topic: I really appreciate your work, but sometimes, what you're doing is just irrational and senesless. I mean, look at all those variable names you're using in UnitIndexer, TimerQueue and even here (I'd actually like to see versions of UnitIndexer and TimerQueue with "normal" and descriptive variable names).
struct tester extends array
private static method display takes unit u returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Armor: " + I2S(GetUnitBonus(u,BONUS_ARMOR)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Damage: " + I2S(GetUnitBonus(u,BONUS_DAMAGE)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Agility: " + I2S(GetUnitBonus(u,BONUS_AGILITY)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Strength: " + I2S(GetUnitBonus(u,BONUS_STRENGTH)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Intelligence: " + I2S(GetUnitBonus(u,BONUS_INTELLIGENCE)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Life: " + I2S(GetUnitBonus(u,BONUS_LIFE)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Life Regen: " + I2S(GetUnitBonus(u,BONUS_LIFE_REGEN)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Mana: " + I2S(GetUnitBonus(u,BONUS_MANA)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Mana Regen%: " + I2S(GetUnitBonus(u,BONUS_MANA_REGEN)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Attack Speed%: " + I2S(GetUnitBonus(u,BONUS_ATTACK_SPEED)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Bonus Sight: " + I2S(GetUnitBonus(u,BONUS_SIGHT)))
endmethod
private static method onInit takes nothing returns nothing
local unit u = CreateUnit(Player(0), 'Hpal', WorldBounds.centerX, WorldBounds.centerY, 0)
call SetUnitBonus(u,BONUS_ATTACK_SPEED,27)
call SetUnitBonus(u,BONUS_SIGHT,-27)
call display(u)
endmethod
endstruct
Honestly, I prefer Status, but others may prefer this, so all I have to say: Good Work![]()
Earth-Fury said:Few points...
- Debug mode modifies the behaviour of the system.
- Range checking is only done in debug mode, which requires users to range-check themselves to avoid horrible, horrible errors. Why the heck would you do that, instead of constraining the value and returning the actual applied value?
- A single min/max range means excess abilities end up generated
- The inability to easily disable individual bonus types leads to unused abilities.
- The last two points mean that you're needlessly increasing map load time, and possibly quite substantially. Unless you manually remove abilities, or edit far too much code...
- My version of bonus mod can handle custom bonuses not applied via abilities... at the cost of a single integer comparison per function.
- You don't sanely handle bonus types which can only affect heroes...
- You have a non-optional external dependency
- The BONUS_MANA_REGEN constant is misleadingly named, with only a single "%" sign at the top to tell you it is percentage regen increase, as opposed to BONUS_LIFE_REGEN.
- You completely lack any real form of documentation.
![]()
Your code is less functional and you should feel less functional.
Less function, less robust, and less optimal (Significantly, from a map loading time perspective) code. High standards... on opposite day.
What if you only need two types of ability-based bonuses?
Oh, right... Use BonusMod...
------------------------------
I quite honestly could optimize BonusMod slightly more. But why the hell would I invest effort in heavily optimizing something that will rape you horribly no matter what due to ability adding/removing overhead, and will never be called that often in spite of its actual performance characteristics?
I completely fail to see the point of this library, other than reinventing the wheel for the sake of it... If you're gonna reinvent the wheel, though... At least make it round, for fuck sakes.
Oh, look, a quote just for you.
It's not 20x shorter than status.... you forget the code generated by the Lua : P
//! textmacro BONUS_DATA
globals
private integer array bd
private integer array bp
private integer array pw
private integer array pm
constant integer BONUS_ARMOR=0
constant integer BONUS_DAMAGE=15
constant integer BONUS_AGILITY=33
constant integer BONUS_STRENGTH=49
constant integer BONUS_INTELLIGENCE=65
constant integer BONUS_LIFE=81
constant integer BONUS_LIFE_REGEN=103
constant integer BONUS_MANA=121
constant integer BONUS_MANA_REGEN=143
constant integer BONUS_SIGHT=154
constant integer BONUS_ATTACK_SPEED=167
endglobals
private module I
private static method onInit takes nothing returns nothing
static if PRELOAD then
local unit u = CreateUnit(Player(14),'hpea',100000,100000,0)
call UnitAddAbility(u,'A!(@')
call UnitAddAbility(u,'A!([')
call UnitAddAbility(u,'A!(]')
call UnitAddAbility(u,'A!(^')
call UnitAddAbility(u,'A!(_')
call UnitAddAbility(u,'A!({')
call UnitAddAbility(u,'A!(|')
call UnitAddAbility(u,'A!(}')
call UnitAddAbility(u,'A!(~')
call UnitAddAbility(u,'A!)!')
call UnitAddAbility(u,'A!)"')
call UnitAddAbility(u,'A!)#')
call UnitAddAbility(u,'A!)$')
call UnitAddAbility(u,'A!)%')
call UnitAddAbility(u,'A!)&')
call UnitAddAbility(u,'A!)(')
call UnitAddAbility(u,'A!))')
call UnitAddAbility(u,'A!)*')
call UnitAddAbility(u,'A!)+')
call UnitAddAbility(u,'A!)-')
call UnitAddAbility(u,'A!).')
call UnitAddAbility(u,'A!):')
call UnitAddAbility(u,'A!);')
call UnitAddAbility(u,'A!)<')
call UnitAddAbility(u,'A!)=')
call UnitAddAbility(u,'A!)>')
call UnitAddAbility(u,'A!)?')
call UnitAddAbility(u,'A!)@')
call UnitAddAbility(u,'A!)[')
call UnitAddAbility(u,'A!)]')
call UnitAddAbility(u,'A!)^')
call UnitAddAbility(u,'A!)_')
call UnitAddAbility(u,'A!){')
call UnitAddAbility(u,'A!)|')
call UnitAddAbility(u,'A!)}')
call UnitAddAbility(u,'A!)~')
call UnitAddAbility(u,'A!*!')
call UnitAddAbility(u,'A!*"')
call UnitAddAbility(u,'A!*#')
call UnitAddAbility(u,'A!*$')
call UnitAddAbility(u,'A!*%')
call UnitAddAbility(u,'A!*&')
call UnitAddAbility(u,'A!*(')
call UnitAddAbility(u,'A!*)')
call UnitAddAbility(u,'A!**')
call UnitAddAbility(u,'A!*+')
call UnitAddAbility(u,'A!*-')
call UnitAddAbility(u,'A!*.')
call UnitAddAbility(u,'A!*:')
call UnitAddAbility(u,'A!*;')
call UnitAddAbility(u,'A!*<')
call UnitAddAbility(u,'A!*=')
call UnitAddAbility(u,'A!*>')
call UnitAddAbility(u,'A!*?')
call UnitAddAbility(u,'A!*@')
call UnitAddAbility(u,'A!*[')
call UnitAddAbility(u,'A!*]')
call UnitAddAbility(u,'A!*^')
call UnitAddAbility(u,'A!*_')
call UnitAddAbility(u,'A!*{')
call UnitAddAbility(u,'A!*|')
call UnitAddAbility(u,'A!*}')
call UnitAddAbility(u,'A!*~')
call UnitAddAbility(u,'A!+!')
call UnitAddAbility(u,'A!+"')
call UnitAddAbility(u,'A!+#')
call UnitAddAbility(u,'A!+$')
call UnitAddAbility(u,'A!+%')
call UnitAddAbility(u,'A!+&')
call UnitAddAbility(u,'A!+(')
call UnitAddAbility(u,'A!+)')
call UnitAddAbility(u,'A!+*')
call UnitAddAbility(u,'A!++')
call UnitAddAbility(u,'A!+-')
call UnitAddAbility(u,'A!+.')
call UnitAddAbility(u,'A!+:')
call UnitAddAbility(u,'A!+;')
call UnitAddAbility(u,'A!+<')
call UnitAddAbility(u,'A!+=')
call UnitAddAbility(u,'A!+>')
call UnitAddAbility(u,'A!+?')
call UnitAddAbility(u,'A!+@')
call UnitAddAbility(u,'A!+[')
call UnitAddAbility(u,'A!+]')
call UnitAddAbility(u,'A!+^')
call UnitAddAbility(u,'A!+_')
call UnitAddAbility(u,'A!+{')
call UnitAddAbility(u,'A!+|')
call UnitAddAbility(u,'A!+}')
call UnitAddAbility(u,'A!+~')
call UnitAddAbility(u,'A!-!')
call UnitAddAbility(u,'A!-"')
call UnitAddAbility(u,'A!-#')
call UnitAddAbility(u,'A!-$')
call UnitAddAbility(u,'A!-%')
call UnitAddAbility(u,'A!-&')
call UnitAddAbility(u,'A!-(')
call UnitAddAbility(u,'A!-)')
call UnitAddAbility(u,'A!-*')
call UnitAddAbility(u,'A!-+')
call UnitAddAbility(u,'A!--')
call UnitAddAbility(u,'A!-.')
call UnitAddAbility(u,'A!-:')
call UnitAddAbility(u,'A!-;')
call UnitAddAbility(u,'A!-<')
call UnitAddAbility(u,'A!-=')
call UnitAddAbility(u,'A!->')
call UnitAddAbility(u,'A!-?')
call UnitAddAbility(u,'A!-@')
call UnitAddAbility(u,'A!-[')
call UnitAddAbility(u,'A!-]')
call UnitAddAbility(u,'A!-^')
call UnitAddAbility(u,'A!-_')
call UnitAddAbility(u,'A!-{')
call UnitAddAbility(u,'A!-|')
call UnitAddAbility(u,'A!-}')
call UnitAddAbility(u,'A!-~')
call UnitAddAbility(u,'A!.!')
call UnitAddAbility(u,'A!."')
call UnitAddAbility(u,'A!.#')
call UnitAddAbility(u,'A!.$')
call UnitAddAbility(u,'A!.%')
call UnitAddAbility(u,'A!.&')
call UnitAddAbility(u,'A!.(')
call UnitAddAbility(u,'A!.)')
call UnitAddAbility(u,'A!.*')
call UnitAddAbility(u,'A!.+')
call UnitAddAbility(u,'A!.-')
call UnitAddAbility(u,'A!..')
call UnitAddAbility(u,'A!.:')
call UnitAddAbility(u,'A!.;')
call UnitAddAbility(u,'A!.<')
call UnitAddAbility(u,'A!.=')
call UnitAddAbility(u,'A!.>')
call UnitAddAbility(u,'A!.?')
call UnitAddAbility(u,'A!.@')
call UnitAddAbility(u,'A!.[')
call UnitAddAbility(u,'A!.]')
call UnitAddAbility(u,'A!.^')
call UnitAddAbility(u,'A!._')
call UnitAddAbility(u,'A!.{')
call UnitAddAbility(u,'A!.|')
call UnitAddAbility(u,'A!.}')
call UnitAddAbility(u,'A!.~')
call UnitAddAbility(u,'A!:!')
call UnitAddAbility(u,'A!:"')
call UnitAddAbility(u,'A!:#')
call UnitAddAbility(u,'A!:$')
call UnitAddAbility(u,'A!:%')
call UnitAddAbility(u,'A!:&')
call UnitAddAbility(u,'A!:(')
call UnitAddAbility(u,'A!:)')
call UnitAddAbility(u,'A!:*')
call UnitAddAbility(u,'A!:+')
call UnitAddAbility(u,'A!:-')
call UnitAddAbility(u,'A!:.')
call UnitAddAbility(u,'A!::')
call UnitAddAbility(u,'A!:;')
call UnitAddAbility(u,'A!:<')
call UnitAddAbility(u,'A!:=')
call UnitAddAbility(u,'A!:>')
call UnitAddAbility(u,'A!:?')
call UnitAddAbility(u,'A!:@')
call UnitAddAbility(u,'A!:[')
call UnitAddAbility(u,'A!:]')
call UnitAddAbility(u,'A!:^')
call UnitAddAbility(u,'A!:_')
call UnitAddAbility(u,'A!:{')
call UnitAddAbility(u,'A!:|')
call UnitAddAbility(u,'A!:}')
call UnitAddAbility(u,'A!:~')
call UnitAddAbility(u,'A!;!')
call UnitAddAbility(u,'A!;"')
call UnitAddAbility(u,'A!;#')
call UnitAddAbility(u,'A!;$')
call UnitAddAbility(u,'A!;%')
call UnitAddAbility(u,'A!;&')
call UnitAddAbility(u,'A!;(')
call RemoveUnit(u)
set u = null
endif
set bd[0]='A!(@'
set bd[1]='A!(['
set bd[2]='A!(]'
set bd[3]='A!(^'
set bd[4]='A!(_'
set bd[5]='A!({'
set bd[6]='A!(|'
set bd[7]='A!(}'
set bd[8]='A!(~'
set bd[9]='A!)!'
set bd[10]='A!)"'
set bd[11]='A!)#'
set bd[12]='A!)$'
set bd[13]='A!)%'
set bd[14]='A!)&'
set bd[15]='A!)('
set bd[16]='A!))'
set bd[17]='A!)*'
set bd[18]='A!)+'
set bd[19]='A!)-'
set bd[20]='A!).'
set bd[21]='A!):'
set bd[22]='A!);'
set bd[23]='A!)<'
set bd[24]='A!)='
set bd[25]='A!)>'
set bd[26]='A!)?'
set bd[27]='A!)@'
set bd[28]='A!)['
set bd[29]='A!)]'
set bd[30]='A!)^'
set bd[31]='A!)_'
set bd[32]='A!){'
set bd[33]='A!)|'
set bd[34]='A!)}'
set bd[35]='A!)~'
set bd[36]='A!*!'
set bd[37]='A!*"'
set bd[38]='A!*#'
set bd[39]='A!*$'
set bd[40]='A!*%'
set bd[41]='A!*&'
set bd[42]='A!*('
set bd[43]='A!*)'
set bd[44]='A!**'
set bd[45]='A!*+'
set bd[46]='A!*-'
set bd[47]='A!*.'
set bd[48]='A!*:'
set bd[49]='A!*;'
set bd[50]='A!*<'
set bd[51]='A!*='
set bd[52]='A!*>'
set bd[53]='A!*?'
set bd[54]='A!*@'
set bd[55]='A!*['
set bd[56]='A!*]'
set bd[57]='A!*^'
set bd[58]='A!*_'
set bd[59]='A!*{'
set bd[60]='A!*|'
set bd[61]='A!*}'
set bd[62]='A!*~'
set bd[63]='A!+!'
set bd[64]='A!+"'
set bd[65]='A!+#'
set bd[66]='A!+$'
set bd[67]='A!+%'
set bd[68]='A!+&'
set bd[69]='A!+('
set bd[70]='A!+)'
set bd[71]='A!+*'
set bd[72]='A!++'
set bd[73]='A!+-'
set bd[74]='A!+.'
set bd[75]='A!+:'
set bd[76]='A!+;'
set bd[77]='A!+<'
set bd[78]='A!+='
set bd[79]='A!+>'
set bd[80]='A!+?'
set bd[81]='A!+@'
set bd[82]='A!+['
set bd[83]='A!+]'
set bd[84]='A!+^'
set bd[85]='A!+_'
set bd[86]='A!+{'
set bd[87]='A!+|'
set bd[88]='A!+}'
set bd[89]='A!+~'
set bd[90]='A!-!'
set bd[91]='A!-"'
set bd[92]='A!-#'
set bd[93]='A!-$'
set bd[94]='A!-%'
set bd[95]='A!-&'
set bd[96]='A!-('
set bd[97]='A!-)'
set bd[98]='A!-*'
set bd[99]='A!-+'
set bd[100]='A!--'
set bd[101]='A!-.'
set bd[102]='A!-:'
set bd[103]='A!-;'
set bd[104]='A!-<'
set bd[105]='A!-='
set bd[106]='A!->'
set bd[107]='A!-?'
set bd[108]='A!-@'
set bd[109]='A!-['
set bd[110]='A!-]'
set bd[111]='A!-^'
set bd[112]='A!-_'
set bd[113]='A!-{'
set bd[114]='A!-|'
set bd[115]='A!-}'
set bd[116]='A!-~'
set bd[117]='A!.!'
set bd[118]='A!."'
set bd[119]='A!.#'
set bd[120]='A!.$'
set bd[121]='A!.%'
set bd[122]='A!.&'
set bd[123]='A!.('
set bd[124]='A!.)'
set bd[125]='A!.*'
set bd[126]='A!.+'
set bd[127]='A!.-'
set bd[128]='A!..'
set bd[129]='A!.:'
set bd[130]='A!.;'
set bd[131]='A!.<'
set bd[132]='A!.='
set bd[133]='A!.>'
set bd[134]='A!.?'
set bd[135]='A!.@'
set bd[136]='A!.['
set bd[137]='A!.]'
set bd[138]='A!.^'
set bd[139]='A!._'
set bd[140]='A!.{'
set bd[141]='A!.|'
set bd[142]='A!.}'
set bd[143]='A!.~'
set bd[144]='A!:!'
set bd[145]='A!:"'
set bd[146]='A!:#'
set bd[147]='A!:$'
set bd[148]='A!:%'
set bd[149]='A!:&'
set bd[150]='A!:('
set bd[151]='A!:)'
set bd[152]='A!:*'
set bd[153]='A!:+'
set bd[154]='A!:-'
set bd[155]='A!:.'
set bd[156]='A!::'
set bd[157]='A!:;'
set bd[158]='A!:<'
set bd[159]='A!:='
set bd[160]='A!:>'
set bd[161]='A!:?'
set bd[162]='A!:@'
set bd[163]='A!:['
set bd[164]='A!:]'
set bd[165]='A!:^'
set bd[166]='A!:_'
set bd[167]='A!:{'
set bd[168]='A!:|'
set bd[169]='A!:}'
set bd[170]='A!:~'
set bd[171]='A!;!'
set bd[172]='A!;"'
set bd[173]='A!;#'
set bd[174]='A!;$'
set bd[175]='A!;%'
set bd[176]='A!;&'
set bd[177]='A!;('
set pm[0]=14
set pm[15]=17
set pm[33]=15
set pm[49]=15
set pm[65]=15
set pm[81]=21
set pm[103]=17
set pm[121]=21
set pm[143]=10
set pm[154]=12
set pm[167]=10
set bp[0]=8192
set bp[15]=65536
set bp[33]=16384
set bp[49]=16384
set bp[65]=16384
set bp[81]=1048576
set bp[103]=65536
set bp[121]=1048576
set bp[143]=512
set bp[154]=2048
set bp[167]=512
set pw[0]=1
set pw[1]=2
set pw[2]=4
set pw[3]=8
set pw[4]=16
set pw[5]=32
set pw[6]=64
set pw[7]=128
set pw[8]=256
set pw[9]=512
set pw[10]=1024
set pw[11]=2048
set pw[12]=4096
set pw[13]=8192
set pw[14]=-8192
set pw[15]=1
set pw[16]=2
set pw[17]=4
set pw[18]=8
set pw[19]=16
set pw[20]=32
set pw[21]=64
set pw[22]=128
set pw[23]=256
set pw[24]=512
set pw[25]=1024
set pw[26]=2048
set pw[27]=4096
set pw[28]=8192
set pw[29]=16384
set pw[30]=32768
set pw[31]=65536
set pw[32]=-65536
set pw[33]=1
set pw[34]=2
set pw[35]=4
set pw[36]=8
set pw[37]=16
set pw[38]=32
set pw[39]=64
set pw[40]=128
set pw[41]=256
set pw[42]=512
set pw[43]=1024
set pw[44]=2048
set pw[45]=4096
set pw[46]=8192
set pw[47]=16384
set pw[48]=-16384
set pw[49]=1
set pw[50]=2
set pw[51]=4
set pw[52]=8
set pw[53]=16
set pw[54]=32
set pw[55]=64
set pw[56]=128
set pw[57]=256
set pw[58]=512
set pw[59]=1024
set pw[60]=2048
set pw[61]=4096
set pw[62]=8192
set pw[63]=16384
set pw[64]=-16384
set pw[65]=1
set pw[66]=2
set pw[67]=4
set pw[68]=8
set pw[69]=16
set pw[70]=32
set pw[71]=64
set pw[72]=128
set pw[73]=256
set pw[74]=512
set pw[75]=1024
set pw[76]=2048
set pw[77]=4096
set pw[78]=8192
set pw[79]=16384
set pw[80]=-16384
set pw[81]=1
set pw[82]=2
set pw[83]=4
set pw[84]=8
set pw[85]=16
set pw[86]=32
set pw[87]=64
set pw[88]=128
set pw[89]=256
set pw[90]=512
set pw[91]=1024
set pw[92]=2048
set pw[93]=4096
set pw[94]=8192
set pw[95]=16384
set pw[96]=32768
set pw[97]=65536
set pw[98]=131072
set pw[99]=262144
set pw[100]=524288
set pw[101]=1048576
set pw[102]=-1048576
set pw[103]=1
set pw[104]=2
set pw[105]=4
set pw[106]=8
set pw[107]=16
set pw[108]=32
set pw[109]=64
set pw[110]=128
set pw[111]=256
set pw[112]=512
set pw[113]=1024
set pw[114]=2048
set pw[115]=4096
set pw[116]=8192
set pw[117]=16384
set pw[118]=32768
set pw[119]=65536
set pw[120]=-65536
set pw[121]=1
set pw[122]=2
set pw[123]=4
set pw[124]=8
set pw[125]=16
set pw[126]=32
set pw[127]=64
set pw[128]=128
set pw[129]=256
set pw[130]=512
set pw[131]=1024
set pw[132]=2048
set pw[133]=4096
set pw[134]=8192
set pw[135]=16384
set pw[136]=32768
set pw[137]=65536
set pw[138]=131072
set pw[139]=262144
set pw[140]=524288
set pw[141]=1048576
set pw[142]=-1048576
set pw[143]=1
set pw[144]=2
set pw[145]=4
set pw[146]=8
set pw[147]=16
set pw[148]=32
set pw[149]=64
set pw[150]=128
set pw[151]=256
set pw[152]=512
set pw[153]=-512
set pw[154]=1
set pw[155]=2
set pw[156]=4
set pw[157]=8
set pw[158]=16
set pw[159]=32
set pw[160]=64
set pw[161]=128
set pw[162]=256
set pw[163]=512
set pw[164]=1024
set pw[165]=2048
set pw[166]=-2048
set pw[167]=1
set pw[168]=2
set pw[169]=4
set pw[170]=8
set pw[171]=16
set pw[172]=32
set pw[173]=64
set pw[174]=128
set pw[175]=256
set pw[176]=512
set pw[177]=-512
endmethod
endmodule
private struct O extends array
implement I
endstruct
//! endtextmacro
->made -ability bonus 2^(power+1) so that 1 less ability is needed for almost the same ranges of power +1
-----| -(2^(power+1) to 2^(power+1)-1
If you could increase the mana regeneration bonus, I'd definitely trash "Status" and use this ^^ (After I go through all the trouble installing those LUA scripts![]()
Really easy to set up compared to the LUA library chain that this requires.
It's the original
Listen to urself Bribe, ur starting to talk like the peeps at wc3c.
If that were the case, then technology in the world would be at a standstill because coal power would be the best since it was the first.
That's why Nestharus is recreating all these libraries.
Nah, I'm mostly recreating them as I personally need them =). I require a certain standard be met in a lib before I use it ^)^, and if it doesn't meet that standard by even a little, I just rewrite it so that it does and submit it for others to use =).
/*************************************************************************************
*
* POWER
*
* Power determines how big a bonus range can go. For example, a power of 15 would be
* -(2^16) to 2^(16-1), or -65536 to 65535.
*
*************************************************************************************/
//powers
//! i powers[armor] = 12 --bonus armor
//! i powers[damage] = 15 --bonus damage
//! i powers[agility] = 13 --bonus agility
//! i powers[strength] = 13 --bonus strength
//! i powers[intelligence] = 13 --bonus intelligence
//! i powers[life] = 19 --bonus life
//! i powers[liferegen] = 15 --bonus life regen
//! i powers[mana] = 19 --bonus mana
//! i powers[manaregen] = 8 --bonus mana regen (%) (8 max?)
//! i powers[sight] = 10 --bonus sight range (10 max)
//! i powers[attackspeed] = 8 --bonus attack speed (%) (8 max)
/*************************************************************************************
*
* ENABLED
*
* Should the bonus be implemented into the system? By disabling a bonus, it will be
* be in the system at all. Abilities and constants won't be made.
*
*************************************************************************************/
//! i enabled[armor] = true --bonus armor
//! i enabled[damage] = true --bonus damage
//! i enabled[agility] = true --bonus agility
//! i enabled[strength] = true --bonus strength
//! i enabled[intelligence] = true --bonus intelligence
//! i enabled[life] = true --bonus life
//! i enabled[liferegen] = true --bonus life regen
//! i enabled[mana] = true --bonus mana
//! i enabled[manaregen] = true --bonus mana regen (%)
//! i enabled[sight] = true --bonus sight range
//! i enabled[attackspeed] = true --bonus attack speed (%)
Safe LUA generation [which noone ever needed or will ever need]
Not that your libraries were readable in the first place, so in the end it doesn't even matter.
Encoder is readable ;D
Anyways, this already works perfectly and couldn't really get any more optimal ^)^.
Nothing is perfectly optimal! Believing that this resource is perfectly optimal will limit you, .. and it!
And i wouldnt argue against that. Its just that BonusMod has extension libraries that supply a few bonuses which require other libraries, like max HP/Mana or movement speed.Furthermore, I can argue that a library should only have the minimum amount required in it to run. Anything extra can be a separate library.
I wouldnt recommend doing that. Theres a reason BonusMod uses another library to supply that bonus. Its because that other library uses a certain trick that allows adding theoretically infinite HP/Mana (itll overflow eventually, but thats not the point).Maximum hp/mana handling can be an entirely separate resource: function wrappers for this resource.
Its pointless to worry about this, how often do you think youll have to adjust a units bonuses? 32 times a second? Try once every 5 seconds.Also, because any non ability bonus is handled very differently from ability bonuses, I haven't made this extensible as it'd be a major efficiency loss.
As i mentioned before, its not as important as you think it is. Sure, in the event there actually is a collision, your libraries would have an advantage. Until then, theyre just overhead.Also, I personally think that this is a major point for a script that generates so many abilities-
Why does there need to be Agi/Str/Int abilities? Those can be set natively via triggers. Is it because Chaos won't remember those trigger-registered changes?
Nest, do you allow me to make a demo (updated of course) of your Bonus using non-lua? :3
Can't do a non Lua version as there are too many abilities. That is never going to happen =). If you want to use this, suck it up and use Lua ; P.
