Determine which stat will be reduced

From Final Fantasy Hacktics Wiki
Revision as of 19:28, 17 April 2022 by Orkney (talk | contribs)
Jump to navigation Jump to search
No Parameters - Returns nothing

This routine determines which stats will be reduced (no bonus here) in a hard coded way (See here))
Chosen ability will decrease by Used Ability X amount.
No cumulative mechanics, only one stat will be altered (PA > MA > Speed)
----------------------------------------------------------------------------------------------
00187860: 3c038019 lui r3,0x8019            |
00187864: 946338d6 lhu r3,0x38d6(r3)        |r3 = Current Ability used Ability ID           0x801938d6 / 801938d6
00187868: 34020090 ori r2,r0,0x0090         |r2 = 0x90 (Power Break ID)
 --- PA Section ---
0018786c: 10620003 beq r3,r2,0x0018787c     #If used Ability ID is not  0x90 (Power Break)
00187870: 340200c6 ori r2,r0,0x00c6             |r2 = 0xc6 (Power Ruin ID)
00187874: 14620008 bne r3,r2,0x00187898         #If Used Ability ID is 0xc6 (Power ruin)
00187878: 34020091 ori r2,r0,0x0091             |r2 = 0x91 (Mind Break ID)
0018787c: 3c028019 lui r2,0x8019            #E      |
00187880: 904238f9 lbu r2,0x38f9(r2)                |r2 = Current Ability used Ability X
00187884: 3c038019 lui r3,0x8019                    |
00187888: 8c632d90 lw r3,0x2d90(r3)                 |r2 = Target Current Action (TCA) data pointer
0018788c: 3042007f andi r2,r2,0x007f                |r2 = Ability X without 0x80 flag (it is a malus)
00187890: 08061e3b j 0x001878ec                     >>Jump to set Attack type
00187894: a0620014 sb r2,0x0014(r3)                 |Store Ability X as a negative PA change
 --- MA Section ---
00187898: 10620003 beq r3,r2,0x001878a8     #If used Ability ID is not  0x91 (Mind Break)
0018789c: 340200c7 ori r2,r0,0x00c7             |r2 = 0xc7 (Mind Ruin ID)
001878a0: 14620008 bne r3,r2,0x001878c4         #If Used Ability ID is 0xc7 (Mind ruin)
001878a4: 3402008f ori r2,r0,0x008f             |r2 = 0x8f (Speed break ID)
001878a8: 3c028019 lui r2,0x8019            #E      |
001878ac: 904238f9 lbu r2,0x38f9(r2)                |r2 = Current Ability used Ability X
001878b0: 3c038019 lui r3,0x8019                    |
001878b4: 8c632d90 lw r3,0x2d90(r3)                 |r2 = Target Current Action (TCA) data pointer
001878b8: 3042007f andi r2,r2,0x007f                |r2 = Ability X without 0x80 flag (it is a malus)
001878bc: 08061e3b j 0x001878ec                     >>Jump to set Attack type
001878c0: a0620015 sb r2,0x0015(r3)                 |Store Ability X as a negative MA change
 --- Speed Section ---
001878c4: 10620003 beq r3,r2,0x001878d4     #If used Ability ID is not  0x8c (Speed Break)
001878c8: 340200c5 ori r2,r0,0x00c5             |r2 = 0xc5 (Speed Ruin ID)
001878cc: 1462000e bne r3,r2,0x00187908         #If Used Ability ID is 0xc5 (Speed ruin) /Else branch to END
001878d0: 00000000 nop                              |
001878d4: 3c028019 lui r2,0x8019            #E      |
001878d8: 904238f9 lbu r2,0x38f9(r2)                |r2 = Current Ability used Ability X
001878dc: 3c038019 lui r3,0x8019                    |
001878e0: 8c632d90 lw r3,0x2d90(r3)                 |r2 = Target Current Action (TCA) data pointer
001878e4: 3042007f andi r2,r2,0x007f                |r2 = Ability X without 0x80 flag (it is a malus)
001878e8: a0620012 sb r2,0x0012(r3)                 |Store Ability X as a negative MA change
 --- End Section ---
001878ec: 3c038019 lui r3,0x8019            |
001878f0: 8c632d90 lw r3,0x2d90(r3)         |r3 = TCA data pointer
001878f4: 00000000 nop                      |
001878f8: 90620025 lbu r2,0x0025(r3)        |r2 = TCA Attack type
001878fc: 00000000 nop                      |
00187900: 34420001 ori r2,r2,0x0001         |r2 = TCA Attack type enhanced with pseudo status
00187904: a0620025 sb r2,0x0025(r3)         |Set Attack type with pseudo status enabled (preserves other flags)
00187908: 03e00008 jr r31                   |
0018790c: 00000000 nop                      |

Hard coded mechanics

The Altered stat is tied to Ability ID
 - Ability 0x8f : Speed malus
 - Ability 0x90 : PA malus
 - Ability 0x91 : MA malus
 - Ability 0xc5 : Speed malus
 - Ability 0xc6 : PA malus
 - Ability 0xc7 : MA malus

If the routine is called by another ability, stat will not be reduced

Return locations

Battle.bin
0018932c: Formula 1a : Hit F(MA+Y)% // -PA/MA/SP (X)
00189ac8: Formula 2b : Hit (PA+X)% // -PA/MA/SP (X)