![secret of mana rom coolrom secret of mana rom coolrom](https://travelshelper.com/wp-content/uploads/2020/10/Praia-de-As-Catedrais-CATHEDRAL-BEACH-The-secret-of-an-ancient-treasure-hidden-in-the-rocks-5.jpg)
So I figured, if underground + head hidden = move south / north or state change, maybe changing the head showing movement from south / north to east / west would allow the full range of movement, but still give a means of changing state. underground state changes if in non-movement direction cannot attack if underground + head showing can only go above ground if underground + head hidden I reevaluated what was wrong with his vanilla AI to begin with: So I scrapped the addition of 4 AI actions and went back to the drawing board. It wasn't going to work well this way: there wasn't a good way to wedge the underground state change back in other than random chance or triggered by attack, neither of which was good. Besides that, if I had added 4-direction movement to either or both underground states (head hidden / showing), then what would trigger changing head state (showing / hiding head)? I actually set this approach up enough to try it and just ignored the glitched out body graphics.
SECRET OF MANA ROM COOLROM CODE
To make this approach work, I would have needed to either relocate something in bank $DC (to add 4 entries to that table) or change the Dark Lich's AI code to clamp the lookup in that table to its maximum value. The relevant table is at $DCE4A9 which controls the Dark Lich's body animation while performing various AI actions.
![secret of mana rom coolrom secret of mana rom coolrom](https://r.mprd.se/media/images/35232-Secret_of_Mana_(USA)-10.jpg)
But there's a problem: the Dark Lich has some animation lookup tables in bank $DC (0x1C) and they don't have room for 4 more AI actions. There's enough space in his AI table to add 4 more AI actions, and with some optimization, space can be made in his AI action scripts to add 4 more. The Dark Lich doesn't have any AI for horizontal movement while underground.
SECRET OF MANA ROM COOLROM HOW TO
With that resolved, I then needed to figure out how to make him move east / west while underground. Since it gave a mechanism to get back to the hidden head state, when it moved again, it'd have a 20% chance to go above ground, so that fixes the logic flaw that would let you trap him.
![secret of mana rom coolrom secret of mana rom coolrom](http://2.bp.blogspot.com/_008y3yHrMZ8/TMpBse6QvkI/AAAAAAAAULg/Gg-r9hEFkX0/s1600/Legend+of+Mana2.png)
Instead of disabling movement, I changed the attack logic, so that if his head was showing and he tried to attack, it'd hide his head and do the fist clench. Obviously that'd conflict with changes to make the Dark Lich move more when underground, so first I rewrote this. Kethinov's original Dark Lich Head Bang Fix removed his ability to move south / north while underground, which meant if he tried to move, it was 50% chance of doing nothing, or 50% chance of showing / hiding head, which meant eventually he'd hit the 20% chance to go above ground when his head was hidden. If he went underground, you stand east / west of him to make him show his head, then stand south / north of him so he only moves south / north, and when he attacks he does nothing, so he can never attack, never hide his head, and never go above ground.
![secret of mana rom coolrom secret of mana rom coolrom](https://www.retrostic.com/img/screenshots/aladdin-usa-thumb.jpg)
So the original Dark Lich AI issues stem from a combination of underground + head showing + attack = do nothing, and the 20% chance to go above ground only being possible if the head is hidden. move south / north for 0x18 animation frames whichever direction the target is mostly in move east / south / west / north for 0x24 animation frames