BulwarkFrame v0.2.0
This commit is contained in:
+4
-1
@@ -168,7 +168,10 @@ C.RANK_RATE = { [0] = 0, [1] = 0.05, [2] = 0.10, [3] = 0.15 }
|
||||
-- neither is assumed; the caller decides once measurement settles it.
|
||||
function C.rateForRank(rank, addBonus, multBonus)
|
||||
local base = C.RANK_RATE[rank or -1]
|
||||
if not base then return 0 end
|
||||
-- `<= 0` and not just `not base`: rank 0 maps to a rate of 0, and 0 is truthy in Lua, so a
|
||||
-- bare nil check would let an additive set bonus resurrect a rate for a talent the character
|
||||
-- has not learned -- exactly the confidently wrong number this guard exists to prevent.
|
||||
if not base or base <= 0 then return 0 end
|
||||
if type(addBonus) == "number" then base = base + addBonus end
|
||||
if type(multBonus) == "number" then base = base * multBonus end
|
||||
return base
|
||||
|
||||
Reference in New Issue
Block a user