suloku's modernised Exp. All

suloku dropped a really good guide on implementing modern Exp. All into RBY, making the item actually useful.

This basically fixes all the issues, but does expose one thing: Gaining Exp takes...a long time. So when you have one Pokemon KO another and have 5 others in waiting, the load time before leaving the battle will take about 3 seconds. This is definitely disorientating, but is still much, much, much faster than the original.
This commit is contained in:
Llinos Evans 2023-07-27 21:54:31 +01:00
parent 47f2683d85
commit 754e1cdf28
5 changed files with 53 additions and 28 deletions

View file

@ -877,6 +877,9 @@ FaintEnemyPokemon:
push af
jr z, .giveExpToMonsThatFought ; if no exp all, then jump
; Features suloku's exp all modernisations https://pastebin.com/23r3tLSc
; Basically, we have to make it round up to not lose that crumb of exp points
; the player has exp all
; first, we halve the values that determine exp gain
; the enemy mon base stats are added to stat exp, so they are halved
@ -884,7 +887,11 @@ FaintEnemyPokemon:
ld hl, wEnemyMonBaseStats
ld b, $7
.halveExpDataLoop
ld a, [hl]
and a, $01
srl [hl]
add a, [hl]
ld [hl], a
inc hl
dec b
jr nz, .halveExpDataLoop

View file

@ -2,9 +2,21 @@ GainExperience:
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ret z ; return if link battle
call DivideExpDataByNumMonsGainingExp
; call DivideExpDataByNumMonsGainingExp removed to modernise exp. all: https://pastebin.com/23r3tLSc
; suloku's modernised boosted exp
ld a, [wBoostExpByExpAll] ;load in a if the EXP All is being used
ld hl, WithExpAllText ; this is preparing the text to show
and a ;check wBoostExpByExpAll value
jr z, .skipExpAll ; if wBoostExpByExpAll is zero, we are not using it, so we don't show anything and keep going on
call PrintText ; if the code reaches this point it means we have the Exp.All, so show the message
.skipExpAll
ld hl, wPartyMon1
xor a
; ld [wWhichPokemon], a
; ld hl, wPartyMon1
xor a
ld [wWhichPokemon], a
.partyMonLoop ; loop over each mon and add gained exp
inc hl
@ -142,14 +154,18 @@ GainExperience:
ld [hld], a
dec hl
.next2
push hl
ld a, [wWhichPokemon]
ld hl, wPartyMonNicks
call GetPartyMonName
ld hl, GainedText
call PrintText
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
push hl
ld a, [wWhichPokemon]
ld hl, wPartyMonNicks
call GetPartyMonName
ld a, [wBoostExpByExpAll]
and a
jr nz, .skipExpText
ld hl, GainedText
call PrintText
.skipExpText
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
call LoadMonData
pop hl
ld bc, wPartyMon1Level - wPartyMon1Exp
@ -324,28 +340,26 @@ DivideExpDataByNumMonsGainingExp:
jr nz, .divideLoop
ret
; multiplies exp by 1.5...NOT!!!! - PvK
; This is only used for Trainer Battles now.
BoostExp:
; ldh a, [hQuotient + 2]
; ld b, a
; ldh a, [hQuotient + 3]
; ld c, a
; srl b
; rr c
; add c
; ldh [hQuotient + 3], a
; ldh a, [hQuotient + 2]
; adc b
; ldh [hQuotient + 2], a
ldh a, [hQuotient + 2]
ld b, a
ldh a, [hQuotient + 3]
ld c, a
srl b
rr c
add c
ldh [hQuotient + 3], a
ldh a, [hQuotient + 2]
adc b
ldh [hQuotient + 2], a
ret
; Here we use suloku's exp all modernisation and remove boosted exp
; https://pastebin.com/23r3tLSc
GainedText:
text_far _GainedText
text_asm
ld a, [wBoostExpByExpAll]
ld hl, WithExpAllText
and a
ret nz
ld hl, ExpPointsText
;ld a, [wGainBoostedExp]
;and a
@ -359,6 +373,7 @@ WithExpAllText:
ld hl, ExpPointsText
ret
; Repurposed for "applying exp" message.
BoostedText:
text_far _BoostedText

View file

@ -205,6 +205,7 @@ DebugItemsList:
db MYSTERY_BOX, 1
db CANDY_JAR, 1
db BICYCLE, 1
db EXP_ALL, 1
db FULL_RESTORE, 99
db MAX_REPEL, 99
db RARE_CANDY, 99