Skip to content

Commit

Permalink
rework loading Pikachu's unique moves in Yellow Forest
Browse files Browse the repository at this point in the history
- gives Pikachu Surf via form check rather than special case player state check
- allows unique move macro to take form as parameter
- fixes bug where Surf or Fly Pikachu could only be male
  • Loading branch information
itsdarsh committed Feb 19, 2025
1 parent ebe742a commit 05992ee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 28 deletions.
12 changes: 9 additions & 3 deletions data/pokemon/unique_wild_moves.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
MACRO unique_moves
db \1 ; landmark
dp \2 ; species
db \3 ; move
if _NARG == 4
dp \2, \3 ; species, form
db \4 ; move
else
dp \2 ; species
db \3 ; move
endc
ENDM

; TODO: finish unique moves
Expand Down Expand Up @@ -30,7 +35,6 @@ UniqueWildMoves:
unique_moves BURNED_TOWER, 0, 0
unique_moves WHIRL_ISLANDS, 0, 0
unique_moves CLIFF_CAVE, 0, 0
unique_moves YELLOW_FOREST, PIKACHU, FLY ; replaced with Surf if Surfing
unique_moves QUIET_CAVE, MUNCHLAX, GIGA_IMPACT ; Snorlax move
unique_moves MT_MORTAR, 0, 0
unique_moves LAKE_OF_RAGE, MAGIKARP, HYDRO_PUMP ; Pokéwalker move
Expand Down Expand Up @@ -82,4 +86,6 @@ UniqueWildMoves:
unique_moves ROUTE_23, GYARADOS, POWER_WHIP ; Sw/Sh TR move
unique_moves ROUTE_44, AIPOM, ROCK_BLAST ; new move
unique_moves ROUTE_49, PARASECT, CONFUSE_RAY ; Prism tutor move
unique_moves YELLOW_FOREST, PIKACHU, PLAIN_FORM, FLY ; Yellow special move, assumed only Pikachu can learn Fly
unique_moves YELLOW_FOREST, PIKACHU, PIKACHU_SURF_FORM, SURF ; Yellow special move, assumed only Pikachu can learn Surf
db -1
2 changes: 1 addition & 1 deletion data/wild/johto_water.asm
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
def_water_wildmons YELLOW_FOREST
db 6 percent ; encounter rate
wildmon LEVEL_FROM_BADGES - 4, MARILL
wildmon LEVEL_FROM_BADGES - 4, PIKACHU
wildmon LEVEL_FROM_BADGES - 4, PIKACHU, PIKACHU_SURF_FORM
wildmon LEVEL_FROM_BADGES - 4, PSYDUCK
end_water_wildmons

Expand Down
33 changes: 9 additions & 24 deletions engine/battle/unique_wild_moves.asm
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ CheckUniqueWildMove:
; If form isn't specified in the unique wildmove list, any form will do.
ld a, [hli] ; form
ld b, a
and FORM_MASK
jr nz, .specific_form
and a, FORM_MASK
ld a, [wCurForm]
jr nz, .specific_form
and EXTSPECIES_MASK
jr .compare_form
.specific_form
ld a, [wCurForm]
and SPECIESFORM_MASK
.compare_form
cp b
Expand All @@ -45,19 +44,10 @@ CheckUniqueWildMove:
jr z, .TeachMove ; assume this is for Explosion in TeamRocketBaseB1F
cp UNION_CAVE
jr z, .TeachMove ; assume this is a Lapras in UnionCaveB2F
cp YELLOW_FOREST
jr nz, .ChanceToTeach
; assume this is a Pikachu in YellowForest; Surf (always teach) or Fly?
ld a, [wPlayerState]
cp PLAYER_SURF
jr z, .SurfingPikachu
cp PLAYER_SURF_PIKA
jr nz, .ChanceToTeach
.SurfingPikachu
ld a, SURF
ld b, a
jr .TeachMove
.ChanceToTeach
ld a, b
cp SURF
jr z, .TeachMove ; assume only Pikachu can learn Surf

call Random
add a
ret nc
Expand All @@ -79,11 +69,8 @@ CheckUniqueWildMove:
ld a, b
ld [hl], a

; assume only Pikachu can learn Surf or Fly
cp SURF
jr z, .UseSurfingPikachu
; assume only Pikachu can learn Fly
cp FLY
ld a, PIKACHU_FLY_FORM
jr z, .UseFlyingPikachu
ret

Expand All @@ -95,11 +82,9 @@ CheckUniqueWildMove:
inc hl
jr .loop

.UseSurfingPikachu
ld a, PIKACHU_SURF_FORM
.UseFlyingPikachu
ld b, a
ld a, [wCurForm]
ld b, PIKACHU_FLY_FORM
ld a, [wOTPartyMon1Form]
and ~FORM_MASK
or b
ld [wCurForm], a
Expand Down

0 comments on commit 05992ee

Please sign in to comment.