mirror of
				https://github.com/thornAvery/jep-hack.git
				synced 2025-11-05 05:10:58 +13:00 
			
		
		
		
	Bug Catching Contest gives a funny Gligar
If you win the Bug Catching Contest, the man will give you an Earthquake Gligar. The code that gives it a special move is a bit fucked up because I tried to add a Farfetch'd function, but I can't be bothered to finish the functionality because I'm stupid (it is actually quite easy I'm just lazy)
This commit is contained in:
		
							parent
							
								
									d765610c04
								
							
						
					
					
						commit
						1bc5644edc
					
				| 
						 | 
				
			
			@ -487,7 +487,7 @@
 | 
			
		|||
	const EVENT_KARENS_ROOM_EXIT_OPEN
 | 
			
		||||
	const EVENT_LANCES_ROOM_ENTRANCE_CLOSED
 | 
			
		||||
	const EVENT_LANCES_ROOM_EXIT_OPEN
 | 
			
		||||
	const EVENT_CONTEST_OFFICER_HAS_SUN_STONE
 | 
			
		||||
	const EVENT_CONTEST_OFFICER_HAS_GLIGAR
 | 
			
		||||
	const EVENT_CONTEST_OFFICER_HAS_EVERSTONE
 | 
			
		||||
	const EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY
 | 
			
		||||
	const EVENT_CONTEST_OFFICER_HAS_BERRY
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -191,3 +191,4 @@ SpecialsPointers::
 | 
			
		|||
	add_special NameMom
 | 
			
		||||
	add_special ShoveSafariBallsDownKrissThroat
 | 
			
		||||
	add_special GiveKrisSneakers
 | 
			
		||||
	add_special DebugGiveMonSpecialMove
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,137 @@ Special::
 | 
			
		|||
 | 
			
		||||
INCLUDE "data/events/special_pointers.asm"
 | 
			
		||||
 | 
			
		||||
DebugGiveMonSpecialMove:
 | 
			
		||||
; TODO: Make this good :3
 | 
			
		||||
; I could implement Rangi's special givepoke but i am too stupid
 | 
			
		||||
; also this code is bugged and never works for farfetch'd partly because i am a dumb stupid idiot
 | 
			
		||||
; it works for gligar tho so it's good FOR NOW
 | 
			
		||||
; ScriptVar 1 - Gligar
 | 
			
		||||
; ScriptVar 2 - Farfetch'd
 | 
			
		||||
	ld bc, wPartyCount
 | 
			
		||||
	ld a, [bc]
 | 
			
		||||
	ld hl, MON_SPECIES
 | 
			
		||||
	call .GetNthPartyMon
 | 
			
		||||
	ld a, [bc]
 | 
			
		||||
	ld c, a
 | 
			
		||||
	push hl
 | 
			
		||||
	
 | 
			
		||||
	;call .GetNthPartyMon
 | 
			
		||||
	ld hl, GLIGAR
 | 
			
		||||
	call GetPokemonIDFromIndex
 | 
			
		||||
	
 | 
			
		||||
	pop hl
 | 
			
		||||
	ld b, a
 | 
			
		||||
	ld de, PARTYMON_STRUCT_LENGTH
 | 
			
		||||
.CheckForNthPokemon:
 | 
			
		||||
; start at the end of the party and search backwards for the last Pokemon in the party.
 | 
			
		||||
	ld a, [hl]
 | 
			
		||||
	cp b
 | 
			
		||||
	jr z, .GiveMoveset
 | 
			
		||||
	ld a, l
 | 
			
		||||
	sub e
 | 
			
		||||
	ld l, a
 | 
			
		||||
	ld a, h
 | 
			
		||||
	sbc d
 | 
			
		||||
	ld h, a
 | 
			
		||||
	dec c
 | 
			
		||||
	jr nz, .CheckForNthPokemon
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
.GiveMoveset:
 | 
			
		||||
	push hl
 | 
			
		||||
	
 | 
			
		||||
	;call .GetNthPartyMon
 | 
			
		||||
	ld hl, GLIGAR
 | 
			
		||||
	call GetPokemonIDFromIndex
 | 
			
		||||
;	cp FARFETCH_D
 | 
			
		||||
;	jr z, .skip
 | 
			
		||||
	ld a, 1
 | 
			
		||||
	ld [wScriptVar], a
 | 
			
		||||
;.skip
 | 
			
		||||
	
 | 
			
		||||
	ld a, [wScriptVar]
 | 
			
		||||
	ld hl, .Movesets
 | 
			
		||||
	ld bc, .Moveset1 - .Moveset0
 | 
			
		||||
	call AddNTimes
 | 
			
		||||
 | 
			
		||||
	; get address of mon's first move
 | 
			
		||||
	pop de
 | 
			
		||||
	inc de
 | 
			
		||||
	inc de
 | 
			
		||||
 | 
			
		||||
.GiveMoves:
 | 
			
		||||
	ld a, [hli]
 | 
			
		||||
	or [hl] ; is the move 00?
 | 
			
		||||
	ret z ; if so, we're done here
 | 
			
		||||
 | 
			
		||||
	push hl
 | 
			
		||||
	push de
 | 
			
		||||
	ld a, [hld]
 | 
			
		||||
	ld l, [hl]
 | 
			
		||||
	ld h, a
 | 
			
		||||
	call GetMoveIDFromIndex
 | 
			
		||||
	ld [de], a ; give the Pokémon the new move
 | 
			
		||||
 | 
			
		||||
	; get the PP of the new move
 | 
			
		||||
	ld l, a
 | 
			
		||||
	ld a, MOVE_PP
 | 
			
		||||
	call GetMoveAttribute
 | 
			
		||||
 | 
			
		||||
	; get the address of the move's PP and update the PP
 | 
			
		||||
	ld hl, MON_PP - MON_MOVES
 | 
			
		||||
	add hl, de
 | 
			
		||||
	ld [hl], a
 | 
			
		||||
 | 
			
		||||
	pop de
 | 
			
		||||
	pop hl
 | 
			
		||||
	inc de
 | 
			
		||||
	inc hl
 | 
			
		||||
	jr .GiveMoves
 | 
			
		||||
 | 
			
		||||
.Movesets:
 | 
			
		||||
.Moveset0:
 | 
			
		||||
; Gligar
 | 
			
		||||
	dw BATON_PASS
 | 
			
		||||
	dw SWORDS_DANCE
 | 
			
		||||
	dw AGILITY
 | 
			
		||||
	dw SLASH
 | 
			
		||||
	dw 0
 | 
			
		||||
.Moveset1:
 | 
			
		||||
; Farfetch'd
 | 
			
		||||
	dw EARTHQUAKE
 | 
			
		||||
	dw POISON_STING
 | 
			
		||||
	dw COUNTER
 | 
			
		||||
	dw WING_ATTACK
 | 
			
		||||
	dw 0
 | 
			
		||||
 | 
			
		||||
.GetNthPartyMon:
 | 
			
		||||
; inputs:
 | 
			
		||||
; hl must be set to 0 before calling this function.
 | 
			
		||||
; a must be set to the number of Pokémon in the party.
 | 
			
		||||
 | 
			
		||||
; outputs:
 | 
			
		||||
; returns the address of the last Pokémon in the party in hl.
 | 
			
		||||
; sets carry if a is 0.
 | 
			
		||||
 | 
			
		||||
	ld de, wPartyMon1
 | 
			
		||||
	add hl, de
 | 
			
		||||
	and a
 | 
			
		||||
	jr z, .EmptyParty
 | 
			
		||||
	dec a
 | 
			
		||||
	ret z
 | 
			
		||||
	ld de, PARTYMON_STRUCT_LENGTH
 | 
			
		||||
.loop
 | 
			
		||||
	add hl, de
 | 
			
		||||
	dec a
 | 
			
		||||
	jr nz, .loop
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
.EmptyParty:
 | 
			
		||||
	scf
 | 
			
		||||
	ret
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
UnusedDummySpecial:
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -355,7 +355,7 @@ BugContestResultsWarpScript:
 | 
			
		|||
BugContestResultsScript:
 | 
			
		||||
	clearflag ENGINE_BUG_CONTEST_TIMER
 | 
			
		||||
	clearevent EVENT_WARPED_FROM_ROUTE_35_NATIONAL_PARK_GATE
 | 
			
		||||
	clearevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE
 | 
			
		||||
	clearevent EVENT_CONTEST_OFFICER_HAS_GLIGAR
 | 
			
		||||
	clearevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE
 | 
			
		||||
	clearevent EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY
 | 
			
		||||
	clearevent EVENT_CONTEST_OFFICER_HAS_BERRY
 | 
			
		||||
| 
						 | 
				
			
			@ -425,18 +425,21 @@ BugContestResults_CleanUp:
 | 
			
		|||
 | 
			
		||||
BugContestResults_FirstPlace:
 | 
			
		||||
	setevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1
 | 
			
		||||
	farwritetext ContestResults_PlayerWonAPrizeText
 | 
			
		||||
	waitbutton
 | 
			
		||||
	readvar VAR_PARTYCOUNT
 | 
			
		||||
	ifequal PARTY_LENGTH, .BugContestResults_NoRoomForGligar
 | 
			
		||||
	
 | 
			
		||||
	givepoke GLIGAR, 5
 | 
			
		||||
	special DebugGiveMonSpecialMove ; give it the Stadium 2 moveset
 | 
			
		||||
 | 
			
		||||
	sjump BugContestResults_ReturnAfterWinnersPrize
 | 
			
		||||
 | 
			
		||||
BugContestResults_SecondPlace:
 | 
			
		||||
	getitemname STRING_BUFFER_4, BLK_AUGURITE
 | 
			
		||||
	farwritetext ContestResults_PlayerWonAPrizeText
 | 
			
		||||
	waitbutton
 | 
			
		||||
	verbosegiveitem BLK_AUGURITE
 | 
			
		||||
	iffalse BugContestResults_NoRoomForSunStone
 | 
			
		||||
	sjump BugContestResults_ReturnAfterWinnersPrize
 | 
			
		||||
 | 
			
		||||
BugContestResults_SecondPlace:
 | 
			
		||||
	getitemname STRING_BUFFER_4, EVERSTONE
 | 
			
		||||
	farwritetext ContestResults_PlayerWonAPrizeText
 | 
			
		||||
	waitbutton
 | 
			
		||||
	verbosegiveitem EVERSTONE
 | 
			
		||||
	iffalse BugContestResults_NoRoomForEverstone
 | 
			
		||||
	sjump BugContestResults_ReturnAfterWinnersPrize
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -448,10 +451,10 @@ BugContestResults_ThirdPlace:
 | 
			
		|||
	iffalse BugContestResults_NoRoomForGoldBerry
 | 
			
		||||
	sjump BugContestResults_ReturnAfterWinnersPrize
 | 
			
		||||
 | 
			
		||||
BugContestResults_NoRoomForSunStone:
 | 
			
		||||
BugContestResults_NoRoomForGligar:
 | 
			
		||||
	farwritetext BugContestPrizeNoRoomText
 | 
			
		||||
	promptbutton
 | 
			
		||||
	setevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE
 | 
			
		||||
	setevent EVENT_CONTEST_OFFICER_HAS_GLIGAR
 | 
			
		||||
	sjump BugContestResults_ReturnAfterWinnersPrize
 | 
			
		||||
 | 
			
		||||
BugContestResults_NoRoomForEverstone:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -357,7 +357,7 @@ MemoryGame_CheckMatch:
 | 
			
		|||
	done
 | 
			
		||||
 | 
			
		||||
.DarnText:
 | 
			
		||||
	text "Darn<...>"
 | 
			
		||||
	text "Darn!"
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
MemoryGame_InitBoard:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -372,6 +372,21 @@ MemoryGameScript:
 | 
			
		|||
	closetext
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
DebugGligarScript:
 | 
			
		||||
	opentext
 | 
			
		||||
	writetext DebugGligarText
 | 
			
		||||
	
 | 
			
		||||
	givepoke GLIGAR, 5
 | 
			
		||||
	special DebugGiveMonSpecialMove
 | 
			
		||||
 | 
			
		||||
	waitbutton
 | 
			
		||||
	closetext
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
DebugGligarText:
 | 
			
		||||
	text "Hi"
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
DebugRoom_MapEvents:
 | 
			
		||||
	db 0, 0 ; filler
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -405,3 +420,4 @@ DebugRoom_MapEvents:
 | 
			
		|||
	object_event 18, 13, SPRITE_SAFARI_ZONE_WORKER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, TrainerTestScript, -1
 | 
			
		||||
	object_event 20, 13, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugDollShopScript, -1
 | 
			
		||||
	object_event 25, 15, SPRITE_WILL, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, MemoryGameScript, -1
 | 
			
		||||
	object_event 27, 16, SPRITE_KAREN, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugGligarScript, -1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -231,7 +231,7 @@ Route36OfficerScriptContest:
 | 
			
		|||
	end
 | 
			
		||||
 | 
			
		||||
Route36Officer_ContestHasConcluded:
 | 
			
		||||
	checkevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE
 | 
			
		||||
	checkevent EVENT_CONTEST_OFFICER_HAS_GLIGAR
 | 
			
		||||
	iftrue .Sunstone
 | 
			
		||||
	checkevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE
 | 
			
		||||
	iftrue .Everstone
 | 
			
		||||
| 
						 | 
				
			
			@ -247,16 +247,19 @@ Route36Officer_ContestHasConcluded:
 | 
			
		|||
.Sunstone:
 | 
			
		||||
	writetext Route36NationalParkGateOfficer1HeresThePrizeText
 | 
			
		||||
	promptbutton
 | 
			
		||||
	verbosegiveitem BLK_AUGURITE
 | 
			
		||||
	iffalse .BagFull
 | 
			
		||||
	clearevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE
 | 
			
		||||
	readvar VAR_PARTYCOUNT
 | 
			
		||||
	ifequal PARTY_LENGTH, .BagFull
 | 
			
		||||
	
 | 
			
		||||
	givepoke GLIGAR, 5
 | 
			
		||||
	special DebugGiveMonSpecialMove ; give it the Stadium 2 moveset
 | 
			
		||||
	clearevent EVENT_CONTEST_OFFICER_HAS_GLIGAR
 | 
			
		||||
	closetext
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
.Everstone:
 | 
			
		||||
	writetext Route36NationalParkGateOfficer1HeresThePrizeText
 | 
			
		||||
	promptbutton
 | 
			
		||||
	verbosegiveitem EVERSTONE
 | 
			
		||||
	verbosegiveitem BLK_AUGURITE
 | 
			
		||||
	iffalse .BagFull
 | 
			
		||||
	clearevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE
 | 
			
		||||
	closetext
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue