# Condition to turn damage into healing instead?

#### Milennin

##### "With a bang and a boom!"
I was looking into making a state that when applied to a hero or enemy, its skills that would normally deal damage, restore the target's HP instead. I'm guessing this is not possible through regular editor tools...? Does a plugin exist that could achieve something like this?

#### Milennin

##### "With a bang and a boom!"
(Tip: multiply a whole damage formula part with -1. That negative part you make actually adds HP because -(-something) = +something ).
I don't know what this means.

#### Zarsla

##### Veteran
Try this:
b.isStateAffected(x) ? (-1 * (y)) : (y)

For example this what it will be for the regular attack skill and with state 15 as the reversing state:
b.isStateAffected(15) ? (-1 * (a.atk*4 -2 * b.def)) : (a.atk*4 - 2 * b.def)

No plugins nesscary just some basic coding.Oh and this goes in to the damage formula box for your skills.

Last edited:

##### Tech Magician Level:
I don't know what this means.
* is the multiplication operator. Thus 2*4 = 8 (two times four equals eight)

Simple math.
X = 10 * 2
Thus X = 20

Now if this is damage, in the end 20 will be subtracted from HP. Right?
HP - 20

Now imagine putting a negative number to be subtracted.
It will be HP - (-20)
This is like saying HP - (20 * (-1))
Now if this is damage, it will mathematically result to HP + 20

#### Milennin

##### "With a bang and a boom!"
Try this:
b.isStateAffected(x) ? (-1 * (y)) : (y)

Yes, that is what I've tried, but it results in 0 damage dealt.

#### Zarsla

##### Veteran
Hmm I can see how this isn't working.
Fix your damage formulas back to the way they were.
Then make sure you have Yanfly Core Engine and Yanfly Skill Core plugins and use this notetag.
<Pre-Damage Eval>
if(user.isStateAffected(x)){
value =-value;
}
</Pre-Damage Eval>
Place this notetag in the affected skills like say the "Attack" skill.
Replace x with the number of the state that's going to inflict this reversing.
Now what should happen is that the user of said skill, should heal targets when attacking/dealing damage and should damage/hurt targets when healing. It'll also reverse the Drain feature, so instead of drain an enemy and heal themselves, they'll drain them selves and heal the enemy.
Basically this should work.

### Latest Profile Posts

Husband has roped me into playing one of his PSO2 characters. Productivity is now negative.
Tileset A is lava! Don't burn D:
as MZ come out what you guys think about.....Some particles engine :3c?
Who wants to sing this song with me?~

Decided to submit my games to the Monday Night Stream. Figured it might be a fun way to get some traction.