From 754e1cdf28a519fa9e2fc73c9c3011a1ee49237c Mon Sep 17 00:00:00 2001 From: Llinos Evans <36418502+PlagueVonKarma@users.noreply.github.com> Date: Thu, 27 Jul 2023 21:54:31 +0100 Subject: [PATCH] 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. --- README.md | 3 +- data/text/text_2.asm | 5 +-- engine/battle/core.asm | 7 ++++ engine/battle/experience.asm | 65 ++++++++++++++++++++++-------------- engine/debug/debug_party.asm | 1 + 5 files changed, 53 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 25875c35..e6467711 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,7 @@ QoL Enhancements - All 151 original Pokemon, plus an additional 100, can be obtained without the use of trading or glitches, including Mew! - Bag capacity is increased from 20 to 30 items. - Pokemon Box capacity is now 280 Pokemon with 14 boxes. +- Exp. All now works like the modern Exp. Share, giving all party members max exp. It also only has one message, though it does still take time to calculate all the exp being thrown around. It'll take around 3 seconds to calculate, sort of like saving. - New Pokedex entries for most Pokemon are available, sourced from the original 1996 Pokedex book by Creatures Inc., restoring a ton of old Kanto lore. Thanks to [Dr. Lava and Nob Ogasawara](http://lavacutcontent.com/1996-creatures-pokedex-translation-1/) for their incredible work translating and writing about it! - Pikachu and Eevee are now starters, featuring fully functional Rival lineups. If you pick Pikachu, he picks Eevee, and if you pick Eevee, he picks Pikachu! Their growth rates have been changed to Medium Slow to give them the early-game power spike the other starters have. - Item Descriptions are available! @@ -398,7 +399,7 @@ If you use our implementations of anything at all, it is encouraged to submit Pu * BGVC - Composed the original 4-channel version of the unused Koukan (trading) music. * SatoMew - Technical advice. * wrulfy - Technical advice. -* suloku - Technical advice regarding setting where you spawn after beating the Elite Four. +* suloku - Technical advice regarding setting where you spawn after beating the Elite Four, Exp. All modernisation code * Molk - Balancing of some beta Pokemon, most notably Deer. * Shellnuts - Balancing of some beta Pokemon, especially Omega; made the type chart suggestions to balance Galarian Moltres properly. * 大吟醸 (Daiginjo) - Assistance in translating the Tamamushi University Student Book, allowing for an accurate adaptation of the location. diff --git a/data/text/text_2.asm b/data/text/text_2.asm index 5cf5e34e..770c5923 100644 --- a/data/text/text_2.asm +++ b/data/text/text_2.asm @@ -1233,9 +1233,10 @@ _GainedText:: line "@" text_end +; changed to be used with suloku's exp all modernisations https://pastebin.com/23r3tLSc _WithExpAllText:: - text "with EXP.ALL," - cont "@" + text "Party gained" + next "@" text_end _BoostedText:: diff --git a/engine/battle/core.asm b/engine/battle/core.asm index c5c44fd2..ba2bf860 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -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 diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 06f5097c..260c7d7e 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -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 diff --git a/engine/debug/debug_party.asm b/engine/debug/debug_party.asm index 6f87687d..ed97c263 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -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