summaryrefslogtreecommitdiff
path: root/event/poke_seer.asm
blob: f49e8ce07f2be50251a0d0754802c2a1b8181516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
SEER_INTRO      EQU 0
SEER_CANT_TELL  EQU 1
SEER_MET_AT     EQU 2
SEER_TIME_LEVEL EQU 3
SEER_TRADED     EQU 4
SEER_CANCEL     EQU 5
SEER_EGG        EQU 6
SEER_LEVEL_ONLY EQU 7


SpecialPokeSeer: ; 4f0bc
	ld a, SEER_INTRO
	call PrintSeerText
	call Functiona36

	ld b, $6
	callba Function50000
	jr c, .cancel

	ld a, [CurPartySpecies]
	cp EGG
	jr z, .egg

	call IsAPokemon
	jr c, .no_mon

	call ReadCaughtData
	call SeerAction
	ret

.cancel
	ld a, SEER_CANCEL
	call PrintSeerText
	ret

.no_mon
	ret

.egg
	ld a, SEER_EGG
	call PrintSeerText
	ret
; 4f0ee


SeerAction: ; 4f0ee
	ld a, [$d002]
	ld hl, SeerActions
	rst JumpTable
	ret
; 4f0f6

SeerActions: ; 4f0f6
	dw SeerAction0
	dw SeerAction1
	dw SeerAction2
	dw SeerAction3
	dw SeerAction4
; 4f100

SeerAction0: ; 4f100
	ld a, SEER_MET_AT
	call PrintSeerText
	ld a, SEER_TIME_LEVEL
	call PrintSeerText
	call SeerAdvice
	ret
; 4f10e

SeerAction1: ; 4f10e
	call GetCaughtOT
	ld a, SEER_TRADED
	call PrintSeerText
	ld a, SEER_TIME_LEVEL
	call PrintSeerText
	call SeerAdvice
	ret
; 4f11f

SeerAction2: ; 4f11f
	ld a, SEER_CANT_TELL
	call PrintSeerText
	ret
; 4f125

SeerAction3: ; 4f125
	ld a, SEER_CANT_TELL
	call PrintSeerText
	ret
; 4f12b

SeerAction4: ; 4f12b
	ld a, SEER_LEVEL_ONLY
	call PrintSeerText
	call SeerAdvice
	ret
; 4f134

ReadCaughtData: ; 4f134
	ld a, PartyMon1CaughtData - PartyMon1
	call GetPartyParamLocation
	ld a, [hli]
	ld [$d03b], a
	ld a, [hld]
	ld [$d03c], a
	or [hl]
	jr z, .asm_4f170

	ld a, 1
	ld [$d002], a

	ld a, PartyMon1ID - PartyMon1
	call GetPartyParamLocation
	ld a, [PlayerID]
	cp [hl]
	jr nz, .asm_4f15f

	inc hl
	ld a, [$d47c]
	jr nz, .asm_4f15f

	ld a, 0
	ld [$d002], a

.asm_4f15f
	call GetCaughtLevel
	call GetCaughtOT
	call GetCaughtName
	call GetCaughtTime
	call GetCaughtLocation
	and a
	ret

.asm_4f170
	ld a, 2
	ld [$d002], a
	ret
; 4f176

GetCaughtName: ; 4f176
	ld a, [CurPartyMon]
	ld hl, PartyMon1Nickname
	ld bc, PKMN_NAME_LENGTH
	call AddNTimes
	ld de, $d003
	ld bc, PKMN_NAME_LENGTH
	call CopyBytes
	ret
; 4f18c

GetCaughtLevel: ; 4f18c
	ld a, "@"
	ld hl, $d036
	ld bc, 4
	call ByteFill

	; caught level
	ld a, [$d03b]
	and $3f
	jr z, .unknown
	cp 1 ; hatched from an egg
	jr nz, .print
	ld a, 5 ; egg hatch level

.print
	ld [$d03a], a
	ld hl, $d036
	ld de, $d03a
	ld bc, $4103
	call PrintNum
	ret

.unknown
	ld de, $d036
	ld hl, .unknown_level
	ld bc, 4
	call CopyBytes
	ret
; 4f1c1

.unknown_level ; 4f1c1
	db "???@"
; 4f1c5

GetCaughtTime: ; 4f1c5
	ld a, [$d03b]
	and $c0
	jr z, .none

	rlca
	rlca
	dec a
	ld hl, .times
	call GetNthString
	ld d, h
	ld e, l
	ld hl, $d01f
	call CopyName2
	and a
	ret

.none
	ld de, $d01f
	call UnknownCaughtData
	ret
; 4f1e6

.times ; 4f1e6
	db "Morning@"
	db "Day@"
	db "Night@"
; 4f1f8

UnknownCaughtData: ; 4f1f8
	ld hl, .unknown
	ld bc, $000b
	call CopyBytes
	ret
; 4f202

.unknown ; 4f202
	db "Unknown@"
; 4f20a

GetCaughtLocation: ; 4f20a
	ld a, [$d03c]
	and $7f
	jr z, .asm_4f22e
	cp $7f
	jr z, .asm_4f234
	cp $7e
	jr z, .asm_4f23b
	ld e, a
	callba GetLandmarkName
	ld hl, StringBuffer1
	ld de, $d00e
	ld bc, $0011
	call CopyBytes
	and a
	ret

.asm_4f22e
	ld de, $d00e
	jp UnknownCaughtData

.asm_4f234
	ld a, $4
	ld [$d002], a
	scf
	ret

.asm_4f23b
	ld a, $3
	ld [$d002], a
	scf
	ret
; 4f242

GetCaughtOT: ; 4f242
	ld a, [CurPartyMon]
	ld hl, PartyMon1OT
	ld bc, $000b
	call AddNTimes
	ld de, $d02a
	ld bc, $000b
	call CopyBytes
	ld hl, .male
	ld a, [$d03c]
	bit 7, a
	jr z, .asm_4f264
	ld hl, .female

.asm_4f264
	ld de, $d035
	ld a, "@"
	ld [de], a
	ret
; 4f26b

.male ; 4f26b
	db "@"
.female ; 4f26c
	db "@"
; 4f26d

PrintSeerText: ; 4f26d
	ld e, a
	ld d, 0
	ld hl, SeerTexts
	add hl, de
	add hl, de
	ld a, [hli]
	ld h, [hl]
	ld l, a
	call PrintText
	ret
; 4f27c

SeerTexts: ; 4f27c
	dw SeerIntroText
	dw SeerCantTellText
	dw SeerMetAtText
	dw SeerTimeLevelText
	dw SeerTradedText
	dw SeerCancelText
	dw SeerEggText
	dw SeerLevelOnlyText
; 4f28c

SeerIntroText: ; 0x4f28c
	; I see all. I know all… Certainly, I know of your #MON!
	text_jump UnknownText_0x1c475f
	db "@"
; 0x4f291

SeerCantTellText: ; 0x4f291
	; Whaaaat? I can't tell a thing! How could I not know of this?
	text_jump UnknownText_0x1c4797
	db "@"
; 0x4f296

SeerMetAtText: ; 0x4f296
	; Hm… I see you met @  here: @ !
	text_jump UnknownText_0x1c47d4
	db "@"
; 0x4f29b

SeerTimeLevelText: ; 0x4f29b
	; The time was @ ! Its level was @ ! Am I good or what?
	text_jump UnknownText_0x1c47fa
	db "@"
; 0x4f2a0

SeerTradedText: ; 0x4f2a0
	; Hm… @ came from @ in a trade? @ was where @ met @ !
	text_jump UnknownText_0x1c4837
	db "@"
; 0x4f2a5

SeerLevelOnlyText: ; 0x4f2a5
	; What!? Incredible! I don't understand how, but it is incredible! You are special. I can't tell where you met it, but it was at level @ . Am I good or what?
	text_jump UnknownText_0x1c487f
	db "@"
; 0x4f2aa

SeerEggText: ; 0x4f2aa
	; Hey! That's an EGG! You can't say that you've met it yet…
	text_jump UnknownText_0x1c491d
	db "@"
; 0x4f2af

SeerCancelText: ; 0x4f2af
	; Fufufu! I saw that you'd do nothing!
	text_jump UnknownText_0x1c4955
	db "@"
; 0x4f2b4


SeerAdvice: ; 4f2b4
	ld a, PartyMon1Level - PartyMon1
	call GetPartyParamLocation
	ld a, [$d03a]
	ld c, a
	ld a, [hl]
	sub c
	ld c, a

	ld hl, SeerAdviceTexts
	ld de, 3
.next
	cp [hl]
	jr c, .print
	jr z, .print
	add hl, de
	jr .next

.print
	inc hl
	ld a, [hli]
	ld h, [hl]
	ld l, a
	call PrintText
	ret
; 4f2d6

SeerAdviceTexts: ; 4f2d6
; level, text
	dbw 9,   SeerAdvice1
	dbw 29,  SeerAdvice2
	dbw 59,  SeerAdvice3
	dbw 89,  SeerAdvice4
	dbw 100, SeerAdvice5
	dbw 255, SeerAdvice1
; 4f2e8

SeerAdvice1: ; 0x4f2e8
	; Incidentally… It would be wise to raise your #MON with a little more care.
	text_jump UnknownText_0x1c497a
	db "@"
; 0x4f2ed

SeerAdvice2: ; 0x4f2ed
	; Incidentally… It seems to have grown a little. @  seems to be becoming more confident.
	text_jump UnknownText_0x1c49c6
	db "@"
; 0x4f2f2

SeerAdvice3: ; 0x4f2f2
	; Incidentally… @  has grown. It's gained much strength.
	text_jump UnknownText_0x1c4a21
	db "@"
; 0x4f2f7

SeerAdvice4: ; 0x4f2f7
	; Incidentally… It certainly has grown mighty! This @ must have come through numerous #MON battles. It looks brimming with confidence.
	text_jump UnknownText_0x1c4a5b
	db "@"
; 0x4f2fc

SeerAdvice5: ; 0x4f2fc
	; Incidentally… I'm impressed by your dedication. It's been a long time since I've seen a #MON as mighty as this @ . I'm sure that seeing @ in battle would excite anyone.
	text_jump UnknownText_0x1c4ae5
	db "@"
; 0x4f301


GetCaughtGender: ; 4f301
	ld hl, PartyMon1CaughtGender - PartyMon1
	add hl, bc

	ld a, [hl]
	and $7f
	jr z, .genderless
	cp $7f
	jr z, .genderless

	ld a, [hl]
	and $80
	jr nz, .male
	ld c, 1
	ret

.male
	ld c, 2
	ret

.genderless
	ld c, 0
	ret
; 4f31c