~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
========================================================
Secret of Mana Remove Empire Castle Gate Permanently 1.4
by Kethinov                                     Jun 2019
========================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This hack alters the gate on the Empire Castle to remove it permanently after you first enter the castle to meet the Emperor. This allows you to reenter Northtown after the Emperor betrays you to save your game, forge weapons, and resupply before finishing the castle.

You can also do an optional sidequest revisiting the castle at any time after getting Flammie. A kid in Northtown will now offer clues about a mysterious treasure chest in the castle's throne room. The Emperor's treasure chest contains a sword orb, but you'll have to fight tougher monsters in order to reach it on your second visit such as Dark Knights and a Dark Stalker just outside the throne room. Underneath the Emperor's chest is a mysterious statue holding a diary. The diary contains an unfinished entry, revealing content that always existed in the game's code but was never actually used until now. (The pygmy statue is also a dummied out graphic.) More info about the dummied out diary entry here: https://tcrf.net/Secret_of_Mana_(SNES)#Diary_Entry

Bear in mind if you choose to do this sidequest to get the sword orb in the Emperor's chest, it will not ultimately result in being able to get an extra sword orb (like Level 9 Weapons Progression Balance will). Instead it will prevent the one in Grand Palace from spawning because you got it early. Likewise if you get the sword orb from Grand Palace first, the Emperor's chest will no longer spawn if you do this sidequest afterward. Also the whip orb in the castle has been swapped with Mech Rider II's javelin orb in order to better balance orb progression now that it's possible to forge weapons before fully clearing the castle.

Other changes include the addition of an extra 1000gp chest in the castle basement to make use of an unused corner of the room and a new 50gp treasure chest behind the infamous secret passage in Northtown that conspicuously exists but serves no actual purpose in the original game. A side effect of this hack is that it will delete the old woman in town who creepily says nothing to you when you try to speak to her, even after you clear Northtown Ruins. She was depressing, so she won't be missed. (This is to make room in the game's memory for the new treasure chest.) These changes are copied directly from "Secret of Mana Treasure in Northtown Woods 1.1" and are necessary to make room for the new dialog offering clues about the Emperor's treasure chest. Her husband (the old man who says his wife is acting strangely) was also replaced with an Imperial Solider who warns you not to loiter. This too was done to make room for the new dialog offering clues about the Emperor's treasure chest. And King Truffle will now wander when he rescues you, displaying previously unseen walking frames.

Some important things to note:

- If you're using Level 9 Weapons Progression Balance, be sure to apply that patch first, then apply this one after. This hack reverts the new sword orb added to Palace of Darkness by Level 9 Weapons Progression Balance, forcing you to do this sidequest to get the extra sword orb (else you'll get two sword orbs in the Grand Palace chest). It also swaps the Empire Castle whip orb with Mech Rider II's javelin orb.
- How to combine this with the Variable Width Font hack: 1. Apply VWF, 2. Remove header, 3. Apply Remove Empire Castle Gate Permanently, 4. Apply Remove Empire Castle Gate Permanently VWF support.
- How to combine this with Relocalized: 1. Apply Relocalized, 2. Apply Remove Empire Castle Gate Permanently, 3. Apply Remove Empire Castle Gate Permanently Relocalized support.
- Known issue: The throne room treasure chest is unusually colored because it must share a palette with the Emperor.

Changelog:

- 1.4: King Truffle will now wander when he rescues you, displaying previously unseen walking frames.
- 1.3: Swapped whip (chest) and javelin (Mech Rider II) orbs in Empire Castle to balance progression. Thanks to hmsong for the suggestion. Also added full support for VWF and Relocalized. Thanks to Queue for the VWF/Relocalized code.
- 1.2: Added kid in Northtown offering clues about the new sidequest, changed Emperor's treasure to a sword orb (reverts the Palace of Darkness one from Level 9 Weapons Progression Balance if present), a new 1000gp chest to the castle basement, bundled changes from "Secret of Mana Treasure in Northtown Woods 1.1" with this hack, replaced an old man in Northtown with an Imperial Soldier (a technical requirement), and added tougher monsters on second visit. Thanks to hmsong for the latter idea.
- 1.1: Added cursed statue holding the dummied out diary entry. Thanks to ThanatosZero for the idea.
- 1.0: Initial version.