ref: b23a298b545565b947c57684fc9f055028bc5429
parent: 12bb1f82bc08e34febad33844dfdd1f30dfbf5e9
author: Snesrev <snesrev@protonmail.com>
date: Fri Oct 7 14:17:53 EDT 2022
Avoid cape magic underflow if an anti-fairy consumes magic. (#126)
--- a/player.c
+++ b/player.c
@@ -3197,7 +3197,9 @@
link_direction &= ~0xf;
if (!--cape_decrement_counter) {
cape_decrement_counter = kCapeDepletionTimers[link_magic_consumption];
- if (!--link_magic_power) {
+ // Avoid magic underflow if an anti-fairy consumes magic.
+ if (link_magic_power == 0 && (enhanced_features0 & kFeatures0_MiscBugFixes) ||
+ !--link_magic_power) {
Link_ForceUnequipCape();
return;
}