mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
replaced hardcoded values in ItemUseMedicine
This commit is contained in:
parent
4f43e47fc9
commit
4cfcc2f589
|
@ -901,10 +901,10 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
ld hl,W_PLAYERBATTSTATUS3
|
ld hl,W_PLAYERBATTSTATUS3
|
||||||
res BadlyPoisoned,[hl] ; heal Toxic status
|
res BadlyPoisoned,[hl] ; heal Toxic status
|
||||||
pop hl
|
pop hl
|
||||||
ld bc,30
|
ld bc,wPartyMon1Stats - wPartyMon1Status
|
||||||
add hl,bc ; hl now points to party stats
|
add hl,bc ; hl now points to party stats
|
||||||
ld de,wBattleMonMaxHP
|
ld de,wBattleMonStats
|
||||||
ld bc,10
|
ld bc,NUM_STATS * 2
|
||||||
call CopyData ; copy party stats to in-battle stat data
|
call CopyData ; copy party stats to in-battle stat data
|
||||||
predef DoubleOrHalveSelectedStats
|
predef DoubleOrHalveSelectedStats
|
||||||
jp .doneHealing
|
jp .doneHealing
|
||||||
|
@ -959,7 +959,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
.compareCurrentHPToMaxHP
|
.compareCurrentHPToMaxHP
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
ld bc,32
|
ld bc,wPartyMon1MaxHP - (wPartyMon1HP + 1)
|
||||||
add hl,bc ; hl now points to max HP
|
add hl,bc ; hl now points to max HP
|
||||||
pop bc
|
pop bc
|
||||||
ld a,[hli]
|
ld a,[hli]
|
||||||
|
@ -991,7 +991,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
ld [wChannelSoundIDs + CH4],a
|
ld [wChannelSoundIDs + CH4],a
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
ld bc,32
|
ld bc,wPartyMon1MaxHP - (wPartyMon1HP + 1)
|
||||||
add hl,bc ; hl now points to max HP
|
add hl,bc ; hl now points to max HP
|
||||||
ld a,[hli]
|
ld a,[hli]
|
||||||
ld [wHPBarMaxHP+1],a
|
ld [wHPBarMaxHP+1],a
|
||||||
|
@ -1024,7 +1024,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
ld [H_DIVISOR],a
|
ld [H_DIVISOR],a
|
||||||
ld b,2 ; number of bytes
|
ld b,2 ; number of bytes
|
||||||
call Divide ; get 1/5 of max HP of pokemon that used Softboiled
|
call Divide ; get 1/5 of max HP of pokemon that used Softboiled
|
||||||
ld bc,wPartyMon1HP - wPartyMon1MaxHP
|
ld bc,(wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1)
|
||||||
add hl,bc ; hl now points to LSB of current HP of pokemon that used Softboiled
|
add hl,bc ; hl now points to LSB of current HP of pokemon that used Softboiled
|
||||||
; subtract 1/5 of max HP from current HP of pokemon that used Softboiled
|
; subtract 1/5 of max HP from current HP of pokemon that used Softboiled
|
||||||
ld a,[H_QUOTIENT + 3]
|
ld a,[H_QUOTIENT + 3]
|
||||||
|
@ -1103,7 +1103,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
inc hl
|
inc hl
|
||||||
ld d,h
|
ld d,h
|
||||||
ld e,l ; de now points to current HP
|
ld e,l ; de now points to current HP
|
||||||
ld hl,33
|
ld hl,(wPartyMon1MaxHP + 1) - (wPartyMon1HP + 1)
|
||||||
add hl,de ; hl now points to max HP
|
add hl,de ; hl now points to max HP
|
||||||
ld a,[wcf91]
|
ld a,[wcf91]
|
||||||
cp a,REVIVE
|
cp a,REVIVE
|
||||||
|
@ -1150,7 +1150,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
ld a,[wcf91]
|
ld a,[wcf91]
|
||||||
cp a,FULL_RESTORE
|
cp a,FULL_RESTORE
|
||||||
jr nz,.updateInBattleData
|
jr nz,.updateInBattleData
|
||||||
ld bc,-31
|
ld bc,wPartyMon1Status - (wPartyMon1MaxHP + 1)
|
||||||
add hl,bc
|
add hl,bc
|
||||||
xor a
|
xor a
|
||||||
ld [hl],a ; remove the status ailment in the party data
|
ld [hl],a ; remove the status ailment in the party data
|
||||||
|
@ -1173,7 +1173,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
ld [wBattleMonStatus],a ; remove the status ailment in the in-battle pokemon data
|
ld [wBattleMonStatus],a ; remove the status ailment in the in-battle pokemon data
|
||||||
.calculateHPBarCoords
|
.calculateHPBarCoords
|
||||||
ld hl,wOAMBuffer + $90
|
ld hl,wOAMBuffer + $90
|
||||||
ld bc,2 * 20
|
ld bc,2 * SCREEN_WIDTH
|
||||||
inc d
|
inc d
|
||||||
.calculateHPBarCoordsLoop
|
.calculateHPBarCoordsLoop
|
||||||
add hl,bc
|
add hl,bc
|
||||||
|
@ -1253,7 +1253,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
ld a,[hl]
|
ld a,[hl]
|
||||||
ld [wd0b5],a
|
ld [wd0b5],a
|
||||||
ld [wd11e],a
|
ld [wd11e],a
|
||||||
ld bc,33
|
ld bc,wPartyMon1Level - wPartyMon1
|
||||||
add hl,bc ; hl now points to level
|
add hl,bc ; hl now points to level
|
||||||
ld a,[hl] ; a = level
|
ld a,[hl] ; a = level
|
||||||
ld [W_CURENEMYLVL],a ; store level
|
ld [W_CURENEMYLVL],a ; store level
|
||||||
|
@ -1270,7 +1270,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
push hl
|
push hl
|
||||||
sub a,HP_UP
|
sub a,HP_UP
|
||||||
add a
|
add a
|
||||||
ld bc,17
|
ld bc,wPartyMon1HPExp - wPartyMon1
|
||||||
add hl,bc
|
add hl,bc
|
||||||
add l
|
add l
|
||||||
ld l,a
|
ld l,a
|
||||||
|
@ -1318,17 +1318,17 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
call PrintText
|
call PrintText
|
||||||
jp GBPalWhiteOut
|
jp GBPalWhiteOut
|
||||||
.recalculateStats
|
.recalculateStats
|
||||||
ld bc,34
|
ld bc,wPartyMon1Stats - wPartyMon1
|
||||||
add hl,bc
|
add hl,bc
|
||||||
ld d,h
|
ld d,h
|
||||||
ld e,l ; de now points to stats
|
ld e,l ; de now points to stats
|
||||||
ld bc,-18
|
ld bc,(wPartyMon1Exp + 2) - wPartyMon1Stats
|
||||||
add hl,bc ; hl now points to byte 3 of experience
|
add hl,bc ; hl now points to LSB of experience
|
||||||
ld b,1
|
ld b,1
|
||||||
jp CalcStats ; recalculate stats
|
jp CalcStats ; recalculate stats
|
||||||
.useRareCandy
|
.useRareCandy
|
||||||
push hl
|
push hl
|
||||||
ld bc,33
|
ld bc,wPartyMon1Level - wPartyMon1
|
||||||
add hl,bc ; hl now points to level
|
add hl,bc ; hl now points to level
|
||||||
ld a,[hl] ; a = level
|
ld a,[hl] ; a = level
|
||||||
cp a, MAX_LEVEL
|
cp a, MAX_LEVEL
|
||||||
|
@ -1342,8 +1342,8 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
callab CalcExperience ; calculate experience for next level and store it at $ff96
|
callab CalcExperience ; calculate experience for next level and store it at $ff96
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
ld bc,-19
|
ld bc,wPartyMon1Exp - wPartyMon1Level
|
||||||
add hl,bc ; hl now points to experience
|
add hl,bc ; hl now points to MSB of experience
|
||||||
; update experience to minimum for new level
|
; update experience to minimum for new level
|
||||||
ld a,[hExperience]
|
ld a,[hExperience]
|
||||||
ld [hli],a
|
ld [hli],a
|
||||||
|
@ -1358,7 +1358,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
push af
|
push af
|
||||||
push de
|
push de
|
||||||
push hl
|
push hl
|
||||||
ld bc,34
|
ld bc,wPartyMon1MaxHP - wPartyMon1
|
||||||
add hl,bc ; hl now points to MSB of max HP
|
add hl,bc ; hl now points to MSB of max HP
|
||||||
ld a,[hli]
|
ld a,[hli]
|
||||||
ld b,a
|
ld b,a
|
||||||
|
@ -1368,8 +1368,8 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
push hl
|
push hl
|
||||||
call .recalculateStats
|
call .recalculateStats
|
||||||
pop hl
|
pop hl
|
||||||
ld bc,35 ; hl now points to LSB of max HP
|
ld bc,(wPartyMon1MaxHP + 1) - wPartyMon1
|
||||||
add hl,bc
|
add hl,bc ; hl now points to LSB of max HP
|
||||||
pop bc
|
pop bc
|
||||||
ld a,[hld]
|
ld a,[hld]
|
||||||
sub c
|
sub c
|
||||||
|
@ -1378,8 +1378,8 @@ ItemUseMedicine: ; dabb (3:5abb)
|
||||||
sbc b
|
sbc b
|
||||||
ld b,a ; bc = the amount of max HP gained from leveling up
|
ld b,a ; bc = the amount of max HP gained from leveling up
|
||||||
; add the amount gained to the current HP
|
; add the amount gained to the current HP
|
||||||
ld de,-32
|
ld de,(wPartyMon1HP + 1) - wPartyMon1MaxHP
|
||||||
add hl,de ; hl now points to MSB of current HP
|
add hl,de ; hl now points to LSB of current HP
|
||||||
ld a,[hl]
|
ld a,[hl]
|
||||||
add c
|
add c
|
||||||
ld [hld],a
|
ld [hld],a
|
||||||
|
|
Loading…
Reference in a new issue