Formula equation in JS

Hey and hello,
i wonder if someone can guide me to the right equation for what i want to accomplish.
If i would convert this formula to MV's format what shall i do?
Code:
Base=SpellPower
Bonus=Magic...[(Lv+Magic)/8]+Magic
HPRestored=Base∗Bonus

This is waht i guess is right besides the ...[] part:
Code:
SpellPower * (a.mat...[a.level + a.mat / 8] + a.mat)
Im not sure but could it be a .min/.max function?
a.mat and a.level should be correct. However, don't use []. Use () instead. [] is used for arrays and indexes, not for equations. This is not high school to use {[()]} in equations, you always use ((())).
And what about the "..." doesnt that mean its a range?
Or would this be correct in JS?:
Code:
(a.mat...(a.level + a.mat / 8) + a.mat)
can you post the original formula "as is"?
No, it's not a range. In fact I don't think it's a valid expression, I just thought it meant some part of the equation you didn't want to mention.
However, mv skills have a possible % damage modifier, so why not use that?
Btw. make sure you have all the brackets you want, because operator precedence is still valid, meaning addition comes after division.
can you post the original formula "as is"?
Link
Its the first formula on the page.
However, mv skills have a possible % damage modifier, so why not use that?
I was curious if i could convert those formulas of FF9 i found on the FF Wiki.
See the link i posted one post before.
I think it's probably a bad conversion from Japanese, since there's this $ around and it also doesn't seem to fit in the formula.
I think it's probably a bad conversion from Japanese, since there's this $ around and it also doesn't seem to fit in the formula.

Its a Rand MOD says the source document.
Its under White Magic::Link
If i understand Math.random right then it should be this in the end:
Code:
a.mat + Math.floor(Math.random() * Math.floor(   ((a.level + a.mat) / 8) + 1)   )
matk + (Math.random() % ((lvl + matk) / 8) + 1)

I think.
MOD seems to be the modulo operation. And, as Poryg says, the author of that document seems to use [] for clarity
matk + (Math.random() % ((lvl + matk) / 8) + 1)

I think.
MOD seems to be the modulo operation. And, as Poryg says, the author of that document seems to use [] for clarity

Ah ok im stupid i didnt realized that myself. Rnd MOD means Random Modulo you are right!
Im not good at math but from what i understand its basicly the rest of a division and the % is used for modulo in formulas?


EDIT: I think this is it, will test it as soon as I have the opportunity.
Code:
// Base = Spell Power
// Bonus = Mag + Rnd MOD ([(Lvl + Mag) / 8] + 1)
// HP Restored = Base * Bonus
//
// Spell Power: 16
// 16 * (a.mat + (Math.random() % ((a.level + a.mat) / 8) + 1))

EDIT2: Ok that would mean i could only use those skills on actors since enemys dont have levels by default.
I know there is one by HIME and one by Yanfly.
Will check them out but i dont want my enemys to have real levels to be true.
A fake level which is just a number would be the best solution in that case.

EDIT3: It seems like HIME's plugin does exactly what i need. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/formula-equation-in-js.105397/