2018-06-24 07:09:41 -07:00
|
|
|
CopyMonToTempMon:
|
2018-02-22 08:13:29 -08:00
|
|
|
; gets the BaseData of a mon
|
2018-02-12 14:58:19 -08:00
|
|
|
; and copies the party_struct to wTempMon
|
2017-12-15 18:22:26 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2017-12-15 18:22:26 -08:00
|
|
|
ld e, a
|
2018-02-22 08:13:29 -08:00
|
|
|
call GetMonSpecies
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
|
|
|
ld [wCurSpecies], a
|
2017-12-15 18:22:26 -08:00
|
|
|
call GetBaseData
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMonType]
|
|
|
|
ld hl, wPartyMon1Species
|
2017-12-15 18:22:26 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
and a
|
|
|
|
jr z, .copywholestruct
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wOTPartyMon1Species
|
2017-12-15 18:22:26 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
cp OTPARTYMON
|
|
|
|
jr z, .copywholestruct
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar CopyBoxmonToTempMon
|
2017-12-15 18:22:26 -08:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.copywholestruct
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2017-12-15 18:22:26 -08:00
|
|
|
call AddNTimes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wTempMon
|
2017-12-15 18:22:26 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CalcBufferMonStats:
|
2017-12-15 18:22:26 -08:00
|
|
|
ld bc, wBufferMon
|
|
|
|
jr _TempMonStatsCalculation
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CalcTempmonStats:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld bc, wTempMon
|
2018-06-24 07:09:41 -07:00
|
|
|
_TempMonStatsCalculation:
|
2017-12-15 18:22:26 -08:00
|
|
|
ld hl, MON_LEVEL
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyLevel], a
|
2017-12-15 18:22:26 -08:00
|
|
|
ld hl, MON_MAXHP
|
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, MON_STAT_EXP - 1
|
|
|
|
add hl, bc
|
|
|
|
push bc
|
2018-02-22 09:12:43 -08:00
|
|
|
ld b, TRUE
|
2018-02-22 08:13:29 -08:00
|
|
|
predef CalcMonStats
|
2017-12-15 18:22:26 -08:00
|
|
|
pop bc
|
|
|
|
ld hl, MON_HP
|
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2017-12-15 18:22:26 -08:00
|
|
|
cp EGG
|
|
|
|
jr nz, .not_egg
|
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld [de], a
|
|
|
|
jr .zero_status
|
|
|
|
|
|
|
|
.not_egg
|
|
|
|
push bc
|
|
|
|
ld hl, MON_MAXHP
|
|
|
|
add hl, bc
|
|
|
|
ld bc, 2
|
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
|
|
|
|
.zero_status
|
|
|
|
ld hl, MON_STATUS
|
|
|
|
add hl, bc
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetMonSpecies:
|
2018-02-22 08:13:29 -08:00
|
|
|
; [wMonType] has the type of the mon
|
|
|
|
; e = Nr. of mon (i.e. [wCurPartyMon])
|
2017-12-15 18:22:26 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMonType]
|
2017-12-15 18:22:26 -08:00
|
|
|
and a ; PARTYMON
|
|
|
|
jr z, .partymon
|
|
|
|
cp OTPARTYMON
|
|
|
|
jr z, .otpartymon
|
|
|
|
cp BOXMON
|
|
|
|
jr z, .boxmon
|
|
|
|
cp TEMPMON
|
|
|
|
jr z, .breedmon
|
|
|
|
; WILDMON
|
|
|
|
|
|
|
|
.partymon
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartySpecies
|
2017-12-15 18:22:26 -08:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.otpartymon
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wOTPartySpecies
|
2017-12-15 18:22:26 -08:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.boxmon
|
|
|
|
ld a, BANK(sBoxSpecies)
|
|
|
|
call GetSRAMBank
|
|
|
|
ld hl, sBoxSpecies
|
|
|
|
call .done
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
|
|
|
.breedmon
|
|
|
|
ld a, [wBreedMon1Species]
|
|
|
|
jr .done2
|
|
|
|
|
|
|
|
.done
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
|
|
|
|
.done2
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2017-12-15 18:22:26 -08:00
|
|
|
ret
|