Espers teaching Stat gains
#6
Hey, not sure if this would help, but I wrote this code to replace the vanilla stat-gain routine to make it easier to update and work with. It fits in the same space, and may have room for a large lookup table, if you want.

What you might do is replace the spell IDs in the esper learning data with bytes that represent the exact stat gains you want to give. The hard part is dynamically generating the boost text inside the esper menu. I do have some code that does this, but it might be tricky to implement it in a different context. Let me know if you'd like it.


Code:
hirom
; header

; BNW - Simplified Esper Levels
; Bropedio (April 26, 2019)
; Last modified: June 11, 2019
;
; This overhauls the handling of esper boosts to enable faster changes:
; * Use a table of data rather than pointers to subroutines
; * Encode each bonus into a single byte (bits: 76543210)
;   * Bit 0 indicates stat versus HP/MP
;   * If stat, bits 2 and 1 provide stat index (7-3 are zero)
;   * If stat, assume change of 1 (could support more w/ unused bits)
;   * If HP/MP, bit 1 indicates MP (over HP)
;   * If HP/MP, bits 7-2 indicate amount to change (max 63)

; NOTE: This patch does not handle esper level text display, though I
; imagine it could be rewritten to programmatically determine the EL
; description based on the table below.

org $C2612C
ELJump:
    REP #$20         ; 16-bit A
    JMP AddEL        ; handle esper levelups
    NOP #2

org $C2614E
ELTable:
    db $78,$78 ; 60HP - Terrato, Crusader
    db $52,$52 ; 40HP - Bahamut, Ragnarok
    db $78,$3E ; 30HP/15MP -  Phoenix, Seraph
    db $01,$50 ; 20HP/Vig - Golem
    db $52,$07 ; 20MP/Mag - Zoneseek
    db $01,$03 ; Vig/Spd - Palidor
    db $03,$07 ; Mag/Spd - Siren
    db $01,$05 ; Vig/Stm - Phantom
    db $05,$07 ; Mag/Stm - Maduin
    db $03,$05 ; Spd/Stm - Alexander
    db $78,$05 ; 30HP/Stm - Kirin, Unicorn
    db $05,$66 ; 25MP/Stm - Carbunkl
    db $01,$01 ; 2Vig - Ramuh, Bismark
    db $03,$03 ; 2Spd - Ifrit, Fenrir
    db $05,$05 ; 2Stm - Stray, Odin, Tritoch, Starlet
    db $07,$07 ; 2Mag - Shiva, Shoat
    db $00,$00 ; null - Raiden?

AddEL:
    LDA ELTable,X   ; A = full 2-byte boost
    SEP #$20        ; 8-bit A
.doone
    TYX             ; X = index to character stats
    XBA             ; swap A bytes
    BNE .bonus      ; if bonus, branch and handle (long-loop)
    RTL             ; return
.bonus
    LSR
    BCC .hpmp       ; if bit $01 not set, use HP/MP
.loop
    BEQ .stat       ; if no stat index, continue
    INX
    DEC
    BRA .loop       ; add X to A
.stat
    LDA $161A,X     ; A = stat
    CMP #$80
    BEQ .fin        ; if maxed already, skip increment
    INC
    STA $161A,X     ; store updated stat
.fin
    BRA .next       ; finish this bonus byte
.hpmp
    LSR             ; remainder is amount to add
    BCC .addhp      ; if MP bit not set, skip INX
    INX
    INX
    INX
    INX             ; X points to max MP now
    CLC
.addhp
    ADC $160B,X
    STA $160B,X     ; add HP/MP bonus
    BCC .next       ; if no overflow, continue
    INC $160C,X     ; carry to hi byte
.next
    LDA #$00        ; clear finished bonus
    BRA .doone      ; loop for second bonus byte

padbyte $FF
pad $C261E9
Reply


Messages In This Thread
Espers teaching Stat gains - by Morendo - 09-09-2020, 04:28 PM
RE: Espers teaching Stat gains - by Turbotastic - 09-17-2020, 12:42 AM
RE: Espers teaching Stat gains - by Morendo - 09-25-2020, 12:00 PM
RE: Espers teaching Stat gains - by Morendo - 11-12-2020, 05:09 AM
RE: Espers teaching Stat gains - by Everything - 11-12-2020, 03:28 PM
RE: Espers teaching Stat gains - by Bropedio - 12-10-2020, 05:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Casting Spells Taught by Espers - RESOLVED! Turbotastic 16 15,070 03-30-2018, 01:36 PM
Last Post: Turbotastic
  Weapons teaching Lore skills? FF6Fanatic 5 6,492 07-11-2016, 03:58 PM
Last Post: FF6Fanatic
  Espers: 1 set of spells KnightDude 7 6,890 07-10-2016, 10:14 AM
Last Post: KnightDude
  Items with stat bonuses +28? DO WE DARE??? ReturnerScum 5 7,523 02-21-2016, 06:23 PM
Last Post: assassin
  Increase required AP to learn spells from espers Tenkarider 5 6,119 01-20-2015, 05:28 PM
Last Post: Drakkhen
  Patch for making Espers unique to different PCs? officemonster 3 4,145 01-14-2015, 02:57 AM
Last Post: Synchysi
  Adding Espers? Royaken 3 3,832 03-24-2014, 08:29 PM
Last Post: Royaken
  Hacking HP/MP amount of stat boosting items Angelo26 2 3,904 04-30-2013, 11:10 PM
Last Post: JWhiteLXXXIX
  Restrict espers by character. Synchysi 22 29,639 10-02-2012, 06:33 PM
Last Post: Synchysi
  Teaching magic spells through weapons Overswarm 25 32,096 12-10-2011, 11:24 AM
Last Post: Angelo26

Forum Jump:


Users browsing this thread: 1 Guest(s)