-
Notifications
You must be signed in to change notification settings - Fork 852
/
Copy pathmove_mon.asm
1822 lines (1671 loc) · 27.3 KB
/
move_mon.asm
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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
DEF RANDY_OT_ID EQU 01001
TryAddMonToParty:
; Check if to copy wild mon or generate a new one
; Whose is it?
ld de, wPartyCount
ld a, [wMonType]
and $f
jr z, .getpartylocation ; PARTYMON
ld de, wOTPartyCount
.getpartylocation
; Do we have room for it?
ld a, [de]
inc a
cp PARTY_LENGTH + 1
ret nc
; Increase the party count
ld [de], a
ld a, [de] ; Why are we doing this?
ldh [hMoveMon], a ; HRAM backup
add e
ld e, a
jr nc, .loadspecies
inc d
.loadspecies
; Load the species of the Pokemon into the party list.
; The terminator is usually here, but it'll be back.
ld a, [wCurPartySpecies]
ld [de], a
; Load the terminator into the next slot.
inc de
ld a, -1
ld [de], a
; Now let's load the OT name.
ld hl, wPartyMonOTs
ld a, [wMonType]
and $f
jr z, .loadOTname
ld hl, wOTPartyMonOTs
.loadOTname
ldh a, [hMoveMon] ; Restore index from backup
dec a
call SkipNames
ld d, h
ld e, l
ld hl, wPlayerName
ld bc, NAME_LENGTH
call CopyBytes
; Only initialize the nickname for party mon
ld a, [wMonType]
and a
jr nz, .skipnickname
ld a, [wCurPartySpecies]
ld [wNamedObjectIndex], a
call GetPokemonName
ld hl, wPartyMonNicknames
ldh a, [hMoveMon]
dec a
call SkipNames
ld d, h
ld e, l
ld hl, wStringBuffer1
ld bc, MON_NAME_LENGTH
call CopyBytes
.skipnickname
ld hl, wPartyMon1Species
ld a, [wMonType]
and $f
jr z, .initializeStats
ld hl, wOTPartyMon1Species
.initializeStats
ldh a, [hMoveMon]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
GeneratePartyMonStats:
; wBattleMode specifies whether it's a wild mon or not.
; wMonType specifies whether it's an opposing mon or not.
; wCurPartySpecies/wCurPartyLevel specify the species and level.
; hl points to the wPartyMon struct to fill.
ld e, l
ld d, h
push hl
; Initialize the species
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
ld a, [wBaseDexNo]
ld [de], a
inc de
; Copy the item if it's a wild mon
ld a, [wBattleMode]
and a
ld a, $0
jr z, .skipitem
ld a, [wEnemyMonItem]
.skipitem
ld [de], a
inc de
; Copy the moves if it's a wild mon
push de
ld h, d
ld l, e
ld a, [wBattleMode]
and a
jr z, .randomlygeneratemoves
ld a, [wMonType]
and a
jr nz, .randomlygeneratemoves
ld de, wEnemyMonMoves
rept NUM_MOVES - 1
ld a, [de]
inc de
ld [hli], a
endr
ld a, [de]
ld [hl], a
jr .next
.randomlygeneratemoves
xor a
rept NUM_MOVES - 1
ld [hli], a
endr
ld [hl], a
ld [wSkipMovesBeforeLevelUp], a
predef FillMoves
.next
pop de
rept NUM_MOVES
inc de
endr
; Initialize ID.
ld a, [wPlayerID]
ld [de], a
inc de
ld a, [wPlayerID + 1]
ld [de], a
inc de
; Initialize Exp.
push de
ld a, [wCurPartyLevel]
ld d, a
callfar CalcExpAtLevel
pop de
ldh a, [hProduct + 1]
ld [de], a
inc de
ldh a, [hProduct + 2]
ld [de], a
inc de
ldh a, [hProduct + 3]
ld [de], a
inc de
; Initialize stat experience.
xor a
ld b, MON_DVS - MON_STAT_EXP
.loop
ld [de], a
inc de
dec b
jr nz, .loop
pop hl
push hl
ld a, [wMonType]
and $f
jr z, .registerpokedex
push hl
farcall GetTrainerDVs
pop hl
jr .initializeDVs
.registerpokedex
ld a, [wCurPartySpecies]
ld [wTempSpecies], a
dec a
push de
call CheckCaughtMon
ld a, [wTempSpecies]
dec a
call SetSeenAndCaughtMon
pop de
pop hl
push hl
ld a, [wBattleMode]
and a
jr nz, .copywildmonDVs
call Random
ld b, a
call Random
ld c, a
.initializeDVs
ld a, b
ld [de], a
inc de
ld a, c
ld [de], a
inc de
; Initialize PP.
push hl
push de
inc hl
inc hl
call FillPP
pop de
pop hl
rept NUM_MOVES
inc de
endr
; Initialize happiness.
ld a, BASE_HAPPINESS
ld [de], a
inc de
xor a
; PokerusStatus
ld [de], a
inc de
; CaughtData/CaughtTime/CaughtLevel
ld [de], a
inc de
; CaughtGender/CaughtLocation
ld [de], a
inc de
; Initialize level.
ld a, [wCurPartyLevel]
ld [de], a
inc de
xor a
; Status
ld [de], a
inc de
; Unused
ld [de], a
inc de
; Initialize HP.
ld bc, MON_STAT_EXP - 1
add hl, bc
ld a, 1
ld c, a
ld b, FALSE
call CalcMonStatC
ldh a, [hProduct + 2]
ld [de], a
inc de
ldh a, [hProduct + 3]
ld [de], a
inc de
jr .initstats
.copywildmonDVs
ld a, [wEnemyMonDVs]
ld [de], a
inc de
ld a, [wEnemyMonDVs + 1]
ld [de], a
inc de
push hl
ld hl, wEnemyMonPP
ld b, NUM_MOVES
.wildmonpploop
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .wildmonpploop
pop hl
; Initialize happiness.
ld a, BASE_HAPPINESS
ld [de], a
inc de
xor a
; PokerusStatus
ld [de], a
inc de
; CaughtData/CaughtTime/CaughtLevel
ld [de], a
inc de
; CaughtGender/CaughtLocation
ld [de], a
inc de
; Initialize level.
ld a, [wCurPartyLevel]
ld [de], a
inc de
ld hl, wEnemyMonStatus
; Copy wEnemyMonStatus
ld a, [hli]
ld [de], a
inc de
; Copy EnemyMonUnused
ld a, [hli]
ld [de], a
inc de
; Copy wEnemyMonHP
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
.initstats
ld a, [wBattleMode]
dec a
jr nz, .generatestats
ld hl, wEnemyMonMaxHP
ld bc, PARTYMON_STRUCT_LENGTH - MON_MAXHP
call CopyBytes
pop hl
jr .registerunowndex
.generatestats
pop hl
ld bc, MON_STAT_EXP - 1
add hl, bc
ld b, FALSE
call CalcMonStats
.registerunowndex
ld a, [wMonType]
and $f
jr nz, .done
ld a, [wCurPartySpecies]
cp UNOWN
jr nz, .done
ld hl, wPartyMon1DVs
ld a, [wPartyCount]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
predef GetUnownLetter
callfar UpdateUnownDex
.done
scf ; When this function returns, the carry flag indicates success vs failure.
ret
FillPP:
push bc
ld b, NUM_MOVES
.loop
ld a, [hli]
and a
jr z, .next
dec a
push hl
push de
push bc
ld hl, Moves
ld bc, MOVE_LENGTH
call AddNTimes
ld de, wStringBuffer1
ld a, BANK(Moves)
call FarCopyBytes
pop bc
pop de
pop hl
ld a, [wStringBuffer1 + MOVE_PP]
.next
ld [de], a
inc de
dec b
jr nz, .loop
pop bc
ret
AddTempmonToParty:
ld hl, wPartyCount
ld a, [hl]
cp PARTY_LENGTH
scf
ret z
inc a
ld [hl], a
ld c, a
ld b, 0
add hl, bc
ld a, [wCurPartySpecies]
ld [hli], a
ld [hl], $ff
ld hl, wPartyMon1Species
ld a, [wPartyCount]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld e, l
ld d, h
ld hl, wTempMonSpecies
call CopyBytes
ld hl, wPartyMonOTs
ld a, [wPartyCount]
dec a
call SkipNames
ld d, h
ld e, l
ld hl, wOTPartyMonOTs
ld a, [wCurPartyMon]
call SkipNames
ld bc, NAME_LENGTH
call CopyBytes
ld hl, wPartyMonNicknames
ld a, [wPartyCount]
dec a
call SkipNames
ld d, h
ld e, l
ld hl, wOTPartyMonNicknames
ld a, [wCurPartyMon]
call SkipNames
ld bc, MON_NAME_LENGTH
call CopyBytes
ld a, [wCurPartySpecies]
ld [wNamedObjectIndex], a
cp EGG
jr z, .egg
dec a
call SetSeenAndCaughtMon
ld hl, wPartyMon1Happiness
ld a, [wPartyCount]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld [hl], BASE_HAPPINESS
.egg
ld a, [wCurPartySpecies]
cp UNOWN
jr nz, .done
ld hl, wPartyMon1DVs
ld a, [wPartyCount]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
predef GetUnownLetter
callfar UpdateUnownDex
ld a, [wFirstUnownSeen]
and a
jr nz, .done
ld a, [wUnownLetter]
ld [wFirstUnownSeen], a
.done
and a
ret
SendGetMonIntoFromBox:
; Sents/Gets mon into/from Box depending on Parameter
; wPokemonWithdrawDepositParameter == 0: get mon into Party
; wPokemonWithdrawDepositParameter == 1: sent mon into Box
; wPokemonWithdrawDepositParameter == 2: get mon from DayCare
; wPokemonWithdrawDepositParameter == 3: put mon into DayCare
ld a, BANK(sBoxCount)
call OpenSRAM
ld a, [wPokemonWithdrawDepositParameter]
and a
jr z, .check_IfPartyIsFull
cp DAY_CARE_WITHDRAW
jr z, .check_IfPartyIsFull
cp DAY_CARE_DEPOSIT
ld hl, wBreedMon1Species
jr z, .breedmon
; we want to sent a mon into the Box
; so check if there's enough space
ld hl, sBoxCount
ld a, [hl]
cp MONS_PER_BOX
jr nz, .there_is_room
jp CloseSRAM_And_SetCarryFlag
.check_IfPartyIsFull
ld hl, wPartyCount
ld a, [hl]
cp PARTY_LENGTH
jp z, CloseSRAM_And_SetCarryFlag
.there_is_room
inc a
ld [hl], a
ld c, a
ld b, 0
add hl, bc
ld a, [wPokemonWithdrawDepositParameter]
cp DAY_CARE_WITHDRAW
ld a, [wBreedMon1Species]
jr z, .okay1
ld a, [wCurPartySpecies]
.okay1
ld [hli], a
ld [hl], $ff
ld a, [wPokemonWithdrawDepositParameter]
dec a
ld hl, wPartyMon1Species
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [wPartyCount]
jr nz, .okay2
ld hl, sBoxMon1Species
ld bc, BOXMON_STRUCT_LENGTH
ld a, [sBoxCount]
.okay2
dec a ; wPartyCount - 1
call AddNTimes
.breedmon
push hl
ld e, l
ld d, h
ld a, [wPokemonWithdrawDepositParameter]
and a
ld hl, sBoxMon1Species
ld bc, BOXMON_STRUCT_LENGTH
jr z, .okay3
cp DAY_CARE_WITHDRAW
ld hl, wBreedMon1Species
jr z, .okay4
ld hl, wPartyMon1Species
ld bc, PARTYMON_STRUCT_LENGTH
.okay3
ld a, [wCurPartyMon]
call AddNTimes
.okay4
ld bc, BOXMON_STRUCT_LENGTH
call CopyBytes
ld a, [wPokemonWithdrawDepositParameter]
cp DAY_CARE_DEPOSIT
ld de, wBreedMon1OT
jr z, .okay5
dec a
ld hl, wPartyMonOTs
ld a, [wPartyCount]
jr nz, .okay6
ld hl, sBoxMonOTs
ld a, [sBoxCount]
.okay6
dec a
call SkipNames
ld d, h
ld e, l
.okay5
ld hl, sBoxMonOTs
ld a, [wPokemonWithdrawDepositParameter]
and a
jr z, .okay7
ld hl, wBreedMon1OT
cp DAY_CARE_WITHDRAW
jr z, .okay8
ld hl, wPartyMonOTs
.okay7
ld a, [wCurPartyMon]
call SkipNames
.okay8
ld bc, NAME_LENGTH
call CopyBytes
ld a, [wPokemonWithdrawDepositParameter]
cp DAY_CARE_DEPOSIT
ld de, wBreedMon1Nickname
jr z, .okay9
dec a
ld hl, wPartyMonNicknames
ld a, [wPartyCount]
jr nz, .okay10
ld hl, sBoxMonNicknames
ld a, [sBoxCount]
.okay10
dec a
call SkipNames
ld d, h
ld e, l
.okay9
ld hl, sBoxMonNicknames
ld a, [wPokemonWithdrawDepositParameter]
and a
jr z, .okay11
ld hl, wBreedMon1Nickname
cp DAY_CARE_WITHDRAW
jr z, .okay12
ld hl, wPartyMonNicknames
.okay11
ld a, [wCurPartyMon]
call SkipNames
.okay12
ld bc, MON_NAME_LENGTH
call CopyBytes
pop hl
ld a, [wPokemonWithdrawDepositParameter]
cp PC_DEPOSIT
jr z, .took_out_of_box
cp DAY_CARE_DEPOSIT
jp z, .CloseSRAM_And_ClearCarryFlag
push hl
srl a
add $2
ld [wMonType], a
predef CopyMonToTempMon
callfar CalcLevel
ld a, d
ld [wCurPartyLevel], a
pop hl
ld b, h
ld c, l
ld hl, MON_LEVEL
add hl, bc
ld [hl], a
ld hl, MON_MAXHP
add hl, bc
ld d, h
ld e, l
ld hl, MON_STAT_EXP - 1
add hl, bc
push bc
ld b, TRUE
call CalcMonStats
pop bc
ld a, [wPokemonWithdrawDepositParameter]
and a
jr nz, .CloseSRAM_And_ClearCarryFlag
ld hl, MON_STATUS
add hl, bc
xor a
ld [hl], a
ld hl, MON_HP
add hl, bc
ld d, h
ld e, l
ld a, [wCurPartySpecies]
cp EGG
jr z, .egg
inc hl
inc hl
ld a, [hli]
ld [de], a
ld a, [hl]
inc de
ld [de], a
jr .CloseSRAM_And_ClearCarryFlag
.egg
xor a
ld [de], a
inc de
ld [de], a
jr .CloseSRAM_And_ClearCarryFlag
.took_out_of_box
ld a, [sBoxCount]
dec a
ld b, a
call RestorePPOfDepositedPokemon
.CloseSRAM_And_ClearCarryFlag:
call CloseSRAM
and a
ret
CloseSRAM_And_SetCarryFlag:
call CloseSRAM
scf
ret
RestorePPOfDepositedPokemon:
ld a, b
ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH
call AddNTimes
ld b, h
ld c, l
ld hl, MON_PP
add hl, bc
push hl
push bc
ld de, wTempMonPP
ld bc, NUM_MOVES
call CopyBytes
pop bc
ld hl, MON_MOVES
add hl, bc
push hl
ld de, wTempMonMoves
ld bc, NUM_MOVES
call CopyBytes
pop hl
pop de
ld a, [wMenuCursorY]
push af
ld a, [wMonType]
push af
ld b, 0
.loop
ld a, [hli]
and a
jr z, .done
ld [wTempMonMoves], a
ld a, BOXMON
ld [wMonType], a
ld a, b
ld [wMenuCursorY], a
push bc
push hl
push de
farcall GetMaxPPOfMove
pop de
pop hl
ld a, [wTempPP]
ld b, a
ld a, [de]
and %11000000
add b
ld [de], a
pop bc
inc de
inc b
ld a, b
cp NUM_MOVES
jr c, .loop
.done
pop af
ld [wMonType], a
pop af
ld [wMenuCursorY], a
ret
RetrieveMonFromDayCareMan:
ld a, [wBreedMon1Species]
ld [wCurPartySpecies], a
ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
call GetBreedMon1LevelGrowth
ld a, b
ld [wPrevPartyLevel], a
ld a, e
ld [wCurPartyLevel], a
xor a
ld [wPokemonWithdrawDepositParameter], a
jp RetrieveBreedmon
RetrieveMonFromDayCareLady:
ld a, [wBreedMon2Species]
ld [wCurPartySpecies], a
ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
call GetBreedMon2LevelGrowth
ld a, b
ld [wPrevPartyLevel], a
ld a, e
ld [wCurPartyLevel], a
ld a, PC_DEPOSIT
ld [wPokemonWithdrawDepositParameter], a
jp RetrieveBreedmon ; pointless
RetrieveBreedmon:
ld hl, wPartyCount
ld a, [hl]
cp PARTY_LENGTH
jr nz, .room_in_party
scf
ret
.room_in_party
inc a
ld [hl], a
ld c, a
ld b, 0
add hl, bc
ld a, [wPokemonWithdrawDepositParameter]
and a
ld a, [wBreedMon1Species]
ld de, wBreedMon1Nickname
jr z, .okay
ld a, [wBreedMon2Species]
ld de, wBreedMon2Nickname
.okay
ld [hli], a
ld [wCurSpecies], a
ld a, $ff
ld [hl], a
ld hl, wPartyMonNicknames
ld a, [wPartyCount]
dec a
call SkipNames
push hl
ld h, d
ld l, e
pop de
call CopyBytes
push hl
ld hl, wPartyMonOTs
ld a, [wPartyCount]
dec a
call SkipNames
ld d, h
ld e, l
pop hl
call CopyBytes
push hl
call GetLastPartyMon
pop hl
ld bc, BOXMON_STRUCT_LENGTH
call CopyBytes
call GetBaseData
call GetLastPartyMon
ld b, d
ld c, e
ld hl, MON_LEVEL
add hl, bc
ld a, [wCurPartyLevel]
ld [hl], a
ld hl, MON_MAXHP
add hl, bc
ld d, h
ld e, l
ld hl, MON_EXP + 2
add hl, bc
push bc
ld b, TRUE
call CalcMonStats
ld hl, wPartyMon1Moves
ld a, [wPartyCount]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld d, h
ld e, l
ld a, TRUE
ld [wSkipMovesBeforeLevelUp], a
predef FillMoves
; BUG: Pokémon deposited in the Day-Care might lose experience (see docs/bugs_and_glitches.md)
ld a, [wPartyCount]
dec a
ld [wCurPartyMon], a
farcall HealPartyMon
ld a, [wCurPartyLevel]
ld d, a
callfar CalcExpAtLevel
pop bc
ld hl, MON_EXP
add hl, bc
ldh a, [hMultiplicand]
ld [hli], a
ldh a, [hMultiplicand + 1]
ld [hli], a
ldh a, [hMultiplicand + 2]
ld [hl], a
and a
ret
GetLastPartyMon:
ld a, [wPartyCount]
dec a
ld hl, wPartyMon1Species
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld d, h
ld e, l
ret
DepositMonWithDayCareMan:
ld de, wBreedMon1Nickname
call DepositBreedmon
xor a ; REMOVE_PARTY
ld [wPokemonWithdrawDepositParameter], a
jp RemoveMonFromPartyOrBox
DepositMonWithDayCareLady:
ld de, wBreedMon2Nickname
call DepositBreedmon
xor a ; REMOVE_PARTY
ld [wPokemonWithdrawDepositParameter], a
jp RemoveMonFromPartyOrBox
DepositBreedmon:
ld a, [wCurPartyMon]
ld hl, wPartyMonNicknames
call SkipNames
call CopyBytes
ld a, [wCurPartyMon]
ld hl, wPartyMonOTs
call SkipNames
call CopyBytes
ld a, [wCurPartyMon]
ld hl, wPartyMon1Species
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld bc, BOXMON_STRUCT_LENGTH
jp CopyBytes
SendMonIntoBox:
; Sends the mon into one of Bills Boxes
; the data comes mainly from 'wEnemyMon:'
ld a, BANK(sBoxCount)
call OpenSRAM
ld de, sBoxCount
ld a, [de]
cp MONS_PER_BOX
jp nc, .full
inc a
ld [de], a
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
ld c, a
.loop
inc de
ld a, [de]
ld b, a
ld a, c
ld c, b
ld [de], a
inc a
jr nz, .loop
call GetBaseData
call ShiftBoxMon
ld hl, wPlayerName
ld de, sBoxMonOTs
ld bc, NAME_LENGTH
call CopyBytes
ld a, [wCurPartySpecies]
ld [wNamedObjectIndex], a
call GetPokemonName
ld de, sBoxMonNicknames
ld hl, wStringBuffer1
ld bc, MON_NAME_LENGTH
call CopyBytes
ld hl, wEnemyMon
ld de, sBoxMon1
ld bc, 1 + 1 + NUM_MOVES ; species + item + moves
call CopyBytes
ld hl, wPlayerID
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
push de
ld a, [wCurPartyLevel]
ld d, a
callfar CalcExpAtLevel
pop de