Is it possible to create a skill which does increased damage per hit of the same target?

I'm looking to make a skill which increases damage when targeting the same opponent. My idea was to have a variable which would +3 whenever it hit and -1 whenever it wasn't targeted (Can't go below 0) so the damage would slowly increase but not revert to 0 when hitting another enemy or using a different skill. The way I tried to do it led me to having to make 9 separate abilities for each enemy it could hit. Is there a way this could be done with Yanfly's buffs or state core or any other optimal methods?
So you want a skill that increases its damage whenever the actor uses it against the same enemy they used that skill on last? Is the skill only available to one actor or can more than one character have it?
this should be relatively easy using damage formula coding and one variable per each enemy, no plugin needed and only one skill.

you need to calculate the variable id for each enemy based on a fixed offset and going +4 instead of +3, because you'll apply the -1 to all enemies with a troop event each turn, use the calculated variable to improve the damage.
this should be relatively easy using damage formula coding and one variable per each enemy, no plugin needed and only one skill.

you need to calculate the variable id for each enemy based on a fixed offset and going +4 instead of +3, because you'll apply the -1 to all enemies with a troop event each turn, use the calculated variable to improve the damage.
Will this work in the damage formula box?

battler.addState(50) If (enemy#1.isStateAffected(50)){ $gameVariables.value(41) + 4); (Damage Formula); } else { If (enemy#2.isStateAffected(50)){ $gameVariables.value(42) + 4); (Damage Formula); } else { If (enemy#3.isStateAffected(50)){ $gameVariables.value(43) + 4); (Damage Formula); } else { If (enemy#4.isStateAffected(50)){ $gameVariables.value(44) + 4); (Damage Formula); } else { If (enemy#5.isStateAffected(50)){ $gameVariables.value(45) + 4); (Damage Formula); } else { If (enemy#6.isStateAffected(50)){ $gameVariables.value(46) + 4); (Damage Formula); } else { If (enemy#7.isStateAffected(50)){ $gameVariables.value(47) + 4); (Damage Formula); } else { If (enemy#8.isStateAffected(50)){ $gameVariables.value(48) + 4); (Damage Formula); }
Will this work in the damage formula box?
yes and no

in that form, it is much too long to fit into the damage formula box.
but on the other hand it is coded in a much too complicated way, I could see several options to shorten the code at a glance.

for example you don't have to check every enemy for the state if only the current target should be able to get the increase - that is probably an old structure from when you had the other enemies reduced in number, but as said that should be moved to a troop event.

second, you can define temporary variables to hold damage numbers, resulting in the damage formula only needed once at the end

unfortunately I currently don't have the time and concentration to rewrite it for you, especially since parts of the info are still missing. I hope the hints above are enough
So you want a skill that increases its damage whenever the actor uses it against the same enemy they used that skill on last? Is the skill only available to one actor or can more than one character have it?
The skill will have increased damage when used on the same person but if they attack another or use a different skill it becomes weaker but doesn't lose all of the buff (using variables it'd be +3 when hit and -1 when not). Only one actor has the ability to use it.
Getting it to increase when used is easy enough; it's getting everything else to *decrease* it that's the bugbear. You could do it as Andar suggested, though I haven't tested that method.

What you could do is put the variable into the damage formula as whatever multiplier you need from it, and give the actor a passive state. The state will have a custom turn end effect where it checks whether the actor's last used skill ID is the one that strengthens and that the last targeted enemy ID is the one from the turn before, then increase the variable and set the turn before target to the current one (as a custom property). Then an else case that decreases the variable by 1.

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-create-a-skill-which-does-increased-damage-per-hit-of-the-same-target.152010/