diff options
author | Remy Oukaour <remy.oukaour@gmail.com> | 2018-01-10 17:30:27 -0500 |
---|---|---|
committer | Remy Oukaour <remy.oukaour@gmail.com> | 2018-01-10 17:30:27 -0500 |
commit | c8575823a0e3694cba7c63e7ef468c55bb301804 (patch) | |
tree | 8dc753dc443b6b84d5649705415d66794781a88e /engine | |
parent | 28d5169a119ece438cc39b442adaa018b9a376e3 (diff) |
Battle data goes in data/battle/
TreeMons, like fish groups, have constants
Diffstat (limited to 'engine')
-rw-r--r-- | engine/battle/effect_commands.asm | 132 | ||||
-rwxr-xr-x | engine/events_3.asm | 25 | ||||
-rwxr-xr-x | engine/link.asm | 4 | ||||
-rwxr-xr-x | engine/warp_connection.asm | 9 |
4 files changed, 61 insertions, 109 deletions
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index f86f90479..f9a8ba63e 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -64,7 +64,7 @@ DoMove: ; 3402c inc hl ld [de], a inc de - cp $ff + cp -1 jr nz, .GetMoveEffect ; Start at the first command. @@ -138,7 +138,7 @@ BattleCommand_CheckTurn: ; 34084 ld [AlreadyFailed], a ld [wSomeoneIsRampaging], a - ld a, 10 ; 1.0 + ld a, EFFECTIVE ld [TypeModifier], a ld a, [hBattleTurn] @@ -282,7 +282,7 @@ CheckPlayerTurn: ; 50% chance of hitting itself call BattleRandom - cp $80 + cp 50 percent + 1 jr nc, .not_confused ; clear confusion-dependent substatus @@ -311,7 +311,7 @@ CheckPlayerTurn: ; 50% chance of infatuation call BattleRandom - cp $80 + cp 50 percent + 1 jr c, .not_infatuated ld hl, InfatuationText @@ -345,7 +345,7 @@ CheckPlayerTurn: ; 25% chance to be fully paralyzed call BattleRandom - cp $3f + cp 25 percent ret nc ld hl, FullyParalyzedText @@ -457,6 +457,8 @@ CheckEnemyTurn: ; 3421f ld hl, EnemyMonStatus bit FRZ, [hl] jr z, .not_frozen + + ; Flame Wheel and Sacred Fire thaw the user. ld a, [CurEnemyMove] cp FLAME_WHEEL jr z, .not_frozen @@ -611,7 +613,7 @@ CheckEnemyTurn: ; 3421f ; 25% chance to be fully paralyzed call BattleRandom - cp $3f + cp 25 percent ret nc ld hl, FullyParalyzedText @@ -989,6 +991,7 @@ IgnoreSleepOnly: ; 3451f ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar + ; Snore and Sleep Talk bypass sleep. cp SNORE jr z, .CheckSleep cp SLEEP_TALK @@ -1172,7 +1175,7 @@ BattleCommand_DoTurn: ; 34555 db EFFECT_ROLLOUT db EFFECT_BIDE db EFFECT_RAMPAGE - db $ff + db -1 ; 3460b CheckMimicUsed: ; 3460b @@ -1266,7 +1269,7 @@ BattleCommand_Critical: ; 34631 ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld de, 1 - ld hl, .Criticals + ld hl, CriticalHitMoves push bc call IsInArray pop bc @@ -1288,7 +1291,7 @@ BattleCommand_Critical: ; 34631 inc c .Tally: - ld hl, .Chances + ld hl, CriticalHitChances ld b, 0 add hl, bc call BattleRandom @@ -1298,12 +1301,7 @@ BattleCommand_Critical: ; 34631 ld [CriticalHit], a ret -.Criticals: - db KARATE_CHOP, RAZOR_WIND, RAZOR_LEAF, CRABHAMMER, SLASH, AEROBLAST, CROSS_CHOP, $ff -.Chances: - ; 6.25% 12.1% 24.6% 33.2% 49.6% 49.6% 49.6% - db $11, $20, $40, $55, $80, $80, $80 - ; 0 1 2 3 4 5 6 +INCLUDE "data/battle/critical_hits.asm" ; 346b2 @@ -1433,11 +1431,11 @@ BattleCommand_Stab: ; 346d2 .TypesLoop: ld a, [hli] - cp $ff + cp -1 jr z, .end ; foresight - cp $fe + cp -2 jr nz, .SkipForesightCheck ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar @@ -1562,9 +1560,9 @@ CheckTypeMatchup: ; 347d3 ld hl, TypeMatchups .TypesLoop: ld a, [hli] - cp $ff + cp -1 jr z, .End - cp $fe + cp -2 jr nz, .Next ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar @@ -1640,7 +1638,7 @@ BattleCommand_ResetTypeMatchup: ; 34833 INCLUDE "engine/battle/ai/switch.asm" -INCLUDE "data/type_matchups.asm" +INCLUDE "data/battle/type_matchups.asm" BattleCommand_DamageVariation: ; 34cfd ; damagevariation @@ -1675,7 +1673,7 @@ BattleCommand_DamageVariation: ; 34cfd .loop call BattleRandom rrca - cp $d9 ; 85% + cp 85 percent + 1 jr c, .loop ld [hMultiplier], a @@ -1756,7 +1754,7 @@ BattleCommand_CheckHit: ; 34d32 .skip_brightpowder ld a, b - cp $ff + cp -1 jr z, .Hit call BattleRandom @@ -1954,7 +1952,7 @@ BattleCommand_CheckHit: ; 34d32 .skip_foresight_check ; subtract evasion from 14 - ld a, 14 + ld a, MAX_STAT_LEVEL + 1 sub c ld c, a ; store the base move accuracy for math ops @@ -1969,7 +1967,7 @@ BattleCommand_CheckHit: ; 34d32 .accuracy_loop ; look up the multiplier from the table push bc - ld hl, .AccProb + ld hl, AccuracyLevelMultipliers dec b sla b ld c, b @@ -2013,21 +2011,7 @@ BattleCommand_CheckHit: ; 34d32 ld [hl], a ret -.AccProb: - db 33, 100 ; 33% -6 - db 36, 100 ; 36% -5 - db 43, 100 ; 43% -4 - db 50, 100 ; 50% -3 - db 60, 100 ; 60% -2 - db 75, 100 ; 75% -1 - db 1, 1 ; 100% 0 - db 133, 100 ; 133% +1 - db 166, 100 ; 166% +2 - db 2, 1 ; 200% +3 - db 233, 100 ; 233% +4 - db 133, 50 ; 266% +5 - db 3, 1 ; 300% +6 - +INCLUDE "data/battle/accuracy_multipliers.asm" ; 34ecc @@ -2199,7 +2183,7 @@ BattleCommand_HitTargetNoSub: ; 34f60 xor 1 ld [wKickCounter], a ld a, [de] - cp $1 + cp 1 push af ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -2438,7 +2422,7 @@ GetFailureResultText: ; 350e4 ld hl, AttackMissedText ld de, AttackMissed2Text ld a, [CriticalHit] - cp $ff + cp -1 jr nz, .got_text ld hl, UnaffectedText .got_text @@ -3519,7 +3503,7 @@ BattleCommand_DamageCalc: ; 35612 .NextItem: ld a, [hli] - cp $ff + cp -1 jr z, .DoneItem ; Item effect @@ -3657,26 +3641,7 @@ BattleCommand_DamageCalc: ; 35612 ; 35703 -TypeBoostItems: ; 35703 - db HELD_NORMAL_BOOST, NORMAL ; Pink/Polkadot Bow - db HELD_FIGHTING_BOOST, FIGHTING ; Blackbelt - db HELD_FLYING_BOOST, FLYING ; Sharp Beak - db HELD_POISON_BOOST, POISON ; Poison Barb - db HELD_GROUND_BOOST, GROUND ; Soft Sand - db HELD_ROCK_BOOST, ROCK ; Hard Stone - db HELD_BUG_BOOST, BUG ; Silverpowder - db HELD_GHOST_BOOST, GHOST ; Spell Tag - db HELD_FIRE_BOOST, FIRE ; Charcoal - db HELD_WATER_BOOST, WATER ; Mystic Water - db HELD_GRASS_BOOST, GRASS ; Miracle Seed - db HELD_ELECTRIC_BOOST, ELECTRIC ; Magnet - db HELD_PSYCHIC_BOOST, PSYCHIC ; Twistedspoon - db HELD_ICE_BOOST, ICE ; Nevermeltice - db HELD_DRAGON_BOOST, DRAGON ; Dragon Scale - db HELD_DARK_BOOST, DARK ; Blackglasses - db HELD_STEEL_BOOST, STEEL ; Metal Coat - db $ff -; 35726 +INCLUDE "data/battle/type_boost_items.asm" BattleCommand_ConstantDamage: ; 35726 @@ -4671,7 +4636,7 @@ BattleCommand_FalseSwipe: ; 35c94 ld [de], a .okay ld a, [CriticalHit] - cp $2 + cp 2 jr nz, .carry xor a ld [CriticalHit], a @@ -5049,7 +5014,7 @@ BattleCommand_SleepTarget: ; 35e5c jr nz, .dont_fail call BattleRandom - cp $40 ; 25% + cp 25 percent + 1 ; 25% chance AI fails ret c .dont_fail @@ -5149,7 +5114,7 @@ BattleCommand_Poison: ; 35f2c jr nz, .mimic_random call BattleRandom - cp $40 ; 25% chance AI fails + cp 25 percent + 1 ; 25% chance AI fails jr c, .failed .mimic_random @@ -5827,7 +5792,7 @@ BattleCommand_StatDown: ; 362e3 inc b .ComputerMiss: -; Computer opponents have a 1/4 chance of failing. +; Computer opponents have a 25% chance of failing. ld a, [hBattleTurn] and a jr z, .DidntMiss @@ -5852,7 +5817,7 @@ BattleCommand_StatDown: ; 362e3 jr z, .DidntMiss call BattleRandom - cp $40 + cp 25 percent + 1 ; 25% chance AI fails jr c, .Failed .DidntMiss: @@ -6104,7 +6069,7 @@ BattleCommand_StatDownFailText: ; 3646a GetStatName: ; 3648f - ld hl, .names + ld hl, StatNames ld c, "@" .CheckName: dec b @@ -6120,33 +6085,10 @@ GetStatName: ; 3648f ld bc, StringBuffer3 - StringBuffer2 jp CopyBytes -.names - db "ATTACK@" - db "DEFENSE@" - db "SPEED@" - db "SPCL.ATK@" - db "SPCL.DEF@" - db "ACCURACY@" - db "EVASION@" - db "ABILITY@" -; 364e6 - - -StatLevelMultipliers: ; 364e6 - db 25, 100 ; 0.25x - db 28, 100 ; 0.28x - db 33, 100 ; 0.33x - db 40, 100 ; 0.40x - db 50, 100 ; 0.50x - db 66, 100 ; 0.66x - db 1, 1 ; 1.00x - db 15, 10 ; 1.50x - db 2, 1 ; 2.00x - db 25, 10 ; 2.50x - db 3, 1 ; 3.00x - db 35, 10 ; 3.50x - db 4, 1 ; 4.00x -; 36500 +INCLUDE "data/battle/stat_names.asm" + + +INCLUDE "data/battle/stat_multipliers.asm" BattleCommand_AllStatsUp: ; 36500 diff --git a/engine/events_3.asm b/engine/events_3.asm index 5ee113a95..b39714d27 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -1,13 +1,11 @@ ReturnFromMapSetupScript:: ; b8000 xor a ld [hBGMapMode], a - ; For some reson, GameFreak chose to use a farcall here instead of just falling through. - ; No other function in the game references the function at 2E:400A, here labeled - ; ReturnFromMapSetupScript.inefficient_farcall. farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes ret ; b800a +; should have just been a fallthrough .inefficient_farcall ; b800a ld a, [MapGroup] ld b, a @@ -70,6 +68,7 @@ ReturnFromMapSetupScript:: ; b8000 ; b8070 .CheckSpecialMap: ; b8070 +; These landmarks do not get pop-up signs. cp -1 ret z cp SPECIAL_MAP @@ -401,6 +400,7 @@ RockMonEncounter: ; b8219 call GetTreeMons jr nc, .no_battle + ; 40% chance of an encounter ld a, 10 call RandomRange cp 4 @@ -461,7 +461,7 @@ GetTreeMons: ; b82d2 ; Return the address of TreeMon table a in hl. ; Return nc if table a doesn't exist. - cp 8 + cp NUM_TREEMON_SETS jr nc, .quit and a @@ -491,15 +491,16 @@ GetTreeMon: ; b83e5 push hl call GetTreeScore pop hl - and a + and a ; TREEMON_SCORE_BAD jr z, .bad - cp 1 + cp TREEMON_SCORE_GOOD jr z, .good - cp 2 + cp TREEMON_SCORE_RARE jr z, .rare ret .bad + ; 10% chance of an encounter ld a, 10 call RandomRange and a @@ -507,6 +508,7 @@ GetTreeMon: ; b83e5 jr SelectTreeMon .good + ; 50% chance of an encounter ld a, 10 call RandomRange cp 5 @@ -514,6 +516,7 @@ GetTreeMon: ; b83e5 jr SelectTreeMon .rare + ; 80% chance of an encounter ld a, 10 call RandomRange cp 8 @@ -542,7 +545,7 @@ SelectTreeMon: ; b841f .ok ld a, [hli] - cp $ff + cp -1 jr z, NoTreeMon ld a, [hli] @@ -575,15 +578,15 @@ GetTreeScore: ; b8443 jr c, .good .bad - xor a + xor a ; TREEMON_SCORE_BAD ret .good - ld a, 1 + ld a, TREEMON_SCORE_GOOD ret .rare - ld a, 2 + ld a, TREEMON_SCORE_RARE ret ; b8466 diff --git a/engine/link.asm b/engine/link.asm index e45f62dfd..779c288e8 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -2045,12 +2045,12 @@ Special_CheckTimeCapsuleCompatibility: ; 29bfb ; If any party Pokemon was introduced in the generation 2 games, don't let it in. ld hl, PartySpecies - ld b, PARTY_LENGTH ; 6 + ld b, PARTY_LENGTH .loop ld a, [hli] cp -1 jr z, .checkitem - cp CHIKORITA ; MEW + 1 ; 151 + 1 + cp MEW + 1 jr nc, .mon_too_new dec b jr nz, .loop diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index a0784caac..3a7292633 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -174,8 +174,11 @@ LoadWarpData: ; 1046c6 call GetAnyMapEnvironment call CheckIndoorMap ret nz + +; MOUNT_MOON_SQUARE and TIN_TOWER_ROOF are outdoor maps within indoor maps. +; Dig and Escape Rope should not take you to them. ld a, [wPrevMapGroup] - cp GROUP_MOUNT_MOON_SQUARE + cp GROUP_MOUNT_MOON_SQUARE ; GROUP_TIN_TOWER_ROOF jr nz, .not_mt_moon_or_tin_tower ld a, [wPrevMapNumber] cp MAP_MOUNT_MOON_SQUARE @@ -183,6 +186,7 @@ LoadWarpData: ; 1046c6 cp MAP_TIN_TOWER_ROOF ret z .not_mt_moon_or_tin_tower + ld a, [wPrevWarp] ld [wDigWarpNumber], a ld a, [wPrevMapGroup] @@ -206,6 +210,8 @@ LoadWarpData: ; 1046c6 ld b, a ld a, [wNextMapNumber] ld c, a + +; Respawn in Pokémon Centers. call GetAnyMapTileset ld a, c cp TILESET_POKECENTER @@ -214,6 +220,7 @@ LoadWarpData: ; 1046c6 jr z, .pokecenter_pokecom ret .pokecenter_pokecom + ld a, [wPrevMapGroup] ld [wLastSpawnMapGroup], a ld a, [wPrevMapNumber] |