MV Solved! (Yanfly Damage Core and Skill Learn System) Conditional Damage When Player Has Specific Skills

I'm trying to make a skill that deals different damage depending on whether the user has a certain skill or not.

Spoiler: the skill
Screenshot 2025-08-24 065427.png

I tried using the if else as follows. Damage is a constant for testing purposes.

JavaScript:
<damage formula>
if ((user.isLearnedSkill(701) && user.isLearnedSkill(702) && user.isLearnedSkill(703) && user.isLearnedSkill(704) && user.isLearnedSkill(705)) {
   value = 60;
} else if (user.isLearnedSkill(701) && user.isLearnedSkill(702) && user.isLearnedSkill(703) && user.isLearnedSkill(704)) {
   value = 50;
} else if (user.isLearnedSkill(701) && user.isLearnedSkill(702) && user.isLearnedSkill(703)) {
   value = 40;
} else if (user.isLearnedSkill(701) && user.isLearnedSkill(702)) {
   value = 30;
} else if (user.isLearnedSkill(701)) {
   value = 20;
} else {
   value = 10;
}
</damage formula>

The skill always deals 0 damage. Weirdly enough, if I use switch case instead:

JavaScript:
<damage formula>
switch (user.isLearnedSkill()) {
 case (701 && 702 && 703 && 704 && 705):
  value = 60;
  break;
 case (701 && 702 && 703 && 704):
  value = 50;
  break;
 case (701 && 702 && 703):
  value = 40;
  break;
 case (701 && 702):
  value = 30;
  break;
 case 701:
  value = 20;
  break;
 default:
  value = 10;
}
</damage formula>

The skill always deals 10 damage, regardless of whether the user has any of those skills.

Skills 701 to 705 do nothing. It's just there to change the damage of other skills.

I only have very basic JavaScript knowledge, so it would be very helpful if someone could help me with this.
The skill always deals 0 damage
syntax error. you have more opening parenthesis in the first line than you have closing ones. it should work after that

The skill always deals 10 damage, regardless of whether the user has any of those skills.
no case will ever be true. Your condition is ran and the used case is based on that. user.isLearnedSkill() requires an argument to be able to result in anything and it wont be multiple simultaneous values
syntax error. you have more opening parenthesis in the first line than you have closing ones. it should work after that

I removed the extra parenthesis, now the skill always deals 10 damage regardless of the condition.

Your condition is ran and the used case is based on that. user.isLearnedSkill() requires an argument to be able to result in anything and it wont be multiple simultaneous values

Wouldn't the argument be whatever the case is?
I removed the extra parenthesis, now the skill always deals 10 damage regardless of the condition.
then to be sure, how does the actor have access to the skills? if they learned them by a learn skill event command or from their class then it should work, but if its from something else like an add skill trait on the actor, some gear, or a state it wont count as being learned. you'd have to use user.hasSkill(x) in that case.

Wouldn't the argument be whatever the case is?
nope. cases arent passed into the condition (and if it could, it you'd have to signify into which function(s) somehow). the case has to be the result of the condition, and running user.isLearnedSkill() without an argument should only result in false
then to be sure, how does the actor have access to the skills? if they learned them by a learn skill event command or from their class then it should work, but if its from something else like an add skill trait on the actor, some gear, or a state it wont count as being learned. you'd have to use user.hasSkill(x) in that case.
There's the problem. While testing, I used the add skill trait. Using user.hasSkill(x) fixes it. Thank you.

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/solved-yanfly-damage-core-and-skill-learn-system-conditional-damage-when-player-has-specific-skills.179737/