VXA Damage Formula Help

Hello, I'm a new member here, but been browsing the forums for years. I'm trying to figure out a damage formula for my VX Ace project, it's based off of old Final Fantasy games where enemy defense was converted into a percentile reduction, but keeps the core of quadruple user's attack reduced by double target's defense. For most generic weapon attacks, the formula is something along the lines of such:

((a.atk+a.agi)*2)*(1000/(1000+(b.def*2)))

So Character A has a Strength of 96, and an Agility of 112, the enemy they're attacking has a Defence of 456.
The sum of both attack stats doubled is 416, and the Damage Reduction value should return 0.52, which should reduce that damage to 215.

Most of the abilities ended up doing 0 damage and I read in this post https://forums.rpgmakerweb.com/index.php?threads/help-with-a-damage-formula.173075/ that VXA's Ruby Script rounds down divided integers, thus 0.xx returns 0, and that I should A. write the numbers as decimal for the script to read and calculate the decimals, and B. use as little brackets as possible. How would I go about that because I can't quite wrap my head around the math? That post was referring to hp-based damage so I can't use the hp_rate function. I'm not using any plugins whatsoever because I'm challenging myself to create something using only the default assets, and the only edits I've made to the scripts was to stop enemy attacks raising the TP bar, since I'm using it as a Stamina bar for physical attacks.
Then you gotta add a decimal digit to your factor or divisor as in 2.0 and you'll be good to go.
Then you gotta add a decimal digit to your factor or divisor as in 2.0 and you'll be good to go.
Ohhh it makes sense now, I was overthinking it, for some reason I was trying to figure out how to put a decimal on the .atk, .def, etc. Making the 1000/1000+def into 1000.0/1000+def made it work, thanks a lot.
alternatively a good trick is to make the division the last mathematical step.

2000*(a.atk + a.agi)/(1000 + 2*b.def)

is exactly the same formula as you have, but will circumvent the rounding as much as possible

I'm adding this options because VXA and Ruby have the minor problem that everything converted to real stays real for the rest of the game, and if you make some conversions at the wrong time that transfers to the original values, resulting in the menu showing 80.00 / 100.00 HP and so on.
It rarely happens because it needs to be converted explicitly, but some people in the past had that problem
alternatively a good trick is to make the division the last mathematical step.

2000*(a.atk + a.agi)/(1000 + 2*b.def)

is exactly the same formula as you have, but will circumvent the rounding as much as possible

I'm adding this options because VXA and Ruby have the minor problem that everything converted to real stays real for the rest of the game, and if you make some conversions at the wrong time that transfers to the original values, resulting in the menu showing 80.00 / 100.00 HP and so on.
It rarely happens because it needs to be converted explicitly, but some people in the past had that problem
It certainly looks cleaner, and the modifier of 2000 can be tweaked for the ultimate skills by making it higher, like bumping it up to **OVER 9000!!!** though the result with your formula at base is slightly off from expected; the example I gave takes a total weapon power of 412 and reduced it to 212, yours gives 217. Weird.
my solution does not completely eliminate the rounding problems, it just prevents a cascade by forcing the rounding error into the last step.

Original thread: https://forums.rpgmakerweb.com/threads/vxa-damage-formula-help.173611/