øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1884.msg19145e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index149e.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1884.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index149e.html.zx—Kg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ…¬û OKtext/htmlISO-8859-1gzip@øÕû ÿÿÿÿÿÿÿÿTue, 10 Mar 2020 08:27:26 GMT0ó°° ®0®P®€§²ð®–Kg^ÿÿÿÿÿÿÿÿ*û  Evasion Fix: AKA How an amateur fixed Square's mess.

Author Topic: Evasion Fix: AKA How an amateur fixed Square's mess.  (Read 2852 times)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Evasion Fix: AKA How an amateur fixed Square's mess.
« on: September 10, 2013, 09:17:20 PM »
Alright, this is something that could be quite game changing and of interest to any FFIV players so I thought I would make a thread for it because something like this was clearly intended to be in the game but due to some ridiculous oversight, it was not.

In the normal game enemies in their data at 29/80 bytes are supposed to have an evasion stat, it is part of their defense code that they should have Defense, Evasion, and Defense Multiplier, now what happens normally is that all of their stats (at least I presume all of their stats. I haven't yet taken a closer look to see if Square was on-the-job with the rest of the Monster Data.) are entered in when battle begins Except for Evasion. The reasoning on why this is, is ridiculous and Square should be ashamed of themselves for not noticing such a thing. (Missing it in code is one thing, but to miss it in testing (and presumably looking at the monster's stats in battle) is another.

Here is the fix.

In LoRom/HiRom...

Normal
$03/90D7   9D 2A 20   STA $202A,x[$7E:22AA]   A:0046   X:0280   Y:0083   P:envMxdIzC


Fixed.
0390D7 9D 29 20 - One byte, one off, and yet Square never caught it.

In ROM this is at...

0192D7 9D 29 20 - One byte, one off, and yet Square never caught it.

What normally happens is that Evasion is written into the Defense Base and then is immediately erased for the Defense Base. Maybe it was intentional? But I mostly doubt it.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #1 on: September 10, 2013, 09:59:05 PM »
So how much does this fix change the game? I don't think I'd want it results in missing more often. Still really interesting to know it's a bug after all. (Also, just LoROM. FF4 is not a HiROM game.)

 :edit:

Does this apply to magic evasion as well?
« Last Edit: September 10, 2013, 10:07:27 PM by Dragonsbrethren »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #2 on: September 10, 2013, 10:04:41 PM »
Due to the odd way accuracy is processed it doesn't make as much of a difference as you may think. It does become a bit more difficult to hit a status proc with weapons though. The game still takes into account attack multipliers so you may see lower damage because some of your attacks aren't going through in the full calculation, but you're still more than likely to land more blows than not.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #3 on: September 10, 2013, 10:23:13 PM »
Guess you missed the edit, but shouldn't there be a similar bug with magic evasion?

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #4 on: September 10, 2013, 10:42:07 PM »
I... didn't take notice. Let me take a look...

Well like Evasion it is missing...

And yes, same exact measure was taken. Now I'm beginning to wonder if it was by design that they took these out rather than by mistake. Once, alright I can see someone not noticing it but a second time makes it seem deliberate. Alright so they included evasions for Magic and Physical for monsters but never followed through with it.

$03/90E9   9D 22 20   STA $2022,x[$7E:22A2]   A:0001   X:0280   Y:0083   P:envMxdIzC - Store Magic Defense Multiplier into Monster's stats
$03/90EC   AD 1D 29   LDA $291D  [$7E:291D]   A:0001   X:0280   Y:0083   P:envMxdIzC - Load Magical Evasion
$03/90EF   9D 24 20   STA $2024,x[$7E:22A4]   A:0028   X:0280   Y:0083   P:envMxdIzC - Load Magical Evasion into Monster's stats (where Magical Defense Base will be)
$03/90F2   AD 1E 29   LDA $291E  [$7E:291E]   A:0028   X:0280   Y:0083   P:envMxdIzC - Load Magical Defense Base
$03/90F5   9D 24 20   STA $2024,x[$7E:22A4]   A:0009   X:0280   Y:0083   P:envMxdIzC - Store Magical Defense Base over Magical Evasion.

Another single one byte fix.

It really does seem like they were dummying them for whatever reason.

 :edit:With that said I have noticed quite a difference in using Magic, against Zombies, Peep failed, which is supposed to have a 99% chance to hit. The attacks spells didn't really seem to be all that effected though, but that's likely because of their 99% hit.
« Last Edit: September 10, 2013, 10:49:19 PM by Grimoire LD »

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #5 on: September 10, 2013, 10:59:09 PM »
I'd think they'd just remove the code (or NOP it out if they didn't want offsets to change) if that were the case. Still really strange to accidentally do the same thing twice; I guess it could've been a copy and paste error.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #6 on: September 10, 2013, 11:12:04 PM »
That's a good point, well in any case, both evasions can be re-implemented into the game so that should be that, it really does speak poorly of their Q&A team to not miss it once but twice.

 I would say that I should look for some reference to 2001 to see if the byte is supposed to be decremented with Long Range Check somewhere but is overlooked, but someone already made that patch thankfully so I guess that should cover it. Maybe I should take a look at the Infinite Arrows Bug and see if there's no easy way to fix that...

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #7 on: September 11, 2013, 12:23:02 AM »
I'll just point out a few things...

The Wonderswan (WS) port subsequently ports many of the same behaviors for monsters... despite them keeping the stats for them. Don't ask me the logic to any of that.

With that said... I've already stated my case for physical evasion in the other thread... but magic evasion is a lot more complicated.

Trying to apply magic evasion to monsters is very... suboptimal. Monsters like the Behemoth would effectively be immune to all forms of magic if you used those stats (well, there are other ways to make that happen in the first place).

It would make the game a bit more hardtype-ish though.

You wouldn't be able to use Tornado on the Dark Dragon.... (not that he isn't easy to take down).
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #8 on: September 11, 2013, 12:35:16 AM »
Here's a few examples... I'm just scrolling through the list quickly through zyrthofar's editor:

1) Waterbug - It is weak vs lightning, but fixing "magic evasion" will require you to have Cecil inflict damage on it prior for Thunder to be used... or it would very likely survive the attack.

2) Alligator - It is weak vs ice, and you get a nice free Ice Rod in the dungeon you find the monster in... but the item magic would simply fail to work due to its low spell multiplier (it's 2, where the Alligator has a magic evasion multiplier of 3).

3) Ogre - Stealing MP from an Ogre is a pain in the ass. It has a magic evasion multiplier of 3... and Tellah's "optimal" Wisdom/Intelligence stat is usually @ 24 (spell multiplier of 9) and that would actually slow down his MP absorption...

I'm sure I could find more examples... but the point is that the game's stats aren't perfectly balanced for the "buggy" code.

 :edit:

4) Tinytoad - Edge's Flood would be ineffective, due to his low INT stat. The monster has naturally "high magic evasion", which limits Rydia to do magic damage.

5) Plague - The match would be a lot more interesting when it does have quite a bit of magic evasion to play with...

6) Most monsters that you could fight in the "Peninsula of Power" north of Mt. Ordeals would murder you... Palom would not have enough INT to damage them through their magic evasion... everything would rely on DK Cecil's Deathbringer.

7) Mechanical Dragon - That monster suddenly becomes an even bigger pain in the ass.

8) Fiend - Casting Mute on them is a pain in the ass... the MageMasher is the solution, but that might take a while...

9) Most moon creatures would be tougher to kill with Leviathan, given their high natural innate magic evasion and Rydia's INT isn't probably where it should be.... (especially with suboptimal equipment).

10) Octomammoth would make Tellah obsolete. Rydia would struggle to produce damage vs it with Chocobo.

11) Cagnazzo finished off with Tellah's Thundaga early in the match? Think again!

12) Rubicante wouldn't really be harmed by Rydia... unless it's just Chocobo while his cape is open... Edge's Ninjutsu is a wasted effort.

13) Odin's match would be that much harder...

14) Leviathan would survive a few Thundaras for sure.

15) EvilWall would be a nastier beast...

There we go.
« Last Edit: September 11, 2013, 12:57:19 AM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #9 on: September 11, 2013, 12:45:29 AM »
Yeah, if this is a bug, the game definitely seems balanced around it. I personally figured the 0 def/m.def% was a feature, especially with the special handling of 254 defense. But it's almost undeniably a bug looking at the code. (Bugs as features, is this Doom?)
« Last Edit: September 11, 2013, 01:04:16 AM by Dragonsbrethren »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #10 on: September 11, 2013, 12:50:05 AM »
You are absolutely right. The WaterBug and Alligator withstood a Thunder (and even resisted one from a Wis. 6 character). The Alligator though the Ice Rod did not always fail to work, it would deal about half of the damage one is used to seeing against it though, but it did fail sometimes. So it's likely random if the Evasion is broken through or not.

This would be great for a Hardtype though. I can kind of understand why it's not implemented for a normal game now however.

Heh, you're quite right DragonsBrethren and I don't think that any version of the game has these enabled, meaning that this became the norm for FFIV releases. But I could be mistaken.

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #11 on: September 11, 2013, 01:02:14 AM »
Fixing the magic evasion is good enough to be its own "hardtype", believe it or not. Regular evasion is meh.

I tend to think of these "bugs" in terms of FF6, except FF6 made Magic Block/Evasion the ultimate stat for a while. In this case, it is simply disabled/bugged (well, at least magic evasion) because it breaks stuff in a much more serious sense.

There may also be unintended side effects (monster magic is #1 on my list to test against).
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #12 on: September 11, 2013, 01:29:58 AM »
Hmm, what do you mean by monster magic causing an issue here? It's a little late so sorry if the meaning is obvious, heh.

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: Evasion Fix: AKA How an amateur fixed Square's mess.
« Reply #13 on: September 11, 2013, 01:43:28 AM »
Hmm, what do you mean by monster magic causing an issue here? It's a little late so sorry if the meaning is obvious, heh.

Monster magic tends to have "special rules" applied to them. I forget what they are exactly, but I'll just repeat what I have from memory (you can refer to my Algo FAQ).

Status effect based "monster magic" like Breath for instance ignore the basic rules for checking if you can evade it through magic evasion. It has very little to do IIRC with the hit rate that is applied to the spell... it is more to do that it's not part of the white/black/ninjutsu/summon spell list. They do still check for resistances though.

Monster magic attack spells do seem to follow the regular damage formulas though.... although IIRC there are special exceptions to the CurrentHP/MaxHP based spells.
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3