• Welcome to Final Fantasy Hacktics. Please login or sign up.

Looking for Linear PA damage formulas (switching punch formulas)

Started by Ansehelm, February 24, 2021, 11:33:15 pm


I'm going to standardize damage in my mod by switching punch abilities to linear damage. AFAIK there aren't any straight PA*X abilities that don't also involve WP, so I'm looking for an ASM that changes a formula to PA*X.  Also, how does one change the standard punch/barehanded attack formula (not the individual punch art abilities)?
  • Modding version: PSX


There are a few ASM hacks and spreadsheets related to that, but nothing that does that specific thing.

Start here:

Ctrl f XA here:

You'll reference this in whatever formulas you use:

The simplest way to make unarmed linear is to make it use base PA instead of current PA for one of the operands in the unarmed formula.

Back to the Base XA calculation, look at this part:
00185ae0: 14600014 bne r3,r0,0x00185b34        Branch if a weapon is equipped //if no weapon, execute following code
00185ae4: 00b00018 mult r5,r16                 Brave * PA
00185ae8: 00001812 mflo r3                     r3 = Brave * PA
00185aec: 3c0251eb lui r2,0x51eb
00185af0: 3442851f ori r2,r2,0x851f
00185af4: 00620018 mult r3,r2                  Brave * PA * 0.32
00185af8: 3c018019 lui r1,0x8019
00185afc: a43038ce sh r16,0x38ce(r1)           Store XA = PA
00185b00: 00031fc3 sra r3,r3,0x1f
00185b04: 00001010 mfhi r2                     r2 = Brave * PA * 0.32
00185b08: 00021143 sra r2,r2,0x05              Brave * PA * 0.32 / 32 (or Brave *  PA / 100)
00185b0c: 00431823 subu r3,r2,r3
00185b10: 00031400 sll r2,r3,0x10              Brave * PA / 100 * 65536
00185b14: 3c018019 lui r1,0x8019
00185b18: a42338d0 sh r3,0x38d0(r1)            Store YA = Brave * PA / 100
00185b1c: 14400058 bne r2,r0,0x00185c80        Branch if YA > 0
00185b20: 24620001 addiu r2,r3,0x0001          r2 = YA + 1 (minimum of 1 YA)
00185b24: 3c018019 lui r1,0x8019
00185b28: a42238d0 sh r2,0x38d0(r1)            Store YA = 1
00185b2c: 08061720 j 0x00185c80                Jump to end
00185b30: 00000000 nop

You'll need to make room for another load like this, but for base PA:
00185ad4: 90500036 lbu r16,0x0036(r2)          Load Attacker's PA
I don't know what you could condense/remove to accomplish that, but there's probably something in there that bears removing or could be simplified.
  • Modding version: PSX