Author Topic: CT Stat Growth  (Read 786 times)


  • Errare Explorer (+1500)
  • *
  • Posts: 1752
    • View Profile
CT Stat Growth
« on: October 16, 2008, 11:16:59 pm »
This is what I have on level-up stats (not HP/MP yet).

The routine for power starts around $C1/F634.
This assumes that $C1/C90B is a routine for multiplication and $C1/C92A does division.

Code: [Select]
Level-up description for Power:
Get PC portrait #.
Multiply it by 7.
Add #$25FA and store to x register.
Load a value from $CC0000,x.
Multiply the value by (Current level after level-up - 1).
Divide by #$64.
Add value from $2F of character stat data.
Store to $0B (power) of character stat data.

The other stats work mostly the same way, and it changes the other stats in this order: Stamina, Hit, Evade, Magic, Magic Defense. CC0002,x and $31 (those would correspond to Speed) of PC stat data are skipped.

Code: [Select]
$C1/F871 7B          TDC
$C1/F872 AA          TAX
$C1/F873 86 10       STX $10    [$00:0010]   
$C1/F875 7B          TDC
$C1/F876 AE 85 B2    LDX $B285  [$7E:B285]   //Get the memory address of the character data being changed
$C1/F879 BD 00 00    LDA $0000,x[$7E:0000]   //Get PC portrait
$C1/F87C 0A          ASL A
$C1/F87D 0A          ASL A
$C1/F87E 0A          ASL A
$C1/F87F 18          CLC
$C1/F880 65 10       ADC $10    [$00:0010]
$C1/F882 AA          TAX
$C1/F883 86 00       STX $00    [$00:0000]
$C1/F885 BF 8A 25 CC LDA $CC258A,x //Get maximum level for current level\HP increase.
$C1/F889 AE 85 B2    LDX $B285  [$7E:B285]   
$C1/F88C DD 12 00    CMP $0012,x //Check if current level is less than value gotten just above.
$C1/F88F 90 24       BCC $24    [$F8B5]     
$C1/F891 7B          TDC
$C1/F892 A6 00       LDX $00 
$C1/F894 BF 8B 25 CC LDA $CC258B,x //Get amount to increase HP by.
$C1/F898 C2 20       REP #$20               
$C1/F89A AE 85 B2    LDX $B285  [$7E:B285]   
$C1/F89D 18          CLC
$C1/F89E 7D 05 00    ADC $0005,x //Increase current max HP by value gotten.
$C1/F8A1 9D 05 00    STA $0005,x //Store new max HP
$C1/F8A4 C9 E7 03    CMP #$03E7 //Check if new max HP > (decimal) 999             
$C1/F8A7 90 06       BCC $06    [$F8AF]
$C1/F8A9 A9 E7 03    LDA #$03E7
$C1/F8AC 9D 05 00    STA $0005,x 

$C1/F8B5 E2 20       SEP #$20               
$C1/F8B7 E6 10       INC $10    [$00:0010]   
$C1/F8B9 E6 10       INC $10    [$00:0010]   
$C1/F8BB 80 B8       BRA $B8    [$F875]
Description in progress.

Starting at $C1/F879:
Get PC portrait value and multiply it by 8.
Add the value at $10 to it.
Move result to X register.
If PC level >= $CC258A,x, then add 2 to mem $10 and repeat. (i.e. Move two bytes forward to the next HP increase and try again.)
Else, add the value at $CC258B,x to the current HP.
« Last Edit: April 13, 2009, 10:14:13 pm by Vehek »