diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/constants/duel_constants.asm | 22 | ||||
-rw-r--r-- | src/data/effect_commands.asm | 38 | ||||
-rw-r--r-- | src/engine/effect_functions.asm | 692 | ||||
-rw-r--r-- | src/engine/home.asm | 16 | ||||
-rw-r--r-- | src/hram.asm | 6 | ||||
-rw-r--r-- | src/text/text1.asm | 20 | ||||
-rw-r--r-- | src/text/text2.asm | 14 | ||||
-rw-r--r-- | src/text/text_offsets.asm | 34 | ||||
-rw-r--r-- | src/wram.asm | 27 |
9 files changed, 770 insertions, 99 deletions
diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index d3883fe..89e61a4 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -45,12 +45,12 @@ DUELVARS_BENCH2_CARD_STAGE EQUS "LOW(wPlayerBench2CardStage)" DUELVARS_BENCH3_CARD_STAGE EQUS "LOW(wPlayerBench3CardStage)" ; d1 DUELVARS_BENCH4_CARD_STAGE EQUS "LOW(wPlayerBench4CardStage)" ; d2 DUELVARS_BENCH5_CARD_STAGE EQUS "LOW(wPlayerBench5CardStage)" ; d3 -DUELVARS_ARENA_CARD_CHANGED_TYPE EQUS "LOW(wPlayerArenaCardChangedType)" ; d4 -DUELVARS_BENCH1_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench1CardChangedType)" ; d5 -DUELVARS_BENCH2_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench2CardChangedType)" ; d6 -DUELVARS_BENCH3_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench3CardChangedType)" ; d7 -DUELVARS_BENCH4_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench4CardChangedType)" ; d8 -DUELVARS_BENCH5_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench5CardChangedType)" ; d9 +DUELVARS_ARENA_CARD_CHANGED_COLOR EQUS "LOW(wPlayerArenaCardChangedColor)" ; d4 +DUELVARS_BENCH1_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench1CardChangedColor)" ; d5 +DUELVARS_BENCH2_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench2CardChangedColor)" ; d6 +DUELVARS_BENCH3_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench3CardChangedColor)" ; d7 +DUELVARS_BENCH4_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench4CardChangedColor)" ; d8 +DUELVARS_BENCH5_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench5CardChangedColor)" ; d9 DUELVARS_ARENA_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerArenaCardAttachedDefender)" ; da DUELVARS_BENCH1_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench1CardAttachedDefender)" ; db DUELVARS_BENCH2_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench2CardAttachedDefender)" ; dc @@ -161,8 +161,14 @@ SUBSTATUS3_THIS_TURN_DOUBLE_DAMAGE EQU 0 SUBSTATUS3_HEADACHE EQU 1 ; DUELVARS_ARENA_CARD_FLAGS_C2 constants -CAN_EVOLVE_THIS_TURN_F EQU 7 -CAN_EVOLVE_THIS_TURN EQU 1 << CAN_EVOLVE_THIS_TURN_F +USED_PKMN_POWER_THIS_TURN_F EQU 5 +CAN_EVOLVE_THIS_TURN_F EQU 7 +USED_PKMN_POWER_THIS_TURN EQU 1 << USED_PKMN_POWER_THIS_TURN_F +CAN_EVOLVE_THIS_TURN EQU 1 << CAN_EVOLVE_THIS_TURN_F + +; *_CHANGED_COLOR constants +HAS_CHANGED_COLOR_F EQU 7 +HAS_CHANGED_COLOR EQU 1 << HAS_CHANGED_COLOR_F ; effect command constants (TryExecuteEffectCommandFunction) ; ordered by (roughly) execution time diff --git a/src/data/effect_commands.asm b/src/data/effect_commands.asm index 9b93372..af6d821 100644 --- a/src/data/effect_commands.asm +++ b/src/data/effect_commands.asm @@ -238,23 +238,23 @@ ParasectSporeEffectCommands: WeedlePoisonStingEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Poison50PercentEffect - dbw EFFECTCMDTYPE_AI, $4b27 + dbw EFFECTCMDTYPE_AI, WeedlePoisonSting_AIEffect db $00 IvysaurPoisonPowderEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoisonEffect - dbw EFFECTCMDTYPE_AI, $4b2f + dbw EFFECTCMDTYPE_AI, IvysaurPoisonPowder_AIEffect db $00 BulbasaurLeechSeedEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4b37 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, BulbasaurLeechSeedEffect db $00 VenusaurEnergyTransEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $4b44 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4b77 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4bfb - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $4b6f + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, EnergyTrans_CheckPlayArea + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, EnergyTrans_TransferEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, EnergyTrans_AIEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, EnergyTrans_PrintProcedure db $00 GrimerNastyGooEffectCommands: @@ -262,38 +262,38 @@ GrimerNastyGooEffectCommands: db $00 GrimerMinimizeEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4c30 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, GrimerMinimizeEffect db $00 MukToxicGasEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4c36 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ToxicGasEffect db $00 MukSludgeEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Poison50PercentEffect - dbw EFFECTCMDTYPE_AI, $4c38 + dbw EFFECTCMDTYPE_AI, Sludge_AIEffect db $00 BellsproutCallForFamilyEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4c40 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4cc2 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $4c50 - dbw EFFECTCMDTYPE_UNKNOWN_08, $4cad + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, BellsproutCallForFamily_CheckDeckAndPlayArea + dbw EFFECTCMDTYPE_AFTER_DAMAGE, BellsproutCallForFamily_PutInPlayAreaEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, BellsproutCallForFamily_PlayerSelectEffect + dbw EFFECTCMDTYPE_UNKNOWN_08, BellsproutCallForFamily_AISelectEffect db $00 WeezingSmogEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Poison50PercentEffect - dbw EFFECTCMDTYPE_AI, $4ce2 + dbw EFFECTCMDTYPE_AI, WeezingSmog_AIEffect db $00 WeezingSelfdestructEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4cea + dbw EFFECTCMDTYPE_AFTER_DAMAGE, WeezingSelfdestructEffect db $00 VenomothShiftEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $4d09 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4d5d - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $4d21 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Shift_OncePerTurnCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Shift_ChangeColorEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Shift_PlayerSelectEffect db $00 VenomothVenomPowderEffectCommands: diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index 3c6fa5d..8b08135 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -155,15 +155,16 @@ CheckIfTurnDuelistIsPlayer: ; 2c0c7 (b:40c7) scf ret -; Sets some flags for AI use +; Stores information about the attack damage for AI purposes +; taking into account poison damage between turns. ; if target poisoned ; [wAIMinDamage] <- [wDamage] ; [wAIMaxDamage] <- [wDamage] ; else -; [wAIMinDamage] <- [wDamage] + d -; [wAIMaxDamage] <- [wDamage] + e -; [wDamage] <- [wDamage] + a -Func_2c0d4: ; 2c0d4 (b:40d4) +; [wAIMinDamage] <- [wDamage] + d +; [wAIMaxDamage] <- [wDamage] + e +; [wDamage] <- [wDamage] + a +StoreAIPoisonDamageInfo: ; 2c0d4 (b:40d4) push af ld a, DUELVARS_ARENA_CARD_STATUS call GetNonTurnDuelistVariable @@ -699,7 +700,249 @@ AIFindBenchWithLowestHP: ; 2c564 (b:4564) ret ; 0x2c588 - INCROM $2c588, $2c6f0 +; handles drawing the Shift Screen and its input. +; outputs in a the color that was selected or, +; if B was pressed, returns carry. +; input: +; a = Play Area location (PLAY_AREA_*), with bit 7 set or unset +; hl = text to be printed in the bottom box +; output: +; a = color that was selected +HandleShiftScreen: ; 2c588 (b:4588) + or a + call z, SwapTurn + push af + call .DrawScreen + pop af + call z, SwapTurn + + ld hl, .menu_params + xor a + call InitializeMenuParameters + call EnableLCD + +.loop_input + call DoFrame + call HandleMenuInput + jr nc, .loop_input + cp -1 ; b pressed? + jr z, .set_carry + ld e, a + ld d, $00 + ld hl, ShiftListItemToColor + add hl, de + ld a, [hl] + or a + ret +.set_carry + scf + ret + +.menu_params + db 1, 1 ; cursor x, cursor y + db 2 ; 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 +; 0x2c5be + +.DrawScreen: ; 2c5be (b:45be) + push hl + push af + call EmptyScreen + call ZeroObjectPositions + call LoadDuelCardSymbolTiles + +; load card data + pop af + and $7f + ld [wTempPlayAreaLocation_cceb], a + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + +; draw card gfx + ld de, v0Tiles1 + $20 tiles ; destination offset of loaded gfx + ld hl, wLoadedCard1Gfx + ld a, [hli] + ld h, [hl] + ld l, a + lb bc, $30, TILE_SIZE + call LoadCardGfx + bank1call SetBGP6OrSGB3ToCardPalette + bank1call FlushAllPalettesOrSendPal23Packet + ld a, $a0 + lb hl, 6, 1 + lb de, 9, 2 + lb bc, 8, 6 + call FillRectangle + bank1call ApplyBGP6OrSGB3ToCardImage + +; print card name and level at the top + ld a, 16 + call CopyCardNameAndLevel + ld [hl], $00 + lb de, 7, 0 + call InitTextPrinting + ld hl, wDefaultText + call ProcessText + +; list all the colors + ld hl, ShiftMenuData + call PlaceTextItems + +; print card's color, resistance and weakness + ld a, [wTempPlayAreaLocation_cceb] + call GetPlayAreaCardColor + inc a + lb bc, 15, 9 + call WriteByteToBGMap0 + ld a, [wTempPlayAreaLocation_cceb] + call GetPlayAreaCardWeakness + lb bc, 15, 10 + bank1call PrintCardPageWeaknessesOrResistances + ld a, [wTempPlayAreaLocation_cceb] + call GetPlayAreaCardResistance + lb bc, 15, 11 + bank1call PrintCardPageWeaknessesOrResistances + + call DrawWideTextBox + +; print list of color names on all list items + lb de, 4, 1 + ldtx hl, ColorListText + call InitTextPrinting_ProcessTextFromID + +; print input hl to text box + lb de, 1, 14 + pop hl + call InitTextPrinting_ProcessTextFromID + +; draw and apply palette to color icons + ld hl, ColorTileAndBGP + lb de, 2, 0 + ld c, NUM_COLORED_TYPES +.loop_colors + ld a, [hli] + push de + push bc + push hl + lb hl, 1, 2 + lb bc, 2, 2 + call FillRectangle + + ld a, [wConsole] + cp CONSOLE_CGB + jr nz, .skip_vram1 + pop hl ; unnecessary + push hl ; unnecessary + call BankswitchVRAM1 + ld a, [hl] + lb hl, 0, 0 + lb bc, 2, 2 + call FillRectangle + call BankswitchVRAM0 + +.skip_vram1 + pop hl + pop bc + pop de + inc hl + inc e + inc e + dec c + jr nz, .loop_colors + ret +; 0x2c686 + +; loads wTxRam2 and wTxRam2_b: +; [wTxRam2] <- wLoadedCard1Name +; [wTxRam2_b] <- input color as text symbol +; input: +; a = type (color) constant +LoadCardNameAndInputColor: ; 2c686 (b:4686) + add a + ld e, a + ld d, $00 + ld hl, ColorToTextSymbol + add hl, de + +; load wTxRam2 with card's name + ld de, wTxRam2 + ld a, [wLoadedCard1Name] + ld [de], a + inc de + ld a, [wLoadedCard1Name + 1] + ld [de], a + +; load wTxRam2_b with ColorToTextSymbol + inc de + ld a, [hli] + ld [de], a + inc de + ld a, [hli] + ld [de], a + ret +; 0x2c6a1 + +ShiftMenuData: ; 2c6a1 (b:46a1) + ; x, y, text id + textitem 10, 9, TypeText + textitem 10, 10, WeaknessText + textitem 10, 11, ResistanceText + db $ff + +ColorTileAndBGP: ; 2c6ae (b:46ae) + ; tile, BG + db $E4, $02 + db $E0, $01 + db $EC, $02 + db $E8, $01 + db $F0, $03 + db $F4, $03 + +ShiftListItemToColor: ; 2c6ba (b:46ba) + db GRASS + db FIRE + db WATER + db LIGHTNING + db FIGHTING + db PSYCHIC + +ColorToTextSymbol: ; 2c6c0 (b:46c0) + tx FireSymbolText + tx GrassSymbolText + tx LightningSymbolText + tx WaterSymbolText + tx FightingSymbolText + tx PsychicSymbolText + +DrawSymbolOnPlayAreaCursor: ; 2c6cc (b:46cc) + ld c, a + add a + add c + add 2 + ; a = 3*a + 2 + ld c, a + ld a, b + ld b, 0 + call WriteByteToBGMap0 + ret +; 0x2c6d9 + + INCROM $2c6d9, $2c6e0 + +PlayAreaSelectionMenuParameters: ; 2c6e0 (b:46e0) + db 0, 0 ; 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 +; 0x2c6e8 + + INCROM $2c6e8, $2c6f0 SpitPoison_AIEffect: ; 2c6f0 (b:46f0) ld a, 5 @@ -757,12 +1000,13 @@ TerrorStrike_SwitchDefendingPokemon: ; 2c726 (b:4726) PoisonFang_AIEffect: ; 2c730 (b:4730) ld a, 10 lb de, 10, 10 - jp Func_2c0d4 + jp StoreAIPoisonDamageInfo +; 0x2c738 WeepinbellPoisonPowder_AIEffect: ; 2c738 (b:4738) ld a, 5 lb de, 0, 10 - jp Func_2c0d4 + jp StoreAIPoisonDamageInfo ; 0x2c740 ; returns carry if non-duelist has no Bench Pokemon @@ -817,7 +1061,8 @@ AcidEffect: ; 2c77e (b:477e) GloomPoisonPowder_AIEffect: ; 2c78b (b:478b) ld a, 10 lb de, 10, 10 - jp Func_2c0d4 + jp StoreAIPoisonDamageInfo +; 0x2c793 ; Defending Pokemon and user become confused FoulOdorEffect: ; 2c793 (b:4793) @@ -841,7 +1086,7 @@ KakunaStiffenEffect: ; 2c7a0 (b:47a0) KakunaPoisonPowder_AIEffect: ; 2c7b4 (b:47b4) ld a, 5 lb de, 0, 10 - jp Func_2c0d4 + jp StoreAIPoisonDamageInfo ; 0x2c7bc GolbatLeechLifeEffect: ; 2c7bc (b:47bc) @@ -911,7 +1156,7 @@ Twineedle_MultiplierEffect: ; 2c7f5 (b:47f5) BeedrillPoisonSting_AIEffect: ; 2c80d (b:480d) ld a, 5 lb de, 0, 10 - jp Func_2c0d4 + jp StoreAIPoisonDamageInfo ; 0x2c815 ExeggcuteLeechSeedEffect: ; 2c815 (b:4815) @@ -967,7 +1212,7 @@ Sprout_PlayerSelectEffect: ; 2c85a (b:485a) ldh [hTemp_ffa0], a call CreateDeckCardList - ldtx hl, ChooseAnOddishFromTheDeckText + ldtx hl, ChooseAnOddishFromDeckText ldtx bc, OddishText lb de, SEARCHEFFECT_CARD_ID, ODDISH call LookForCardInDeck @@ -1446,9 +1691,156 @@ ButterfreeMegaDrainEffect: ; 2cb0f (b:4b0f) ret ; 0x2cb27 - INCROM $2cb27, $2cbfb +WeedlePoisonSting_AIEffect: ; 2cb27 (b:4b27) + ld a, 5 + lb de, 0, 10 + jp StoreAIPoisonDamageInfo +; 0x2cb2f + +IvysaurPoisonPowder_AIEffect: ; 2cb2f (b:4b2f) + ld a, 10 + lb de, 10, 10 + jp StoreAIPoisonDamageInfo +; 0x2cb37 + +BulbasaurLeechSeedEffect: ; 2cb37 (b:4b37) + ld hl, wDealtDamage + ld a, [hli] + or [hl] + ret z ; return if no damage dealt + lb de, 0, 10 + call ApplyAndAnimateHPDrain + ret +; 0x2cb44 + +; returns carry if no Grass Energy in Play Area +EnergyTrans_CheckPlayArea: ; 2cb44 (b:4b44) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret c ; cannot use Pkmn Power -Func_2cbfb: ; 2cbfb (b:4bfb) +; search in Play Area for at least 1 Grass Energy type + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_deck + ld a, [hl] + and CARD_LOCATION_PLAY_AREA + jr z, .next + push hl + ld a, l + call GetCardIDFromDeckIndex + call GetCardType + pop hl + cp TYPE_ENERGY_GRASS + ret z +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_deck + +; none found + ldtx hl, NoGrassEnergyText + scf + ret +; 0x2cb6f + +EnergyTrans_PrintProcedure: ; 2cb6f (b:4b6f) + ldtx hl, ProcedureForEnergyTransferText + bank1call Func_57df + or a + ret +; 0x2cb77 + +EnergyTrans_TransferEffect: ; 2cb77 (b:4b77) + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_PLAYER + jr z, .player +; not player + bank1call Func_61a1 + bank1call PrintPlayAreaCardList_EnableLCD + ret + +.player + xor a + ldh [hCurPlayAreaItem], a + bank1call Func_61a1 + +.draw_play_area + bank1call PrintPlayAreaCardList_EnableLCD + push af + ldh a, [hCurPlayAreaItem] + ld hl, PlayAreaSelectionMenuParameters + call InitializeMenuParameters + pop af + ld [wNumMenuItems], a + +; handle the action of taking a Grass Energy card +.loop_input_take + call DoFrame + call HandleMenuInput + jr nc, .loop_input_take + cp -1 ; b press? + ret z + +; a press + ldh [hTempPlayAreaLocation_ffa1], a + ldh [hCurPlayAreaItem], a + call CheckIfCardHasGrassEnergyAttached + jr c, .play_sfx ; no Grass attached + + ldh [hAIEnergyTransEnergyCard], a + ldh a, [hAIEnergyTransEnergyCard] ; useless + ; temporarily take card away to draw Play Area + call AddCardToHand + bank1call PrintPlayAreaCardList_EnableLCD + ldh a, [hTempPlayAreaLocation_ffa1] + ld e, a + ldh a, [hAIEnergyTransEnergyCard] + ; give card back + call PutHandCardInPlayArea + + ; draw Grass symbol near cursor + ldh a, [hTempPlayAreaLocation_ffa1] + ld b, SYM_GRASS + call DrawSymbolOnPlayAreaCursor + +; handle the action of placing a Grass Energy card +.loop_input_put + call DoFrame + call HandleMenuInput + jr nc, .loop_input_put + cp -1 ; b press? + jr z, .remove_symbol + +; a press + ldh [hCurPlayAreaItem], a + ldh [hAIEnergyTransPlayAreaLocation], a + ld a, OPPACTION_6B15 + call SetOppAction_SerialSendDuelData + ldh a, [hAIEnergyTransPlayAreaLocation] + ld e, a + ldh a, [hAIEnergyTransEnergyCard] + ; give card being held to this Pokemon + call AddCardToHand + call PutHandCardInPlayArea + +.remove_symbol + ldh a, [hTempPlayAreaLocation_ffa1] + ld b, SYM_SPACE + call DrawSymbolOnPlayAreaCursor + call EraseCursor + jr .draw_play_area + +.play_sfx + call Func_3794 + jr .loop_input_take +; 0x2cbfb + +EnergyTrans_AIEffect: ; 2cbfb (b:4bfb) ldh a, [hAIEnergyTransPlayAreaLocation] ld e, a ldh a, [hAIEnergyTransEnergyCard] @@ -1458,7 +1850,275 @@ Func_2cbfb: ; 2cbfb (b:4bfb) ret ; 0x2cc0a - INCROM $2cc0a, $2f4e1 +; returns carry if no Grass Energy cards +; attached to card in Play Area location of a. +; input: +; a = PLAY_AREA_* of location to check +CheckIfCardHasGrassEnergyAttached: ; 2cc0a (b:4c0a) + or CARD_LOCATION_PLAY_AREA + ld e, a + + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop + ld a, [hl] + cp e + jr nz, .next + push de + push hl + ld a, l + call GetCardIDFromDeckIndex + call GetCardType + pop hl + pop de + cp TYPE_ENERGY_GRASS + jr z, .no_carry +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop + scf + ret +.no_carry + ld a, l + or a + ret +; 0x2cc30 + +GrimerMinimizeEffect: ; 2cc30 (b:4c30) + ld a, SUBSTATUS1_REDUCE_BY_20 + call ApplySubstatus1ToDefendingCard + ret +; 0x2cc36 + +ToxicGasEffect: ; 2cc36 (b:4c36) + scf + ret +; 0x2cc38 + +Sludge_AIEffect: ; 2cc38 (b:4c38) + ld a, 5 + lb de, 0, 10 + jp StoreAIPoisonDamageInfo +; 0x2cc40 + +; returns carry if no cards in Deck or if +; Play Area is full already. +BellsproutCallForFamily_CheckDeckAndPlayArea: ; 2cc40 (b:4c40) + call CheckIfDeckIsEmpty + ret c ; return if 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 +; 0x2cc50 + +BellsproutCallForFamily_PlayerSelectEffect: ; 2cc50 (b:4c50) + ld a, $ff + ldh [hTemp_ffa0], a + + call CreateDeckCardList + ldtx hl, ChooseABellsproutFromDeckText + ldtx bc, BellsproutText + lb de, SEARCHEFFECT_CARD_ID, BELLSPROUT + call LookForCardInDeck + ret c + +; draw Deck list interface and print text + bank1call Func_5591 + ldtx hl, ChooseABellsproutText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText + +.loop + bank1call DisplayCardList + jr c, .pressed_b + call GetCardIDFromDeckIndex + ld bc, BELLSPROUT + call CompareDEtoBC + jr nz, .play_sfx + +; Bellsprout was selected + 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 Bellsprout card. + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_b_press + ld a, [hl] + cp CARD_LOCATION_DECK + jr nz, .next + ld a, l + call GetCardIDFromDeckIndex + ld bc, BELLSPROUT + call CompareDEtoBC + jr z, .play_sfx ; found Bellsprout, go back to top loop +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_b_press + +; no Bellsprout in Deck, can safely exit screen + ld a, $ff + ldh [hTemp_ffa0], a + or a + ret +; 0x2ccad + +BellsproutCallForFamily_AISelectEffect: ; 2ccad (b:4cad) + call CreateDeckCardList + ld hl, wDuelTempList +.loop_deck + ld a, [hli] + ldh [hTemp_ffa0], a + cp $ff + ret z ; no Bellsprout + call GetCardIDFromDeckIndex + ld a, e + cp BELLSPROUT + jr nz, .loop_deck + ret ; Bellsprout found +; 0x2ccc2 + +BellsproutCallForFamily_PutInPlayAreaEffect: ; 2ccc2 (b:4cc2) + ldh a, [hTemp_ffa0] + cp $ff + jr z, .shuffle + call SearchCardInDeckAndAddToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + call CheckIfTurnDuelistIsPlayer + jr c, .shuffle + ldh a, [hTemp_ffa0] + ldtx hl, PlacedOnTheBenchText + bank1call DisplayCardDetailScreen +.shuffle + call Func_2c0bd + ret +; 0x2cce2 + +WeezingSmog_AIEffect: ; 2cce2 (b:4ce2) + ld a, 5 + lb de, 0, 10 + jp StoreAIPoisonDamageInfo +; 0x2ccea + +WeezingSelfdestructEffect: ; 2ccea (b:4cea) + ld a, 60 + call Func_1955 + 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 +; 0x2cd09 + +Shift_OncePerTurnCheck: ; 2cd09 (b:4d09) + 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 +; 0x2cd21 + +Shift_PlayerSelectEffect: ; 2cd21 (b:4d21) + ldtx hl, ChoosePokemonWishToColorChangeText + ldh a, [hTemp_ffa0] + or $80 + call HandleShiftScreen + ldh [hAIPkmnPowerEffectParam], a + ret c ; cancelled + +; check whether the color selected is valid + ; look in Turn Duelist's Play Area + call .CheckColorInPlayArea + ret nc + ; look in NonTurn Duelist's Play Area + call SwapTurn + call .CheckColorInPlayArea + call SwapTurn + ret nc + ; not found in either Duelist's Play Area + ldtx hl, UnableToSelectText + call DrawWideTextBox_WaitForInput + jr Shift_PlayerSelectEffect ; loop back to start +; 0x2cd44 + +; checks in input color in a exists in Turn Duelist's Play Area +; returns carry if not found. +.CheckColorInPlayArea: ; 2cd44 (b:4d44) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + ld b, PLAY_AREA_ARENA +.loop_play_area + push bc + ld a, b + call GetPlayAreaCardColor + pop bc + ld hl, hAIPkmnPowerEffectParam + cp [hl] + ret z ; found + inc b + dec c + jr nz, .loop_play_area + ; not found + scf + ret +; 0x2cd5d + +Shift_ChangeColorEffect: ; 2cd5d (b:4d5d) + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_FLAGS_C2 + call GetTurnDuelistVariable + set USED_PKMN_POWER_THIS_TURN_F, [hl] + + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_CHANGED_COLOR + ld l, a + ldh a, [hAIPkmnPowerEffectParam] + or HAS_CHANGED_COLOR + ld [hl], a + call LoadCardNameAndInputColor + ldtx hl, ChangedTheColorOfText + call DrawWideTextBox_WaitForInput + ret +; 0x2cd84 + + INCROM $2cd84, $2f4e1 ImposterProfessorOakEffect: ; 2f4e1 (b:74e1) call SwapTurn @@ -1488,5 +2148,5 @@ ImposterProfessorOakEffect: ; 2f4e1 (b:74e1) ret ; 0x2f513 - INCROM $2f513, $30000 + diff --git a/src/engine/home.asm b/src/engine/home.asm index edbd6f5..42215a6 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -3742,7 +3742,7 @@ EvolvePokemonCard: ; 13a2 (0:13a2) ld l, a ld [hl], $00 ld a, e - add DUELVARS_ARENA_CARD_CHANGED_TYPE + add DUELVARS_ARENA_CARD_CHANGED_COLOR ld l, a ld [hl], $00 ld a, e @@ -3908,7 +3908,7 @@ PutHandPokemonCardInPlayArea: ; 1485 (0:1485) add e ld l, a ld [hl], $0 - ld a, DUELVARS_ARENA_CARD_CHANGED_TYPE + ld a, DUELVARS_ARENA_CARD_CHANGED_COLOR add e ld l, a ld [hl], $0 @@ -3988,7 +3988,7 @@ EmptyPlayAreaSlot: ; 14f8 (0:14f8) call .init_duelvar ld a, DUELVARS_ARENA_CARD_STAGE call .init_duelvar - ld a, DUELVARS_ARENA_CARD_CHANGED_TYPE + ld a, DUELVARS_ARENA_CARD_CHANGED_COLOR call .init_duelvar ld a, DUELVARS_ARENA_CARD_ATTACHED_DEFENDER call .init_duelvar @@ -4055,7 +4055,7 @@ SwapPlayAreaPokemon: ; 1548 (0:1548) call .swap_duelvar ld a, DUELVARS_ARENA_CARD_STAGE call .swap_duelvar - ld a, DUELVARS_ARENA_CARD_CHANGED_TYPE + ld a, DUELVARS_ARENA_CARD_CHANGED_COLOR call .swap_duelvar ld a, DUELVARS_ARENA_CARD_ATTACHED_PLUSPOWER call .swap_duelvar @@ -10278,7 +10278,7 @@ ClearChangedTypesIfMuk: ; 36d9 (0:36d9) call .zero_changed_types call SwapTurn .zero_changed_types - ld a, DUELVARS_ARENA_CARD_CHANGED_TYPE + ld a, DUELVARS_ARENA_CARD_CHANGED_COLOR call GetTurnDuelistVariable ld c, MAX_PLAY_AREA_POKEMON .zero_changed_types_loop @@ -10299,9 +10299,9 @@ GetPlayAreaCardColor: ; 36f7 (0:36f7) push hl push de ld e, a - add DUELVARS_ARENA_CARD_CHANGED_TYPE + add DUELVARS_ARENA_CARD_CHANGED_COLOR call GetTurnDuelistVariable - bit 7, a + bit HAS_CHANGED_COLOR_F, a jr nz, .has_changed_color .regular_color ld a, e @@ -10321,7 +10321,7 @@ GetPlayAreaCardColor: ; 36f7 (0:36f7) call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 jr c, .regular_color ; jump if can't use Shift ld a, e - add DUELVARS_ARENA_CARD_CHANGED_TYPE + add DUELVARS_ARENA_CARD_CHANGED_COLOR call GetTurnDuelistVariable pop de pop hl diff --git a/src/hram.asm b/src/hram.asm index f22b172..96230d7 100644 --- a/src/hram.asm +++ b/src/hram.asm @@ -153,7 +153,11 @@ hffb0:: ; ffb0 hCurMenuItem:: ; ffb1 ds $1 - ds $3 +; stores the item number in the Play Area selection menu +hCurPlayAreaItem:: ; ffb2 + ds $1 + + ds $2 hffb5:: ; ffb5 ds $1 diff --git a/src/text/text1.asm b/src/text/text1.asm index edac289..1cb1e0a 100644 --- a/src/text/text1.asm +++ b/src/text/text1.asm @@ -290,11 +290,11 @@ DuelistPlacedACardText: ; 367f9 (d:67f9) line "a <RAMTEXT>." done -Text0045: ; 36808 (d:6808) +UnableToSelectText: ; 36808 (d:6808) text "Unable to select." done -Text0046: ; 3681b (d:681b) +ColorListText: ; 3681b (d:681b) text "Grass" line "Fire" line "Water" @@ -303,27 +303,27 @@ Text0046: ; 3681b (d:681b) line "Psychic" done -Text0047: ; 36848 (d:6848) +GrassSymbolText: ; 36848 (d:6848) textfw0 "<GRASS>" done -Text0048: ; 3684b (d:684b) +FireSymbolText: ; 3684b (d:684b) textfw0 "<FIRE>" done -Text0049: ; 3684e (d:684e) +WaterSymbolText: ; 3684e (d:684e) textfw0 "<WATER>" done -Text004a: ; 36851 (d:6851) +LightningSymbolText: ; 36851 (d:6851) textfw0 "<LIGHTNING>" done -Text004b: ; 36854 (d:6854) +FightingSymbolText: ; 36854 (d:6854) textfw0 "<FIGHTING>" done -Text004c: ; 36857 (d:6857) +PsychicSymbolText: ; 36857 (d:6857) textfw0 "<PSYCHIC>" done @@ -945,7 +945,7 @@ Text00c9: ; 37897 (d:7897) text "No Resistance." done -Text00ca: ; 378a7 (d:78a7) +OnlyOncePerTurnText: ; 378a7 (d:78a7) text "Only once per turn." done @@ -963,7 +963,7 @@ Text00cd: ; 37923 (d:7923) text "There is no Energy card attached." done -Text00ce: ; 37946 (d:7946) +NoGrassEnergyText: ; 37946 (d:7946) text "No Grass Energy." done diff --git a/src/text/text2.asm b/src/text/text2.asm index bea4094..1afa4d8 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -146,7 +146,7 @@ Text0112: ; 3860a (e:460a) line "to change with Conversion 2." done -Text0113: ; 38647 (e:4647) +ChoosePokemonWishToColorChangeText: ; 38647 (e:4647) text "Choose the Pokémon whose color you" line "wish to change with Color change." done @@ -163,7 +163,7 @@ Text0115: ; 386af (e:46af) text "<RAMTEXT> to <RAMTEXT>." done -Text0116: ; 386d3 (e:46d3) +ChangedTheColorOfText: ; 386d3 (e:46d3) text "Changed the color of" line "" text "<RAMTEXT> to <RAMTEXT>." @@ -242,7 +242,7 @@ Text0125: ; 3899f (e:499f) line "from the Deck." done -ChooseAnOddishFromTheDeckText: ; 389cf (e:49cf) +ChooseAnOddishFromDeckText: ; 389cf (e:49cf) text "Choose an Oddish" line "from the Deck." done @@ -275,7 +275,7 @@ Text012c: ; 38a83 (e:4a83) line "Fighting Pokémon" done -Text012d: ; 38aa4 (e:4aa4) +ProcedureForEnergyTransferText: ; 38aa4 (e:4aa4) text "Procedure for Energy Transfer:" line "" line "1. Choose the Pokémon to move Grass" @@ -289,12 +289,12 @@ Text012d: ; 38aa4 (e:4aa4) line "4. Press the B Button to end." done -Text012e: ; 38b8f (e:4b8f) +ChooseABellsproutFromDeckText: ; 38b8f (e:4b8f) text "Choose a Bellsprout" line "from the Deck." done -Text012f: ; 38bb3 (e:4bb3) +ChooseABellsproutText: ; 38bb3 (e:4bb3) text "Choose a Bellsprout." done @@ -433,7 +433,7 @@ OddishText: ; 392dc (e:52dc) text "Oddish" done -Text0141: ; 392e4 (e:52e4) +BellsproutText: ; 392e4 (e:52e4) text "Bellsprout" done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index a4eac01..e0c3cb8 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -70,14 +70,14 @@ TextOffsets:: ; 34000 (d:4000) textpointer WillDrawNPrizesText ; 0x0042 textpointer DrewNPrizesText ; 0x0043 textpointer DuelistPlacedACardText ; 0x0044 - textpointer Text0045 ; 0x0045 - textpointer Text0046 ; 0x0046 - textpointer Text0047 ; 0x0047 - textpointer Text0048 ; 0x0048 - textpointer Text0049 ; 0x0049 - textpointer Text004a ; 0x004a - textpointer Text004b ; 0x004b - textpointer Text004c ; 0x004c + textpointer UnableToSelectText ; 0x0045 + textpointer ColorListText ; 0x0046 + textpointer GrassSymbolText ; 0x0047 + textpointer FireSymbolText ; 0x0048 + textpointer WaterSymbolText ; 0x0049 + textpointer LightningSymbolText ; 0x004a + textpointer FightingSymbolText ; 0x004b + textpointer PsychicSymbolText ; 0x004c textpointer Text004d ; 0x004d textpointer KnockOutText ; 0x004e textpointer DamageToSelfDueToConfusionText ; 0x004f @@ -203,11 +203,11 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text00c7 ; 0x00c7 textpointer Text00c8 ; 0x00c8 textpointer Text00c9 ; 0x00c9 - textpointer Text00ca ; 0x00ca + textpointer OnlyOncePerTurnText ; 0x00ca textpointer CannotUseDueToStatusText ; 0x00cb textpointer Text00cc ; 0x00cc textpointer Text00cd ; 0x00cd - textpointer Text00ce ; 0x00ce + textpointer NoGrassEnergyText ; 0x00ce textpointer Text00cf ; 0x00cf textpointer Text00d0 ; 0x00d0 textpointer Text00d1 ; 0x00d1 @@ -276,10 +276,10 @@ TextOffsets:: ; 34000 (d:4000) textpointer DuelistIsSelectingPokemonToPlaceInArenaText ; 0x0110 textpointer Text0111 ; 0x0111 textpointer Text0112 ; 0x0112 - textpointer Text0113 ; 0x0113 + textpointer ChoosePokemonWishToColorChangeText ; 0x0113 textpointer Text0114 ; 0x0114 textpointer Text0115 ; 0x0115 - textpointer Text0116 ; 0x0116 + textpointer ChangedTheColorOfText ; 0x0116 textpointer Text0117 ; 0x0117 textpointer DrawCardsFromTheDeckText ; 0x0118 textpointer CannotDrawCardBecauseNoCardsInDeckText ; 0x0119 @@ -295,16 +295,16 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text0123 ; 0x0123 textpointer Text0124 ; 0x0124 textpointer Text0125 ; 0x0125 - textpointer ChooseAnOddishFromTheDeckText ; 0x0126 + textpointer ChooseAnOddishFromDeckText ; 0x0126 textpointer ChooseAnOddishText ; 0x0127 textpointer Text0128 ; 0x0128 textpointer Text0129 ; 0x0129 textpointer ChooseNidoranFromDeckText ; 0x012a textpointer ChooseNidoranText ; 0x012b textpointer Text012c ; 0x012c - textpointer Text012d ; 0x012d - textpointer Text012e ; 0x012e - textpointer Text012f ; 0x012f + textpointer ProcedureForEnergyTransferText ; 0x012d + textpointer ChooseABellsproutFromDeckText ; 0x012e + textpointer ChooseABellsproutText ; 0x012f textpointer Text0130 ; 0x0130 textpointer Text0131 ; 0x0131 textpointer Text0132 ; 0x0132 @@ -322,7 +322,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text013e ; 0x013e textpointer NidoranMNidoranFText ; 0x013f textpointer OddishText ; 0x0140 - textpointer Text0141 ; 0x0141 + textpointer BellsproutText ; 0x0141 textpointer Text0142 ; 0x0142 textpointer Text0143 ; 0x0143 textpointer Text0144 ; 0x0144 diff --git a/src/wram.asm b/src/wram.asm index 3613eba..8f30cf5 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -102,18 +102,18 @@ wPlayerBench5CardStage:: ; c2d3 ds $1 ; changed type from Venomoth's Shift Pokemon Power -; if bit 7 == 1, then bits 0-3 override the Pokemon's actual type -wPlayerArenaCardChangedType:: ; c2d4 +; if bit 7 == 1, then bits 0-3 override the Pokemon's actual color +wPlayerArenaCardChangedColor:: ; c2d4 ds $1 -wPlayerBench1CardChangedType:: ; c2d5 +wPlayerBench1CardChangedColor:: ; c2d5 ds $1 -wPlayerBench2CardChangedType:: ; c2d6 +wPlayerBench2CardChangedColor:: ; c2d6 ds $1 -wPlayerBench3CardChangedType:: ; c2d7 +wPlayerBench3CardChangedColor:: ; c2d7 ds $1 -wPlayerBench4CardChangedType:: ; c2d8 +wPlayerBench4CardChangedColor:: ; c2d8 ds $1 -wPlayerBench5CardChangedType:: ; c2d9 +wPlayerBench5CardChangedColor:: ; c2d9 ds $1 wPlayerArenaCardAttachedDefender:: ; c2da @@ -249,17 +249,17 @@ wOpponentBench4CardStage:: ; c3d2 wOpponentBench5CardStage:: ; c3d3 ds $1 -wOpponentArenaCardChangedType:: ; c3d4 +wOpponentArenaCardChangedColor:: ; c3d4 ds $1 -wOpponentBench1CardChangedType:: ; c3d5 +wOpponentBench1CardChangedColor:: ; c3d5 ds $1 -wOpponentBench2CardChangedType:: ; c3d6 +wOpponentBench2CardChangedColor:: ; c3d6 ds $1 -wOpponentBench3CardChangedType:: ; c3d7 +wOpponentBench3CardChangedColor:: ; c3d7 ds $1 -wOpponentBench4CardChangedType:: ; c3d8 +wOpponentBench4CardChangedColor:: ; c3d8 ds $1 -wOpponentBench5CardChangedType:: ; c3d9 +wOpponentBench5CardChangedColor:: ; c3d9 ds $1 wOpponentArenaCardAttachedDefender:: ; c3da @@ -988,6 +988,7 @@ wEffectFunctionsFeedback:: ; ccce ds $18 ; this is 1 (non-0) if dealing damage to self due to confusion +; or a self-destruct type attack wIsDamageToSelf:: ; cce6 ds $1 |