The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.3.33 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Users browsing this thread: 1 Guest(s)
Good Lord Send Us An Esper Level Up Bonus Patch

#1
Posts: 61
Threads: 18
Thanks Received: 1
Thanks Given: 47
Joined: May 2014
Status
None
So one of the things I've been trying to do for years now is figure out how to make the esper level up bonuses better.  Does anyone know how?

I've tried to trace another person's mod to no avail.  Here's what I focus on from the C2:


Code:
C2/60E8: 7B           TDC            (Clear 16-bit A)
C2/60E9: BF 0A 6E D8  LDA $D86E0A,X  (end of data block for Esper..  probably
                                     has level-up bonus)
C2/60ED: 30 05        BMI $60F4      (if null, don't try to calculate bonus)
C2/60EF: 0A           ASL
C2/60F0: AA           TAX            (multiply bonus index by 2)
C2/60F1: FC 4E 61     JSR ($614E,X)  (calculate bonus.  note that [Stat]+1 jumps to the
                                     same place as [Stat]+2.  what distinguishes them?
                                     Bit 1 of X.  if X is 20, 24, 28, 32, you'll get +1
                                     to a stat.. if it's 18, 22, 26, 30, you get +2.

                                     for HP/MP boosts, X of 0/2/4 means HP, and
                                     6/8/10 means MP)
                      
C2/60F4: FA           PLX
C2/60F5: 7A           PLY
I think this is the only part that initiates the sequence.

And then there is the calculation:

Code:
(Code Pointers)

C2/614E: 70 61  (~10% HP bonus)  (HP due to X)
C2/6150: 74 61  (~30% HP bonus)  (HP due to X)
C2/6152: 78 61  (50% HP bonus)   (HP due to X)
C2/6154: 70 61  (~10% MP bonus)  (MP due to X)
C2/6156: 74 61  (~30% MP bonus)  (MP due to X)
C2/6158: 78 61  (50% MP bonus)   (MP due to X)  
C2/615A: B0 61  (Double natural HP gain for level.  Curious...)
C2/615C: 97 61  (No bonus)
C2/615E: 97 61  (No bonus)
C2/6160: 9B 61  (Vigor bonus)    (+1 due to X value in caller)
C2/6162: 9B 61  (Vigor bonus)    (+2 due to X)
C2/6164: 9A 61  (Speed bonus)    (+1 due to X)
C2/6166: 9A 61  (Speed bonus)    (+2 due to X.  No Esper currently uses)
C2/6168: 99 61  (Stamina bonus)  (+1 due to X)
C2/616A: 99 61  (Stamina bonus)  (+2 due to X)
C2/616C: 98 61  (MagPwr bonus)   (+1 due to X)
C2/616E: 98 61  (MagPwr bonus)   (+2 due to X)
As you can see, these are pointers to the real calculation.  Espers look here which points to a bonus.

The real calculation is:

Code:
(Esper HP or MP bonus at level-up)

C2/6170: A9 1A        LDA #$1A     (26 => 10.12625% bonus)  
C2/6172: 80 06        BRA $617A
C2/6174: A9 4E        LDA #$4E     (78 => 30.46875% bonus)    
C2/6176: 80 02        BRA $617A
C2/6178: A9 80        LDA #$80     (128 ==> 50% bonus)
C2/617A: E0 06 00     CPX #$0006   (are we boosting MP rather than HP?)
C2/617D: A2 00 00     LDX #$0000   (start pointing to $FC, which holds normal HP to raise)
C2/6180: 90 02        BCC $6184    (if X was less than 6, we're just boosting HP,
                                   so branch)
C2/6182: E8           INX
C2/6183: E8           INX          (point to $FE, which holds normal MP to raise)
C2/6184: EB           XBA          (put boost numerator in top of A)
C2/6185: B5 FC        LDA $FC,X    (get current HP or MP to add)
C2/6187: 20 81 47     JSR $4781    
C2/618A: EB           XBA          (get (boost number * current HP or MP) / 256.
                                   after all, the boost IS a percentage..)
C2/618B: D0 01        BNE $618E    (if the HP/MP bonus is nonzero, branch)
C2/618D: 1A           INC          (if it was zero, be nice and give the chump one..)
C2/618E: 18           CLC
C2/618F: 75 FC        ADC $FC,X
C2/6191: 95 FC        STA $FC,X    (add boost to natural HP/MP gain)
C2/6193: 90 02        BCC $6197    
C2/6195: F6 FD        INC $FD,X    (if bottom byte overflowed from add, boost top byte)
C2/6197: 60           RTS


(Esper stat bonus at level-up.  Vigor, Speed, Stamina, or MagPwr.
If Bit 1 of X is set, give +1 bonus.  If not, give +2.)

C2/6198: C8           INY          (enter here = 3 INYs = point to MagPwr)
C2/6199: C8           INY          (enter here = 2 INYs = point to Stamina)
C2/619A: C8           INY          (enter here = 1 INY  = point to Speed)
C2/619B: 8A           TXA          (enter here = 0 INYs = point to Vigor)

C2/619C: 4A           LSR
C2/619D: 4A           LSR          (Carry holds bit 1 of X)

C2/619E: BB           TYX          (0 to 3 value.  determines which stat will be altered)
C2/619F: BD 1A 16     LDA $161A,X  (at $161A,X we have Vigor, Speed, Stamina, and MagPwr,
                                   respectively)
C2/61A2: 1A           INC
C2/61A3: B0 01        BCS $61A6    (If carry set, just give +1)
C2/61A5: 1A           INC
C2/61A6: C9 81        CMP #$81     (is stat >= 129?)
C2/61A8: 90 02        BCC $61AC
C2/61AA: A9 80        LDA #$80     (if so, make it 128)
C2/61AC: 9D 1A 16     STA $161A,X  (save updated stat)
C2/61AF: 60           RTS
Why....does it increase Y, copy X to A, then maybe make it carry, then copy Y to X, which I think is then used to determine which stat is changed based on what's in X, which is then increased based on the carry?  This seems like an awfully weird way of doing it, and a perfect way from preventing me to change it to what I want.

Ideally, I'm trying to make a version that allows:
Stamina +6
Speed+6
Vigor/Magic +1/+2/+1/+2

And then the HP/MP.....way too complicated. Right? If anyone's figured this out, please show us all the ninja that is inside of you.
  Find
Quote  



Messages In This Thread
Good Lord Send Us An Esper Level Up Bonus Patch - by ReturnerScum - 01-31-2016, 02:49 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite