Users browsing this thread: 1 Guest(s)
Hacking HP/MP amount of stat boosting items

#1
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
While working on the RotDS Hack , Nattak and I ran into a certain problem. When you battle Kefka as a PC (e.g., imperial camp, floating continent, etc.) his HP levels are determined by the average level of your party. Unless you equip Kefka with really strong equipment and relics to boost his HP/MP, he will go down pretty easily.

The idea behind this post is to edit the stat boosting properties of an item or relic in such a way that, when equipped, it grants max HP/MP. Specifically, I would like any equipment marked with 50% HP/MP boost to grant max HP/MP.

There are two bank locations in the rom in which the amount of HP/MP boost of some items is handled. Bank C3 handles the HP/MP boost while in the menu, while C2 handles the HP/MP boost in battles.

Code:
C3 CodeThis is called by both HP and MP to adjust their values based on boosting equipment
C3/0D65:    C220        REP #$20      (16 bit memory/accum.)
C3/0D67:    A5F3        LDA $F3        (load HP/MP)
C3/0D69:    29FF3F      AND #$3FFF     (only keep the HP/MP)
C3/0D6C:    85E7        STA $E7        (save it to a temp location)
C3/0D6E:    A5F3        LDA $F3        (load HP/MP again)
C3/0D70:    2900C0      AND #$C000     (this time keep only the boosts)
C3/0D73:    18          CLC            (this is crucial)
C3/0D74:    2A          ROL A
C3/0D75:    2A          ROL A
C3/0D76:    2A          ROL A
C3/0D77:    2A          ROL A          (transfer boosts to lower two bits)
C3/0D78:    AA          TAX            (index them)
C3/0D79:    A5E7        LDA $E7        (load our non-boosted HP/MP)
C3/0D7B:    7C7E0D      JMP ($0D7E,X)

C3/0D7E:    860D        (no HP/MP boost)
C3/0D80:    880D        (25% HP/MP boost)
C3/0D82:    890D        (50% HP/MP boost)
C3/0D84:    870D        (12.5% HP/MP boost)

C3/0D86:    7B          TDC
C3/0D87:    4A          LSR A
C3/0D88:    4A          LSR A
C3/0D89:    4A          LSR A
C3/0D8A:    18          CLC
C3/0D8B:    65E7        ADC $E7        (add in the non-boosted HP/MP)
C3/0D8D:    85F3        STA $F3        (save new boosted HP/MP)
C3/0D8F:    E220        SEP #$20      (8 bit memory/accum.)
C3/0D91:    60          RTS

[font=Verdana]
C2 Code(Apply percentage boost to HP or MP.  Bit 14 set = 25% boost,
Bit 15 set = 50% boost, Both of those bits set = 12.5% boost)

C2/283C: DA           PHX
C2/283D: 0A           ASL
C2/283E: 2A           ROL
C2/283F: 85 EE        STA $EE
C2/2841: 2A           ROL
C2/2842: 2A           ROL           (Bit 15 is now in Bit 2, and Bit 14 is in Bit 1)
C2/2843: 29 06 00     AND #$0006    (isolate Bits 1 and 2)
C2/2846: AA           TAX           (and use them as function pointer)
C2/2847: A5 EE        LDA $EE
C2/2849: 4A           LSR
C2/284A: 4A           LSR
C2/284B: 85 EE        STA $EE       (all that crazy shifting was equivalent to
                                     $EE = A AND 16383.  gotta love Square =] )
C2/284D: 7C 59 28     JMP ($2859,X)

(Boost A by some fraction, if any)
C2/2850: 7B           TDC           (enter here for A = 0 + $EE)
C2/2851: 4A           LSR           (enter here for A = (A * 1/8) + $EE)
C2/2852: 4A           LSR           (enter here for A = (A * 1/4) + $EE)
C2/2853: 4A           LSR           (enter here for A = (A * 1/2) + $EE)
C2/2854: 18           CLC
C2/2855: 65 EE        ADC $EE
C2/2857: FA           PLX
C2/2858: 60           RTS

Code Pointers
C2/2859: 50 28  (A = A) (technically, A = $EE, but it's the same deal.)
C2/285B: 52 28  (A = A + (A * 1/4) )
C2/285D: 53 28  (A = A + (A * 1/2) )
C2/285F: 51 28  (A = A + (A * 1/8) )

The following changes are suggested:
Code:
C3/0D7B:    7CD0F4 JMP ($F4D0,X)
C3/F4D0:    D8 F4 (no HP/MP boost)
C3/F4D2:    DA F4 (25% HP/MP boost)
C3/F4D4:    E3 F4 (50% HP/MP boost)
C3/F4D6:    D9 F4 (12.5% HP/MP boost)

C3/F4D8:    7B TDC
C3/F4D9:    4A LSR A
C3/F4DA:    4A LSR A
C3/F4DB:    18 CLC
C3/F4DC:    65E7 ADC $E7 (add in the non-boosted HP/MP)
C3/F4DE:    85F3 STA $F3 (save new boosted HP/MP)
C3/F4E0:    E220 SEP #$20 (8 bit memory/accum.)
C3/F4E2:    60 RTS

C3/F4E3:    A20F27 LDX #270F (Loads 9999)
C3/F4E6:    86F3 STX $F3
C3/F4E0:    E220 SEP #$20 (8 bit memory/accum.)
C3/F4E2:    60 RTS

C2 Code(Apply percentage boost to HP or MP.  Bit 14 set = 25% boost,
Bit 15 set = 50% boost, Both of those bits set = 12.5% boost)

C2/283C: 22F2F4C3 JSL $C3/F4F2
C2/2840: 60           NOP
Addresses from C2/283E through C2/285F should be replaced with EA / NOP.

C3/F4F2: DA           PHX
C3/F4F3: 0A           ASL
C3/F4F4: 2A           ROL
C3/F4F5: 85 EE       STA $EE
C3/F4F7: 2A           ROL
C3/F4F8: 2A           ROL           (Bit 15 is now in Bit 2, and Bit 14 is in Bit 1)
C3/F4F9: 29 06 00   AND #$0006    (isolate Bits 1 and 2)
C3/F4FC: AA           TAX           (and use them as function pointer)
C3/F4FD: A5 EE        LDA $EE
C3/F4FF: 4A           LSR
C3/F500: 4A           LSR
C3/F501: 85 EE        STA $EE       (all that crazy shifting was equivalent to $EE = A AND 16383.  gotta love Square =] )

C3/F503: 7C 06 F5     JMP ($F506,X)

C3/F506: 0E F5  (A = A) (technically, A = $EE, but it's the same deal.)
C3/F508: 10 F5  (A = A + (A * 1/4) )
C3/F50A: 16 F5  (A = A + (A * 1/2) )
C3/F50C: 0F F5  (A = A + (A * 1/8) )

(Boost A by some fraction, if any)
C3/F50E: 7B           TDC           (enter here for A = 0 + $EE)
C3/F50F: 4A           LSR           (enter here for A = (A * 1/8) + $EE)
C3/F510: 4A           LSR           (enter here for A = (A * 1/4) + $EE)
C3/F511: 18           CLC
C3/F512: 65 EE       ADC $EE
C3/F514: FA           PLX
C3/F515: 6B           RTl
C3/F516: A90F27    LDA #270F (9999)
C3/F519: 18           CLC
C3/F51A: 65 EE       ADC $EE
C3/F51C: FA           PLX
C3/F51D: 6B           RTL

The alterations above suggested gives 9999HP and/or 999MP to the user with an item or relic that boosts HP/MP by 50%.
Quote  
[-] The following 2 users say Thank You to Angelo26 for this post:
  • JWhiteLXXXIX (04-30-2013), SSJ Rick (04-28-2013)

#2
Posts: 2,769
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
niiice


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  

#3
Posts: 875
Threads: 44
Thanks Received: 22
Thanks Given: 17
Joined: Nov 2011
Reputation: 23
Status
Imprisoned
ahhh hell yeah!


The only limit is imagination. And 16 colors.. I guess 

Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite