Conditional Attack Effects?

Hey all, I'm very new to RPG maker MZ (and RPG maker in general), so I don't know if what I want to do is possible or not.

I'm going to have a character in the game who is a vampire. I'm hoping to create a skill that will serve as his basic attack, and its effect changes based on the target's state. If he uses this skill on a target that does not have the "Vampire Mark" state, it will deal normal damage and add that state to the target. If he uses the skill on that enemy a second time (or any enemy already afflicted with "Vampire Mark"), then the attack will instead deal extra damage (say, 20%) and have partial HP drain (say, 25%).

Is this a possible idea? Since my hope is to use this skill as his basic attack command, I'm trying to avoid breaking this apart into 2 separate skills. I'm currently using the VisuStella MZ Battle Core and Core Engine, if that helps.
yes, it can be done - and without any plugins.

what you need is javascript code inside the damage formula of the skill.
there should be a pinned topic on how to use the damage formula in the forum for the maker you use.
I had found something and tried using the following formula to modify the amount of damage that the target takes if they currently have the state applied to them, and it seems to work so far! But I can't figure out where/how to add the HP drain mechanic.


b.isStateAffected(9) ? a.atk*5 - b.def*2 : a.atk*4 - b.def*2;

Original thread: https://forums.rpgmakerweb.com/threads/conditional-attack-effects.135365/