I didn't mean to say that it was a problem.
In this case, if you want your skill to deal 120% of its normal damage in "situation X", then you could express that in your skills damage formula with a relatively simple pattern:
(
Original Formula) * (
SituationX ? 1.2 : 1)
If you want your skill to deal extra damage in the amount of 20% of the skills base damage but without the targets elemental affinity
(or maybe other modifiers) then the pattern would become more intricate as you'd have to calculate these effects out
(as one possible solution):
(
Original Formula) * (
SituationX ? (
ElementRate + 0.2) /
ElementRate : 1)
It wasn't entirely clear to me from your opening post if you actually needed that extra complexity.
Instead of
b.elementRate(2) > 1
you can also use
this.calcElementRate(b) > 1
to check if the target is weak to the skills element. This alternative works without you having to enter the specific element again
(in case your skill has multiple elements or if you want to apply the condition to different skills).
If you look through the suggestions in the "Damage Formulas 101" thread ATT_Turan linked you'll find a lot of examples that use the damage formula for custom effects not
(entirely) related to damage calculation. I was kind of tired when I wrote the footnote, but these were the kind of effects I meant.^^
Generally this works fine if you don't mind the extra code taking up space in the formula window
(or if you use Ahuramazdas approach and move the code) and don't plan to make use of the Autobattle trait or plugins featuring a damage preview or elaborate enemy AI by relying on calculating the skills damage for evaluation.
The Battle Core example just provides an alternative space to put these effects in without cramping the formula window or disrupting eventual skill assessments if that is something you prefer.
I don't know if it is still relevant, but you should be able to add any of the skill effects with variable parameters using this pattern:
Code:
<JS Post-Apply>
if (b.result().isHit()) {
let effect;
effect = {};
effect.code = Game_Action.EFFECT_GROW;
effect.dataId = 0;
effect.value1 = 15;
effect.value2 = 0;
this.applyItemEffect(b, effect);
}
</JS Post-Apply>
effect.code => You can find the possible skill effect codes in "rmmz_objects.js" in the /js folder of your project, line 1390-1402. You can use either the constants name or the assigned numerical value here:
Spoiler
Game_Action.EFFECT_RECOVER_HP = 11;
Game_Action.EFFECT_RECOVER_MP = 12;
Game_Action.EFFECT_GAIN_TP = 13;
Game_Action.EFFECT_ADD_STATE = 21;
Game_Action.EFFECT_REMOVE_STATE = 22;
Game_Action.EFFECT_ADD_BUFF = 31;
Game_Action.EFFECT_ADD_DEBUFF = 32;
Game_Action.EFFECT_REMOVE_BUFF = 33;
Game_Action.EFFECT_REMOVE_DEBUFF = 34;
Game_Action.EFFECT_SPECIAL = 41;
Game_Action.EFFECT_GROW = 42;
Game_Action.EFFECT_LEARN_SKILL = 43;
Game_Action.EFFECT_COMMON_EVENT = 44;
effect.dataId => The database ID of the operated entry, otherwise the position in the drop down menu
(in these cases starting at index 0)
effect.value1 => The value of the numerical field
(in case of a percentage: 1.0 equals 100%)
effect.value2 => The value of the second numerical field
(only used for Recover HP/MP effects)
As this is in Javascript, you could go to any length to determine these values.
In this example, you have the skill effect for increasing MHP by 15. Value2 is not used for this particular effect and the line could be removed here.
The Battle Core also allows you to add these pre-apply, pre-damage, post-damage or post-apply effects to your actors directly with a slightly different notetag-name instead of a specific skill, in case you want an effect to apply to all skills that actor uses
(as maybe an alternative to the Skills&States Core solution).