MZ Need help with Visustella battle core damage styles

Im using the visustella core plugins for my project. I wanted to use the FF9 damage style so I could just put a power level integer into the damage formula and save time that way. But the party deals way too much damage whenever its a physical attack skill.

When starting, to try to get a sense of things, I copied ff9 for my characters stats at lvl 1. (FF9 doesnt have a defense stat on level up, its all provided by armor, and it doesnt have a luck stat. However, spirit functions similarly to luck, so I just substituted that. Besides, the damage styles arent one to one formula conversions.)

Then, I copied a low level enemy's stats (trick sparrow) and general Ai. Then, I went and set the general attack skill to be skill power 1. And I also implemented a basic thunder spell, because the spells have a skill power value I can copy.

However basic attacks from my party (with no equipment) were dealing 800 damage, while the basic enemy was doing like 15. Now, 15 damage is low, but within expectations for lvl 1. at lvl 1 vivi only has 60 hp, after all. with equipment (a +12 to strength, copied from ff9's equipment stats) basic attacks were dealing like 1,800 damage.

Expected range of basic attack damage at lvl 1 is like. 70 for physically strong characters with a weapon, and half that for mage characters. And rpg maker handling equipment as flat stat bonuses might contribute to the problem, but it still exists even without anything equipped.

For reference, a thunder spell is skill power 14. and when using a skill copying it (again, just a 14 in the damage formula box, with element set to electric), it was dealing like 100-120 damage, which is within expectations for lvl 1. I made a copy of the thunder spell and just changed the skill type to physical and it was dealing 600-800 damage. so it feels like its a problem specific to party-side physical attack skills.

So there seems to be an extra multiplier in the ff9 damage style code that specifically applies to physical attack skills, and I dont know how to parse the damage style formula in the plugin settings well enough to tell where that is. If anyone can tell why this is happening I'd really appreciate it.

Code:
// the visustella damage style base formula code from the plugin setup
// Define Constants
const user = this.subject();
const target = arguments[0];
const item = this.item();
const a = this.subject();
const b = target;
const v = $gameVariables._data;
const sign = [3, 4].includes(item.damage.type) ? -1 : 1;

// Create Damage Constant
const power = Math.max(eval(item.damage.formula), 0);
if (this.isCertainHit()) {
    return (isNaN(power) ? 0 : power) * sign;
}

// Declare Main Stats
let armor = this.isPhysical() ? b.def : b.mdf;
armor = this.applyArmorModifiers(b, armor);
let stat = 1;
if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    stat = a.atk;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    stat = a.mat;
} else if (this.isPhysical() && this.isRecover()) {
    stat = a.def;
} else if (this.isMagical() && this.isRecover()) {
    stat = a.mdf;
}

// Declare Base Damage
let baseDamage = power;
if (this.isPhysical()) {
    baseDamage += stat;
}
if (this.isDamage() || this.isDrain()) {
    baseDamage -= armor;
    baseDamage = Math.max(1, baseDamage);
}

// Declare Bonus Damage
let bonusDamage = stat + (((a.level || a.luk) + stat) / 8);

// Declare Final Damage
let value = baseDamage * bonusDamage * sign;

// Return Value
return isNaN(value) ? 0 : value;

Edit: the only point of difference i can see is the base damage declaration, where the str stat is added to the variable, which is then reduced by the armor (derived from the physical defense stat.) The relevant stat is also present in the bonus damage calculation, so I think the str stat is getting used twice here.

So lets take a physical skill with skill power 10 and a strength stat of 15. The base power becomes 25, the equivalent of a magic skill with base power 25. Then, the base damage subtracts the relevant defense stat, picks the higher between 1 or the result, then applies the bonus damage multiplier. The attackers stat also shows up in the damage multiplier formula.

So im gonna comment out that physical type extra stat bonus and see if it solves things

EDIT EDIT:
that definitely reduced the damage back down to more expected result ranges! regular attacks (skill strength 1) are hitting around 20-40 damage each. i wonder why that if statement was included, and if there's some sort of divider or mitigating operation to stop it from getting too strong that wasn't included.
You can also do something like... a.atk * 1.7 - (b.def * (b.arm / a.pen))

... where defense can be amplified by Armor, but cut by Penetration. The only numeric factor is the magnitude, 1.7 in this case. Low magnitude skills are easier to mitigate with armor, while high magnitude skills are harder to mitigate with armor. You could also mix and match stats within the formula, using magic attack/defense, luck, MP, HP, or AP.
Heres more analysis:
here's the ff9 basic attack damage formula:

{\displaystyle Base\times Bonus}


and you get the base like this:

{\displaystyle Base=Atk-Def}


while the bonus damage changes depending on what weapon youre using, but is most commonly this:

{\displaystyle Bonus=Str+RND([(Lv+Str)/8]+1)}


that RND operator is most likely just a rounding operator so we aren't dealing with decimals. rpg maker has this built into it.

so lets go over the visustella formula step by step, to try to figure out what the heck happened.
Spoiler: code
JavaScript:
// Define Constants
const user = this.subject();
const target = arguments[0];
const item = this.item();
const a = this.subject();
const b = target;
const v = $gameVariables._data;
const sign = [3, 4].includes(item.damage.type) ? -1 : 1;

this is just defining some variables and constants. the ones that may seem odd are the const v, which is referring to an ingame variable. const sign is just saying "hey is this positive or negative", and if it's a healing skill it applies at the end to make the amount healed a positive number.

next is the declaration of the damage constant.

Spoiler: more code
JavaScript:
// Create Damage Constant
const power = Math.max(eval(item.damage.formula), 0);
if (this.isCertainHit()) {
    return (isNaN(power) ? 0 : power) * sign;
}

what this is doing is checking which is higher, zero or whatever was put into the damage formula? and the second part im not sure but is probably just to make sure a certain hit attack doesn't require a damage formula in there, as a certain hit type skill is commonly used for buffs and healing.

next is declarations of which stats are gonna be used.

Spoiler: even more code
JavaScript:
// Declare Main Stats
let armor = this.isPhysical() ? b.def : b.mdf;
armor = this.applyArmorModifiers(b, armor);
let stat = 1;
if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    stat = a.atk;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    stat = a.mat;
} else if (this.isPhysical() && this.isRecover()) {
    stat = a.def;
} else if (this.isMagical() && this.isRecover()) {
    stat = a.mdf;
}

the let armor segment is checking the skill type. if the skill is physical, grab the target's defense stat. otherwise, use their magic defense stat.
the applyArmorModifiers part is a command i don't quite understand, and i cant find it in the regular function call library. i think it's just assigning the target and the relevant stat so the code can be used for multi-hit attacks and it properly assesses defenses based on the target.

so, so far this is a bunch of setup. now we get to the actual math.
our base damage, stored in the power variable is already declared at this point to be either zero, or whatever is declared in the formula box.

Spoiler: yet even more code
JavaScript:
// Declare Base Damage
let baseDamage = power;
if (this.isPhysical()) {
    baseDamage += stat;
}

this is the part that, when commented out, reduced the damage from Way Too Much to more expected levels. why?

Spoiler: last of the code i promise
JavaScript:
if (this.isDamage() || this.isDrain()) {
    baseDamage -= armor;
    baseDamage = Math.max(1, baseDamage);
}

// Declare Bonus Damage
let bonusDamage = stat + (((a.level || a.luk) + stat) / 8);

// Declare Final Damage
let value = baseDamage * bonusDamage * sign;

// Return Value
return isNaN(value) ? 0 : value;

so the base damage, when its a physical hit, will make the base damage of the skill equal to the strength stat. then, it will subtract the armor variable (b.def), then it will pick the higher of 1 or the result of that operation.

then the bonus damage. this is taking the relevant stat, then ((attacker's level OR luck stat) + the relevant attack stat, and all that gets divided by 8. rpg maker rounds automatically so we dont need the originals RND operation. the reason that the OR thing is there is because by default enemies don't have a level, so it uses their luck stat instead. as far as i understand, however, because it's parsing things from left to right it'll always pick the level stat as a number if it's available.

if we have an actor at lvl 4 with a strength stat of 20 (including from equipment) fighting an enemy with a defense of 10, then the formula is

(20-10)*(20+(((4+20)/8)+1))
which ends up being 240.

and guess what? thats accurate! however, if you provide any sort of skill power to the skill in the initial formula box, that number gets inflated. also, when you equip stuff, rpg maker by default flatly adds those status bonuses to the relevant stat. remember how in ff9 theres actually not a lot of physical attack skills? most of them are "basic atk calculation and then an extra multiplier at the end like if you hit a weakness" calculations. spells have a set spell strength, which is what gets subtracted against magic defense.

so tldr idk where the crazy multiplier is happening but its probably in how equipment directly increases your strength stat so you need to artificially inflate your enemy's defenses to keep that in track, or make your equipment not match ff9 because that adds too much. there might be a split between attack and strength. there certainly is one on the enemy statblocks.

but if you're wondering on how to stop that crazy damage number inflation, consider treating all your skills like how ff9 treats magic skills and commenting out the part where it adds your strength to the base damage stat.

You can also do something like... a.atk * 1.7 - (b.def * (b.arm / a.pen))

... where defense can be amplified by Armor, but cut by Penetration. The only numeric factor is the magnitude, 1.7 in this case. Low magnitude skills are easier to mitigate with armor, while high magnitude skills are harder to mitigate with armor. You could also mix and match stats within the formula, using magic attack/defense, luck, MP, HP, or AP.
honestly having spent over three hours on this with little to show for it you make a good argument and i might take that formula and see how it feels.
that RND operator is most likely just a rounding operator so we aren't dealing with decimals. rpg maker has this built into it.
it's a random number between 0 and the number-1, not a rounding operation. its essentially Math.randomInt() which is an included funcion within RpgMaker

the ones that may seem odd are the const v, which is referring to an ingame variable
its not a single variable. its the array that contains the data for all of the game's variables. so instead of using $gamevariables.value(13) and $gameVariables.setValue(13, x) to get and set the value of variable 13 (which is also subject to a few extra behaviors), you can just use v[13] in your formulas

what this is doing is checking which is higher, zero or whatever was put into the damage formula? and the second part im not sure but is probably just to make sure a certain hit attack doesn't require a damage formula in there, as a certain hit type skill is commonly used for buffs and healing.
yes to both. The first part is imposing a minimum value of 0 on the power. the 2nd part ends the function right there and uses the value of the formula if its certain

this is the part that, when commented out, reduced the damage from Way Too Much to more expected levels. why?
youd have to follow the ff9 formula standard attack formula. 'power' wouldnt be a hard value attached to the skill, itd be the weapon's attack power. but also as youve noted later, RM adds the weapon's atk into the actor's atk stat automatically and the atk being used has them both together.
you'd need to redo the formula to not factor in those those extra parameters or alter how the parameters are calculated to not include equipment parameters directly like how ff9 does.

that being said, im not sure how likely the latter would work with how likely it is that VS is also touching those functions and needs those changes...

try this:
set the attack formula to
Code:
a.isActor() ? a.weapons()[0]?.params[2] || 1 : 1;
to get the raw attack power from the weapon

then...
Code:
// Declare Main Stats
let armor = this.isPhysical() ? b.def : b.mdf;
armor = this.applyArmorModifiers(b, armor);
let stat = 1;
if (this.isAttack()) {
    stat = a.paramBase(2) * a.paramRate(2) * a.paramBuffRate(2);
} else if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    stat = a.atk;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    stat = a.mat;
} else if (this.isPhysical() && this.isRecover()) {
    stat = a.def;
} else if (this.isMagical() && this.isRecover()) {
    stat = a.mdf;
}
which has an added section to check if the attack is the user's standard attack, and if it is, uses their atk without their weapon's atk factored in

Code:
// Declare Base Damage
let baseDamage = power;
if (this.isPhysical() && !this.isAttack()) {
    baseDamage += stat;
}
if (this.isDamage() || this.isDrain()) {
    baseDamage -= armor;
    baseDamage = Math.max(1, baseDamage);
}
which makes it so that when the standard attack is being used, the base attack used is only the weapon atk and not the actor's total atk

Code:
// Declare Bonus Damage
let bonusDamage = stat + Math.randomInt(((a.level + stat)/8)+1)
which is the correct formula for the bonus damage, including only using the user's "str" instead of the total attack.

(We're ignoring that different weapons like the forks and thef swords used different formulas entirely 🤣)

and now Reid on a class that has a base atk of 24 class with a weapon that has an atk of 12 (Steiner starts with 24 str and has a weap with an atk power of 12), against an enemy with 10 def (everything in the evil forest has 10 def) deals ~50 damage per swing, (Steiner's starting damage range in the evil forest is 48~54)
ff9-ezgif.com-optimize.gif


Edit:
Also

@spejoku, please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.

it's a random number between 0 and the number-1, not a rounding operation. its essentially Math.randomInt() which is an included funcion within RpgMaker


its not a single variable. its the array that contains the data for all of the game's variables. so instead of using $gamevariables.value(13) and $gameVariables.setValue(13, x) to get and set the value of variable 13 (which is also subject to a few extra behaviors), you can just use v[13] in your formulas


yes to both. The first part is imposing a minimum value of 0 on the power. the 2nd part ends the function right there and uses the value of the formula if its certain


youd have to follow the ff9 formula standard attack formula. 'power' wouldnt be a hard value attached to the skill, itd be the weapon's attack power. but also as youve noted later, RM adds the weapon's atk into the actor's atk stat automatically and the atk being used has them both together.
you'd need to redo the formula to not factor in those those extra parameters or alter how the parameters are calculated to not include equipment parameters directly like how ff9 does.

that being said, im not sure how likely the latter would work with how likely it is that VS is also touching those functions and needs those changes...

try this:
set the attack formula to
Code:
a.isActor() ? a.weapons()[0]?.params[2] || 1 : 1;
to get the raw attack power from the weapon

then...
Code:
// Declare Main Stats
let armor = this.isPhysical() ? b.def : b.mdf;
armor = this.applyArmorModifiers(b, armor);
let stat = 1;
if (this.isAttack()) {
    stat = a.paramBase(2) * a.paramRate(2) * a.paramBuffRate(2);
} else if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    stat = a.atk;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    stat = a.mat;
} else if (this.isPhysical() && this.isRecover()) {
    stat = a.def;
} else if (this.isMagical() && this.isRecover()) {
    stat = a.mdf;
}
which has an added section to check if the attack is the user's standard attack, and if it is, uses their atk without their weapon's atk factored in

Code:
// Declare Base Damage
let baseDamage = power;
if (this.isPhysical() && !this.isAttack()) {
    baseDamage += stat;
}
if (this.isDamage() || this.isDrain()) {
    baseDamage -= armor;
    baseDamage = Math.max(1, baseDamage);
}
which makes it so that when the standard attack is being used, the base attack used is only the weapon atk and not the actor's total atk

Code:
// Declare Bonus Damage
let bonusDamage = stat + Math.randomInt(((a.level + stat)/8)+1)
which is the correct formula for the bonus damage, including only using the user's "str" instead of the total attack.

(We're ignoring that different weapons like the forks and thef swords used different formulas entirely 🤣)

and now Reid on a class that has a base atk of 24 class with a weapon that has an atk of 12 (Steiner starts with 24 str and has a weap with an atk power of 12), against an enemy with 10 def (everything in the evil forest has 10 def) deals ~50 damage per swing, (Steiner's starting damage range in the evil forest is 48~54)
View attachment 354895

Edit:
Also Double-post notice: @spejoku
Thank you very much! This is incredibly helpful! Sorry for double posting.

implementing the code as you wrote (adding in a last ; to close off that last bit) got regular attacks working in the range they should be in! thanks.

i do have another question, actually. FF9 doesn't have very many physical damage skills, so how would I go about implementing a skill like Climhazzard (double basic attack damage to enemy party) or Shock (triple regular damage to one enemy)? would it be adding a x2 or x3 to the formula box code kinda like this?

JavaScript:
a.isActor() ? 2*(a.weapons()[0]?.params[2]) || 1 : 1;

edit: nope that didn't work. when the formula is copied onto another non-basic attack skill it uses the added together atk stats (because duh it's not a basic attack). maybe i should just save the equipped weapon's stats and actor's inherent atk stats as separate variables that i can reuse. or use a different damage formula that still feels ok with ff9's statlines.
nope that didn't work. multiplying the parameter like that just reduced the damage by about half.
you had the right idea, but as I said earlier, the changes I made only apply to standard attacks.
let stat = 1;
if (this.isAttack()) {
stat = a.paramBase(2) * a.paramRate(2) * a.paramBuffRate(2);
}
if you would like all physical skills to function like this, then you would need changes made to reflect that. otherwise, its behaving exactly as how the skills were when you started, but with the bonus damage calculation being corrected.
Code:
// Declare Main Stats
let armor = this.isPhysical() ? b.def : b.mdf;
armor = this.applyArmorModifiers(b, armor);
let stat = 1;
if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    stat = a.paramBase(2) * a.paramRate(2) * a.paramBuffRate(2);
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    stat = a.mat;
} else if (this.isPhysical() && this.isRecover()) {
    stat = a.def;
} else if (this.isMagical() && this.isRecover()) {
    stat = a.mdf;
}

i believe you would also want to remove the
Code:
if (this.isPhysical() && !this.isAttack()) {
    baseDamage += stat;
}
bit entirely as its going to make additions you dont always want, and can easily be done by adding it to the skill's formula directly

after that, the formula you tried should work



Edit: looked a bit deeper and im getting conflicting information on their formulas between the gamefaq's damage formula sheet and the ff fandom wiki. assuming the ff fandom wiki is right about both (cause it gives an opportunity to show off both cases), climhazard uses double the weapon's atk power, which is what I gave above. shock is just normal attack damage * 3. in that case, you can use the normal attack formula and the battle core notetag
Code:
<JS Pre-Damage>
value *= 3;
</JS Pre-Damage>
to triple the end damage
you had the right idea, but as I said earlier, the changes I made only apply to standard attacks.

if you would like all physical skills to function like this, then you would need changes made to reflect that. otherwise, its behaving exactly as how the skills were when you started, but with the bonus damage calculation being corrected.
Code:
// Declare Main Stats
let armor = this.isPhysical() ? b.def : b.mdf;
armor = this.applyArmorModifiers(b, armor);
let stat = 1;
if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    stat = a.paramBase(2) * a.paramRate(2) * a.paramBuffRate(2);
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    stat = a.mat;
} else if (this.isPhysical() && this.isRecover()) {
    stat = a.def;
} else if (this.isMagical() && this.isRecover()) {
    stat = a.mdf;
}

i believe you would also want to remove the
Code:
if (this.isPhysical() && !this.isAttack()) {
    baseDamage += stat;
}
bit entirely as its going to make additions you dont always want, and can easily be done by adding it to the skill's formula directly

Edit: looked a bit deeper. climhazard uses double the weapon's atk power, which is what I gave above. shock is just normal attack power * 3. in this case, you can use the normal attack formula and the battle core notetag
Code:
<JS Pre-Damage>
value *= 3;
</JS Pre-Damage>
to triple the end damage
thanks a ton! it works!
this helps a lot. being able to just copy-paste the basic attack and then applying the damage modifiers via either action sequences or notetags is great, and I can use the base attack as a template for all physical damaging skills now. I was planning on all of the physical skills being either unique formulae like a minus strike or derived from the basic attack formula.

and thanks for pointing out that the formula multiplication was for double the equipped weapon power, specifically. that's a handy distinction to know.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-visustella-battle-core-damage-styles.181411/