summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2020-06-04 16:28:16 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2020-12-16 00:24:21 +0000
commit75fa5549f3a5e7fe5a690454852559e6e1705cb1 (patch)
tree710a640c330f9b4c83d0a4ddc67ae2e5bd6a3854
parent046cb28bde1c0d6716380f83e26df4a568d7691c (diff)
Lightning attack effects
-rw-r--r--src/constants/charmaps.asm1
-rw-r--r--src/constants/deck_ai_constants.asm3
-rw-r--r--src/constants/duel_constants.asm4
-rw-r--r--src/data/effect_commands.asm106
-rw-r--r--src/engine/bank05.asm22
-rw-r--r--src/engine/bank08.asm8
-rw-r--r--src/engine/effect_functions.asm1160
-rw-r--r--src/engine/home.asm12
-rw-r--r--src/hram.asm19
-rw-r--r--src/text/text1.asm4
-rw-r--r--src/text/text2.asm12
-rw-r--r--src/text/text_offsets.asm16
-rw-r--r--src/wram.asm10
13 files changed, 1227 insertions, 150 deletions
diff --git a/src/constants/charmaps.asm b/src/constants/charmaps.asm
index baa3f46..f87e841 100644
--- a/src/constants/charmaps.asm
+++ b/src/constants/charmaps.asm
@@ -94,6 +94,7 @@ ENDM
fwcharmap 3, "\", $98
fwcharmap 3, "┐", $99
fwcharmap 3, "|", $9a
+ fwcharmap 3, " ", $9c
fwcharmap 3, "!", $9d
fwcharmap 3, "#", $9f
fwcharmap 3, "$", $a0
diff --git a/src/constants/deck_ai_constants.asm b/src/constants/deck_ai_constants.asm
index a10729c..52b0283 100644
--- a/src/constants/deck_ai_constants.asm
+++ b/src/constants/deck_ai_constants.asm
@@ -42,7 +42,8 @@ AI_ENERGY_FLAG_SKIP_ARENA_CARD EQU 1 << 7 ; whether to include Arena card in det
; used by wAIBarrierFlagCounter to determine
; whether Player is running Mewtwo1 mill deck.
; flag set means true, flag not set means false.
-AI_FLAG_MEWTWO_MILL EQU 1 << 7
+AI_MEWTWO_MILL_F EQU 7
+AI_MEWTWO_MILL EQU 1 << AI_MEWTWO_MILL_F
; defines the behaviour of HandleAIEnergyTrans, for determining
; whether to move energy cards from the Bench to the Arena or vice-versa
diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm
index 028cc10..a9ff54b 100644
--- a/src/constants/duel_constants.asm
+++ b/src/constants/duel_constants.asm
@@ -178,6 +178,10 @@ CAN_EVOLVE_THIS_TURN EQU 1 << CAN_EVOLVE_THIS_TURN_F
HAS_CHANGED_COLOR_F EQU 7
HAS_CHANGED_COLOR EQU 1 << HAS_CHANGED_COLOR_F
+; flag in wDamage + 1 that indicates
+; whether damage is unaffected by Weakness/Resistance
+UNAFFECTED_BY_WEAKNESS_RESISTANCE_F EQU 7
+
; effect command constants (TryExecuteEffectCommandFunction)
; ordered by (roughly) execution time
EFFECTCMDTYPE_INITIAL_EFFECT_1 EQU $01
diff --git a/src/data/effect_commands.asm b/src/data/effect_commands.asm
index f4a7740..508d80b 100644
--- a/src/data/effect_commands.asm
+++ b/src/data/effect_commands.asm
@@ -200,7 +200,7 @@ NidoranFCallForFamilyEffectCommands:
db $00
NidoranMHornHazardEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, HornHazard_Failure50PercentEffect
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, HornHazard_Success50PercentEffect
dbw EFFECTCMDTYPE_AI, HornHazard_AIEffect
db $00
@@ -613,7 +613,7 @@ MoltresWildfireEffectCommands:
db $00
Moltres1DiveBombEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Moltres1DiveBomb_Failure50PercentEffect
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Moltres1DiveBomb_Success50PercentEffect
dbw EFFECTCMDTYPE_AI, Moltres1DiveBomb_AIEffect
db $00
@@ -687,7 +687,7 @@ MoltresFiregiverEffectCommands:
db $00
Moltres2DiveBombEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Moltres2DiveBomb_Failure50PercentEffect
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Moltres2DiveBomb_Success50PercentEffect
dbw EFFECTCMDTYPE_AI, Moltres2DiveBomb_AIEffect
db $00
@@ -841,7 +841,7 @@ SlowbroPsyshockEffectCommands:
SlowpokeSpacingOutEffectCommands:
dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, SpacingOut_CheckDamage
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SpacingOut_Failure50PercentEffect
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SpacingOut_Success50PercentEffect
dbw EFFECTCMDTYPE_AFTER_DAMAGE, SpacingOut_HealEffect
db $00
@@ -1006,18 +1006,18 @@ ElectabuzzThundershockEffectCommands:
db $00
ElectabuzzThunderpunchEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $63a1
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $63b0
- dbw EFFECTCMDTYPE_AI, $6399
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Thunderpunch_ModifierEffect
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, Thunderpunch_RecoilEffect
+ dbw EFFECTCMDTYPE_AI, Thunderpunch_AIEffect
db $00
ElectabuzzLightScreenEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $63ba
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, LightScreenEffect
db $00
ElectabuzzQuickAttackEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $63c8
- dbw EFFECTCMDTYPE_AI, $63c0
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ElectabuzzQuickAttack_DamageBoostEffect
+ dbw EFFECTCMDTYPE_AI, ElectabuzzQuickAttack_AIEffect
db $00
MagnemiteThunderWaveEffectCommands:
@@ -1025,30 +1025,30 @@ MagnemiteThunderWaveEffectCommands:
db $00
MagnemiteSelfdestructEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $63db
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, MagnemiteSelfdestructEffect
db $00
ZapdosThunderEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $63fa
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6409
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ZapdosThunder_Recoil50PercentEffect
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, ZapdosThunder_RecoilEffect
db $00
ZapdosThunderboltEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6419
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ThunderboltEffect
db $00
ZapdosThunderstormEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6429
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, ThunderstormEffect
db $00
JolteonQuickAttackEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $64c3
- dbw EFFECTCMDTYPE_AI, $64bb
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, JolteonQuickAttack_DamageBoostEffect
+ dbw EFFECTCMDTYPE_AI, JolteonQuickAttack_AIEffect
db $00
JolteonPinMissileEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $64de
- dbw EFFECTCMDTYPE_AI, $64d6
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PinMissile_MultiplierEffect
+ dbw EFFECTCMDTYPE_AI, PinMissile_AIEffect
db $00
FlyingPikachuThundershockEffectCommands:
@@ -1056,23 +1056,23 @@ FlyingPikachuThundershockEffectCommands:
db $00
FlyingPikachuFlyEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $64fc
- dbw EFFECTCMDTYPE_AI, $64f4
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Fly_Success50PercentEffect
+ dbw EFFECTCMDTYPE_AI, Fly_AIEffect
db $00
PikachuThunderJoltEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $651a
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6529
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ThunderJolt_Recoil50PercentEffect
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, ThunderJolt_RecoilEffect
db $00
PikachuSparkEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6574
- dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6539
- dbw EFFECTCMDTYPE_AI_SELECTION, $6562
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, Spark_BenchDamageEffect
+ dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Spark_PlayerSelectEffect
+ dbw EFFECTCMDTYPE_AI_SELECTION, Spark_AISelectEffect
db $00
Pikachu3GrowlEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6589
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Pikachu3GrowlEffect
db $00
Pikachu3ThundershockEffectCommands:
@@ -1080,7 +1080,7 @@ Pikachu3ThundershockEffectCommands:
db $00
Pikachu4GrowlEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $658f
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Pikachu4GrowlEffect
db $00
Pikachu4ThundershockEffectCommands:
@@ -1088,22 +1088,22 @@ Pikachu4ThundershockEffectCommands:
db $00
ElectrodeChainLightningEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6595
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, ChainLightningEffect
db $00
RaichuAgilityEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $65dc
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, RaichuAgilityEffect
db $00
RaichuThunderEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $65ee
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $65fd
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, RaichuThunder_Recoil50PercentEffect
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, RaichuThunder_RecoilEffect
db $00
RaichuGigashockEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $671f
- dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $660d
- dbw EFFECTCMDTYPE_AI_SELECTION, $66c3
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, Gigashock_BenchDamageEffect
+ dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Gigashock_PlayerSelectEffect
+ dbw EFFECTCMDTYPE_AI_SELECTION, Gigashock_AISelectEffect
db $00
MagnetonThunderWaveEffectCommands:
@@ -1111,48 +1111,48 @@ MagnetonThunderWaveEffectCommands:
db $00
Magneton1SelfdestructEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6739
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, Magneton1SelfdestructEffect
db $00
MagnetonSonicboomEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6758
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $675e
- dbw EFFECTCMDTYPE_AI, $6758
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, MagnetonSonicboom_UnaffectedByColorEffect
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, MagnetonSonicboom_NullEffect
+ dbw EFFECTCMDTYPE_AI, MagnetonSonicboom_UnaffectedByColorEffect
db $00
Magneton2SelfdestructEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $675f
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, Magneton2SelfdestructEffect
db $00
ZapdosPealOfThunderEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $677e
- dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, $6780
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PealOfThunder_InitialEffect
+ dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, PealOfThunder_RandomlyDamageEffect
db $00
ZapdosBigThunderEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $67cb
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, BigThunderEffect
db $00
MagnemiteMagneticStormEffectCommands:
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $67d5
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, MagneticStormEffect
db $00
ElectrodeSonicboomEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6870
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6876
- dbw EFFECTCMDTYPE_AI, $6870
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ElectrodeSonicboom_UnaffectedByColorEffect
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, ElectrodeSonicboom_NullEffect
+ dbw EFFECTCMDTYPE_AI, ElectrodeSonicboom_UnaffectedByColorEffect
db $00
ElectrodeEnergySpikeEffectCommands:
- dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6877
- dbw EFFECTCMDTYPE_AFTER_DAMAGE, $68f6
- dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $687b
- dbw EFFECTCMDTYPE_AI_SELECTION, $68f1
+ dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, EnergySpike_DeckCheck
+ dbw EFFECTCMDTYPE_AFTER_DAMAGE, EnergySpike_AttachEnergyEffect
+ dbw EFFECTCMDTYPE_REQUIRE_SELECTION, EnergySpike_PlayerSelectEffect
+ dbw EFFECTCMDTYPE_AI_SELECTION, EnergySpike_AISelectEffect
db $00
JolteonDoubleKickEffectCommands:
- dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6938
- dbw EFFECTCMDTYPE_AI, $6930
+ dbw EFFECTCMDTYPE_BEFORE_DAMAGE, JolteonDoubleKick_MultiplierEffect
+ dbw EFFECTCMDTYPE_AI, JolteonDoubleKick_AIEffect
db $00
JolteonStunNeedleEffectCommands:
diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm
index 708bfd9..0855131 100644
--- a/src/engine/bank05.asm
+++ b/src/engine/bank05.asm
@@ -866,11 +866,9 @@ _CalculateDamage_VersusDefendingPokemon: ; 14462 (5:4462)
ldh a, [hTempPlayAreaLocation_ff9d]
or a
call z, HandleDoubleDamageSubstatus
- ; skips the weak/res checks if bit 7 is set
- ; I guess to avoid overflowing?
- ; should probably just have skipped weakness test instead?
- bit 7, d
- res 7, d
+ ; skips the weak/res checks if unaffected.
+ bit UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d
+ res UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d
jr nz, .not_resistant
; handle weakness
@@ -1083,8 +1081,8 @@ CalculateDamage_FromDefendingPokemon: ; 1458c (5:458c)
call SwapTurn
call HandleDoubleDamageSubstatus
- bit 7, d
- res 7, d
+ bit UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d
+ res UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d
jr nz, .not_resistant
; handle weakness
@@ -1339,7 +1337,7 @@ InitAITurnVars: ; 15649 (5:5649)
; check if flag was already set, if so,
; reset wAIBarrierFlagCounter to $80.
ld a, [wAIBarrierFlagCounter]
- bit 7, a
+ bit AI_MEWTWO_MILL_F, a
jr nz, .set_flag
; if not, increase it by 1 and check if it exceeds 2.
@@ -1369,14 +1367,14 @@ InitAITurnVars: ; 15649 (5:5649)
jr .done
.set_flag
- ld a, AI_FLAG_MEWTWO_MILL + 0
+ ld a, AI_MEWTWO_MILL
ld [wAIBarrierFlagCounter], a
jr .done
.check_flag
; increase counter by 1 if flag is set
ld a, [wAIBarrierFlagCounter]
- bit 7, a
+ bit AI_MEWTWO_MILL_F, a
jr z, .reset_2
inc a
ld [wAIBarrierFlagCounter], a
@@ -4089,7 +4087,7 @@ AIProcessEnergyCards: ; 164fc (5:64fc)
; arena
ld a, [wAIBarrierFlagCounter]
- bit 7, a
+ bit AI_MEWTWO_MILL_F, a
jr z, .add_to_score
; subtract from score instead
@@ -5019,7 +5017,7 @@ AIProcessAttacks: ; 169fc (5:69fc)
; if Player is running Mewtwo1 mill deck,
; skip attack if Barrier counter is 0.
ld a, [wAIBarrierFlagCounter]
- cp AI_FLAG_MEWTWO_MILL + 0
+ cp AI_MEWTWO_MILL + 0
jp z, .dont_attack
; determine AI score of both attacks.
diff --git a/src/engine/bank08.asm b/src/engine/bank08.asm
index fc81d90..5360e25 100644
--- a/src/engine/bank08.asm
+++ b/src/engine/bank08.asm
@@ -4626,7 +4626,7 @@ AIDecide_Gambler: ; 21875 (8:5875)
; check if flag is set for Player using Mewtwo1 only deck
ld a, [wAIBarrierFlagCounter]
- and AI_FLAG_MEWTWO_MILL
+ and AI_MEWTWO_MILL
jr z, .no_carry
; set carry if number of cards in deck <= 4.
@@ -6637,7 +6637,7 @@ HandleAIHeal: ; 22402 (8:6402)
ld a, OPPACTION_USE_PKMN_POWER
bank1call AIMakeDecision
pop af
- ldh [hAIHealCard], a
+ ldh [hPkmnPowerPlayAreaTarget], a
ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT
bank1call AIMakeDecision
ld a, OPPACTION_DUEL_MAIN_SCENE
@@ -7380,12 +7380,12 @@ CheckIfPlayerHasPokemonOtherThanMewtwo1: ; 227a9 (8:67a9)
HandleAIAntiMewtwoDeckStrategy: ; 227d3 (8:67d3)
; return carry if Player is not playing Mewtwo1 mill deck
ld a, [wAIBarrierFlagCounter]
- bit 7, a
+ bit AI_MEWTWO_MILL_F, a
jr z, .set_carry
; else, check if there's been less than 2 turns
; without the Player using Barrier.
- cp AI_FLAG_MEWTWO_MILL + 2
+ cp AI_MEWTWO_MILL + 2
jr c, .count_bench
; if there has been, reset wAIBarrierFlagCounter
diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm
index 3a4182f..70817c0 100644
--- a/src/engine/effect_functions.asm
+++ b/src/engine/effect_functions.asm
@@ -228,7 +228,7 @@ DealDamageToAllBenchedPokemon: ; 2c117 (b:4117)
jr .skip_to_bench
.loop
push bc
- call DealDamageToPlayAreaPokemon
+ call DealDamageToPlayAreaPokemon_RegularAnim
pop bc
.skip_to_bench
inc b
@@ -311,7 +311,7 @@ PickRandomPlayAreaCard: ; 2c17e (b:417e)
; 0x2c188
; outputs in hl the current position
-; in hTempCardList list to place a new card.
+; in hTempList list to place a new card.
GetCurPositionInTempList: ; 2c188 (b:4188)
push de
ld hl, hEffectItemSelection
@@ -319,7 +319,7 @@ GetCurPositionInTempList: ; 2c188 (b:4188)
inc [hl]
ld e, a
ld d, $00
- ld hl, hTempCardList
+ ld hl, hTempList
add hl, de
pop de
ret
@@ -1429,7 +1429,14 @@ PlayAreaSelectionMenuParameters: ; 2c6e0 (b:46e0)
dw $0000 ; function pointer if non-0
; 0x2c6e8
- INCROM $2c6e8, $2c6f0
+BenchSelectionMenuParameters: ; 2c6e8 (b:46e8)
+ db 0, 3 ; cursor x, cursor y
+ db 3 ; y displacement between items
+ db MAX_PLAY_AREA_POKEMON ; number of items
+ db SYM_CURSOR_R ; cursor tile number
+ db SYM_SPACE ; tile behind cursor
+ dw $0000 ; function pointer if non-0
+; 0x2c6f0
SpitPoison_AIEffect: ; 2c6f0 (b:46f0)
ld a, 10 / 2
@@ -2077,7 +2084,7 @@ HornHazard_AIEffect: ; 2ca8e (b:4a8e)
jp StoreAIDamageInfo
; 0x2ca96
-HornHazard_Failure50PercentEffect: ; 2ca96 (b:4a96)
+HornHazard_Success50PercentEffect: ; 2ca96 (b:4a96)
ldtx de, DamageCheckIfTailsNoDamageText
call TossCoin_BankB
jr c, .heads
@@ -3631,7 +3638,7 @@ IceBreath_RandomPokemonDamageEffect: ; 2d32e (b:532e)
call PickRandomPlayAreaCard
ld b, a
ld de, 40
- call DealDamageToPlayAreaPokemon
+ call DealDamageToPlayAreaPokemon_RegularAnim
call SwapTurn
ret
; 0x2d33f
@@ -3651,14 +3658,14 @@ PlayerPickFireEnergyCardToDiscard: ; 2d34b (b:534b)
bank1call DisplayEnergyDiscardScreen
bank1call HandleEnergyDiscardMenuInput
ldh a, [hTempCardIndex_ff98]
- ldh [hTempCardList], a
+ ldh [hTempList], a
ret
; 0x2d35a
AIPickFireEnergyCardToDiscard: ; 2d35a (b:535a)
call CreateListOfFireEnergyAttachedToArena
ld a, [wDuelTempList]
- ldh [hTempCardList], a ; pick first in list
+ ldh [hTempList], a ; pick first in list
ret
; 0x2d363
@@ -3683,7 +3690,7 @@ ArcanineFlamethrower_AISelectEffect: ; 2d375 (b:5375)
; 0x2d379
ArcanineFlamethrower_DiscardEffect: ; 2d379 (b:5379)
- ldh a, [hTempCardList]
+ ldh a, [hTempList]
call PutCardInDiscardPile
ret
; 0x2d37f
@@ -3747,14 +3754,14 @@ FlamesOfRage_PlayerSelectEffect: ; 2d3ae (b:53ae)
FlamesOfRage_AISelectEffect: ; 2d3d5 (b:53d5)
call AIPickFireEnergyCardToDiscard
ld a, [wDuelTempList + 1]
- ldh [hTempCardList + 1], a
+ ldh [hTempList + 1], a
ret
; 0x2d3de
FlamesOfRage_DiscardEffect: ; 2d3de (b:53de)
- ldh a, [hTempCardList]
+ ldh a, [hTempList]
call PutCardInDiscardPile
- ldh a, [hTempCardList + 1]
+ ldh a, [hTempList + 1]
call PutCardInDiscardPile
ret
; 0x2d3e9
@@ -3861,7 +3868,7 @@ FireBlast_AISelectEffect: ; 2d475 (b:5475)
; 0x2d479
FireBlast_DiscardEffect: ; 2d479 (b:5479)
- ldh a, [hTempCardList]
+ ldh a, [hTempList]
call PutCardInDiscardPile
ret
; 0x2d47f
@@ -3887,7 +3894,7 @@ Ember_AISelectEffect: ; 2d491 (b:5491)
; 0x2d495
Ember_DiscardEffect: ; 2d495 (b:5495)
- ldh a, [hTempCardList]
+ ldh a, [hTempList]
call PutCardInDiscardPile
ret
; 0x2d49b
@@ -3943,7 +3950,7 @@ Wildfire_PlayerSelectEffect: ; 2d4a9 (b:54a9)
Wildfire_AISelectEffect: ; 2d4dd (b:54dd)
; AI always chooses 0 cards to discard
xor a
- ldh [hTempCardList], a
+ ldh [hTempList], a
ret
; 0x2d4e1
@@ -4009,7 +4016,7 @@ Moltres1DiveBomb_AIEffect: ; 2d523 (b:5523)
jp StoreAIDamageInfo
; 0x2d52b
-Moltres1DiveBomb_Failure50PercentEffect: ; 2d52b (b:552b)
+Moltres1DiveBomb_Success50PercentEffect: ; 2d52b (b:552b)
ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText
call TossCoin_BankB
jr c, .heads
@@ -4062,7 +4069,7 @@ FlareonFlamethrower_AISelectEffect: ; 2d56e (b:556e)
; 0x2d572
FlareonFlamethrower_DiscardEffect: ; 2d572 (b:5572)
- ldh a, [hTempCardList]
+ ldh a, [hTempList]
call PutCardInDiscardPile
ret
; 0x2d578
@@ -4088,7 +4095,7 @@ MagmarFlamethrower_AISelectEffect: ; 2d58a (b:558a)
; 0x2d58e
MagmarFlamethrower_DiscardEffect: ; 2d58e (b:558e)
- ldh a, [hTempCardList]
+ ldh a, [hTempList]
call PutCardInDiscardPile
ret
; 0x2d594
@@ -4126,7 +4133,7 @@ CharmeleonFlamethrower_AISelectEffect: ; 2d5b4 (b:55b4)
; 0x2d5b8
CharmeleonFlamethrower_DiscardEffect: ; 2d5b8 (b:55b8)
- ldh a, [hTempCardList]
+ ldh a, [hTempList]
call PutCardInDiscardPile
ret
; 0x2d5be
@@ -4186,14 +4193,14 @@ FireSpin_AISelectEffect: ; 2d606 (b:5606)
call CreateArenaOrBenchEnergyCardList
ld hl, wDuelTempList
ld a, [hli]
- ldh [hTempCardList], a
+ ldh [hTempList], a
ld a, [hl]
- ldh [hTempCardList + 1], a
+ ldh [hTempList + 1], a
ret
; 0x2d614
FireSpin_DiscardEffect: ; 2d614 (b:5614)
- ld hl, hTempCardList
+ ld hl, hTempList
ld a, [hli]
call PutCardInDiscardPile
ld a, [hli]
@@ -4454,7 +4461,7 @@ Moltres2DiveBomb_AIEffect: ; 2d76e (b:576e)
jp StoreAIDamageInfo
; 0x2d776
-Moltres2DiveBomb_Failure50PercentEffect: ; 2d776 (b:5776)
+Moltres2DiveBomb_Success50PercentEffect: ; 2d776 (b:5776)
ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText
call TossCoin_BankB
jr c, .heads
@@ -4514,7 +4521,7 @@ GetEnergyAttachedMultiplierDamage: ; 2d78c (b:578c)
; for Player to select from.
; the Player can select up to 2 cards from the list.
; these cards are given in $ff-terminated list
-; in hTempCardList.
+; in hTempList.
HandleEnergyCardsInDiscardPileSelection: ; 2d7bc (b:57bc)
push hl
xor a
@@ -4696,7 +4703,7 @@ Curse_PlayerSelectEffect: ; 2d834 (b:5834)
Curse_TransferDamageEffect: ; 2d8bb (b:58bb)
; set Pkmn Power as used
- ldh a, [hTempCardList]
+ ldh a, [hTempList]
add DUELVARS_ARENA_CARD_FLAGS_C2
call GetTurnDuelistVariable
set USED_PKMN_POWER_THIS_TURN_F, [hl]
@@ -4788,7 +4795,7 @@ GengarDarkMind_DamageBenchEffect: ; 2d93c (b:593c)
call SwapTurn
ld b, a
ld de, 10
- call DealDamageToPlayAreaPokemon
+ call DealDamageToPlayAreaPokemon_RegularAnim
call SwapTurn
ret
; 0x2d94f
@@ -4817,7 +4824,7 @@ DestinyBond_PlayerSelectEffect: ; 2d964 (b:5964)
bank1call HandleEnergyDiscardMenuInput
ret c
ldh a, [hTempCardIndex_ff98]
- ldh [hTempCardList], a
+ ldh [hTempList], a
ret
; 0x2d976
@@ -4826,12 +4833,12 @@ DestinyBond_AISelectEffect: ; 2d976 (b:5976)
ld a, TYPE_ENERGY_PSYCHIC
call CreateListOfEnergyAttachedToArena
ld a, [wDuelTempList]
- ldh [hTempCardList], a
+ ldh [hTempList], a
ret
; 0x2d981
DestinyBond_DiscardEffect: ; 2d981 (b:5981)
- ldh a, [hTempCardList]
+ ldh a, [hTempList]
call PutCardInDiscardPile
ret
; 0x2d987
@@ -4858,7 +4865,7 @@ EnergyConversion_PlayerSelectEffect: ; 2d994 (b:5994)
EnergyConversion_AISelectEffect: ; 2d99b (b:599b)
call CreateEnergyCardListFromDiscardPile_OnlyBasic
ld hl, wDuelTempList
- ld de, hTempCardList
+ ld de, hTempList
ld c, 2
; select the first two energy cards found in Discard Pile
.loop
@@ -4883,7 +4890,7 @@ EnergyConversion_AddToHandEffect: ; 2d9b4 (b:59b4)
; loop cards that were chosen
; until $ff is reached,
; and move them to the hand.
- ld hl, hTempCardList
+ ld hl, hTempList
ld de, wDuelTempList
.loop_cards
ld a, [hli]
@@ -4951,7 +4958,7 @@ Prophecy_PlayerSelectEffect: ; 2da00 (b:5a00)
jr nz, Prophecy_PlayerSelectEffect ; loop back to start
ldh a, [hCurMenuItem]
- ldh [hTempCardList], a ; store selection in first position in list
+ ldh [hTempList], a ; store selection in first position in list
or a
jr z, .turn_duelist
@@ -4983,7 +4990,7 @@ Prophecy_AISelectEffect: ; 2da3c (b:5a3c)
; 0x2da41
Prophecy_ReorderDeckEffect: ; 2da41 (b:5a41)
- ld hl, hTempCardList
+ ld hl, hTempList
ld a, [hli]
or a
jr z, .ReorderCards ; turn duelist's deck
@@ -5028,7 +5035,7 @@ Prophecy_ReorderDeckEffect: ; 2da41 (b:5a41)
; draw and handle Player selection for reordering
; the top 3 cards of Deck.
-; the resulting list is output in order in hTempCardList.
+; the resulting list is output in order in hTempList.
HandleProphecyScreen: ; 2da76 (b:5a76)
ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
call GetTurnDuelistVariable
@@ -5117,7 +5124,7 @@ HandleProphecyScreen: ; 2da76 (b:5a76)
call YesOrNoMenuWithText_LeftAligned
jr c, .start ; if not, return back to beginning of selection
-; write in hTempCardList the card list
+; write in hTempList the card list
; in order that was selected.
ld hl, wDuelTempList + 10
ld de, wDuelTempList
@@ -5130,7 +5137,7 @@ HandleProphecyScreen: ; 2da76 (b:5a76)
push bc
ld c, a
ld b, $00
- ld hl, hTempCardList
+ ld hl, hTempList
add hl, bc
ld a, [de]
ld [hl], a
@@ -5139,12 +5146,12 @@ HandleProphecyScreen: ; 2da76 (b:5a76)
inc de
inc c
jr .loop_order
-; now hTempCardList has the list of card deck indices
+; now hTempList has the list of card deck indices
; in the order selected to be place on top of the deck.
.done
ld b, $00
- ld hl, hTempCardList + 1
+ ld hl, hTempList + 1
add hl, bc
ld [hl], $ff ; terminating byte
or a
@@ -5218,7 +5225,7 @@ HypnoDarkMind_DamageBenchEffect: ; 2db64 (b:5b64)
call SwapTurn
ld b, a
ld de, 10
- call DealDamageToPlayAreaPokemon
+ call DealDamageToPlayAreaPokemon_RegularAnim
call SwapTurn
ret
; 0x2db77
@@ -5696,7 +5703,7 @@ Mewtwo3EnergyAbsorption_AISelectEffect: ; 2ddd3 (b:5dd3)
; AI picks first 2 energy cards
call CreateEnergyCardListFromDiscardPile_OnlyBasic
ld hl, wDuelTempList
- ld de, hTempCardList
+ ld de, hTempList
ld c, 2
.loop
ld a, [hli]
@@ -5713,7 +5720,7 @@ Mewtwo3EnergyAbsorption_AISelectEffect: ; 2ddd3 (b:5dd3)
; 0x2ddec
Mewtwo3EnergyAbsorption_AddToHandEffect: ; 2ddec (b:5dec)
- ld hl, hTempCardList
+ ld hl, hTempList
.loop
ld a, [hli]
cp $ff
@@ -5742,7 +5749,7 @@ Mewtwo2EnergyAbsorption_AISelectEffect: ; 2de0d (b:5e0d)
; AI picks first 2 energy cards
call CreateEnergyCardListFromDiscardPile_OnlyBasic
ld hl, wDuelTempList
- ld de, hTempCardList
+ ld de, hTempList
ld c, 2
.loop
ld a, [hli]
@@ -5759,7 +5766,7 @@ Mewtwo2EnergyAbsorption_AISelectEffect: ; 2de0d (b:5e0d)
; 0x2de26
Mewtwo2EnergyAbsorption_AddToHandEffect: ; 2de26 (b:5e26)
- ld hl, hTempCardList
+ ld hl, hTempList
.loop
ld a, [hli]
cp $ff
@@ -5894,7 +5901,7 @@ SpacingOut_CheckDamage: ; 2ded5 (b:5ed5)
ret
; 0x2dee0
-SpacingOut_Failure50PercentEffect: ; 2dee0 (b:5ee0)
+SpacingOut_Success50PercentEffect: ; 2dee0 (b:5ee0)
ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText
call TossCoin_BankB
ldh [hTemp_ffa0], a
@@ -6523,7 +6530,7 @@ StretchKick_BenchDamageEffect: ; 2e25b (b:625b)
ldh a, [hTemp_ffa0]
ld b, a
ld de, 20
- call DealDamageToPlayAreaPokemon
+ call DealDamageToPlayAreaPokemon_RegularAnim
call SwapTurn
ret
; 0x2e26b
@@ -6611,7 +6618,7 @@ Peek_SelectEffect: ; 2e2b4 (b:62b4)
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
+ and (~AI_PEEK_TARGET_HAND & $ff) ; 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.
@@ -6731,4 +6738,1063 @@ Wail_FillBenchEffect: ; 2e335 (b:6335)
ret
; 0x2e399
- INCROM $2e399, $30000
+Thunderpunch_AIEffect: ; 2e399 (b:6399)
+ ld a, (30 + 40) / 2
+ lb de, 30, 40
+ jp StoreAIDamageInfo
+; 0x2e3a1
+
+Thunderpunch_ModifierEffect: ; 2e3a1 (b:63a1)
+ ldtx de, IfHeadPlus10IfTails10ToYourselfText
+ call TossCoin_BankB
+ ldh [hTemp_ffa0], a
+ ret nc ; return if got tails
+ ld a, 10
+ call AddToDamage
+ ret
+; 0x2e3b0
+
+Thunderpunch_RecoilEffect: ; 2e3b0 (b:63b0)
+ ldh a, [hTemp_ffa0]
+ or a
+ ret nz ; return if got heads
+ ld a, 10
+ call DealRecoilDamageToSelf
+ ret
+; 0x2e3ba
+
+LightScreenEffect: ; 2e3ba (b:63ba)
+ ld a, SUBSTATUS1_HALVE_DAMAGE
+ call ApplySubstatus1ToDefendingCard
+ ret
+; 0x2e3c0
+
+ElectabuzzQuickAttack_AIEffect: ; 2e3c0 (b:63c0)
+ ld a, (10 + 30) / 2
+ lb de, 10, 30
+ jp StoreAIDamageInfo
+; 0x2e3c8
+
+ElectabuzzQuickAttack_DamageBoostEffect: ; 2e3c8 (b:63c8)
+ ld hl, 20
+ call LoadTxRam3
+ ldtx de, DamageCheckIfHeadsPlusDamageText
+ call TossCoin_BankB
+ ret nc ; return if tails
+ ld a, 20
+ call AddToDamage
+ ret
+; 0x2e3db
+
+MagnemiteSelfdestructEffect: ; 2e3db (b:63db)
+ ld a, 40
+ call DealRecoilDamageToSelf
+
+ ld a, $01
+ ld [wIsDamageToSelf], a
+ ld a, 10
+ call DealDamageToAllBenchedPokemon
+ call SwapTurn
+
+ xor a
+ ld [wIsDamageToSelf], a
+ ld a, 10
+ call DealDamageToAllBenchedPokemon
+ call SwapTurn
+ ret
+; 0x2e3fa
+
+ZapdosThunder_Recoil50PercentEffect: ; 2e3fa (b:63fa)
+ ld hl, 30
+ call LoadTxRam3
+ ldtx de, IfTailsDamageToYourselfTooText
+ call TossCoin_BankB
+ ldh [hTemp_ffa0], a
+ ret
+; 0x2e409
+
+ZapdosThunder_RecoilEffect: ; 2e409 (b:6409)
+ ld hl, 30
+ call LoadTxRam3
+ ldh a, [hTemp_ffa0]
+ or a
+ ret nz ; return if got heads
+ ld a, 30
+ call DealRecoilDamageToSelf
+ ret
+; 0x2e419
+
+ThunderboltEffect: ; 2e419 (b:6419)
+ xor a
+ call CreateArenaOrBenchEnergyCardList
+ ld hl, wDuelTempList
+; put all energy cards in Discard Pile
+.loop
+ ld a, [hli]
+ cp $ff
+ ret z
+ call PutCardInDiscardPile
+ jr .loop
+; 0x2e429
+
+ThunderstormEffect: ; 2e429 (b:6429)
+ ld a, 1
+ ldh [hEffectItemSelection], a
+
+ call SwapTurn
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ ld c, a
+ ld b, 0
+ ld e, b
+ jr .next_pkmn
+
+.check_damage
+ push de
+ push bc
+ call .DisplayText
+ ld de, $0
+ call SwapTurn
+ call TossCoin_BankB
+ call SwapTurn
+ push af
+ call GetCurPositionInTempList
+ pop af
+ ld [hl], a ; store result in list
+ pop bc
+ pop de
+ jr c, .next_pkmn
+ inc b ; increase number of tails
+
+.next_pkmn
+ inc e
+ dec c
+ jr nz, .check_damage
+
+; all coins were tossed for each Benched Pokemon
+ call GetCurPositionInTempList
+ ld [hl], $ff
+ ld a, b
+ ldh [hTemp_ffa0], a
+ call Func_3b21
+ call SwapTurn
+
+; tally recoil damage
+ ldh a, [hTemp_ffa0]
+ or a
+ jr z, .skip_recoil
+ ; deal number of tails times 10 to self
+ call ATimes10
+ call DealRecoilDamageToSelf
+.skip_recoil
+
+; deal damage for Bench Pokemon that got heads
+ call SwapTurn
+ ld hl, hTempPlayAreaLocation_ffa1
+ ld b, PLAY_AREA_BENCH_1
+.loop_bench
+ ld a, [hli]
+ cp $ff
+ jr z, .done
+ or a
+ jr z, .skip_damage ; skip if tails
+ ld de, 20
+ call DealDamageToPlayAreaPokemon_RegularAnim
+.skip_damage
+ inc b
+ jr .loop_bench
+
+.done
+ call SwapTurn
+ ret
+; 0x2e491
+
+; displays text for current Bench Pokemon,
+; printing its Bench number and name.
+.DisplayText ; 2e491 (b:6491)
+ ld b, e
+ ldtx hl, BenchText
+ ld de, wDefaultText
+ call CopyText
+ ld a, $30 ; 0 FW character
+ add b
+ ld [de], a
+ inc de
+ ld a, $20 ; space FW character
+ ld [de], a
+ inc de
+
+ ld a, DUELVARS_ARENA_CARD
+ add b
+ call GetTurnDuelistVariable
+ call LoadCardDataToBuffer2_FromDeckIndex
+ ld hl, wLoadedCard2Name
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call CopyText
+
+ xor a
+ ld [wDuelDisplayedScreen], a
+ ret
+; 0x2e4bb
+
+JolteonQuickAttack_AIEffect: ; 2e4bb (b:64bb)
+ ld a, (10 + 30) / 2
+ lb de, 10, 30
+ jp StoreAIDamageInfo
+; 0x2e4c3
+
+JolteonQuickAttack_DamageBoostEffect: ; 2e4c3 (b:64c3)
+ ld hl, 20
+ call LoadTxRam3
+ ldtx de, DamageCheckIfHeadsPlusDamageText
+ call TossCoin_BankB
+ ret nc ; return if tails
+ ld a, 20
+ call AddToDamage
+ ret
+; 0x2e3d6
+
+PinMissile_AIEffect: ; 2e4d6 (b:64d6)
+ ld a, (20 * 4) / 2
+ lb de, 0, 80
+ jp StoreAIDamageInfo
+; 0x2e4de
+
+PinMissile_MultiplierEffect: ; 2e4de (b:64de)
+ ld hl, 20
+ call LoadTxRam3
+ ldtx de, DamageCheckIfHeadsXDamageText
+ ld a, 4
+ call TossCoinATimes_BankB
+ add a ; a = 2 * heads
+ call ATimes10
+ call StoreDamageInfo
+ ret
+; 0x2e4f4
+
+Fly_AIEffect: ; 2e4f4 (b:64f4)
+ ld a, 30 / 2
+ lb de, 0, 30
+ jp StoreAIDamageInfo
+; 0x2e4fc
+
+Fly_Success50PercentEffect: ; 2e4fc (b:64fc)
+ ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText
+ call TossCoin_BankB
+ jr c, .heads
+ xor a
+ ld [wLoadedMoveAnimation], a
+ call StoreDamageInfo
+ call SetWasUnsuccessful
+ ret
+.heads
+ ld a, $52
+ ld [wLoadedMoveAnimation], a
+ ld a, SUBSTATUS1_FLY
+ call ApplySubstatus1ToDefendingCard
+ ret
+; 0x2e51a
+
+ThunderJolt_Recoil50PercentEffect: ; 2e51a (b:651a)
+ ld hl, 10
+ call LoadTxRam3
+ ldtx de, IfTailsDamageToYourselfTooText
+ call TossCoin_BankB
+ ldh [hTemp_ffa0], a
+ ret
+; 0x2e529
+
+ThunderJolt_RecoilEffect: ; 2e529 (b:6529)
+ ld hl, 10
+ call LoadTxRam3
+ ldh a, [hTemp_ffa0]
+ or a
+ ret nz ; return if was heads
+ ld a, 10
+ call DealRecoilDamageToSelf
+ ret
+; 0x2e539
+
+Spark_PlayerSelectEffect: ; 2e539 (b:6539)
+ ld a, $ff
+ ldh [hTemp_ffa0], a
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetNonTurnDuelistVariable
+ cp 2
+ ret c ; has no Bench Pokemon
+
+ ldtx hl, ChoosePkmnInTheBenchToGiveDamageText
+ call DrawWideTextBox_WaitForInput
+ call SwapTurn
+ bank1call HasAlivePokemonInBench
+
+ ; the following two instructions can be removed
+ ; since Player selection will overwrite it.
+ ld a, PLAY_AREA_BENCH_1
+ ldh [hTempPlayAreaLocation_ff9d], a
+
+.loop_input
+ bank1call OpenPlayAreaScreenForSelection
+ jr c, .loop_input
+ ldh a, [hTempPlayAreaLocation_ff9d]
+ ldh [hTemp_ffa0], a
+ call SwapTurn
+ ret
+; 0x2e562
+
+Spark_AISelectEffect: ; 2e562 (b:6562)
+ ld a, $ff
+ ldh [hTemp_ffa0], a
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetNonTurnDuelistVariable
+ cp 2
+ ret c ; has no Bench Pokemon
+; AI always picks Pokemon with lowest HP remaining
+ call AIFindBenchWithLowestHP
+ ldh [hTemp_ffa0], a
+ ret
+; 0x2e574
+
+Spark_BenchDamageEffect: ; 2e574 (b:6574)
+ ldh a, [hTemp_ffa0]
+ cp $ff
+ ret z
+ call SwapTurn
+ ldh a, [hTemp_ffa0]
+ ld b, a
+ ld de, 10
+ call DealDamageToPlayAreaPokemon_RegularAnim
+ call SwapTurn
+ ret
+; 0x2e589
+
+Pikachu3GrowlEffect: ; 2e589 (b:6589)
+ ld a, SUBSTATUS2_GROWL
+ call ApplySubstatus2ToDefendingCard
+ ret
+; 0x2e58f
+
+Pikachu4GrowlEffect: ; 2e58f (b:658f)
+ ld a, SUBSTATUS2_GROWL
+ call ApplySubstatus2ToDefendingCard
+ ret
+; 0x2e595
+
+ChainLightningEffect: ; 2e595 (b:6595)
+ ld a, 10
+ call StoreDamageInfo
+ call SwapTurn
+ call GetArenaCardColor
+ call SwapTurn
+ ldh [hEffectItemSelection], a
+ cp COLORLESS
+ ret z ; don't damage if colorless
+
+; opponent's Bench
+ call SwapTurn
+ call .DamageSameColorBench
+ call SwapTurn
+
+; own Bench
+ ld a, $01
+ ld [wIsDamageToSelf], a
+ call .DamageSameColorBench
+ ret
+; 0x2e5ba
+
+.DamageSameColorBench ; 2e5ba (b:65ba)
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ ld e, a
+ ld d, PLAY_AREA_ARENA
+ jr .next_bench
+
+.check_damage
+ ld a, d
+ call GetPlayAreaCardColor
+ ld c, a
+ ldh a, [hEffectItemSelection]
+ cp c
+ jr nz, .next_bench ; skip if not same color
+; apply damage to this Bench card
+ push de
+ ld b, d
+ ld de, 10
+ call DealDamageToPlayAreaPokemon_RegularAnim
+ pop de
+
+.next_bench
+ inc d
+ dec e
+ jr nz, .check_damage
+ ret
+; 0x2e5dc
+
+RaichuAgilityEffect: ; 2e5dc (b:65dc)
+ ldtx de, IfHeadsDoNotReceiveDamageOrEffectText
+ call TossCoin_BankB
+ ret nc ; skip if got tails
+ ld a, $52
+ ld [wLoadedMoveAnimation], a
+ ld a, SUBSTATUS1_AGILITY
+ call ApplySubstatus1ToDefendingCard
+ ret
+; 0x2e5ee
+
+RaichuThunder_Recoil50PercentEffect: ; 2e5ee (b:65ee)
+ ld hl, 30
+ call LoadTxRam3
+ ldtx de, IfTailsDamageToYourselfTooText
+ call TossCoin_BankB
+ ldh [hTemp_ffa0], a
+ ret
+; 0x2e5fd
+
+RaichuThunder_RecoilEffect: ; 2e5fd (b:65fd)
+ ld hl, 30
+ call LoadTxRam3
+ ldh a, [hTemp_ffa0]
+ or a
+ ret nz ; return if got heads
+ ld a, 30
+ call DealRecoilDamageToSelf
+ ret
+; 0x2e60d
+
+Gigashock_PlayerSelectEffect: ; 2e60d (b:660d)
+ call SwapTurn
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ cp 2
+ jr nc, .has_bench
+ call SwapTurn
+ ld a, $ff
+ ldh [hTempList], a
+ ret
+
+.has_bench
+ ldtx hl, ChooseUpTo3PkmnOnBenchToGiveDamageText
+ call DrawWideTextBox_WaitForInput
+
+; init number of items in list and cursor position
+ xor a
+ ldh [hEffectItemSelection], a
+ ld [wce72], a
+ bank1call Func_61a1
+.start
+ bank1call PrintPlayAreaCardList_EnableLCD
+ push af
+ ld a, [wce72]
+ ld hl, BenchSelectionMenuParameters
+ call InitializeMenuParameters
+ pop af
+
+; exclude Arena Pokemon from number of items
+ dec a
+ ld [wNumMenuItems], a
+
+.loop_input
+ call DoFrame
+ call HandleMenuInput
+ jr nc, .loop_input
+ cp -1
+ jr z, .try_cancel
+
+ ld [wce72], a
+ call .CheckIfChosenAlready
+ jr nc, .not_chosen
+ ; play SFX
+ call Func_3794
+ jr .loop_input
+
+.not_chosen
+; mark this Play Area location
+ ldh a, [hCurMenuItem]
+ inc a
+ ld b, SYM_LIGHTNING
+ call DrawSymbolOnPlayAreaCursor
+; store it in the list of chosen Bench Pokemon
+ call GetCurPositionInTempList
+ ldh a, [hCurMenuItem]
+ inc a
+ ld [hl], a
+
+; check if 3 were chosen already
+ ldh a, [hEffectItemSelection]
+ ld c, a
+ cp 3
+ jr nc, .chosen ; check if already chose 3
+
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ dec a
+ cp c
+ jr nz, .start ; if sill more options available, loop back
+ ; fallthrough if no other options available to choose
+
+.chosen
+ ldh a, [hCurMenuItem]
+ inc a
+ call Func_2c10b
+ ldh a, [hKeysPressed]
+ and B_BUTTON
+ jr nz, .try_cancel
+ call SwapTurn
+ call GetCurPositionInTempList
+ ld [hl], $ff ; terminating byte
+ ret
+
+.try_cancel
+ ldh a, [hEffectItemSelection]
+ or a
+ jr z, .start ; none selected, can safely loop back to start
+
+; undo last selection made
+ dec a
+ ldh [hEffectItemSelection], a
+ ld e, a
+ ld d, $00
+ ld hl, hTempList
+ add hl, de
+ ld a, [hl]
+
+ push af
+ ld b, SYM_SPACE
+ call DrawSymbolOnPlayAreaCursor
+ call EraseCursor
+ pop af
+
+ dec a
+ ld [wce72], a
+ jr .start
+; 0x2e6af
+
+; returns carry if Bench Pokemon
+; in register a was already chosen.
+.CheckIfChosenAlready: ; 2e6af (b:66af)
+ inc a
+ ld c, a
+ ldh a, [hEffectItemSelection]
+ ld b, a
+ ld hl, hTempList
+ inc b
+ jr .next_check
+.check_chosen
+ ld a, [hli]
+ cp c
+ scf
+ ret z ; return if chosen already
+.next_check
+ dec b
+ jr nz, .check_chosen
+ or a
+ ret
+; 0x2e6c3
+
+Gigashock_AISelectEffect: ; 2e6c3 (b:66c3)
+; if Bench has 3 Pokemon or less, no need for selection,
+; since AI will choose them all.
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetNonTurnDuelistVariable
+ cp MAX_PLAY_AREA_POKEMON - 1
+ jr nc, .start_selection
+
+; select them all
+ ld hl, hTempList
+ ld b, PLAY_AREA_ARENA
+ jr .next_bench
+.select_bench
+ ld [hl], b
+ inc hl
+.next_bench
+ inc b
+ dec a
+ jr nz, .select_bench
+ ld [hl], $ff ; terminating byte
+ ret
+
+.start_selection
+; has more than 3 Bench cards,proceed to sort them
+; by lowest remaining HP to highest, and pick first 3.
+ call SwapTurn
+ dec a
+ ld c, a
+ ld b, PLAY_AREA_BENCH_1
+
+; first select all of the Bench Pokemon and write to list
+ ld hl, hTempList
+.loop_all
+ ld [hl], b
+ inc hl
+ inc b
+ dec c
+ jr nz, .loop_all
+ ld [hl], $00 ; end list with $00
+
+; then check each of the Bench Pokemon HP
+; sort them from lowest remaining HP to highest.
+ ld de, hTempList
+.loop_outer
+ ld a, [de]
+ add DUELVARS_ARENA_CARD_HP
+ call GetTurnDuelistVariable
+ ld c, a
+ ld l, e
+ ld h, d
+ inc hl
+
+.loop_inner
+ ld a, [hli]
+ or a
+ jr z, .next ; reaching $00 means it's end of list
+
+ push hl
+ add DUELVARS_ARENA_CARD_HP
+ call GetTurnDuelistVariable
+ pop hl
+ cp c
+ jr c, .loop_inner
+ ; a Bench Pokemon was found with less HP
+ ld c, a ; store its HP
+
+; switch the two
+ dec hl
+ ld b, [hl]
+ ld a, [de]
+ ld [hli], a
+ ld a, b
+ ld [de], a
+ jr .loop_inner
+
+.next
+ inc de
+ ld a, [de]
+ or a
+ jr nz, .loop_outer
+
+; done
+ ld a, $ff ; terminating byte
+ ldh [hTempList + 3], a
+ call SwapTurn
+ ret
+; 0x2e71f
+
+Gigashock_BenchDamageEffect: ; 2e71f (b:671f)
+ call SwapTurn
+ ld hl, hTempList
+.loop_selection
+ ld a, [hli]
+ cp $ff
+ jr z, .done
+ push hl
+ ld b, a
+ ld de, 10
+ call DealDamageToPlayAreaPokemon_RegularAnim
+ pop hl
+ jr .loop_selection
+.done
+ call SwapTurn
+ ret
+; 0x2e739
+
+Magneton1SelfdestructEffect: ; 2e739 (b:6739)
+ ld a, 80
+ call DealRecoilDamageToSelf
+
+; own bench
+ ld a, $01
+ ld [wIsDamageToSelf], a
+ ld a, 20
+ call DealDamageToAllBenchedPokemon
+
+; opponent's bench
+ call SwapTurn
+ xor a
+ ld [wIsDamageToSelf], a
+ ld a, 20
+ call DealDamageToAllBenchedPokemon
+ call SwapTurn
+ ret
+; 0x2e758
+
+MagnetonSonicboom_UnaffectedByColorEffect: ; 2e758 (b:6758)
+ ld hl, wDamage + 1
+ set UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, [hl]
+ ret
+; 0x2e75e
+
+MagnetonSonicboom_NullEffect: ; 2e75e (b:675e)
+ ret
+; 0x2e75f
+
+Magneton2SelfdestructEffect: ; 2e75f (b:675f)
+ ld a, 100
+ call DealRecoilDamageToSelf
+
+; own bench
+ ld a, $01
+ ld [wIsDamageToSelf], a
+ ld a, 20
+ call DealDamageToAllBenchedPokemon
+
+; opponent's bench
+ call SwapTurn
+ xor a
+ ld [wIsDamageToSelf], a
+ ld a, 20
+ call DealDamageToAllBenchedPokemon
+ call SwapTurn
+ ret
+; 0x2e77e
+
+PealOfThunder_InitialEffect: ; 2e77e (b:677e)
+ scf
+ ret
+; 0x2e780
+
+PealOfThunder_RandomlyDamageEffect: ; 2e780 (b:6780)
+ call ExchangeRNG
+ ld de, 30 ; damage to inflict
+ call RandomlyDamagePlayAreaPokemon
+ bank1call Func_6e49
+ ret
+; 0x2e78d
+
+; randomly damages a Pokemon in play, except
+; card that is in [hTempPlayAreaLocation_ff9d].
+; plays thunder animation when Play Area is shown.
+; input:
+; de = amount of damage to deal
+RandomlyDamagePlayAreaPokemon: ; 2e78d (b:678d)
+ xor a
+ ld [wNoDamageOrEffect], a
+
+; choose randomly which Play Area to attack
+ call UpdateRNGSources
+ and 1
+ jr nz, .opp_play_area
+
+; own Play Area
+ ld a, $01
+ ld [wIsDamageToSelf], a
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ call Random
+ ld b, a
+ ; can't select Zapdos
+ ldh a, [hTempPlayAreaLocation_ff9d]
+ cp b
+ jr z, RandomlyDamagePlayAreaPokemon ; re-roll Pokemon to attack
+
+.damage
+ ld a, $82
+ ld [wLoadedMoveAnimation], a
+ call DealDamageToPlayAreaPokemon
+ ret
+
+.opp_play_area
+ xor a
+ ld [wIsDamageToSelf], a
+ call SwapTurn
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ call Random
+ ld b, a
+ call .damage
+ call SwapTurn
+ ret
+; 0x2e7cb
+
+BigThunderEffect: ; 2e7cb (b:67cb)
+ call ExchangeRNG
+ ld de, 70 ; damage to inflict
+ call RandomlyDamagePlayAreaPokemon
+ ret
+; 0x2e7d5
+
+MagneticStormEffect: ; 2e7d5 (b:67d5)
+ ld a, DUELVARS_CARD_LOCATIONS
+ call GetTurnDuelistVariable
+
+; writes in wDuelTempList all deck indices
+; of Energy cards attached to Pokemon
+; in the Turn Duelist's Play Area.
+ ld de, wDuelTempList
+ ld c, 0
+.loop_card_locations
+ ld a, [hl]
+ and CARD_LOCATION_PLAY_AREA
+ jr z, .next_card_location
+
+; is a card that is in the Play Area
+ push hl
+ push de
+ push bc
+ ld a, l
+ call GetCardIDFromDeckIndex
+ call GetCardType
+ pop bc
+ pop de
+ pop hl
+ and TYPE_ENERGY
+ jr z, .next_card_location
+; is an Energy card attached to Pokemon in Play Area
+ ld a, l
+ ld [de], a
+ inc de
+ inc c
+.next_card_location
+ inc l
+ ld a, l
+ cp DECK_SIZE
+ jr c, .loop_card_locations
+ ld a, $ff ; terminating byte
+ ld [de], a
+
+; divide number of energy cards
+; by number of Pokemon in Play Area
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ ld b, a
+ ld a, c
+ ld c, -1
+.loop_division
+ inc c
+ sub b
+ jr nc, .loop_division
+ ; c = floor(a / b)
+
+; evenly divides the Energy cards randomly
+; to every Pokemon in the Play Area.
+ push bc
+ ld hl, wDuelTempList
+ call CountCardsInDuelTempList
+ call ShuffleCards
+ ld d, c
+ ld e, PLAY_AREA_ARENA
+.start_attach
+ ld c, d
+ inc c
+ jr .check_done
+.attach_energy
+ ld a, [hli]
+ push hl
+ push de
+ push bc
+ call AddCardToHand
+ call PutHandCardInPlayArea
+ pop bc
+ pop de
+ pop hl
+.check_done
+ dec c
+ jr nz, .attach_energy
+; go to next Pokemon in Play Area
+ inc e ; next in Play Area
+ dec b
+ jr nz, .start_attach
+ pop bc
+
+ push hl
+ ld hl, hTempList
+
+; fill hTempList with PLAY_AREA_* locations
+; that have Pokemon in them.
+ push hl
+ xor a
+.loop_init
+ ld [hli], a
+ inc a
+ cp b
+ jr nz, .loop_init
+ pop hl
+
+; shuffle them and distribute
+; the remaining cards in random order.
+ ld a, b
+ call ShuffleCards
+ pop hl
+ ld de, hTempList
+.next_random_pokemon
+ ld a, [hl]
+ cp $ff
+ jr z, .done
+ push hl
+ push de
+ ld a, [de]
+ ld e, a
+ ld a, [hl]
+ call AddCardToHand
+ call PutHandCardInPlayArea
+ pop de
+ pop hl
+ inc hl
+ inc de
+ jr .next_random_pokemon
+
+.done
+ bank1call DrawDuelMainScene
+ bank1call DrawDuelHUDs
+ ldtx hl, TheEnergyCardFromPlayAreaWasMovedText
+ call DrawWideTextBox_WaitForInput
+ xor a
+ call Func_2c10b
+ ret
+; 0x2e870
+
+ElectrodeSonicboom_UnaffectedByColorEffect: ; 2e870 (b:6870)
+ ld hl, wDamage + 1
+ set UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, [hl]
+ ret
+; 0x2e876
+
+ElectrodeSonicboom_NullEffect: ; 2e876 (b:6876)
+ ret
+; 0x2e877
+
+; return carry if no cards in Deck
+EnergySpike_DeckCheck: ; 2e877 (b:6877)
+ call CheckIfDeckIsEmpty
+ ret
+; 0x2e87b
+
+EnergySpike_PlayerSelectEffect: ; 2e87b (b:687b)
+ ld a, $ff
+ ldh [hTemp_ffa0], a
+
+; search cards in Deck
+ call CreateDeckCardList
+ ldtx hl, Choose1BasicEnergyCardFromDeckText
+ ldtx bc, BasicEnergyText
+ lb de, SEARCHEFFECT_BASIC_ENERGY, 0
+ call LookForCardInDeck
+ ret c
+
+ bank1call Func_5591
+ ldtx hl, ChooseBasicEnergyCardText
+ ldtx de, DuelistDeckText
+ bank1call SetCardListHeaderText
+.select_card
+ bank1call DisplayCardList
+ jr c, .try_cancel
+ call GetCardIDFromDeckIndex
+ call GetCardType
+ cp TYPE_ENERGY_DOUBLE_COLORLESS
+ jr nc, .select_card ; not a Basic Energy card
+ and TYPE_ENERGY
+ jr z, .select_card ; not a Basic Energy card
+ ; Energy card selected
+
+ ldh a, [hTempCardIndex_ff98]
+ ldh [hTemp_ffa0], a
+ call EmptyScreen
+ ldtx hl, ChoosePokemonToAttachEnergyCardText
+ call DrawWideTextBox_WaitForInput
+
+; choose a Pokemon in Play Area to attach card
+ bank1call HasAlivePokemonInPlayArea
+.loop_input
+ bank1call OpenPlayAreaScreenForSelection
+ jr c, .loop_input
+ ldh a, [hTempPlayAreaLocation_ff9d]
+ ldh [hTempPlayAreaLocation_ffa1], a
+ ret
+
+.play_sfx
+ call Func_3794
+ jr .select_card
+
+.try_cancel
+; Player tried exiting screen, if there are
+; any Basic Energy cards, Player is forced to select them.
+; otherwise, they can safely exit.
+ ld a, DUELVARS_CARD_LOCATIONS
+ call GetTurnDuelistVariable
+.loop_deck
+ ld a, [hl]
+ cp CARD_LOCATION_DECK
+ jr nz, .next_card
+ ld a, l
+ call GetCardIDFromDeckIndex
+ call GetCardType
+ and TYPE_ENERGY
+ jr z, .next_card
+ cp TYPE_ENERGY_DOUBLE_COLORLESS
+ jr c, .play_sfx
+.next_card
+ inc l
+ ld a, l
+ cp DECK_SIZE
+ jr c, .loop_deck
+ ; can exit
+
+ ld a, $ff
+ ldh [hTemp_ffa0], a
+ ret
+; 0x2e8f1
+
+EnergySpike_AISelectEffect: ; 2e8f1 (b:68f1)
+; AI doesn't select any card
+ ld a, $ff
+ ldh [hTemp_ffa0], a
+ ret
+; 0x2e8f6
+
+EnergySpike_AttachEnergyEffect: ; 2e8f6 (b:68f6)
+ ldh a, [hTemp_ffa0]
+ cp $ff
+ jr z, .done
+
+; add card to hand and attach it to the selected Pokemon
+ call SearchCardInDeckAndAddToHand
+ call AddCardToHand
+ ldh a, [hTempPlayAreaLocation_ffa1]
+ ld e, a
+ ldh a, [hTemp_ffa0]
+ call PutHandCardInPlayArea
+ call CheckIfTurnDuelistIsPlayer
+ jr c, .done
+
+; not Player, so show detail screen
+; and which Pokemon was chosen to attach Energy.
+ ldh a, [hTempPlayAreaLocation_ffa1]
+ add DUELVARS_ARENA_CARD
+ call GetTurnDuelistVariable
+ call LoadCardDataToBuffer1_FromDeckIndex
+ ld hl, wLoadedCard1Name
+ ld de, wTxRam2_b
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ ldh a, [hTemp_ffa0]
+ ldtx hl, AttachedEnergyToPokemonText
+ bank1call DisplayCardDetailScreen
+
+.done
+ call Func_2c0bd
+ ret
+; 0x2e930
+
+JolteonDoubleKick_AIEffect: ; 2e930 (b:6930)
+ ld a, 40 / 2
+ lb de, 0, 40
+ jp StoreAIDamageInfo
+; 0x2e938
+
+JolteonDoubleKick_MultiplierEffect: ; 2e938 (b:6938)
+ ld hl, 20
+ call LoadTxRam3
+ ldtx de, DamageCheckIfHeadsXDamageText
+ ld a, 2
+ call TossCoinATimes_BankB
+ add a ; a = 2 * heads
+ call ATimes10
+ call StoreDamageInfo
+ ret
+; 0x2e94e
+
+ INCROM $2e94e, $30000
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 8009117..3c659d8 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -4968,10 +4968,18 @@ PrintKnockedOut: ; 1ad3 (0:1ad3)
; deal damage to turn holder's Pokemon card at play area location at b (PLAY_AREA_*).
; damage to deal is given in de.
; shows the defending player's play area screen when dealing the damage
-; instead of the main duel interface, and has a fixed move animation.
-DealDamageToPlayAreaPokemon: ; 1af3 (0:1af3)
+; instead of the main duel interface with regular attack animation.
+DealDamageToPlayAreaPokemon_RegularAnim: ; 1af3 (0:1af3)
ld a, $78
ld [wLoadedMoveAnimation], a
+; fallthrough
+
+; deal damage to turn holder's Pokemon card at play area location at b (PLAY_AREA_*).
+; damage to deal is given in de.
+; shows the defending player's play area screen when dealing the damage
+; instead of the main duel interface.
+; plays animation that is loaded in wLoadedMoveAnimation.
+DealDamageToPlayAreaPokemon: ; 1af8 (0:1af8)
ld a, b
ld [wTempPlayAreaLocation_cceb], a
or a ; cp PLAY_AREA_ARENA
diff --git a/src/hram.asm b/src/hram.asm
index 1554be6..d36869b 100644
--- a/src/hram.asm
+++ b/src/hram.asm
@@ -90,14 +90,6 @@ hTempPlayAreaLocation_ffa1:: ; ffa1
hAIPkmnPowerEffectParam:: ; ffa1
ds $1
-NEXTU
-
-; list of cards selected for various effects
-hTempCardList:: ; ffa0
- ds $2
-
-ENDU
-
UNION
; $ff-terminated list of cards to be discarded upon retreat
@@ -119,12 +111,15 @@ hPkmnPowerPlayAreaTarget:: ; ffa2
hAIEnergyTransPlayAreaLocation:: ; ffa3
ds $1
+ENDU
+
NEXTU
-; Play Area location (PLAY_AREA_*) of card
-; chosen by AI to use Heal Pkmn Power on.
-hAIHealCard:: ; ffa2
- ds $1
+; list of various items, such as
+; cards selected for various effects,
+; Play Area locations, etc.
+hTempList:: ; ffa0
+ ds $8
ENDU
diff --git a/src/text/text1.asm b/src/text/text1.asm
index 031befb..577bef5 100644
--- a/src/text/text1.asm
+++ b/src/text/text1.asm
@@ -327,7 +327,7 @@ PsychicSymbolText: ; 36857 (d:6857)
textfw0 "<PSYCHIC>"
done
-Text004d: ; 3685a (d:685a)
+BenchText: ; 3685a (d:685a)
text "Bench"
done
@@ -1113,7 +1113,7 @@ IfHeadsHealIsSuccessfulText: ; 37e73 (d:7e73)
line "Heal is successful."
done
-Text00ed: ; 37e92 (d:7e92)
+IfTailsDamageToYourselfTooText: ; 37e92 (d:7e92)
text "If Tails, <RAMNUM> damage"
line "to yourself, too."
done
diff --git a/src/text/text2.asm b/src/text/text2.asm
index d6a982b..9c127f5 100644
--- a/src/text/text2.asm
+++ b/src/text/text2.asm
@@ -187,17 +187,17 @@ ChoosePkmnInTheBenchToGiveDamageText: ; 38769 (e:4769)
line "to give damage to."
done
-Text011b: ; 3879b (e:479b)
+ChooseUpTo3PkmnOnBenchToGiveDamageText: ; 3879b (e:479b)
text "Choose up to 3 Pokémon on the"
line "Bench to give damage to."
done
-Text011c: ; 387d3 (e:47d3)
+Choose1BasicEnergyCardFromDeckText: ; 387d3 (e:47d3)
text "Choose 1 Basic Energy card"
line "from the Deck."
done
-Text011d: ; 387fe (e:47fe)
+ChoosePokemonToAttachEnergyCardText: ; 387fe (e:47fe)
text "Choose a Pokémon to attach"
line "the Energy card to."
done
@@ -255,7 +255,7 @@ ChooseAKrabbyText: ; 38a02 (e:4a02)
text "Choose a Krabby."
done
-Text0129: ; 38a14 (e:4a14)
+ChooseBasicEnergyCardText: ; 38a14 (e:4a14)
text "Choose a Basic"
line "Energy card."
done
@@ -445,7 +445,7 @@ FightingPokemonDeckText: ; 392f8 (e:52f8)
text "Fighting Pokémon"
done
-Text0144: ; 3930a (e:530a)
+BasicEnergyText: ; 3930a (e:530a)
text "Basic Energy"
done
@@ -483,7 +483,7 @@ ThereWasNoEffectFromTxRam2Text: ; 393ff (e:53ff)
line "from <RAMTEXT>."
done
-Text014c: ; 3941c (e:541c)
+TheEnergyCardFromPlayAreaWasMovedText: ; 3941c (e:541c)
text "The Energy card from <RAMNAME>'s"
line "Play Area was moved."
done
diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm
index 728a110..fad0a83 100644
--- a/src/text/text_offsets.asm
+++ b/src/text/text_offsets.asm
@@ -78,7 +78,7 @@ TextOffsets:: ; 34000 (d:4000)
textpointer LightningSymbolText ; 0x004a
textpointer FightingSymbolText ; 0x004b
textpointer PsychicSymbolText ; 0x004c
- textpointer Text004d ; 0x004d
+ textpointer BenchText ; 0x004d
textpointer KnockOutText ; 0x004e
textpointer DamageToSelfDueToConfusionText ; 0x004f
textpointer ChooseEnergyCardToDiscardText ; 0x0050
@@ -238,7 +238,7 @@ TextOffsets:: ; 34000 (d:4000)
textpointer DamageToOppBenchIfHeadsDamageToYoursIfTailsText ; 0x00ea
textpointer IfHeadsChangeOpponentsActivePokemonText ; 0x00eb
textpointer IfHeadsHealIsSuccessfulText ; 0x00ec
- textpointer Text00ed ; 0x00ed
+ textpointer IfTailsDamageToYourselfTooText ; 0x00ed
textpointer SuccessCheckIfHeadsAttackIsSuccessfulText ; 0x00ee
textpointer TrainerCardSuccessCheckText ; 0x00ef
textpointer Text00f0 ; 0x00f0
@@ -284,9 +284,9 @@ TextOffsets:: ; 34000 (d:4000)
textpointer DrawCardsFromTheDeckText ; 0x0118
textpointer CannotDrawCardBecauseNoCardsInDeckText ; 0x0119
textpointer ChoosePkmnInTheBenchToGiveDamageText ; 0x011a
- textpointer Text011b ; 0x011b
- textpointer Text011c ; 0x011c
- textpointer Text011d ; 0x011d
+ textpointer ChooseUpTo3PkmnOnBenchToGiveDamageText ; 0x011b
+ textpointer Choose1BasicEnergyCardFromDeckText ; 0x011c
+ textpointer ChoosePokemonToAttachEnergyCardText ; 0x011d
textpointer Text011e ; 0x011e
textpointer ChooseAndDiscard2FireEnergyCardsText ; 0x011f
textpointer DiscardOppDeckAsManyFireEnergyCardsText ; 0x0120
@@ -298,7 +298,7 @@ TextOffsets:: ; 34000 (d:4000)
textpointer ChooseAnOddishFromDeckText ; 0x0126
textpointer ChooseAnOddishText ; 0x0127
textpointer ChooseAKrabbyText ; 0x0128
- textpointer Text0129 ; 0x0129
+ textpointer ChooseBasicEnergyCardText ; 0x0129
textpointer ChooseNidoranFromDeckText ; 0x012a
textpointer ChooseNidoranText ; 0x012b
textpointer ChooseBasicFightingPokemonText ; 0x012c
@@ -325,7 +325,7 @@ TextOffsets:: ; 34000 (d:4000)
textpointer BellsproutText ; 0x0141
textpointer KrabbyText ; 0x0142
textpointer FightingPokemonDeckText ; 0x0143
- textpointer Text0144 ; 0x0144
+ textpointer BasicEnergyText ; 0x0144
textpointer PeekWasUsedToLookInYourHandText ; 0x0145
textpointer CardPeekWasUsedOnText ; 0x0146
textpointer Text0147 ; 0x0147
@@ -333,7 +333,7 @@ TextOffsets:: ; 34000 (d:4000)
textpointer BasicPokemonWasPlacedOnEachBenchText ; 0x0149
textpointer WasUnsuccessfulText ; 0x014a
textpointer ThereWasNoEffectFromTxRam2Text ; 0x014b
- textpointer Text014c ; 0x014c
+ textpointer TheEnergyCardFromPlayAreaWasMovedText ; 0x014c
textpointer DrewFireEnergyFromTheHandText ; 0x014d
textpointer ThePkmnCardsInHandAndDeckWereShuffledText ; 0x014e
textpointer Text014f ; 0x014f
diff --git a/src/wram.asm b/src/wram.asm
index c16fb56..578738b 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -931,6 +931,7 @@ wLoadedMove:: ; cca6
; the damage field of an used move is loaded here
; doubles as "wAIAverageDamage" when complementing wAIMinDamage and wAIMaxDamage
; little-endian
+; second byte may have UNAFFECTED_BY_WEAKNESS_RESISTANCE_F set/unset
wDamage:: ; ccb9
ds $2
@@ -1207,8 +1208,8 @@ wAIPokedexCounter:: ; cda6
ds $1
; variable to keep track of Mewtwo1's Barrier usage during Player' turn.
-; AI_FLAG_MEWTWO_MILL set means Player is running Mewtwo1 mill deck.
-; - when flag is not set, this counts how many turns in a row
+; AI_MEWTWO_MILL set means Player is running Mewtwo1 mill deck.
+; - when flag is not set, this counts how many turns in a row
; Player used Mewtwo1's Barrier attack;
; - when flag is set, this counts how many turns in a row
; Player has NOT used Barrier attack.
@@ -1684,7 +1685,10 @@ wce70:: ; ce70
wce71:: ; ce71
ds $1
- ds $3
+wce72:: ; ce72
+ ds $1
+
+ ds $2
; stores the amount of cards that are being ordered.
wNumberOfCardsToOrder:: ; ce75