mirror of https://github.com/pret/pokecrystal.git
Use a macro for Odd Egg probabilities.
This commit is contained in:
parent
e2ec8a1d13
commit
b6793b65df
|
@ -1,43 +1,52 @@
|
||||||
GiveOddEgg: ; 1fb4b6
|
GiveOddEgg: ; 1fb4b6
|
||||||
|
|
||||||
; Figure out which egg to give.
|
; Figure out which egg to give.
|
||||||
|
|
||||||
|
; Compare a random word to
|
||||||
|
; probabilities out of 0xffff.
|
||||||
call Random
|
call Random
|
||||||
ld hl, .Probabilities
|
ld hl, .Probabilities
|
||||||
ld c, 0
|
ld c, 0
|
||||||
ld b, c
|
ld b, c
|
||||||
.next
|
.loop
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld e, a
|
ld e, a
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld d, a
|
ld d, a
|
||||||
|
|
||||||
|
; Break on $ffff.
|
||||||
ld a, d
|
ld a, d
|
||||||
cp $ff
|
cp $ffff / $100
|
||||||
jr nz, .first
|
jr nz, .not_done
|
||||||
ld a, e
|
ld a, e
|
||||||
cp $ff
|
cp $ffff % $100
|
||||||
jr z, .done
|
jr z, .done
|
||||||
.first
|
.not_done
|
||||||
ld a, [hRandomSub]
|
|
||||||
|
; Break when [hRandom] <= de.
|
||||||
|
ld a, [hRandom + 1]
|
||||||
cp d
|
cp d
|
||||||
jr c, .done
|
jr c, .done
|
||||||
jr z, .second
|
jr z, .ok
|
||||||
jr .good
|
jr .next
|
||||||
.second
|
.ok
|
||||||
ld a, [hRandomAdd]
|
ld a, [hRandom + 0]
|
||||||
cp e
|
cp e
|
||||||
jr c, .done
|
jr c, .done
|
||||||
jr z, .done
|
jr z, .done
|
||||||
.good
|
.next
|
||||||
inc bc
|
inc bc
|
||||||
jr .next
|
jr .loop
|
||||||
.done
|
.done
|
||||||
|
|
||||||
ld hl, OddEggs
|
ld hl, OddEggs
|
||||||
ld a, OddEgg2 - OddEgg1
|
ld a, OddEgg2 - OddEgg1
|
||||||
call AddNTimes
|
call AddNTimes
|
||||||
|
|
||||||
ld de, $c608
|
ld de, $c608
|
||||||
ld bc, $0046
|
ld bc, $0046
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
|
|
||||||
ld a, EGG_TICKET
|
ld a, EGG_TICKET
|
||||||
ld [CurItem], a
|
ld [CurItem], a
|
||||||
ld a, $1
|
ld a, $1
|
||||||
|
@ -46,29 +55,31 @@ GiveOddEgg: ; 1fb4b6
|
||||||
ld [$d107], a
|
ld [$d107], a
|
||||||
ld hl, NumItems
|
ld hl, NumItems
|
||||||
call TossItem
|
call TossItem
|
||||||
|
|
||||||
ld a, EGG
|
ld a, EGG
|
||||||
ld [$cd2a], a
|
ld [$cd2a], a
|
||||||
ld a, $29
|
|
||||||
|
ld a, $cd29 % $100
|
||||||
ld [$cd20], a
|
ld [$cd20], a
|
||||||
ld a, $cd
|
ld a, $cd29 / $100
|
||||||
ld [$cd21], a
|
ld [$cd21], a
|
||||||
ld a, $8
|
ld a, $c608 % $100
|
||||||
ld [$cd22], a
|
ld [$cd22], a
|
||||||
ld a, $c6
|
ld a, $c608 / $100
|
||||||
ld [$cd23], a
|
ld [$cd23], a
|
||||||
|
|
||||||
ld hl, .Odd
|
ld hl, .Odd
|
||||||
ld de, $cd2b
|
ld de, $cd2b
|
||||||
ld bc, $000b
|
ld bc, PKMN_NAME_LENGTH
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
|
|
||||||
ld a, $2b
|
ld a, $cd2b % $100
|
||||||
ld [$cd24], a
|
ld [$cd24], a
|
||||||
ld a, $cd
|
ld a, $cd2b / $100
|
||||||
ld [$cd25], a
|
ld [$cd25], a
|
||||||
ld a, $38
|
ld a, $c638 % $100
|
||||||
ld [$cd26], a
|
ld [$cd26], a
|
||||||
ld a, $c6
|
ld a, $c638 / $100
|
||||||
ld [$cd27], a
|
ld [$cd27], a
|
||||||
callba Function11b98f
|
callba Function11b98f
|
||||||
ret
|
ret
|
||||||
|
@ -78,20 +89,28 @@ GiveOddEgg: ; 1fb4b6
|
||||||
db "ODD@@@@@@@@@"
|
db "ODD@@@@@@@@@"
|
||||||
|
|
||||||
.Probabilities
|
.Probabilities
|
||||||
dw $147a ; 92% -> 8%
|
|
||||||
dw $170a ; 91% -> 1%
|
prob: MACRO
|
||||||
dw $3fff ; 75% -> 16%
|
prob_total = prob_total + (\1)
|
||||||
dw $47ad ; 72% -> 3%
|
dw prob_total * $ffff / 100
|
||||||
dw $70a3 ; 56% -> 16%
|
ENDM
|
||||||
dw $7851 ; 53% -> 3%
|
|
||||||
dw $9c28 ; 39% -> 14%
|
prob_total = 0
|
||||||
dw $a147 ; 37% -> 2%
|
|
||||||
dw $bae0 ; 27% -> 10%
|
prob 8
|
||||||
dw $bfff ; 25% -> 2%
|
prob 1
|
||||||
dw $deb7 ; 13% -> 12%
|
prob 16
|
||||||
dw $e3d6 ; 11% -> 2%
|
prob 3
|
||||||
dw $fd6f ; 1% -> 10%
|
prob 16
|
||||||
dw $ffff ; 0% -> 1%
|
prob 3
|
||||||
|
prob 14
|
||||||
|
prob 2
|
||||||
|
prob 10
|
||||||
|
prob 2
|
||||||
|
prob 12
|
||||||
|
prob 2
|
||||||
|
prob 10
|
||||||
|
prob 1
|
||||||
; 1fb56e
|
; 1fb56e
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue