2020-06-21 20:27:43 +00:00
|
|
|
CorrectPartyErrors: ; unreferenced
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyCount
|
2017-12-16 01:10:54 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
cp PARTY_LENGTH + 1
|
|
|
|
jr c, .party_length_okay
|
|
|
|
ld a, PARTY_LENGTH
|
|
|
|
ld [hl], a
|
|
|
|
.party_length_okay
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
ld b, a
|
|
|
|
ld c, 0
|
|
|
|
.loop1
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .invalid_species
|
|
|
|
cp NUM_POKEMON + 1
|
|
|
|
jr z, .invalid_species
|
|
|
|
cp EGG + 1
|
|
|
|
jr c, .next_species
|
|
|
|
|
|
|
|
.invalid_species
|
|
|
|
ld [hl], SMEARGLE
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld a, c
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMon1Species
|
2017-12-16 01:10:54 +00:00
|
|
|
call GetPartyLocation
|
|
|
|
ld [hl], SMEARGLE
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
.next_species
|
|
|
|
inc hl
|
|
|
|
inc c
|
|
|
|
dec b
|
|
|
|
jr nz, .loop1
|
|
|
|
ld [hl], $ff
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMon1
|
|
|
|
ld a, [wPartyCount]
|
2017-12-16 01:10:54 +00:00
|
|
|
ld d, a
|
|
|
|
ld e, 0
|
|
|
|
.loop2
|
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .invalid_species_2
|
|
|
|
cp NUM_POKEMON + 1
|
|
|
|
jr c, .check_level
|
|
|
|
|
|
|
|
.invalid_species_2
|
|
|
|
ld [hl], SMEARGLE
|
|
|
|
push de
|
|
|
|
ld d, 0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartySpecies
|
2017-12-16 01:10:54 +00:00
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
ld a, SMEARGLE
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
.check_level
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurSpecies], a
|
2017-12-16 01:10:54 +00:00
|
|
|
call GetBaseData
|
|
|
|
ld hl, MON_LEVEL
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp MIN_LEVEL
|
|
|
|
ld a, MIN_LEVEL
|
|
|
|
jr c, .invalid_level
|
|
|
|
ld a, [hl]
|
|
|
|
cp MAX_LEVEL
|
|
|
|
jr c, .load_level
|
|
|
|
ld a, MAX_LEVEL
|
|
|
|
.invalid_level
|
|
|
|
ld [hl], a
|
|
|
|
.load_level
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartyLevel], a
|
2017-12-16 01:10:54 +00:00
|
|
|
|
|
|
|
ld hl, MON_MAXHP
|
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, MON_STAT_EXP - 1
|
|
|
|
add hl, bc
|
2018-02-22 17:12:43 +00:00
|
|
|
ld b, TRUE
|
2018-02-22 16:13:29 +00:00
|
|
|
predef CalcMonStats
|
2017-12-16 01:10:54 +00:00
|
|
|
pop hl
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
pop de
|
|
|
|
inc e
|
|
|
|
dec d
|
|
|
|
jr nz, .loop2
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wPartyMonNicknames
|
|
|
|
ld a, [wPartyCount]
|
2017-12-16 01:10:54 +00:00
|
|
|
ld b, a
|
|
|
|
ld c, 0
|
|
|
|
.loop3
|
|
|
|
push bc
|
|
|
|
call .GetLengthOfStringWith6CharCap
|
|
|
|
push de
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CheckStringForErrors
|
2017-12-16 01:10:54 +00:00
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
jr nc, .valid_nickname
|
|
|
|
|
|
|
|
push bc
|
|
|
|
push hl
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartySpecies
|
2017-12-16 01:10:54 +00:00
|
|
|
push bc
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp EGG
|
|
|
|
ld hl, .TAMAGO
|
|
|
|
jr z, .got_nickname
|
2018-07-28 23:27:34 +00:00
|
|
|
ld [wNamedObjectIndexBuffer], a
|
2017-12-16 01:10:54 +00:00
|
|
|
call GetPokemonName
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer1
|
2017-12-16 01:10:54 +00:00
|
|
|
.got_nickname
|
|
|
|
pop de
|
2018-01-20 17:25:55 +00:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2017-12-16 01:10:54 +00:00
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
|
|
|
|
.valid_nickname
|
|
|
|
inc c
|
|
|
|
dec b
|
|
|
|
jr nz, .loop3
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wPartyMonOT
|
|
|
|
ld a, [wPartyCount]
|
2017-12-16 01:10:54 +00:00
|
|
|
ld b, a
|
|
|
|
ld c, 0
|
|
|
|
.loop4
|
|
|
|
push bc
|
|
|
|
call .GetLengthOfStringWith6CharCap
|
|
|
|
push de
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CheckStringForErrors
|
2017-12-16 01:10:54 +00:00
|
|
|
pop hl
|
|
|
|
jr nc, .valid_ot_name
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPlayerName
|
2017-12-16 01:10:54 +00:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
.valid_ot_name
|
|
|
|
pop bc
|
|
|
|
inc c
|
|
|
|
dec b
|
|
|
|
jr nz, .loop4
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMon1Moves
|
|
|
|
ld a, [wPartyCount]
|
2017-12-16 01:10:54 +00:00
|
|
|
ld b, a
|
|
|
|
.loop5
|
|
|
|
push hl
|
|
|
|
ld c, NUM_MOVES
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .invalid_move
|
|
|
|
cp NUM_ATTACKS + 1
|
|
|
|
jr c, .moves_loop
|
|
|
|
.invalid_move
|
|
|
|
ld [hl], POUND
|
|
|
|
|
|
|
|
.moves_loop
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .fill_invalid_moves
|
|
|
|
cp NUM_ATTACKS + 1
|
|
|
|
jr c, .next_move
|
|
|
|
|
|
|
|
.fill_invalid_moves
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .fill_invalid_moves
|
|
|
|
jr .next_pokemon
|
|
|
|
|
|
|
|
.next_move
|
|
|
|
inc hl
|
|
|
|
dec c
|
|
|
|
jr nz, .moves_loop
|
|
|
|
|
|
|
|
.next_pokemon
|
|
|
|
pop hl
|
|
|
|
push bc
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
|
|
|
jr nz, .loop5
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.TAMAGO:
|
2017-12-16 01:10:54 +00:00
|
|
|
db "タマゴ@@@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.GetLengthOfStringWith6CharCap:
|
2017-12-16 01:10:54 +00:00
|
|
|
push de
|
|
|
|
ld c, 1
|
|
|
|
ld b, NAME_LENGTH_JAPANESE
|
|
|
|
.search_loop
|
|
|
|
ld a, [de]
|
|
|
|
cp "@"
|
|
|
|
jr z, .done
|
|
|
|
inc de
|
|
|
|
inc c
|
|
|
|
dec b
|
|
|
|
jr nz, .search_loop
|
|
|
|
dec c
|
|
|
|
dec de
|
|
|
|
ld a, "@"
|
|
|
|
ld [de], a
|
|
|
|
.done
|
|
|
|
pop de
|
|
|
|
ret
|