The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.3.33 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




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

#1
Posts: 281
Threads: 18
Thanks Received: 13
Thanks Given: 8
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)



Messages In This Thread
[Patch] Granular Damage Modification - by seibaby - 02-05-2017, 06:42 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite