Hey guys,
Hope somebody will be able to help me out with a problem I am facing with a custom damage formula.
My Java script knowledge is very limited so I apologies if this question is obvious.
This is the formula I have been working with.
<damage formula>
if (a.isStateAffected(707)) {
value = a.atk * 5 + a.luk * 2;
} else {
value = a.atk * 4
}
</damage formula>
I know that this makes the game check if the hero is affected with state 707 and if so execute the increased damage.
My question:
How do I have to write the code to make the game check if the hero is affected with either of the states 707, 708, 709, 710 or 711 to execute the increased damage?
These represent my "Hidden" state which comes in different tiers but either tier should be able to trigger the higher damage.
Any help will be much appreciated, thank you in advance!
Help with Yanfly's Damage Core - Damage Formula
● ARCHIVED · READ-ONLY
-
-
You add a " || " condition to it, which means OR.
For example:
if (a.isStateAffected(1) || a.isStateAffected(2) || a.isStateAffected(3)) {
value = a.atk * 5 + a.luk * 2;
} else {
value = a.atk * 4
}
</damage formula> -
Thank you mate!You add a " || " condition to it, which means OR.
For example: -
Depending on how many things you are checking, putting OR conditions could be quite long. Here's an alternative:
Code:<damage formula> if ([707, 708, 709, 710, 711].some(s => a.isStateAffected(s))) { value = a.atk * 5 + a.luk * 2; } else { value = a.atk * 4 } </damage formula>
Of course, you don't need a plugin for this anyways, it can go directly into the damage formula as a one-liner:
Code:([707, 708, 709, 710, 711].some(s => a.isStateAffected(s))) ? a.atk * 5 + a.luk * 2 : a.atk * 4
Note: This uses modern JS syntax which is not supported by MV 1.5 and lower, the syntax would have to be slightly different for old versions of MV. -
Thank you for the tip bro! Good to know!Depending on how many things you are checking, putting OR conditions could be quite long. Here's an alternative:
Code:<damage formula> if ([707, 708, 709, 710, 711].some(s => a.isStateAffected(s))) { value = a.atk * 5 + a.luk * 2; } else { value = a.atk * 4 } </damage formula>
Of course, you don't need a plugin for this anyways, it can go directly into the damage formula as a one-liner:
Code:([707, 708, 709, 710, 711].some(s => a.isStateAffected(s))) ? a.atk * 5 + a.luk * 2 : a.atk * 4
Note: This uses modern JS syntax which is not supported by MV 1.5 and lower, the syntax would have to be slightly different for old versions of MV.