How to make two attacks

There are two skills I'm having trouble figuring out how to make so I'll ask for help with both on the same post.

The first one I need help with is I want a skill that works like Facade from Pokemon. In Pokemon, Facade is a move that does a certain amount of damage normally, but does double when the user of it is affected by burn, poison, or paralysis. The states I want it to cause to hit with double damage are state numbers 2, 3, 4, 7, 26, and 30. I want the normal damage that this move deals without the statuses be the same as a normal attack, a.atk * 4 - b.def * 2. How would I go about with the formula?

The other skill I need help with is an all target attack that gives each enemy a random weakness, either to fire, ice, or thunder. The numbers for my "element weak" states are 50, 51, and 52. This move will also do damage. So it hits all enemies for damage, and then gives each one a random one of those states. I was assuming that it would be with a common event, and then using variables it will randomly pick which state is given to the enemies, but I tried that and it doesn't work.
These damage formulas come to mind. I haven't tested them...


Code:
dmg = a.atk * 4 - b.def * 2 ; b.states.any? {|s| [2,3,4,7,26,30].include?(s.id)} ? dmg * 2 : dmg

b.add_state([50, 51, 52].sample) ; a.atk * 4 - b.def * 2
Tested the first one you gave me, it didn't work, but the issue was you put b.states.any when I intended for the user of the attack to have the state, so I changed it to a.states.any and after that it worked. Thank you!

The other one does damage but didn't give enemies a state.

EDIT: Oh nvm, it works! I just needed to remove the spaces between each state. Thank you very much!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-two-attacks.85999/