I want the scale the number of counters applied by the user's MAT stat. To stop the numbers from getting to high, I decided that it should only increase for every power of ten. This is the code I came up with.
<Custom Apply Effect>
var stack = Math.log10(user.MAT);
target.addStateCounter(8, stack);
</Custom Apply Effect>
When I test it out, it results in the state counter having a value of NaN. As I understand, that should only happen if user.MAT is a negative number. So, what am I doing wrong?
Edit:
I had assumed the issue was with the log10 function, but it seems to result in ten no matter what equation I use, even user.MAT alone. Is that just not how you refer to the stat in code?
Edit 2:
After changing to user.mat, it has even stranger behavior. Math.log10(user.mat) feeds out 1 no matter how high the MAT value is. Using user.mat on its own, similarly always results in a value of 10.
<Custom Apply Effect>
var stack = Math.log10(user.MAT);
target.addStateCounter(8, stack);
</Custom Apply Effect>
When I test it out, it results in the state counter having a value of NaN. As I understand, that should only happen if user.MAT is a negative number. So, what am I doing wrong?
Edit:
I had assumed the issue was with the log10 function, but it seems to result in ten no matter what equation I use, even user.MAT alone. Is that just not how you refer to the stat in code?
Edit 2:
After changing to user.mat, it has even stranger behavior. Math.log10(user.mat) feeds out 1 no matter how high the MAT value is. Using user.mat on its own, similarly always results in a value of 10.