Question about special attacks

Ok so I'm trying to make 2 skills that do things when the enemy attacks.

The first one has a chance to stun all enemies and if an enemy wasn't stunned and it attacks that turn then it should take damage.
As for the second skill, the player selects the skill and if the user evades an attack that turn then it deals damage to the enemy that attacked and lowers its atk.

Does anyone have any ideas on how I could do these?
Thanks in advance

Original thread: https://forums.rpgmakerweb.com/threads/question-about-special-attacks.55760/