diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-23 17:50:50 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-23 17:50:50 -0400 |
commit | 0a62d48df2d73c11ca13e4c3015d3d3abfa20292 (patch) | |
tree | 530f89782772bb76a76fbdd28247f1c6e3248483 | |
parent | bdeb494add78beb8d00375f352a2c49e9f7fd32b (diff) |
Move more tables from engine/ to data/
This also splits the end of engine/battle/core.asm into engine/battle/effects.asm.
65 files changed, 2864 insertions, 2826 deletions
diff --git a/data/battle/always_happen_effects.asm b/data/battle/always_happen_effects.asm new file mode 100644 index 00000000..4b6d466f --- /dev/null +++ b/data/battle/always_happen_effects.asm @@ -0,0 +1,13 @@ +AlwaysHappenSideEffects: +; Attacks that aren't finished after they faint the opponent. + db DRAIN_HP_EFFECT + db EXPLODE_EFFECT + db DREAM_EATER_EFFECT + db PAY_DAY_EFFECT + db TWO_TO_FIVE_ATTACKS_EFFECT + db $1E + db ATTACK_TWICE_EFFECT + db RECOIL_EFFECT + db TWINEEDLE_EFFECT + db RAGE_EFFECT + db -1 diff --git a/data/battle/critical_hit_moves.asm b/data/battle/critical_hit_moves.asm new file mode 100644 index 00000000..ee7543e8 --- /dev/null +++ b/data/battle/critical_hit_moves.asm @@ -0,0 +1,6 @@ +HighCriticalMoves: + db KARATE_CHOP + db RAZOR_LEAF + db CRABHAMMER + db SLASH + db $FF diff --git a/data/battle/residual_effects_1.asm b/data/battle/residual_effects_1.asm new file mode 100644 index 00000000..36e28391 --- /dev/null +++ b/data/battle/residual_effects_1.asm @@ -0,0 +1,20 @@ +; These are move effects (second value from the Moves table in bank $E). +ResidualEffects1: +; most non-side effects + db CONVERSION_EFFECT + db HAZE_EFFECT + db SWITCH_AND_TELEPORT_EFFECT + db MIST_EFFECT + db FOCUS_ENERGY_EFFECT + db CONFUSION_EFFECT + db HEAL_EFFECT + db TRANSFORM_EFFECT + db LIGHT_SCREEN_EFFECT + db REFLECT_EFFECT + db POISON_EFFECT + db PARALYZE_EFFECT + db SUBSTITUTE_EFFECT + db MIMIC_EFFECT + db LEECH_SEED_EFFECT + db SPLASH_EFFECT + db -1 diff --git a/data/battle/residual_effects_2.asm b/data/battle/residual_effects_2.asm new file mode 100644 index 00000000..cde55cc9 --- /dev/null +++ b/data/battle/residual_effects_2.asm @@ -0,0 +1,32 @@ +ResidualEffects2: +; non-side effects not included in ResidualEffects1 +; stat-affecting moves, sleep-inflicting moves, and Bide +; e.g., Meditate, Bide, Hypnosis + db $01 + db ATTACK_UP1_EFFECT + db DEFENSE_UP1_EFFECT + db SPEED_UP1_EFFECT + db SPECIAL_UP1_EFFECT + db ACCURACY_UP1_EFFECT + db EVASION_UP1_EFFECT + db ATTACK_DOWN1_EFFECT + db DEFENSE_DOWN1_EFFECT + db SPEED_DOWN1_EFFECT + db SPECIAL_DOWN1_EFFECT + db ACCURACY_DOWN1_EFFECT + db EVASION_DOWN1_EFFECT + db BIDE_EFFECT + db SLEEP_EFFECT + db ATTACK_UP2_EFFECT + db DEFENSE_UP2_EFFECT + db SPEED_UP2_EFFECT + db SPECIAL_UP2_EFFECT + db ACCURACY_UP2_EFFECT + db EVASION_UP2_EFFECT + db ATTACK_DOWN2_EFFECT + db DEFENSE_DOWN2_EFFECT + db SPEED_DOWN2_EFFECT + db SPECIAL_DOWN2_EFFECT + db ACCURACY_DOWN2_EFFECT + db EVASION_DOWN2_EFFECT + db -1 diff --git a/data/battle/set_damage_effects.asm b/data/battle/set_damage_effects.asm new file mode 100644 index 00000000..3fc75e41 --- /dev/null +++ b/data/battle/set_damage_effects.asm @@ -0,0 +1,6 @@ +SetDamageEffects: +; moves that do damage but not through normal calculations +; e.g., Super Fang, Psywave + db SUPER_FANG_EFFECT + db SPECIAL_DAMAGE_EFFECT + db -1 diff --git a/data/battle/special_effects.asm b/data/battle/special_effects.asm new file mode 100644 index 00000000..0db05b9a --- /dev/null +++ b/data/battle/special_effects.asm @@ -0,0 +1,24 @@ +SpecialEffects: +; Effects from arrays 2, 4, and 5B, minus Twineedle and Rage. +; Includes all effects that do not need to be called at the end of +; ExecutePlayerMove (or ExecuteEnemyMove), because they have already been handled + db DRAIN_HP_EFFECT + db EXPLODE_EFFECT + db DREAM_EATER_EFFECT + db PAY_DAY_EFFECT + db SWIFT_EFFECT + db TWO_TO_FIVE_ATTACKS_EFFECT + db $1E + db CHARGE_EFFECT + db SUPER_FANG_EFFECT + db SPECIAL_DAMAGE_EFFECT + db FLY_EFFECT + db ATTACK_TWICE_EFFECT + db JUMP_KICK_EFFECT + db RECOIL_EFFECT + ; fallthrough to Next EffectsArray +SpecialEffectsCont: +; damaging moves whose effect is executed prior to damage calculation + db THRASH_PETAL_DANCE_EFFECT + db TRAPPING_EFFECT + db -1 diff --git a/data/battle/stat_modifiers.asm b/data/battle/stat_modifiers.asm new file mode 100644 index 00000000..c0a6355a --- /dev/null +++ b/data/battle/stat_modifiers.asm @@ -0,0 +1,15 @@ +StatModifierRatios: +; first byte is numerator, second byte is denominator + db 25, 100 ; 0.25 + db 28, 100 ; 0.28 + db 33, 100 ; 0.33 + db 40, 100 ; 0.40 + db 50, 100 ; 0.50 + db 66, 100 ; 0.66 + db 1, 1 ; 1.00 + db 15, 10 ; 1.50 + db 2, 1 ; 2.00 + db 25, 10 ; 2.50 + db 3, 1 ; 3.00 + db 35, 10 ; 3.50 + db 4, 1 ; 4.00 diff --git a/data/battle/unused_critical_hit_moves.asm b/data/battle/unused_critical_hit_moves.asm new file mode 100644 index 00000000..84cb65ce --- /dev/null +++ b/data/battle/unused_critical_hit_moves.asm @@ -0,0 +1,6 @@ +UnusedHighCriticalMoves: + db KARATE_CHOP + db RAZOR_LEAF + db CRABHAMMER + db SLASH + db $FF diff --git a/data/bookshelf_tile_ids.asm b/data/bookshelf_tile_ids.asm new file mode 100644 index 00000000..535bf8e9 --- /dev/null +++ b/data/bookshelf_tile_ids.asm @@ -0,0 +1,37 @@ +; format: db tileset id, bookshelf tile id, text id +BookshelfTileIDs: + db PLATEAU, $30 + db_tx_pre IndigoPlateauStatues + db HOUSE, $3D + db_tx_pre TownMapText + db HOUSE, $1E + db_tx_pre BookOrSculptureText + db MANSION, $32 + db_tx_pre BookOrSculptureText + db REDS_HOUSE_1, $32 + db_tx_pre BookOrSculptureText + db LAB, $28 + db_tx_pre BookOrSculptureText + db LOBBY, $16 + db_tx_pre ElevatorText + db GYM, $1D + db_tx_pre BookOrSculptureText + db DOJO, $1D + db_tx_pre BookOrSculptureText + db GATE, $22 + db_tx_pre BookOrSculptureText + db MART, $54 + db_tx_pre PokemonStuffText + db MART, $55 + db_tx_pre PokemonStuffText + db POKECENTER, $54 + db_tx_pre PokemonStuffText + db POKECENTER, $55 + db_tx_pre PokemonStuffText + db LOBBY, $50 + db_tx_pre PokemonStuffText + db LOBBY, $52 + db_tx_pre PokemonStuffText + db SHIP, $36 + db_tx_pre BookOrSculptureText + db $FF diff --git a/data/cut_tree_blocks.asm b/data/cut_tree_blocks.asm new file mode 100644 index 00000000..eb63a712 --- /dev/null +++ b/data/cut_tree_blocks.asm @@ -0,0 +1,13 @@ +CutTreeBlockSwaps: +; first byte = tileset block containing the cut tree +; second byte = corresponding tileset block after the cut animation happens + db $32, $6D + db $33, $6C + db $34, $6F + db $35, $4C + db $60, $6E + db $0B, $0A + db $3C, $35 + db $3F, $35 + db $3D, $36 + db $FF ; list terminator diff --git a/data/door_tile_ids.asm b/data/door_tile_ids.asm new file mode 100644 index 00000000..686e418c --- /dev/null +++ b/data/door_tile_ids.asm @@ -0,0 +1,48 @@ +DoorTileIDPointers: + dbw OVERWORLD, OverworldDoorTileIDs + dbw FOREST, ForestDoorTileIDs + dbw MART, MartDoorTileIDs + dbw HOUSE, HouseDoorTileIDs + dbw FOREST_GATE, TilesetMuseumDoorTileIDs + dbw MUSEUM, TilesetMuseumDoorTileIDs + dbw GATE, TilesetMuseumDoorTileIDs + dbw SHIP, ShipDoorTileIDs + dbw LOBBY, LobbyDoorTileIDs + dbw MANSION, MansionDoorTileIDs + dbw LAB, LabDoorTileIDs + dbw FACILITY, FacilityDoorTileIDs + dbw PLATEAU, PlateauDoorTileIDs + db $ff + +OverworldDoorTileIDs: + db $1B,$58,$00 + +ForestDoorTileIDs: + db $3a,$00 + +MartDoorTileIDs: + db $5e,$00 + +HouseDoorTileIDs: + db $54,$00 + +TilesetMuseumDoorTileIDs: + db $3b,$00 + +ShipDoorTileIDs: + db $1e,$00 + +LobbyDoorTileIDs: + db $1c,$38,$1a,$00 + +MansionDoorTileIDs: + db $1a,$1c,$53,$00 + +LabDoorTileIDs: + db $34,$00 + +FacilityDoorTileIDs: + db $43,$58,$1b,$00 + +PlateauDoorTileIDs: + db $3b,$1b,$00 diff --git a/data/dungeon_maps.asm b/data/dungeon_maps.asm new file mode 100644 index 00000000..118cf46b --- /dev/null +++ b/data/dungeon_maps.asm @@ -0,0 +1,29 @@ +; GetBattleTransitionID_IsDungeonMap checks if wCurMap +; is equal to one of these maps +DungeonMaps1: + db VIRIDIAN_FOREST + db ROCK_TUNNEL_1F + db SEAFOAM_ISLANDS_1F + db ROCK_TUNNEL_B1F + db $FF + +; GetBattleTransitionID_IsDungeonMap checks if wCurMap +; is in between or equal to each pair of maps +DungeonMaps2: + ; all MT_MOON maps + db MT_MOON_1F + db MT_MOON_B2F + + ; all SS_ANNE maps, VICTORY_ROAD_1F, LANCES_ROOM, and HALL_OF_FAME + db SS_ANNE_1F + db HALL_OF_FAME + + ; all POKEMON_TOWER maps and Lavender Town buildings + db LAVENDER_POKECENTER + db LAVENDER_CUBONE_HOUSE + + ; SILPH_CO_[2-8]F, POKEMON_MANSION[2F-B1F], SAFARI_ZONE, and + ; CERULEAN_CAVE maps, except for SILPH_CO_1F + db SILPH_CO_2F + db CERULEAN_CAVE_1F + db $FF diff --git a/data/effects_pointers.asm b/data/effects_pointers.asm new file mode 100644 index 00000000..0d36e887 --- /dev/null +++ b/data/effects_pointers.asm @@ -0,0 +1,87 @@ +MoveEffectPointerTable: + dw SleepEffect ; unused effect + dw PoisonEffect ; POISON_SIDE_EFFECT1 + dw DrainHPEffect ; DRAIN_HP_EFFECT + dw FreezeBurnParalyzeEffect ; BURN_SIDE_EFFECT1 + dw FreezeBurnParalyzeEffect ; FREEZE_SIDE_EFFECT + dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT1 + dw ExplodeEffect ; EXPLODE_EFFECT + dw DrainHPEffect ; DREAM_EATER_EFFECT + dw $0000 ; MIRROR_MOVE_EFFECT + dw StatModifierUpEffect ; ATTACK_UP1_EFFECT + dw StatModifierUpEffect ; DEFENSE_UP1_EFFECT + dw StatModifierUpEffect ; SPEED_UP1_EFFECT + dw StatModifierUpEffect ; SPECIAL_UP1_EFFECT + dw StatModifierUpEffect ; ACCURACY_UP1_EFFECT + dw StatModifierUpEffect ; EVASION_UP1_EFFECT + dw PayDayEffect ; PAY_DAY_EFFECT + dw $0000 ; SWIFT_EFFECT + dw StatModifierDownEffect ; ATTACK_DOWN1_EFFECT + dw StatModifierDownEffect ; DEFENSE_DOWN1_EFFECT + dw StatModifierDownEffect ; SPEED_DOWN1_EFFECT + dw StatModifierDownEffect ; SPECIAL_DOWN1_EFFECT + dw StatModifierDownEffect ; ACCURACY_DOWN1_EFFECT + dw StatModifierDownEffect ; EVASION_DOWN1_EFFECT + dw ConversionEffect ; CONVERSION_EFFECT + dw HazeEffect ; HAZE_EFFECT + dw BideEffect ; BIDE_EFFECT + dw ThrashPetalDanceEffect ; THRASH_PETAL_DANCE_EFFECT + dw SwitchAndTeleportEffect ; SWITCH_AND_TELEPORT_EFFECT + dw TwoToFiveAttacksEffect ; TWO_TO_FIVE_ATTACKS_EFFECT + dw TwoToFiveAttacksEffect ; unused effect + dw FlinchSideEffect ; FLINCH_SIDE_EFFECT1 + dw SleepEffect ; SLEEP_EFFECT + dw PoisonEffect ; POISON_SIDE_EFFECT2 + dw FreezeBurnParalyzeEffect ; BURN_SIDE_EFFECT2 + dw FreezeBurnParalyzeEffect ; unused effect + dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT2 + dw FlinchSideEffect ; FLINCH_SIDE_EFFECT2 + dw OneHitKOEffect ; OHKO_EFFECT + dw ChargeEffect ; CHARGE_EFFECT + dw $0000 ; SUPER_FANG_EFFECT + dw $0000 ; SPECIAL_DAMAGE_EFFECT + dw TrappingEffect ; TRAPPING_EFFECT + dw ChargeEffect ; FLY_EFFECT + dw TwoToFiveAttacksEffect ; ATTACK_TWICE_EFFECT + dw $0000 ; JUMP_KICK_EFFECT + dw MistEffect ; MIST_EFFECT + dw FocusEnergyEffect ; FOCUS_ENERGY_EFFECT + dw RecoilEffect ; RECOIL_EFFECT + dw ConfusionEffect ; CONFUSION_EFFECT + dw StatModifierUpEffect ; ATTACK_UP2_EFFECT + dw StatModifierUpEffect ; DEFENSE_UP2_EFFECT + dw StatModifierUpEffect ; SPEED_UP2_EFFECT + dw StatModifierUpEffect ; SPECIAL_UP2_EFFECT + dw StatModifierUpEffect ; ACCURACY_UP2_EFFECT + dw StatModifierUpEffect ; EVASION_UP2_EFFECT + dw HealEffect ; HEAL_EFFECT + dw TransformEffect ; TRANSFORM_EFFECT + dw StatModifierDownEffect ; ATTACK_DOWN2_EFFECT + dw StatModifierDownEffect ; DEFENSE_DOWN2_EFFECT + dw StatModifierDownEffect ; SPEED_DOWN2_EFFECT + dw StatModifierDownEffect ; SPECIAL_DOWN2_EFFECT + dw StatModifierDownEffect ; ACCURACY_DOWN2_EFFECT + dw StatModifierDownEffect ; EVASION_DOWN2_EFFECT + dw ReflectLightScreenEffect ; LIGHT_SCREEN_EFFECT + dw ReflectLightScreenEffect ; REFLECT_EFFECT + dw PoisonEffect ; POISON_EFFECT + dw ParalyzeEffect ; PARALYZE_EFFECT + dw StatModifierDownEffect ; ATTACK_DOWN_SIDE_EFFECT + dw StatModifierDownEffect ; DEFENSE_DOWN_SIDE_EFFECT + dw StatModifierDownEffect ; SPEED_DOWN_SIDE_EFFECT + dw StatModifierDownEffect ; SPECIAL_DOWN_SIDE_EFFECT + dw StatModifierDownEffect ; unused effect + dw StatModifierDownEffect ; unused effect + dw StatModifierDownEffect ; unused effect + dw StatModifierDownEffect ; unused effect + dw ConfusionSideEffect ; CONFUSION_SIDE_EFFECT + dw TwoToFiveAttacksEffect ; TWINEEDLE_EFFECT + dw $0000 ; unused effect + dw SubstituteEffect ; SUBSTITUTE_EFFECT + dw HyperBeamEffect ; HYPER_BEAM_EFFECT + dw RageEffect ; RAGE_EFFECT + dw MimicEffect ; MIMIC_EFFECT + dw $0000 ; METRONOME_EFFECT + dw LeechSeedEffect ; LEECH_SEED_EFFECT + dw SplashEffect ; SPLASH_EFFECT + dw DisableEffect ; DISABLE_EFFECT diff --git a/data/growth_rates.asm b/data/growth_rates.asm new file mode 100644 index 00000000..6c443183 --- /dev/null +++ b/data/growth_rates.asm @@ -0,0 +1,12 @@ +; each entry has the following scheme: +; %AAAABBBB %SCCCCCCC %DDDDDDDD %EEEEEEEE +; resulting in +; (a*n^3)/b + sign*c*n^2 + d*n - e +; where sign = -1 <=> S=1 +GrowthRateTable: + db $11,$00,$00,$00 ; medium fast n^3 + db $34,$0A,$00,$1E ; (unused?) 3/4 n^3 + 10 n^2 - 30 + db $34,$14,$00,$46 ; (unused?) 3/4 n^3 + 20 n^2 - 70 + db $65,$8F,$64,$8C ; medium slow: 6/5 n^3 - 15 n^2 + 100 n - 140 + db $45,$00,$00,$00 ; fast: 4/5 n^3 + db $54,$00,$00,$00 ; slow: 5/4 n^3 diff --git a/data/guard_drink_items.asm b/data/guard_drink_items.asm new file mode 100644 index 00000000..effef203 --- /dev/null +++ b/data/guard_drink_items.asm @@ -0,0 +1,2 @@ +GuardDrinksList: + db FRESH_WATER, SODA_POP, LEMONADE, $00 diff --git a/data/ledge_tiles.asm b/data/ledge_tiles.asm new file mode 100644 index 00000000..b742af1a --- /dev/null +++ b/data/ledge_tiles.asm @@ -0,0 +1,11 @@ +LedgeTiles: + ; (player direction) (tile player standing on) (ledge tile) (input required) + db SPRITE_FACING_DOWN, $2C,$37,D_DOWN + db SPRITE_FACING_DOWN, $39,$36,D_DOWN + db SPRITE_FACING_DOWN, $39,$37,D_DOWN + db SPRITE_FACING_LEFT, $2C,$27,D_LEFT + db SPRITE_FACING_LEFT, $39,$27,D_LEFT + db SPRITE_FACING_RIGHT,$2C,$0D,D_RIGHT + db SPRITE_FACING_RIGHT,$2C,$1D,D_RIGHT + db SPRITE_FACING_RIGHT,$39,$0D,D_RIGHT + db $FF diff --git a/data/mon_party_sprite_pointers.asm b/data/mon_party_sprite_pointers.asm new file mode 100644 index 00000000..7e94b04a --- /dev/null +++ b/data/mon_party_sprite_pointers.asm @@ -0,0 +1,140 @@ +MonPartySpritePointers: + dw SlowbroSprite + $c0 + db $40 / $10 ; 40 bytes + db BANK(SlowbroSprite) + dw vSprites + + dw BallSprite + db $80 / $10 ; $80 bytes + db BANK(BallSprite) + dw vSprites + $40 + + dw ClefairySprite + $c0 + db $40 / $10 ; $40 bytes + db BANK(ClefairySprite) + dw vSprites + $c0 + + dw BirdSprite + $c0 + db $40 / $10 ; $40 bytes + db BANK(BirdSprite) + dw vSprites + $100 + + dw SeelSprite + db $40 / $10 ; $40 bytes + db BANK(SeelSprite) + dw vSprites + $140 + + dw MonPartySprites + $40 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $180 + + dw MonPartySprites + $50 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $1a0 + + dw MonPartySprites + $60 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $1c0 + + dw MonPartySprites + $70 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $1e0 + + dw MonPartySprites + $80 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $200 + + dw MonPartySprites + $90 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $220 + + dw MonPartySprites + $A0 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $240 + + dw MonPartySprites + $B0 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $260 + + dw MonPartySprites + $100 + db $40 / $10 ; $40 bytes + db BANK(MonPartySprites) + dw vSprites + $380 + + dw SlowbroSprite + db $40 / $10 ; $40 bytes + db BANK(SlowbroSprite) + dw vSprites + $400 + + dw BallSprite + db $80 / $10 ; $80 bytes + db BANK(BallSprite) + dw vSprites + $440 + + dw ClefairySprite + db $40 / $10 ; $40 bytes + db BANK(ClefairySprite) + dw vSprites + $4c0 + + dw BirdSprite + db $40 / $10 ; $40 bytes + db BANK(BirdSprite) + dw vSprites + $500 + + dw SeelSprite + $C0 + db $40 / $10 ; $40 bytes + db BANK(SeelSprite) + dw vSprites + $540 + + dw MonPartySprites + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $580 + + dw MonPartySprites + $10 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $5a0 + + dw MonPartySprites + $20 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $5c0 + + dw MonPartySprites + $30 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $5E0 + + dw MonPartySprites + $C0 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $600 + + dw MonPartySprites + $D0 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $620 + + dw MonPartySprites + $E0 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $640 + + dw MonPartySprites + $F0 + db $10 / $10 ; $10 bytes + db BANK(MonPartySprites) + dw vSprites + $660 + + dw MonPartySprites + $140 + db $40 / $10 ; $40 bytes + db BANK(MonPartySprites) + dw vSprites + $780 diff --git a/data/move_animation_pointers.asm b/data/move_animation_pointers.asm new file mode 100644 index 00000000..ba607141 --- /dev/null +++ b/data/move_animation_pointers.asm @@ -0,0 +1,81 @@ +; Format: Special Effect ID (1 byte), Address (2 bytes) +SpecialEffectPointers: + db SE_DARK_SCREEN_FLASH ; $FE + dw AnimationFlashScreen + db SE_DARK_SCREEN_PALETTE ; $FD + dw AnimationDarkScreenPalette + db SE_RESET_SCREEN_PALETTE ; $FC + dw AnimationResetScreenPalette + db SE_SHAKE_SCREEN ; $FB + dw AnimationShakeScreen + db SE_WATER_DROPLETS_EVERYWHERE ; $FA + dw AnimationWaterDropletsEverywhere + db SE_DARKEN_MON_PALETTE ; $F9 + dw AnimationDarkenMonPalette + db SE_FLASH_SCREEN_LONG ; $F8 + dw AnimationFlashScreenLong + db SE_SLIDE_MON_UP ; $F7 + dw AnimationSlideMonUp + db SE_SLIDE_MON_DOWN ; $F6 + dw AnimationSlideMonDown + db SE_FLASH_MON_PIC ; $F5 + dw AnimationFlashMonPic + db SE_SLIDE_MON_OFF ; $F4 + dw AnimationSlideMonOff + db SE_BLINK_MON ; $F3 + dw AnimationBlinkMon + db SE_MOVE_MON_HORIZONTALLY ; $F2 + dw AnimationMoveMonHorizontally + db SE_RESET_MON_POSITION ; $F1 + dw AnimationResetMonPosition + db SE_LIGHT_SCREEN_PALETTE ; $F0 + dw AnimationLightScreenPalette + db SE_HIDE_MON_PIC ; $EF + dw AnimationHideMonPic + db SE_SQUISH_MON_PIC ; $EE + dw AnimationSquishMonPic + db SE_SHOOT_BALLS_UPWARD ; $ED + dw AnimationShootBallsUpward + db SE_SHOOT_MANY_BALLS_UPWARD ; $EC + dw AnimationShootManyBallsUpward + db SE_BOUNCE_UP_AND_DOWN ; $EB + dw AnimationBoundUpAndDown + db SE_MINIMIZE_MON ; $EA + dw AnimationMinimizeMon + db SE_SLIDE_MON_DOWN_AND_HIDE ; $E9 + dw AnimationSlideMonDownAndHide + db SE_TRANSFORM_MON ; $E8 + dw AnimationTransformMon + db SE_LEAVES_FALLING ; $E7 + dw AnimationLeavesFalling + db SE_PETALS_FALLING ; $E6 + dw AnimationPetalsFalling + db SE_SLIDE_MON_HALF_OFF ; $E5 + dw AnimationSlideMonHalfOff + db SE_SHAKE_ENEMY_HUD ; $E4 + dw AnimationShakeEnemyHUD + db SE_SHAKE_ENEMY_HUD_2 ; unused--same pointer as SE_SHAKE_ENEMY_HUD ($E4) + dw AnimationShakeEnemyHUD + db SE_SPIRAL_BALLS_INWARD ; $E2 + dw AnimationSpiralBallsInward + db SE_DELAY_ANIMATION_10 ; $E1 + dw AnimationDelay10 + db SE_FLASH_ENEMY_MON_PIC ; unused--same as SE_FLASH_MON_PIC ($F5), but for the enemy mon + dw AnimationFlashEnemyMonPic + db SE_HIDE_ENEMY_MON_PIC ; $DF + dw AnimationHideEnemyMonPic + db SE_BLINK_ENEMY_MON ; $DE + dw AnimationBlinkEnemyMon + db SE_SHOW_MON_PIC ; $DD + dw AnimationShowMonPic + db SE_SHOW_ENEMY_MON_PIC ; $DC + dw AnimationShowEnemyMonPic + db SE_SLIDE_ENEMY_MON_OFF ; $DB + dw AnimationSlideEnemyMonOff + db SE_SHAKE_BACK_AND_FORTH ; $DA + dw AnimationShakeBackAndForth + db SE_SUBSTITUTE_MON ; $D9 + dw AnimationSubstitute + db SE_WAVY_SCREEN ; $D8 + dw AnimationWavyScreen + db $FF diff --git a/data/move_animation_special_effects.asm b/data/move_animation_special_effects.asm new file mode 100644 index 00000000..9dfb5645 --- /dev/null +++ b/data/move_animation_special_effects.asm @@ -0,0 +1,75 @@ +; Format: Animation ID (1 byte), Address (2 bytes) +AnimationIdSpecialEffects: + db MEGA_PUNCH + dw AnimationFlashScreen + + db GUILLOTINE + dw AnimationFlashScreen + + db MEGA_KICK + dw AnimationFlashScreen + + db HEADBUTT + dw AnimationFlashScreen + + db TAIL_WHIP + dw TailWhipAnimationUnused + + db GROWL + dw DoGrowlSpecialEffects + + db DISABLE + dw AnimationFlashScreen + + db BLIZZARD + dw DoBlizzardSpecialEffects + + db BUBBLEBEAM + dw AnimationFlashScreen + + db HYPER_BEAM + dw FlashScreenEveryFourFrameBlocks + + db THUNDERBOLT + dw FlashScreenEveryEightFrameBlocks + + db REFLECT + dw AnimationFlashScreen + + db SELFDESTRUCT + dw DoExplodeSpecialEffects + + db SPORE + dw AnimationFlashScreen + + db EXPLOSION + dw DoExplodeSpecialEffects + + db ROCK_SLIDE + dw DoRockSlideSpecialEffects + + db TRADE_BALL_DROP_ANIM + dw TradeHidePokemon + + db TRADE_BALL_SHAKE_ANIM + dw TradeShakePokeball + + db TRADE_BALL_TILT_ANIM + dw TradeJumpPokeball + + db TOSS_ANIM + dw DoBallTossSpecialEffects + + db SHAKE_ANIM + dw DoBallShakeSpecialEffects + + db POOF_ANIM + dw DoPoofSpecialEffects + + db GREATTOSS_ANIM + dw DoBallTossSpecialEffects + + db ULTRATOSS_ANIM + dw DoBallTossSpecialEffects + + db $FF ; terminator diff --git a/data/move_grammar.asm b/data/move_grammar.asm new file mode 100644 index 00000000..8113ab7c --- /dev/null +++ b/data/move_grammar.asm @@ -0,0 +1,14 @@ +ExclamationPointMoveSets: + db SWORDS_DANCE, GROWTH + db $00 + db RECOVER, BIDE, SELFDESTRUCT, AMNESIA + db $00 + db MEDITATE, AGILITY, TELEPORT, MIMIC, DOUBLE_TEAM, BARRAGE + db $00 + db POUND, SCRATCH, VICEGRIP, WING_ATTACK, FLY, BIND, SLAM, HORN_ATTACK, BODY_SLAM + db WRAP, THRASH, TAIL_WHIP, LEER, BITE, GROWL, ROAR, SING, PECK, COUNTER + db STRENGTH, ABSORB, STRING_SHOT, EARTHQUAKE, FISSURE, DIG, TOXIC, SCREECH, HARDEN + db MINIMIZE, WITHDRAW, DEFENSE_CURL, METRONOME, LICK, CLAMP, CONSTRICT, POISON_GAS + db LEECH_LIFE, BUBBLE, FLASH, SPLASH, ACID_ARMOR, FURY_SWIPES, REST, SHARPEN, SLASH, SUBSTITUTE + db $00 + db $FF ; terminator diff --git a/data/move_sfx.asm b/data/move_sfx.asm new file mode 100644 index 00000000..28ad0b63 --- /dev/null +++ b/data/move_sfx.asm @@ -0,0 +1,168 @@ +MoveSoundTable: + ; ID, pitch mod, tempo mod + db SFX_POUND, $00,$80 ; POUND + db SFX_BATTLE_0C, $10,$80 ; KARATE_CHOP + db SFX_DOUBLESLAP, $00,$80 ; DOUBLESLAP + db SFX_BATTLE_0B, $01,$80 ; COMET_PUNCH + db SFX_BATTLE_0D, $00,$40 ; MEGA_PUNCH + db SFX_SILPH_SCOPE, $00,$ff ; PAY_DAY + db SFX_BATTLE_0D, $10,$60 ; FIRE_PUNCH + db SFX_BATTLE_0D, $20,$80 ; ICE_PUNCH + db SFX_BATTLE_0D, $00,$a0 ; THUNDERPUNCH + db SFX_DAMAGE, $00,$80 ; SCRATCH + db SFX_BATTLE_0F, $20,$40 ; VICEGRIP + db SFX_BATTLE_0F, $00,$80 ; GUILLOTINE + db SFX_BATTLE_0E, $00,$a0 ; RAZOR_WIND + db SFX_NOT_VERY_EFFECTIVE,$10,$c0 ; SWORDS_DANCE + db SFX_NOT_VERY_EFFECTIVE,$00,$a0 ; CUT + db SFX_BATTLE_12, $00,$c0 ; GUST + db SFX_BATTLE_12, $10,$a0 ; WING_ATTACK + db SFX_BATTLE_13, $00,$e0 ; WHIRLWIND + db SFX_NOT_VERY_EFFECTIVE,$20,$c0 ; FLY + db SFX_BATTLE_14, $00,$80 ; BIND + db SFX_BATTLE_22, $00,$80 ; SLAM + db SFX_VINE_WHIP, $01,$80 ; VINE_WHIP + db SFX_BATTLE_20, $00,$80 ; STOMP + db SFX_BATTLE_17, $f0,$40 ; DOUBLE_KICK + db SFX_SUPER_EFFECTIVE, $00,$80 ; MEGA_KICK + db SFX_BATTLE_17, $00,$80 ; JUMP_KICK + db SFX_BATTLE_21, $10,$80 ; ROLLING_KICK + db SFX_BATTLE_1B, $01,$a0 ; SAND_ATTACK + db SFX_BATTLE_18, $00,$80 ; HEADBUTT + db SFX_BATTLE_1E, $00,$60 ; HORN_ATTACK + db SFX_BATTLE_1E, $01,$40 ; FURY_ATTACK + db SFX_HORN_DRILL, $00,$a0 ; HORN_DRILL + db SFX_SUPER_EFFECTIVE, $10,$a0 ; TACKLE + db SFX_BATTLE_20, $00,$c0 ; BODY_SLAM + db SFX_BATTLE_14, $10,$60 ; WRAP + db SFX_SUPER_EFFECTIVE, $00,$a0 ; TAKE_DOWN + db SFX_BATTLE_22, $11,$c0 ; THRASH + db SFX_SUPER_EFFECTIVE, $20,$c0 ; DOUBLE_EDGE + db SFX_BATTLE_21, $00,$80 ; TAIL_WHIP + db SFX_BATTLE_1B, $00,$80 ; POISON_STING + db SFX_BATTLE_1B, $20,$c0 ; TWINEEDLE + db SFX_BATTLE_19, $00,$80 ; PIN_MISSILE + db SFX_BATTLE_31, $ff,$40 ; LEER + db SFX_BATTLE_1E, $00,$80 ; BITE + db SFX_BATTLE_0B, $00,$c0 ; GROWL + db SFX_BATTLE_0B, $00,$40 ; ROAR + db SFX_BATTLE_35, $00,$80 ; SING + db SFX_BATTLE_27, $40,$60 ; SUPERSONIC + db SFX_BATTLE_27, $00,$80 ; SONICBOOM + db SFX_BATTLE_27, $ff,$40 ; DISABLE + db SFX_BATTLE_2A, $80,$c0 ; ACID + db SFX_BATTLE_19, $10,$a0 ; EMBER + db SFX_BATTLE_19, $21,$e0 ; FLAMETHROWER + db SFX_BATTLE_29, $00,$80 ; MIST + db SFX_BATTLE_24, $20,$60 ; WATER_GUN + db SFX_BATTLE_2A, $00,$80 ; HYDRO_PUMP + db SFX_BATTLE_2C, $00,$80 ; SURF + db SFX_BATTLE_28, $40,$80 ; ICE_BEAM + db SFX_BATTLE_29, $f0,$e0 ; BLIZZARD + db SFX_PSYBEAM, $00,$80 ; PSYBEAM + db SFX_BATTLE_2A, $f0,$60 ; BUBBLEBEAM + db SFX_BATTLE_28, $00,$80 ; AURORA_BEAM + db SFX_BATTLE_36, $00,$80 ; HYPER_BEAM + db SFX_PECK, $01,$a0 ; PECK + db SFX_BATTLE_13, $f0,$20 ; DRILL_PECK + db SFX_BATTLE_23, $01,$c0 ; SUBMISSION + db SFX_BATTLE_23, $00,$80 ; LOW_KICK + db SFX_SUPER_EFFECTIVE, $00,$e0 ; COUNTER + db SFX_BATTLE_26, $01,$60 ; SEISMIC_TOSS + db SFX_BATTLE_26, $20,$40 ; STRENGTH + db SFX_BATTLE_24, $00,$80 ; ABSORB + db SFX_BATTLE_24, $40,$c0 ; MEGA_DRAIN + db SFX_BATTLE_1B, $03,$60 ; LEECH_SEED + db SFX_BATTLE_25, $11,$e0 ; GROWTH + db SFX_BATTLE_12, $20,$e0 ; RAZOR_LEAF + db SFX_BATTLE_2E, $00,$80 ; SOLARBEAM + db SFX_BATTLE_1C, $00,$80 ; POISONPOWDER + db SFX_BATTLE_1C, $11,$a0 ; STUN_SPORE + db SFX_BATTLE_1C, $01,$c0 ; SLEEP_POWDER + db SFX_BATTLE_13, $14,$c0 ; PETAL_DANCE + db SFX_BATTLE_1B, $02,$a0 ; STRING_SHOT + db SFX_BATTLE_29, $f0,$80 ; DRAGON_RAGE + db SFX_BATTLE_29, $20,$c0 ; FIRE_SPIN + db SFX_BATTLE_2F, $00,$20 ; THUNDERSHOCK + db SFX_BATTLE_2F, $20,$80 ; THUNDERBOLT + db SFX_BATTLE_2E, $12,$60 ; THUNDER_WAVE + db SFX_BATTLE_26, $00,$80 ; THUNDER + db SFX_BATTLE_14, $01,$e0 ; ROCK_THROW + db SFX_BATTLE_29, $0f,$e0 ; EARTHQUAKE + db SFX_BATTLE_29, $11,$20 ; FISSURE + db SFX_DAMAGE, $10,$40 ; DIG + db SFX_BATTLE_0F, $10,$c0 ; TOXIC + db SFX_BATTLE_14, $00,$20 ; CONFUSION + db SFX_PSYCHIC_M, $00,$80 ; PSYCHIC_M + db SFX_BATTLE_35, $11,$18 ; HYPNOSIS + db SFX_BATTLE_09, $20,$c0 ; MEDITATE + db SFX_FAINT_FALL, $20,$c0 ; AGILITY + db SFX_BATTLE_25, $00,$10 ; QUICK_ATTACK + db SFX_BATTLE_26, $f0,$20 ; RAGE + db SFX_BATTLE_33, $f0,$c0 ; TELEPORT + db SFX_NOT_VERY_EFFECTIVE,$f0,$e0 ; NIGHT_SHADE + db SFX_BATTLE_09, $f0,$40 ; MIMIC + db SFX_BATTLE_31, $00,$80 ; SCREECH + db SFX_BATTLE_33, $80,$40 ; DOUBLE_TEAM + db SFX_BATTLE_33, $00,$80 ; RECOVER + db SFX_BATTLE_14, $11,$20 ; HARDEN + db SFX_BATTLE_14, $22,$10 ; MINIMIZE + db SFX_BATTLE_1B, $f1,$ff ; SMOKESCREEN + db SFX_BATTLE_13, $f1,$ff ; CONFUSE_RAY + db SFX_BATTLE_14, $33,$30 ; WITHDRAW + db SFX_BATTLE_32, $40,$c0 ; DEFENSE_CURL + db SFX_BATTLE_0E, $20,$20 ; BARRIER + db SFX_BATTLE_0E, $f0,$10 ; LIGHT_SCREEN + db SFX_BATTLE_0F, $f8,$10 ; HAZE + db SFX_NOT_VERY_EFFECTIVE,$f0,$10 ; REFLECT + db SFX_BATTLE_25, $00,$80 ; FOCUS_ENERGY + db SFX_BATTLE_18, $00,$c0 ; BIDE + db SFX_BATTLE_32, $c0,$ff ; METRONOME + db SFX_BATTLE_09, $f2,$20 ; MIRROR_MOVE + db SFX_BATTLE_34, $00,$80 ; SELFDESTRUCT + db SFX_BATTLE_34, $00,$40 ; EGG_BOMB + db SFX_BATTLE_09, $00,$40 ; LICK + db SFX_NOT_VERY_EFFECTIVE,$10,$ff ; SMOG + db SFX_BATTLE_2A, $20,$20 ; SLUDGE + db SFX_BATTLE_32, $00,$80 ; BONE_CLUB + db SFX_BATTLE_29, $1f,$20 ; FIRE_BLAST + db SFX_BATTLE_25, $2f,$80 ; WATERFALL + db SFX_BATTLE_0F, $1f,$ff ; CLAMP + db SFX_BATTLE_2B, $1f,$60 ; SWIFT + db SFX_BATTLE_26, $1e,$20 ; SKULL_BASH + db SFX_BATTLE_26, $1f,$18 ; SPIKE_CANNON + db SFX_BATTLE_14, $0f,$80 ; CONSTRICT + db SFX_BATTLE_09, $f8,$10 ; AMNESIA + db SFX_FAINT_FALL, $18,$20 ; KINESIS + db SFX_BATTLE_32, $08,$40 ; SOFTBOILED + db SFX_BATTLE_17, $01,$e0 ; HI_JUMP_KICK + db SFX_NOT_VERY_EFFECTIVE,$09,$ff ; GLARE + db SFX_BATTLE_35, $42,$01 ; DREAM_EATER + db SFX_BATTLE_1C, $00,$ff ; POISON_GAS + db SFX_BATTLE_32, $08,$e0 ; BARRAGE + db SFX_BATTLE_24, $00,$80 ; LEECH_LIFE + db SFX_BATTLE_09, $88,$10 ; LOVELY_KISS + db SFX_BATTLE_25, $48,$ff ; SKY_ATTACK + db SFX_FAINT_FALL, $ff,$ff ; TRANSFORM + db SFX_BATTLE_24, $ff,$10 ; BUBBLE + db SFX_FAINT_FALL, $ff,$04 ; DIZZY_PUNCH + db SFX_BATTLE_1C, $01,$ff ; SPORE + db SFX_BATTLE_13, $f8,$ff ; FLASH + db SFX_BATTLE_0C, $f0,$f0 ; PSYWAVE + db SFX_BATTLE_0F, $08,$10 ; SPLASH + db SFX_BATTLE_0D, $f0,$ff ; ACID_ARMOR + db SFX_SUPER_EFFECTIVE, $f0,$ff ; CRABHAMMER + db SFX_BATTLE_34, $10,$ff ; EXPLOSION + db SFX_BATTLE_0E, $f0,$20 ; FURY_SWIPES + db SFX_BATTLE_2B, $f0,$60 ; BONEMERANG + db SFX_BATTLE_21, $12,$10 ; REST + db SFX_BATTLE_36, $f0,$20 ; ROCK_SLIDE + db SFX_BATTLE_1E, $12,$ff ; HYPER_FANG + db SFX_BATTLE_31, $80,$04 ; SHARPEN + db SFX_BATTLE_33, $f0,$10 ; CONVERSION + db SFX_BATTLE_29, $f8,$ff ; TRI_ATTACK + db SFX_BATTLE_26, $f0,$ff ; SUPER_FANG + db SFX_NOT_VERY_EFFECTIVE,$01,$ff ; SLASH + db SFX_BATTLE_2C, $d8,$04 ; SUBSTITUTE + db SFX_BATTLE_0B, $00,$80 ; STRUGGLE + db SFX_BATTLE_0B, $00,$80 diff --git a/data/overworld_items.asm b/data/overworld_items.asm new file mode 100644 index 00000000..c2c244fe --- /dev/null +++ b/data/overworld_items.asm @@ -0,0 +1,9 @@ +; items which close the item menu when used +UsableItems_CloseMenu: + db ESCAPE_ROPE + db ITEMFINDER + db POKE_FLUTE + db OLD_ROD + db GOOD_ROD + db SUPER_ROD + db $ff diff --git a/data/party_items.asm b/data/party_items.asm new file mode 100644 index 00000000..0126ed5e --- /dev/null +++ b/data/party_items.asm @@ -0,0 +1,39 @@ +; items which bring up the party menu when used +UsableItems_PartyMenu: + db MOON_STONE + db ANTIDOTE + db BURN_HEAL + db ICE_HEAL + db AWAKENING + db PARLYZ_HEAL + db FULL_RESTORE + db MAX_POTION + db HYPER_POTION + db SUPER_POTION + db POTION + db FIRE_STONE + db THUNDER_STONE + db WATER_STONE + db HP_UP + db PROTEIN + db IRON + db CARBOS + db CALCIUM + db RARE_CANDY + db LEAF_STONE + db FULL_HEAL + db REVIVE + db MAX_REVIVE + db FRESH_WATER + db SODA_POP + db LEMONADE + db X_ATTACK + db X_DEFEND + db X_SPEED + db X_SPECIAL + db PP_UP + db ETHER + db MAX_ETHER + db ELIXER + db MAX_ELIXER + db $ff diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm new file mode 100644 index 00000000..5ce797e0 --- /dev/null +++ b/data/predef_pointers.asm @@ -0,0 +1,102 @@ +PredefPointers:: +; these are pointers to ASM routines. +; they appear to be used in overworld map scripts. + add_predef DrawPlayerHUDAndHPBar + add_predef CopyUncompressedPicToTilemap + add_predef AnimateSendingOutMon + add_predef ScaleSpriteByTwo + add_predef LoadMonBackPic + add_predef CopyDownscaledMonTiles + dbw $03,JumpMoveEffect ; wrong bank + add_predef HealParty + add_predef MoveAnimation + add_predef DivideBCDPredef + add_predef DivideBCDPredef2 + add_predef AddBCDPredef + add_predef SubBCDPredef + add_predef DivideBCDPredef3 + add_predef DivideBCDPredef4 + add_predef InitPlayerData + add_predef FlagActionPredef + add_predef HideObject + add_predef IsObjectHidden + add_predef ApplyOutOfBattlePoisonDamage + add_predef AnyPartyAlive + add_predef ShowObject + add_predef ShowObject2 + add_predef ReplaceTileBlock + add_predef InitPlayerData2 + add_predef LoadTilesetHeader + add_predef LearnMoveFromLevelUp + add_predef LearnMove + add_predef GetQuantityOfItemInBag + dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; home bank + dbw $03,GiveItem ; home bank + add_predef ChangeBGPalColor0_4Frames + add_predef FindPathToPlayer + add_predef PredefShakeScreenVertically + add_predef CalcPositionOfPlayerRelativeToNPC + add_predef ConvertNPCMovementDirectionsToJoypadMasks + add_predef PredefShakeScreenHorizontally + add_predef UpdateHPBar + add_predef HPBarLength + add_predef Diploma_TextBoxBorder + add_predef DoubleOrHalveSelectedStats + add_predef ShowPokedexMenu + add_predef EvolutionAfterBattle + add_predef SaveSAVtoSRAM0 + add_predef InitOpponent + add_predef CableClub_Run + add_predef DrawBadges + add_predef ExternalClockTradeAnim + add_predef BattleTransition + add_predef CopyTileIDsFromList + add_predef PlayIntro + add_predef GetMoveSoundB + add_predef FlashScreen + add_predef GetTileAndCoordsInFrontOfPlayer + add_predef StatusScreen + add_predef StatusScreen2 + add_predef InternalClockTradeAnim + add_predef TrainerEngage + add_predef IndexToPokedex + add_predef DisplayPicCenteredOrUpperRight + add_predef UsedCut + add_predef ShowPokedexData + add_predef WriteMonMoves + add_predef SaveSAV + add_predef LoadSGB + add_predef MarkTownVisitedAndLoadMissableObjects + add_predef SetPartyMonTypes + add_predef CanLearnTM + add_predef TMToMove + add_predef _RunPaletteCommand + add_predef StarterDex + add_predef _AddPartyMon + add_predef UpdateHPBar2 + add_predef DrawEnemyHUDAndHPBar + add_predef LoadTownMap_Nest + add_predef PrintMonType + add_predef EmotionBubble + add_predef EmptyFunc3; return immediately + add_predef AskName + add_predef PewterGuys + add_predef SaveSAVtoSRAM2 + add_predef LoadSAV2 + add_predef LoadSAV + add_predef SaveSAVtoSRAM1 + add_predef DoInGameTradeDialogue + add_predef HallOfFamePC + add_predef DisplayDexRating + dbw $1E, _LeaveMapAnim ; wrong bank + dbw $1E, EnterMapAnim ; wrong bank + add_predef GetTileTwoStepsInFrontOfPlayer + add_predef CheckForCollisionWhenPushingBoulder + add_predef PrintStrengthTxt + add_predef PickUpItem + add_predef PrintMoveType + add_predef LoadMovePPs + add_predef DrawHP + add_predef DrawHP2 + add_predef DisplayElevatorFloorMenu + add_predef OaksAideScript diff --git a/data/rest_house_maps.asm b/data/rest_house_maps.asm new file mode 100644 index 00000000..2feb89d3 --- /dev/null +++ b/data/rest_house_maps.asm @@ -0,0 +1,5 @@ +SafariZoneRestHouses: + db SAFARI_ZONE_WEST_REST_HOUSE + db SAFARI_ZONE_EAST_REST_HOUSE + db SAFARI_ZONE_NORTH_REST_HOUSE + db -1 diff --git a/data/trainer_ai_pointers.asm b/data/trainer_ai_pointers.asm new file mode 100644 index 00000000..d7cb5f19 --- /dev/null +++ b/data/trainer_ai_pointers.asm @@ -0,0 +1,51 @@ +TrainerAIPointers: +; one entry per trainer class +; first byte, number of times (per Pokémon) it can occur +; next two bytes, pointer to AI subroutine for trainer class + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,JugglerAI ; juggler_x + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,GenericAI + dbw 3,JugglerAI ; juggler + dbw 3,GenericAI + dbw 3,GenericAI + dbw 2,BlackbeltAI ; blackbelt + dbw 3,GenericAI + dbw 3,GenericAI + dbw 1,GenericAI ; chief + dbw 3,GenericAI + dbw 1,GiovanniAI ; giovanni + dbw 3,GenericAI + dbw 2,CooltrainerMAI ; cooltrainerm + dbw 1,CooltrainerFAI ; cooltrainerf + dbw 2,BrunoAI ; bruno + dbw 5,BrockAI ; brock + dbw 1,MistyAI ; misty + dbw 1,LtSurgeAI ; surge + dbw 1,ErikaAI ; erika + dbw 2,KogaAI ; koga + dbw 2,BlaineAI ; blaine + dbw 1,SabrinaAI ; sabrina + dbw 3,GenericAI + dbw 1,Sony2AI ; sony2 + dbw 1,Sony3AI ; sony3 + dbw 2,LoreleiAI ; lorelei + dbw 3,GenericAI + dbw 2,AgathaAI ; agatha + dbw 1,LanceAI ; lance diff --git a/data/trainer_move_choices.asm b/data/trainer_move_choices.asm new file mode 100644 index 00000000..ccbae448 --- /dev/null +++ b/data/trainer_move_choices.asm @@ -0,0 +1,50 @@ +; move choice modification methods that are applied for each trainer class +; 0 is sentinel value +TrainerClassMoveChoiceModifications: + db 0 ; YOUNGSTER + db 1,0 ; BUG CATCHER + db 1,0 ; LASS + db 1,3,0 ; SAILOR + db 1,0 ; JR_TRAINER_M + db 1,0 ; JR_TRAINER_F + db 1,2,3,0; POKEMANIAC + db 1,2,0 ; SUPER_NERD + db 1,0 ; HIKER + db 1,0 ; BIKER + db 1,3,0 ; BURGLAR + db 1,0 ; ENGINEER + db 1,2,0 ; JUGGLER_X + db 1,3,0 ; FISHER + db 1,3,0 ; SWIMMER + db 0 ; CUE_BALL + db 1,0 ; GAMBLER + db 1,3,0 ; BEAUTY + db 1,2,0 ; PSYCHIC_TR + db 1,3,0 ; ROCKER + db 1,0 ; JUGGLER + db 1,0 ; TAMER + db 1,0 ; BIRD_KEEPER + db 1,0 ; BLACKBELT + db 1,0 ; SONY1 + db 1,3,0 ; PROF_OAK + db 1,2,0 ; CHIEF + db 1,2,0 ; SCIENTIST + db 1,3,0 ; GIOVANNI + db 1,0 ; ROCKET + db 1,3,0 ; COOLTRAINER_M + db 1,3,0 ; COOLTRAINER_F + db 1,0 ; BRUNO + db 1,0 ; BROCK + db 1,3,0 ; MISTY + db 1,3,0 ; LT_SURGE + db 1,3,0 ; ERIKA + db 1,3,0 ; KOGA + db 1,3,0 ; BLAINE + db 1,3,0 ; SABRINA + db 1,2,0 ; GENTLEMAN + db 1,3,0 ; SONY2 + db 1,3,0 ; SONY3 + db 1,2,3,0; LORELEI + db 1,0 ; CHANNELER + db 1,0 ; AGATHA + db 1,3,0 ; LANCE diff --git a/engine/battle/trainer_pic_money_pointers.asm b/data/trainer_pic_money_pointers.asm index 37678e74..37678e74 100755 --- a/engine/battle/trainer_pic_money_pointers.asm +++ b/data/trainer_pic_money_pointers.asm diff --git a/data/vending_prices.asm b/data/vending_prices.asm new file mode 100644 index 00000000..9a473cc9 --- /dev/null +++ b/data/vending_prices.asm @@ -0,0 +1,7 @@ +VendingPrices: + db FRESH_WATER + money 200 + db SODA_POP + money 300 + db LEMONADE + money 350 diff --git a/data/warp_carpet_tile_ids.asm b/data/warp_carpet_tile_ids.asm new file mode 100644 index 00000000..6f312bc7 --- /dev/null +++ b/data/warp_carpet_tile_ids.asm @@ -0,0 +1,17 @@ +WarpTileListPointers: + dw .facingDownWarpTiles + dw .facingUpWarpTiles + dw .facingLeftWarpTiles + dw .facingRightWarpTiles + +.facingDownWarpTiles + db $01,$12,$17,$3D,$04,$18,$33,$FF + +.facingUpWarpTiles + db $01,$5C,$FF + +.facingLeftWarpTiles + db $1A,$4B,$FF + +.facingRightWarpTiles + db $0F,$4E,$FF diff --git a/data/warp_pad_hole_tile_ids.asm b/data/warp_pad_hole_tile_ids.asm new file mode 100644 index 00000000..3e2c1890 --- /dev/null +++ b/data/warp_pad_hole_tile_ids.asm @@ -0,0 +1,7 @@ +; format: db tileset id, tile id, value to be put in [wStandingOnWarpPadOrHole] +WarpPadAndHoleData: + db FACILITY, $20, 1 ; warp pad + db FACILITY, $11, 2 ; hole + db CAVERN, $22, 2 ; hole + db INTERIOR, $55, 1 ; warp pad + db $FF diff --git a/data/water_tilesets.asm b/data/water_tilesets.asm new file mode 100644 index 00000000..00f0ab1f --- /dev/null +++ b/data/water_tilesets.asm @@ -0,0 +1,4 @@ +; tilesets with water +WaterTilesets: + db OVERWORLD, FOREST, DOJO, GYM, SHIP, SHIP_PORT, CAVERN, FACILITY, PLATEAU + db $ff ; terminator diff --git a/data/wild_probabilities.asm b/data/wild_probabilities.asm new file mode 100644 index 00000000..9d4704c6 --- /dev/null +++ b/data/wild_probabilities.asm @@ -0,0 +1,15 @@ +WildMonEncounterSlotChances: +; There are 10 slots for wild pokemon, and this is the table that defines how common each of +; those 10 slots is. A random number is generated and then the first byte of each pair in this +; table is compared against that random number. If the random number is less than or equal +; to the first byte, then that slot is chosen. The second byte is double the slot number. + db $32, $00 ; 51/256 = 19.9% chance of slot 0 + db $65, $02 ; 51/256 = 19.9% chance of slot 1 + db $8C, $04 ; 39/256 = 15.2% chance of slot 2 + db $A5, $06 ; 25/256 = 9.8% chance of slot 3 + db $BE, $08 ; 25/256 = 9.8% chance of slot 4 + db $D7, $0A ; 25/256 = 9.8% chance of slot 5 + db $E4, $0C ; 13/256 = 5.1% chance of slot 6 + db $F1, $0E ; 13/256 = 5.1% chance of slot 7 + db $FC, $10 ; 11/256 = 4.3% chance of slot 8 + db $FF, $12 ; 3/256 = 1.2% chance of slot 9 diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 7d5ab20d..9eb7badb 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -649,81 +649,7 @@ DoSpecialEffectByAnimationId: pop hl ret -; Format: Animation ID (1 byte), Address (2 bytes) -AnimationIdSpecialEffects: - db MEGA_PUNCH - dw AnimationFlashScreen - - db GUILLOTINE - dw AnimationFlashScreen - - db MEGA_KICK - dw AnimationFlashScreen - - db HEADBUTT - dw AnimationFlashScreen - - db TAIL_WHIP - dw TailWhipAnimationUnused - - db GROWL - dw DoGrowlSpecialEffects - - db DISABLE - dw AnimationFlashScreen - - db BLIZZARD - dw DoBlizzardSpecialEffects - - db BUBBLEBEAM - dw AnimationFlashScreen - - db HYPER_BEAM - dw FlashScreenEveryFourFrameBlocks - - db THUNDERBOLT - dw FlashScreenEveryEightFrameBlocks - - db REFLECT - dw AnimationFlashScreen - - db SELFDESTRUCT - dw DoExplodeSpecialEffects - - db SPORE - dw AnimationFlashScreen - - db EXPLOSION - dw DoExplodeSpecialEffects - - db ROCK_SLIDE - dw DoRockSlideSpecialEffects - - db TRADE_BALL_DROP_ANIM - dw TradeHidePokemon - - db TRADE_BALL_SHAKE_ANIM - dw TradeShakePokeball - - db TRADE_BALL_TILT_ANIM - dw TradeJumpPokeball - - db TOSS_ANIM - dw DoBallTossSpecialEffects - - db SHAKE_ANIM - dw DoBallShakeSpecialEffects - - db POOF_ANIM - dw DoPoofSpecialEffects - - db GREATTOSS_ANIM - dw DoBallTossSpecialEffects - - db ULTRATOSS_ANIM - dw DoBallTossSpecialEffects - - db $FF ; terminator +INCLUDE "data/move_animation_special_effects.asm" DoBallTossSpecialEffects: ld a, [wcf91] @@ -985,87 +911,7 @@ TailWhipAnimationUnused: ld c, 20 jp DelayFrames -; Format: Special Effect ID (1 byte), Address (2 bytes) -SpecialEffectPointers: - db SE_DARK_SCREEN_FLASH ; $FE - dw AnimationFlashScreen - db SE_DARK_SCREEN_PALETTE ; $FD - dw AnimationDarkScreenPalette - db SE_RESET_SCREEN_PALETTE ; $FC - dw AnimationResetScreenPalette - db SE_SHAKE_SCREEN ; $FB - dw AnimationShakeScreen - db SE_WATER_DROPLETS_EVERYWHERE ; $FA - dw AnimationWaterDropletsEverywhere - db SE_DARKEN_MON_PALETTE ; $F9 - dw AnimationDarkenMonPalette - db SE_FLASH_SCREEN_LONG ; $F8 - dw AnimationFlashScreenLong - db SE_SLIDE_MON_UP ; $F7 - dw AnimationSlideMonUp - db SE_SLIDE_MON_DOWN ; $F6 - dw AnimationSlideMonDown - db SE_FLASH_MON_PIC ; $F5 - dw AnimationFlashMonPic - db SE_SLIDE_MON_OFF ; $F4 - dw AnimationSlideMonOff - db SE_BLINK_MON ; $F3 - dw AnimationBlinkMon - db SE_MOVE_MON_HORIZONTALLY ; $F2 - dw AnimationMoveMonHorizontally - db SE_RESET_MON_POSITION ; $F1 - dw AnimationResetMonPosition - db SE_LIGHT_SCREEN_PALETTE ; $F0 - dw AnimationLightScreenPalette - db SE_HIDE_MON_PIC ; $EF - dw AnimationHideMonPic - db SE_SQUISH_MON_PIC ; $EE - dw AnimationSquishMonPic - db SE_SHOOT_BALLS_UPWARD ; $ED - dw AnimationShootBallsUpward - db SE_SHOOT_MANY_BALLS_UPWARD ; $EC - dw AnimationShootManyBallsUpward - db SE_BOUNCE_UP_AND_DOWN ; $EB - dw AnimationBoundUpAndDown - db SE_MINIMIZE_MON ; $EA - dw AnimationMinimizeMon - db SE_SLIDE_MON_DOWN_AND_HIDE ; $E9 - dw AnimationSlideMonDownAndHide - db SE_TRANSFORM_MON ; $E8 - dw AnimationTransformMon - db SE_LEAVES_FALLING ; $E7 - dw AnimationLeavesFalling - db SE_PETALS_FALLING ; $E6 - dw AnimationPetalsFalling - db SE_SLIDE_MON_HALF_OFF ; $E5 - dw AnimationSlideMonHalfOff - db SE_SHAKE_ENEMY_HUD ; $E4 - dw AnimationShakeEnemyHUD - db SE_SHAKE_ENEMY_HUD_2 ; unused--same pointer as SE_SHAKE_ENEMY_HUD ($E4) - dw AnimationShakeEnemyHUD - db SE_SPIRAL_BALLS_INWARD ; $E2 - dw AnimationSpiralBallsInward - db SE_DELAY_ANIMATION_10 ; $E1 - dw AnimationDelay10 - db SE_FLASH_ENEMY_MON_PIC ; unused--same as SE_FLASH_MON_PIC ($F5), but for the enemy mon - dw AnimationFlashEnemyMonPic - db SE_HIDE_ENEMY_MON_PIC ; $DF - dw AnimationHideEnemyMonPic - db SE_BLINK_ENEMY_MON ; $DE - dw AnimationBlinkEnemyMon - db SE_SHOW_MON_PIC ; $DD - dw AnimationShowMonPic - db SE_SHOW_ENEMY_MON_PIC ; $DC - dw AnimationShowEnemyMonPic - db SE_SLIDE_ENEMY_MON_OFF ; $DB - dw AnimationSlideEnemyMonOff - db SE_SHAKE_BACK_AND_FORTH ; $DA - dw AnimationShakeBackAndForth - db SE_SUBSTITUTE_MON ; $D9 - dw AnimationSubstitute - db SE_WAVY_SCREEN ; $D8 - dw AnimationWavyScreen - db $FF +INCLUDE "data/move_animation_pointers.asm" AnimationDelay10: ld c, 10 @@ -2362,174 +2208,7 @@ IsCryMove: scf ret -MoveSoundTable: - ; ID, pitch mod, tempo mod - db SFX_POUND, $00,$80 ; POUND - db SFX_BATTLE_0C, $10,$80 ; KARATE_CHOP - db SFX_DOUBLESLAP, $00,$80 ; DOUBLESLAP - db SFX_BATTLE_0B, $01,$80 ; COMET_PUNCH - db SFX_BATTLE_0D, $00,$40 ; MEGA_PUNCH - db SFX_SILPH_SCOPE, $00,$ff ; PAY_DAY - db SFX_BATTLE_0D, $10,$60 ; FIRE_PUNCH - db SFX_BATTLE_0D, $20,$80 ; ICE_PUNCH - db SFX_BATTLE_0D, $00,$a0 ; THUNDERPUNCH - db SFX_DAMAGE, $00,$80 ; SCRATCH - db SFX_BATTLE_0F, $20,$40 ; VICEGRIP - db SFX_BATTLE_0F, $00,$80 ; GUILLOTINE - db SFX_BATTLE_0E, $00,$a0 ; RAZOR_WIND - db SFX_NOT_VERY_EFFECTIVE,$10,$c0 ; SWORDS_DANCE - db SFX_NOT_VERY_EFFECTIVE,$00,$a0 ; CUT - db SFX_BATTLE_12, $00,$c0 ; GUST - db SFX_BATTLE_12, $10,$a0 ; WING_ATTACK - db SFX_BATTLE_13, $00,$e0 ; WHIRLWIND - db SFX_NOT_VERY_EFFECTIVE,$20,$c0 ; FLY - db SFX_BATTLE_14, $00,$80 ; BIND - db SFX_BATTLE_22, $00,$80 ; SLAM - db SFX_VINE_WHIP, $01,$80 ; VINE_WHIP - db SFX_BATTLE_20, $00,$80 ; STOMP - db SFX_BATTLE_17, $f0,$40 ; DOUBLE_KICK - db SFX_SUPER_EFFECTIVE, $00,$80 ; MEGA_KICK - db SFX_BATTLE_17, $00,$80 ; JUMP_KICK - db SFX_BATTLE_21, $10,$80 ; ROLLING_KICK - db SFX_BATTLE_1B, $01,$a0 ; SAND_ATTACK - db SFX_BATTLE_18, $00,$80 ; HEADBUTT - db SFX_BATTLE_1E, $00,$60 ; HORN_ATTACK - db SFX_BATTLE_1E, $01,$40 ; FURY_ATTACK - db SFX_HORN_DRILL, $00,$a0 ; HORN_DRILL - db SFX_SUPER_EFFECTIVE, $10,$a0 ; TACKLE - db SFX_BATTLE_20, $00,$c0 ; BODY_SLAM - db SFX_BATTLE_14, $10,$60 ; WRAP - db SFX_SUPER_EFFECTIVE, $00,$a0 ; TAKE_DOWN - db SFX_BATTLE_22, $11,$c0 ; THRASH - db SFX_SUPER_EFFECTIVE, $20,$c0 ; DOUBLE_EDGE - db SFX_BATTLE_21, $00,$80 ; TAIL_WHIP - db SFX_BATTLE_1B, $00,$80 ; POISON_STING - db SFX_BATTLE_1B, $20,$c0 ; TWINEEDLE - db SFX_BATTLE_19, $00,$80 ; PIN_MISSILE - db SFX_BATTLE_31, $ff,$40 ; LEER - db SFX_BATTLE_1E, $00,$80 ; BITE - db SFX_BATTLE_0B, $00,$c0 ; GROWL - db SFX_BATTLE_0B, $00,$40 ; ROAR - db SFX_BATTLE_35, $00,$80 ; SING - db SFX_BATTLE_27, $40,$60 ; SUPERSONIC - db SFX_BATTLE_27, $00,$80 ; SONICBOOM - db SFX_BATTLE_27, $ff,$40 ; DISABLE - db SFX_BATTLE_2A, $80,$c0 ; ACID - db SFX_BATTLE_19, $10,$a0 ; EMBER - db SFX_BATTLE_19, $21,$e0 ; FLAMETHROWER - db SFX_BATTLE_29, $00,$80 ; MIST - db SFX_BATTLE_24, $20,$60 ; WATER_GUN - db SFX_BATTLE_2A, $00,$80 ; HYDRO_PUMP - db SFX_BATTLE_2C, $00,$80 ; SURF - db SFX_BATTLE_28, $40,$80 ; ICE_BEAM - db SFX_BATTLE_29, $f0,$e0 ; BLIZZARD - db SFX_PSYBEAM, $00,$80 ; PSYBEAM - db SFX_BATTLE_2A, $f0,$60 ; BUBBLEBEAM - db SFX_BATTLE_28, $00,$80 ; AURORA_BEAM - db SFX_BATTLE_36, $00,$80 ; HYPER_BEAM - db SFX_PECK, $01,$a0 ; PECK - db SFX_BATTLE_13, $f0,$20 ; DRILL_PECK - db SFX_BATTLE_23, $01,$c0 ; SUBMISSION - db SFX_BATTLE_23, $00,$80 ; LOW_KICK - db SFX_SUPER_EFFECTIVE, $00,$e0 ; COUNTER - db SFX_BATTLE_26, $01,$60 ; SEISMIC_TOSS - db SFX_BATTLE_26, $20,$40 ; STRENGTH - db SFX_BATTLE_24, $00,$80 ; ABSORB - db SFX_BATTLE_24, $40,$c0 ; MEGA_DRAIN - db SFX_BATTLE_1B, $03,$60 ; LEECH_SEED - db SFX_BATTLE_25, $11,$e0 ; GROWTH - db SFX_BATTLE_12, $20,$e0 ; RAZOR_LEAF - db SFX_BATTLE_2E, $00,$80 ; SOLARBEAM - db SFX_BATTLE_1C, $00,$80 ; POISONPOWDER - db SFX_BATTLE_1C, $11,$a0 ; STUN_SPORE - db SFX_BATTLE_1C, $01,$c0 ; SLEEP_POWDER - db SFX_BATTLE_13, $14,$c0 ; PETAL_DANCE - db SFX_BATTLE_1B, $02,$a0 ; STRING_SHOT - db SFX_BATTLE_29, $f0,$80 ; DRAGON_RAGE - db SFX_BATTLE_29, $20,$c0 ; FIRE_SPIN - db SFX_BATTLE_2F, $00,$20 ; THUNDERSHOCK - db SFX_BATTLE_2F, $20,$80 ; THUNDERBOLT - db SFX_BATTLE_2E, $12,$60 ; THUNDER_WAVE - db SFX_BATTLE_26, $00,$80 ; THUNDER - db SFX_BATTLE_14, $01,$e0 ; ROCK_THROW - db SFX_BATTLE_29, $0f,$e0 ; EARTHQUAKE - db SFX_BATTLE_29, $11,$20 ; FISSURE - db SFX_DAMAGE, $10,$40 ; DIG - db SFX_BATTLE_0F, $10,$c0 ; TOXIC - db SFX_BATTLE_14, $00,$20 ; CONFUSION - db SFX_PSYCHIC_M, $00,$80 ; PSYCHIC_M - db SFX_BATTLE_35, $11,$18 ; HYPNOSIS - db SFX_BATTLE_09, $20,$c0 ; MEDITATE - db SFX_FAINT_FALL, $20,$c0 ; AGILITY - db SFX_BATTLE_25, $00,$10 ; QUICK_ATTACK - db SFX_BATTLE_26, $f0,$20 ; RAGE - db SFX_BATTLE_33, $f0,$c0 ; TELEPORT - db SFX_NOT_VERY_EFFECTIVE,$f0,$e0 ; NIGHT_SHADE - db SFX_BATTLE_09, $f0,$40 ; MIMIC - db SFX_BATTLE_31, $00,$80 ; SCREECH - db SFX_BATTLE_33, $80,$40 ; DOUBLE_TEAM - db SFX_BATTLE_33, $00,$80 ; RECOVER - db SFX_BATTLE_14, $11,$20 ; HARDEN - db SFX_BATTLE_14, $22,$10 ; MINIMIZE - db SFX_BATTLE_1B, $f1,$ff ; SMOKESCREEN - db SFX_BATTLE_13, $f1,$ff ; CONFUSE_RAY - db SFX_BATTLE_14, $33,$30 ; WITHDRAW - db SFX_BATTLE_32, $40,$c0 ; DEFENSE_CURL - db SFX_BATTLE_0E, $20,$20 ; BARRIER - db SFX_BATTLE_0E, $f0,$10 ; LIGHT_SCREEN - db SFX_BATTLE_0F, $f8,$10 ; HAZE - db SFX_NOT_VERY_EFFECTIVE,$f0,$10 ; REFLECT - db SFX_BATTLE_25, $00,$80 ; FOCUS_ENERGY - db SFX_BATTLE_18, $00,$c0 ; BIDE - db SFX_BATTLE_32, $c0,$ff ; METRONOME - db SFX_BATTLE_09, $f2,$20 ; MIRROR_MOVE - db SFX_BATTLE_34, $00,$80 ; SELFDESTRUCT - db SFX_BATTLE_34, $00,$40 ; EGG_BOMB - db SFX_BATTLE_09, $00,$40 ; LICK - db SFX_NOT_VERY_EFFECTIVE,$10,$ff ; SMOG - db SFX_BATTLE_2A, $20,$20 ; SLUDGE - db SFX_BATTLE_32, $00,$80 ; BONE_CLUB - db SFX_BATTLE_29, $1f,$20 ; FIRE_BLAST - db SFX_BATTLE_25, $2f,$80 ; WATERFALL - db SFX_BATTLE_0F, $1f,$ff ; CLAMP - db SFX_BATTLE_2B, $1f,$60 ; SWIFT - db SFX_BATTLE_26, $1e,$20 ; SKULL_BASH - db SFX_BATTLE_26, $1f,$18 ; SPIKE_CANNON - db SFX_BATTLE_14, $0f,$80 ; CONSTRICT - db SFX_BATTLE_09, $f8,$10 ; AMNESIA - db SFX_FAINT_FALL, $18,$20 ; KINESIS - db SFX_BATTLE_32, $08,$40 ; SOFTBOILED - db SFX_BATTLE_17, $01,$e0 ; HI_JUMP_KICK - db SFX_NOT_VERY_EFFECTIVE,$09,$ff ; GLARE - db SFX_BATTLE_35, $42,$01 ; DREAM_EATER - db SFX_BATTLE_1C, $00,$ff ; POISON_GAS - db SFX_BATTLE_32, $08,$e0 ; BARRAGE - db SFX_BATTLE_24, $00,$80 ; LEECH_LIFE - db SFX_BATTLE_09, $88,$10 ; LOVELY_KISS - db SFX_BATTLE_25, $48,$ff ; SKY_ATTACK - db SFX_FAINT_FALL, $ff,$ff ; TRANSFORM - db SFX_BATTLE_24, $ff,$10 ; BUBBLE - db SFX_FAINT_FALL, $ff,$04 ; DIZZY_PUNCH - db SFX_BATTLE_1C, $01,$ff ; SPORE - db SFX_BATTLE_13, $f8,$ff ; FLASH - db SFX_BATTLE_0C, $f0,$f0 ; PSYWAVE - db SFX_BATTLE_0F, $08,$10 ; SPLASH - db SFX_BATTLE_0D, $f0,$ff ; ACID_ARMOR - db SFX_SUPER_EFFECTIVE, $f0,$ff ; CRABHAMMER - db SFX_BATTLE_34, $10,$ff ; EXPLOSION - db SFX_BATTLE_0E, $f0,$20 ; FURY_SWIPES - db SFX_BATTLE_2B, $f0,$60 ; BONEMERANG - db SFX_BATTLE_21, $12,$10 ; REST - db SFX_BATTLE_36, $f0,$20 ; ROCK_SLIDE - db SFX_BATTLE_1E, $12,$ff ; HYPER_FANG - db SFX_BATTLE_31, $80,$04 ; SHARPEN - db SFX_BATTLE_33, $f0,$10 ; CONVERSION - db SFX_BATTLE_29, $f8,$ff ; TRI_ATTACK - db SFX_BATTLE_26, $f0,$ff ; SUPER_FANG - db SFX_NOT_VERY_EFFECTIVE,$01,$ff ; SLASH - db SFX_BATTLE_2C, $d8,$04 ; SUBSTITUTE - db SFX_BATTLE_0B, $00,$80 ; STRUGGLE - db SFX_BATTLE_0B, $00,$80 +INCLUDE "data/move_sfx.asm" CopyPicTiles: ld a, [H_WHOSETURN] diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 436e38b5..f2e26ed5 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -151,35 +151,7 @@ GetBattleTransitionID_IsDungeonMap: res 2, c ret -; GetBattleTransitionID_IsDungeonMap checks if wCurMap -; is equal to one of these maps -DungeonMaps1: - db VIRIDIAN_FOREST - db ROCK_TUNNEL_1F - db SEAFOAM_ISLANDS_1F - db ROCK_TUNNEL_B1F - db $FF - -; GetBattleTransitionID_IsDungeonMap checks if wCurMap -; is in between or equal to each pair of maps -DungeonMaps2: - ; all MT_MOON maps - db MT_MOON_1F - db MT_MOON_B2F - - ; all SS_ANNE maps, VICTORY_ROAD_1F, LANCES_ROOM, and HALL_OF_FAME - db SS_ANNE_1F - db HALL_OF_FAME - - ; all POKEMON_TOWER maps and Lavender Town buildings - db LAVENDER_POKECENTER - db LAVENDER_CUBONE_HOUSE - - ; SILPH_CO_[2-8]F, POKEMON_MANSION[2F-B1F], SAFARI_ZONE, and - ; CERULEAN_CAVE maps, except for SILPH_CO_1F - db SILPH_CO_2F - db CERULEAN_CAVE_1F - db $FF +INCLUDE "data/dungeon_maps.asm" LoadBattleTransitionTile: ld hl, vChars1 + $7f0 diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index 4a138048..e541d604 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -5,7 +5,7 @@ PrintBeginningBattleText: ld a, [wCurMap] cp POKEMON_TOWER_3F jr c, .notPokemonTower - cp MR_FUJIS_HOUSE + cp POKEMON_TOWER_7F + 1 jr c, .pokemonTower .notPokemonTower ld a, [wEnemyMonSpecies2] diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 90033b53..96ec8e2f 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1,100 +1,10 @@ BattleCore: -; These are move effects (second value from the Moves table in bank $E). -ResidualEffects1: -; most non-side effects - db CONVERSION_EFFECT - db HAZE_EFFECT - db SWITCH_AND_TELEPORT_EFFECT - db MIST_EFFECT - db FOCUS_ENERGY_EFFECT - db CONFUSION_EFFECT - db HEAL_EFFECT - db TRANSFORM_EFFECT - db LIGHT_SCREEN_EFFECT - db REFLECT_EFFECT - db POISON_EFFECT - db PARALYZE_EFFECT - db SUBSTITUTE_EFFECT - db MIMIC_EFFECT - db LEECH_SEED_EFFECT - db SPLASH_EFFECT - db -1 -SetDamageEffects: -; moves that do damage but not through normal calculations -; e.g., Super Fang, Psywave - db SUPER_FANG_EFFECT - db SPECIAL_DAMAGE_EFFECT - db -1 -ResidualEffects2: -; non-side effects not included in ResidualEffects1 -; stat-affecting moves, sleep-inflicting moves, and Bide -; e.g., Meditate, Bide, Hypnosis - db $01 - db ATTACK_UP1_EFFECT - db DEFENSE_UP1_EFFECT - db SPEED_UP1_EFFECT - db SPECIAL_UP1_EFFECT - db ACCURACY_UP1_EFFECT - db EVASION_UP1_EFFECT - db ATTACK_DOWN1_EFFECT - db DEFENSE_DOWN1_EFFECT - db SPEED_DOWN1_EFFECT - db SPECIAL_DOWN1_EFFECT - db ACCURACY_DOWN1_EFFECT - db EVASION_DOWN1_EFFECT - db BIDE_EFFECT - db SLEEP_EFFECT - db ATTACK_UP2_EFFECT - db DEFENSE_UP2_EFFECT - db SPEED_UP2_EFFECT - db SPECIAL_UP2_EFFECT - db ACCURACY_UP2_EFFECT - db EVASION_UP2_EFFECT - db ATTACK_DOWN2_EFFECT - db DEFENSE_DOWN2_EFFECT - db SPEED_DOWN2_EFFECT - db SPECIAL_DOWN2_EFFECT - db ACCURACY_DOWN2_EFFECT - db EVASION_DOWN2_EFFECT - db -1 -AlwaysHappenSideEffects: -; Attacks that aren't finished after they faint the opponent. - db DRAIN_HP_EFFECT - db EXPLODE_EFFECT - db DREAM_EATER_EFFECT - db PAY_DAY_EFFECT - db TWO_TO_FIVE_ATTACKS_EFFECT - db $1E - db ATTACK_TWICE_EFFECT - db RECOIL_EFFECT - db TWINEEDLE_EFFECT - db RAGE_EFFECT - db -1 -SpecialEffects: -; Effects from arrays 2, 4, and 5B, minus Twineedle and Rage. -; Includes all effects that do not need to be called at the end of -; ExecutePlayerMove (or ExecuteEnemyMove), because they have already been handled - db DRAIN_HP_EFFECT - db EXPLODE_EFFECT - db DREAM_EATER_EFFECT - db PAY_DAY_EFFECT - db SWIFT_EFFECT - db TWO_TO_FIVE_ATTACKS_EFFECT - db $1E - db CHARGE_EFFECT - db SUPER_FANG_EFFECT - db SPECIAL_DAMAGE_EFFECT - db FLY_EFFECT - db ATTACK_TWICE_EFFECT - db JUMP_KICK_EFFECT - db RECOIL_EFFECT - ; fallthrough to Next EffectsArray -SpecialEffectsCont: -; damaging moves whose effect is executed prior to damage calculation - db THRASH_PETAL_DANCE_EFFECT - db TRAPPING_EFFECT - db -1 +INCLUDE "data/battle/residual_effects_1.asm" +INCLUDE "data/battle/set_damage_effects.asm" +INCLUDE "data/battle/residual_effects_2.asm" +INCLUDE "data/battle/always_happen_effects.asm" +INCLUDE "data/battle/special_effects.asm" SlidePlayerAndEnemySilhouettesOnScreen: call LoadPlayerBackPic @@ -3904,20 +3814,7 @@ DetermineExclamationPointTextNum: pop bc ret -ExclamationPointMoveSets: - db SWORDS_DANCE, GROWTH - db $00 - db RECOVER, BIDE, SELFDESTRUCT, AMNESIA - db $00 - db MEDITATE, AGILITY, TELEPORT, MIMIC, DOUBLE_TEAM, BARRAGE - db $00 - db POUND, SCRATCH, VICEGRIP, WING_ATTACK, FLY, BIND, SLAM, HORN_ATTACK, BODY_SLAM - db WRAP, THRASH, TAIL_WHIP, LEER, BITE, GROWL, ROAR, SING, PECK, COUNTER - db STRENGTH, ABSORB, STRING_SHOT, EARTHQUAKE, FISSURE, DIG, TOXIC, SCREECH, HARDEN - db MINIMIZE, WITHDRAW, DEFENSE_CURL, METRONOME, LICK, CLAMP, CONSTRICT, POISON_GAS - db LEECH_LIFE, BUBBLE, FLASH, SPLASH, ACID_ARMOR, FURY_SWIPES, REST, SHARPEN, SLASH, SUBSTITUTE - db $00 - db $FF ; terminator +INCLUDE "data/move_grammar.asm" PrintMoveFailureText: ld de, wPlayerMoveEffect @@ -4668,13 +4565,7 @@ JumpToOHKOMoveEffect: dec a ret - -UnusedHighCriticalMoves: - db KARATE_CHOP - db RAZOR_LEAF - db CRABHAMMER - db SLASH - db $FF +INCLUDE "data/battle/unused_critical_hit_moves.asm" ; determines if attack is a critical hit ; azure heights claims "the fastest pokémon (who are,not coincidentally, @@ -4745,14 +4636,7 @@ CriticalHitTest: ld [wCriticalHitOrOHKO], a ; set critical hit flag ret -; high critical hit moves -HighCriticalMoves: - db KARATE_CHOP - db RAZOR_LEAF - db CRABHAMMER - db SLASH - db $FF - +INCLUDE "data/battle/critical_hit_moves.asm" ; function to determine if Counter hits and if so, how much damage it does HandleCounterMove: @@ -7117,1603 +7001,3 @@ LoadMonBackPic: ld a, [H_LOADEDROMBANK] ld b, a jp CopyVideoData - -JumpMoveEffect: - call _JumpMoveEffect - ld b, $1 - ret - -_JumpMoveEffect: - ld a, [H_WHOSETURN] - and a - ld a, [wPlayerMoveEffect] - jr z, .next1 - ld a, [wEnemyMoveEffect] -.next1 - dec a ; subtract 1, there is no special effect for 00 - add a ; x2, 16bit pointers - ld hl, MoveEffectPointerTable - ld b, 0 - ld c, a - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - jp hl ; jump to special effect handler - -MoveEffectPointerTable: - dw SleepEffect ; unused effect - dw PoisonEffect ; POISON_SIDE_EFFECT1 - dw DrainHPEffect ; DRAIN_HP_EFFECT - dw FreezeBurnParalyzeEffect ; BURN_SIDE_EFFECT1 - dw FreezeBurnParalyzeEffect ; FREEZE_SIDE_EFFECT - dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT1 - dw ExplodeEffect ; EXPLODE_EFFECT - dw DrainHPEffect ; DREAM_EATER_EFFECT - dw $0000 ; MIRROR_MOVE_EFFECT - dw StatModifierUpEffect ; ATTACK_UP1_EFFECT - dw StatModifierUpEffect ; DEFENSE_UP1_EFFECT - dw StatModifierUpEffect ; SPEED_UP1_EFFECT - dw StatModifierUpEffect ; SPECIAL_UP1_EFFECT - dw StatModifierUpEffect ; ACCURACY_UP1_EFFECT - dw StatModifierUpEffect ; EVASION_UP1_EFFECT - dw PayDayEffect ; PAY_DAY_EFFECT - dw $0000 ; SWIFT_EFFECT - dw StatModifierDownEffect ; ATTACK_DOWN1_EFFECT - dw StatModifierDownEffect ; DEFENSE_DOWN1_EFFECT - dw StatModifierDownEffect ; SPEED_DOWN1_EFFECT - dw StatModifierDownEffect ; SPECIAL_DOWN1_EFFECT - dw StatModifierDownEffect ; ACCURACY_DOWN1_EFFECT - dw StatModifierDownEffect ; EVASION_DOWN1_EFFECT - dw ConversionEffect ; CONVERSION_EFFECT - dw HazeEffect ; HAZE_EFFECT - dw BideEffect ; BIDE_EFFECT - dw ThrashPetalDanceEffect ; THRASH_PETAL_DANCE_EFFECT - dw SwitchAndTeleportEffect ; SWITCH_AND_TELEPORT_EFFECT - dw TwoToFiveAttacksEffect ; TWO_TO_FIVE_ATTACKS_EFFECT - dw TwoToFiveAttacksEffect ; unused effect - dw FlinchSideEffect ; FLINCH_SIDE_EFFECT1 - dw SleepEffect ; SLEEP_EFFECT - dw PoisonEffect ; POISON_SIDE_EFFECT2 - dw FreezeBurnParalyzeEffect ; BURN_SIDE_EFFECT2 - dw FreezeBurnParalyzeEffect ; unused effect - dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT2 - dw FlinchSideEffect ; FLINCH_SIDE_EFFECT2 - dw OneHitKOEffect ; OHKO_EFFECT - dw ChargeEffect ; CHARGE_EFFECT - dw $0000 ; SUPER_FANG_EFFECT - dw $0000 ; SPECIAL_DAMAGE_EFFECT - dw TrappingEffect ; TRAPPING_EFFECT - dw ChargeEffect ; FLY_EFFECT - dw TwoToFiveAttacksEffect ; ATTACK_TWICE_EFFECT - dw $0000 ; JUMP_KICK_EFFECT - dw MistEffect ; MIST_EFFECT - dw FocusEnergyEffect ; FOCUS_ENERGY_EFFECT - dw RecoilEffect ; RECOIL_EFFECT - dw ConfusionEffect ; CONFUSION_EFFECT - dw StatModifierUpEffect ; ATTACK_UP2_EFFECT - dw StatModifierUpEffect ; DEFENSE_UP2_EFFECT - dw StatModifierUpEffect ; SPEED_UP2_EFFECT - dw StatModifierUpEffect ; SPECIAL_UP2_EFFECT - dw StatModifierUpEffect ; ACCURACY_UP2_EFFECT - dw StatModifierUpEffect ; EVASION_UP2_EFFECT - dw HealEffect ; HEAL_EFFECT - dw TransformEffect ; TRANSFORM_EFFECT - dw StatModifierDownEffect ; ATTACK_DOWN2_EFFECT - dw StatModifierDownEffect ; DEFENSE_DOWN2_EFFECT - dw StatModifierDownEffect ; SPEED_DOWN2_EFFECT - dw StatModifierDownEffect ; SPECIAL_DOWN2_EFFECT - dw StatModifierDownEffect ; ACCURACY_DOWN2_EFFECT - dw StatModifierDownEffect ; EVASION_DOWN2_EFFECT - dw ReflectLightScreenEffect ; LIGHT_SCREEN_EFFECT - dw ReflectLightScreenEffect ; REFLECT_EFFECT - dw PoisonEffect ; POISON_EFFECT - dw ParalyzeEffect ; PARALYZE_EFFECT - dw StatModifierDownEffect ; ATTACK_DOWN_SIDE_EFFECT - dw StatModifierDownEffect ; DEFENSE_DOWN_SIDE_EFFECT - dw StatModifierDownEffect ; SPEED_DOWN_SIDE_EFFECT - dw StatModifierDownEffect ; SPECIAL_DOWN_SIDE_EFFECT - dw StatModifierDownEffect ; unused effect - dw StatModifierDownEffect ; unused effect - dw StatModifierDownEffect ; unused effect - dw StatModifierDownEffect ; unused effect - dw ConfusionSideEffect ; CONFUSION_SIDE_EFFECT - dw TwoToFiveAttacksEffect ; TWINEEDLE_EFFECT - dw $0000 ; unused effect - dw SubstituteEffect ; SUBSTITUTE_EFFECT - dw HyperBeamEffect ; HYPER_BEAM_EFFECT - dw RageEffect ; RAGE_EFFECT - dw MimicEffect ; MIMIC_EFFECT - dw $0000 ; METRONOME_EFFECT - dw LeechSeedEffect ; LEECH_SEED_EFFECT - dw SplashEffect ; SPLASH_EFFECT - dw DisableEffect ; DISABLE_EFFECT - -SleepEffect: - ld de, wEnemyMonStatus - ld bc, wEnemyBattleStatus2 - ld a, [H_WHOSETURN] - and a - jp z, .sleepEffect - ld de, wBattleMonStatus - ld bc, wPlayerBattleStatus2 - -.sleepEffect - ld a, [bc] - bit NEEDS_TO_RECHARGE, a ; does the target need to recharge? (hyper beam) - res NEEDS_TO_RECHARGE, a ; target no longer needs to recharge - ld [bc], a - jr nz, .setSleepCounter ; if the target had to recharge, all hit tests will be skipped - ; including the event where the target already has another status - ld a, [de] - ld b, a - and $7 - jr z, .notAlreadySleeping ; can't affect a mon that is already asleep - ld hl, AlreadyAsleepText - jp PrintText -.notAlreadySleeping - ld a, b - and a - jr nz, .didntAffect ; can't affect a mon that is already statused - push de - call MoveHitTest ; apply accuracy tests - pop de - ld a, [wMoveMissed] - and a - jr nz, .didntAffect -.setSleepCounter -; set target's sleep counter to a random number between 1 and 7 - call BattleRandom - and $7 - jr z, .setSleepCounter - ld [de], a - call PlayCurrentMoveAnimation2 - ld hl, FellAsleepText - jp PrintText -.didntAffect - jp PrintDidntAffectText - -FellAsleepText: - TX_FAR _FellAsleepText - db "@" - -AlreadyAsleepText: - TX_FAR _AlreadyAsleepText - db "@" - -PoisonEffect: - ld hl, wEnemyMonStatus - ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] - and a - jr z, .poisonEffect - ld hl, wBattleMonStatus - ld de, wEnemyMoveEffect -.poisonEffect - call CheckTargetSubstitute - jr nz, .noEffect ; can't poison a substitute target - ld a, [hli] - ld b, a - and a - jr nz, .noEffect ; miss if target is already statused - ld a, [hli] - cp POISON ; can't poison a poison-type target - jr z, .noEffect - ld a, [hld] - cp POISON ; can't poison a poison-type target - jr z, .noEffect - ld a, [de] - cp POISON_SIDE_EFFECT1 - ld b, $34 ; ~20% chance of poisoning - jr z, .sideEffectTest - cp POISON_SIDE_EFFECT2 - ld b, $67 ; ~40% chance of poisoning - jr z, .sideEffectTest - push hl - push de - call MoveHitTest ; apply accuracy tests - pop de - pop hl - ld a, [wMoveMissed] - and a - jr nz, .didntAffect - jr .inflictPoison -.sideEffectTest - call BattleRandom - cp b ; was side effect successful? - ret nc -.inflictPoison - dec hl - set 3, [hl] ; mon is now poisoned - push de - dec de - ld a, [H_WHOSETURN] - and a - ld b, ANIM_C7 - ld hl, wPlayerBattleStatus3 - ld a, [de] - ld de, wPlayerToxicCounter - jr nz, .ok - ld b, ANIM_A9 - ld hl, wEnemyBattleStatus3 - ld de, wEnemyToxicCounter -.ok - cp TOXIC - jr nz, .normalPoison ; done if move is not Toxic - set BADLY_POISONED, [hl] ; else set Toxic battstatus - xor a - ld [de], a - ld hl, BadlyPoisonedText - jr .continue -.normalPoison - ld hl, PoisonedText -.continue - pop de - ld a, [de] - cp POISON_EFFECT - jr z, .regularPoisonEffect - ld a, b - call PlayBattleAnimation2 - jp PrintText -.regularPoisonEffect - call PlayCurrentMoveAnimation2 - jp PrintText -.noEffect - ld a, [de] - cp POISON_EFFECT - ret nz -.didntAffect - ld c, 50 - call DelayFrames - jp PrintDidntAffectText - -PoisonedText: - TX_FAR _PoisonedText - db "@" - -BadlyPoisonedText: - TX_FAR _BadlyPoisonedText - db "@" - -DrainHPEffect: - jpab DrainHPEffect_ - -ExplodeEffect: - ld hl, wBattleMonHP - ld de, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] - and a - jr z, .faintUser - ld hl, wEnemyMonHP - ld de, wEnemyBattleStatus2 -.faintUser - xor a - ld [hli], a ; set the mon's HP to 0 - ld [hli], a - inc hl - ld [hl], a ; set mon's status to 0 - ld a, [de] - res SEEDED, a ; clear mon's leech seed status - ld [de], a - ret - -FreezeBurnParalyzeEffect: - xor a - ld [wAnimationType], a - call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag] - ret nz ; return if they have a substitute, can't effect them - ld a, [H_WHOSETURN] - and a - jp nz, opponentAttacker - ld a, [wEnemyMonStatus] - and a - jp nz, CheckDefrost ; can't inflict status if opponent is already statused - ld a, [wPlayerMoveType] - ld b, a - ld a, [wEnemyMonType1] - cp b ; do target type 1 and move type match? - ret z ; return if they match (an ice move can't freeze an ice-type, body slam can't paralyze a normal-type, etc.) - ld a, [wEnemyMonType2] - cp b ; do target type 2 and move type match? - ret z ; return if they match - ld a, [wPlayerMoveEffect] - cp PARALYZE_SIDE_EFFECT1 + 1 ; 10% status effects are 04, 05, 06 so 07 will set carry for those - ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance - jr c, .next1 ; branch ahead if this is a 10% chance effect.. - ld b, $4d ; else use 0x4D/0x100 or 77/256 = 30.1%~ chance - sub $1e ; subtract $1E to map to equivalent 10% chance effects -.next1 - push af - call BattleRandom ; get random 8bit value for probability test - cp b - pop bc - ret nc ; do nothing if random value is >= 1A or 4D [no status applied] - ld a, b ; what type of effect is this? - cp BURN_SIDE_EFFECT1 - jr z, .burn - cp FREEZE_SIDE_EFFECT - jr z, .freeze -; .paralyze - ld a, 1 << PAR - ld [wEnemyMonStatus], a - call QuarterSpeedDueToParalysis ; quarter speed of affected mon - ld a, ANIM_A9 - call PlayBattleAnimation - jp PrintMayNotAttackText ; print paralysis text -.burn - ld a, 1 << BRN - ld [wEnemyMonStatus], a - call HalveAttackDueToBurn ; halve attack of affected mon - ld a, ANIM_A9 - call PlayBattleAnimation - ld hl, BurnedText - jp PrintText -.freeze - call ClearHyperBeam ; resets hyper beam (recharge) condition from target - ld a, 1 << FRZ - ld [wEnemyMonStatus], a - ld a, ANIM_A9 - call PlayBattleAnimation - ld hl, FrozenText - jp PrintText -opponentAttacker: - ld a, [wBattleMonStatus] ; mostly same as above with addresses swapped for opponent - and a - jp nz, CheckDefrost - ld a, [wEnemyMoveType] - ld b, a - ld a, [wBattleMonType1] - cp b - ret z - ld a, [wBattleMonType2] - cp b - ret z - ld a, [wEnemyMoveEffect] - cp PARALYZE_SIDE_EFFECT1 + 1 - ld b, $1a - jr c, .next1 - ld b, $4d - sub $1e -.next1 - push af - call BattleRandom - cp b - pop bc - ret nc - ld a, b - cp BURN_SIDE_EFFECT1 - jr z, .burn - cp FREEZE_SIDE_EFFECT - jr z, .freeze - ld a, 1 << PAR - ld [wBattleMonStatus], a - call QuarterSpeedDueToParalysis - jp PrintMayNotAttackText -.burn - ld a, 1 << BRN - ld [wBattleMonStatus], a - call HalveAttackDueToBurn - ld hl, BurnedText - jp PrintText -.freeze -; hyper beam bits aren't reseted for opponent's side - ld a, 1 << FRZ - ld [wBattleMonStatus], a - ld hl, FrozenText - jp PrintText - -BurnedText: - TX_FAR _BurnedText - db "@" - -FrozenText: - TX_FAR _FrozenText - db "@" - -CheckDefrost: -; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target - and 1 << FRZ ; are they frozen? - ret z ; return if so - ld a, [H_WHOSETURN] - and a - jr nz, .opponent - ;player [attacker] - ld a, [wPlayerMoveType] - sub FIRE - ret nz ; return if type of move used isn't fire - ld [wEnemyMonStatus], a ; set opponent status to 00 ["defrost" a frozen monster] - ld hl, wEnemyMon1Status - ld a, [wEnemyMonPartyPos] - ld bc, wEnemyMon2 - wEnemyMon1 - call AddNTimes - xor a - ld [hl], a ; clear status in roster - ld hl, FireDefrostedText - jr .common -.opponent - ld a, [wEnemyMoveType] ; same as above with addresses swapped - sub FIRE - ret nz - ld [wBattleMonStatus], a - ld hl, wPartyMon1Status - ld a, [wPlayerMonNumber] - ld bc, wPartyMon2 - wPartyMon1 - call AddNTimes - xor a - ld [hl], a - ld hl, FireDefrostedText -.common - jp PrintText - -FireDefrostedText: - TX_FAR _FireDefrostedText - db "@" - -StatModifierUpEffect: - ld hl, wPlayerMonStatMods - ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] - and a - jr z, .statModifierUpEffect - ld hl, wEnemyMonStatMods - ld de, wEnemyMoveEffect -.statModifierUpEffect - ld a, [de] - sub ATTACK_UP1_EFFECT - cp EVASION_UP1_EFFECT + $3 - ATTACK_UP1_EFFECT ; covers all +1 effects - jr c, .incrementStatMod - sub ATTACK_UP2_EFFECT - ATTACK_UP1_EFFECT ; map +2 effects to equivalent +1 effect -.incrementStatMod - ld c, a - ld b, $0 - add hl, bc - ld b, [hl] - inc b ; increment corresponding stat mod - ld a, $d - cp b ; can't raise stat past +6 ($d or 13) - jp c, PrintNothingHappenedText - ld a, [de] - cp ATTACK_UP1_EFFECT + $8 ; is it a +2 effect? - jr c, .ok - inc b ; if so, increment stat mod again - ld a, $d - cp b ; unless it's already +6 - jr nc, .ok - ld b, a -.ok - ld [hl], b - ld a, c - cp $4 - jr nc, UpdateStatDone ; jump if mod affected is evasion/accuracy - push hl - ld hl, wBattleMonAttack + 1 - ld de, wPlayerMonUnmodifiedAttack - ld a, [H_WHOSETURN] - and a - jr z, .pointToStats - ld hl, wEnemyMonAttack + 1 - ld de, wEnemyMonUnmodifiedAttack -.pointToStats - push bc - sla c - ld b, $0 - add hl, bc ; hl = modified stat - ld a, c - add e - ld e, a - jr nc, .checkIf999 - inc d ; de = unmodified (original) stat -.checkIf999 - pop bc - ld a, [hld] - sub 999 % $100 ; check if stat is already 999 - jr nz, .recalculateStat - ld a, [hl] - sbc 999 / $100 - jp z, RestoreOriginalStatModifier -.recalculateStat ; recalculate affected stat - ; paralysis and burn penalties, as well as badge boosts are ignored - push hl - push bc - ld hl, StatModifierRatios - dec b - sla b - ld c, b - ld b, $0 - add hl, bc - pop bc - xor a - ld [H_MULTIPLICAND], a - ld a, [de] - ld [H_MULTIPLICAND + 1], a - inc de - ld a, [de] - ld [H_MULTIPLICAND + 2], a - ld a, [hli] - ld [H_MULTIPLIER], a - call Multiply - ld a, [hl] - ld [H_DIVISOR], a - ld b, $4 - call Divide - pop hl -; cap at 999 - ld a, [H_PRODUCT + 3] - sub 999 % $100 - ld a, [H_PRODUCT + 2] - sbc 999 / $100 - jp c, UpdateStat - ld a, 999 / $100 - ld [H_MULTIPLICAND + 1], a - ld a, 999 % $100 - ld [H_MULTIPLICAND + 2], a - -UpdateStat: - ld a, [H_PRODUCT + 2] - ld [hli], a - ld a, [H_PRODUCT + 3] - ld [hl], a - pop hl -UpdateStatDone: - ld b, c - inc b - call PrintStatText - ld hl, wPlayerBattleStatus2 - ld de, wPlayerMoveNum - ld bc, wPlayerMonMinimized - ld a, [H_WHOSETURN] - and a - jr z, .asm_3f4e6 - ld hl, wEnemyBattleStatus2 - ld de, wEnemyMoveNum - ld bc, wEnemyMonMinimized -.asm_3f4e6 - ld a, [de] - cp MINIMIZE - jr nz, .asm_3f4f9 - ; if a substitute is up, slide off the substitute and show the mon pic before - ; playing the minimize animation - bit HAS_SUBSTITUTE_UP, [hl] - push af - push bc - ld hl, HideSubstituteShowMonAnim - ld b, BANK(HideSubstituteShowMonAnim) - push de - call nz, Bankswitch - pop de -.asm_3f4f9 - call PlayCurrentMoveAnimation - ld a, [de] - cp MINIMIZE - jr nz, .applyBadgeBoostsAndStatusPenalties - pop bc - ld a, $1 - ld [bc], a - ld hl, ReshowSubstituteAnim - ld b, BANK(ReshowSubstituteAnim) - pop af - call nz, Bankswitch -.applyBadgeBoostsAndStatusPenalties - ld a, [H_WHOSETURN] - and a - call z, ApplyBadgeStatBoosts ; whenever the player uses a stat-up move, badge boosts get reapplied again to every stat, - ; even to those not affected by the stat-up move (will be boosted further) - ld hl, MonsStatsRoseText - call PrintText - -; these shouldn't be here - call QuarterSpeedDueToParalysis ; apply speed penalty to the player whose turn is not, if it's paralyzed - jp HalveAttackDueToBurn ; apply attack penalty to the player whose turn is not, if it's burned - -RestoreOriginalStatModifier: - pop hl - dec [hl] - -PrintNothingHappenedText: - ld hl, NothingHappenedText - jp PrintText - -MonsStatsRoseText: - TX_FAR _MonsStatsRoseText - TX_ASM - ld hl, GreatlyRoseText - ld a, [H_WHOSETURN] - and a - ld a, [wPlayerMoveEffect] - jr z, .playerTurn - ld a, [wEnemyMoveEffect] -.playerTurn - cp ATTACK_DOWN1_EFFECT - ret nc - ld hl, RoseText - ret - -GreatlyRoseText: - TX_DELAY - TX_FAR _GreatlyRoseText -; fallthrough -RoseText: - TX_FAR _RoseText - db "@" - -StatModifierDownEffect: - ld hl, wEnemyMonStatMods - ld de, wPlayerMoveEffect - ld bc, wEnemyBattleStatus1 - ld a, [H_WHOSETURN] - and a - jr z, .statModifierDownEffect - ld hl, wPlayerMonStatMods - ld de, wEnemyMoveEffect - ld bc, wPlayerBattleStatus1 - ld a, [wLinkState] - cp LINK_STATE_BATTLING - jr z, .statModifierDownEffect - call BattleRandom - cp $40 ; 1/4 chance to miss by in regular battle - jp c, MoveMissed -.statModifierDownEffect - call CheckTargetSubstitute ; can't hit through substitute - jp nz, MoveMissed - ld a, [de] - cp ATTACK_DOWN_SIDE_EFFECT - jr c, .nonSideEffect - call BattleRandom - cp $55 ; 85/256 chance for side effects - jp nc, CantLowerAnymore - ld a, [de] - sub ATTACK_DOWN_SIDE_EFFECT ; map each stat to 0-3 - jr .decrementStatMod -.nonSideEffect ; non-side effects only - push hl - push de - push bc - call MoveHitTest ; apply accuracy tests - pop bc - pop de - pop hl - ld a, [wMoveMissed] - and a - jp nz, MoveMissed - ld a, [bc] - bit INVULNERABLE, a ; fly/dig - jp nz, MoveMissed - ld a, [de] - sub ATTACK_DOWN1_EFFECT - cp EVASION_DOWN1_EFFECT + $3 - ATTACK_DOWN1_EFFECT ; covers all -1 effects - jr c, .decrementStatMod - sub ATTACK_DOWN2_EFFECT - ATTACK_DOWN1_EFFECT ; map -2 effects to corresponding -1 effect -.decrementStatMod - ld c, a - ld b, $0 - add hl, bc - ld b, [hl] - dec b ; dec corresponding stat mod - jp z, CantLowerAnymore ; if stat mod is 1 (-6), can't lower anymore - ld a, [de] - cp ATTACK_DOWN2_EFFECT - $16 ; $24 - jr c, .ok - cp EVASION_DOWN2_EFFECT + $5 ; $44 - jr nc, .ok - dec b ; stat down 2 effects only (dec mod again) - jr nz, .ok - inc b ; increment mod to 1 (-6) if it would become 0 (-7) -.ok - ld [hl], b ; save modified mod - ld a, c - cp $4 - jr nc, UpdateLoweredStatDone ; jump for evasion/accuracy - push hl - push de - ld hl, wEnemyMonAttack + 1 - ld de, wEnemyMonUnmodifiedAttack - ld a, [H_WHOSETURN] - and a - jr z, .pointToStat - ld hl, wBattleMonAttack + 1 - ld de, wPlayerMonUnmodifiedAttack -.pointToStat - push bc - sla c - ld b, $0 - add hl, bc ; hl = modified stat - ld a, c - add e - ld e, a - jr nc, .noCarry - inc d ; de = unmodified stat -.noCarry - pop bc - ld a, [hld] - sub $1 ; can't lower stat below 1 (-6) - jr nz, .recalculateStat - ld a, [hl] - and a - jp z, CantLowerAnymore_Pop -.recalculateStat -; recalculate affected stat -; paralysis and burn penalties, as well as badge boosts are ignored - push hl - push bc - ld hl, StatModifierRatios - dec b - sla b - ld c, b - ld b, $0 - add hl, bc - pop bc - xor a - ld [H_MULTIPLICAND], a - ld a, [de] - ld [H_MULTIPLICAND + 1], a - inc de - ld a, [de] - ld [H_MULTIPLICAND + 2], a - ld a, [hli] - ld [H_MULTIPLIER], a - call Multiply - ld a, [hl] - ld [H_DIVISOR], a - ld b, $4 - call Divide - pop hl - ld a, [H_PRODUCT + 3] - ld b, a - ld a, [H_PRODUCT + 2] - or b - jp nz, UpdateLoweredStat - ld [H_MULTIPLICAND + 1], a - ld a, $1 - ld [H_MULTIPLICAND + 2], a - -UpdateLoweredStat: - ld a, [H_PRODUCT + 2] - ld [hli], a - ld a, [H_PRODUCT + 3] - ld [hl], a - pop de - pop hl -UpdateLoweredStatDone: - ld b, c - inc b - push de - call PrintStatText - pop de - ld a, [de] - cp $44 - jr nc, .ApplyBadgeBoostsAndStatusPenalties - call PlayCurrentMoveAnimation2 -.ApplyBadgeBoostsAndStatusPenalties - ld a, [H_WHOSETURN] - and a - call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat, - ; even to those not affected by the stat-up move (will be boosted further) - ld hl, MonsStatsFellText - call PrintText - -; These where probably added given that a stat-down move affecting speed or attack will override -; the stat penalties from paralysis and burn respectively. -; But they are always called regardless of the stat affected by the stat-down move. - call QuarterSpeedDueToParalysis - jp HalveAttackDueToBurn - -CantLowerAnymore_Pop: - pop de - pop hl - inc [hl] - -CantLowerAnymore: - ld a, [de] - cp ATTACK_DOWN_SIDE_EFFECT - ret nc - ld hl, NothingHappenedText - jp PrintText - -MoveMissed: - ld a, [de] - cp $44 - ret nc - jp ConditionalPrintButItFailed - -MonsStatsFellText: - TX_FAR _MonsStatsFellText - TX_ASM - ld hl, FellText - ld a, [H_WHOSETURN] - and a - ld a, [wPlayerMoveEffect] - jr z, .playerTurn - ld a, [wEnemyMoveEffect] -.playerTurn -; check if the move's effect decreases a stat by 2 - cp BIDE_EFFECT - ret c - cp ATTACK_DOWN_SIDE_EFFECT - ret nc - ld hl, GreatlyFellText - ret - -GreatlyFellText: - TX_DELAY - TX_FAR _GreatlyFellText -; fallthrough -FellText: - TX_FAR _FellText - db "@" - -PrintStatText: - ld hl, StatsTextStrings - ld c, "@" -.findStatName_outer - dec b - jr z, .foundStatName -.findStatName_inner - ld a, [hli] - cp c - jr z, .findStatName_outer - jr .findStatName_inner -.foundStatName - ld de, wcf4b - ld bc, $a - jp CopyData - -StatsTextStrings: - db "ATTACK@" - db "DEFENSE@" - db "SPEED@" - db "SPECIAL@" - db "ACCURACY@" - db "EVADE@" - -StatModifierRatios: -; first byte is numerator, second byte is denominator - db 25, 100 ; 0.25 - db 28, 100 ; 0.28 - db 33, 100 ; 0.33 - db 40, 100 ; 0.40 - db 50, 100 ; 0.50 - db 66, 100 ; 0.66 - db 1, 1 ; 1.00 - db 15, 10 ; 1.50 - db 2, 1 ; 2.00 - db 25, 10 ; 2.50 - db 3, 1 ; 3.00 - db 35, 10 ; 3.50 - db 4, 1 ; 4.00 - -BideEffect: - ld hl, wPlayerBattleStatus1 - ld de, wPlayerBideAccumulatedDamage - ld bc, wPlayerNumAttacksLeft - ld a, [H_WHOSETURN] - and a - jr z, .bideEffect - ld hl, wEnemyBattleStatus1 - ld de, wEnemyBideAccumulatedDamage - ld bc, wEnemyNumAttacksLeft -.bideEffect - set STORING_ENERGY, [hl] ; mon is now using bide - xor a - ld [de], a - inc de - ld [de], a - ld [wPlayerMoveEffect], a - ld [wEnemyMoveEffect], a - call BattleRandom - and $1 - inc a - inc a - ld [bc], a ; set Bide counter to 2 or 3 at random - ld a, [H_WHOSETURN] - add XSTATITEM_ANIM - jp PlayBattleAnimation2 - -ThrashPetalDanceEffect: - ld hl, wPlayerBattleStatus1 - ld de, wPlayerNumAttacksLeft - ld a, [H_WHOSETURN] - and a - jr z, .thrashPetalDanceEffect - ld hl, wEnemyBattleStatus1 - ld de, wEnemyNumAttacksLeft -.thrashPetalDanceEffect - set THRASHING_ABOUT, [hl] ; mon is now using thrash/petal dance - call BattleRandom - and $1 - inc a - inc a - ld [de], a ; set thrash/petal dance counter to 2 or 3 at random - ld a, [H_WHOSETURN] - add ANIM_B0 - jp PlayBattleAnimation2 - -SwitchAndTeleportEffect: - ld a, [H_WHOSETURN] - and a - jr nz, .handleEnemy - ld a, [wIsInBattle] - dec a - jr nz, .notWildBattle1 - ld a, [wCurEnemyLVL] - ld b, a - ld a, [wBattleMonLevel] - cp b ; is the player's level greater than the enemy's level? - jr nc, .playerMoveWasSuccessful ; if so, teleport will always succeed - add b - ld c, a - inc c ; c = sum of player level and enemy level -.rejectionSampleLoop1 - call BattleRandom - cp c ; get a random number between 0 and c - jr nc, .rejectionSampleLoop1 - srl b - srl b ; b = enemyLevel / 4 - cp b ; is rand[0, playerLevel + enemyLevel) >= (enemyLevel / 4)? - jr nc, .playerMoveWasSuccessful ; if so, allow teleporting - ld c, 50 - call DelayFrames - ld a, [wPlayerMoveNum] - cp TELEPORT - jp nz, PrintDidntAffectText - jp PrintButItFailedText_ -.playerMoveWasSuccessful - call ReadPlayerMonCurHPAndStatus - xor a - ld [wAnimationType], a - inc a - ld [wEscapedFromBattle], a - ld a, [wPlayerMoveNum] - jr .playAnimAndPrintText -.notWildBattle1 - ld c, 50 - call DelayFrames - ld hl, IsUnaffectedText - ld a, [wPlayerMoveNum] - cp TELEPORT - jp nz, PrintText - jp PrintButItFailedText_ -.handleEnemy - ld a, [wIsInBattle] - dec a - jr nz, .notWildBattle2 - ld a, [wBattleMonLevel] - ld b, a - ld a, [wCurEnemyLVL] - cp b - jr nc, .enemyMoveWasSuccessful - add b - ld c, a - inc c -.rejectionSampleLoop2 - call BattleRandom - cp c - jr nc, .rejectionSampleLoop2 - srl b - srl b - cp b - jr nc, .enemyMoveWasSuccessful - ld c, 50 - call DelayFrames - ld a, [wEnemyMoveNum] - cp TELEPORT - jp nz, PrintDidntAffectText - jp PrintButItFailedText_ -.enemyMoveWasSuccessful - call ReadPlayerMonCurHPAndStatus - xor a - ld [wAnimationType], a - inc a - ld [wEscapedFromBattle], a - ld a, [wEnemyMoveNum] - jr .playAnimAndPrintText -.notWildBattle2 - ld c, 50 - call DelayFrames - ld hl, IsUnaffectedText - ld a, [wEnemyMoveNum] - cp TELEPORT - jp nz, PrintText - jp ConditionalPrintButItFailed -.playAnimAndPrintText - push af - call PlayBattleAnimation - ld c, 20 - call DelayFrames - pop af - ld hl, RanFromBattleText - cp TELEPORT - jr z, .printText - ld hl, RanAwayScaredText - cp ROAR - jr z, .printText - ld hl, WasBlownAwayText -.printText - jp PrintText - -RanFromBattleText: - TX_FAR _RanFromBattleText - db "@" - -RanAwayScaredText: - TX_FAR _RanAwayScaredText - db "@" - -WasBlownAwayText: - TX_FAR _WasBlownAwayText - db "@" - -TwoToFiveAttacksEffect: - ld hl, wPlayerBattleStatus1 - ld de, wPlayerNumAttacksLeft - ld bc, wPlayerNumHits - ld a, [H_WHOSETURN] - and a - jr z, .twoToFiveAttacksEffect - ld hl, wEnemyBattleStatus1 - ld de, wEnemyNumAttacksLeft - ld bc, wEnemyNumHits -.twoToFiveAttacksEffect - bit ATTACKING_MULTIPLE_TIMES, [hl] ; is mon attacking multiple times? - ret nz - set ATTACKING_MULTIPLE_TIMES, [hl] ; mon is now attacking multiple times - ld hl, wPlayerMoveEffect - ld a, [H_WHOSETURN] - and a - jr z, .setNumberOfHits - ld hl, wEnemyMoveEffect -.setNumberOfHits - ld a, [hl] - cp TWINEEDLE_EFFECT - jr z, .twineedle - cp ATTACK_TWICE_EFFECT - ld a, $2 ; number of hits it's always 2 for ATTACK_TWICE_EFFECT - jr z, .saveNumberOfHits -; for TWO_TO_FIVE_ATTACKS_EFFECT 3/8 chance for 2 and 3 hits, and 1/8 chance for 4 and 5 hits - call BattleRandom - and $3 - cp $2 - jr c, .gotNumHits -; if the number of hits was greater than 2, re-roll again for a lower chance - call BattleRandom - and $3 -.gotNumHits - inc a - inc a -.saveNumberOfHits - ld [de], a - ld [bc], a - ret -.twineedle - ld a, POISON_SIDE_EFFECT1 - ld [hl], a ; set Twineedle's effect to poison effect - jr .saveNumberOfHits - -FlinchSideEffect: - call CheckTargetSubstitute - ret nz - ld hl, wEnemyBattleStatus1 - ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] - and a - jr z, .flinchSideEffect - ld hl, wPlayerBattleStatus1 - ld de, wEnemyMoveEffect -.flinchSideEffect - ld a, [de] - cp FLINCH_SIDE_EFFECT1 - ld b, $1a ; ~10% chance of flinch - jr z, .gotEffectChance - ld b, $4d ; ~30% chance of flinch -.gotEffectChance - call BattleRandom - cp b - ret nc - set FLINCHED, [hl] ; set mon's status to flinching - call ClearHyperBeam - ret - -OneHitKOEffect: - jpab OneHitKOEffect_ - -ChargeEffect: - ld hl, wPlayerBattleStatus1 - ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] - and a - ld b, XSTATITEM_ANIM - jr z, .chargeEffect - ld hl, wEnemyBattleStatus1 - ld de, wEnemyMoveEffect - ld b, ANIM_AF -.chargeEffect - set CHARGING_UP, [hl] - ld a, [de] - dec de ; de contains enemy or player MOVENUM - cp FLY_EFFECT - jr nz, .notFly - set INVULNERABLE, [hl] ; mon is now invulnerable to typical attacks (fly/dig) - ld b, TELEPORT ; load Teleport's animation -.notFly - ld a, [de] - cp DIG - jr nz, .notDigOrFly - set INVULNERABLE, [hl] ; mon is now invulnerable to typical attacks (fly/dig) - ld b, ANIM_C0 -.notDigOrFly - xor a - ld [wAnimationType], a - ld a, b - call PlayBattleAnimation - ld a, [de] - ld [wChargeMoveNum], a - ld hl, ChargeMoveEffectText - jp PrintText - -ChargeMoveEffectText: - TX_FAR _ChargeMoveEffectText - TX_ASM - ld a, [wChargeMoveNum] - cp RAZOR_WIND - ld hl, MadeWhirlwindText - jr z, .gotText - cp SOLARBEAM - ld hl, TookInSunlightText - jr z, .gotText - cp SKULL_BASH - ld hl, LoweredItsHeadText - jr z, .gotText - cp SKY_ATTACK - ld hl, SkyAttackGlowingText - jr z, .gotText - cp FLY - ld hl, FlewUpHighText - jr z, .gotText - cp DIG - ld hl, DugAHoleText -.gotText - ret - -MadeWhirlwindText: - TX_FAR _MadeWhirlwindText - db "@" - -TookInSunlightText: - TX_FAR _TookInSunlightText - db "@" - -LoweredItsHeadText: - TX_FAR _LoweredItsHeadText - db "@" - -SkyAttackGlowingText: - TX_FAR _SkyAttackGlowingText - db "@" - -FlewUpHighText: - TX_FAR _FlewUpHighText - db "@" - -DugAHoleText: - TX_FAR _DugAHoleText - db "@" - -TrappingEffect: - ld hl, wPlayerBattleStatus1 - ld de, wPlayerNumAttacksLeft - ld a, [H_WHOSETURN] - and a - jr z, .trappingEffect - ld hl, wEnemyBattleStatus1 - ld de, wEnemyNumAttacksLeft -.trappingEffect - bit USING_TRAPPING_MOVE, [hl] - ret nz - call ClearHyperBeam ; since this effect is called before testing whether the move will hit, - ; the target won't need to recharge even if the trapping move missed - set USING_TRAPPING_MOVE, [hl] ; mon is now using a trapping move - call BattleRandom ; 3/8 chance for 2 and 3 attacks, and 1/8 chance for 4 and 5 attacks - and $3 - cp $2 - jr c, .setTrappingCounter - call BattleRandom - and $3 -.setTrappingCounter - inc a - ld [de], a - ret - -MistEffect: - jpab MistEffect_ - -FocusEnergyEffect: - jpab FocusEnergyEffect_ - -RecoilEffect: - jpab RecoilEffect_ - -ConfusionSideEffect: - call BattleRandom - cp $19 ; ~10% chance - ret nc - jr ConfusionSideEffectSuccess - -ConfusionEffect: - call CheckTargetSubstitute - jr nz, ConfusionEffectFailed - call MoveHitTest - ld a, [wMoveMissed] - and a - jr nz, ConfusionEffectFailed - -ConfusionSideEffectSuccess: - ld a, [H_WHOSETURN] - and a - ld hl, wEnemyBattleStatus1 - ld bc, wEnemyConfusedCounter - ld a, [wPlayerMoveEffect] - jr z, .confuseTarget - ld hl, wPlayerBattleStatus1 - ld bc, wPlayerConfusedCounter - ld a, [wEnemyMoveEffect] -.confuseTarget - bit CONFUSED, [hl] ; is mon confused? - jr nz, ConfusionEffectFailed - set CONFUSED, [hl] ; mon is now confused - push af - call BattleRandom - and $3 - inc a - inc a - ld [bc], a ; confusion status will last 2-5 turns - pop af - cp CONFUSION_SIDE_EFFECT - call nz, PlayCurrentMoveAnimation2 - ld hl, BecameConfusedText - jp PrintText - -BecameConfusedText: - TX_FAR _BecameConfusedText - db "@" - -ConfusionEffectFailed: - cp CONFUSION_SIDE_EFFECT - ret z - ld c, 50 - call DelayFrames - jp ConditionalPrintButItFailed - -ParalyzeEffect: - jpab ParalyzeEffect_ - -SubstituteEffect: - jpab SubstituteEffect_ - -HyperBeamEffect: - ld hl, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] - and a - jr z, .hyperBeamEffect - ld hl, wEnemyBattleStatus2 -.hyperBeamEffect - set NEEDS_TO_RECHARGE, [hl] ; mon now needs to recharge - ret - -ClearHyperBeam: - push hl - ld hl, wEnemyBattleStatus2 - ld a, [H_WHOSETURN] - and a - jr z, .playerTurn - ld hl, wPlayerBattleStatus2 -.playerTurn - res NEEDS_TO_RECHARGE, [hl] ; mon no longer needs to recharge - pop hl - ret - -RageEffect: - ld hl, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] - and a - jr z, .player - ld hl, wEnemyBattleStatus2 -.player - set USING_RAGE, [hl] ; mon is now in "rage" mode - ret - -MimicEffect: - ld c, 50 - call DelayFrames - call MoveHitTest - ld a, [wMoveMissed] - and a - jr nz, .mimicMissed - ld a, [H_WHOSETURN] - and a - ld hl, wBattleMonMoves - ld a, [wPlayerBattleStatus1] - jr nz, .enemyTurn - ld a, [wLinkState] - cp LINK_STATE_BATTLING - jr nz, .letPlayerChooseMove - ld hl, wEnemyMonMoves - ld a, [wEnemyBattleStatus1] -.enemyTurn - bit INVULNERABLE, a - jr nz, .mimicMissed -.getRandomMove - push hl - call BattleRandom - and $3 - ld c, a - ld b, $0 - add hl, bc - ld a, [hl] - pop hl - and a - jr z, .getRandomMove - ld d, a - ld a, [H_WHOSETURN] - and a - ld hl, wBattleMonMoves - ld a, [wPlayerMoveListIndex] - jr z, .playerTurn - ld hl, wEnemyMonMoves - ld a, [wEnemyMoveListIndex] - jr .playerTurn -.letPlayerChooseMove - ld a, [wEnemyBattleStatus1] - bit INVULNERABLE, a - jr nz, .mimicMissed - ld a, [wCurrentMenuItem] - push af - ld a, $1 - ld [wMoveMenuType], a - call MoveSelectionMenu - call LoadScreenTilesFromBuffer1 - ld hl, wEnemyMonMoves - ld a, [wCurrentMenuItem] - ld c, a - ld b, $0 - add hl, bc - ld d, [hl] - pop af - ld hl, wBattleMonMoves -.playerTurn - ld c, a - ld b, $0 - add hl, bc - ld a, d - ld [hl], a - ld [wd11e], a - call GetMoveName - call PlayCurrentMoveAnimation - ld hl, MimicLearnedMoveText - jp PrintText -.mimicMissed - jp PrintButItFailedText_ - -MimicLearnedMoveText: - TX_FAR _MimicLearnedMoveText - db "@" - -LeechSeedEffect: - jpab LeechSeedEffect_ - -SplashEffect: - call PlayCurrentMoveAnimation - jp PrintNoEffectText - -DisableEffect: - call MoveHitTest - ld a, [wMoveMissed] - and a - jr nz, .moveMissed - ld de, wEnemyDisabledMove - ld hl, wEnemyMonMoves - ld a, [H_WHOSETURN] - and a - jr z, .disableEffect - ld de, wPlayerDisabledMove - ld hl, wBattleMonMoves -.disableEffect -; no effect if target already has a move disabled - ld a, [de] - and a - jr nz, .moveMissed -.pickMoveToDisable - push hl - call BattleRandom - and $3 - ld c, a - ld b, $0 - add hl, bc - ld a, [hl] - pop hl - and a - jr z, .pickMoveToDisable ; loop until a non-00 move slot is found - ld [wd11e], a ; store move number - push hl - ld a, [H_WHOSETURN] - and a - ld hl, wBattleMonPP - jr nz, .enemyTurn - ld a, [wLinkState] - cp LINK_STATE_BATTLING - pop hl ; wEnemyMonMoves - jr nz, .playerTurnNotLinkBattle -; .playerTurnLinkBattle - push hl - ld hl, wEnemyMonPP -.enemyTurn - push hl - ld a, [hli] - or [hl] - inc hl - or [hl] - inc hl - or [hl] - and $3f - pop hl ; wBattleMonPP or wEnemyMonPP - jr z, .moveMissedPopHL ; nothing to do if all moves have no PP left - add hl, bc - ld a, [hl] - pop hl - and a - jr z, .pickMoveToDisable ; pick another move if this one had 0 PP -.playerTurnNotLinkBattle -; non-link battle enemies have unlimited PP so the previous checks aren't needed - call BattleRandom - and $7 - inc a ; 1-8 turns disabled - inc c ; move 1-4 will be disabled - swap c - add c ; map disabled move to high nibble of wEnemyDisabledMove / wPlayerDisabledMove - ld [de], a - call PlayCurrentMoveAnimation2 - ld hl, wPlayerDisabledMoveNumber - ld a, [H_WHOSETURN] - and a - jr nz, .printDisableText - inc hl ; wEnemyDisabledMoveNumber -.printDisableText - ld a, [wd11e] ; move number - ld [hl], a - call GetMoveName - ld hl, MoveWasDisabledText - jp PrintText -.moveMissedPopHL - pop hl -.moveMissed - jp PrintButItFailedText_ - -MoveWasDisabledText: - TX_FAR _MoveWasDisabledText - db "@" - -PayDayEffect: - jpab PayDayEffect_ - -ConversionEffect: - jpab ConversionEffect_ - -HazeEffect: - jpab HazeEffect_ - -HealEffect: - jpab HealEffect_ - -TransformEffect: - jpab TransformEffect_ - -ReflectLightScreenEffect: - jpab ReflectLightScreenEffect_ - -NothingHappenedText: - TX_FAR _NothingHappenedText - db "@" - -PrintNoEffectText: - ld hl, NoEffectText - jp PrintText - -NoEffectText: - TX_FAR _NoEffectText - db "@" - -ConditionalPrintButItFailed: - ld a, [wMoveDidntMiss] - and a - ret nz ; return if the side effect failed, yet the attack was successful - -PrintButItFailedText_: - ld hl, ButItFailedText - jp PrintText - -ButItFailedText: - TX_FAR _ButItFailedText - db "@" - -PrintDidntAffectText: - ld hl, DidntAffectText - jp PrintText - -DidntAffectText: - TX_FAR _DidntAffectText - db "@" - -IsUnaffectedText: - TX_FAR _IsUnaffectedText - db "@" - -PrintMayNotAttackText: - ld hl, ParalyzedMayNotAttackText - jp PrintText - -ParalyzedMayNotAttackText: - TX_FAR _ParalyzedMayNotAttackText - db "@" - -CheckTargetSubstitute: - push hl - ld hl, wEnemyBattleStatus2 - ld a, [H_WHOSETURN] - and a - jr z, .next1 - ld hl, wPlayerBattleStatus2 -.next1 - bit HAS_SUBSTITUTE_UP, [hl] - pop hl - ret - -PlayCurrentMoveAnimation2: -; animation at MOVENUM will be played unless MOVENUM is 0 -; plays wAnimationType 3 or 6 - ld a, [H_WHOSETURN] - and a - ld a, [wPlayerMoveNum] - jr z, .notEnemyTurn - ld a, [wEnemyMoveNum] -.notEnemyTurn - and a - ret z - -PlayBattleAnimation2: -; play animation ID at a and animation type 6 or 3 - ld [wAnimationID], a - ld a, [H_WHOSETURN] - and a - ld a, $6 - jr z, .storeAnimationType - ld a, $3 -.storeAnimationType - ld [wAnimationType], a - jp PlayBattleAnimationGotID - -PlayCurrentMoveAnimation: -; animation at MOVENUM will be played unless MOVENUM is 0 -; resets wAnimationType - xor a - ld [wAnimationType], a - ld a, [H_WHOSETURN] - and a - ld a, [wPlayerMoveNum] - jr z, .notEnemyTurn - ld a, [wEnemyMoveNum] -.notEnemyTurn - and a - ret z - -PlayBattleAnimation: -; play animation ID at a and predefined animation type - ld [wAnimationID], a - -PlayBattleAnimationGotID: -; play animation at wAnimationID - push hl - push de - push bc - predef MoveAnimation - pop bc - pop de - pop hl - ret diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm new file mode 100644 index 00000000..8bb22a1c --- /dev/null +++ b/engine/battle/effects.asm @@ -0,0 +1,1493 @@ +JumpMoveEffect: + call _JumpMoveEffect + ld b, $1 + ret + +_JumpMoveEffect: + ld a, [H_WHOSETURN] + and a + ld a, [wPlayerMoveEffect] + jr z, .next1 + ld a, [wEnemyMoveEffect] +.next1 + dec a ; subtract 1, there is no special effect for 00 + add a ; x2, 16bit pointers + ld hl, MoveEffectPointerTable + ld b, 0 + ld c, a + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + jp hl ; jump to special effect handler + +INCLUDE "data/effects_pointers.asm" + +SleepEffect: + ld de, wEnemyMonStatus + ld bc, wEnemyBattleStatus2 + ld a, [H_WHOSETURN] + and a + jp z, .sleepEffect + ld de, wBattleMonStatus + ld bc, wPlayerBattleStatus2 + +.sleepEffect + ld a, [bc] + bit NEEDS_TO_RECHARGE, a ; does the target need to recharge? (hyper beam) + res NEEDS_TO_RECHARGE, a ; target no longer needs to recharge + ld [bc], a + jr nz, .setSleepCounter ; if the target had to recharge, all hit tests will be skipped + ; including the event where the target already has another status + ld a, [de] + ld b, a + and $7 + jr z, .notAlreadySleeping ; can't affect a mon that is already asleep + ld hl, AlreadyAsleepText + jp PrintText +.notAlreadySleeping + ld a, b + and a + jr nz, .didntAffect ; can't affect a mon that is already statused + push de + call MoveHitTest ; apply accuracy tests + pop de + ld a, [wMoveMissed] + and a + jr nz, .didntAffect +.setSleepCounter +; set target's sleep counter to a random number between 1 and 7 + call BattleRandom + and $7 + jr z, .setSleepCounter + ld [de], a + call PlayCurrentMoveAnimation2 + ld hl, FellAsleepText + jp PrintText +.didntAffect + jp PrintDidntAffectText + +FellAsleepText: + TX_FAR _FellAsleepText + db "@" + +AlreadyAsleepText: + TX_FAR _AlreadyAsleepText + db "@" + +PoisonEffect: + ld hl, wEnemyMonStatus + ld de, wPlayerMoveEffect + ld a, [H_WHOSETURN] + and a + jr z, .poisonEffect + ld hl, wBattleMonStatus + ld de, wEnemyMoveEffect +.poisonEffect + call CheckTargetSubstitute + jr nz, .noEffect ; can't poison a substitute target + ld a, [hli] + ld b, a + and a + jr nz, .noEffect ; miss if target is already statused + ld a, [hli] + cp POISON ; can't poison a poison-type target + jr z, .noEffect + ld a, [hld] + cp POISON ; can't poison a poison-type target + jr z, .noEffect + ld a, [de] + cp POISON_SIDE_EFFECT1 + ld b, $34 ; ~20% chance of poisoning + jr z, .sideEffectTest + cp POISON_SIDE_EFFECT2 + ld b, $67 ; ~40% chance of poisoning + jr z, .sideEffectTest + push hl + push de + call MoveHitTest ; apply accuracy tests + pop de + pop hl + ld a, [wMoveMissed] + and a + jr nz, .didntAffect + jr .inflictPoison +.sideEffectTest + call BattleRandom + cp b ; was side effect successful? + ret nc +.inflictPoison + dec hl + set 3, [hl] ; mon is now poisoned + push de + dec de + ld a, [H_WHOSETURN] + and a + ld b, ANIM_C7 + ld hl, wPlayerBattleStatus3 + ld a, [de] + ld de, wPlayerToxicCounter + jr nz, .ok + ld b, ANIM_A9 + ld hl, wEnemyBattleStatus3 + ld de, wEnemyToxicCounter +.ok + cp TOXIC + jr nz, .normalPoison ; done if move is not Toxic + set BADLY_POISONED, [hl] ; else set Toxic battstatus + xor a + ld [de], a + ld hl, BadlyPoisonedText + jr .continue +.normalPoison + ld hl, PoisonedText +.continue + pop de + ld a, [de] + cp POISON_EFFECT + jr z, .regularPoisonEffect + ld a, b + call PlayBattleAnimation2 + jp PrintText +.regularPoisonEffect + call PlayCurrentMoveAnimation2 + jp PrintText +.noEffect + ld a, [de] + cp POISON_EFFECT + ret nz +.didntAffect + ld c, 50 + call DelayFrames + jp PrintDidntAffectText + +PoisonedText: + TX_FAR _PoisonedText + db "@" + +BadlyPoisonedText: + TX_FAR _BadlyPoisonedText + db "@" + +DrainHPEffect: + jpab DrainHPEffect_ + +ExplodeEffect: + ld hl, wBattleMonHP + ld de, wPlayerBattleStatus2 + ld a, [H_WHOSETURN] + and a + jr z, .faintUser + ld hl, wEnemyMonHP + ld de, wEnemyBattleStatus2 +.faintUser + xor a + ld [hli], a ; set the mon's HP to 0 + ld [hli], a + inc hl + ld [hl], a ; set mon's status to 0 + ld a, [de] + res SEEDED, a ; clear mon's leech seed status + ld [de], a + ret + +FreezeBurnParalyzeEffect: + xor a + ld [wAnimationType], a + call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag] + ret nz ; return if they have a substitute, can't effect them + ld a, [H_WHOSETURN] + and a + jp nz, opponentAttacker + ld a, [wEnemyMonStatus] + and a + jp nz, CheckDefrost ; can't inflict status if opponent is already statused + ld a, [wPlayerMoveType] + ld b, a + ld a, [wEnemyMonType1] + cp b ; do target type 1 and move type match? + ret z ; return if they match (an ice move can't freeze an ice-type, body slam can't paralyze a normal-type, etc.) + ld a, [wEnemyMonType2] + cp b ; do target type 2 and move type match? + ret z ; return if they match + ld a, [wPlayerMoveEffect] + cp PARALYZE_SIDE_EFFECT1 + 1 ; 10% status effects are 04, 05, 06 so 07 will set carry for those + ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance + jr c, .next1 ; branch ahead if this is a 10% chance effect.. + ld b, $4d ; else use 0x4D/0x100 or 77/256 = 30.1%~ chance + sub $1e ; subtract $1E to map to equivalent 10% chance effects +.next1 + push af + call BattleRandom ; get random 8bit value for probability test + cp b + pop bc + ret nc ; do nothing if random value is >= 1A or 4D [no status applied] + ld a, b ; what type of effect is this? + cp BURN_SIDE_EFFECT1 + jr z, .burn + cp FREEZE_SIDE_EFFECT + jr z, .freeze +; .paralyze + ld a, 1 << PAR + ld [wEnemyMonStatus], a + call QuarterSpeedDueToParalysis ; quarter speed of affected mon + ld a, ANIM_A9 + call PlayBattleAnimation + jp PrintMayNotAttackText ; print paralysis text +.burn + ld a, 1 << BRN + ld [wEnemyMonStatus], a + call HalveAttackDueToBurn ; halve attack of affected mon + ld a, ANIM_A9 + call PlayBattleAnimation + ld hl, BurnedText + jp PrintText +.freeze + call ClearHyperBeam ; resets hyper beam (recharge) condition from target + ld a, 1 << FRZ + ld [wEnemyMonStatus], a + ld a, ANIM_A9 + call PlayBattleAnimation + ld hl, FrozenText + jp PrintText +opponentAttacker: + ld a, [wBattleMonStatus] ; mostly same as above with addresses swapped for opponent + and a + jp nz, CheckDefrost + ld a, [wEnemyMoveType] + ld b, a + ld a, [wBattleMonType1] + cp b + ret z + ld a, [wBattleMonType2] + cp b + ret z + ld a, [wEnemyMoveEffect] + cp PARALYZE_SIDE_EFFECT1 + 1 + ld b, $1a + jr c, .next1 + ld b, $4d + sub $1e +.next1 + push af + call BattleRandom + cp b + pop bc + ret nc + ld a, b + cp BURN_SIDE_EFFECT1 + jr z, .burn + cp FREEZE_SIDE_EFFECT + jr z, .freeze + ld a, 1 << PAR + ld [wBattleMonStatus], a + call QuarterSpeedDueToParalysis + jp PrintMayNotAttackText +.burn + ld a, 1 << BRN + ld [wBattleMonStatus], a + call HalveAttackDueToBurn + ld hl, BurnedText + jp PrintText +.freeze +; hyper beam bits aren't reseted for opponent's side + ld a, 1 << FRZ + ld [wBattleMonStatus], a + ld hl, FrozenText + jp PrintText + +BurnedText: + TX_FAR _BurnedText + db "@" + +FrozenText: + TX_FAR _FrozenText + db "@" + +CheckDefrost: +; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target + and 1 << FRZ ; are they frozen? + ret z ; return if so + ld a, [H_WHOSETURN] + and a + jr nz, .opponent + ;player [attacker] + ld a, [wPlayerMoveType] + sub FIRE + ret nz ; return if type of move used isn't fire + ld [wEnemyMonStatus], a ; set opponent status to 00 ["defrost" a frozen monster] + ld hl, wEnemyMon1Status + ld a, [wEnemyMonPartyPos] + ld bc, wEnemyMon2 - wEnemyMon1 + call AddNTimes + xor a + ld [hl], a ; clear status in roster + ld hl, FireDefrostedText + jr .common +.opponent + ld a, [wEnemyMoveType] ; same as above with addresses swapped + sub FIRE + ret nz + ld [wBattleMonStatus], a + ld hl, wPartyMon1Status + ld a, [wPlayerMonNumber] + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + xor a + ld [hl], a + ld hl, FireDefrostedText +.common + jp PrintText + +FireDefrostedText: + TX_FAR _FireDefrostedText + db "@" + +StatModifierUpEffect: + ld hl, wPlayerMonStatMods + ld de, wPlayerMoveEffect + ld a, [H_WHOSETURN] + and a + jr z, .statModifierUpEffect + ld hl, wEnemyMonStatMods + ld de, wEnemyMoveEffect +.statModifierUpEffect + ld a, [de] + sub ATTACK_UP1_EFFECT + cp EVASION_UP1_EFFECT + $3 - ATTACK_UP1_EFFECT ; covers all +1 effects + jr c, .incrementStatMod + sub ATTACK_UP2_EFFECT - ATTACK_UP1_EFFECT ; map +2 effects to equivalent +1 effect +.incrementStatMod + ld c, a + ld b, $0 + add hl, bc + ld b, [hl] + inc b ; increment corresponding stat mod + ld a, $d + cp b ; can't raise stat past +6 ($d or 13) + jp c, PrintNothingHappenedText + ld a, [de] + cp ATTACK_UP1_EFFECT + $8 ; is it a +2 effect? + jr c, .ok + inc b ; if so, increment stat mod again + ld a, $d + cp b ; unless it's already +6 + jr nc, .ok + ld b, a +.ok + ld [hl], b + ld a, c + cp $4 + jr nc, UpdateStatDone ; jump if mod affected is evasion/accuracy + push hl + ld hl, wBattleMonAttack + 1 + ld de, wPlayerMonUnmodifiedAttack + ld a, [H_WHOSETURN] + and a + jr z, .pointToStats + ld hl, wEnemyMonAttack + 1 + ld de, wEnemyMonUnmodifiedAttack +.pointToStats + push bc + sla c + ld b, $0 + add hl, bc ; hl = modified stat + ld a, c + add e + ld e, a + jr nc, .checkIf999 + inc d ; de = unmodified (original) stat +.checkIf999 + pop bc + ld a, [hld] + sub 999 % $100 ; check if stat is already 999 + jr nz, .recalculateStat + ld a, [hl] + sbc 999 / $100 + jp z, RestoreOriginalStatModifier +.recalculateStat ; recalculate affected stat + ; paralysis and burn penalties, as well as badge boosts are ignored + push hl + push bc + ld hl, StatModifierRatios + dec b + sla b + ld c, b + ld b, $0 + add hl, bc + pop bc + xor a + ld [H_MULTIPLICAND], a + ld a, [de] + ld [H_MULTIPLICAND + 1], a + inc de + ld a, [de] + ld [H_MULTIPLICAND + 2], a + ld a, [hli] + ld [H_MULTIPLIER], a + call Multiply + ld a, [hl] + ld [H_DIVISOR], a + ld b, $4 + call Divide + pop hl +; cap at 999 + ld a, [H_PRODUCT + 3] + sub 999 % $100 + ld a, [H_PRODUCT + 2] + sbc 999 / $100 + jp c, UpdateStat + ld a, 999 / $100 + ld [H_MULTIPLICAND + 1], a + ld a, 999 % $100 + ld [H_MULTIPLICAND + 2], a + +UpdateStat: + ld a, [H_PRODUCT + 2] + ld [hli], a + ld a, [H_PRODUCT + 3] + ld [hl], a + pop hl +UpdateStatDone: + ld b, c + inc b + call PrintStatText + ld hl, wPlayerBattleStatus2 + ld de, wPlayerMoveNum + ld bc, wPlayerMonMinimized + ld a, [H_WHOSETURN] + and a + jr z, .asm_3f4e6 + ld hl, wEnemyBattleStatus2 + ld de, wEnemyMoveNum + ld bc, wEnemyMonMinimized +.asm_3f4e6 + ld a, [de] + cp MINIMIZE + jr nz, .asm_3f4f9 + ; if a substitute is up, slide off the substitute and show the mon pic before + ; playing the minimize animation + bit HAS_SUBSTITUTE_UP, [hl] + push af + push bc + ld hl, HideSubstituteShowMonAnim + ld b, BANK(HideSubstituteShowMonAnim) + push de + call nz, Bankswitch + pop de +.asm_3f4f9 + call PlayCurrentMoveAnimation + ld a, [de] + cp MINIMIZE + jr nz, .applyBadgeBoostsAndStatusPenalties + pop bc + ld a, $1 + ld [bc], a + ld hl, ReshowSubstituteAnim + ld b, BANK(ReshowSubstituteAnim) + pop af + call nz, Bankswitch +.applyBadgeBoostsAndStatusPenalties + ld a, [H_WHOSETURN] + and a + call z, ApplyBadgeStatBoosts ; whenever the player uses a stat-up move, badge boosts get reapplied again to every stat, + ; even to those not affected by the stat-up move (will be boosted further) + ld hl, MonsStatsRoseText + call PrintText + +; these shouldn't be here + call QuarterSpeedDueToParalysis ; apply speed penalty to the player whose turn is not, if it's paralyzed + jp HalveAttackDueToBurn ; apply attack penalty to the player whose turn is not, if it's burned + +RestoreOriginalStatModifier: + pop hl + dec [hl] + +PrintNothingHappenedText: + ld hl, NothingHappenedText + jp PrintText + +MonsStatsRoseText: + TX_FAR _MonsStatsRoseText + TX_ASM + ld hl, GreatlyRoseText + ld a, [H_WHOSETURN] + and a + ld a, [wPlayerMoveEffect] + jr z, .playerTurn + ld a, [wEnemyMoveEffect] +.playerTurn + cp ATTACK_DOWN1_EFFECT + ret nc + ld hl, RoseText + ret + +GreatlyRoseText: + TX_DELAY + TX_FAR _GreatlyRoseText +; fallthrough +RoseText: + TX_FAR _RoseText + db "@" + +StatModifierDownEffect: + ld hl, wEnemyMonStatMods + ld de, wPlayerMoveEffect + ld bc, wEnemyBattleStatus1 + ld a, [H_WHOSETURN] + and a + jr z, .statModifierDownEffect + ld hl, wPlayerMonStatMods + ld de, wEnemyMoveEffect + ld bc, wPlayerBattleStatus1 + ld a, [wLinkState] + cp LINK_STATE_BATTLING + jr z, .statModifierDownEffect + call BattleRandom + cp $40 ; 1/4 chance to miss by in regular battle + jp c, MoveMissed +.statModifierDownEffect + call CheckTargetSubstitute ; can't hit through substitute + jp nz, MoveMissed + ld a, [de] + cp ATTACK_DOWN_SIDE_EFFECT + jr c, .nonSideEffect + call BattleRandom + cp $55 ; 85/256 chance for side effects + jp nc, CantLowerAnymore + ld a, [de] + sub ATTACK_DOWN_SIDE_EFFECT ; map each stat to 0-3 + jr .decrementStatMod +.nonSideEffect ; non-side effects only + push hl + push de + push bc + call MoveHitTest ; apply accuracy tests + pop bc + pop de + pop hl + ld a, [wMoveMissed] + and a + jp nz, MoveMissed + ld a, [bc] + bit INVULNERABLE, a ; fly/dig + jp nz, MoveMissed + ld a, [de] + sub ATTACK_DOWN1_EFFECT + cp EVASION_DOWN1_EFFECT + $3 - ATTACK_DOWN1_EFFECT ; covers all -1 effects + jr c, .decrementStatMod + sub ATTACK_DOWN2_EFFECT - ATTACK_DOWN1_EFFECT ; map -2 effects to corresponding -1 effect +.decrementStatMod + ld c, a + ld b, $0 + add hl, bc + ld b, [hl] + dec b ; dec corresponding stat mod + jp z, CantLowerAnymore ; if stat mod is 1 (-6), can't lower anymore + ld a, [de] + cp ATTACK_DOWN2_EFFECT - $16 ; $24 + jr c, .ok + cp EVASION_DOWN2_EFFECT + $5 ; $44 + jr nc, .ok + dec b ; stat down 2 effects only (dec mod again) + jr nz, .ok + inc b ; increment mod to 1 (-6) if it would become 0 (-7) +.ok + ld [hl], b ; save modified mod + ld a, c + cp $4 + jr nc, UpdateLoweredStatDone ; jump for evasion/accuracy + push hl + push de + ld hl, wEnemyMonAttack + 1 + ld de, wEnemyMonUnmodifiedAttack + ld a, [H_WHOSETURN] + and a + jr z, .pointToStat + ld hl, wBattleMonAttack + 1 + ld de, wPlayerMonUnmodifiedAttack +.pointToStat + push bc + sla c + ld b, $0 + add hl, bc ; hl = modified stat + ld a, c + add e + ld e, a + jr nc, .noCarry + inc d ; de = unmodified stat +.noCarry + pop bc + ld a, [hld] + sub $1 ; can't lower stat below 1 (-6) + jr nz, .recalculateStat + ld a, [hl] + and a + jp z, CantLowerAnymore_Pop +.recalculateStat +; recalculate affected stat +; paralysis and burn penalties, as well as badge boosts are ignored + push hl + push bc + ld hl, StatModifierRatios + dec b + sla b + ld c, b + ld b, $0 + add hl, bc + pop bc + xor a + ld [H_MULTIPLICAND], a + ld a, [de] + ld [H_MULTIPLICAND + 1], a + inc de + ld a, [de] + ld [H_MULTIPLICAND + 2], a + ld a, [hli] + ld [H_MULTIPLIER], a + call Multiply + ld a, [hl] + ld [H_DIVISOR], a + ld b, $4 + call Divide + pop hl + ld a, [H_PRODUCT + 3] + ld b, a + ld a, [H_PRODUCT + 2] + or b + jp nz, UpdateLoweredStat + ld [H_MULTIPLICAND + 1], a + ld a, $1 + ld [H_MULTIPLICAND + 2], a + +UpdateLoweredStat: + ld a, [H_PRODUCT + 2] + ld [hli], a + ld a, [H_PRODUCT + 3] + ld [hl], a + pop de + pop hl +UpdateLoweredStatDone: + ld b, c + inc b + push de + call PrintStatText + pop de + ld a, [de] + cp $44 + jr nc, .ApplyBadgeBoostsAndStatusPenalties + call PlayCurrentMoveAnimation2 +.ApplyBadgeBoostsAndStatusPenalties + ld a, [H_WHOSETURN] + and a + call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat, + ; even to those not affected by the stat-up move (will be boosted further) + ld hl, MonsStatsFellText + call PrintText + +; These where probably added given that a stat-down move affecting speed or attack will override +; the stat penalties from paralysis and burn respectively. +; But they are always called regardless of the stat affected by the stat-down move. + call QuarterSpeedDueToParalysis + jp HalveAttackDueToBurn + +CantLowerAnymore_Pop: + pop de + pop hl + inc [hl] + +CantLowerAnymore: + ld a, [de] + cp ATTACK_DOWN_SIDE_EFFECT + ret nc + ld hl, NothingHappenedText + jp PrintText + +MoveMissed: + ld a, [de] + cp $44 + ret nc + jp ConditionalPrintButItFailed + +MonsStatsFellText: + TX_FAR _MonsStatsFellText + TX_ASM + ld hl, FellText + ld a, [H_WHOSETURN] + and a + ld a, [wPlayerMoveEffect] + jr z, .playerTurn + ld a, [wEnemyMoveEffect] +.playerTurn +; check if the move's effect decreases a stat by 2 + cp BIDE_EFFECT + ret c + cp ATTACK_DOWN_SIDE_EFFECT + ret nc + ld hl, GreatlyFellText + ret + +GreatlyFellText: + TX_DELAY + TX_FAR _GreatlyFellText +; fallthrough +FellText: + TX_FAR _FellText + db "@" + +PrintStatText: + ld hl, StatsTextStrings + ld c, "@" +.findStatName_outer + dec b + jr z, .foundStatName +.findStatName_inner + ld a, [hli] + cp c + jr z, .findStatName_outer + jr .findStatName_inner +.foundStatName + ld de, wcf4b + ld bc, $a + jp CopyData + +INCLUDE "text/stat_names.asm" + +INCLUDE "data/battle/stat_modifiers.asm" + +BideEffect: + ld hl, wPlayerBattleStatus1 + ld de, wPlayerBideAccumulatedDamage + ld bc, wPlayerNumAttacksLeft + ld a, [H_WHOSETURN] + and a + jr z, .bideEffect + ld hl, wEnemyBattleStatus1 + ld de, wEnemyBideAccumulatedDamage + ld bc, wEnemyNumAttacksLeft +.bideEffect + set STORING_ENERGY, [hl] ; mon is now using bide + xor a + ld [de], a + inc de + ld [de], a + ld [wPlayerMoveEffect], a + ld [wEnemyMoveEffect], a + call BattleRandom + and $1 + inc a + inc a + ld [bc], a ; set Bide counter to 2 or 3 at random + ld a, [H_WHOSETURN] + add XSTATITEM_ANIM + jp PlayBattleAnimation2 + +ThrashPetalDanceEffect: + ld hl, wPlayerBattleStatus1 + ld de, wPlayerNumAttacksLeft + ld a, [H_WHOSETURN] + and a + jr z, .thrashPetalDanceEffect + ld hl, wEnemyBattleStatus1 + ld de, wEnemyNumAttacksLeft +.thrashPetalDanceEffect + set THRASHING_ABOUT, [hl] ; mon is now using thrash/petal dance + call BattleRandom + and $1 + inc a + inc a + ld [de], a ; set thrash/petal dance counter to 2 or 3 at random + ld a, [H_WHOSETURN] + add ANIM_B0 + jp PlayBattleAnimation2 + +SwitchAndTeleportEffect: + ld a, [H_WHOSETURN] + and a + jr nz, .handleEnemy + ld a, [wIsInBattle] + dec a + jr nz, .notWildBattle1 + ld a, [wCurEnemyLVL] + ld b, a + ld a, [wBattleMonLevel] + cp b ; is the player's level greater than the enemy's level? + jr nc, .playerMoveWasSuccessful ; if so, teleport will always succeed + add b + ld c, a + inc c ; c = sum of player level and enemy level +.rejectionSampleLoop1 + call BattleRandom + cp c ; get a random number between 0 and c + jr nc, .rejectionSampleLoop1 + srl b + srl b ; b = enemyLevel / 4 + cp b ; is rand[0, playerLevel + enemyLevel) >= (enemyLevel / 4)? + jr nc, .playerMoveWasSuccessful ; if so, allow teleporting + ld c, 50 + call DelayFrames + ld a, [wPlayerMoveNum] + cp TELEPORT + jp nz, PrintDidntAffectText + jp PrintButItFailedText_ +.playerMoveWasSuccessful + call ReadPlayerMonCurHPAndStatus + xor a + ld [wAnimationType], a + inc a + ld [wEscapedFromBattle], a + ld a, [wPlayerMoveNum] + jr .playAnimAndPrintText +.notWildBattle1 + ld c, 50 + call DelayFrames + ld hl, IsUnaffectedText + ld a, [wPlayerMoveNum] + cp TELEPORT + jp nz, PrintText + jp PrintButItFailedText_ +.handleEnemy + ld a, [wIsInBattle] + dec a + jr nz, .notWildBattle2 + ld a, [wBattleMonLevel] + ld b, a + ld a, [wCurEnemyLVL] + cp b + jr nc, .enemyMoveWasSuccessful + add b + ld c, a + inc c +.rejectionSampleLoop2 + call BattleRandom + cp c + jr nc, .rejectionSampleLoop2 + srl b + srl b + cp b + jr nc, .enemyMoveWasSuccessful + ld c, 50 + call DelayFrames + ld a, [wEnemyMoveNum] + cp TELEPORT + jp nz, PrintDidntAffectText + jp PrintButItFailedText_ +.enemyMoveWasSuccessful + call ReadPlayerMonCurHPAndStatus + xor a + ld [wAnimationType], a + inc a + ld [wEscapedFromBattle], a + ld a, [wEnemyMoveNum] + jr .playAnimAndPrintText +.notWildBattle2 + ld c, 50 + call DelayFrames + ld hl, IsUnaffectedText + ld a, [wEnemyMoveNum] + cp TELEPORT + jp nz, PrintText + jp ConditionalPrintButItFailed +.playAnimAndPrintText + push af + call PlayBattleAnimation + ld c, 20 + call DelayFrames + pop af + ld hl, RanFromBattleText + cp TELEPORT + jr z, .printText + ld hl, RanAwayScaredText + cp ROAR + jr z, .printText + ld hl, WasBlownAwayText +.printText + jp PrintText + +RanFromBattleText: + TX_FAR _RanFromBattleText + db "@" + +RanAwayScaredText: + TX_FAR _RanAwayScaredText + db "@" + +WasBlownAwayText: + TX_FAR _WasBlownAwayText + db "@" + +TwoToFiveAttacksEffect: + ld hl, wPlayerBattleStatus1 + ld de, wPlayerNumAttacksLeft + ld bc, wPlayerNumHits + ld a, [H_WHOSETURN] + and a + jr z, .twoToFiveAttacksEffect + ld hl, wEnemyBattleStatus1 + ld de, wEnemyNumAttacksLeft + ld bc, wEnemyNumHits +.twoToFiveAttacksEffect + bit ATTACKING_MULTIPLE_TIMES, [hl] ; is mon attacking multiple times? + ret nz + set ATTACKING_MULTIPLE_TIMES, [hl] ; mon is now attacking multiple times + ld hl, wPlayerMoveEffect + ld a, [H_WHOSETURN] + and a + jr z, .setNumberOfHits + ld hl, wEnemyMoveEffect +.setNumberOfHits + ld a, [hl] + cp TWINEEDLE_EFFECT + jr z, .twineedle + cp ATTACK_TWICE_EFFECT + ld a, $2 ; number of hits it's always 2 for ATTACK_TWICE_EFFECT + jr z, .saveNumberOfHits +; for TWO_TO_FIVE_ATTACKS_EFFECT 3/8 chance for 2 and 3 hits, and 1/8 chance for 4 and 5 hits + call BattleRandom + and $3 + cp $2 + jr c, .gotNumHits +; if the number of hits was greater than 2, re-roll again for a lower chance + call BattleRandom + and $3 +.gotNumHits + inc a + inc a +.saveNumberOfHits + ld [de], a + ld [bc], a + ret +.twineedle + ld a, POISON_SIDE_EFFECT1 + ld [hl], a ; set Twineedle's effect to poison effect + jr .saveNumberOfHits + +FlinchSideEffect: + call CheckTargetSubstitute + ret nz + ld hl, wEnemyBattleStatus1 + ld de, wPlayerMoveEffect + ld a, [H_WHOSETURN] + and a + jr z, .flinchSideEffect + ld hl, wPlayerBattleStatus1 + ld de, wEnemyMoveEffect +.flinchSideEffect + ld a, [de] + cp FLINCH_SIDE_EFFECT1 + ld b, $1a ; ~10% chance of flinch + jr z, .gotEffectChance + ld b, $4d ; ~30% chance of flinch +.gotEffectChance + call BattleRandom + cp b + ret nc + set FLINCHED, [hl] ; set mon's status to flinching + call ClearHyperBeam + ret + +OneHitKOEffect: + jpab OneHitKOEffect_ + +ChargeEffect: + ld hl, wPlayerBattleStatus1 + ld de, wPlayerMoveEffect + ld a, [H_WHOSETURN] + and a + ld b, XSTATITEM_ANIM + jr z, .chargeEffect + ld hl, wEnemyBattleStatus1 + ld de, wEnemyMoveEffect + ld b, ANIM_AF +.chargeEffect + set CHARGING_UP, [hl] + ld a, [de] + dec de ; de contains enemy or player MOVENUM + cp FLY_EFFECT + jr nz, .notFly + set INVULNERABLE, [hl] ; mon is now invulnerable to typical attacks (fly/dig) + ld b, TELEPORT ; load Teleport's animation +.notFly + ld a, [de] + cp DIG + jr nz, .notDigOrFly + set INVULNERABLE, [hl] ; mon is now invulnerable to typical attacks (fly/dig) + ld b, ANIM_C0 +.notDigOrFly + xor a + ld [wAnimationType], a + ld a, b + call PlayBattleAnimation + ld a, [de] + ld [wChargeMoveNum], a + ld hl, ChargeMoveEffectText + jp PrintText + +ChargeMoveEffectText: + TX_FAR _ChargeMoveEffectText + TX_ASM + ld a, [wChargeMoveNum] + cp RAZOR_WIND + ld hl, MadeWhirlwindText + jr z, .gotText + cp SOLARBEAM + ld hl, TookInSunlightText + jr z, .gotText + cp SKULL_BASH + ld hl, LoweredItsHeadText + jr z, .gotText + cp SKY_ATTACK + ld hl, SkyAttackGlowingText + jr z, .gotText + cp FLY + ld hl, FlewUpHighText + jr z, .gotText + cp DIG + ld hl, DugAHoleText +.gotText + ret + +MadeWhirlwindText: + TX_FAR _MadeWhirlwindText + db "@" + +TookInSunlightText: + TX_FAR _TookInSunlightText + db "@" + +LoweredItsHeadText: + TX_FAR _LoweredItsHeadText + db "@" + +SkyAttackGlowingText: + TX_FAR _SkyAttackGlowingText + db "@" + +FlewUpHighText: + TX_FAR _FlewUpHighText + db "@" + +DugAHoleText: + TX_FAR _DugAHoleText + db "@" + +TrappingEffect: + ld hl, wPlayerBattleStatus1 + ld de, wPlayerNumAttacksLeft + ld a, [H_WHOSETURN] + and a + jr z, .trappingEffect + ld hl, wEnemyBattleStatus1 + ld de, wEnemyNumAttacksLeft +.trappingEffect + bit USING_TRAPPING_MOVE, [hl] + ret nz + call ClearHyperBeam ; since this effect is called before testing whether the move will hit, + ; the target won't need to recharge even if the trapping move missed + set USING_TRAPPING_MOVE, [hl] ; mon is now using a trapping move + call BattleRandom ; 3/8 chance for 2 and 3 attacks, and 1/8 chance for 4 and 5 attacks + and $3 + cp $2 + jr c, .setTrappingCounter + call BattleRandom + and $3 +.setTrappingCounter + inc a + ld [de], a + ret + +MistEffect: + jpab MistEffect_ + +FocusEnergyEffect: + jpab FocusEnergyEffect_ + +RecoilEffect: + jpab RecoilEffect_ + +ConfusionSideEffect: + call BattleRandom + cp $19 ; ~10% chance + ret nc + jr ConfusionSideEffectSuccess + +ConfusionEffect: + call CheckTargetSubstitute + jr nz, ConfusionEffectFailed + call MoveHitTest + ld a, [wMoveMissed] + and a + jr nz, ConfusionEffectFailed + +ConfusionSideEffectSuccess: + ld a, [H_WHOSETURN] + and a + ld hl, wEnemyBattleStatus1 + ld bc, wEnemyConfusedCounter + ld a, [wPlayerMoveEffect] + jr z, .confuseTarget + ld hl, wPlayerBattleStatus1 + ld bc, wPlayerConfusedCounter + ld a, [wEnemyMoveEffect] +.confuseTarget + bit CONFUSED, [hl] ; is mon confused? + jr nz, ConfusionEffectFailed + set CONFUSED, [hl] ; mon is now confused + push af + call BattleRandom + and $3 + inc a + inc a + ld [bc], a ; confusion status will last 2-5 turns + pop af + cp CONFUSION_SIDE_EFFECT + call nz, PlayCurrentMoveAnimation2 + ld hl, BecameConfusedText + jp PrintText + +BecameConfusedText: + TX_FAR _BecameConfusedText + db "@" + +ConfusionEffectFailed: + cp CONFUSION_SIDE_EFFECT + ret z + ld c, 50 + call DelayFrames + jp ConditionalPrintButItFailed + +ParalyzeEffect: + jpab ParalyzeEffect_ + +SubstituteEffect: + jpab SubstituteEffect_ + +HyperBeamEffect: + ld hl, wPlayerBattleStatus2 + ld a, [H_WHOSETURN] + and a + jr z, .hyperBeamEffect + ld hl, wEnemyBattleStatus2 +.hyperBeamEffect + set NEEDS_TO_RECHARGE, [hl] ; mon now needs to recharge + ret + +ClearHyperBeam: + push hl + ld hl, wEnemyBattleStatus2 + ld a, [H_WHOSETURN] + and a + jr z, .playerTurn + ld hl, wPlayerBattleStatus2 +.playerTurn + res NEEDS_TO_RECHARGE, [hl] ; mon no longer needs to recharge + pop hl + ret + +RageEffect: + ld hl, wPlayerBattleStatus2 + ld a, [H_WHOSETURN] + and a + jr z, .player + ld hl, wEnemyBattleStatus2 +.player + set USING_RAGE, [hl] ; mon is now in "rage" mode + ret + +MimicEffect: + ld c, 50 + call DelayFrames + call MoveHitTest + ld a, [wMoveMissed] + and a + jr nz, .mimicMissed + ld a, [H_WHOSETURN] + and a + ld hl, wBattleMonMoves + ld a, [wPlayerBattleStatus1] + jr nz, .enemyTurn + ld a, [wLinkState] + cp LINK_STATE_BATTLING + jr nz, .letPlayerChooseMove + ld hl, wEnemyMonMoves + ld a, [wEnemyBattleStatus1] +.enemyTurn + bit INVULNERABLE, a + jr nz, .mimicMissed +.getRandomMove + push hl + call BattleRandom + and $3 + ld c, a + ld b, $0 + add hl, bc + ld a, [hl] + pop hl + and a + jr z, .getRandomMove + ld d, a + ld a, [H_WHOSETURN] + and a + ld hl, wBattleMonMoves + ld a, [wPlayerMoveListIndex] + jr z, .playerTurn + ld hl, wEnemyMonMoves + ld a, [wEnemyMoveListIndex] + jr .playerTurn +.letPlayerChooseMove + ld a, [wEnemyBattleStatus1] + bit INVULNERABLE, a + jr nz, .mimicMissed + ld a, [wCurrentMenuItem] + push af + ld a, $1 + ld [wMoveMenuType], a + call MoveSelectionMenu + call LoadScreenTilesFromBuffer1 + ld hl, wEnemyMonMoves + ld a, [wCurrentMenuItem] + ld c, a + ld b, $0 + add hl, bc + ld d, [hl] + pop af + ld hl, wBattleMonMoves +.playerTurn + ld c, a + ld b, $0 + add hl, bc + ld a, d + ld [hl], a + ld [wd11e], a + call GetMoveName + call PlayCurrentMoveAnimation + ld hl, MimicLearnedMoveText + jp PrintText +.mimicMissed + jp PrintButItFailedText_ + +MimicLearnedMoveText: + TX_FAR _MimicLearnedMoveText + db "@" + +LeechSeedEffect: + jpab LeechSeedEffect_ + +SplashEffect: + call PlayCurrentMoveAnimation + jp PrintNoEffectText + +DisableEffect: + call MoveHitTest + ld a, [wMoveMissed] + and a + jr nz, .moveMissed + ld de, wEnemyDisabledMove + ld hl, wEnemyMonMoves + ld a, [H_WHOSETURN] + and a + jr z, .disableEffect + ld de, wPlayerDisabledMove + ld hl, wBattleMonMoves +.disableEffect +; no effect if target already has a move disabled + ld a, [de] + and a + jr nz, .moveMissed +.pickMoveToDisable + push hl + call BattleRandom + and $3 + ld c, a + ld b, $0 + add hl, bc + ld a, [hl] + pop hl + and a + jr z, .pickMoveToDisable ; loop until a non-00 move slot is found + ld [wd11e], a ; store move number + push hl + ld a, [H_WHOSETURN] + and a + ld hl, wBattleMonPP + jr nz, .enemyTurn + ld a, [wLinkState] + cp LINK_STATE_BATTLING + pop hl ; wEnemyMonMoves + jr nz, .playerTurnNotLinkBattle +; .playerTurnLinkBattle + push hl + ld hl, wEnemyMonPP +.enemyTurn + push hl + ld a, [hli] + or [hl] + inc hl + or [hl] + inc hl + or [hl] + and $3f + pop hl ; wBattleMonPP or wEnemyMonPP + jr z, .moveMissedPopHL ; nothing to do if all moves have no PP left + add hl, bc + ld a, [hl] + pop hl + and a + jr z, .pickMoveToDisable ; pick another move if this one had 0 PP +.playerTurnNotLinkBattle +; non-link battle enemies have unlimited PP so the previous checks aren't needed + call BattleRandom + and $7 + inc a ; 1-8 turns disabled + inc c ; move 1-4 will be disabled + swap c + add c ; map disabled move to high nibble of wEnemyDisabledMove / wPlayerDisabledMove + ld [de], a + call PlayCurrentMoveAnimation2 + ld hl, wPlayerDisabledMoveNumber + ld a, [H_WHOSETURN] + and a + jr nz, .printDisableText + inc hl ; wEnemyDisabledMoveNumber +.printDisableText + ld a, [wd11e] ; move number + ld [hl], a + call GetMoveName + ld hl, MoveWasDisabledText + jp PrintText +.moveMissedPopHL + pop hl +.moveMissed + jp PrintButItFailedText_ + +MoveWasDisabledText: + TX_FAR _MoveWasDisabledText + db "@" + +PayDayEffect: + jpab PayDayEffect_ + +ConversionEffect: + jpab ConversionEffect_ + +HazeEffect: + jpab HazeEffect_ + +HealEffect: + jpab HealEffect_ + +TransformEffect: + jpab TransformEffect_ + +ReflectLightScreenEffect: + jpab ReflectLightScreenEffect_ + +NothingHappenedText: + TX_FAR _NothingHappenedText + db "@" + +PrintNoEffectText: + ld hl, NoEffectText + jp PrintText + +NoEffectText: + TX_FAR _NoEffectText + db "@" + +ConditionalPrintButItFailed: + ld a, [wMoveDidntMiss] + and a + ret nz ; return if the side effect failed, yet the attack was successful + +PrintButItFailedText_: + ld hl, ButItFailedText + jp PrintText + +ButItFailedText: + TX_FAR _ButItFailedText + db "@" + +PrintDidntAffectText: + ld hl, DidntAffectText + jp PrintText + +DidntAffectText: + TX_FAR _DidntAffectText + db "@" + +IsUnaffectedText: + TX_FAR _IsUnaffectedText + db "@" + +PrintMayNotAttackText: + ld hl, ParalyzedMayNotAttackText + jp PrintText + +ParalyzedMayNotAttackText: + TX_FAR _ParalyzedMayNotAttackText + db "@" + +CheckTargetSubstitute: + push hl + ld hl, wEnemyBattleStatus2 + ld a, [H_WHOSETURN] + and a + jr z, .next1 + ld hl, wPlayerBattleStatus2 +.next1 + bit HAS_SUBSTITUTE_UP, [hl] + pop hl + ret + +PlayCurrentMoveAnimation2: +; animation at MOVENUM will be played unless MOVENUM is 0 +; plays wAnimationType 3 or 6 + ld a, [H_WHOSETURN] + and a + ld a, [wPlayerMoveNum] + jr z, .notEnemyTurn + ld a, [wEnemyMoveNum] +.notEnemyTurn + and a + ret z + +PlayBattleAnimation2: +; play animation ID at a and animation type 6 or 3 + ld [wAnimationID], a + ld a, [H_WHOSETURN] + and a + ld a, $6 + jr z, .storeAnimationType + ld a, $3 +.storeAnimationType + ld [wAnimationType], a + jp PlayBattleAnimationGotID + +PlayCurrentMoveAnimation: +; animation at MOVENUM will be played unless MOVENUM is 0 +; resets wAnimationType + xor a + ld [wAnimationType], a + ld a, [H_WHOSETURN] + and a + ld a, [wPlayerMoveNum] + jr z, .notEnemyTurn + ld a, [wEnemyMoveNum] +.notEnemyTurn + and a + ret z + +PlayBattleAnimation: +; play animation ID at a and predefined animation type + ld [wAnimationID], a + +PlayBattleAnimationGotID: +; play animation at wAnimationID + push hl + push de + push bc + predef MoveAnimation + pop bc + pop de + pop hl + ret diff --git a/engine/battle/save_trainer_name.asm b/engine/battle/save_trainer_name.asm index 49d0429f..114bd650 100644 --- a/engine/battle/save_trainer_name.asm +++ b/engine/battle/save_trainer_name.asm @@ -18,95 +18,4 @@ SaveTrainerName: jr nz, .CopyCharacter ret -TrainerNamePointers: -; what is the point of these? - dw YoungsterName - dw BugCatcherName - dw LassName - dw wTrainerName - dw JrTrainerMName - dw JrTrainerFName - dw PokemaniacName - dw SuperNerdName - dw wTrainerName - dw wTrainerName - dw BurglarName - dw EngineerName - dw JugglerXName - dw wTrainerName - dw SwimmerName - dw wTrainerName - dw wTrainerName - dw BeautyName - dw wTrainerName - dw RockerName - dw JugglerName - dw wTrainerName - dw wTrainerName - dw BlackbeltName - dw wTrainerName - dw ProfOakName - dw ChiefName - dw ScientistName - dw wTrainerName - dw RocketName - dw CooltrainerMName - dw CooltrainerFName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - dw wTrainerName - -YoungsterName: - db "YOUNGSTER@" -BugCatcherName: - db "BUG CATCHER@" -LassName: - db "LASS@" -JrTrainerMName: - db "JR.TRAINER♂@" -JrTrainerFName: - db "JR.TRAINER♀@" -PokemaniacName: - db "POKéMANIAC@" -SuperNerdName: - db "SUPER NERD@" -BurglarName: - db "BURGLAR@" -EngineerName: - db "ENGINEER@" -JugglerXName: - db "JUGGLER@" -SwimmerName: - db "SWIMMER@" -BeautyName: - db "BEAUTY@" -RockerName: - db "ROCKER@" -JugglerName: - db "JUGGLER@" -BlackbeltName: - db "BLACKBELT@" -ProfOakName: - db "PROF.OAK@" -ChiefName: - db "CHIEF@" -ScientistName: - db "SCIENTIST@" -RocketName: - db "ROCKET@" -CooltrainerMName: - db "COOLTRAINER♂@" -CooltrainerFName: - db "COOLTRAINER♀@" +INCLUDE "text/trainer_name_pointers.asm" diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index ac6c1a72..7755b50f 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -273,58 +273,9 @@ ReadMove: pop hl ret -; move choice modification methods that are applied for each trainer class -; 0 is sentinel value -TrainerClassMoveChoiceModifications: - db 0 ; YOUNGSTER - db 1,0 ; BUG CATCHER - db 1,0 ; LASS - db 1,3,0 ; SAILOR - db 1,0 ; JR_TRAINER_M - db 1,0 ; JR_TRAINER_F - db 1,2,3,0; POKEMANIAC - db 1,2,0 ; SUPER_NERD - db 1,0 ; HIKER - db 1,0 ; BIKER - db 1,3,0 ; BURGLAR - db 1,0 ; ENGINEER - db 1,2,0 ; JUGGLER_X - db 1,3,0 ; FISHER - db 1,3,0 ; SWIMMER - db 0 ; CUE_BALL - db 1,0 ; GAMBLER - db 1,3,0 ; BEAUTY - db 1,2,0 ; PSYCHIC_TR - db 1,3,0 ; ROCKER - db 1,0 ; JUGGLER - db 1,0 ; TAMER - db 1,0 ; BIRD_KEEPER - db 1,0 ; BLACKBELT - db 1,0 ; SONY1 - db 1,3,0 ; PROF_OAK - db 1,2,0 ; CHIEF - db 1,2,0 ; SCIENTIST - db 1,3,0 ; GIOVANNI - db 1,0 ; ROCKET - db 1,3,0 ; COOLTRAINER_M - db 1,3,0 ; COOLTRAINER_F - db 1,0 ; BRUNO - db 1,0 ; BROCK - db 1,3,0 ; MISTY - db 1,3,0 ; LT_SURGE - db 1,3,0 ; ERIKA - db 1,3,0 ; KOGA - db 1,3,0 ; BLAINE - db 1,3,0 ; SABRINA - db 1,2,0 ; GENTLEMAN - db 1,3,0 ; SONY2 - db 1,3,0 ; SONY3 - db 1,2,3,0; LORELEI - db 1,0 ; CHANNELER - db 1,0 ; AGATHA - db 1,3,0 ; LANCE - -INCLUDE "engine/battle/trainer_pic_money_pointers.asm" +INCLUDE "data/trainer_move_choices.asm" + +INCLUDE "data/trainer_pic_money_pointers.asm" INCLUDE "text/trainer_names.asm" @@ -368,57 +319,7 @@ TrainerAI: call Random jp hl -TrainerAIPointers: -; one entry per trainer class -; first byte, number of times (per Pokémon) it can occur -; next two bytes, pointer to AI subroutine for trainer class - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,JugglerAI ; juggler_x - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,GenericAI - dbw 3,JugglerAI ; juggler - dbw 3,GenericAI - dbw 3,GenericAI - dbw 2,BlackbeltAI ; blackbelt - dbw 3,GenericAI - dbw 3,GenericAI - dbw 1,GenericAI ; chief - dbw 3,GenericAI - dbw 1,GiovanniAI ; giovanni - dbw 3,GenericAI - dbw 2,CooltrainerMAI ; cooltrainerm - dbw 1,CooltrainerFAI ; cooltrainerf - dbw 2,BrunoAI ; bruno - dbw 5,BrockAI ; brock - dbw 1,MistyAI ; misty - dbw 1,LtSurgeAI ; surge - dbw 1,ErikaAI ; erika - dbw 2,KogaAI ; koga - dbw 2,BlaineAI ; blaine - dbw 1,SabrinaAI ; sabrina - dbw 3,GenericAI - dbw 1,Sony2AI ; sony2 - dbw 1,Sony3AI ; sony3 - dbw 2,LoreleiAI ; lorelei - dbw 3,GenericAI - dbw 2,AgathaAI ; agatha - dbw 1,LanceAI ; lance +INCLUDE "data/trainer_ai_pointers.asm" JugglerAI: cp 25 percent + 1 diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 231c46e7..93409051 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -101,18 +101,4 @@ TryDoWildEncounter: xor a ret -WildMonEncounterSlotChances: -; There are 10 slots for wild pokemon, and this is the table that defines how common each of -; those 10 slots is. A random number is generated and then the first byte of each pair in this -; table is compared against that random number. If the random number is less than or equal -; to the first byte, then that slot is chosen. The second byte is double the slot number. - db $32, $00 ; 51/256 = 19.9% chance of slot 0 - db $65, $02 ; 51/256 = 19.9% chance of slot 1 - db $8C, $04 ; 39/256 = 15.2% chance of slot 2 - db $A5, $06 ; 25/256 = 9.8% chance of slot 3 - db $BE, $08 ; 25/256 = 9.8% chance of slot 4 - db $D7, $0A ; 25/256 = 9.8% chance of slot 5 - db $E4, $0C ; 13/256 = 5.1% chance of slot 6 - db $F1, $0E ; 13/256 = 5.1% chance of slot 7 - db $FC, $10 ; 11/256 = 4.3% chance of slot 8 - db $FF, $12 ; 3/256 = 1.2% chance of slot 9 +INCLUDE "data/wild_probabilities.asm" diff --git a/engine/experience.asm b/engine/experience.asm index 2efc13de..0b8d154f 100755 --- a/engine/experience.asm +++ b/engine/experience.asm @@ -146,15 +146,4 @@ CalcDSquared: ld [H_MULTIPLIER], a jp Multiply -; each entry has the following scheme: -; %AAAABBBB %SCCCCCCC %DDDDDDDD %EEEEEEEE -; resulting in -; (a*n^3)/b + sign*c*n^2 + d*n - e -; where sign = -1 <=> S=1 -GrowthRateTable: - db $11,$00,$00,$00 ; medium fast n^3 - db $34,$0A,$00,$1E ; (unused?) 3/4 n^3 + 10 n^2 - 30 - db $34,$14,$00,$46 ; (unused?) 3/4 n^3 + 20 n^2 - 70 - db $65,$8F,$64,$8C ; medium slow: 6/5 n^3 - 15 n^2 + 100 n - 140 - db $45,$00,$00,$00 ; fast: 4/5 n^3 - db $54,$00,$00,$00 ; slow: 5/4 n^3 +INCLUDE "data/growth_rates.asm" diff --git a/engine/hidden_object_functions3.asm b/engine/hidden_object_functions3.asm index aaedcbca..ade99fd7 100755 --- a/engine/hidden_object_functions3.asm +++ b/engine/hidden_object_functions3.asm @@ -36,43 +36,7 @@ PrintBookshelfText: ld [$ffdb], a jpba PrintCardKeyText -; format: db tileset id, bookshelf tile id, text id -BookshelfTileIDs: - db PLATEAU, $30 - db_tx_pre IndigoPlateauStatues - db HOUSE, $3D - db_tx_pre TownMapText - db HOUSE, $1E - db_tx_pre BookOrSculptureText - db MANSION, $32 - db_tx_pre BookOrSculptureText - db REDS_HOUSE_1, $32 - db_tx_pre BookOrSculptureText - db LAB, $28 - db_tx_pre BookOrSculptureText - db LOBBY, $16 - db_tx_pre ElevatorText - db GYM, $1D - db_tx_pre BookOrSculptureText - db DOJO, $1D - db_tx_pre BookOrSculptureText - db GATE, $22 - db_tx_pre BookOrSculptureText - db MART, $54 - db_tx_pre PokemonStuffText - db MART, $55 - db_tx_pre PokemonStuffText - db POKECENTER, $54 - db_tx_pre PokemonStuffText - db POKECENTER, $55 - db_tx_pre PokemonStuffText - db LOBBY, $50 - db_tx_pre PokemonStuffText - db LOBBY, $52 - db_tx_pre PokemonStuffText - db SHIP, $36 - db_tx_pre BookOrSculptureText - db $FF +INCLUDE "data/bookshelf_tile_ids.asm" IndigoPlateauStatues: TX_ASM diff --git a/engine/items/items.asm b/engine/items/items.asm index ec51a0d4..05dcf572 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -2881,10 +2881,7 @@ IsNextTileShoreOrWater: and a ret -; tilesets with water -WaterTilesets: - db OVERWORLD, FOREST, DOJO, GYM, SHIP, SHIP_PORT, CAVERN, FACILITY, PLATEAU - db $ff ; terminator +INCLUDE "data/water_tilesets.asm" ReadSuperRodData: ; return e = 2 if no fish on this map diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index a05676c4..6f643228 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -89,7 +89,7 @@ SomeonesPCText: db "SOMEONE's PC@" BillsPCText: db "BILL's PC@" PlayersPCText: db "'s PC@" OaksPCText: db "PROF.OAK's PC@" -PKMNLeaguePCText: db $4a, "LEAGUE@" +PKMNLeaguePCText: db "<pkmn>LEAGUE@" LogOffPCText: db "LOG OFF@" BillsPC_:: @@ -339,9 +339,9 @@ DisplayMonListMenu: ret BillsPCMenuText: - db "WITHDRAW ", $4a - next "DEPOSIT ", $4a - next "RELEASE ", $4a + db "WITHDRAW <pkmn>" + next "DEPOSIT <pkmn>" + next "RELEASE <pkmn>" next "CHANGE BOX" next "SEE YA!" db "@" diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index 64065c4d..91723da1 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -365,11 +365,7 @@ PrintAlphabet: ld [H_AUTOBGTRANSFERENABLED], a jp Delay3 -LowerCaseAlphabet: - db "abcdefghijklmnopqrstuvwxyz ×():;[]",$e1,$e2,"-?!♂♀/⠄,¥UPPER CASE@" - -UpperCaseAlphabet: - db "ABCDEFGHIJKLMNOPQRSTUVWXYZ ×():;[]",$e1,$e2,"-?!♂♀/⠄,¥lower case@" +INCLUDE "text/alphabets.asm" PrintNicknameAndUnderscores: call CalcStringLength @@ -439,21 +435,7 @@ DakutensAndHandakutens: ld [wNamingScreenLetter], a ret -Dakutens: - db "かが", "きぎ", "くぐ", "けげ", "こご" - db "さざ", "しじ", "すず", "せぜ", "そぞ" - db "ただ", "ちぢ", "つづ", "てで", "とど" - db "はば", "ひび", "ふぶ", "へべ", "ほぼ" - db "カガ", "キギ", "クグ", "ケゲ", "コゴ" - db "サザ", "シジ", "スズ", "セゼ", "ソゾ" - db "タダ", "チヂ", "ツヅ", "テデ", "トド" - db "ハバ", "ヒビ", "フブ", "へべ", "ホボ" - db $ff - -Handakutens: - db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ" - db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ" - db $ff +INCLUDE "text/dakutens.asm" ; calculates the length of the string at wcf4b and stores it in c CalcStringLength: diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 947837e3..04efe711 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -446,55 +446,9 @@ CannotGetOffHereText: TX_FAR _CannotGetOffHereText db "@" -; items which bring up the party menu when used -UsableItems_PartyMenu: - db MOON_STONE - db ANTIDOTE - db BURN_HEAL - db ICE_HEAL - db AWAKENING - db PARLYZ_HEAL - db FULL_RESTORE - db MAX_POTION - db HYPER_POTION - db SUPER_POTION - db POTION - db FIRE_STONE - db THUNDER_STONE - db WATER_STONE - db HP_UP - db PROTEIN - db IRON - db CARBOS - db CALCIUM - db RARE_CANDY - db LEAF_STONE - db FULL_HEAL - db REVIVE - db MAX_REVIVE - db FRESH_WATER - db SODA_POP - db LEMONADE - db X_ATTACK - db X_DEFEND - db X_SPEED - db X_SPECIAL - db PP_UP - db ETHER - db MAX_ETHER - db ELIXER - db MAX_ELIXER - db $ff +INCLUDE "data/party_items.asm" -; items which close the item menu when used -UsableItems_CloseMenu: - db ESCAPE_ROPE - db ITEMFINDER - db POKE_FLUTE - db OLD_ROD - db GOOD_ROD - db SUPER_ROD - db $ff +INCLUDE "data/overworld_items.asm" StartMenu_TrainerInfo: call GBPalWhiteOut diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index aab4adf4..0b5c8842 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -130,10 +130,4 @@ LoadVendingMachineItem: ld [hVendingMachinePrice + 2], a ret -VendingPrices: - db FRESH_WATER - money 200 - db SODA_POP - money 300 - db LEMONADE - money 350 +INCLUDE "data/vending_prices.asm" diff --git a/engine/mon_party_sprites.asm b/engine/mon_party_sprites.asm index 864ac136..a8f85748 100755 --- a/engine/mon_party_sprites.asm +++ b/engine/mon_party_sprites.asm @@ -162,146 +162,7 @@ LoadMonPartySpriteGfxWithLCDDisabled: jr nz, .loop jp EnableLCD -MonPartySpritePointers: - dw SlowbroSprite + $c0 - db $40 / $10 ; 40 bytes - db BANK(SlowbroSprite) - dw vSprites - - dw BallSprite - db $80 / $10 ; $80 bytes - db BANK(BallSprite) - dw vSprites + $40 - - dw ClefairySprite + $c0 - db $40 / $10 ; $40 bytes - db BANK(ClefairySprite) - dw vSprites + $c0 - - dw BirdSprite + $c0 - db $40 / $10 ; $40 bytes - db BANK(BirdSprite) - dw vSprites + $100 - - dw SeelSprite - db $40 / $10 ; $40 bytes - db BANK(SeelSprite) - dw vSprites + $140 - - dw MonPartySprites + $40 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $180 - - dw MonPartySprites + $50 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $1a0 - - dw MonPartySprites + $60 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $1c0 - - dw MonPartySprites + $70 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $1e0 - - dw MonPartySprites + $80 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $200 - - dw MonPartySprites + $90 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $220 - - dw MonPartySprites + $A0 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $240 - - dw MonPartySprites + $B0 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $260 - - dw MonPartySprites + $100 - db $40 / $10 ; $40 bytes - db BANK(MonPartySprites) - dw vSprites + $380 - - dw SlowbroSprite - db $40 / $10 ; $40 bytes - db BANK(SlowbroSprite) - dw vSprites + $400 - - dw BallSprite - db $80 / $10 ; $80 bytes - db BANK(BallSprite) - dw vSprites + $440 - - dw ClefairySprite - db $40 / $10 ; $40 bytes - db BANK(ClefairySprite) - dw vSprites + $4c0 - - dw BirdSprite - db $40 / $10 ; $40 bytes - db BANK(BirdSprite) - dw vSprites + $500 - - dw SeelSprite + $C0 - db $40 / $10 ; $40 bytes - db BANK(SeelSprite) - dw vSprites + $540 - - dw MonPartySprites - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $580 - - dw MonPartySprites + $10 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $5a0 - - dw MonPartySprites + $20 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $5c0 - - dw MonPartySprites + $30 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $5E0 - - dw MonPartySprites + $C0 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $600 - - dw MonPartySprites + $D0 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $620 - - dw MonPartySprites + $E0 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $640 - - dw MonPartySprites + $F0 - db $10 / $10 ; $10 bytes - db BANK(MonPartySprites) - dw vSprites + $660 - - dw MonPartySprites + $140 - db $40 / $10 ; $40 bytes - db BANK(MonPartySprites) - dw vSprites + $780 +INCLUDE "data/mon_party_sprite_pointers.asm" WriteMonPartySpriteOAMByPartyIndex: ; Write OAM blocks for the party mon in [hPartyMonIndex]. diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index 1258c59b..fdc9ffa3 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -187,37 +187,7 @@ DisplayIntroNameTextBox: .namestring db "NAME@" -IF DEF(_RED) -DefaultNamesPlayer: - db "NEW NAME" - next "RED" - next "ASH" - next "JACK" - db "@" - -DefaultNamesRival: - db "NEW NAME" - next "BLUE" - next "GARY" - next "JOHN" - db "@" -ENDC - -IF DEF(_BLUE) -DefaultNamesPlayer: - db "NEW NAME" - next "BLUE" - next "GARY" - next "JOHN" - db "@" - -DefaultNamesRival: - db "NEW NAME" - next "RED" - next "ASH" - next "JACK" - db "@" -ENDC +INCLUDE "text/player_names.asm" GetDefaultName: ; a = name index @@ -243,30 +213,7 @@ GetDefaultName: ld bc, $14 jp CopyData -IF DEF(_RED) -DefaultNamesPlayerList: - db "NEW NAME@" - db "RED@" - db "ASH@" - db "JACK@" -DefaultNamesRivalList: - db "NEW NAME@" - db "BLUE@" - db "GARY@" - db "JOHN@" -ENDC -IF DEF(_BLUE) -DefaultNamesPlayerList: - db "NEW NAME@" - db "BLUE@" - db "GARY@" - db "JOHN@" -DefaultNamesRivalList: - db "NEW NAME@" - db "RED@" - db "ASH@" - db "JACK@" -ENDC +INCLUDE "text/player_names_list.asm" TextTerminator_6b20: db "@" diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index f6ae6468..f61ca65f 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -248,16 +248,4 @@ ReplaceTreeTileBlock: ld [hl], a ret -CutTreeBlockSwaps: -; first byte = tileset block containing the cut tree -; second byte = corresponding tileset block after the cut animation happens - db $32, $6D - db $33, $6C - db $34, $6F - db $35, $4C - db $60, $6E - db $0B, $0A - db $3C, $35 - db $3F, $35 - db $3D, $36 - db $FF ; list terminator +INCLUDE "data/cut_tree_blocks.asm" diff --git a/engine/overworld/doors.asm b/engine/overworld/doors.asm index c39e096d..1339430a 100755 --- a/engine/overworld/doors.asm +++ b/engine/overworld/doors.asm @@ -25,51 +25,4 @@ IsPlayerStandingOnDoorTile: and a ret -DoorTileIDPointers: - dbw OVERWORLD, OverworldDoorTileIDs - dbw FOREST, ForestDoorTileIDs - dbw MART, MartDoorTileIDs - dbw HOUSE, HouseDoorTileIDs - dbw FOREST_GATE, TilesetMuseumDoorTileIDs - dbw MUSEUM, TilesetMuseumDoorTileIDs - dbw GATE, TilesetMuseumDoorTileIDs - dbw SHIP, ShipDoorTileIDs - dbw LOBBY, LobbyDoorTileIDs - dbw MANSION, MansionDoorTileIDs - dbw LAB, LabDoorTileIDs - dbw FACILITY, FacilityDoorTileIDs - dbw PLATEAU, PlateauDoorTileIDs - db $ff - -OverworldDoorTileIDs: - db $1B,$58,$00 - -ForestDoorTileIDs: - db $3a,$00 - -MartDoorTileIDs: - db $5e,$00 - -HouseDoorTileIDs: - db $54,$00 - -TilesetMuseumDoorTileIDs: - db $3b,$00 - -ShipDoorTileIDs: - db $1e,$00 - -LobbyDoorTileIDs: - db $1c,$38,$1a,$00 - -MansionDoorTileIDs: - db $1a,$1c,$53,$00 - -LabDoorTileIDs: - db $34,$00 - -FacilityDoorTileIDs: - db $43,$58,$1b,$00 - -PlateauDoorTileIDs: - db $3b,$1b,$00 +INCLUDE "data/door_tile_ids.asm" diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index 342540b2..77e7bd47 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -54,17 +54,7 @@ HandleLedges: call PlaySound ret - ; (player direction) (tile player standing on) (ledge tile) (input required) -LedgeTiles: - db SPRITE_FACING_DOWN, $2C,$37,D_DOWN - db SPRITE_FACING_DOWN, $39,$36,D_DOWN - db SPRITE_FACING_DOWN, $39,$37,D_DOWN - db SPRITE_FACING_LEFT, $2C,$27,D_LEFT - db SPRITE_FACING_LEFT, $39,$27,D_LEFT - db SPRITE_FACING_RIGHT,$2C,$0D,D_RIGHT - db SPRITE_FACING_RIGHT,$2C,$1D,D_RIGHT - db SPRITE_FACING_RIGHT,$39,$0D,D_RIGHT - db $FF +INCLUDE "data/ledge_tiles.asm" LoadHoppingShadowOAM: ld hl, vChars1 + $7f0 diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index a17e67bd..0f17de8f 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -349,7 +349,7 @@ GetPlayerTeleportAnimFrameDelay: IsPlayerStandingOnWarpPadOrHole: ld b, 0 - ld hl, .warpPadAndHoleData + ld hl, WarpPadAndHoleData ld a, [wCurMapTileset] ld c, a .loop @@ -373,13 +373,7 @@ IsPlayerStandingOnWarpPadOrHole: ld [wStandingOnWarpPadOrHole], a ret -; format: db tileset id, tile id, value to be put in [wStandingOnWarpPadOrHole] -.warpPadAndHoleData: - db FACILITY, $20, 1 ; warp pad - db FACILITY, $11, 2 ; hole - db CAVERN, $22, 2 ; hole - db INTERIOR, $55, 1 ; warp pad - db $FF +INCLUDE "data/warp_pad_hole_tile_ids.asm" FishingAnim: ld c, 10 diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 73c55da2..ba47f7eb 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -157,12 +157,12 @@ IsWarpTileInFrontOfPlayer: call _GetTileAndCoordsInFrontOfPlayer ld a, [wCurMap] cp SS_ANNE_BOW - jr z, .ssAnne5 + jr z, IsSSAnneBowWarpTileInFrontOfPlayer ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction srl a ld c, a ld b, 0 - ld hl, .warpTileListPointers + ld hl, WarpTileListPointers add hl, bc ld a, [hli] ld h, [hl] @@ -176,33 +176,17 @@ IsWarpTileInFrontOfPlayer: pop hl ret -.warpTileListPointers: - dw .facingDownWarpTiles - dw .facingUpWarpTiles - dw .facingLeftWarpTiles - dw .facingRightWarpTiles +INCLUDE "data/warp_carpet_tile_ids.asm" -.facingDownWarpTiles - db $01,$12,$17,$3D,$04,$18,$33,$FF - -.facingUpWarpTiles - db $01,$5C,$FF - -.facingLeftWarpTiles - db $1A,$4B,$FF - -.facingRightWarpTiles - db $0F,$4E,$FF - -.ssAnne5 +IsSSAnneBowWarpTileInFrontOfPlayer: ld a, [wTileInFrontOfPlayer] cp $15 jr nz, .notSSAnne5Warp scf - jr .done + jr IsWarpTileInFrontOfPlayer.done .notSSAnne5Warp and a - jr .done + jr IsWarpTileInFrontOfPlayer.done IsPlayerStandingOnDoorTileOrWarpTile: push hl diff --git a/engine/overworld/saffron_guards.asm b/engine/overworld/saffron_guards.asm index 3b26b6f8..92d4847f 100755 --- a/engine/overworld/saffron_guards.asm +++ b/engine/overworld/saffron_guards.asm @@ -12,5 +12,4 @@ RemoveGuardDrink: jr z, .drinkLoop jpba RemoveItemByID -GuardDrinksList: - db FRESH_WATER, SODA_POP, LEMONADE, $00 +INCLUDE "data/guard_drink_items.asm" diff --git a/engine/overworld/set_blackout_map.asm b/engine/overworld/set_blackout_map.asm index bac2f0ca..14f0ba28 100644 --- a/engine/overworld/set_blackout_map.asm +++ b/engine/overworld/set_blackout_map.asm @@ -22,8 +22,4 @@ SetLastBlackoutMap: pop hl ret -SafariZoneRestHouses: - db SAFARI_ZONE_WEST_REST_HOUSE - db SAFARI_ZONE_EAST_REST_HOUSE - db SAFARI_ZONE_NORTH_REST_HOUSE - db -1 +INCLUDE "data/rest_house_maps.asm" diff --git a/engine/predefs.asm b/engine/predefs.asm index 6f605043..43ab7349 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -49,105 +49,4 @@ GetPredefPointer: ret -PredefPointers:: -; these are pointers to ASM routines. -; they appear to be used in overworld map scripts. - add_predef DrawPlayerHUDAndHPBar - add_predef CopyUncompressedPicToTilemap - add_predef AnimateSendingOutMon - add_predef ScaleSpriteByTwo - add_predef LoadMonBackPic - add_predef CopyDownscaledMonTiles - dbw $03,JumpMoveEffect ; wrong bank - add_predef HealParty - add_predef MoveAnimation - add_predef DivideBCDPredef - add_predef DivideBCDPredef2 - add_predef AddBCDPredef - add_predef SubBCDPredef - add_predef DivideBCDPredef3 - add_predef DivideBCDPredef4 - add_predef InitPlayerData - add_predef FlagActionPredef - add_predef HideObject - add_predef IsObjectHidden - add_predef ApplyOutOfBattlePoisonDamage - add_predef AnyPartyAlive - add_predef ShowObject - add_predef ShowObject2 - add_predef ReplaceTileBlock - add_predef InitPlayerData2 - add_predef LoadTilesetHeader - add_predef LearnMoveFromLevelUp - add_predef LearnMove - add_predef GetQuantityOfItemInBag - dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; home bank - dbw $03,GiveItem ; home bank - add_predef ChangeBGPalColor0_4Frames - add_predef FindPathToPlayer - add_predef PredefShakeScreenVertically - add_predef CalcPositionOfPlayerRelativeToNPC - add_predef ConvertNPCMovementDirectionsToJoypadMasks - add_predef PredefShakeScreenHorizontally - add_predef UpdateHPBar - add_predef HPBarLength - add_predef Diploma_TextBoxBorder - add_predef DoubleOrHalveSelectedStats - add_predef ShowPokedexMenu - add_predef EvolutionAfterBattle - add_predef SaveSAVtoSRAM0 - add_predef InitOpponent - add_predef CableClub_Run - add_predef DrawBadges - add_predef ExternalClockTradeAnim - add_predef BattleTransition - add_predef CopyTileIDsFromList - add_predef PlayIntro - add_predef GetMoveSoundB - add_predef FlashScreen - add_predef GetTileAndCoordsInFrontOfPlayer - add_predef StatusScreen - add_predef StatusScreen2 - add_predef InternalClockTradeAnim - add_predef TrainerEngage - add_predef IndexToPokedex - add_predef DisplayPicCenteredOrUpperRight - add_predef UsedCut - add_predef ShowPokedexData - add_predef WriteMonMoves - add_predef SaveSAV - add_predef LoadSGB - add_predef MarkTownVisitedAndLoadMissableObjects - add_predef SetPartyMonTypes - add_predef CanLearnTM - add_predef TMToMove - add_predef _RunPaletteCommand - add_predef StarterDex - add_predef _AddPartyMon - add_predef UpdateHPBar2 - add_predef DrawEnemyHUDAndHPBar - add_predef LoadTownMap_Nest - add_predef PrintMonType - add_predef EmotionBubble - add_predef EmptyFunc3; return immediately - add_predef AskName - add_predef PewterGuys - add_predef SaveSAVtoSRAM2 - add_predef LoadSAV2 - add_predef LoadSAV - add_predef SaveSAVtoSRAM1 - add_predef DoInGameTradeDialogue - add_predef HallOfFamePC - add_predef DisplayDexRating - dbw $1E, _LeaveMapAnim ; wrong bank - dbw $1E, EnterMapAnim ; wrong bank - add_predef GetTileTwoStepsInFrontOfPlayer - add_predef CheckForCollisionWhenPushingBoulder - add_predef PrintStrengthTxt - add_predef PickUpItem - add_predef PrintMoveType - add_predef LoadMovePPs - add_predef DrawHP - add_predef DrawHP2 - add_predef DisplayElevatorFloorMenu - add_predef OaksAideScript +INCLUDE "data/predef_pointers.asm" @@ -919,6 +919,7 @@ INCLUDE "engine/battle/moveEffects/reflect_light_screen_effect.asm" SECTION "bankF", ROMX INCLUDE "engine/battle/core.asm" +INCLUDE "engine/battle/effects.asm" SECTION "bank10", ROMX diff --git a/text/alphabets.asm b/text/alphabets.asm new file mode 100644 index 00000000..9799a7e6 --- /dev/null +++ b/text/alphabets.asm @@ -0,0 +1,5 @@ +LowerCaseAlphabet: + db "abcdefghijklmnopqrstuvwxyz ×():;[]",$e1,$e2,"-?!♂♀/⠄,¥UPPER CASE@" + +UpperCaseAlphabet: + db "ABCDEFGHIJKLMNOPQRSTUVWXYZ ×():;[]",$e1,$e2,"-?!♂♀/⠄,¥lower case@" diff --git a/text/dakutens.asm b/text/dakutens.asm new file mode 100644 index 00000000..f3bf4854 --- /dev/null +++ b/text/dakutens.asm @@ -0,0 +1,15 @@ +Dakutens: + db "かが", "きぎ", "くぐ", "けげ", "こご" + db "さざ", "しじ", "すず", "せぜ", "そぞ" + db "ただ", "ちぢ", "つづ", "てで", "とど" + db "はば", "ひび", "ふぶ", "へべ", "ほぼ" + db "カガ", "キギ", "クグ", "ケゲ", "コゴ" + db "サザ", "シジ", "スズ", "セゼ", "ソゾ" + db "タダ", "チヂ", "ツヅ", "テデ", "トド" + db "ハバ", "ヒビ", "フブ", "へべ", "ホボ" + db $ff + +Handakutens: + db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ" + db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ" + db $ff diff --git a/text/player_names.asm b/text/player_names.asm new file mode 100644 index 00000000..f57c9877 --- /dev/null +++ b/text/player_names.asm @@ -0,0 +1,31 @@ +IF DEF(_RED) +DefaultNamesPlayer: + db "NEW NAME" + next "RED" + next "ASH" + next "JACK" + db "@" + +DefaultNamesRival: + db "NEW NAME" + next "BLUE" + next "GARY" + next "JOHN" + db "@" +ENDC + +IF DEF(_BLUE) +DefaultNamesPlayer: + db "NEW NAME" + next "BLUE" + next "GARY" + next "JOHN" + db "@" + +DefaultNamesRival: + db "NEW NAME" + next "RED" + next "ASH" + next "JACK" + db "@" +ENDC diff --git a/text/player_names_list.asm b/text/player_names_list.asm new file mode 100644 index 00000000..56075df0 --- /dev/null +++ b/text/player_names_list.asm @@ -0,0 +1,27 @@ +IF DEF(_RED) +DefaultNamesPlayerList: + db "NEW NAME@" + db "RED@" + db "ASH@" + db "JACK@" + +DefaultNamesRivalList: + db "NEW NAME@" + db "BLUE@" + db "GARY@" + db "JOHN@" +ENDC + +IF DEF(_BLUE) +DefaultNamesPlayerList: + db "NEW NAME@" + db "BLUE@" + db "GARY@" + db "JOHN@" + +DefaultNamesRivalList: + db "NEW NAME@" + db "RED@" + db "ASH@" + db "JACK@" +ENDC diff --git a/text/stat_names.asm b/text/stat_names.asm new file mode 100644 index 00000000..854780c6 --- /dev/null +++ b/text/stat_names.asm @@ -0,0 +1,7 @@ +StatsTextStrings: + db "ATTACK@" + db "DEFENSE@" + db "SPEED@" + db "SPECIAL@" + db "ACCURACY@" + db "EVADE@" diff --git a/text/trainer_name_pointers.asm b/text/trainer_name_pointers.asm new file mode 100644 index 00000000..aa5e72d3 --- /dev/null +++ b/text/trainer_name_pointers.asm @@ -0,0 +1,92 @@ +TrainerNamePointers: +; what is the point of these? + dw YoungsterName + dw BugCatcherName + dw LassName + dw wTrainerName + dw JrTrainerMName + dw JrTrainerFName + dw PokemaniacName + dw SuperNerdName + dw wTrainerName + dw wTrainerName + dw BurglarName + dw EngineerName + dw JugglerXName + dw wTrainerName + dw SwimmerName + dw wTrainerName + dw wTrainerName + dw BeautyName + dw wTrainerName + dw RockerName + dw JugglerName + dw wTrainerName + dw wTrainerName + dw BlackbeltName + dw wTrainerName + dw ProfOakName + dw ChiefName + dw ScientistName + dw wTrainerName + dw RocketName + dw CooltrainerMName + dw CooltrainerFName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + dw wTrainerName + +YoungsterName: + db "YOUNGSTER@" +BugCatcherName: + db "BUG CATCHER@" +LassName: + db "LASS@" +JrTrainerMName: + db "JR.TRAINER♂@" +JrTrainerFName: + db "JR.TRAINER♀@" +PokemaniacName: + db "POKéMANIAC@" +SuperNerdName: + db "SUPER NERD@" +BurglarName: + db "BURGLAR@" +EngineerName: + db "ENGINEER@" +JugglerXName: + db "JUGGLER@" +SwimmerName: + db "SWIMMER@" +BeautyName: + db "BEAUTY@" +RockerName: + db "ROCKER@" +JugglerName: + db "JUGGLER@" +BlackbeltName: + db "BLACKBELT@" +ProfOakName: + db "PROF.OAK@" +ChiefName: + db "CHIEF@" +ScientistName: + db "SCIENTIST@" +RocketName: + db "ROCKET@" +CooltrainerMName: + db "COOLTRAINER♂@" +CooltrainerFName: + db "COOLTRAINER♀@" |