CuteOne / BadRotations

GNU General Public License v3.0
166 stars 213 forks source link

% operator #987

Closed leifan8440 closed 3 years ago

leifan8440 commented 3 years ago

https://github.com/simulationcraft/simc/wiki/Conditional-expressions

in simc % is the division operator: it returns the division of the left by the right member. %% is the modulo operator: it returns the integer remainder of the division operator (New in Simulationcraft 9.0.1 release 1)

in lua % is the modulo operator https://www.lua.org/manual/5.1/manual.html 2.5.1 – Arithmetic Operators Lua supports the usual arithmetic operators: the binary + (addition), - (subtraction), * (multiplication), / (division), % (modulo), and ^ (exponentiation); and unary - (negation). If the operands are numbers, or strings that can be converted to numbers (see §2.2.1), then all operations have the usual meaning. Exponentiation works for any exponent. For instance, x^(-0.5) computes the inverse of the square root of x. Modulo is defined as

 a % b == a - math.floor(a/b)*b

That is, it is the remainder of a division that rounds the quotient towards minus infinity.

https://github.com/CuteOne/BadRotations/blob/a97248877ce0bdc74b4f27e883d842548e871fdc/Rotations/Druid/Balance/BalanceLaksmackt.lua#L755

actions.aoe+=/variable,name=starfire_in_solar,value=spell_targets.starfire>8+floor(mastery_value%20)+floor(buff.starsurge_empowerment.stack%4) local starfire_in_solar = #enemies.yards45 > 8 + floor(masteryAmount % 20)

kuukuukuatchu commented 3 years ago

Was there a point to that wall of text? I think I'm missing something here..... Maybe state what your issue is?

leifan8440 commented 3 years ago

local starfire_in_solar = #enemies.yards45 > 8 + floor(masteryAmount % 20) -> masteryAmount / 20

kuukuukuatchu commented 3 years ago

Ah ok, now it makes sense. You're saying he needs to change masteryAmount % 20 to masteryAmount / 20. Thank you for the clarification.

leifan8440 commented 3 years ago

I think there should be many % errors