Difference between revisions of "Teleport Chances"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
  00176c10: 3c068019 lui r6,0x8019
 
  00176c10: 3c068019 lui r6,0x8019
  00176c14: 8cc6f4e0 lw r6,-0x0b20(r6)
+
  00176c14: 8cc6f4e0 lw r6,-0x0b20(r6) #custom array, not unit data.
 
  00176c18: 27bdffe8 addiu r29,r29,0xffe8
 
  00176c18: 27bdffe8 addiu r29,r29,0xffe8
 
  00176c1c: afbf0010 sw r31,0x0010(r29)
 
  00176c1c: afbf0010 sw r31,0x0010(r29)
Line 28: Line 28:
 
  00176c74: 00a32821 addu r5,r5,r3 Extra Distance * 5
 
  00176c74: 00a32821 addu r5,r5,r3 Extra Distance * 5
 
  00176c78: 0c017833 jal 0x0005e0cc              Check if Random is greater/equal to Chance
 
  00176c78: 0c017833 jal 0x0005e0cc              Check if Random is greater/equal to Chance
  00176c7c: 00052840 sll r5,r5,0x01 Extra Distance * 10 (16% chance of failure for each tile)
+
  00176c7c: 00052840 sll r5,r5,0x01 Extra Distance * 0x0A (10% chance of failure for each tile)
 
  00176c80: 8fbf0010 lw r31,0x0010(r29)
 
  00176c80: 8fbf0010 lw r31,0x0010(r29)
 
  00176c84: 27bd0018 addiu r29,r29,0x0018
 
  00176c84: 27bd0018 addiu r29,r29,0x0018
 
  00176c88: 03e00008 jr r31
 
  00176c88: 03e00008 jr r31
 
  00176c8c: 00000000 nop
 
  00176c8c: 00000000 nop
 +
 +
Return address:
 +
00176964

Latest revision as of 11:53, 3 October 2018

Teleport Chances
00176c10: 3c068019 lui r6,0x8019
00176c14: 8cc6f4e0 lw r6,-0x0b20(r6)			#custom array, not unit data.
00176c18: 27bdffe8 addiu r29,r29,0xffe8
00176c1c: afbf0010 sw r31,0x0010(r29)
00176c20: 90c20024 lbu r2,0x0024(r6)
00176c24: 00000000 nop
00176c28: 30420004 andi r2,r2,0x0004
00176c2c: 14400014 bne r2,r0,0x00176c80			Exit if not teleport? Not moving beyond Move distance?
00176c30: 34020001 ori r2,r0,0x0001
00176c34: 90c5000a lbu r5,0x000a(r6)			Target X
00176c38: 90c30007 lbu r3,0x0007(r6)			Current X
00176c3c: 90c4000b lbu r4,0x000b(r6)			Target Y
00176c40: 90c20008 lbu r2,0x0008(r6)			Current Y
00176c44: 00a31823 subu r3,r5,r3				Tar X - Cur X
00176c48: 04610002 bgez r3,0x00176c54			Branch if X Distance is positive
00176c4c: 00822023 subu r4,r4,r2				Tar Y - Cur Y
00176c50: 00031823 subu r3,r0,r3				Make X Distance Positive
00176c54: 04810002 bgez r4,0x00176c60			Branch if Y Distance is positive
00176c58: 00000000 nop
00176c5c: 00042023 subu r4,r0,r4				Make Y Distance positive
00176c60: 90c20006 lbu r2,0x0006(r6)			Load Move
00176c64: 00641821 addu r3,r3,r4				X Distance + Y Distance
00176c68: 34040064 ori r4,r0,0x0064				r4 = 100%
00176c6c: 00621823 subu r3,r3,r2				Distance - Move
00176c70: 00032880 sll r5,r3,0x02				Extra Distance * 4
00176c74: 00a32821 addu r5,r5,r3				Extra Distance * 5
00176c78: 0c017833 jal 0x0005e0cc              	Check if Random is greater/equal to Chance
00176c7c: 00052840 sll r5,r5,0x01				Extra Distance * 0x0A (10% chance of failure for each tile)
00176c80: 8fbf0010 lw r31,0x0010(r29)
00176c84: 27bd0018 addiu r29,r29,0x0018
00176c88: 03e00008 jr r31
00176c8c: 00000000 nop

Return address: 00176964