Seal of Righteousness skill

Hello,

I would like help to do a skill that is found in WOW:

It's this one:
Capture d’écran 2021-01-04 173315.png

I've done it two ways but neither one works for me.
Plugins installed: All Yanfly and ICFSoft plugins.

1st way:
My basic attack has for action sequence this:

<target action>
if user.speed == 3 && (user.isStateAffected(344))
motion attack: user
wait: 10
attack animation: target
wait for animation
action effect
wait for effect
common event: 301
else user.speed == 2 && (user.isStateAffected(344))
motion attack: user
wait: 10
attack animation: target
wait for animation
action effect
common event: 301
wait for effect
motion attack: user
wait: 10
attack animation: target
wait for animation
action effect
wait for effect
common event: 301
end
</target action>

The speed determines how many hits the user will give to his target.
State 334 is the Seal of Righteousness.
The common event is the Seal of Righteousness effect which has the following sequence of actions:
<target action>
action effect
</target action>

The problem with this method is that when the player attacks (with two speed) and has state 344 he attacks once, the common event starts and does damage and then the player returns to his original position and then repeats the same attack cycle a second time.

I don't want him to go back to his original position until he does all his attacks and common events but I think that's impossible because of the common event.

My second method is this:

<Post-Damage Eval>
if (user.isStateAffected(344)) {
target.gainHp(-6 - (user.care * 0.43));
}
</Post-Damage Eval>.

<target action>
if user.speed == 3 && (user.isStateAffected(344))
motion attack: user
wait: 10
attack animation: target
wait for animation
action effect
wait for effect
else user.speed == 2 && (user.isStateAffected(344))
motion attack: user
wait: 10
attack animation: target
wait for animation
action effect
common event: 301
wait for effect
motion attack: user
wait: 10
attack animation: target
wait for animation
action effect
wait for effect
end
</target action>

Additional damage is calculated in relation to <Post-Damage Eval>.
The problem is that I have no control over the type of damage, I want the extra damage to be sacred damage and the extra damage to be separate from the basic attack, a pop up for each.

Do you have any idea how I can inflict extra Holy damage when the character has the Seal of Righteousness state and does a basic physical attack while displaying the attack damage and the extra Holy damage separately?

Thanks for your help and sorry for my English.
Using a <Custom Confirm Effect> from BuffsStatesCore on the Seal state.
Code:
<Custom Confirm Effect>
if (this.isPhysical()) {
var damage = Math.random(6)+3 //3-9 extra damage
damage = damage * target.elementRate(X) //change x to the element of holy
target.gainHp(-Math.round(damage))
target.startDamagePopup();
target.performDamage();
}
</Custom Confirm Effect>

The state checks if the action being performed is a physical skill, then grabs a random number from 3-9. then multiplies that by the target's element rate for X (which you change to whatever your holy element is). Then it rounds that to a whole number and subtracts it from the target's hp. Then it shows a damage popup, and makes the target perform their flinch movement.

Confirm effects only happen when the afflicted battler successfully hits a target. If a skill misses, this will not trigger.
Thank you very much for your answer.
I've tried on my project and it doesn't seem to work. I tried on Yanfly's project and it doesn't work either.
I will try on a new project with the correct plugins and I will keep you posted.
Ah, my bad, use target.gainHp(-damage) instead of target.hp -= damage
It works very well!

Thank you very much.

I'm not sure I understood the formula:

Code:
Math.random(6)+3

My character is constantly doing 3 damage.

If I change 3 by 20 for example he will always do 20 of damage.

Same if I put 50 in brackets he will always do 20 damage.

I continue my research on math.random

edit: I found it, here is the formula:
Code:
Mat.round(Math.random() * (9 - 3) + 3)
I'm not sure I understood the formula:

Code:
Math.random(6)+3

My character is constantly doing 3 damage.

If I change 3 by 20 for example he will always do 20 of damage.

Same if I put 50 in brackets he will always do 20 damage.

I continue my research on math.random
I have another question:
I would like to make this skill only usable if the player has state 344.
Capture d’écran 2021-01-05 052103.png

I enter this in the skill's notetag:
Code:
<Custom Requirement>
   if (user.isStateAffected(344)) {
     value = true;
   } else {
     value = false;
}
</Custom Requirement>
but I can still use it even when the player does not have state 344. I do not know why.

Edit: I found the problem,

I forgot a hug :/
Double-post notice: Bertrand

Once your question is answered, please report your thread to be closed. If you have another question that isn't related to the first, it's best if you post it in a new thread.

If everything in this thread is now resolved, please report so we can close it.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/seal-of-righteousness-skill.131808/