Weather Elemental effects

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
No Parameters - Returns Nothing

Modify Target Current Action HP damage amount based on Weather
 - Fire :    -25% of HP damage if Thunderstorm (strong or not)
 - Thunder : +25% of HP damage if Thunderstorm (strong or not)
 - Ice :     +25% of HP damage if Snowstorm (strong or not)

Note that Fire and Thunder modification could be apply together if ability is Fire and Thunder
-------------------------------------------------------------------------------------------------------
00186ed0: 27bdffe8 addiu r29,r29,-0x0018    |
00186ed4: afb00010 sw r16,0x0010(r29)       |
00186ed8: 3c108019 lui r16,0x8019           |
00186edc: 921038f7 lbu r16,0x38f7(r16)      |r16 = Current Ability : Ability Element  0x801938f7 / 801938f7
00186ee0: afbf0014 sw r31,0x0014(r29)       |
00186ee4: 0c063998 jal 0x0018e660           |-->0018e660 - 0018e6b4  Returns r2 = Weather value (+0x03 if snowy) or 0x00 if ignored
00186ee8: 00000000 nop                      |
00186eec: 00402821 addu r5,r2,r0            |r5 = Weather
00186ef0: 24a2fffd addiu r2,r5,-0x0003      |r2 = Weather  - 0x03
00186ef4: 2c420002 sltiu r2,r2,0x0002       |r2 = 0x01 if Weather Mod is Thunderstorm or Strong thunder storm
00186ef8: 1040001e beq r2,r0,0x00186f74     #If Weather is Thunder Storm (strong or not)
00186efc: 32020080 andi r2,r16,0x0080           |r2 = 0x80 if Ability element is Fire
00186f00: 1040000e beq r2,r0,0x00186f3c         #If Ability element is fire
00186f04: 32020040 andi r2,r16,0x0040           |r2 = 0x40 if Ability element is Thunder
00186f08: 3c048019 lui r4,0x8019                    |
00186f0c: 8c842d90 lw r4,0x2d90(r4)                 |r4 = Target Current Action (TCA) data pointer
00186f10: 00000000 nop                              |
00186f14: 84830004 lh r3,0x0004(r4)                 |r3 = TCA HP damage amount
00186f18: 00000000 nop                              |
00186f1c: 00031040 sll r2,r3,0x01                   |HP Damage * 2
00186f20: 00431021 addu r2,r2,r3                    |HP Damage * 3 
00186f24: 04410002 bgez r2,0x00186f30               #If HP damage * 3 < 0x00  (never ?)
00186f28: 00000000 nop                                  |
00186f2c: 24420003 addiu r2,r2,0x0003                   |HP damage = 0x03
00186f30: 00021083 sra r2,r2,0x02                   |HP Damage * 3 / 4
00186f34: a4820004 sh r2,0x0004(r4)                 |Store HP Damage = 75% of Initial HP damage
00186f38: 32020040 andi r2,r16,0x0040               |r2 = 0x40 if Ability element is Thunder
00186f3c: 1040000e beq r2,r0,0x00186f78         #If Element is Thunder
00186f40: 24a2fffa addiu r2,r5,-0x0006          |r2 = Weather - 0x06
00186f44: 3c048019 lui r4,0x8019                    |
00186f48: 8c842d90 lw r4,0x2d90(r4)                 |r4 = Target Current Action (TCA) data pointer
00186f4c: 00000000 nop                              |
00186f50: 84830004 lh r3,0x0004(r4)                 |r3 = TCA HP damage amount
00186f54: 00000000 nop                              |
00186f58: 00031080 sll r2,r3,0x02                   |HP Damage * 4
00186f5c: 00431021 addu r2,r2,r3                    |HP Damage * 5
00186f60: 04410002 bgez r2,0x00186f6c               #If HP damage * 5 < 0x00 (never ?)
00186f64: 00000000 nop                                  |
00186f68: 24420003 addiu r2,r2,0x0003                   |r2 = 0x03
00186f6c: 00021083 sra r2,r2,0x02                   |HP Damage * 5 /4
00186f70: a4820004 sh r2,0x0004(r4)                 |Store HP Damage = 125% of Initial HP damage
00186f74: 24a2fffa addiu r2,r5,0xfffa       |r2 = Weather - 0x06
00186f78: 2c420002 sltiu r2,r2,0x0002       |r2 = 0x01 if Weather is  (Snow Storm or Strong snow storm)
00186f7c: 1040000f beq r2,r0,0x00186fbc     #If Weather is Snow Storm (strong or not)
00186f80: 32020020 andi r2,r16,0x0020           |r2 = 0x20 if Ability Element is Ice
00186f84: 1040000d beq r2,r0,0x00186fbc         #If Ability Element is Ice
00186f88: 00000000 nop                              |
00186f8c: 3c048019 lui r4,0x8019                    |
00186f90: 8c842d90 lw r4,0x2d90(r4)                 |r4 = Target Current Action (TCA) data pointer
00186f94: 00000000 nop                              |
00186f98: 84830004 lh r3,0x0004(r4)                 |r3 = TCA HP damage amount
00186f9c: 00000000 nop                              |
00186fa0: 00031080 sll r2,r3,0x02                   |HP Damage * 4
00186fa4: 00431021 addu r2,r2,r3                    |HP Damage * 5
00186fa8: 04410002 bgez r2,0x00186fb4               #If HP damage * 5 < 0x00
00186fac: 00000000 nop                                  |
00186fb0: 24420003 addiu r2,r2,0x0003                   |r2 = 0x03
00186fb4: 00021083 sra r2,r2,0x02                   |HP Damage * 5 /4
00186fb8: a4820004 sh r2,0x0004(r4)                 |Store HP Damage = 125% of Initial HP damage
00186fbc: 8fbf0014 lw r31,0x0014(r29)       END
00186fc0: 8fb00010 lw r16,0x0010(r29)       
00186fc4: 27bd0018 addiu r29,r29,0x0018     
00186fc8: 03e00008 jr r31                   
00186fcc: 00000000 nop                      

Note

Weather value used in this routine (returned by 0018e660 - 0018e6b4 )
 - 0x00 If weather is ignored
 - 0x01 Clear
 - 0x02 Rain
 - 0x03 Thunderstorm
 - 0x04 Strong Thunderstorm
 - 0x05 Snow
 - 0x06 Snowstorm
 - 0x07 Strong Snowstorm

Return location

Battle.bin
00188794: Elemental_XA_*_YA
00188e2c: Formula 09 : Dmg (Y/100)% Hit F(MA+X)%
00189d20: Formula 31 : Dmg ((PA+Y)/2*PA)
0018a61c: Formula 53 : Dmg (X)% Hit (MA+X)%