Users browsing this thread: 1 Guest(s)
Item Effect - More Rare Items

#1
Posts: 735
Threads: 36
Thanks Received: 13
Thanks Given: 42
Joined: Jan 2016
Reputation: 6
Status
None
This is a quick rundown of how to do some small edits to the Steal command, and the item drop function, to allow item effects that increase the odds of getting a rare item. Thanks to Fëanor on the Discord for their help figuring this out.

First, rare Steals.

Code:
C2/39D9: 20 5A 4B     JSR $4B5A      (Random: 0 to 255)
C2/39DC: C9 20        CMP #$20
C2/39DE: 90 01        BCC $39E1      (branch 1/8 of the time, so Rare steal slot
                                     will be checked)
C2/39E0: C8           INY            (Check the 2nd [Common] slot 7/8 of the time)

Copy this data and replace it with a jump to a blank spot in the code, then NOP out the rest. I had pockets of blank space around my C2 bank due to my mod's many inclusions, so I found room fine, but if you're not putting this stuff in C2, you may have to use a different jump command. For me in C2, here's what I did:

Code:
C2/39D9: 20 20 3C     JSR $3C20

And at the blank space, we have this. The game performs a check for an item flag and branches to the "normal" Steal code if not detected, at the end of which it RTS's back into the rest of the coding for Steal at C2/39. But if the item flag IS detected, it keeps going without branching to code identical to the normal Steal code and then RTS's, but the RNG is more favorable to you. The item flag used is an unused one, directly below the "boost Steal rate" flag in special effect 2, so that's convenient and easy to remember.

Code:
BD 45 3C
89 01      Check for bit 02 in effect 2
F0 09      Branch to second Steal data if not detected
20 5A 4B
C9 80      1/2 odds of branching; 50% chance of rare Steal
90 01
C8         Common item
60         RTS
20 5A 4B
C9 20      1/8 odds of branching; 12.5% chance of rare Steal
90 01
C8         Common item
60         RTS


For increasing the odds of rare item drops, the code is very similar as you'd expect. The special effect flag used here is 20 in effect 4, the unused flag directly under the Cat-Ear Hood.

Code:
C2/5F1E: 20 5A 4B     JSR $4B5A      (random #, 0 to 255)
C2/5F21: C9 20        CMP #$20       (Carry clear if A < 20h, set otherwise.
                                     this means we'll use the Rare dropped item slot 1/8 of
                                     the time, and the Common 7/8 of the time)
C2/5F23: C2 30        REP #$30       (Accumulator and Index regs 16-bit)
C2/5F25: 7B           TDC            (clear A)
C2/5F26: 6A           ROR            (put Carry in highest bit of A)

As before, copy all of this, put a jump to some blank space, and NOP out the rest.

Code:
B9 59 3C
29 20       check for bit 20 in effect 4
F0 0A       Branch to second Drop data if not detected
20 5A 4B
C9 80       1/2 odds of branching; 50% chance of rare drop
C2 30
7B
6A
60         RTS
20 5A 4B
C9 20      1/8 odds of branching; 12.5% chance of rare drop
C2 30
7B
6A
60         RTS
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite