diff options
-rw-r--r-- | Don't-gain-experience-at-level-100.md | 79 | ||||
-rw-r--r-- | Tutorials.md | 2 |
2 files changed, 80 insertions, 1 deletions
diff --git a/Don't-gain-experience-at-level-100.md b/Don't-gain-experience-at-level-100.md new file mode 100644 index 0000000..ff57841 --- /dev/null +++ b/Don't-gain-experience-at-level-100.md @@ -0,0 +1,79 @@ +At level 100, Pokémon can't usefully gain experience. But until Gen 5, they did so anyway, taking a share from other battle participants who would actually benefit (and wasting time with messages about their gains). + +This tutorial shows how to disable experience gain at level 100. It does *not* affect stat experience (the Gen 1 and 2 precursor to EVs), so you can still use the [box trick](https://bulbapedia.bulbagarden.net/wiki/Box_trick) to raise stats at level 100. + +Anyway, just edit one file, [engine/battle/core.asm](../blob/master/engine/battle/core.asm): + +```diff + GiveExperiencePoints: + ; Give experience. + ; Don't give experience if linked or in the Battle Tower. + ... + + .skip + inc de + inc de + dec c + jr nz, .loop1 ++ pop bc ++ ld hl, MON_LEVEL ++ add hl, bc ++ ld a, [hl] ++ cp MAX_LEVEL ++ jp nc, .skip_stats ++ push bc + xor a + ld [hMultiplicand + 0], a + ld [hMultiplicand + 1], a + ld a, [wEnemyMonBaseExp] + ld [hMultiplicand + 2], a + ld a, [wEnemyMonLevel] + ld [hMultiplier], a + call Multiply + ld a, 7 + ld [hDivisor], a + ld b, 4 + call Divide + + ... + + .EvenlyDivideExpAmongParticipants: + ; count number of battle participants + ld a, [wBattleParticipantsNotFainted] + ld b, a + ld c, PARTY_LENGTH + ld d, 0 + .count_loop ++ push bc ++ push de ++ ld a, [wPartyCount] ++ cp c ++ jr c, .no_mon ++ ld a, c ++ dec a ++ ld hl, wPartyMon1Level ++ call GetPartyLocation ++ ld a, [hl] ++.no_mon ++ cp MAX_LEVEL ++ pop de ++ pop bc ++ jr nz, .gains_exp ++ srl b ++ ld a, d ++ jr .no_exp ++.gains_exp + xor a + srl b + adc d + ld d, a ++.no_exp + dec c + jr nz, .count_loop + cp 2 + ret c +``` + +The first edit there skips experience gain for level 100 Pokémon. The second edit skips counting those Pokémon toward the divisor, just as if they were fainted, so all the experience points will be evenly divided among participants that can actually benefit. + +(If you're studying how it works, notice that the logic around `jr c, .no_mon` relies on `PARTY_LENGTH` < `MAX_LEVEL`, i.e. 6 < 100. This is a safe assumption that allows for more efficient code.) diff --git a/Tutorials.md b/Tutorials.md index 2234830..e99b5bd 100644 --- a/Tutorials.md +++ b/Tutorials.md @@ -55,6 +55,7 @@ Tutorials may use diff syntax to show edits: **Features from later generations:** - [Physical/Special split](Physical-Special-split) +- [Don't gain experience at level 100](Don't-gain-experience-at-level-100) - [Infinitely reusable TMs](Infinitely-reusable-TMs) - [Automatically reuse Repel](Automatically-reuse-Repel) - [Evolution moves](Evolution-moves) @@ -79,7 +80,6 @@ Tutorials may use diff syntax to show edits: - More daily and weekly events - More than 15 `object_event`s per map - Third trainer card page for Kanto badges -- Don't print experience gain at level 100 - Colored party menu icons - Option to show shiny colors in Pokédex - Automatic rain/sun/sandstorm on certain maps |