Author Topic: Labyrinth of Touhou 19F  (Read 3683 times)

0 Members and 3 Guests are viewing this topic.

Thurler

  • Go slow to go fast
    • Twitch
    • Twitter
    • Github
  • Gender: Male
Re: Labyrinth of Touhou 19F
« Reply #60 on: Yesterday at 04:59:47 AM »
Actually, Thurler just found out the hit rate formula today, it's (ACC*100)/(EVA+100)%, with ACC being the user's Accuracy plus the spell's Accuracy modifier. So at base 100 ACC with no modifiers you'd have a 50% chance of hitting a target with 100 EVA.

To expand a bit on this, if a move has 10000 ACC or higher, the game treats the target's EVA stat as if it were 0, effectively giving the move 10000% chance to hit! :cirnotan:

Messing around a bit further with damage and evasion calculation also helped me isolate where in the code damage variance comes into the damage calculation, and properly patch it out so damage is consistent. This should help with testing out spell formulas or whether some things scale additively or multiplicatively, just in case there's still something we don't know. It also acts as a ground truth if you're planning out how much damage you'll do to a boss.

The game basically takes the exact damage value, multiplies it by (1000 + X), then divides it by 1000. X here is an integer from (what I assume to be) -100 to +100, giving the 10% variance we know should exist. What the patch below does is change the division to also be (1000 + X), effectively negating the damage variance. This might make Marisa's Sudden Impulse skill useless, depending on how the game calculates the bonuses from that, I haven't tested that out. To patch your game:
  • Open your game exe on any hex editor
  • Look for the following hex sequence: E8 B4 98 FD FF 6A 00 68 E8 03 00 00 (should be at offset 0x36C4A)
  • Replace it with the following hex sequence: E8 B4 98 FD FF 6A 00 51 90 90 90 90
Obviously you should backup your exe in case something goes wrong. This changes the last 5 bytes in the sequence from a "push 1000" instruction to a "push ecx" instruction followed by 4 NOPs. This is what hijacks the fixed 1000 value from before with the same random number used for the multiplication. In the unlikely event we get another patch, I've kinda documented the procudure I used to find that hex sequence in the video linked below, so that the same steps can be used to determine the new offset (the sequence includes a "call" instruction, which is likely to change in a new patch/build). There's also one for the accuracy/evasion formula, if anyone is interested in how these were found in some detail.

Patching out damage variance: https://www.youtube.com/watch?v=sNufZRu2fSE
Figuring out the ACC/EVA formula: https://www.youtube.com/watch?v=TBXjbTsJLJE