Phoenix State

Hello all,

I want to use Yanflys Phoenix Ring, but I dont want to use it as an equipment but as a state.

Here is the code:

<Custom Apply Effect>
if (target.isActor()) {
var ring = $dataArmors[1541];
if (target.hasArmor(ring)) {
target.discardEquip(ring);
target.startAnimation(42);
var hp = Math.floor(target.mhp * 0.25);
target.gainHp(hp);
target.startDamagePopup();
}
}
</Custom Apply Effect>

can anyone help me to rewrite it?
I guess that everything in red need to be changed, but i am not really sure how...
If you're looking for auto-life, Yanfly has a tip/trick thingy for that, too:

http://yanfly.moe/2016/05/28/tips-tricks-auto-life-rpg-maker-mv/
try replacing the .hasArmor and .discardEquip with

.hasState(state ID)
.removeState(state ID)
Didn't knew that he has that tip and trick too 🙂

Then i will do it that way, is the easiest 🙂

Thank both of you

Original thread: https://forums.rpgmakerweb.com/threads/phoenix-state.101584/