Race / Gender-based Damage Increase without Modifying Damage Formula?

I am trying to implement passives and weapons that deal increased damage to specific foes. For example, a Demonslayer weapon would deal increased damage to Demon enemies (determined by a passive state labeling them as demons). However, the problem I am having is creating a state that grants the increased damage to these specific enemies without adding it to the front of every damage formula. So every actor/enemy is labeled by a race and gender through a passive state, and skills or weapons deal extra damage to these races or genders without modifying the damage formula (At least, that is what I am hoping to do).

TLDR: How can I increase the damage to enemies with a state "Demon" when a party member has the "Demonslayer" state, without modifying damage formulas? Is this possible? Is there a simpler method to accomplish what I am trying to do? Any help or advice would be appreciated.

(I am trying to use Yanfly's AutoPassiveStates to accomplish this.)
One of Yanfly's tips and tricks teach you how to turn heal to hurt against undead. I think you should be able to adapt that to your needs.
That is usually done by damage elements - give the weapon the damage element "demon" and have the demon enemies an elemental rate of for example 150% against demon damage.

That way you don't even have to use a state, you could set the damage rate either by state or directly in the enemy.
That is usually done by damage elements - give the weapon the damage element "demon" and have the demon enemies an elemental rate of for example 150% against demon damage.

That way you don't even have to use a state, you could set the damage rate either by state or directly in the enemy.

That's simple enough for a weapon, but what I am trying to do is apply it as a level-up skill, so when my character hits level 30, they gain the increased damage to demons. I have this slightly by giving the conditional passive state in the notetags. Here is the custom passive condition in this example:

<Custom Passive Condition>

if (target.isStateAffected(190)) {

condition = true;

} else {

condition = false;

}

</Custom Passive Condition>



Where state 190 is "Demon". However, this makes it so the passive is always active, but I only want it to occur during damage calculation. I thought this would work because the state looks for a "target", but it doesn't seem to matter in the end.

One of Yanfly's tips and tricks teach you how to turn heal to hurt against undead. I think you should be able to adapt that to your needs.

I'll have to take a look at this when I get home in a couple of hours.

edit: This looks like it will do exactly what I want it to, but I have no idea how to edit the code to work the way I want it to.
Try this:
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage()) {
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>
Try this:
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage()) {
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>

okay, this is almost exactly what I needed, the problem is, how do I have it also check if the attacker has the "Demonslayer" passive? I modified it slightly to:
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage()) and (user.isStateAffected(179)) {
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>

Where state 179 is "Demonslayer," and there seems to be no change in damage.
"and" is not JS code. "and" in js is &&. So:
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage() &&(user.isStateAffected(179)) {
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>
"and" is not JS code. "and" in js is &&. So:
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage() &&(user.isStateAffected(179)) {
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>

Regardless of if I use:

<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage()) && (user.isStateAffected(179)) {
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>

Or the one I used previously, I still get an error code before damage calculation.

SyntaxError: Unexpected token {message: "Unexpected token {"stack: (...)get stack: function () { [native code] }set stack: function () { [native code] }__proto__: Error
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage() && (user.isStateAffected(179)) {
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>
Try this, it looks like there was some parentheses issues.
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage() && (user.isStateAffected(179)) {
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>
Try this, it looks like there was some parentheses issues.

Nope, still getting an error. :/

SyntaxError: Unexpected token &&

SyntaxError: Unexpected token {
Try this:
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage() && user.isStateAffected(179)){
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>
Try this:
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage() && user.isStateAffected(179)){
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>

I'm truly at a loss. I've modified the code several times to make it work and it is still getting error codes.

js/plugins/YEP_AutoPassiveStates.js:587
TypeError: undefined is not a function

Yanfly.Util.displayError = function(e, code, message) {
console.log(message);
console.log(code || 'NON-EXISTENT');
console.error(e);
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
if (!require('nw.gui').Window.get().isDevToolsOpen()) {
require('nw.gui').Window.get().showDevTools();
}
}
};
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage() && origin.isStateAffected(179)){
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>

Make sure that this is a passive state that is on the enemy.
<Custom React Effect>
// Check if the action is a damage skill.
if (this.isHpDamage() && origin.isStateAffected(179)){
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>

Make sure that this is a passive state that is on the enemy.

Spoiler: screenshots
be9aa0c9f5747418421c4d346b9e1382.png

20fb410ed2bdf6c7c15a6fb746a23346.png

d68a79d81c6236d2d400271dcbb8c54b.png

45d8bb3c9d291968b2f39e672a874440.png
3 questions, do you have BuffStates Core by Yanfly, in your game? If yes, is it above Auto Passive State and below Battle Engine Core.

And can I have a screenshot if you're plugins list?
(Just in case Something crazier happens)
3 questions, do you have BuffStates Core by Yanfly, in your game? If yes, is it above Auto Passive State and below Battle Engine Core.

And can I have a screenshot if you're plugins list?
(Just in case Something crazier happens)

Yes I do. Here's the list.
Spoiler: screenshots
d6bb599d5603cd14878bbfe0c9f603d6.png

09140cab092fe3111ffff08921caacb8.png

1f21dab355cb379ef7c1c58290c0e973.png

527e3d139241a5840b7c91604c798559.png
Kay thanx. Also I got it.

<Custom React Effect>

// Check if the action is a recovery skill.

if (a.isStateAffected(x)) {

// If it is, let's convert the value into damage!

value *= y;

}

</Custom React Effect>
This goes into your enemy state. Replace x with the id of the state that the battler needs to be affected with so, in this case state 179. Then set y to be the damage multiplier of power. for example if y is 2, than double of the damage is done when state 179 is inflicted on Daniel, just remember this is a decimal value. So 1.5 is 150% the damage while 0.2 is 20% of the damage.

I was being stupid, I re-read what custom React effect did. And then I had to figure out what variable ie a or target or user, was need so that it knew to check who did it. And then last but not least, I had to remember to the value be multipled by something or else it wouldn't have increased damage.
Kay thanx. Also I got it.

<Custom React Effect>

// Check if the action is a recovery skill.

if (a.isStateAffected(x)) {

// If it is, let's convert the value into damage!

value *= y;

}

</Custom React Effect>
This goes into your enemy state. Replace x with the id of the state that the battler needs to be affected with so, in this case state 179. Then set y to be the damage multiplier of power. for example if y is 2, than double of the damage is done when state 179 is inflicted on Daniel, just remember this is a decimal value. So 1.5 is 150% the damage while 0.2 is 20% of the damage.

I was being stupid, I re-read what custom React effect did. And then I had to figure out what variable ie a or target or user, was need so that it knew to check who did it. And then last but not least, I had to remember to the value be multipled by something or else it wouldn't have increased damage.

It works! Thank you very much for your help. I really appreciate your patience and effort!
You're welcome and I really don't mind

Original thread: https://forums.rpgmakerweb.com/threads/race-gender-based-damage-increase-without-modifying-damage-formula.81764/