MV Make event happen when player attacks an enemy that is guarding.

Hello, first of all, sorry for bad english.
I want to make an event happen during the battle if the player decides to attack while the enemy is using the skill guard. Like for example the enemy says something with a dialogue box and then the player gets an state like confusion.
Yanfly action sequences. And I think it's like conditional:
if (target.isGuard())

Original thread: https://forums.rpgmakerweb.com/threads/make-event-happen-when-player-attacks-an-enemy-that-is-guarding.183563/