State that multiplies damage dealt based on existence or nonexistence of another state?

Hello all, I'm trying to create a state called Shark's Nose that changes damage dealt by any attacking skill if the target is or is not afflicted with Bleed. An example situation:

Actor "Ralph" attacks a monster and deals 30 damage.
On his next turn, Ralph uses the Shark's Nose skill on himself, granting him the Shark's Nose buff (state).
Then, Ralph attacks the same monster. The monster does not have the Bleed effect, so the damage is reduced by 25% - Ralph only deals 23 damage.
Ralph takes a turn to use the Puncture Wound skill, which inflicts Bleed on a target.
Ralph attacks the bleeding target. Since the monster now has Bleed, the damage is boosted by 150% - Ralph deals 40 damage.

I'm utilizing yanfly's plugins to try and accomplish this, but I'm having trouble figuring out how to apply the multipliers to damage. I want to avoid putting this check in the damage formula since there are lots of skills, and all attacking skills have a chance to proc this effect. So I'm trying to see if I can't get the effect into the Shark's Nose state itself.

Thank you for your help!
The subject <Custom Confirm Effect> and target <Custom React Effect> let you alter the action's calculated formula value before it gets applied to the target.

So something like this may work (untested):

<Custom Confirm Effect> if (value > 0) { value *= target.isStateAffected(123) ? 1.5 : 0.75; } </Custom Confirm Effect>
I.e.
  • If damage is done (value is negative for heals)...
  • ...then multiply value by:
    • 1.5 if the target is affected by state ID 123; or
    • 0.75 otherwise.

[Edit: those tags are from YEP Buffs & States Core.]
I tried this code you developed and encountered an interesting issue.

At first I thought it was working - It showed up a little strange, as it would apply as a separate number, but it would do roughly the correct amount of bonus damage. But I discovered there's an issue with the basic damage calculator that I hadn't noticed until now.

I playtest my skills and states and whatnot in the Troops section since it's quick and easy to set up, so maybe that's an issue. What I found is, at level 1 and with certain items equipped, Ralph has a 25 Attack stat. The basic Attack action currently has a damage formula of (a.atk * 50) / b. def. I'm using the default Minotaur to test my things out, and I removed the variance from the basic Attack to test my theory.

What we should expect is that when Ralph uses the Attack action, he should deal 31/32 damage (depending on the rounding). What I got, though, is Ralph dealing 36 damage sometimes, 29 damage other times, etc. I've made sure he is not wearing armor that grants weird states and I'm not applying buffs, debuffs, or states to him. These are the raw damage numbers.

I tested again with a new Attack value of 10, so what we should expect is for Ralph to deal 12/13 damage. Instead, he's dealing 21, or even sometimes more.

Anybody know what might be causing this? It's a little hard to determine when your other code is working when the numbers are not following the formulas as they should.
See if you still get tricky results in a full playtest. I honestly recommend always testing stuff in a playtest as opposed to a battle test, since plugin stuff doesn't always properly work there.
So, when running as a full playtest the numbers level out. However, the numbers are still incorrect.
I'm also using yanfly's enemy levels script, so sometimes the level is different, but I'm taking that into account with the calculations I'm doing on the backend to predict what should result.

Ralph has 35 attack when accounting for everything during full playtest. A Lv 1 Minotaur should have 40 DEF. Therefore, using the same calculation as before, we should expect Ralph to deal 43/44 damage to the Minotaur (rounding and whatnot). Instead he only deals 36.

When the Minotaur instead comes out as Lv 2, the Minotaur's DEF comes out to 44. This means Ralph should deal 39/40 damage. Instead he only deals 32.

On rare occasions, the Minotaur comes out at Lv 3, so its DEF is 49. This means Ralph should deal 35/36 damage. Instead he only deals 29.

What I learned is that the Minotaur's DEF is still reducing the damage more effectively as it increases, which is good. I was worried when doing the troop playtests. But as we can see, there's some other shenanigans happening behind the scenes that I'm not able to identify. I haven't changed any of the base code or messed with the Damage Core plugin aside from boosting the damage cap up. Anyone ever seen something like this?
As far as I'm aware, battle-test should be A-OK with Yanfly's plugins.

Ideas:
  1. It's possible your "accounting for everything" has missed something. E.g. the battle-test setup screen does not check for traits such as Param Rate. Other easy-to-overlook traits include Element Rate and Physical/Magical Damage Rate. Remember that for actors, traits are sourced from various database records: Actor, Class, Weapon, Armor, State.

  2. Try pressing F8 during test to show the dev tools window, and make sure you're on the Console tab. Then try typing these lines (press Enter after each one and it should show the value):

    • ATK of the party leader:

      $gameParty.members()[0].atk
    • DEF of enemy #1:

      $gameTroop.members()[0].def

  3. You could try temporarily turning off all plugins in the Plugin Manager: select all, right-click -> Turn OFF. That could help narrow down whether or not it is a plugin issue. As always, save your project to apply Plugin Manager changes before testing.

    Note that even if the problem disappears when you switch off 1 plugin, that does not necessarily mean that plugin is at fault. It could be a bad configuration, or a conflict with another active plugin, possibly due to a bad load order. Yanfly's plugins should be loaded in the order listed on their site to minimise problems:
    You can click+drag to rearrange the order in the Plugin Manager.

Original thread: https://forums.rpgmakerweb.com/threads/state-that-multiplies-damage-dealt-based-on-existence-or-nonexistence-of-another-state.153257/