2016-05-21 01:10:17 +00:00
|
|
|
CorrectErrorsInPlayerParty: ; unreferenced
|
2015-11-11 21:11:08 +00:00
|
|
|
ld hl, PartyCount
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
cp PARTY_LENGTH + 1
|
2016-05-21 01:10:17 +00:00
|
|
|
jr c, .party_length_okay
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, PARTY_LENGTH
|
|
|
|
ld [hl], a
|
2016-05-21 01:10:17 +00:00
|
|
|
.party_length_okay
|
2015-11-11 21:11:08 +00:00
|
|
|
inc hl
|
|
|
|
|
|
|
|
ld b, a
|
|
|
|
ld c, 0
|
2016-05-21 01:10:17 +00:00
|
|
|
.loop1
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2016-05-21 01:10:17 +00:00
|
|
|
jr z, .invalid_species
|
|
|
|
cp NUM_POKEMON + 1
|
|
|
|
jr z, .invalid_species
|
|
|
|
cp EGG + 1
|
|
|
|
jr c, .next_species
|
2015-11-11 21:11:08 +00:00
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.invalid_species
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [hl], SMEARGLE
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld a, c
|
|
|
|
ld hl, PartyMon1Species
|
|
|
|
call GetPartyLocation
|
|
|
|
ld [hl], SMEARGLE
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.next_species
|
2015-11-11 21:11:08 +00:00
|
|
|
inc hl
|
|
|
|
inc c
|
|
|
|
dec b
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nz, .loop1
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [hl], $ff
|
|
|
|
|
|
|
|
ld hl, PartyMon1
|
|
|
|
ld a, [PartyCount]
|
|
|
|
ld d, a
|
|
|
|
ld e, 0
|
2016-05-21 01:10:17 +00:00
|
|
|
.loop2
|
2015-11-11 21:11:08 +00:00
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2016-05-21 01:10:17 +00:00
|
|
|
jr z, .invalid_species_2
|
2015-11-11 21:11:08 +00:00
|
|
|
cp NUM_POKEMON + 1
|
2016-05-21 01:10:17 +00:00
|
|
|
jr c, .check_level
|
2015-11-11 21:11:08 +00:00
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.invalid_species_2
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [hl], SMEARGLE
|
|
|
|
push de
|
|
|
|
ld d, 0
|
|
|
|
ld hl, PartySpecies
|
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
ld a, SMEARGLE
|
|
|
|
ld [hl], a
|
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.check_level
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [CurSpecies], a
|
|
|
|
call GetBaseData
|
|
|
|
ld hl, MON_LEVEL
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp MIN_LEVEL
|
|
|
|
ld a, MIN_LEVEL
|
2016-05-21 01:10:17 +00:00
|
|
|
jr c, .invalid_level
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [hl]
|
|
|
|
cp MAX_LEVEL
|
2016-05-21 01:10:17 +00:00
|
|
|
jr c, .load_level
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, MAX_LEVEL
|
2016-05-21 01:10:17 +00:00
|
|
|
.invalid_level
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [hl], a
|
2016-05-21 01:10:17 +00:00
|
|
|
.load_level
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [CurPartyLevel], a
|
|
|
|
|
|
|
|
ld hl, MON_MAXHP
|
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-12-21 19:10:16 +00:00
|
|
|
ld hl, MON_STAT_EXP - 1
|
2015-11-11 21:11:08 +00:00
|
|
|
add hl, bc
|
|
|
|
ld b, $1
|
|
|
|
predef CalcPkmnStats
|
|
|
|
pop hl
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
pop de
|
|
|
|
inc e
|
|
|
|
dec d
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nz, .loop2
|
2015-11-11 21:11:08 +00:00
|
|
|
|
|
|
|
ld de, PartyMonNicknames
|
|
|
|
ld a, [PartyCount]
|
|
|
|
ld b, a
|
|
|
|
ld c, 0
|
2016-05-21 01:10:17 +00:00
|
|
|
.loop3
|
2015-11-11 21:11:08 +00:00
|
|
|
push bc
|
2016-05-21 01:10:17 +00:00
|
|
|
call .GetLengthOfStringWith6CharCap
|
2015-11-11 21:11:08 +00:00
|
|
|
push de
|
|
|
|
callba CheckStringForErrors
|
|
|
|
pop hl
|
|
|
|
pop bc
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nc, .valid_nickname
|
2015-11-11 21:11:08 +00:00
|
|
|
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
ld hl, PartySpecies
|
|
|
|
push bc
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp EGG
|
|
|
|
ld hl, .TAMAGO
|
2016-05-21 01:10:17 +00:00
|
|
|
jr z, .got_nickname
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [wd265], a
|
|
|
|
call GetPokemonName
|
|
|
|
ld hl, StringBuffer1
|
2016-05-21 01:10:17 +00:00
|
|
|
.got_nickname
|
2015-11-11 21:11:08 +00:00
|
|
|
pop de
|
|
|
|
ld bc, PKMN_NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.valid_nickname
|
2015-11-11 21:11:08 +00:00
|
|
|
inc c
|
|
|
|
dec b
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nz, .loop3
|
2015-11-11 21:11:08 +00:00
|
|
|
|
|
|
|
ld de, PartyMonOT
|
|
|
|
ld a, [PartyCount]
|
|
|
|
ld b, a
|
|
|
|
ld c, 0
|
2016-05-21 01:10:17 +00:00
|
|
|
.loop4
|
2015-11-11 21:11:08 +00:00
|
|
|
push bc
|
2016-05-21 01:10:17 +00:00
|
|
|
call .GetLengthOfStringWith6CharCap
|
2015-11-11 21:11:08 +00:00
|
|
|
push de
|
|
|
|
callba CheckStringForErrors
|
|
|
|
pop hl
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nc, .valid_ot_name
|
2015-11-11 21:11:08 +00:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, PlayerName
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
2016-05-21 01:10:17 +00:00
|
|
|
.valid_ot_name
|
2015-11-11 21:11:08 +00:00
|
|
|
pop bc
|
|
|
|
inc c
|
|
|
|
dec b
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nz, .loop4
|
2015-11-11 21:11:08 +00:00
|
|
|
|
|
|
|
ld hl, PartyMon1Moves
|
|
|
|
ld a, [PartyCount]
|
|
|
|
ld b, a
|
2016-05-21 01:10:17 +00:00
|
|
|
.loop5
|
2015-11-11 21:11:08 +00:00
|
|
|
push hl
|
|
|
|
ld c, NUM_MOVES
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2016-05-21 01:10:17 +00:00
|
|
|
jr z, .invalid_move
|
2015-11-11 21:11:08 +00:00
|
|
|
cp NUM_ATTACKS + 1
|
2016-05-21 01:10:17 +00:00
|
|
|
jr c, .moves_loop
|
|
|
|
.invalid_move
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [hl], POUND
|
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.moves_loop
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2016-05-21 01:10:17 +00:00
|
|
|
jr z, .fill_invalid_moves
|
2015-11-11 21:11:08 +00:00
|
|
|
cp NUM_ATTACKS + 1
|
2016-05-21 01:10:17 +00:00
|
|
|
jr c, .next_move
|
2015-11-11 21:11:08 +00:00
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.fill_invalid_moves
|
2015-11-11 21:11:08 +00:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nz, .fill_invalid_moves
|
|
|
|
jr .next_pokemon
|
2015-11-11 21:11:08 +00:00
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.next_move
|
2015-11-11 21:11:08 +00:00
|
|
|
inc hl
|
|
|
|
dec c
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nz, .moves_loop
|
2015-11-11 21:11:08 +00:00
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.next_pokemon
|
2015-11-11 21:11:08 +00:00
|
|
|
pop hl
|
|
|
|
push bc
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nz, .loop5
|
2015-11-11 21:11:08 +00:00
|
|
|
ret
|
|
|
|
; 13b6b
|
|
|
|
|
|
|
|
.TAMAGO: ; 13b6b
|
|
|
|
db "タマゴ@@@"
|
|
|
|
; 13b71
|
|
|
|
|
2016-05-21 01:10:17 +00:00
|
|
|
.GetLengthOfStringWith6CharCap: ; 13b71
|
2015-11-11 21:11:08 +00:00
|
|
|
push de
|
|
|
|
ld c, 1
|
|
|
|
ld b, 6
|
2016-05-21 01:10:17 +00:00
|
|
|
.search_loop
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [de]
|
|
|
|
cp "@"
|
|
|
|
jr z, .done
|
|
|
|
inc de
|
|
|
|
inc c
|
|
|
|
dec b
|
2016-05-21 01:10:17 +00:00
|
|
|
jr nz, .search_loop
|
2015-11-11 21:11:08 +00:00
|
|
|
dec c
|
|
|
|
dec de
|
|
|
|
ld a, "@"
|
|
|
|
ld [de], a
|
|
|
|
.done
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
; 13b87
|