# # notes # # # questions (many yprobably will be obvious from looking at existing routines or searching wiki): # what (and where) is Attacker Current Action data? # how are various data structures (stack?) implemented, and where are they? # how can I figure out what is being called where with cheat engine, a debugger, or a hex editor? # what sort of underlying data structures does FFT use to determine things like hit rates, elements, status inflicts, and so on? seems like modifying them is the easiest way to spoon feed the ai # how do i load attackers skill bytes (AI flags, various skill flags, status inflict, element flags) and where are they? # how do i load attackers weapon element flags byte, so i can logical OR it? # how do i separate "M/Atk/Def UP" flags from "WP/PA/MA/SP" powered flags? i'm running out of bits here. # # # todo: # make a formula pointer table todo list # # make maintenance check called by these routines reduce hit rate for stat/gear breaks/steals by 1/2, 1/3, or 1/4. probably latter as it needs to justify a support slot, and it's a more limited abandon # also needs to check the evadable flag for these skills if that's unchecked # # put gear broken/stolen checks in steal/break/mighty sword hardcoding routine space # check for: # * nybble of effect is in "affects gear" range of effects # * affected gear is present # * various protection effects are not present, and if they are account for them # * anything which enhances accuracy is dealt with, either here or in respective formulas (most likely the latter, as any integer accuracy above 0 is a sign of success for this routine) # things to do in this routine: # * check break or steal selection bit # * check nybble special effect (should it be passed as parameter in calling routine, or grabbed here? question for forums) vs target gear # * check "negate damage if sfx used" bit here, or in calling routine? i'm guessing calling routine, as that deals with damage and should only be checked after this routine returns a yes & effect # * note: random steal/break effect - make bit flags of target's equipped gear, get random bit, mask to target's equipped gear bit flags, if logical or is true then proceed, if not try again # * anything else? # find a faith flag somewhere so you can integrate faith based weapon strike skills? # # # # # # # # # # # # # # # # # # 25, 26, 27, 28 are adjacent (break, steal, steal gil, steal exp) # can be freely consolidated # # 29 can't be consolidated, move it elsewhere # # 2a, 2b could be consolidated with a finger guard flag and sleep flag i can check for. # # 2c can't be consolidated, move it elsewhere # # 2d, 2e, 2f, 30 are adjacent (holy sword, mighty sword, dark sword mp absorb, dark sword hp absorb) # can be freely consolidated # need check in 2f and 30 to ensure you don't absorb more hp/mp than target has remaining - cap it at hp/mp lost by target, otherwise infinite mp absorb bug and minor hp absorb bug # # 61, 62 could be consolidated here, likely freeing up space where they are # # # # # # # # # # # # # https://ffhacktics.com/wiki/Base_XA_Calculation # not modifying this here, but you need to study it to ensure +- Y is applied correctly # will be modified later, by a lot # useful as a reference too # # # https://ffhacktics.com/wiki/Song_abilities # same here: not modifying this now, but will later # useful as a reference too # # # https://ffhacktics.com/wiki/Dance_abilities # same here: not modifying this now, but will later # useful as a reference too # # # ram -> battle.bin: -67000 # https://ffhacktics.com/wiki/Formula_Table # 18F614 ram start # 18F7A0 ram end # 128614 battle.bin start # 1287A0 battle.bin end # not assembly, just a pointer table # easily labeled, tbh # label everything for later reuse, but keep unmodified stuff in vanilla locations, albeit via a label 0x80188B64 # Formula 01 Start 0x80188BA4 # Formula 02 Start 0x80188BE4 # Formula 03 Start 0x80188C24 # Formula 04 Start 0x80188C9C # Formula 05 Start 0x80188CF4 # Formula 06 Start 0x80188D3C # Formula 07 Start 0x80188D84 # Formula 08 Start 0x80188DF4 # Formula 09 Start 0x80188E78 # Formula 0A Start 0x80188EB8 # Formula 0B Start 0x80188EF8 # Formula 0C Start 0x80188F38 # Formula 0D Start 0x80188F90 # Formula 0E Start 0x80189084 # Formula 0F Start 0x801890DC # Formula 10 Start 0x80189124 # Formula 11 Start 0x8018912C # Formula 12 Start 0x80189164 # Formula 13 Start 0x8018916C # Formula 14 Start 0x801891AC # Formula 15 Start 0x80189204 # Formula 16 Start 0x8018925C # Formula 17 Start 0x8018929C # Formula 18 Start 0x801892A4 # Formula 19 Start 0x801892AC # Formula 1A Start 0x8018933C # Formula 1B Start 0x8018937C # Formula 1C Start 0x801893D8 # Formula 1D Start 0x80189434 # Formula 1E Start 0x80189464 # Formula 1F Start 0x801895C4 # Formula 20 Start 0x801895F4 # Formula 21 Start 0x80189654 # Formula 22 Start 0x8018967C # Formula 23 Start 0x801896B4 # Formula 24 Start 0x801896EC # Formula 25 Start 0x80189794 # Formula 26 Start 0x80189828 # Formula 27 Start 0x80189870 # Formula 28 Start 0x80189910 # Formula 29 Start 0x801899A4 # Formula 2A Start 0x80189A90 # Formula 2B Start 0x80189AD8 # Formula 2C Start 0x80189B20 # Formula 2D Start 0x80189B94 # Formula 2E Start 0x80189C50 # Formula 2F Start 0x80189C90 # Formula 30 Start 0x80189CD0 # Formula 31 Start 0x80189D74 # Formula 32 Start 0x80189E28 # Formula 33 Start 0x80189E94 # Formula 34 Start 0x80189F08 # Formula 35 Start 0x801868F0 # Formula 36 Start 0x80189F84 # Formula 37 Start 0x80187F24 # Formula 38 Start 0x80186D2C # Formula 39 Start 0x80186D00 # Formula 3A Start 0x80186D58 # Formula 3B Start 0x80186DBC # Formula 3C Start 0x80189FCC # Formula 3D Start 0x8018A00C # Formula 3E Start 0x8018A02C # Formula 3F Start 0x8018A088 # Formula 40 Start 0x8018A114 # Formula 41 Start 0x8018A17C # Formula 42 Start 0x80186E28 # Formula 43 Start 0x80186E54 # Formula 44 Start 0x80186E78 # Formula 45 Start 0x8018A218 # Formula 46 Start 0x8018A220 # Formula 47 Start 0x8018A250 # Formula 48 Start 0x80188288 # Formula 49 Start 0x8018A2C4 # Formula 4A Start 0x8018A2EC # Formula 4B Start 0x8018A3A0 # Formula 4C Start 0x8018A3D0 # Formula 4D Start 0x8018A420 # Formula 4E Start 0x8018A458 # Formula 4F Start 0x8018A4A0 # Formula 50 Start 0x8018A4E8 # Formula 51 Start 0x8018A554 # Formula 52 Start 0x8018A5E4 # Formula 53 Start 0x8018A668 # Formula 54 Start 0x8018A698 # Formula 55 Start 0x8018A6F8 # Formula 56 Start 0x8018A758 # Formula 57 Start 0x8018A824 # Formula 58 Start 0x8018A908 # Formula 59 Start 0x8018A980 # Formula 5A Start 0x8018A9C4 # Formula 5B Start 0x8018AA10 # Formula 5C Start 0x8018AA54 # Formula 5D Start 0x8018AA98 # Formula 5E Start 0x8018AAC8 # Formula 5F Start 0x8018AAF8 # Formula 60 Start 0x8018AB18 # Formula 61 Start 0x8018AB58 # Formula 62 Start 0x8018AB98 # Formula 63 Start 0x8018AC44 # Formula 64 Start # https://ffhacktics.com/wiki/Talk_Skill # 186c04 ram start # 186cfc ram end # 11FC04 battle.bin start # 11FCFC battle.bin end # modify this to handle the stat breaks/heals, and have it treat the gear breaks/steals as stat buffs # going to reuse it later to de-hardcode the stat buff skills, so okay if the statement above has overlaps - never gonna call it anywhere else # add checks for min/max stats resulting in failure/miss if outside those bounds # https://ffhacktics.com/wiki/Maintenance # 187638 ram start # 18768c ram end # 120638 battle.bin start # 12068C battle.bin end # see notes above, or better yet transpose them here # allow hacker to set a divisor for hit rate, with 0 making it miss completely of course (assuming divide by zero errors don't result in a crash) # https://ffhacktics.com/wiki/Determine_which_stat_will_be_reduced # 187860 ram start # 18790c ram end # 120860 battle.bin start # 12090C battle.bin end # great example of idiocy. does pretty much same thing as talk skill, plus talk skill fx are duplicated in next 6 formulas or so after talk skill lmao - triple the dumb # used in formulas 1a and 2b # probably not enough room to reuse, either switch with another needed small subroutine, repurpose it for something else, or make it free space for later modifications # https://ffhacktics.com/wiki/Steal/Break/Might_Sword_Hard_Coding # 1879c8 ram start # 187c9c ram end # 1209C8 battle.bin start # 120C9C battle.bin end # note: routine above will be reused in steal, break, and mighty sword formulas # https://ffhacktics.com/wiki/18 # 18929c ram start # 1892a0 ram end # 12229C battle.bin start # 1222a0 battle.bin end # dummy, consolidate with formula 1A # https://ffhacktics.com/wiki/19 # 1892a4 ram start # 1892a8 ram end # 1222A4 battle.bin start # 1222A8 battle.bin end # dummy, consolidate with formula 1A # https://ffhacktics.com/wiki/1A_Hit_F(MA%2BY)%25_//_-PA/MA/SP_(X) # 1892ac ram start # 189338 ram end # 1222AC battle.bin start # 122338 battle.bin end # if you can get a faith flag somehow then you can add this guy in there, tho you need to switch x and y # https://ffhacktics.com/wiki/25_Equipped:_Break_Hit_(PA%2BWP%2BX)%25 # 1896ec ram start # 189790 ram end # 1226EC battle.bin start # 122790 battle.bin end # https://ffhacktics.com/wiki/26_Equipped:_Steal_Hit_(SP%2BX)%25 # 189794 ram start # 189824 ram end # 122794 battle.bin start # 122824 battle.bin end # https://ffhacktics.com/wiki/27_StealGil_(CasLVL*SP)_Hit_(SP%2BX)%25 # 189828 ram start # 18986c ram end # 122828 battle.bin start # 12286C battle.bin end # https://ffhacktics.com/wiki/28_StealExp_(Lowest_of_TarCurExp_%26_SP%2BY)_Hit_(SP%2BX)%25 # 189870 ram start # 18990c ram end # 122870 battle.bin start # 12290C battle.bin end # https://ffhacktics.com/wiki/29_OppositeSex:_Hit_(MA%2BX)%25 # 189910 ram start # 1899a0 ram end # 122910 battle.bin start # 1229A0 battle.bin end # this formula isn't being consolidated with these, it's just in the way and needs to be moved upwards so i have more free space # https://ffhacktics.com/wiki/2A_Hit_(MA%2BX)%25_//_AffectBraveOrFaith(Y) # 1899a4 ram start # 189a8c ram end # 1229A4 battle.bin start # 122A8C battle.bin end # if you can get a talk skill check - which encompasses finger guard check (only for hostile fx) and sleep check - then you can consolidate this too #issue is that finger guard is limited abandon. only works on talk skills. need other fx to make it viable, either enhancing talk skills or immunity to silence (fluff: loudmouth, narcissist, etc) # https://ffhacktics.com/wiki/2B_Hit_(PA%2BY)%25_//_-PA/MA/SP_(X) # 189a90 ram start # 189ad4 ram end # 122A90 battle.bin start # 122AD4 battle.bin end # https://ffhacktics.com/wiki/2C_DmgMP_(Y)%25_Hit_(PA%2BY)%25 # 189ad8 ram start # 189b1c ram end # 122AD8 battle.bin start # 122B1C battle.bin end # this formula isn't being consolidated with these, it's just in the way and needs to be moved upwards so i have more free space # consolidate it in a later hack instead. with these formulas and no stat/gear break/steal special effects: # https://ffhacktics.com/wiki/1B_DmgMP_(Y)%25_Hit_F(MA%2BX)%25 # https://ffhacktics.com/wiki/09_Dmg_(Y/100)%25_Hit_F(MA%2BX)%25 # https://ffhacktics.com/wiki/0E_Dmg_(Y)%25_Hit_F(MA%2BX)%25_100%25_Status_Hide_Status # https://ffhacktics.com/wiki/0F_AbsMP_(Y)%25_Hit_F(MA%2BX)%25 # https://ffhacktics.com/wiki/10_AbsHP_(Y)%25_Hit_F(MA%2BX)%25 # https://ffhacktics.com/wiki/1B_DmgMP_(Y)%25_Hit_F(MA%2BX)%25 # https://ffhacktics.com/wiki/2C_DmgMP_(Y)%25_Hit_(PA%2BY)%25 # https://ffhacktics.com/wiki/47_AbsHP_(Y)%25_100%25_Status # https://ffhacktics.com/wiki/4D_AbsHP_(Y)%25_Hit_(MA%2BX)%25 # https://ffhacktics.com/wiki/53_Dmg_(Y)%25_Hit_(MA%2BX)%25 # # https://ffhacktics.com/wiki/2D_Dmg_(PA*(WP%2BY))_100%25_Status # 189b20 ram start # 189b90 ram end # 122B20 battle.bin start # 122B90 battle.bin end [0x00189b20] addiu r29,r29,-0x0018 # [0x00189b24] sw r31,0x0010(r29) # [0x00189b28] jal 0x00188510 # Physical_Evade_Calculation If Abillity is evadeable roll Ability Evade byte against Ability base Hit - Returns r2 [0x00189b2c] nop # [0x00189b30] bne r2,r0,0x00189b84 # #If Attack is not evaded [0x00189b34] nop # [0x00189b38] jal 0x00185e5c # Store PA and WP + Y XA is Attacker's PA and YA is WP + Y [0x00189b3c] nop # [0x00189b40] jal 0x00185fa4 # Weapon_Element_Strengthen XA + 25% if Weapon Element is strengthened [0x00189b44] nop # [0x00189b48] jal 0x001886a4 # Physical Dmg calculation Modify XA (Support-Statuses-Compat-Critical Hit), Might add Knockback, Set TCA HP damage to XA*YA [0x00189b4c] nop # [0x00189b50] jal 0x00186fd0 # Elemental Damage Modification (Prep) Cancel Action / Enable Absorption flags and/or Modify HP damage [0x00189b54] nop # [0x00189b58] lui r2,0x8019 # [0x00189b5c] lw r2,0x2d90(r2) # r2 = Target Current Action (TCA) data pointer [0x00189b60] nop # [0x00189b64] lbu r2,0x0000(r2) # r2 = TCA hit flag [0x00189b68] nop # [0x00189b6c] beq r2,r0,0x00189b84 # If Attack hits (not canceled by elements) [0x00189b70] nop # [0x00189b74] jal 0x001870fc # Elemental_Absorption HP damage becomes HP recovery - Changes Attack Type from 0x80 to 0x40 (HP recovery) [0x00189b78] nop # [0x00189b7c] jal 0x00187eb4 # Apply status (to action) - (Preserve hit status, evade type, hit %) Update Target Current Action status infliction/Removal [0x00189b80] nop # [0x00189b84] lw r31,0x0010(r29) # END [0x00189b88] addiu r29,r29,0x0018 # [0x00189b8c] jr r31 # [0x00189b90] nop # # https://ffhacktics.com/wiki/2E_Equipped:Break_Dmg_(PA*WP) # 189b94 ram start # 189c4c ram end # 122B94 battle.bin start # 122C4C battle.bin end # https://ffhacktics.com/wiki/2F_AbsMP_(PA*WP) # 189c50 ram start # 189c8c ram end # 122C50 battle.bin start # 122C8C battle.bin end # https://ffhacktics.com/wiki/30_AbsHP_(PA*WP) # 189c90 ram start # 189ccc ram end # 122C90 battle.bin start # 122CCC battle.bin end # https://ffhacktics.com/wiki/61_%E2%80%93Brave_(Y)_Hit_F(MA%2BX)%25 # 18ab18 ram start # 18ab54 ram end # 123B18 battle.bin start # 123B54 battle.bin end # https://ffhacktics.com/wiki/62_%E2%80%93Brave_(Y)_Hit_(MA%2BX)%25 # 18ab58 ram start # 18ab94 ram end # 123B58 battle.bin start # 123B94 battle.bin end