Fully fix poison issue

This commit is contained in:
Lorenzo Carletti 2020-08-22 11:04:10 +02:00
parent 95fe2f6d90
commit 9a56b3d424
3 changed files with 48 additions and 21 deletions

View File

@ -1,24 +1,54 @@
//==============================================================================
//Fixes the issue where Gyigas could take damage from poison
//Fixes the issue where Gyigas and other enemies would not use their death attack
//(or phase change) because of the poison
dee6c_fix_poison_gyigas:
push {lr}
add r0,#0x44
ldrh r0,[r0,#0] // Get the enemy's identifier
lsr r1,r0,#3 // Divide it by 8
lsl r2,r1,#3
sub r0,r0,r2 // Get the division's rest
ldr r2,=#status_damage_table
add r2,r2,r1
ldrb r1,[r2,#0] // Get the byte that contains this entity's data
mov r2,#1
lsl r2,r0
and r2,r1 // If this is not 0, the enemy shouldn't take damage
cmp r2,#0
bne @@end
ldr r0,[r6,#0] // Proceed normally
mov r1,r4
bl 0x80E9CFC
bl 0x80E9CFC //Normal code
ldr r2,=#0x2024860 //Where the action's data is stored
ldr r0,[r6,#0] //Load the entity's slot
add r0,#0x44
ldrh r1,[r0,#0]
cmp r1,#0
beq @@normal //Characters have this set as 0
cmp r1,#0xDA //This particular Gyigas phase does not need this... (It will reflect the poison randomly if we let it continue)
beq @@normal
ldrh r1,[r0,#4] // Get the enemy's current HP
cmp r1,#0 //Check if they're 0
bne @@normal
ldrh r1,[r0,#6] // Get the enemy's scrolling HP
cmp r1,#0 //Check if they're 0 (probably not needed)
bne @@normal
mov r0,#0x9 //Fabricate a death check for the enemy
add r2,#0x16
strh r0,[r2,#0]
mov r0,#0
strh r0,[r2,#4]
mov r0,#4 //This counts as a PSI, since setting it as a normal attack would make it so the Diamond Dog would reflect it
strh r0,[r2,#6]
add r2,#0xC
strh r0,[r2,#0x6]
mov r0,#1
strh r0,[r2,#4]
mov r0,#0
strh r0,[r2,#0]
add r2,#0x24
strh r0,[r2,#0]
strh r0,[r2,#0x12]
ldr r2,=#0x2025034
mov r0,#1
strh r0,[r2,#0] //This is a PSI. Not a physical attack
ldr r0,=#0x3005378
mov r1,#0xC //This is PSI Cool Thing
strh r1,[r0,#0]
mov r1,#0
strh r1,[r0,#0x10]
b @@end
@@normal:
mov r0,#0x64 //Normal game's behaviour
strh r0,[r2,#0x16]
@@end:
pop {pc}

View File

@ -1704,7 +1704,7 @@ nop
//==============================================================================
// Fix Gyigas' poison bug
//==============================================================================
.org 0x80DEE6C :: bl dee6c_fix_poison_gyigas
.org 0x80DEE6C :: bl dee6c_fix_poison_gyigas :: nop :: nop :: nop
//==============================================================================
// Move stuff around in order to make space for the code
@ -1857,9 +1857,6 @@ flyover_tea:
flyover_coffee:
.include "data/flyover-coffee.asm"
status_damage_table:
.incbin "data/status_damage_immune_table.bin"
m2InsaneCultist:
.incbin "data/m2-insane-cultist.bin"