Refactoring invincibility frames handling