Users browsing this thread: 1 Guest(s)
"Low on HP" spells and "Active if Imp" flag

#5
Posts: 110
Threads: 4
Thanks Received: 4
Thanks Given: 1
Joined: Jan 2012
Reputation: 4
Status
None
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
  Find
Quote  



Messages In This Thread
RE: "Low on HP" spells and "Active if Imp" flag - by dn - 02-23-2018, 02:18 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite