Ignore Freeze for monsters - seibaby - 01-05-2017
author: seibaby
Download
Things have been kind of slow here lately due to the holidays, so I thought I'd kick off the new year with a new hack!
We all know how broken Gau is with certain Rages like Nightshade (Charm) and Doom Drgn (N. Cross). Long ago, Drakkhen released his Ignore Charm (sadly non-functional, but fixed by me here), and now I'm releasing this patch, Ignore Freeze. In short, with this patch, a monster author can use FF3usME to check the Float immunity box in the monster editor in order to set Freeze immunity.
Don't worry, it doesn't actually set Float immunity as well - that bit actually signifies Dance immunity. Just like the original code does some bit twiddling to transform "inherent Dance" into "inherent Float" (which is why the checkbox is labeled as Float in the editor), my code twiddles some more bits to transform Dance immunity into Freeze immunity.
Code: ;Ignore Freeze
;This modifies the code that loads monster data and copies bit 0 of $CF0016
;(block Dance) into bit 1 of in-battle Blocked Statuses 4 (block Freeze).
;In other words, Dance immunity now also grants Freeze immunity.
;xkas 0.06
hirom ;don't change this
;header ;uncomment if your ROM has a header
!freespace = $C2A65A ;change this (requires 7 bytes of free space in C2)
;New code
org !freespace
newfunc:
STA $3330,Y ;Blocked Status 3
LSR ;Carry = 0 if Dance is blocked
LDA #$FF
RTS
;Load monster's special attack, elemental properties, statuses, status
;immunities, Metamorph info, special properties like Human/Undead/Dies at MP=0,
;etc
org $C22DC1
monster_properties:
PHP
LDA $CF001F,X ;Special attack
STA $322D,Y
LDA $CF0019,X ;elemental weaknesses
ORA $3BE0,Y
STA $3BE0,Y ;add to existing weaknesses
;Blocked statuses
LDA $CF0016,X ;blocked status byte 3 from monster data
EOR #$FF ;invert it
AND $3330,Y ;combine with whatever was already blocked
;--Modified code starts here--
JSR newfunc ;previously: STA $3330,Y ;Blocked Status 3
;Blocked statuses 4
ROL #2 ;Rotate Carry (= Dance) into position signifying Freeze
;--Modified code ends here----
AND $3331,Y
STA $3331,Y ;block no additional statuses in byte 4
;Inherent statuses
REP #$20 ;Set 16-bit Accumulator
LDA $CF001B,X ;monster status bytes 1-2
STA $3DD4,Y ;copy into "status to set" bytes
LDA $CF001D,X ;get monster status bytes 3-4
PHA ;push monster status bytes 3-4
AND #$0001
LSR
ROR
ORA $01,S ;this moves Byte 3,Bit 0 into Byte 4,Bit 7 position
;it turns out "Dance" in B3,b0 is permanent float,
; while B4,b7 is a dispellable float
AND #$84FE ;filter out character stats like dog and rage
;in byte 4, only Float and Life 3 are kept
STA $3DE8,Y ;put in "status to set"
PLA ;pull monster status bytes 3-4
XBA ;now swap enemy status bytes 3<->4 within A
LSR
BCC .no_rage ;if byte4, bit 0 ;aka "Rage" had not been set, branch
LDA $3C58,Y
ORA #$0040 ;Set True Knight effect?
STA $3C58,Y
.no_rage
LDA $CF001C,X ;monster status bytes 2-3
ORA $3C6C,Y ;this makes a copy of ^, used in procs like c2/2675
STA $3C6C,Y
LDA $CF0014,X ;blocked status bytes 1-2
EOR #$FFFF ;invert 'em
AND $331C,Y
STA $331C,Y ;add to existing blockages
;Elemental properties
LDA $CF0017,X ;elements absorbed and nullified
ORA $3BCC,Y
STA $3BCC,Y ;add to existing absorptions and nullifications
;Metamorph and Special properties
LDA $CF0011,X
STA $3C94,Y ;$3C94 = Metamorph info
;$3C95 = Special Byte 3: Dies at 0 MP, No name, Human,
;Auto critical if Imp, Undead
PLP
RTS
EDIT: the code as-is is compatible with C.V. Reynolds Bug Fix Compilation, which indicates that this should be compatible with most bug fix patches, so I made some IPS patches:
Miraculously, the free space I always use for testing seems to be yet unclaimed by the myriad of patch authors, but if this causes conflicts with one of your patches (it certainly will with any of mine), use the .asm patch instead and simply change the offset used by the new code by changing the !freespace define in the beginning of the code.
|