summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/effect_commands.asm8
-rw-r--r--src/engine/effect_functions.asm76
-rw-r--r--src/text/text1.asm2
-rw-r--r--src/text/text_offsets.asm2
4 files changed, 80 insertions, 8 deletions
diff --git a/src/data/effect_commands.asm b/src/data/effect_commands.asm
index 7360aff..c201b91 100644
--- a/src/data/effect_commands.asm
+++ b/src/data/effect_commands.asm
@@ -58,10 +58,10 @@ WeepinbellPoisonPowderEffectCommands:
db $00
VictreebelLureEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4740
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $476a
- dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $474b
- dbw EFFECTCMDTYPE_UNKNOWN_08, $4764
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, VictreebelLure_CheckBenchPokemon
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, VictreebelLure_SwitchDefendingPokemon
+ dbw EFFECTCMDTYPE_REQUIRE_SELECTION, VictreebelLure_PlayerSelectBenchPokemon
+ dbw EFFECTCMDTYPE_UNKNOWN_08, VictreebelLure_AISelectBenchPokemon
db $00
VictreebelAcidEffectCommands:
diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm
index 4ed3dbe..edfc773 100644
--- a/src/engine/effect_functions.asm
+++ b/src/engine/effect_functions.asm
@@ -459,7 +459,41 @@ DuelistSelectForcedSwitch: ; 2c487 (b:4487)
ret
; 0x2c4da
- INCROM $2c4da, $2c6f0
+ INCROM $2c4da, $2c564
+
+; outputs in a the Play Area location (PLAY_AREA_* constant)
+; of lowest HP card in non-duelist's Bench.
+AIFindBenchWithLowestHP: ; 2c564 (b:4564)
+ call SwapTurn
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ ld c, a
+ lb de, PLAY_AREA_ARENA, $ff
+ ld b, d
+ ld a, DUELVARS_BENCH1_CARD_HP
+ call GetTurnDuelistVariable
+ jr .start
+; find Play Area location with least amount of HP
+.loop_bench
+ ld a, e
+ cp [hl]
+ jr c, .next ; skip if HP is higher
+ ld e, [hl]
+ ld d, b
+
+.next
+ inc hl
+.start
+ inc b
+ dec c
+ jr nz, .loop_bench
+
+ ld a, d
+ call SwapTurn
+ ret
+; 0x2c588
+
+ INCROM $2c588, $2c6f0
SpitPoison_AIEffect: ; 2c6f0 (b:46f0)
ld a, 5
@@ -524,7 +558,45 @@ WeepinbellPoisonPowder_AIEffect: ; 2c738 (b:4738)
jp Func_2c0d4
; 0x2c740
- INCROM $2c740, $2c77e
+; returns carry if non-duelist has no Bench Pokemon
+VictreebelLure_CheckBenchPokemon: ; 2c740 (b:4740)
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetNonTurnDuelistVariable
+ ldtx hl, LureNoPokemonOnTheBenchText
+ cp 2
+ ret
+; 0x2c74b
+
+VictreebelLure_PlayerSelectBenchPokemon: ; 2c74b (b:474b)
+ ldtx hl, SelectPkmnOnBenchToSwitchWithActiveText
+ call DrawWideTextBox_WaitForInput
+ call SwapTurn
+ bank1call HasAlivePokemonInBench
+.loop_selection
+ bank1call OpenPlayAreaScreenForSelection
+ jr c, .loop_selection
+ ldh a, [hTempPlayAreaLocation_ff9d]
+ ldh [hTemp_ffa0], a
+ call SwapTurn
+ ret
+; 0x2c764
+
+VictreebelLure_AISelectBenchPokemon: ; 2c764 (b:4764)
+ call AIFindBenchWithLowestHP
+ ldh [hTemp_ffa0], a
+ ret
+; 0x2c76a
+
+VictreebelLure_SwitchDefendingPokemon: ; 2c76a (b:476a)
+ call SwapTurn
+ ldh a, [hTemp_ffa0]
+ ld e, a
+ call HandleNShieldAndTransparency
+ call nc, SwapArenaWithBenchPokemon
+ call SwapTurn
+ xor a
+ ld [wDuelDisplayedScreen], a
+ ret
; If heads, defending Pokemon can't retreat next turn
AcidEffect: ; 2c77e (b:477e)
diff --git a/src/text/text1.asm b/src/text/text1.asm
index 07d7a7a..00dc22f 100644
--- a/src/text/text1.asm
+++ b/src/text/text1.asm
@@ -858,7 +858,7 @@ Text00b6: ; 375bc (d:75bc)
text "Not enough cards in Hand."
done
-Text00b7: ; 375d7 (d:75d7)
+LureNoPokemonOnTheBenchText: ; 375d7 (d:75d7)
text "No Pokémon on the Bench."
done
diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm
index 605ec7d..7ff0d44 100644
--- a/src/text/text_offsets.asm
+++ b/src/text/text_offsets.asm
@@ -184,7 +184,7 @@ TextOffsets:: ; 34000 (d:4000)
textpointer CantEvolvePokemonInSameTurnItsPlacedText ; 0x00b4
textpointer Text00b5 ; 0x00b5
textpointer Text00b6 ; 0x00b6
- textpointer Text00b7 ; 0x00b7
+ textpointer LureNoPokemonOnTheBenchText ; 0x00b7
textpointer Text00b8 ; 0x00b8
textpointer Text00b9 ; 0x00b9
textpointer Text00ba ; 0x00ba