From 460a7c4d9be846fb585b7c2b5d0d7e686be4b2bd Mon Sep 17 00:00:00 2001 From: earthoul Date: Thu, 26 Feb 2026 23:03:13 +0900 Subject: [PATCH] Fill gap in bank 5 the same function as in TCG1 --- src/engine/bank05.asm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm index f686b64..395b148 100644 --- a/src/engine/bank05.asm +++ b/src/engine/bank05.asm @@ -9203,9 +9203,29 @@ CheckIfAnyAttackKnocksOutDefendingCard: ret nz scf ret -; 0x179aa -SECTION "Bank 5@79c2", ROMX[$79c2], BANK[$5] +; returns carry if any of the defending Pokémon's attacks +; brings card at hTempPlayAreaLocation_ff9d down +; to exactly 0 HP. +; outputs that attack index in wSelectedAttack. +CheckIfAnyDefendingPokemonAttackDealsSameDamageAsHP: + xor a ; FIRST_ATTACK_OR_PKMN_POWER + call .CheckDamage + ret c + ld a, SECOND_ATTACK + +.CheckDamage: + call EstimateDamage_FromDefendingPokemon + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_HP + get_turn_duelist_var + ld hl, wDamage + sub [hl] + jr z, .true + ret +.true + scf + ret ; checks AI scores for all benched Pokémon ; returns the location of the card with highest score