Hit barrier + weakness variable

So I have two burning questions.

1: I want to have a barrier state that doesn't just block damage, it functions based on the amount of hits it can take.

Like let's say actor 1 has a 5 hit barrier that negates all damage taken while it's up. The actual strength behind an attack doesn't matter - a 5 hit combo by the demon king will get rid of it but so will 5 rats attacking at once.

I feel the best way I can describe this is like the Pokemon Mimikyu's Disguise ability where it can block a direct attack but only once.

I am intensely curious if theres a way to pull this off via a script or something like that.

2: I'm pretty sure this was asked before but I'm curious if it's possible to make the game keep track of using weaknesses on enemies.

Like you hit an enemy with a super effective attack, and a variable rises so it does something different next time it's hit with a super effective attack.

Original thread: https://forums.rpgmakerweb.com/threads/hit-barrier-weakness-variable.123744/