I think I worked this out!
So, the original assembly does this:
$03/D54F AD 2B 27 LDA $272B [$7E:272B] ;Load target's status immunity 1
$03/D552 2D A3 28 AND $28A3 [$7E:28A3] ;AND immunity 1 with status to inflict 1
$03/D555 D0 06 BNE $06 [$D55D] ;If any immunity matches any status to inflict, fail any further operations
$03/D557 AD 2C 27 LDA $272C [$7E:272C] ;Load target's status immunity 2
$03/D55A 2D A4 28 AND $28A4 [$7E:28A4] ;AND immunity 2 with status to inflict 2
$03/D55D D0 53 BNE $53 [$D5B2] ;fail pending any matches
$03/D55F AD 03 27 LDA $2703 [$7E:2703] ;Load target's status byte 1
$03/D562 05 AE ORA $AE [$00:00AE] ;add in all applicable statuses to inflict
$03/D564 8D 03 27 STA $2703 [$7E:2703] ;store in target's status byte 1
$03/D567 AD 04 27 LDA $2704 [$7E:2704]
$03/D56A 05 AD ORA $AD [$00:00AD]
$03/D56C 8D 04 27 STA $2704 [$7E:2704] ;perform same operation with status 2
Obviously, the problem with this is that any immunity to any applicable status will fail the whole routine.
So I replaced that chunk of code with this (which is the same exact length thanks to some extreme variable storing on the part of the original developers):
$03/D54F AD 2B 27 LDA $272B [$00:272B] ;Load Target's Status Immunity Byte 1
$03/D552 49 FF EOR #$FF ;Perform Exclusive OR (this turns "on" all bits that are "off" and turns "off" all bits that are "on"), thus turning "status Immunity" into "status vulnerability"
$03/D554 25 AE AND $AE [$00:06AE] ;AND status vulnerability 1 with status to inflict 1 (leaving only the vulnerable statuses to inflict)
$03/D556 85 AE STA $AE [$00:06AE] ;Store the result into status to inflict 1
$03/D558 AD 2C 27 LDA $272C [$00:272C] ;
$03/D55B 49 FF EOR #$FF ;
$03/D55D 25 AD AND $AD [$00:06AD] ;
$03/D55F 85 AD STA $AD [$00:06AD] ;Perform the same operation with status immunity 2 and status to inflict 2
$03/D561 A5 AC LDA $AC [$00:06AC] ;Load target's current status 1 (already stored here earlier in the routine)
$03/D563 05 AE ORA $AE [$00:06AE] ;add in all applicable statuses to inflict (1)
$03/D565 8D 03 27 STA $2703 [$00:2703] ;Store in target's current status 1
$03/D568 A5 AB LDA $AB [$00:06AB] ;
$03/D56A 05 AD ORA $AD [$00:06AD] ;
$03/D56C 8D 04 27 STA $2704 [$00:2704] ;Perform same operation with status 2
And there you have it! I tested it out, having a monster use Breath on a party that had two completely vulnerable, one with Blind immunity and one with Mute immunity. All statuses applied to all targets with the exception of those that they were immune to.
Looking at the code, i can see one possible drawback to this fix - this will force the game to consider any execution of this routine "successful," thus it will always dispel Berserk status (which the original one does upon any successful hit), even if it doesn't inflict any new statuses. But I think I can live with that.
Thoughts?