summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2020-06-03 15:03:24 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2020-12-16 00:23:26 +0000
commit046cb28bde1c0d6716380f83e26df4a568d7691c (patch)
treef01ffcbcdb2cb9b8c964499cefdf35575cefd8e1 /src
parentb75d9712271fc49b7c3f83fc65c4b260624af386 (diff)
Fighting attack effects
Diffstat (limited to 'src')
-rw-r--r--src/constants/deck_ai_constants.asm26
-rw-r--r--src/data/effect_commands.asm84
-rw-r--r--src/engine/bank08.asm10
-rw-r--r--src/engine/effect_functions.asm587
-rw-r--r--src/text/text1.asm4
-rw-r--r--src/text/text2.asm14
-rw-r--r--src/text/text_offsets.asm18
7 files changed, 671 insertions, 72 deletions
diff --git a/src/constants/deck_ai_constants.asm b/src/constants/deck_ai_constants.asm
index a0b87f7..a10729c 100644
--- a/src/constants/deck_ai_constants.asm
+++ b/src/constants/deck_ai_constants.asm
@@ -54,8 +54,24 @@ AI_ENERGY_TRANS_TO_BENCH EQU $e ; moves energy cards away from Arena card
; used to know which AI routine to call in
; the AIAction pointer tables in AIDoAction
const_def 1
- const AIACTION_DO_TURN ; $1
- const AIACTION_START_DUEL ; $2
- const AIACTION_FORCED_SWITCH ; $3
- const AIACTION_KO_SWITCH ; $4
- const AIACTION_TAKE_PRIZE ; $5
+ const AIACTION_DO_TURN ; $1
+ const AIACTION_START_DUEL ; $2
+ const AIACTION_FORCED_SWITCH ; $3
+ const AIACTION_KO_SWITCH ; $4
+ const AIACTION_TAKE_PRIZE ; $5
+
+; this bit is set when the AI decides to use Peek on their Prize cards,
+; with the following bits deciding which one to Peek. That is:
+; %10'0000 = first prize card
+; %10'0001 = second prize card
+; %10'0010 = third prize card
+; etc...
+AI_PEEK_TARGET_PRIZE_F EQU 6
+AI_PEEK_TARGET_PRIZE EQU 1 << AI_PEEK_TARGET_PRIZE_F
+; this bit is set when the AI decides to use Peek on Player hand card,
+; with the following bits deciding which one to Peek. That is:
+; %1XXX XXXX, where XXX XXXX is the deck index of card chosen
+AI_PEEK_TARGET_HAND_F EQU 7
+AI_PEEK_TARGET_HAND EQU 1 << AI_PEEK_TARGET_HAND_F
+; all bits set means AI chose to look at Player's top deck card
+AI_PEEK_TARGET_DECK EQU $ff
diff --git a/src/data/effect_commands.asm b/src/data/effect_commands.asm
index c5c9735..f4a7740 100644
--- a/src/data/effect_commands.asm
+++ b/src/data/effect_commands.asm
@@ -174,7 +174,7 @@ ExeggutorBigEggsplosionEffectCommands:
NidokingThrashEffectCommands:
dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Thrash_ModifierEffect
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, Func_2c982
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, Thrash_RecoilEffect
dbw EFFECTCMDTYPE_AI, Thrash_AIEffect
db $00
@@ -886,119 +886,119 @@ MewMysteryAttackEffectCommands:
db $00
GeodudeStoneBarrageEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6052
- dbw EFFECTCMDTYPE_AI, $604a
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, StoneBarrage_MultiplierEffect
+ dbw EFFECTCMDTYPE_AI, StoneBarrage_AIEffect
db $00
OnixHardenEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6075
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, OnixHardenEffect
db $00
PrimeapeFurySwipesEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6083
- dbw EFFECTCMDTYPE_AI, $607b
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PrimeapeFurySwipes_MultiplierEffect
+ dbw EFFECTCMDTYPE_AI, PrimeapeFurySwipes_AIEffect
db $00
PrimeapeTantrumEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6099
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, TantrumEffect
db $00
MachampStrikesBackEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $60af
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, StrikesBackEffect
db $00
KabutoKabutoArmorEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $60b1
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, KabutoArmorEffect
db $00
KabutopsAbsorbEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $60b3
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, AbsorbEffect
db $00
CuboneSnivelEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $60cb
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SnivelEffect
db $00
CuboneRageEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $60d7
- dbw EFFECTCMDTYPE_AI, $60d1
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, CuboneRage_DamageBoostEffect
+ dbw EFFECTCMDTYPE_AI, CuboneRage_AIEffect
db $00
MarowakBonemerangEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $60e8
- dbw EFFECTCMDTYPE_AI, $60e0
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Bonemerang_MultiplierEffect
+ dbw EFFECTCMDTYPE_AI, Bonemerang_AIEffect
db $00
MarowakCallforFriendEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6100
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6194
- dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6110
- dbw EFFECTCMDTYPE_AI_SELECTION, $6177
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, MarowakCallForFamily_CheckDeckAndPlayArea
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, MarowakCallForFamily_PutInPlayAreaEffect
+ dbw EFFECTCMDTYPE_REQUIRE_SELECTION, MarowakCallForFamily_PlayerSelectEffect
+ dbw EFFECTCMDTYPE_AI_SELECTION, MarowakCallForFamily_AISelectEffect
db $00
MachokeKarateChopEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $61ba
- dbw EFFECTCMDTYPE_AI, $61b4
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, KarateChop_DamageSubtractionEffect
+ dbw EFFECTCMDTYPE_AI, KarateChop_AIEffect
db $00
MachokeSubmissionEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $61d1
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, SubmissionEffect
db $00
GolemSelfdestructEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $61d7
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, GolemSelfdestructEffect
db $00
GravelerHardenEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $61f6
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, GravelerHardenEffect
db $00
RhydonRamEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6212
- dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $61fc
- dbw EFFECTCMDTYPE_SWITCH_DEFENDING_PKMN, $61fc
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, Ram_RecoilSwitchEffect
+ dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Ram_SelectSwitchEffect
+ dbw EFFECTCMDTYPE_SWITCH_DEFENDING_PKMN, Ram_SelectSwitchEffect
db $00
RhyhornLeerEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $621d
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, LeerEffect
db $00
HitmonleeStretchKickEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6231
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $625b
- dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $623c
- dbw EFFECTCMDTYPE_AI_SELECTION, $6255
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, StretchKick_CheckBench
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, StretchKick_BenchDamageEffect
+ dbw EFFECTCMDTYPE_REQUIRE_SELECTION, StretchKick_PlayerSelectEffect
+ dbw EFFECTCMDTYPE_AI_SELECTION, StretchKick_AISelectEffect
db $00
SandshrewSandAttackEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $626b
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SandAttackEffect
db $00
SandslashFurySwipesEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6279
- dbw EFFECTCMDTYPE_AI, $6271
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SandslashFurySwipes_MultiplierEffect
+ dbw EFFECTCMDTYPE_AI, SandslashFurySwipes_AIEffect
db $00
DugtrioEarthquakeEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $628f
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, EarthquakeEffect
db $00
AerodactylPrehistoricPowerEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $629a
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PrehistoricPowerEffect
db $00
MankeyPeekEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $629c
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $62b4
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Peek_OncePerTurnCheck
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Peek_SelectEffect
db $00
MarowakBoneAttackEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $630f
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, BoneAttackEffect
db $00
MarowakWailEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $631c
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6335
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Wail_BenchCheck
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, Wail_FillBenchEffect
db $00
ElectabuzzThundershockEffectCommands:
diff --git a/src/engine/bank08.asm b/src/engine/bank08.asm
index d133fd1..fc81d90 100644
--- a/src/engine/bank08.asm
+++ b/src/engine/bank08.asm
@@ -6824,7 +6824,7 @@ HandleAIPeek: ; 224e6 (8:64e6)
ld a, 3
call Random
or a
- jr z, .check_player_prizes
+ jr z, .check_ai_prizes
cp 2
jr c, .check_player_hand
@@ -6833,10 +6833,10 @@ HandleAIPeek: ; 224e6 (8:64e6)
call GetNonTurnDuelistVariable
cp DECK_SIZE - 1
ret nc ; return if Player has one or no cards in Deck
- ld a, $ff
+ ld a, AI_PEEK_TARGET_DECK
jr .use_peek
-.check_player_prizes
+.check_ai_prizes
ld a, DUELVARS_PRIZES
call GetTurnDuelistVariable
ld hl, wcda5
@@ -6861,7 +6861,7 @@ HandleAIPeek: ; 224e6 (8:64e6)
ld a, c
sub b
ld [hl], a
- ld a, $40
+ ld a, AI_PEEK_TARGET_PRIZE
add d
jr .use_peek
@@ -6876,7 +6876,7 @@ HandleAIPeek: ; 224e6 (8:64e6)
call CountCardsInDuelTempList
call ShuffleCards
ld a, [wDuelTempList]
- or $80
+ or AI_PEEK_TARGET_HAND
.use_peek
push af
diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm
index eccf79f..3a4182f 100644
--- a/src/engine/effect_functions.asm
+++ b/src/engine/effect_functions.asm
@@ -1892,7 +1892,7 @@ Thrash_ModifierEffect: ; 2c973 (b:4973)
call AddToDamage
ret
-Func_2c982: ; 2c982 (b:4982)
+Thrash_RecoilEffect: ; 2c982 (b:4982)
ldh a, [hTemp_ffa0]
or a
ret nz
@@ -6148,4 +6148,587 @@ MysteryAttack_RecoverEffect: ; 2e03e (b:603e)
ret
; 0x2e04a
- INCROM $2e04a, $30000
+StoneBarrage_AIEffect: ; 2e04a (b:604a)
+ ld a, 10
+ lb de, 0, 100
+ jp StoreAIDamageInfo
+; 0x2e052
+
+StoneBarrage_MultiplierEffect: ; 2e052 (b:6052)
+ xor a
+ ldh [hTemp_ffa0], a
+.loop_coin_toss
+ ldtx de, FlipUntilFailAppears10DamageForEachHeadsText
+ xor a
+ call TossCoinATimes_BankB
+ jr nc, .tails
+ ld hl, hTemp_ffa0
+ inc [hl] ; increase heads count
+ jr .loop_coin_toss
+
+.tails
+; store resulting damage
+ ldh a, [hTemp_ffa0]
+ ld l, a
+ ld h, 10
+ call HtimesL
+ ld de, wDamage
+ ld a, l
+ ld [de], a
+ inc de
+ ld a, h
+ ld [de], a
+ ret
+; 0x2e075
+
+OnixHardenEffect: ; 2e075 (b:6075)
+ ld a, SUBSTATUS1_HARDEN
+ call ApplySubstatus1ToDefendingCard
+ ret
+; 0x2e07b
+
+PrimeapeFurySwipes_AIEffect: ; 2e07b (b:607b)
+ ld a, 60 / 2
+ lb de, 0, 60
+ jp StoreAIDamageInfo
+; 0x2e083
+
+PrimeapeFurySwipes_MultiplierEffect: ; 2e083 (b:6083)
+ ld hl, 20
+ call LoadTxRam3
+ ldtx de, DamageCheckIfHeadsXDamageText
+ ld a, 3
+ call TossCoinATimes_BankB
+ add a
+ call ATimes10
+ call StoreDamageInfo
+ ret
+; 0x2e099
+
+TantrumEffect: ; 2e099 (b:6099)
+ ldtx de, IfTailsYourPokemonBecomesConfusedText
+ call TossCoin_BankB
+ ret c ; return if heads
+; confuse Pokemon
+ ld a, $29
+ ld [wLoadedMoveAnimation], a
+ call SwapTurn
+ call ConfusionEffect
+ call SwapTurn
+ ret
+; 0x2e0af
+
+StrikesBackEffect: ; 2e0af (b:60af)
+ scf
+ ret
+; 0x2e0b1
+
+KabutoArmorEffect: ; 2e0b1 (b:60b1)
+ scf
+ ret
+; 0x2e0b3
+
+AbsorbEffect: ; 2e0b3 (b:60b3)
+ ld hl, wDealtDamage
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ srl h
+ rr l
+ bit 0, l
+ jr z, .rounded
+ ; round up to nearest 10
+ ld de, 5
+ add hl, de
+.rounded
+ ld e, l
+ ld d, h
+ call ApplyAndAnimateHPRecovery
+ ret
+; 0x2e0cb
+
+SnivelEffect: ; 2e0cb (b:60cb)
+ ld a, SUBSTATUS2_REDUCE_BY_20
+ call ApplySubstatus2ToDefendingCard
+ ret
+; 0x2e0d1
+
+CuboneRage_AIEffect: ; 2e0d1 (b:60d1)
+ call CuboneRage_DamageBoostEffect
+ jp SetMinMaxDamageSameAsDamage
+; 0x2e0d7
+
+CuboneRage_DamageBoostEffect: ; 2e0d7 (b:60d7)
+ ld e, PLAY_AREA_ARENA
+ call GetCardDamageAndMaxHP
+ call AddToDamage
+ ret
+; 0x2e0e0
+
+Bonemerang_AIEffect: ; 2e0e0 (b:60e0)
+ ld a, 60 / 2
+ lb de, 0, 60
+ jp StoreAIDamageInfo
+; 0x2e0e8
+
+Bonemerang_MultiplierEffect: ; 2e0e8 (b:60e8)
+ ld hl, 30
+ call LoadTxRam3
+ ldtx de, DamageCheckIfHeadsXDamageText
+ ld a, 2
+ call TossCoinATimes_BankB
+ ld e, a
+ add a ; a = 2 * heads
+ add e ; a = 3 * heads
+ call ATimes10
+ call StoreDamageInfo
+ ret
+; 0x2e100
+
+; returns carry if can't add Pokemon from deck
+MarowakCallForFamily_CheckDeckAndPlayArea: ; 2e100 (b:6100)
+ call CheckIfDeckIsEmpty
+ ret c ; no cards in deck
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ ldtx hl, NoSpaceOnTheBenchText
+ cp MAX_PLAY_AREA_POKEMON
+ ccf
+ ret
+; 0x2e110
+
+MarowakCallForFamily_PlayerSelectEffect: ; 2e110 (b:6110)
+ ld a, $ff
+ ldh [hTemp_ffa0], a
+
+ call CreateDeckCardList
+ ldtx hl, ChooseBasicFightingPokemonFromDeckText
+ ldtx bc, FightingPokemonDeckText
+ lb de, SEARCHEFFECT_BASIC_FIGHTING, $00
+ call LookForCardInDeck
+ ret c
+
+; draw Deck list interface and print text
+ bank1call Func_5591
+ ldtx hl, ChooseBasicFightingPokemonText
+ ldtx de, DuelistDeckText
+ bank1call SetCardListHeaderText
+
+.loop
+ bank1call DisplayCardList
+ jr c, .pressed_b
+
+ call LoadCardDataToBuffer2_FromDeckIndex
+ ld a, [wLoadedCard2Type]
+ cp FIGHTING
+ jr nz, .play_sfx ; is Fighting?
+ ld a, [wLoadedCard2Stage]
+ or a
+ jr nz, .play_sfx ; is Basic?
+ ldh a, [hTempCardIndex_ff98]
+ ldh [hTemp_ffa0], a
+ or a
+ ret
+
+.play_sfx
+ ; play SFX and loop back
+ call Func_3794
+ jr .loop
+
+.pressed_b
+; figure if Player can exit the screen without selecting,
+; that is, if the Deck has no Basic Fighting Pokemon.
+ ld a, DUELVARS_CARD_LOCATIONS
+ call GetTurnDuelistVariable
+.loop_b_press
+ ld a, [hl]
+ cp CARD_LOCATION_DECK
+ jr nz, .next
+ ld a, l
+ call LoadCardDataToBuffer2_FromDeckIndex
+ ld a, [wLoadedCard1Type]
+ cp FIGHTING
+ jr nz, .next ; found, go back to top loop
+ ld a, [wLoadedCard1Stage]
+ or a
+ jr z, .play_sfx ; found, go back to top loop
+.next
+ inc l
+ ld a, l
+ cp DECK_SIZE
+ jr c, .loop_b_press
+
+; no valid card in Deck, can safely exit screen
+ ld a, $ff
+ ldh [hTemp_ffa0], a
+ or a
+ ret
+; 0x2e177
+
+MarowakCallForFamily_AISelectEffect: ; 2e177 (b:6177)
+ call CreateDeckCardList
+ ld hl, wDuelTempList
+.loop_deck
+ ld a, [hli]
+ ldh [hTemp_ffa0], a
+ cp $ff
+ ret z ; none found
+ call LoadCardDataToBuffer2_FromDeckIndex
+ ld a, [wLoadedCard2Type]
+ cp FIGHTING
+ jr nz, .loop_deck
+ ld a, [wLoadedCard2Stage]
+ or a
+ jr nz, .loop_deck
+; found
+ ret
+; 0x2e194
+
+MarowakCallForFamily_PutInPlayAreaEffect: ; 2e194 (b:6194)
+ ldh a, [hTemp_ffa0]
+ cp $ff
+ jr z, .shuffle
+ call SearchCardInDeckAndAddToHand
+ call AddCardToHand
+ call PutHandPokemonCardInPlayArea
+ call CheckIfTurnDuelistIsPlayer
+ jr c, .shuffle
+ ; display card on screen
+ ldh a, [hTemp_ffa0]
+ ldtx hl, PlacedOnTheBenchText
+ bank1call DisplayCardDetailScreen
+.shuffle
+ call Func_2c0bd
+ ret
+; 0x2c1b4
+
+KarateChop_AIEffect: ; 2e1b4 (b:61b4)
+ call KarateChop_DamageSubtractionEffect
+ jp SetMinMaxDamageSameAsDamage
+; 0x2e1ba
+
+KarateChop_DamageSubtractionEffect: ; 2e1ba (b:61ba)
+ ld e, PLAY_AREA_ARENA
+ call GetCardDamageAndMaxHP
+ ld e, a
+ ld hl, wDamage
+ ld a, [hl]
+ sub e
+ ld [hli], a
+ ld a, [hl]
+ sbc 0
+ ld [hl], a
+ rla
+ ret nc
+; cap it to 0 damage
+ xor a
+ call StoreDamageInfo
+ ret
+; 0x2e1d1
+
+SubmissionEffect: ; 2e1d1 (b:61d1)
+ ld a, 20
+ call DealRecoilDamageToSelf
+ ret
+; 0x2e1d7
+
+GolemSelfdestructEffect: ; 2e1d7 (b:61d7)
+ ld a, 100
+ call DealRecoilDamageToSelf
+ ld a, $01
+ ld [wIsDamageToSelf], a
+ ld a, 20
+ call DealDamageToAllBenchedPokemon
+ call SwapTurn
+ xor a
+ ld [wIsDamageToSelf], a
+ ld a, 20
+ call DealDamageToAllBenchedPokemon
+ call SwapTurn
+ ret
+; 0x2e1f6
+
+GravelerHardenEffect: ; 2e1f6 (b:61f6)
+ ld a, SUBSTATUS1_HARDEN
+ call ApplySubstatus1ToDefendingCard
+ ret
+; 0x2e1fc
+
+Ram_SelectSwitchEffect: ; 2e1fc (b:61fc)
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetNonTurnDuelistVariable
+ cp 2
+ jr c, .no_bench
+ call DuelistSelectForcedSwitch
+ ldh a, [hTempPlayAreaLocation_ff9d]
+ ldh [hTemp_ffa0], a
+ ret
+.no_bench
+ ld a, $ff
+ ldh [hTemp_ffa0], a
+ ret
+; 0x2e212
+
+Ram_RecoilSwitchEffect: ; 2e212 (b:6212)
+ ld a, 20
+ call DealRecoilDamageToSelf
+ ldh a, [hTemp_ffa0]
+ call HandleSwitchDefendingPokemonEffect
+ ret
+; 0x2e21d
+
+LeerEffect: ; 2e21d (b:621d)
+ ldtx de, IfHeadsOpponentCannotAttackText
+ call TossCoin_BankB
+ jp nc, SetWasUnsuccessful
+ ld a, $74
+ ld [wLoadedMoveAnimation], a
+ ld a, SUBSTATUS2_LEER
+ call ApplySubstatus2ToDefendingCard
+ ret
+; 0x2e231
+
+; return carry if opponent has no Bench Pokemon.
+StretchKick_CheckBench: ; 2e231 (b:6231)
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetNonTurnDuelistVariable
+ ldtx hl, EffectNoPokemonOnTheBenchText
+ cp 2
+ ret
+; 0x2e23c
+
+StretchKick_PlayerSelectEffect: ; 2e23c (b:623c)
+ ldtx hl, ChoosePkmnInTheBenchToGiveDamageText
+ call DrawWideTextBox_WaitForInput
+ call SwapTurn
+ bank1call HasAlivePokemonInBench
+.loop_input
+ bank1call OpenPlayAreaScreenForSelection
+ jr c, .loop_input
+ ldh a, [hTempPlayAreaLocation_ff9d]
+ ldh [hTemp_ffa0], a
+ call SwapTurn
+ ret
+; 0x2e255
+
+StretchKick_AISelectEffect: ; 2e255 (b:6255)
+; chooses Bench Pokemon with least amount of remaining HP
+ call AIFindBenchWithLowestHP
+ ldh [hTemp_ffa0], a
+ ret
+; 0x2e25b
+
+StretchKick_BenchDamageEffect: ; 2e25b (b:625b)
+ call SwapTurn
+ ldh a, [hTemp_ffa0]
+ ld b, a
+ ld de, 20
+ call DealDamageToPlayAreaPokemon
+ call SwapTurn
+ ret
+; 0x2e26b
+
+SandAttackEffect: ; 2e26b (b:626b)
+ ld a, SUBSTATUS2_SAND_ATTACK
+ call ApplySubstatus2ToDefendingCard
+ ret
+; 0x2e271
+
+SandslashFurySwipes_AIEffect: ; 2e271 (b:6271)
+ ld a, 60 / 2
+ lb de, 0, 60
+ jp StoreAIDamageInfo
+; 0x2e279
+
+SandslashFurySwipes_MultiplierEffect: ; 2e279 (b:6279)
+ ld hl, 20
+ call LoadTxRam3
+ ldtx de, DamageCheckIfHeadsXDamageText
+ ld a, 3
+ call TossCoinATimes_BankB
+ add a
+ call ATimes10
+ call StoreDamageInfo
+ ret
+; 0x2e28f
+
+EarthquakeEffect: ; 2e28f (b:628f)
+ ld a, $01
+ ld [wIsDamageToSelf], a
+ ld a, 10
+ call DealDamageToAllBenchedPokemon
+ ret
+; 0x2e29a
+
+PrehistoricPowerEffect: ; 2e29a (b:629a)
+ scf
+ ret
+; 0x2e29c
+
+; returns carry if Pkmn Power can't be used.
+Peek_OncePerTurnCheck: ; 2e29c (b:629c)
+ ldh a, [hTempPlayAreaLocation_ff9d]
+ ldh [hTemp_ffa0], a
+ add DUELVARS_ARENA_CARD_FLAGS_C2
+ call GetTurnDuelistVariable
+ and USED_PKMN_POWER_THIS_TURN
+ jr nz, .already_used
+ ldh a, [hTempPlayAreaLocation_ff9d]
+ call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
+ ret
+.already_used
+ ldtx hl, OnlyOncePerTurnText
+ scf
+ ret
+; 0x2e2b4
+
+Peek_SelectEffect: ; 2e2b4 (b:62b4)
+; set Pkmn Power used flag
+ ldh a, [hTemp_ffa0]
+ add DUELVARS_ARENA_CARD_FLAGS_C2
+ call GetTurnDuelistVariable
+ set USED_PKMN_POWER_THIS_TURN_F, [hl]
+
+ ld a, DUELVARS_DUELIST_TYPE
+ call GetTurnDuelistVariable
+ cp DUELIST_TYPE_LINK_OPP
+ jr z, .link_opp
+ and DUELIST_TYPE_AI_OPP
+ jr nz, .ai_opp
+
+; player
+ call Func_3b31
+ call Func_30e7
+ ldh [hAIPkmnPowerEffectParam], a
+ call SerialSend8Bytes
+ ret
+
+.link_opp
+ call SerialRecv8Bytes
+ ldh [hAIPkmnPowerEffectParam], a
+
+.ai_opp
+ ldh a, [hAIPkmnPowerEffectParam]
+ bit AI_PEEK_TARGET_HAND_F, a
+ jr z, .prize_or_deck
+ and ~AI_PEEK_TARGET_HAND ; unset bit to get deck index
+; if masked value is higher than $40, then it means
+; that AI chose to look at Player's deck.
+; all deck indices will be smaller than $40.
+ cp $40
+ jr c, .hand
+ ldh a, [hAIPkmnPowerEffectParam]
+ jr .prize_or_deck
+
+.hand
+; AI chose to look at random card in hand,
+; so display it to the Player on screen.
+ call SwapTurn
+ ldtx hl, PeekWasUsedToLookInYourHandText
+ bank1call DisplayCardDetailScreen
+ call SwapTurn
+ ret
+
+.prize_or_deck
+; AI chose either a prize card or Player's top deck card,
+; so show Play Area and draw cursor appropriately.
+ call Func_3b31
+ call SwapTurn
+ ldh a, [hAIPkmnPowerEffectParam]
+ xor $80
+ call Func_30f9
+ call SwapTurn
+ ldtx hl, CardPeekWasUsedOnText
+ call DrawWideTextBox_WaitForInput
+ ret
+; 0x2e30f
+
+BoneAttackEffect: ; 2e30f (b:630f)
+ ldtx de, IfHeadsOpponentCannotAttackText
+ call TossCoin_BankB
+ ret nc
+ ld a, SUBSTATUS2_BONE_ATTACK
+ call ApplySubstatus2ToDefendingCard
+ ret
+; 0x2e31c
+
+; return carry if neither Play Area
+; has room for more Bench Pokemon.
+Wail_BenchCheck: ; 2e31c (b:631c)
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ cp MAX_PLAY_AREA_POKEMON
+ jr c, .no_carry
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetNonTurnDuelistVariable
+ cp MAX_PLAY_AREA_POKEMON
+ jr c, .no_carry
+ ldtx hl, NoSpaceOnTheBenchText
+ scf
+ ret
+.no_carry
+ or a
+ ret
+; 0x2e335
+
+Wail_FillBenchEffect: ; 2e335 (b:6335)
+ call SwapTurn
+ call .FillBench
+ call SwapTurn
+ call .FillBench
+
+; display both Play Areas
+ ldtx hl, BasicPokemonWasPlacedOnEachBenchText
+ call DrawWideTextBox_WaitForInput
+ bank1call HasAlivePokemonInPlayArea
+ bank1call OpenPlayAreaScreenForSelection
+ call SwapTurn
+ bank1call HasAlivePokemonInPlayArea
+ bank1call OpenPlayAreaScreenForSelection
+ call SwapTurn
+ ret
+
+.FillBench ; 2e35a (b:635a)
+ call CreateDeckCardList
+ ret c
+ ld hl, wDuelTempList
+ call ShuffleCards
+
+; if no more space in the Bench, then return.
+.check_bench
+ push hl
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ pop hl
+ cp MAX_PLAY_AREA_POKEMON
+ jr nc, .done
+
+; there's still space, so look for the next
+; Basic Pokemon card to put in the Bench.
+.loop
+ ld a, [hli]
+ ldh [hTempCardIndex_ff98], a
+ cp $ff
+ jr z, .done
+ call LoadCardDataToBuffer2_FromDeckIndex
+ ld a, [wLoadedCard2Type]
+ cp TYPE_ENERGY
+ jr nc, .loop ; is Pokemon card?
+ ld a, [wLoadedCard2Stage]
+ or a
+ jr nz, .loop ; is Basic?
+; place card in Bench
+ push hl
+ ldh a, [hTempCardIndex_ff98]
+ call SearchCardInDeckAndAddToHand
+ call AddCardToHand
+ call PutHandPokemonCardInPlayArea
+ pop hl
+ jr .check_bench
+
+.done
+ call Func_2c0bd
+ ret
+; 0x2e399
+
+ INCROM $2e399, $30000
diff --git a/src/text/text1.asm b/src/text/text1.asm
index e1985c1..031befb 100644
--- a/src/text/text1.asm
+++ b/src/text/text1.asm
@@ -1073,7 +1073,7 @@ VenomPowderCheckText: ; 37cdf (d:7cdf)
line "opponent is Poisoned & Confused."
done
-Text00e5: ; 37d1f (d:7d1f)
+IfTailsYourPokemonBecomesConfusedText: ; 37d1f (d:7d1f)
text "If Tails, your Pokémon"
line "becomes Confused."
done
@@ -1088,7 +1088,7 @@ Text00e7: ; 37d70 (d:7d70)
line "Draw 1 card from Deck!"
done
-Text00e8: ; 37d92 (d:7d92)
+FlipUntilFailAppears10DamageForEachHeadsText: ; 37d92 (d:7d92)
text "Flip until Tails appears."
line "10 damage for each Heads!!!"
done
diff --git a/src/text/text2.asm b/src/text/text2.asm
index 90e405f..d6a982b 100644
--- a/src/text/text2.asm
+++ b/src/text/text2.asm
@@ -32,7 +32,7 @@ IfHeadsDoNotReceiveDamageOrEffectText: ; 38124 (e:4124)
line "or effect of opponent's next Attack!"
done
-Text00fc: ; 3816a (e:416a)
+IfHeadsOpponentCannotAttackText: ; 3816a (e:416a)
text "If Heads, opponent cannot Attack"
line "next turn!"
done
@@ -237,7 +237,7 @@ ChooseAttackOpponentWillNotBeAbleToUseText: ; 38955 (e:4955)
line "not be able to use on the next turn."
done
-Text0125: ; 3899f (e:499f)
+ChooseBasicFightingPokemonFromDeckText: ; 3899f (e:499f)
text "Choose a Basic Fighting Pokémon"
line "from the Deck."
done
@@ -270,7 +270,7 @@ ChooseNidoranText: ; 38a61 (e:4a61)
line "or a Nidoran♂."
done
-Text012c: ; 38a83 (e:4a83)
+ChooseBasicFightingPokemonText: ; 38a83 (e:4a83)
text "Choose a Basic"
line "Fighting Pokémon"
done
@@ -441,7 +441,7 @@ KrabbyText: ; 392f0 (e:52f0)
text "Krabby"
done
-Text0143: ; 392f8 (e:52f8)
+FightingPokemonDeckText: ; 392f8 (e:52f8)
text "Fighting Pokémon"
done
@@ -449,12 +449,12 @@ Text0144: ; 3930a (e:530a)
text "Basic Energy"
done
-Text0145: ; 39318 (e:5318)
+PeekWasUsedToLookInYourHandText: ; 39318 (e:5318)
text "Peek was used to look at the"
line "<RAMTEXT> in your Hand."
done
-Text0146: ; 39346 (e:5346)
+CardPeekWasUsedOnText: ; 39346 (e:5346)
text "Card Peek was used on"
done
@@ -468,7 +468,7 @@ WasChosenForTheEffectOfAmnesiaText: ; 39392 (e:5392)
line "for the effect of Amnesia."
done
-Text0149: ; 393bb (e:53bb)
+BasicPokemonWasPlacedOnEachBenchText: ; 393bb (e:53bb)
text "A Basic Pokémon was placed"
line "on each Bench."
done
diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm
index f4cecee..728a110 100644
--- a/src/text/text_offsets.asm
+++ b/src/text/text_offsets.asm
@@ -230,10 +230,10 @@ TextOffsets:: ; 34000 (d:4000)
textpointer PoisonCheckText ; 0x00e2
textpointer ConfusionCheckText ; 0x00e3
textpointer VenomPowderCheckText ; 0x00e4
- textpointer Text00e5 ; 0x00e5
+ textpointer IfTailsYourPokemonBecomesConfusedText ; 0x00e5
textpointer DamageCheckIfTailsNoDamageText ; 0x00e6
textpointer Text00e7 ; 0x00e7
- textpointer Text00e8 ; 0x00e8
+ textpointer FlipUntilFailAppears10DamageForEachHeadsText ; 0x00e8
textpointer IfHeadPlus10IfTails10ToYourselfText ; 0x00e9
textpointer DamageToOppBenchIfHeadsDamageToYoursIfTailsText ; 0x00ea
textpointer IfHeadsChangeOpponentsActivePokemonText ; 0x00eb
@@ -253,7 +253,7 @@ TextOffsets:: ; 34000 (d:4000)
textpointer PokemonsSleepCheckText ; 0x00f9
textpointer PoisonedIfHeadsConfusedIfTailsText ; 0x00fa
textpointer IfHeadsDoNotReceiveDamageOrEffectText ; 0x00fb
- textpointer Text00fc ; 0x00fc
+ textpointer IfHeadsOpponentCannotAttackText ; 0x00fc
textpointer AttackUnsuccessfulText ; 0x00fd
textpointer UnableToRetreatDueToAcidText ; 0x00fe
textpointer UnableToUseTrainerDueToHeadacheText ; 0x00ff
@@ -294,14 +294,14 @@ TextOffsets:: ; 34000 (d:4000)
textpointer ChooseAKrabbyFromDeckText ; 0x0122
textpointer ChooseDiscardEnergyCardFromOpponentText ; 0x0123
textpointer ChooseAttackOpponentWillNotBeAbleToUseText ; 0x0124
- textpointer Text0125 ; 0x0125
+ textpointer ChooseBasicFightingPokemonFromDeckText ; 0x0125
textpointer ChooseAnOddishFromDeckText ; 0x0126
textpointer ChooseAnOddishText ; 0x0127
textpointer ChooseAKrabbyText ; 0x0128
textpointer Text0129 ; 0x0129
textpointer ChooseNidoranFromDeckText ; 0x012a
textpointer ChooseNidoranText ; 0x012b
- textpointer Text012c ; 0x012c
+ textpointer ChooseBasicFightingPokemonText ; 0x012c
textpointer ProcedureForEnergyTransferText ; 0x012d
textpointer ChooseABellsproutFromDeckText ; 0x012e
textpointer ChooseABellsproutText ; 0x012f
@@ -324,13 +324,13 @@ TextOffsets:: ; 34000 (d:4000)
textpointer OddishText ; 0x0140
textpointer BellsproutText ; 0x0141
textpointer KrabbyText ; 0x0142
- textpointer Text0143 ; 0x0143
+ textpointer FightingPokemonDeckText ; 0x0143
textpointer Text0144 ; 0x0144
- textpointer Text0145 ; 0x0145
- textpointer Text0146 ; 0x0146
+ textpointer PeekWasUsedToLookInYourHandText ; 0x0145
+ textpointer CardPeekWasUsedOnText ; 0x0146
textpointer Text0147 ; 0x0147
textpointer WasChosenForTheEffectOfAmnesiaText ; 0x0148
- textpointer Text0149 ; 0x0149
+ textpointer BasicPokemonWasPlacedOnEachBenchText ; 0x0149
textpointer WasUnsuccessfulText ; 0x014a
textpointer ThereWasNoEffectFromTxRam2Text ; 0x014b
textpointer Text014c ; 0x014c