Damage and Knockback Routine (alternative)
Revision as of 18:51, 24 April 2022 by Orkney (talk | contribs) (Created page with " No Parameters - Returns Nothing '''Alternative Notes Damage_and_Knockback_Routine_(Dash,_tackle,_throw_stone) Set Target Current Action HP damage = Random n...")
No Parameters - Returns Nothing Alternative Notes Damage_and_Knockback_Routine_(Dash,_tackle,_throw_stone) Set Target Current Action HP damage = Random number between 1 and used Ability Y If Action is being executed ( 0x8018f5fc = 0x00) Roll knockback : - Knockback will be triggered if Random(0 to Target's Brave-1) < Random (0 to Attacker's Brave-1) ------------------------------------------------------------------------------------------------------------- 0018691c: 27bdffe8 addiu r29,r29,-0x0018 | 00186920: afbf0010 sw r31,0x0010(r29) | 00186924: 0c063ba8 jal 0x0018eea0 |-->Random_Process,_gives_a_number_between_0-7fff returns r2 = Random {0…0x7fff} 00186928: 00000000 nop | 0018692c: 3c038019 lui r3,0x8019 | 00186930: 906338fa lbu r3,0x38fa(r3) |r3 = Current Ability used Abilit Y 00186934: 00000000 nop | 00186938: 00430018 mult r2,r3 |Y * random 0018693c: 00001012 mflo r2 |r2 = Y * Random{0…0x7fff) 00186940: 04410002 bgez r2,0x0018694c #If r2 < 0x00 00186944: 00000000 nop | 00186948: 24427fff addiu r2,r2,0x7fff |make r2 positive 0018694c: 000213c3 sra r2,r2,0x0f |r2 = Random between 0x00 and (Y-1) (Y * Random/max possible Random +1) 00186950: 3c038019 lui r3,0x8019 | 00186954: 946338ce lhu r3,0x38ce(r3) |r3 = Current Ability XA 00186958: 24420001 addiu r2,r2,0x0001 |r2 = Random from 0x01 to Y 0018695c: 00430018 mult r2,r3 |XA * Random (1 to Y) 00186960: 3c048019 lui r4,0x8019 | 00186964: 8c842d90 lw r4,0x2d90(r4) |r4 = Target Current Action (TCA) data pointer 00186968: 34020080 ori r2,r0,0x0080 |r2 = 0x80 0018696c: a0820025 sb r2,0x0025(r4) |Set TCA Attack type to HP damage 00186970: 3c038019 lui r3,0x8019 | 00186974: 8c63f5fc lw r3,-0x0a04(r3) |r3 = Action State 00186978: 00001012 mflo r2 |r2 = XA*Random(1 to Y) 0018697c: 14600017 bne r3,r0,0x001869dc #If Action is being executed (Roll knocback) /Else branch to END 00186980: a4820004 sh r2,0x0004(r4) |Store XA*Random(1 to Y) as TCA HP damage 00186984: 0c063ba8 jal 0x0018eea0 |-->Random_Process,_gives_a_number_between_0-7fff returns r2 = Random {0…0x7fff} 00186988: 00000000 nop | 0018698c: 3c038019 lui r3,0x8019 | 00186990: 8c632d94 lw r3,0x2d94(r3) |r3 = Attacker data pointer 00186994: 00000000 nop | 00186998: 90630024 lbu r3,0x0024(r3) |r3 = Attacker's Brave 0018699c: 00000000 nop | 001869a0: 00430018 mult r2,r3 |r2 = Random * Brave 001869a4: 00002812 mflo r5 |r5 = Brave * Random(0 to 0x7fff) 001869a8: 04a10002 bgez r5,0x001869b4 #If r5 < 0x00 001869ac: 00000000 nop | 001869b0: 24a57fff addiu r5,r5,0x7fff |Make r5 positive 001869b4: 3c028019 lui r2,0x8019 | 001869b8: 8c422d98 lw r2,0x2d98(r2) |r2 = Target data pointer 001869bc: 00000000 nop | 001869c0: 90440024 lbu r4,0x0024(r2) |r4 = Target Brave 001869c4: 0c017833 jal 0x0005e0cc |-->Pass/Fail_Roll r2 = 0x00 if Random (0 to Target Brave -1) < Random (0 to Attacker's Brave -1) 001869c8: 00052bc3 sra r5,r5,0x0f |r5 = Random(0 to Attacker's Brave - 1) 001869cc: 14400003 bne r2,r0,0x001869dc #If Random (0 to Target Brave -1) < Random (0 to Attacker's Brave -1) : play knockback 001869d0: 00000000 nop | 001869d4: 0c0610fb jal 0x001843ec |-->Knockback_Calculation Check Knockback usability - Set knockback flags if ok 001869d8: 00000000 nop | 001869dc: 8fbf0010 lw r31,0x0010(r29) END 001869e0: 27bd0018 addiu r29,r29,0x0018 001869e4: 03e00008 jr r31 001869e8: 00000000 nop
Return location
Battle.bin 00189fbc: 37_Dmg_(Rdm(1…Y)*PA)