Think0028

Member
  • Content count

    18
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by Think0028


  1. Elemental fixing - DONE 

     

    ;xkas 0.06
    hirom
    ;header
    !freespace = $C0FD40 ;patch to this offset
    ; change to 2/3 and resist at 1 null at 3

    org $C20B9D
    JML newfunc2
    returnfromnewfunc2:
    NOP
    NOP

    ;hook
    org $C20BD3
    LDA $11A1
    BEQ done
    LDA $3BCC,Y ;(Absorbed elements)
    BIT $11A1
    BEQ nullstart   ;(branch if none are used in attack)
    LDA $F2
    EOR #$01
    STA $F2     ;(toggle healing flag)
    BRA done
    nullstart:
    PHX ; 17 bytes so far
    LDX #$00
    LDA $3BCD,Y ;(Nullified elements)
    AND $11A1
    null:
    BEQ resiststart   ;(branch if none are used in attack or left to check)
    LSR
    BCC null ;(move to next ele if this one isn't nulled)
    INX
    INX
    INX
    BRA null ;(counted this nulled element, 34 bytes so far)
    resiststart:
    LDA $3BE1,Y ;(Resisted elements)
    AND $11A1
    resist:
    BEQ weakstart   ;(branch if none are used in attack or left to check)
    LSR
    BCC resist ;(move to next ele if this one isn't resisted)
    INX
    INX
    BRA resist ;(counted this resisted element, 48 bytes)
    weakstart:
    LDA $3BE0,Y ;(Weak elements)
    AND $11A1
    weak:
    BEQ damage   ;(branch if none are used in attack or left to check)
    LSR
    BCC weak ;(move to next ele if this one isn't weak)
    DEX
    DEX
    BRA weak ;(counted this weak element, 62 bytes)
    damage:
    JSL newfunc
    PLX
    done:
    LDA $11A9 ;  (get attack special effect, 69 (nice) bytes)
    CMP #$04
    BNE skip ;  (Branch if not Atma Weapon)
    JSR $0E39 ;  (Atma Weapon damage modification)
    skip:
    JSR $0C2D
    PLP 
    RTS 

    org !freespace
    newfunc:
    PHY ; (stack is y)
    LDY #$00
    LDA $11A1
    elecount:
    BEQ continue   ;(no eles left, 8 bytes)
    LSR
    BCC elecount ;(this ele isn't used)
    INY ; (12 bytes so far)
    BRA elecount
    continue:
    TXA 
    BPL proper ; if it's negative, we're takin double
    ASL $F0
    ROL $F1
    BRA done2
    proper:
    TYA ; at this point, A is the element count, X is the resistance total. We are gonna do some bullshit
    CMP #$02 ; compare to 2, carry is set if element count >= 2
    BCC elehandled
    TXA ; A and X are resistance totals now
    LSR
    TAX ; finished manipulating
    elehandled:
    TXA ; :^) 21 bytes
    CMP #$03 ; if >= 2, we're blocking
    BCC resistcheck
    STZ $F0
    STZ $F1 ; 35
    resistcheck:
    CMP #$02 ; if == 1, we resist
    BNE done2
    LSR $F1
    ROR $F0
    done2:
    PLY
    RTL

    newfunc2:
    LDA $3EE4,Y
    ASL
    BMI petrified
    JML returnfromnewfunc2
    petrified:
    STZ $F0
    STZ $F1
    JML done

    • Upvote 1

  2. Y'all arguing about how exactly the code works without... actually looking at the code. If you did, you would see that I cheated and I don't divide in the case that it's negative, and instead always treat it as a weakness if it's negative. I was very precise in my wording when I explained the algorithm as half rounded down. (Fuck Microsoft's implementation of down as to-zero). The term y'all are thinking of is round-to-zero.

     

    As for splitting it in pieces, I intentionally didn't implement it that way so that 1) I didn't have to make calls out to the expensive division function 2) I didn't add new layers of weakness/resistance to the game.

    • Upvote 1

  3. It's weird, because on one hand it makes Merton worse in the battle it's really good in (unfreezing people against whichever goddess that was again) but it makes it way more usable in regular-ass randoms. I did it mostly because BTB asked me to, and as a proof of concept alternate resistance systems are possible without too much overhaul.


  4. https://drive.google.com/file/d/1uTrUOsoFmSDj6OEUV4SbCEUFPw1N5SRE/view?usp=sharing

     

    Here's a new beta patch. All I've verified right now is that it doesn't crash immediately, so heads up. The goal of this patch is to shuffle around how resistances are calculated with attacks with multiple elements. Basically what it does is look at each element and do a rolling sum:

    1) If it's absorbed, the attack is absorbed and the rest skipped.

    2) If it's nulled, add 3 to the resist count.

    3) If it's resisted, add 2 to the resist count.

    4) If it's one they're weak against, subtract 2 from the resist count.

    Then, if 2 or more elements were used in the attack, the resist count is cut in half, rounded down. Then:

    1) If the count is negative, take double damage.

    2) If the count is 3 or greater, take no damage.

    3) If the count is 1 or 2, take half damage.

     

    For some concrete examples:

    Fire+wind attack (Merton):

    Null fire, neutral wind : resist

    Null fire, weak wind : resist

    Absorb fire: absorb

    Resist fire resist wind: resist

    Resist fire neutral wind: resist

    Null fire resist wind: resist

    Code:

     

    ;xkas 0.06
    hirom
    ;header
    !freespace = $C0FD40 ;patch to this offset

    org $C20B9D
    JML newfunc2
    returnfromnewfunc2:
    NOP
    NOP

    ;hook
    org $C20BD3
    LDA $11A1
    BEQ done
    LDA $3BCC,Y ;(Absorbed elements)
    BIT $11A1
    BEQ nullstart   ;(branch if none are used in attack)
    LDA $F2
    EOR #$01
    STA $F2     ;(toggle healing flag)
    BRA done
    nullstart:
    PHX ; 17 bytes so far
    LDX #$00
    LDA $3BCD,Y ;(Nullified elements)
    AND $11A1
    null:
    BEQ resiststart   ;(branch if none are used in attack or left to check)
    LSR
    BCC null ;(move to next ele if this one isn't nulled)
    INX
    INX
    INX
    BRA null ;(counted this nulled element, 34 bytes so far)
    resiststart:
    LDA $3BE1,Y ;(Resisted elements)
    AND $11A1
    resist:
    BEQ weakstart   ;(branch if none are used in attack or left to check)
    LSR
    BCC resist ;(move to next ele if this one isn't resisted)
    INX
    INX
    BRA resist ;(counted this resisted element, 48 bytes)
    weakstart:
    LDA $3BE0,Y ;(Weak elements)
    AND $11A1
    weak:
    BEQ damage   ;(branch if none are used in attack or left to check)
    LSR
    LSR
    BCC weak ;(move to next ele if this one isn't weak)
    DEX
    BRA weak ;(counted this weak element, 62 bytes)
    damage:
    JSL newfunc
    PLX
    done:
    LDA $11A9 ;  (get attack special effect, 69 (nice) bytes)
    CMP #$04
    BNE skip ;  (Branch if not Atma Weapon)
    JSR $0E39 ;  (Atma Weapon damage modification)
    skip:
    JSR $0C2D
    PLP 
    RTS 

    org !freespace
    newfunc:
    PHY ; (stack is y)
    LDY #$00
    LDA $11A1
    elecount:
    BEQ continue   ;(no eles left, 8 bytes)
    LSR
    BCC elecount ;(this ele isn't used)
    INY ; (12 bytes so far)
    BRA elecount
    continue:
    TXA 
    BPL proper ; if it's negative, we're takin double
    ASL $F0
    ROL $F1
    BRA done2
    proper:
    TYA ; at this point, A is the element count, X is the resistance total. We are gonna do some bullshit
    CMP #$02 ; compare to 2, carry is set if element count >= 2
    BCC elehandled
    TXA ; A and X are resistance totals now
    LSR
    TAX ; finished manipulating
    elehandled:
    TXA ; :^) 21 bytes
    CMP #$03 ; if >= 2, we're blocking
    BCC resistcheck
    STZ $F0
    STZ $F1 ; 35
    resistcheck:
    CMP #$02 ; if == 1, we resist
    BNE done2
    LSR $F1
    ROR $F0
    done2:
    PLY
    RTL

    newfunc2:
    LDA $3EE4,Y
    ASL
    BMI petrified
    JML returnfromnewfunc2
    petrified:
    STZ $F0
    STZ $F1
    JML done

    • Upvote 5

  5. The code doesn't affect Gau's rejoin code for when he's out of the party - just modifies what happens when you Leap him. Shouldn't break the Gau rejoin at all. And it uses the same byte I checked back in my Learnable Rage patch that checks if a formation can appear on the Veldt, which is set for regular encounters so that it knows to enable the formation on the Veldt.