Users browsing this thread: 1 Guest(s)
Final Requests for Help
05-14-2021, 11:59 PM
(05-14-2021, 12:41 PM)PowerPanda Wrote: Hey Subtraction, I have a question on this section of the code:
Specifically:
JSR $4B5A
AND #$1F ; 1/32 chance of breaking
With it saying #$1F, does that mean that it's actually breaking 1/8th of the time? I was expecting "AND #$05". Reports from players have their tools breaking multiple times before they even hit the Returner's hideout.
No, AND #$05 would be a 1/8 chance. In fact, when I was testing this, it was taking too long for tools to break, so I changed it to AND #$03 to make them break more frequently.
JSR $4B5A sets the accumulator to a pseudo-random number, 0–255
AND #$1F clears the top 3 bits, making it a pseudo-random number from 0–31. If the number is now 0, it sets the Zero flag; otherwise it clears the Zero flag.
BNE branches if the Zero flag is clear.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)