Users browsing this thread: 1 Guest(s)
"Low on HP" spells and "Active if Imp" flag
02-23-2018, 02:18 PM
A simple code modification to the SOS spellcasts:
Code:
hirom
org $c20a4a
C20A4A: LDA $3AA0,X
C20A4D: BIT #$10 ; (is entity Wounded, Petrified, or Stopped, or is somebody else under the influence of Quick?)
C20A4F: BNE sos_end ; (Exit function if any are true)
C20A51: LDA #$02
C20A53: BIT $3EE5,X
C20A56: BEQ sos_end ; (Branch if not Near Fatal)
C20A58: BIT $3205,X ; (is bit 1 set?)
C20A5B: BEQ sos_end ; (exit if not, meaning we've already activated a spell on low HP this battle)
C20A5D: EOR $3205,X
C20A60: STA $3205,X ; (toggle off bit 1)
lda $3c59,x ; load equip special byte 4
and #$07 ; filter all except bits 0-2
beq sos_end
phx ; save X
dec
tax ; move A to X, as index
lda (#spell_index),x ; load value to compare
plx
sta $b8 ; spell ID
lda #$26 ; command #$26 (force target self, no MT)
jsr $4e91 ; queue command
sos_end:
rts
spell_index:
;Spell IDs go here. All use self-targetting only, though offensive spells may use a very simple single target randomization on enemy targets. I haven't tested that.
db $00 ; 001 (Previously Shell flag)
db $00 ; 010 (Previously Safe flag)
db $00 ; 011 (Previously Shell+Safe flags)
db $00 ; 100 (Previously Rflect flag)
db $00 ; 101 (Previously Rflect+Shell flags)
db $00 ; 110 (Previously Rflect+Safe flags)
db $00 ; 111 (Previously Rflct+Safe+Shell flags)
padbyte $FF : pad $c20a91
« Next Oldest | Next Newest »
|
||||
Users browsing this thread: 1 Guest(s)