MV-equivalent of VX formula

In VX you could use the following line in the damage formula of a skill to apply a buff on a character:
a.add_buff(2,3); a.mat*1.5-b.mdf*1
(just an example)

This doesn't seem to work anymore in the damage field of MV. Is there any equivalent for it?


Same question about the rand()
[a.atk*1-b.def*1, 1+rand(2)].max
(again, just an example)

This was working on Ace but no longer is on MV. Any equivalent?


And finally (sorry for the many questions) what is the way (if any) to use a variable and to test a condition (for instance if a switch is on) through the damage formula?
You may find this thread helpful: https://forums.rpgmakerweb.com/index.php?threads/damage-formulas-101.81905/
(Original - rpgmakercentral)

Give the skill user a 3-turn buff to param 2 (atk):
Code:
a.addBuff(2, 3);
In your context:
Code:
a.addBuff(2,3); a.mat*1.5-b.mdf*1


Get a random number from 0~1:
Code:
Math.randomInt(2)
In your context:
Code:
Math.max(a.atk - b.def, 1 + Math.randomInt(2))


Get the value of game variable 15 (these two lines are equivalent, first one is a shortcut for the damage formula box):
Code:
v[15]
Code:
$gameVariables.value(15)
Get the value of game switch 8:
Code:
$gameSwitches.value(8)
Return 100 if switch 8 is on, else return 10:
Code:
$gameSwitches.value(8) ? 100 : 10
Or you can use an "if" statement, e.g. do the addBuff thing above only if the value of variable 15 is more than 20:
Code:
if (v[15] > 20) { a.addBuff(2, 3); }; a.mat * 1.5 - b.mdf
Perfect reply, thank you. 👍
You're welcome! 😂

Original thread: https://forums.rpgmakerweb.com/threads/mv-equivalent-of-vx-formula.115714/