Users browsing this thread: 1 Guest(s)
Changing physical damage calculations?

#2
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(04-10-2012, 07:14 PM)Marketa Lazarova Wrote: One thing I am interested in doing is changing the way physical attack damage is dealt. However, I get the feeling that this is no simple matter, the way it was to increase the damage dealt by GP Rain, or to change the sprite that the Moogle Suit changes you to! There are two aspects of the game's coding I want to focus on. Firstly, I want the effectiveness of battle power (both abilities and regular attacks) to be amplified...allowing for a greater range of damage from smaller attack power. Also, I want to increase the role that player Stamina plays in the defense against physical attacks.

First of all, Bank C2 is where everything you want to change should be. With a quick search for "damage" I found the Damage modification routine. There are other special routines concerning damage like for relics such as Atlas armlet. C2 is well commented thanks to some devoted people. As for GP rain and the role that stamina plays, the routines should be in C2 as well. Maybe try with a search with those words...

I can't tell you which bytes exactly to change and where because it's not an area that I focused on so far. It also depends of what you want exactly but all this require some ASM knowledge. I could have a closer look to all this tonight, but maybe you could try first to understand the routines with the comments, the code and a instruction list.

Code:
Damage modification (Randomness, Row, Self Damage, and more)

C2/0C9E: 08           PHP
C2/0C9F: C2 20        REP #$20
C2/0CA1: AD B0 11     LDA $11B0   (Maximum Damage)
C2/0CA4: 85 F0        STA $F0
C2/0CA6: E2 20        SEP #$20    (Set 8-bit Accumulator)
C2/0CA8: AD 14 34     LDA $3414
C2/0CAB: D0 03        BNE $0CB0
C2/0CAD: 4C 3B 0D     JMP $0D3B   (Exit if $3414 = 0)
C2/0CB0: 20 5A 4B     JSR $4B5A   (Random number 0 to 255)
C2/0CB3: 09 E0        ORA #$E0    (Set bits 7,6,5; bits 0,1,2,3,4 are random)
C2/0CB5: 85 E8        STA $E8     (Random number [224..255])
C2/0CB7: 20 3D 0D     JSR $0D3D   (Damage randomness)
C2/0CBA: 18           CLC
C2/0CBB: AD A3 11     LDA $11A3
C2/0CBE: 30 04        BMI $0CC4   (Branch if Concern MP)
C2/0CC0: AD A2 11     LDA $11A2
C2/0CC3: 4A           LSR
C2/0CC4: AD A2 11     LDA $11A2
C2/0CC7: 89 20        BIT #$20
C2/0CC9: D0 57        BNE $0D22   (Branch if ignores defense)
C2/0CCB: 08           PHP
C2/0CCC: B9 B9 3B     LDA $3BB9,Y (Magic Defense)
C2/0CCF: 90 03        BCC $0CD4   (Branch if concern MP or Magical damage)
C2/0CD1: B9 B8 3B     LDA $3BB8,Y (Defense)
C2/0CD4: 1A           INC
C2/0CD5: F0 10        BEQ $0CE7   (If = 255)
C2/0CD7: EB           XBA
C2/0CD8: AD 82 3A     LDA $3A82
C2/0CDB: 2D 83 3A     AND $3A83
C2/0CDE: 30 03        BMI $0CE3   (If Blocked by Golem or Dog, defense = 192)
C2/0CE0: A9 C1        LDA #$C1
C2/0CE2: EB           XBA
C2/0CE3: EB           XBA
C2/0CE4: 3A           DEC
C2/0CE5: 49 FF        EOR #$FF
C2/0CE7: 85 E8        STA $E8     (= 255 - Defense)
C2/0CE9: 20 3D 0D     JSR $0D3D   (Multiply damage by (255 - Defense) / 256 ,
                                   then add 1)
C2/0CEC: A3 01        LDA $01,S
C2/0CEE: 4A           LSR
C2/0CEF: B9 F8 3E     LDA $3EF8,Y (Status byte 3)
C2/0CF2: B0 01        BCS $0CF5   (Branch if physical attack)
C2/0CF4: 0A           ASL
C2/0CF5: 0A           ASL
C2/0CF6: 10 07        BPL $0CFF   (Branch if no safe / shell)
C2/0CF8: A9 AA        LDA #$AA
C2/0CFA: 85 E8        STA $E8
C2/0CFC: 20 3D 0D     JSR $0D3D   (Multiply damage by 170 / 256 , then add 1)
C2/0CFF: 28           PLP
C2/0D00: 90 15        BCC $0D17   (Skip row check if magical attack)
C2/0D02: B9 A1 3A     LDA $3AA1,Y
C2/0D05: 89 02        BIT #$02
C2/0D07: F0 04        BEQ $0D0D   (Branch if not defending)
C2/0D09: 46 F1        LSR $F1
C2/0D0B: 66 F0        ROR $F0     (Cut damage in half)
C2/0D0D: 89 20        BIT #$20    (Check row)
C2/0D0F: F0 11        BEQ $0D22   (Branch if target in front row)
C2/0D11: 46 F1        LSR $F1
C2/0D13: 66 F0        ROR $F0     (Cut damage in half)
C2/0D15: 80 0B        BRA $0D22   (Skip morph if physical attack)
C2/0D17: B9 F9 3E     LDA $3EF9,Y
C2/0D1A: 89 08        BIT #$08
C2/0D1C: F0 04        BEQ $0D22   (Branch if not morph)
C2/0D1E: 46 F1        LSR $F1
C2/0D20: 66 F0        ROR $F0     (Cut damage in half)
C2/0D22: C2 20        REP #$20    (Set 16-bit Accumulator)
C2/0D24: AD A4 11     LDA $11A4
C2/0D27: 4A           LSR
C2/0D28: B0 0A        BCS $0D34   (Branch if heal, heal skips self damage theory)
C2/0D2A: C0 08        CPY #$08
C2/0D2C: B0 06        BCS $0D34   (Branch if target is a monster)
C2/0D2E: E0 08        CPX #$08
C2/0D30: B0 02        BCS $0D34   (Branch if attacker is monster)
C2/0D32: 46 F0        LSR $F0     (Cut damage in half if party attacks party)
C2/0D34: A5 F0        LDA $F0    
C2/0D36: 20 0B 37     JSR $370B   (Increment damage using $BC)
C2/0D39: 85 F0        STA $F0
C2/0D3B: 28           PLP
C2/0D3C: 60           RTS

Edit: As for the moogle suit sprite, there is a thread about this with another thread linked in it about the same thing: https://www.ff6hacking.com/forums/showth...p?tid=1545
  Find
Quote  



Messages In This Thread
RE: Changing physical damage calculations? - by madsiur - 04-11-2012, 06:12 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite