Skill formulae question

I have this skill that I want to do damage and inflict bleeding, but if the target is already afflicted by bleeding, then the skill does double damage instead, but not inflict bleeding.

I first tried the skill without the added bleeding, which looked like this, and worked fine under both conditions.

b.state?(26) ? a.mat * 2 - b.mdf * 0.33 : a.mat - b.mdf * 0.33The problem lies in adding the bleeding effect if the target is not affected by bleeding. I made this:

b.state?(26) ? a.mat * 2 - b.mdf * 0.33 : a.mat - b.mdf * 0.33 ; b.add_state(26)But then it skips over the damage calculation and only adds the bleeding.

I also tried putting the add bleed condition in front of the damage calculation, like this:

b.state?(26) ? a.mat * 2 - b.mdf * 0.33 : b.add_state(26) ; a.mat - b.mdf * 0.33It works as intended if the target isn't bleeding, but it skips over the double damage calculation and uses the normal calculation instead.

What do I do to make this work the way I want it?
it will only return last piece for the return. Try this... (Untested)

Code:
m = b.state?(26) ? 2 : 1; b.add_state(26); (a.mat * 2 - b.mdf * 0.33) * m
Why not just put under the features tab to add bleeding to the attack? If the state is already on the target, having it readd the state should not matter.
it will only return last piece for the return. Try this... (Untested)

m = b.state?(26) ? 2 : 1; b.add_state(26); (a.mat * 2 - b.mdf * 0.33) * m
Thanks, will give it a try tomorrow morning and let you know how it went. 🙂

Why not just put under the features tab to add bleeding to the attack? If the state is already on the target, having it readd the state should not matter.
I tried that, but it resets the duration if I do that, which I don't want to happen.
If you don't want to reapply the duration, then...

Code:
m = b.state?(26) ? 2 : (b.add_state(26); 1); (a.mat * 2 - b.mdf * 0.33) * m
Problem solved. 🙂
If I understood what you need this will probably help.

r=a.atk*2-b.mdf*0.33; b.state?(26) ? r*2 : (b.add_state(26); r)I tried it in my project and it works. If enemy has state(26) it deals double damage, if not it deals normal damage and adds state(26).
You could also give that state a "0% bleeding state rate" feature to prevent it from getting refreshed.

This way you could apply the state without having to mess with the formula.

Edit: Heirukichis solution works too of course.

Edit2: Overlooked Zetus second formula, sorry.
Sorry, Zeta's formulae actually did work. I forgot to remove the Feature to add Bleeding that I tried out earlier after changing the formulae. Working now, thanks a lot for the help. 🙂
b.state?(26) ? a.mat * 2 - b.mdf * 0.33 : (b.add_state(26);a.mat - b.mdf * 0.33)

just adding the brackets to the 2nd half of the condition like this would've worked too after switching around the order

Original thread: https://forums.rpgmakerweb.com/threads/skill-formulae-question.45613/