Doing 1 damage.

Hi friends! New here. Just like the title says I am trying to figure out how to make the minimum for all damage to be 1 instead of zero. I have every Yanfly app if that helps.

Ty in advance!
In your damage formula, you should have a formula for damage you want to use right?

If you want minimum 1 damage, write it as this:

formula => Math.max(1, formula)

Where: Math.max(1, formula)
is the modified formula for minimum 1 damage.
I feel like using YEP_DamageCore and adding +1 to the base damage formula would work, or yeah Math.max like @Synrec said.
In your damage formula, you should have a formula for damage you want to use right?

If you want minimum 1 damage, write it as this:

formula => Math.max(1, formula
Is the suggestion that I put "Math.max(1", formula) into every damaging ability I make in game?

ex. Math.max(1, a.atk-b.def).
yes, that is the suggestion.
yes, that is the suggestion.
Okay, ty! Was hoping there was some global go around through a plug in but I'll do what's I gotta do.
yes and no - it could be done by a plugin, but that would introduce compatibility issues.

the more plugins that affect the same area, the higher the chance that something crashes.
and the damage formula is one area that is very often modified.

so unless there is a problem with adding that to every skill, it should be tried to be done that way first.

if you really want this to be done by plugin, we'll need to see your entire plugin list and getting a few more details about how your damage is supposed to work.
Alternatively, you can alias the function for damage calculation and apply the Math.max function on it to apply it globally.

JavaScript:
Game_Action.prototype.makeDamageValue = function(target, critical) {
    const item = this.item();
    const baseValue = this.evalDamageFormula(target);
    let value = baseValue * this.calcElementRate(target);
    if (this.isPhysical()) {
        value *= target.pdr;
    }
    if (this.isMagical()) {
        value *= target.mdr;
    }
    if (baseValue < 0) {
        value *= target.rec;
    }
    if (critical) {
        value = this.applyCritical(value);
    }
    value = this.applyVariance(value, item.damage.variance);
    value = this.applyGuard(value, target);
    value = Math.round(value);
    return value;
};

This is the unmodified code for damage value calculation.
What you wanna do is alias this function which you can do like this:
JavaScript:
const alias_game_action_make_damage_value = Game_Action.prototype.makeDamageValue;

then reapply the function like this:
JavaScript:
const alias_game_action_make_damage_value = Game_Action.prototype.makeDamageValue;
Game_Action.prototype.makeDamageValue = function(target, critical) {
    const base_value = alias_game_action_make_damage_value.call(this, target, critical);
    return Math.max(1, base_value);
}

You can put the above code into a .js file and it'll work when you load it into the plugin manager.
Be careful though as some plugins may not play too nicely with modifying this function.
Okay, ty! Was hoping there was some global go around through a plug in but I'll do what's I gotta do.
Read my comment.
Read my comment.
Yes, ty! I will consider this for later but for now but for the moment the first solution was easy and is working.

TY everyone for the great responses.

Original thread: https://forums.rpgmakerweb.com/threads/doing-1-damage.159730/