Users browsing this thread: 1 Guest(s)
[Patch] Granular Damage Modification

#1
Posts: 274
Threads: 18
Thanks Received: 133
Thanks Given: 53
Joined: Mar 2014
Reputation: 8
Status
None
Sup folks! @Imzogelmo recently quoted me (in agreement) as saying the equivalent of "this thing should exist". And I made it exist, actually, a while back, then promptly forgot all about it.

What is this, in a nutshell?
It allows a hacker to to make an attack apply, or not apply, each step in damage modification separately.

What are the steps of damage modification?
  1. Random variance
  2. Defense/Mdef
  3. Safe/Shell
  4. Defend
  5. Row
  6. Morph
  7. Self damage theory
  8. Damage multiplier
A bit of background info: the damage modification function performs modifications to the final damage done by an attack, most noticeably the reduction by Defense, but also a host of other minor functions. In fact, there are exactly eight such functions, as described above.

There is a spell bit for Ignore Defense, which actually causes the attack to ignore a lot more: Defense, Safe/Shell, Defend, Row, and Morph are all skipped if this is set. The whole thing really isn't very flexible. However, there is a single-byte battle variable ($3414) which, if cleared, causes the entirety of the damage modification function to be skipped. How many bits are in a byte? That's right, eight!

So I took it upon myself to modify the damage modification function to parse each bit of $3414 separately, to ensure that a hacker could separately set any combination of damage modifications for an attack. Now you can simply hook any place where $3414 is cleared (conveniently listed in the code) to insert a small function to set any desired combination of bits (example provided!).

Honestly, the fact that it took me this long to share this is reflective of how few actual use cases I saw for it. All I wanted was Ignore Target Row, and that's included, but it's really more of an add-on to the main functionality of this patch (I should split that off and make a separate patch for it...). Hopefully, someone with more imagination than me can make better use of this code.

It's been a while since I touched (or tested) this code, so I offer no guarantees. Also, I didn't bother to optimize free space usage - I simply relocated the entire function because the entire thing is full of branches and a pain to split up. This isn't a "plug and play" type of patch, anyway - to make use of it, you need at least basic assembly knowledge.

xkas 0.06 compatible code:
  Find
Quote  
[-] The following 3 users say Thank You to seibaby for this post:
  • Imzogelmo (02-05-2017), SSJ Rick (02-07-2017), Tenkarider (02-05-2017)

#2
Posts: 81
Threads: 4
Thanks Received: 22
Thanks Given: 29
Joined: Nov 2009
Reputation: 14
Status
Weakness
Yep, as I said, I thought this is how the designers *should* have done it. I hate to see a whole byte wasted for a true/false flag... But yet, there it is. And to have that byte actually skip 8 individual steps-- it almost screams for a flexibility mod. So thanks, seibaby, and kudos for the code implementation.

As for what to do with it, I still have no idea really, but it would be a great thing to incorporate into a deep hack project. If you don't mind, I think I'll add the functionality into my as-yet-unnamed compilation patch, along with 24-bit HP for monsters, bugfix selection, and other such amenities.


I appreciate the prayers and good wishes. Those who don't know, I was diagnosed with stage 4 melanoma in 2019, and I have done well with the treatment, but eventually treatments stop working and you change.  I recently had a seizure at work, now I am healing but not able to work or really do much at all. The focus is just to get better. Again, thanks for the support and if I can help you I will.  I've forgotten more about this game than most people should ever learn, lol.
  Find
Quote  

#3
Posts: 1,633
Threads: 56
Thanks Received: 50
Thanks Given: 135
Joined: Apr 2014
Reputation: 12
Status
Atma
Sooner or later i'll need to check this stuff because, you know... i have an idea or two on how to use them


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#4
Posts: 274
Threads: 18
Thanks Received: 133
Thanks Given: 53
Joined: Mar 2014
Reputation: 8
Status
None
(02-05-2017, 08:16 PM)Imzogelmo Wrote: As for what to do with it, I still have no idea really, but it would be a great thing to incorporate into a deep hack project. If you don't mind, I think I'll add the functionality into my as-yet-unnamed compilation patch, along with 24-bit HP for monsters, bugfix selection, and other such amenities.

You're absolutely welcome to use my code in your compilation. Your project sounds really neat and if you don't mind I'd like a copy of that reassemblable C2 bank to use as basis for my own work. Smile

As for utility, most vanilla spells that make use of damage modification really work best with the binary option, so I can see why they simplified things. The best utility I can see is to allow things that ignore defense to not ignore Safe/Shell (and Drakkhen made a patch eons ago for just that). Adding random variance to stuff like potions or Runic is kinda neat, I guess, although mostly for flavour. Where this would shine is most likely in entirely new custom spell or Tools effects.
  Find
Quote  

#5
Posts: 81
Threads: 4
Thanks Received: 22
Thanks Given: 29
Joined: Nov 2009
Reputation: 14
Status
Weakness
Oh, I have a disassembly that will produce the battle engine part of C2, equivalent to vanilla version 1.0. You can get that if you want. But the compilation thing is not quite ready yet.


I appreciate the prayers and good wishes. Those who don't know, I was diagnosed with stage 4 melanoma in 2019, and I have done well with the treatment, but eventually treatments stop working and you change.  I recently had a seizure at work, now I am healing but not able to work or really do much at all. The focus is just to get better. Again, thanks for the support and if I can help you I will.  I've forgotten more about this game than most people should ever learn, lol.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite