Users browsing this thread: 1 Guest(s)
Gau's Rage 75%

#1
Posts: 145
Threads: 47
Thanks Received: 0
Thanks Given: 0
Joined: Jan 2020
Reputation: 0
Status
None
Do you know how to edit Gau's Rage from 50-50 to 75-25? 

The odd 50% suck but I do not want 100% because it kinda fit the theme from other characters command chances like Umaro, Relm & Mog.
  Find
Quote  

#2
Posts: 281
Threads: 18
Thanks Received: 13
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
Yes, if you know ASM, you can do it by rewriting this section of code, which is basically a coinflip.

Code:
C2/0600: 20 53 4B     JSR $4B53      (random: 0 or 1 in Carry flag)
C2/0603: C2 30        REP #$30
C2/0605: 2A           ROL
C2/0606: AA           TAX            (X: 0 or 1)
C2/0607: E2 20        SEP #$20       (Set 8-bit Accumulator)
C2/0609: BF 00 46 CF  LDA $CF4600,X  (load Rage move)
C2/060D: 28           PLP
C2/060E: FA           PLX
C2/060F: 60           RTS
  Find
Quote  

#3
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
If you have no idea how to do it you can test this code with xkas 0.06. Note that you'll need to change the org $C26469 to actual free space in bank $C2 if that space is occupied by patches. This code is untested.

Code:
hirom
;header

org $C20600
jsr sub_rage      ; get good index
tax               ; transfer rage/attack index to X
sep #$20          ; 8-bit accumulator
lda $CF4600,X     ; load rage/attack
plp
plx
rts

org $C26469       ; change to free space in bank $C2
sub_rage:
pha               ; save monster index
jsr $4B5A         ; random number between 0 and 255
cmp #$40          ; compare to 64
bcc is_attack     ; branch if smaller than 64
; rage (75%)
pla               ; restore monster index
rep #$30          ; 16-bit accumulator/index
asl a             ; multiply by 2
inc a             ; increment by 1
bra exit          
is_attack:
; attack (25%)
pla               ; restore monster index
rep #$30          ; 16-bit accumulator/index
asl a             ; multiply by 2
exit:
rts
  Find
Quote  

#4
Posts: 145
Threads: 47
Thanks Received: 0
Thanks Given: 0
Joined: Jan 2020
Reputation: 0
Status
None
(01-23-2020, 05:49 PM)seibaby Wrote: Yes, if you know ASM, you can do it by rewriting this section of code, which is basically a coinflip.

Code:
C2/0600: 20 53 4B     JSR $4B53      (random: 0 or 1 in Carry flag)
C2/0603: C2 30        REP #$30
C2/0605: 2A           ROL
C2/0606: AA           TAX            (X: 0 or 1)
C2/0607: E2 20        SEP #$20       (Set 8-bit Accumulator)
C2/0609: BF 00 46 CF  LDA $CF4600,X  (load Rage move)
C2/060D: 28           PLP
C2/060E: FA           PLX
C2/060F: 60           RTS
And to not make it a coin flip but 75-25?
  Find
Quote  

#5
Posts: 272
Threads: 2
Thanks Received: 2
Thanks Given: 0
Joined: Apr 2013
Reputation: 3
Status
Prowess
Put two coinflips in. Flip coin: if 0, pick move 1. If 1, flip coin: if 0, pick move 1, if 1, pick move 2. Not sure if that's the *easiest* way to go about it because I'm not familiar with assembly, but I suspect the building blocks are already there to make 75/25 happen.


The only thing harder than finding a needle in a haystack is finding a haystack in a needle. Laugh
  Find
Quote  

#6
Posts: 281
Threads: 18
Thanks Received: 13
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
The easiest way is to replace the coin flip with a call to the RNG function at $C24B5A to draw a random number 0..255, then compare it to 64 for a 75% chance to set the carry flag.

Edit: just do this

Code:
;header
!freespace = $c2a65a

org $c20600
jsr newfunc

org !freespace
newfunc:
sep #$20
jsr $4b5a
cmp #$40
rep #$20
rts

Copy the above code into notepad, save it as something.asm and look up on Youtube how to apply an ASM patch using xkas.
  Find
Quote  
[-] The following 3 users say Thank You to seibaby for this post:
  • doofenH (01-29-2020), madsiur (01-24-2020), Robo Jesus (01-27-2020)

#7
Posts: 145
Threads: 47
Thanks Received: 0
Thanks Given: 0
Joined: Jan 2020
Reputation: 0
Status
None
(01-24-2020, 04:46 PM)seibaby Wrote: The easiest way is to replace the coin flip with a call to the RNG function at $C24B5A to draw a random number 0..255, then compare it to 64 for a 75% chance to set the carry flag.

Edit: just do this

Code:
;header
!freespace = $c2a65a

org $c20600
jsr newfunc

org !freespace
newfunc:
sep #$20
jsr $4b5a
cmp #$40
rep #$20
rts

Copy the above code into notepad, save it as something.asm and look up on Youtube how to apply an ASM patch using xkas.
Rage does become 75-25 happened. However Gau keep using different attacks. Did you notice? And any idea why it happened?
  Find
Quote  

#8
Posts: 200
Threads: 1
Thanks Received: 10
Thanks Given: 0
Joined: Oct 2015
Reputation: 18
Status
None
ah, A needs to be preserved surrounding the "jsr $4b5a / cmp #$40".

and can the "sep #$20" and "rep #$20" be chucked to save space?
Quote  

#9
Posts: 145
Threads: 47
Thanks Received: 0
Thanks Given: 0
Joined: Jan 2020
Reputation: 0
Status
None
(01-30-2020, 02:53 AM)assassin Wrote: ah, A needs to be preserved surrounding the "jsr $4b5a / cmp #$40".

and can the "sep #$20" and "rep #$20" be chucked to save space?
Sorry but I don't get it. What do you mean "Preserved" and "chucked"? 

You mean like this? 

header
!freespace = $c2a65a

org $c20600
jsr newfunc

org !freespace
newfunc:
jsr $4b5a
cmp #$40
rts


or like this?


header
!freespace = $c2a65a

org $c20600
jsr newfunc

org !freespace
newfunc:
sep #$20
jsr $4b5a/cmp #$40
rep #$20
rts
  Find
Quote  

#10
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
I think he meant something like this:

Code:
org !freespace
newfunc:
pha
jsr $4b5a
cmp #$40
pla
rts
  Find
Quote  
[-] The following 2 users say Thank You to madsiur for this post:
  • doofenH (01-31-2020), seibaby (01-30-2020)



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite