Well, since appealing for help worked so well last time, here’s another thing I’m struggling with 😛

So, we need to balance out enemy stats. There’s a huge, huge disparity in strength of enemies between early and late game, which means if the randomizer sends you into a late dungeon early, that’s essentially OHKO territory. I want the balance to be closer to ALTTP, where late-game enemies are tough and pack a punch, but you can still reasonably navigate around them even if your stats are nothing to write home about. (To balance this out, I also plan to reduce the total STR/DEF upgrades available to the player, to make everything somewhat even — will take some playtesting to get the dials just right, I imagine.)

Naturally, I want to be able to control an enemy’s effective health (HP), strength (STR) and defense (DEF). HP is easy, for that’s a parameter that’s specified when an enemy script is called in the map event table. STR and DEF… not so much. Those must be buried somewhere deep in the enemy event code itself.

I’ve been looking at the enemy code of various enemies, trying to find patterns and similarities that I can attribute to either how much damage an enemy does, or to how much damage the enemy takes when attacked. Not much luck so far. Here’s a summary of what I’ve been looking at:

Diamond Mine Enemies

As we all know, the enemies in the Diamond Mine are essentially re-skinned for use in the Jeweler’s Mansion. One of the first things I checked was whether the code for these enemies was copied with slight modifications, or whether they used the same block of code for both dungeons. Turns out the latter is the case: When you look at the event table for both Diamond Mine and Jeweler’s Mansion, they call identical enemies, which makes sense from a space-efficiency perspective. This means there must be a handler inside the code blocks for these enemies that checks which map you’re on, and determines from there how the enemy should behave.

Sure enough, this is exactly what happens. Here’s the block of code from the Eye Stalker enemy (@ab103) that checks whether you’re in the Jeweler’s Mansion, which is Map 233 (0xE9):

@ab12b: AD 44 06 / C9 E9 / 00 / D0 05 / 02 C4 [19 B1 8A]

This should be the key to determining how enemy STR and DEF are assigned — I mean, you’d think there would be similar patterns of code on either branching path of this check with some key differences that would denote a strong enemy for a positive check and a weaker enemy for a negative check. It’s probably good for our national security that I don’t work for the NSA, because I haven’t yet been able to find any helpful patterns as I trace through the code. I’m hoping others might have better luck.

Bats and Dynapedes

One problem with looking at code for Diamond Mine enemies is that each enemy in that map can deal damage in a couple ways: Either through contact with their hit box, or through contact with a projectile that they generate. These enemies also react to the player’s behavior, acting differently depending on factors such as the player’s proximity to them. To mitigate these complication, I’ve been comparing the code for two enemies that have neither projectiles, nor much in the way of reacting to player behavior: Bats (from the Underground Tunnel, @a8755) and Dynapedes (from the Sky Garden, @ac533). There are of course some differences in how these enemies behave, but they both generally wonder around at random and only deal damage if you walk into them. I was hoping that comparing the data of these two enemies would shed some light as to how enemy STR and DEF are handled. Again, no such luck yet, but I’m still looking.

Any help or insights from folks would be appreciated!