From f13ddf25bf61c79200c56666184fe84b579ad1cc Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 15 Dec 2020 21:13:15 +0100 Subject: Complete Lure effect functions --- src/data/effect_commands.asm | 2 +- src/engine/effect_functions.asm | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/data/effect_commands.asm b/src/data/effect_commands.asm index 60063ae..9000b7c 100644 --- a/src/data/effect_commands.asm +++ b/src/data/effect_commands.asm @@ -64,7 +64,7 @@ VictreebelLureEffectCommands: dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Lure_AssertPokemonInBench dbw EFFECTCMDTYPE_AFTER_DAMAGE, Lure_SwitchDefendingPokemon dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Lure_SelectSwitchPokemon - dbw EFFECTCMDTYPE_AI_SELECTION, Func_2c764 + dbw EFFECTCMDTYPE_AI_SELECTION, Lure_GetBenchPokemonWithLowestHP db $00 VictreebelAcidEffectCommands: diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index 7e8db45..965b639 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -463,9 +463,9 @@ DuelistSelectForcedSwitch: ; 2c487 (b:4487) INCROM $2c4da, $2c564 -; Return in a the PLAY_AREA_* of the non-turn holder's Pokemon card in bench with the lowest HP +; Return in a the PLAY_AREA_* of the non-turn holder's Pokemon card in bench with the lowest (remaining) HP. ; if multiple cards are tied for the lowest HP, the one with the highest PLAY_AREA_* is returned. -Func_2c564: ; 2c564 (b:4564) +GetBenchPokemonWithLowestHP: ; 2c564 (b:4564) call SwapTurn ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetTurnDuelistVariable @@ -580,8 +580,10 @@ Lure_SelectSwitchPokemon: ; 2c74b (b:474b) ret ; 0x2c764 -Func_2c764: ; 2c764 (b:4764) - call Func_2c564 +; Return in hTemp_ffa0 the PLAY_AREA_* of the non-turn holder's Pokemon card in bench with the lowest (remaining) HP. +; if multiple cards are tied for the lowest HP, the one with the highest PLAY_AREA_* is returned. +Lure_GetBenchPokemonWithLowestHP: ; 2c764 (b:4764) + call GetBenchPokemonWithLowestHP ldh [hTemp_ffa0], a ret ; 0x2c76a -- cgit v1.2.3