Death sentence, crystalization, treasurization, etc

From Final Fantasy Hacktics Wiki
Revision as of 15:28, 23 January 2016 by Choto (talk | contribs)
Jump to navigation Jump to search
Death sentence, crystalization, treasurization, reraise, defend removal, chicken brave increment
00183078: 27bdffe0 addiu r29,r29,0xffe0
0018307c: afb00010 sw r16,0x0010(r29)
00183080: 00a08021 addu r16,r5,r0			unit data
00183084: afb10014 sw r17,0x0014(r29)
00183088: 2611018c addiu r17,r16,0x018c		unit action data
0018308c: afbf0018 sw r31,0x0018(r29)
00183090: 0c062f5d jal 0x0018bd74			Current Action Data Nulling
00183094: 02202021 addu r4,r17,r0
00183098: 0c0088c3 jal 0x0002230c			Random Number Generator
0018309c: 00000000 nop
001830a0: 00403021 addu r6,r2,r0			undead revive check
001830a4: 92030058 lbu r3,0x0058(r16)
001830a8: 34020020 ori r2,r0,0x0020
001830ac: 30630030 andi r3,r3,0x0030
001830b0: 14620013 bne r3,r2,0x 00183100		branch if not (dead and not undead)
001830b4: 00000000 nop
Reraise if dead but not undead
001830b8: 9202005a lbu r2,0x005a(r16)
001830bc: 00000000 nop
001830c0: 30420020 andi r2,r2,0x0020
001830c4: 1040000e beq r2,r0,0x 00183100		Branch if Status = Reraise
001830c8: 3c03cccc lui r3,0xcccc
001830cc: 9602002a lhu r2,0x002a(r16)		Load Unit's Max HP
001830d0: 3463cccd ori r3,r3,0xcccd
001830d4: 00430019 multu r2,r3				Max HP * 0.8
001830d8: 34020002 ori r2,r0,0x0002			r2 = 2
001830dc: 34030020 ori r3,r0,0x0020			r3 = 20
001830e0: a20301ac sb r3,0x01ac(r16)		Store Status Removal 1 = Dead
001830e4: a20301ae sb r3,0x01ae(r16)		Store Status Removal 3 = Reraise
001830e8: 34030048 ori r3,r0,0x0048
001830ec: a20301b1 sb r3,0x01b1(r16)		Store Attack Type = HP Heal/Status Change?
001830f0: 00001810 mfhi r3					r3 = Max HP * 0.8
001830f4: 000318c2 srl r3,r3,0x03			Max HP / 10
001830f8: 08060cad j 0x 001832b4
001830fc: a6030192 sh r3,0x0192(r16)		Store HP Recovery = Max HP / 10
if not (dead and not undead)
00183100: 92050058 lbu r5,0x0058(r16)
00183104: 00000000 nop
00183108: 30a20020 andi r2,r5,0x0020
0018310c: 1040003d beq r2,r0,0x 00183204		branch if not dead
00183110: 00000000 nop
if dead and maybe undead
00183114: 3c028019 lui r2,0x8019
00183118: 8c42f5fc lw r2,-0x0a04(r2)			load acting unit ID
0018311c: 00000000 nop
00183120: 14400038 bne r2,r0,0x 00183204		branch if none
00183124: 00000000 nop
00183128: 92020005 lbu r2,0x0005(r16)
0018312c: 00000000 nop
00183130: 30420004 andi r2,r2,0x0004		if dead and immortal
00183134: 1440005f bne r2,r0,0x 001832b4		branch if immortal return r2 = 0
00183138: 00001021 addu r2,r0,r0
0018313c: 92020006 lbu r2,0x0006(r16)
00183140: 00000000 nop
00183144: 30420009 andi r2,r2,0x0009		if a guest and dead
00183148: 1440005a bne r2,r0,0x 001832b4		branch if immortal/save/load formation
0018314c: 00001021 addu r2,r0,r0			return r2 = 0
if normal unit
00183150: 92040007 lbu r4,0x0007(r16)		load death counter
00183154: 340200ff ori r2,r0,0x00ff
00183158: 2484ffff addiu r4,r4,0xffff		death counter -1
0018315c: 308300ff andi r3,r4,0x00ff		
00183160: 10620003 beq r3,r2,0x 00183170		branch if death counter expired
00183164: 00001021 addu r2,r0,r0			r2 = 0
00183168: 08060cad j 0x 001832b4			otherwise, return
0018316c: a2040007 sb r4,0x0007(r16)		store new death counter
If death counter expired
00183170: 30a20010 andi r2,r5,0x0010
00183174: 10400012 beq r2,r0,0x 001831c0		branch if not undead
00183178: 30c20001 andi r2,r6,0x0001			50%
0018317c: 10400010 beq r2,r0,0x 001831c0		branch if not reviving
if undead reviving
00183180: 34020020 ori r2,r0,0x0020
00183184: 0c0088c3 jal 0x0002230c			Random Number Generator
00183188: a2220020 sb r2,0x0020(r17)		store ??
0018318c: 9603002a lhu r3,0x002a(r16)		load max HP
00183190: 00000000 nop
00183194: 00430018 mult r2,r3			
00183198: 00001812 mflo r3
0018319c: 04610002 bgez r3,0x 001831a8		
001831a0: 34020002 ori r2,r0,0x0002			return r2 = 2
001831a4: 24637fff addiu r3,r3,0x7fff
001831a8: 00031bc3 sra r3,r3,0x0f
001831ac: 24630001 addiu r3,r3,0x0001		Undead Revival
001831b0: a6230006 sh r3,0x0006(r17)		store HP recovery
001831b4: 34030048 ori r3,r0,0x0048		
001831b8: 08060cad j 0x 001832b4
001831bc: a2230025 sb r3,0x0025(r17)		store attack type HP recovery/status change
if not undead or not undead reviving (death counter expired)
001831c0: 920201ba lbu r2,0x01ba(r16)		load modified flags
001831c4: 00000000 nop
001831c8: 30420008 andi r2,r2,0x0008
001831cc: 10400002 beq r2,r0,0x 001831d8		branch if not control flagged
001831d0: 34030010 ori r3,r0,0x0010			if enemy unit, 50/50?
001831d4: 34030110 ori r3,r0,0x0110			if player unit, 25% chance?
001831d8: 00c31024 and r2,r6,r3
001831dc: 10400004 beq r2,r0,0x 001831f0		branch if treasuring
001831e0: 34020001 ori r2,r0,0x0001			return r2 = 1
crystal
001831e4: 34030040 ori r3,r0,0x0040
001831e8: 08060c7e j 0x 001831f8
001831ec: a223001b sb r3,0x001b(r17)		store attack status infliction (0x40 = crystal)
treasure
001831f0: 34030001 ori r3,r0,0x0001
001831f4: a223001c sb r3,0x001c(r17)		store attack status infliction treasure
001831f8: 34030008 ori r3,r0,0x0008
001831fc: 08060cad j 0x 001832b4
00183200: a2230025 sb r3,0x0025(r17)		store status change
if not dead and not undead
00183204: 9202005c lbu r2,0x005c(r16)		load current status
00183208: 00000000 nop
0018320c: 30420001 andi r2,r2,0x0001
00183210: 10400013 beq r2,r0,0x 00183260		branch if not death sentenced
00183214: 00000000 nop
00183218: 9204006c lbu r4,0x006c(r16)		load death sentence CT
0018321c: 00000000 nop
00183220: 2484ffff addiu r4,r4,0xffff		decrement death sentence CT
00183224: 308200ff andi r2,r4,0x00ff
00183228: 1440000c bne r2,r0,0x 0018325c		branch if CT is not 0
0018322c: 34020001 ori r2,r0,0x0001		
if death sentencing
00183230: a2220024 sb r2,0x0024(r17)		store death sentence status removal
00183234: 34020008 ori r2,r0,0x0008
00183238: a2220025 sb r2,0x0025(r17)		store as status change
0018323c: 92020058 lbu r2,0x0058(r16)		laod current status
00183240: 00000000 nop
00183244: 30420010 andi r2,r2,0x0010
00183248: 14400005 bne r2,r0,0x 00183260		Branch if undead
0018324c: 34020020 ori r2,r0,0x0020
00183250: a222001b sb r2,0x001b(r17)		store attack status infliction: dead	
00183254: 08060cad j 0x 001832b4
00183258: 34020003 ori r2,r0,0x0003			jump to end, return r2 = 3
0018325c: a204006c sb r4,0x006c(r16)		store death sentence CT
Remove Defend
00183260: 92020058 lbu r2,0x0058(r16)		load current status
00183264: 00000000 nop
00183268: 30420002 andi r2,r2,0x0002
0018326c: 10400004 beq r2,r0,0x 00183280		branch if not defending
00183270: 34020002 ori r2,r0,0x0002
00183274: a2220020 sb r2,0x0020(r17)		store attack status removal: defend
00183278: 34020008 ori r2,r0,0x0008
0018327c: a2220025 sb r2,0x0025(r17)		store attack type
00183280: 92020024 lbu r2,0x0024(r16)		load brave
00183284: 00000000 nop
00183288: 2c42000a sltiu r2,r2,0x000a
0018328c: 10400005 beq r2,r0,0x 001832a4		branch if brave > 10
00183290: 34030081 ori r3,r0,0x0081
00183294: 92220025 lbu r2,0x0025(r17)		load attack type
00183298: a2230016 sb r3,0x0016(r17)		store brave change +1
0018329c: 34420001 ori r2,r2,0x0001
001832a0: a2220025 sb r2,0x0025(r17)		store attack type
001832a4: 92220025 lbu r2,0x0025(r17)
001832a8: 00000000 nop
001832ac: 0002102b sltu r2,r0,r2		set if attack type < 2 (brave change)
001832b0: 00021040 sll r2,r2,0x01		return 2 if attack type < 2
001832b4: 8fbf0018 lw r31,0x0018(r29)
001832b8: 8fb10014 lw r17,0x0014(r29)
001832bc: 8fb00010 lw r16,0x0010(r29)
001832c0: 27bd0020 addiu r29,r29,0x0020
001832c4: 03e00008 jr r31
001832c8: 00000000 nop
r2 = 3 : Death sentence death
r2 = 2 : Reraise
r2 = 1: Brave Change
r2 = 1 : Treasuring, crystaling
r2 = 0 : knocked out, death counter decrement