Small Damage Formula Question

Take note though that by using Ninja's formula, you could end up with cases where your actor will deal more damage to enemies with high defense than those with defense close to his attack.

For example:

Actor has 10 atk, enemy has 9 defense

Damage will be 1

Actor has 10 atk, enemy has 15 defense

Damage will be 3 (10*0.3)

In case you dont want that, and want the atk*0.3 to be the absolute lowest damage of that attack, just do this instead

Code:
[a.atk-b.def,a.atk*0.3].max

This will take whichever value is higher from the two formulas
@NinjaKittyProductions
@Engr. Adiktuzmiko
Ohhhhhhhhhhh, thank you for that. I was slow on the draw and I thought you were showing me a way to make sure a skill always does at least 1 point of damage. Thank you so much, it works great, it does exactly what I want! Also thank you for alerting me about that potentially higher damage problem, and for that extra formula, Engr. Adiktuzmiko, it will definitely come in handy.
@Oddball
Thank you for trying to help me, Oddball, even though I tested the formula and it doesn't do what I wanted.

Also
The problem with the damage formula in the database is it serves as base damage before everything else is applied.
The flow goes like this:
  • Base damage, is calculated from the damage formula. You can try whatever you can to always set minimum damage from a skill, e.g, Adiktuzmiko's formula, etc.
  • After the base is calculated, then multiplied by the element rate. Say, for whatever reason, you set the minimum damage to 10 in the damage formula. However, if you set the element rate higher/lower than 100%, the damage won't be 10
  • After the element rate, then multiplied by the physical/magical rate
  • Then it goes to check if the skill rolls critical, this process is ignored when the skill will not deal critical damage.
  • Then it checks the variance.
  • Then it checks if the target is guarding. If so, the damage is cut by a flat 50%.
  • Will the final damage is equal to 10? Probably, and probably not. Probably less, probably more.
If you want the minimum damage to always have a fixed value whatever factor is affecting it (element rate, physical/magical dmg rate, variance, etc), it needs a script to edit the damage calculation.
@TheoAllen have a good point, that's why I use in damage formula following:
Code:
Math.max(10, skillFormula);

I don't use VX Ace, but I'm sure it has equivalent call as MV

By the way, thank you @TheoAllen for claryfing things. I also had some difficulties with my skill damage formulas 🙂

Edit, correct me if I'm wrong, but with ruby you could try
Code:
[min, formula].max
and replace min with minimal damage, and formula with default skill formula
@Soulrender - the Ace equivalent is what I've written.

Though as Theo said, the damage formula is evaluated before everything else is applied so both our methods wont "guarantee" the minimum value in case the dev makes stuff like enemies that have element/damage resist traits etc.
@Soulrender the snippet you posted is similar to @Engr. Adiktuzmiko snippet code using
Code:
[val1, val2].max
Will return the highest value inside the array

Original thread: https://forums.rpgmakerweb.com/threads/small-damage-formula-question.114232/