MV Weapons that deal damage to passive enemy states (types)

I'm using YEP_DamageCore and YEP_Auto_Passive_States plugin to create passive states (types) for enemies, such as Beast, Vermin, Aquatic, etc.
I'd like certain weapons to deal 2x damage to an enemy if the state is applied.

EX:
Depth charge weapon would deal 2x damage to Flying and Aquatic type enemies, if they have the Flying or Aquatic state as a passive.

I got this far with help from a friend but it doesn't seem to work, as the damage values in battle are still the same as with another regular weapon.

<damage formula>
const validStates = new Set([114, 115]);
const hasValidState = target.states().some(el => validStates.has(el.id)); if (hasValidState) value = Math.max(a.atk * 3 - b.def, 1); else value = Math.max(a.atk * 1.5 - b.def, 1);
</damage formula>

Link to plugin:
I was about to tell you that your syntax is wrong, but it isn't really - your formatting is just very screwy 😛

You should always put code in the CODE tags (the </> in the edit bar) and make sure there are line breaks and indentations in the appropriate places.

That said, the approach you got from your friend is rather overcomplicated. Making a Set and using map functions instead of a simple array seems unnecessary; as is iterating through the target's states array when RPG Maker provides the isStateAffected() method.

Aside from that, it's not working because the notetag is invalid. I'm assuming you're putting this on the weapons but <damage formula> isn't a Weapon notetag.
1690209866941.png


So your two options are:
- Make the damage formula in all of your skills check for the ownership of the appropriate weapon type and target passive state to calculate the damage. I think this is inefficient.

- Make your weapons give you a passive state and you modify damage from that.

So you can do, in the passive state from the weapon,
Code:
<Custom Confirm Effect>
if ([114, 115].some(passive => target.isStateAffected(passive)))
    value*=2;
</Custom Confirm Effect>
and this weapon will do double damage against an enemy with passive states 114 or 115.

- You can make the weapons give an attack element, and the passive states give a a low element rate multiplier against that element. In this case, it's all built into MV - you don't even have any need for passive states, just put the element rate trait directly on the enemy and the attack element on the weapon.
I was about to tell you that your syntax is wrong, but it isn't really - your formatting is just very screwy 😛

You should always put code in the CODE tags (the </> in the edit bar) and make sure there are line breaks and indentations in the appropriate places.

That said, the approach you got from your friend is rather overcomplicated. Making a Set and using map functions instead of a simple array seems unnecessary; as is iterating through the target's states array when RPG Maker provides the isStateAffected() method.

Aside from that, it's not working because the notetag is invalid. I'm assuming you're putting this on the weapons but <damage formula> isn't a Weapon notetag.
View attachment 270514

So your two options are:
- Make the damage formula in all of your skills check for the ownership of the appropriate weapon type and target passive state to calculate the damage. I think this is inefficient.

- Make your weapons give you a passive state and you modify damage from that.

So you can do, in the passive state from the weapon,
Code:
<Custom Confirm Effect>
if ([114, 115].some(passive => target.isStateAffected(passive)))
    value*=2;
</Custom Confirm Effect>
and this weapon will do double damage against an enemy with passive states 114 or 115.

- You can make the weapons give an attack element, and the passive states give a a low element rate multiplier against that element. In this case, it's all built into MV - you don't even have any need for passive states, just put the element rate trait directly on the enemy and the attack element on the weapon.
So I did have it with proper spacing/lines before I copy/pasted but I think the first line is so long, it keeps getting broken up and formatted weirdly when I copy it to something else. Lol

And okay. To clarify:

You’re saying to give the player an invisible passive for, and the custom confirm effect would go in that passive, correct?

Would I need to do create a unique actor passive for every weapon, or only that ones that check for more than the one state.

Example;
A sword or gun both deal x2 damage to plants, so both weapons could use the same passive for both weapons?

The sword deals x2 damage to plants and aquatics. The gun deals x2 damage to plans.

The sword would add a unique passive that checks for both the plant and aquatic passive, and the gun would have the aforementioned one.
Anything that works the same way can be recycled. If you want/need to go the route of passive states, then your sword would have two passive states: for plants and for aquatics.

But, honestly, I'm not sure why you can't just use elements for this system.
LOL
The whole reason I went this convoluted route to check the states was because I thought there was a problem checking passive states...😛

Now I remember that the problem is with passive states not going through the 'apply' stage so it was the corresponding notetags that don't work...

Also, for the weapons side of, I had a system where I used YEP Weapon Unleash to give each of my weapon types a different damage formula by using the 'replace' notetag, where you can replace the normal attack skill with another skill through a notetag on the weapons.
Now I remember that the problem is with passive states not going through the 'apply' stage so it was the corresponding notetags that don't work...
That's true, although I have a lightly-tested snippet to fix that, if it matters for your project.

Also, for the weapons side of, I had a system where I used YEP Weapon Unleash to give each of my weapon types a different damage formula by using the 'replace' notetag, where you can replace the normal attack skill with another skill through a notetag on the weapons.
That's definitely a thing that can be done, although I'm assuming this damage modifier should apply to all skills used by that weapon.
I agree that utilizing either the passive states linked to a weapon or the elemental system would be more efficient.

Original thread: https://forums.rpgmakerweb.com/threads/weapons-that-deal-damage-to-passive-enemy-states-types.159651/