Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

item-newbox | Incorrect skipping of parameters in evolve.asm #24

Open
MarioBones opened this issue Nov 10, 2024 · 1 comment
Open

item-newbox | Incorrect skipping of parameters in evolve.asm #24

MarioBones opened this issue Nov 10, 2024 · 1 comment

Comments

@MarioBones
Copy link

There are a few spots in engine/pokemon/evolve.asm where hl is incremented the wrong number of times and so the Pokemon's evolutions are not checked properly. This is only really noticeable on Eevee and Tyrogue but any Pokemon using EVOLVE_HAPPINESS or EVOLVE_STAT can theoretically encounter the issue.

If you step through EvolveAfterBattle_MasterLoop.loop when Eevee levels up you can see incorrect and invalid values for evolution methods get passed into a:
pokecrystal evolve

The following changes need to be made in evolve.asm:

; EVOLVE_STAT
	call GetNextEvoAttackByte
	ld c, a
	ld a, [wTempMonLevel]
	cp c
-	jp c, .skip_evolution_species_parameter
+	jp c, .skip_half_species_parameter

	call IsMonHoldingEverstone
-	jp z, .skip_evolution_species_parameter
+	jp c, .skip_evolution_species

...

.happiness
	ld a, [wTempMonHappiness]
	cp HAPPINESS_TO_EVOLVE
-	jp c, .skip_evolution_species_parameter
+	jp c, .skip_half_species_parameter

...

; TR_NITE
	ld a, [wTimeOfDay]
	cp NITE_F
-	jp nz, .skip_half_species_parameter
+	jp nz, .skip_evolution_species
	jp .proceed

.happiness_daylight
	ld a, [wTimeOfDay]
	cp NITE_F
-	jp z, .skip_half_species_parameter
+	jp z, .skip_evolution_species
	jp .proceed

I haven't done any testing with trades so it's possible that there's issues with EVOLVE_TRADE that I'm not aware of.

@Rangi42
Copy link
Collaborator

Rangi42 commented Nov 10, 2024

I think a good solution would just be making all evolutions three values: dbww method byte, 16-bit param, 16-bit species. The param could be an item ID, move ID, etc, or some combination of two bytes for more complex methods (e.g. dbbbw EVOLVE_STAT, 20, ATK_LT_DEF, HITMONCHAN or dbbbw EVOLVE_LEVEL, 35, IN_GALAR, GALARIAN_WEEZING).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants