Tsukihime Mana Shield Effect Help


When an actor with a mana shield state takes damage that's greater than their current HP, the mana shield doesn't absorb the damage, and the actor just dies. How can I make it so that the MP must reach zero before the HP takes any damage?
probably
@hp = [(@hp - hp_damage).to_i, 0].max if @mp == 0
or
hp_damage = @result.hp_damage - mp_damage if @mp == 0
Testing those script shows that it does work as intended, but only about 50% of the time.
It's like the shield is randomly applied to an attack.
Not sure what is wrong there.
probably
@hp = [(@hp - hp_damage).to_i, 0].max if @mp == 0
or
hp_damage = @result.hp_damage - mp_damage if @mp == 0

Tried adding the "if @mp == 0" part where you suggested, neither of them seemed to work. Tried using both of them at once, and it didn't work either.

If it helps, my actor has a larger Max MP than their Max HP.
Please tell me the names of all battle-related scripts you're using
Yanfly Core
Yanfly Ace Battle Engine

Yanfly Anti-Fail Message
Yanfly Follow Up Skill
Yanfly Skill Restrictions
Yanfly Skill Cost Manager
Yanfly Hide Skills
Yanfly Combat Log

Tsukihime Effect Manager
Tsukihime Mana Shield
Tsukihime Thorns
Tsukihime Add Self State

Tsukihime Troop Battle BGM
Tsukihime Post-Battle Events
Tsukihime Casting Time
Tsukihime Conditional States
Tsukihime State Animations

DoubleX's Counterattack Edit

Galv's Parameter Names

Craze's Accuracy Overflow

Fomar0153 Battle Events from another Troop

Selchar's Add Skill Command Exceptions
Selchar's FF7 Limit Break

I have also tried the edits you suggested in a new project, but it didn't work either.

Original thread: https://forums.rpgmakerweb.com/threads/tsukihime-mana-shield-effect-help.128987/