Find simple calcs in bank 8

was also in the same bank in tcg1
This commit is contained in:
earthoul
2026-04-02 18:53:18 +09:00
parent d15412edc8
commit e73d3b0fb9
2 changed files with 35 additions and 9 deletions

View File

@@ -5178,12 +5178,8 @@ ConvertHPToCounters:
pop bc
ret
; returns in a the result of
; dividing b by a, rounded down
; input:
; a = divisor
; b = dividend
CalculateBDividedByA_Bank5:
; returns a = floor(b / a)
CalculateBDividedByA_Bank05:
push bc
ld c, a
ld a, b
@@ -6236,7 +6232,7 @@ AIDecideBenchPokemonToSwitchTo:
.add_hp_score
ld b, a
ld a, 4
call CalculateBDividedByA_Bank5
call CalculateBDividedByA_Bank05
call ConvertHPToCounters
call AIEncourage

View File

@@ -230,9 +230,39 @@ AIProcessHandTrainerCards:
ret z
inc de
jr .loop_copy
; 0x20270
SECTION "Bank 8@4290", ROMX[$4290], BANK[$8]
; returns hl = floor(hl / 10)
CalculateWordTensDigit:
push bc
push de
lb bc, $ff, -10
lb de, $ff, -1
.loop
inc de
add hl, bc
jr c, .loop
ld h, d
ld l, e
pop de
pop bc
ret
; returns a = floor(b / a)
CalculateBDividedByA_Bank08:
push bc
ld c, a
ld a, b
ld b, c
ld c, 0
.loop
sub b
jr c, .done
inc c
jr .loop
.done
ld a, c
pop bc
ret
; makes AI use Potion card.
AIPlay_Potion: