The way i made it work now is that if you set "allowCoinFlipDeaths" to true, then the mod will check if an enemy is doing a special attack and re-enable the function which allow you to take damage and also the function which applies buffs/debuffs to you(otherwise you would truly be invincible).
After the enemy is done with its special attack you'll be back to being invincible(if you manage to survive a special attack like the prison guard one for example, but the few i've seen do end up killing you).