diff options
| -rw-r--r-- | Replace-stat-experience-with-EVs.md | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/Replace-stat-experience-with-EVs.md b/Replace-stat-experience-with-EVs.md index 6b7a776..7ecce09 100644 --- a/Replace-stat-experience-with-EVs.md +++ b/Replace-stat-experience-with-EVs.md @@ -339,7 +339,7 @@ GiveExperiencePoints: +; t = sat, f = sdf, 0 = unused bits + ld a, [wBaseHPAtkDefSpdEVs] + ld b, a -+ ld c, 6 ; six EVs ++ ld c, NUM_STATS ; six EVs +.ev_loop + rlc b + rlc b @@ -374,8 +374,8 @@ GiveExperiencePoints: ld [wTempByteValue], a - ld hl, wEnemyMonBaseStats - ld c, wEnemyMonEnd - wEnemyMonBaseStats +-.base_stat_division_loop + ld hl, wEnemyMonBaseExp - .base_stat_division_loop xor a ldh [hDividend + 0], a ld a, [hl] @@ -558,15 +558,17 @@ Edit [engine/items/item_effects.asm](../blob/master/engine/items/item_effects.as -GetStatExpRelativePointer: +GetEVRelativePointer: ld a, [wCurItem] - ld hl, StatExpItemPointerOffsets +- ld hl, StatExpItemPointerOffsets ++ ld hl, EVItemPointerOffsets ... - StatExpItemPointerOffsets: +-StatExpItemPointerOffsets: - db HP_UP, MON_HP_EXP - MON_STAT_EXP - db PROTEIN, MON_ATK_EXP - MON_STAT_EXP - db IRON, MON_DEF_EXP - MON_STAT_EXP - db CARBOS, MON_SPD_EXP - MON_STAT_EXP - db CALCIUM, MON_SPC_EXP - MON_STAT_EXP ++EVItemPointerOffsets: + db HP_UP, MON_HP_EV - MON_EVS + db PROTEIN, MON_ATK_EV - MON_EVS + db IRON, MON_DEF_EV - MON_EVS @@ -758,7 +760,7 @@ Then edit [engine/items/item_effects.asm](../blob/master/engine/items/item_effec ... - StatExpItemPointerOffsets: + EVItemPointerOffsets: db HP_UP, MON_HP_EV - MON_EVS db PROTEIN, MON_ATK_EV - MON_EVS db IRON, MON_DEF_EV - MON_EVS @@ -774,9 +776,7 @@ That's all! ## 11. Limit total EVs to 510 -This section allows you to limit total EVs of each Pokémon to 510. - -First, edit [constants/pokemon_data_constants.asm](../blob/master/constants/pokemon_data_constants.asm) again: +At this point all stats use EVs instead of Stat Exp, but the total EV limit form Gen 3 onward hasn't been coded yet; in this section we're going to implement it. First, edit [constants/pokemon_data_constants.asm](../blob/master/constants/pokemon_data_constants.asm) again: ```diff ; significant EV values @@ -796,13 +796,13 @@ Next edit `GiveExperiencePoints` in [engine/battle/core.asm](../blob/master/engi + ld d, a + ld a, c +.find_correct_ev_address ; If address of first EV is changed, find the correct one. -+ cp 6 ++ cp NUM_STATS + jr z, .found_address + dec hl + inc a + jr .find_correct_ev_address +.found_address -+ ld e, 6 ++ ld e, NUM_STATS + ld bc, 0 +.count_evs + ld a, [hli] @@ -831,14 +831,13 @@ Next edit `GiveExperiencePoints` in [engine/battle/core.asm](../blob/master/engi + pop bc + ld a, e add [hl] - cp MAX_EV + jr c, .ev_overflow + cp MAX_EV + 1 ... ldh a, [hQuotient + 3] - ld [hli], a - dec c - jr nz, .base_stat_division_loop + ld [hl], a ret +IsEvsGreaterThan510: @@ -866,7 +865,7 @@ Edit `VitaminEffect` in [engine/items/item_effects.asm](../blob/master/engine/it + ld d, 10 + push bc + push hl -+ ld e, 6 ++ ld e, NUM_STATS + ld bc, 0 +.count_evs + ld a, [hli] |
