diff options
32 files changed, 8671 insertions, 1158 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..3971c045e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# No monkey business with line endings +* text=false diff --git a/audio/sfx_pointers.asm b/audio/sfx_pointers.asm index fb06d931b..726e712c2 100644 --- a/audio/sfx_pointers.asm +++ b/audio/sfx_pointers.asm @@ -1,212 +1,213 @@ ; e927c - dbw $3c, $4b3f ; dex fanfare 50-79 - dbw $3c, $4c2f ; item - dbw $3c, $4c89 ; caught mon - dbw $3c, $4941 ; pokeballs placed on table - dbw $3c, $4947 ; potion - dbw $3c, $494a ; full heal - dbw $3c, $494d ; menu - dbw $3c, $4950 ; read text - dbw $3c, $4950 ; read text - dbw $3c, $4bd5 ; dex fanfare 20-49 - dbw $3c, $4cea ; dex fanfare 80-109 - dbw $3c, $4953 ; poison - dbw $3c, $4956 ; got safari balls - dbw $3c, $4959 ; boot pc - dbw $3c, $495c ; shut down pc - dbw $3c, $495f ; choose pc option - dbw $3c, $4962 ; bide / escape rope - dbw $3c, $4965 ; push button - dbw $3c, $4968 ; second part of itemfinder - dbw $3c, $496b ; warp to - dbw $3c, $496e ; warp from - dbw $3c, $4971 ; change dex mode - dbw $3c, $4974 ; jump over ledge - dbw $3c, $4977 ; grass rustle - dbw $3c, $497a ; fly - dbw $3c, $497d ; wrong - dbw $3c, $4983 ; squeak - dbw $3c, $4986 ; strength - dbw $3c, $4989 ; boat - dbw $3c, $498f ; wall open - dbw $3c, $4992 ; place puzzle piece down - dbw $3c, $4995 ; enter door - dbw $3c, $4998 ; switch pokemon - dbw $3c, $499e ; score tally? ; sounds like something out of game corner - dbw $3c, $49a4 ; buy/sell - dbw $3c, $49ad ; exit building - dbw $3c, $49aa ; bump - dbw $3c, $49b0 ; save - dbw $3c, $49f8 ; pokeflute - dbw $3c, $49fb ; elevator end - dbw $3c, $49fe ; throw ball - dbw $3c, $4a04 ; smokescreen - dbw $3c, $4a0a ; ; something skidding on water? - dbw $3c, $4a10 ; run - dbw $3c, $4a13 ; slot machine start - dbw $3c, $4dbe ; fanfare - dbw $3c, $4a3d ; peck - dbw $3c, $4a40 ; kinesis - dbw $3c, $4a43 ; lick - dbw $3c, $4a46 ; pound - dbw $3c, $4a49 ; move puzzle piece - dbw $3c, $4a4c ; comet punch - dbw $3c, $4a4f ; mega punch - dbw $3c, $4a52 ; scratch - dbw $3c, $4a55 ; vicegrip - dbw $3c, $4a58 ; razor wind - dbw $3c, $4a5b ; cut - dbw $3c, $4a5e ; wing attack - dbw $3c, $4a61 ; whirlwind - dbw $3c, $4a64 ; bind - dbw $3c, $4a67 ; vine whip - dbw $3c, $4a6a ; double kick - dbw $3c, $4a6d ; mega kick - dbw $3c, $4a70 ; headbutt - dbw $3c, $4a73 ; horn attack - dbw $3c, $4a76 ; tackle - dbw $3c, $4a79 ; poison sting - dbw $3c, $4a7c ; poisonpowder - dbw $3c, $4a7f ; doubleslap - dbw $3c, $4a82 ; bite - dbw $3c, $4a88 ; jump kick - dbw $3c, $4a8b ; stomp - dbw $3c, $4a8e ; tail whip - dbw $3c, $4a91 ; karate chop - dbw $3c, $4a94 ; submission - dbw $3c, $4a97 ; water gun - dbw $3c, $4a9d ; swords dance - dbw $3c, $4aa0 ; thunder - dbw $3c, $4aa3 ; supersonic - dbw $3c, $4aac ; leer - dbw $3c, $4ab5 ; ember - dbw $3c, $4abb ; bubblebeam - dbw $3c, $4ac4 ; hydro pump - dbw $3c, $4aca ; surf - dbw $3c, $4ad3 ; psybeam - dbw $3c, $4adc ; leech seed - dbw $3c, $4ae5 ; thundershock - dbw $3c, $4aee ; psychic - dbw $3c, $4af7 ; screech - dbw $3c, $4afd ; bone club - dbw $3c, $4b03 ; sharpen - dbw $3c, $4b09 ; egg bomb - dbw $3c, $4b12 ; sing - dbw $3c, $4b18 ; sky attack - dbw $3c, $4b21 ; hyper beam - dbw $3c, $4b24 ; shine - dbw $3c, $4a1c ; - dbw $3c, $4a1f ; $60 - dbw $3c, $4a22 ; tap - dbw $3c, $4a25 ; tap - dbw $3c, $4a28 ; burn ; that is not a burn - dbw $3c, $4a2b ; title screen sound - dbw $3c, $4a2e ; similar to $60 - dbw $3c, $4a31 ; get coin from slots - dbw $3c, $4a34 ; pay day - dbw $3c, $4a3a ; metronome - dbw $3c, $4a19 ; call - dbw $3c, $4b2d ; hang up - dbw $3c, $4b30 ; no signal - dbw $3c, $4b2a ; sandstorm - dbw $3c, $4b33 ; elevator - dbw $3c, $52b4 ; protect - dbw $3c, $52f6 ; sketch - dbw $3c, $5314 ; rain dance - dbw $3c, $5334 ; aeroblast - dbw $3c, $5352 ; spark - dbw $3c, $5360 ; curse - dbw $3c, $537d ; rage - dbw $3c, $539c ; thief - dbw $3c, $53b0 ; thief - dbw $3c, $53ca ; spider web - dbw $3c, $53f7 ; mind reader - dbw $3c, $541d ; nighmare - dbw $3c, $5453 ; snore - dbw $3c, $5469 ; sweet kiss - dbw $3c, $547f ; sweet kiss - dbw $3c, $54a5 ; belly drum - dbw $3c, $54ba ; - dbw $3c, $54d0 ; sludge bomb - dbw $3c, $54f5 ; foresight - dbw $3c, $5515 ; spite - dbw $3c, $553a ; outrage - dbw $3c, $554d ; perish song - dbw $3c, $5570 ; giga drain - dbw $3c, $55b4 ; attract - dbw $3c, $55cc ; kinesis - dbw $3c, $55de ; zap cannon - dbw $3c, $55ef ; mean look - dbw $3c, $5621 ; heal bell - dbw $3c, $5637 ; return - dbw $3c, $5653 ; exp bar - dbw $3c, $567f ; milk drink - dbw $3c, $569f ; present - dbw $3c, $56b9 ; morning sun - dbw $3c, $4b3f ; level up - dbw $3c, $4b86 ; key item - dbw $3c, $4d56 ; fanfare - dbw $3c, $4dc7 ; register phone # - dbw $3c, $4e26 ; 3rd place - dbw $3c, $4e66 ; get egg from daycare man - dbw $3c, $4e66 ; get egg from daycare lady - dbw $3c, $4edc ; move deleted - dbw $3c, $4f5e ; 2nd place - dbw $3c, $4fe2 ; 1st place - dbw $3c, $5069 ; choose a card - dbw $3c, $5104 ; get tm - dbw $3c, $517d ; get badge - dbw $3c, $5236 ; quit slots - dbw $3c, $5775 ; nothing - dbw $3c, $5878 ; dex fanfare <20 - dbw $3c, $58d2 ; dex fanfare 140-169 - dbw $3c, $5951 ; dex fanfare 170-199 - dbw $3c, $59d6 ; dex fanfare 200-229 - dbw $3c, $5a66 ; dex fanfare >=230 - dbw $3c, $5784 ; evolved - dbw $3c, $579b ; master ball - dbw $3c, $57c0 ; egg crack - dbw $3c, $57d9 ; charizard fireball (gs intro) - dbw $3c, $57ff ; pokemon appears (gs intro) - dbw $3c, $5818 ; flash - dbw $3c, $5846 ; game freak logo - dbw $3c, $5b33 ; not very effective - dbw $3c, $5b40 ; damage - dbw $3c, $5b50 ; super effective - dbw $3c, $5b63 ; ball bounce - dbw $3c, $56df ; moonlight - dbw $3c, $56fd ; encore - dbw $3c, $5721 ; beat up - dbw $3c, $574c ; batom pass - dbw $3c, $4944 ; ball wiggle - dbw $3c, $5734 ; sweet scent - dbw $3c, $5bb3 ; sweet scent - dbw $3c, $5bec ; hit end of exp bar - dbw $3c, $5c10 ; give trademon - dbw $3c, $5c3e ; get trademon - dbw $3c, $5c6c ; train arrived - dbw $3c, $675b ; stop slot - dbw $3c, $5cb4 ; 2 boops - dbw $3c, $6769 ; glass ting - dbw $3c, $6773 ; 2 glass ting + dbw $3c, $4b3f ; Dex Fanfare 50-79 + dbw $3c, $4c2f ; Item + dbw $3c, $4c89 ; Caught Mon + dbw $3c, $4941 ; Pokeballs Placed On Table + dbw $3c, $4947 ; Potion + dbw $3c, $494a ; Full Heal + dbw $3c, $494d ; Menu + dbw $3c, $4950 ; Read Text + dbw $3c, $4950 ; Read Text 2 + dbw $3c, $4bd5 ; Dex Fanfare 20-49 + dbw $3c, $4cea ; Dex Fanfare 80-109 + dbw $3c, $4953 ; Poison + dbw $3c, $4956 ; Got Safari Balls + dbw $3c, $4959 ; Boot Pc + dbw $3c, $495c ; Shut Down Pc + dbw $3c, $495f ; Choose Pc Option + dbw $3c, $4962 ; Escape Rope + dbw $3c, $4965 ; Push Button + dbw $3c, $4968 ; Second Part Of Itemfinder + dbw $3c, $496b ; Warp To + dbw $3c, $496e ; Warp From + dbw $3c, $4971 ; Change Dex Mode + dbw $3c, $4974 ; Jump Over Ledge + dbw $3c, $4977 ; Grass Rustle + dbw $3c, $497a ; Fly + dbw $3c, $497d ; Wrong + dbw $3c, $4983 ; Squeak + dbw $3c, $4986 ; Strength + dbw $3c, $4989 ; Boat + dbw $3c, $498f ; Wall Open + dbw $3c, $4992 ; Place Puzzle Piece Down + dbw $3c, $4995 ; Enter Door + dbw $3c, $4998 ; Switch Pokemon + dbw $3c, $499e ; Tally + dbw $3c, $49a4 ; Transaction + dbw $3c, $49ad ; Exit Building + dbw $3c, $49aa ; Bump + dbw $3c, $49b0 ; Save + dbw $3c, $49f8 ; Pokeflute + dbw $3c, $49fb ; Elevator End + dbw $3c, $49fe ; Throw Ball + dbw $3c, $4a04 ; Ball Poof + dbw $3c, $4a0a ; Unknown 3A + dbw $3c, $4a10 ; Run + dbw $3c, $4a13 ; Slot Machine Start + dbw $3c, $4dbe ; Fanfare + dbw $3c, $4a3d ; Peck + dbw $3c, $4a40 ; Kinesis + dbw $3c, $4a43 ; Lick + dbw $3c, $4a46 ; Pound + dbw $3c, $4a49 ; Move Puzzle Piece + dbw $3c, $4a4c ; Comet Punch + dbw $3c, $4a4f ; Mega Punch + dbw $3c, $4a52 ; Scratch + dbw $3c, $4a55 ; Vicegrip + dbw $3c, $4a58 ; Razor Wind + dbw $3c, $4a5b ; Cut + dbw $3c, $4a5e ; Wing Attack + dbw $3c, $4a61 ; Whirlwind + dbw $3c, $4a64 ; Bind + dbw $3c, $4a67 ; Vine Whip + dbw $3c, $4a6a ; Double Kick + dbw $3c, $4a6d ; Mega Kick + dbw $3c, $4a70 ; Headbutt + dbw $3c, $4a73 ; Horn Attack + dbw $3c, $4a76 ; Tackle + dbw $3c, $4a79 ; Poison Sting + dbw $3c, $4a7c ; Powder + dbw $3c, $4a7f ; Doubleslap + dbw $3c, $4a82 ; Bite + dbw $3c, $4a88 ; Jump Kick + dbw $3c, $4a8b ; Stomp + dbw $3c, $4a8e ; Tail Whip + dbw $3c, $4a91 ; Karate Chop + dbw $3c, $4a94 ; Submission + dbw $3c, $4a97 ; Water Gun + dbw $3c, $4a9d ; Swords Dance + dbw $3c, $4aa0 ; Thunder + dbw $3c, $4aa3 ; Supersonic + dbw $3c, $4aac ; Leer + dbw $3c, $4ab5 ; Ember + dbw $3c, $4abb ; Bubblebeam + dbw $3c, $4ac4 ; Hydro Pump + dbw $3c, $4aca ; Surf + dbw $3c, $4ad3 ; Psybeam + dbw $3c, $4adc ; Charge + dbw $3c, $4ae5 ; Thundershock + dbw $3c, $4aee ; Psychic + dbw $3c, $4af7 ; Screech + dbw $3c, $4afd ; Bone Club + dbw $3c, $4b03 ; Sharpen + dbw $3c, $4b09 ; Egg Bomb + dbw $3c, $4b12 ; Sing + dbw $3c, $4b18 ; Hyper Beam + dbw $3c, $4b21 ; Shine + dbw $3c, $4b24 ; Unknown 5F + dbw $3c, $4a1c ; Unknown 60 + dbw $3c, $4a1f ; Unknown 61 + dbw $3c, $4a22 ; Unknown 62 + dbw $3c, $4a25 ; Unknown 63 + dbw $3c, $4a28 ; Burn + dbw $3c, $4a2b ; Title Screen Entrance + dbw $3c, $4a2e ; Unknown 66 + dbw $3c, $4a31 ; Get Coin From Slots + dbw $3c, $4a34 ; Pay Day + dbw $3c, $4a3a ; Metronome + dbw $3c, $4a19 ; Call + dbw $3c, $4b2d ; Hang Up + dbw $3c, $4b30 ; No Signal + dbw $3c, $4b2a ; Sandstorm + dbw $3c, $4b33 ; Elevator + dbw $3c, $52b4 ; Protect + dbw $3c, $52f6 ; Sketch + dbw $3c, $5314 ; Rain Dance + dbw $3c, $5334 ; Aeroblast + dbw $3c, $5352 ; Spark + dbw $3c, $5360 ; Curse + dbw $3c, $537d ; Rage + dbw $3c, $539c ; Thief + dbw $3c, $53b0 ; Thief 2 + dbw $3c, $53ca ; Spider Web + dbw $3c, $53f7 ; Mind Reader + dbw $3c, $541d ; Nightmare + dbw $3c, $5453 ; Snore + dbw $3c, $5469 ; Sweet Kiss + dbw $3c, $547f ; Sweet Kiss 2 + dbw $3c, $54a5 ; Belly Drum + dbw $3c, $54ba ; Unknown 7F + dbw $3c, $54d0 ; Sludge Bomb + dbw $3c, $54f5 ; Foresight + dbw $3c, $5515 ; Spite + dbw $3c, $553a ; Outrage + dbw $3c, $554d ; Perish Song + dbw $3c, $5570 ; Giga Drain + dbw $3c, $55b4 ; Attract + dbw $3c, $55cc ; Kinesis 2 + dbw $3c, $55de ; Zap Cannon + dbw $3c, $55ef ; Mean Look + dbw $3c, $5621 ; Heal Bell + dbw $3c, $5637 ; Return + dbw $3c, $5653 ; Exp Bar + dbw $3c, $567f ; Milk Drink + dbw $3c, $569f ; Present + dbw $3c, $56b9 ; Morning Sun + dbw $3c, $4b3f ; Level Up + dbw $3c, $4b86 ; Key Item + dbw $3c, $4d56 ; Fanfare 2 + dbw $3c, $4dc7 ; Register Phone # + dbw $3c, $4e26 ; 3Rd Place + dbw $3c, $4e66 ; Get Egg From Daycare Man + dbw $3c, $4e66 ; Get Egg From Daycare Lady + dbw $3c, $4edc ; Move Deleted + dbw $3c, $4f5e ; 2Nd Place + dbw $3c, $4fe2 ; 1St Place + dbw $3c, $5069 ; Choose A Card + dbw $3c, $5104 ; Get Tm + dbw $3c, $517d ; Get Badge + dbw $3c, $5236 ; Quit Slots + dbw $3c, $5775 ; Egg Crack + dbw $3c, $5878 ; Dex Fanfare < 20 + dbw $3c, $58d2 ; Dex Fanfare 140-169 + dbw $3c, $5951 ; Dex Fanfare 170-199 + dbw $3c, $59d6 ; Dex Fanfare 200-229 + dbw $3c, $5a66 ; Dex Fanfare 230 + + dbw $3c, $5784 ; Evolved + dbw $3c, $579b ; Master Ball + dbw $3c, $57c0 ; Egg Hatch + dbw $3c, $57d9 ; Gs Intro Charizard Fireball + dbw $3c, $57ff ; Gs Intro Pokemon Appears + dbw $3c, $5818 ; Flash + dbw $3c, $5846 ; Game Freak Logo Gs + dbw $3c, $5b33 ; Not Very Effective + dbw $3c, $5b40 ; Damage + dbw $3c, $5b50 ; Super Effective + dbw $3c, $5b63 ; Ball Bounce + dbw $3c, $56df ; Moonlight + dbw $3c, $56fd ; Encore + dbw $3c, $5721 ; Beat Up + dbw $3c, $574c ; Baton Pass + dbw $3c, $4944 ; Ball Wiggle + dbw $3c, $5734 ; Sweet Scent + dbw $3c, $5bb3 ; Sweet Scent 2 + dbw $3c, $5bec ; Hit End Of Exp Bar + dbw $3c, $5c10 ; Give Trademon + dbw $3c, $5c3e ; Get Trademon + dbw $3c, $5c6c ; Train Arrived + dbw $3c, $675b ; Stop Slot + dbw $3c, $5cb4 ; 2 Boops + dbw $3c, $6769 ; Glass Ting + dbw $3c, $6773 ; Glass Ting 2 ; Crystal adds the following SFX: - dbw $5e, $582d ; intro unown 1 - dbw $5e, $583e ; intro unown 2 - dbw $5e, $584f ; intro unown 3 - dbw $5e, $586e ; boop - dbw $5e, $5888 ; game freak ditto transform - dbw $5e, $58a0 ; intro suicune 1 - dbw $5e, $58aa ; intro pichu - dbw $5e, $58c0 ; intro suicune 2 - dbw $5e, $58f4 ; intro suicune 3 - dbw $5e, $5907 ; game freak ditto bounce - dbw $5e, $591d ; intro suicune 4 - dbw $5e, $5942 ; game freak presents - dbw $5e, $5961 ; tingle - dbw $3c, $5cd0 ; sand? - dbw $5e, $597c ; two pc beeps - dbw $5e, $5992 ; 4 note ditty - dbw $5e, $59cb ; twinkle + dbw $5e, $582d ; Intro Unown 1 + dbw $5e, $583e ; Intro Unown 2 + dbw $5e, $584f ; Intro Unown 3 + dbw $5e, $586e ; Ditto Pop Up + dbw $5e, $5888 ; Ditto Transform + dbw $5e, $58a0 ; Intro Suicune 1 + dbw $5e, $58aa ; Intro Pichu + dbw $5e, $58c0 ; Intro Suicune 2 + dbw $5e, $58f4 ; Intro Suicune 3 + dbw $5e, $5907 ; Ditto Bounce + dbw $5e, $591d ; Intro Suicune 4 + dbw $5e, $5942 ; Game Freak Presents + dbw $5e, $5961 ; Tingle + dbw $3c, $5cd0 ; Unknown Cb + dbw $5e, $597c ; Two Pc Beeps + dbw $5e, $5992 ; 4 Note Ditty + dbw $5e, $59cb ; Twinkle ; e94e9 + diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm new file mode 100644 index 000000000..b48e04bc6 --- /dev/null +++ b/battle/ai/scoring.asm @@ -0,0 +1,3362 @@ +AIScoring_RedStatus: ; 38591 +; Don't use status-only moves if the player can't be statused. + + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.checkmove + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call AIGetEnemyMove + + ld a, [EnemyMoveEffect] + ld c, a + + push hl + push de + push bc + ld a, $b + ld hl, $441a + rst FarCall + pop bc + pop de + pop hl + jr nz, .discourage + + ld a, [EnemyMoveEffect] + push hl + push de + push bc + ld hl, .statusonlyeffects + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr nc, .checkmove + + ld a, [BattleMonStatus] + and a + jr nz, .discourage + + ld a, [PlayerScreens] + bit SCREENS_SAFEGUARD, a + jr z, .checkmove + +.discourage + call AIDiscourageMove + jr .checkmove +; 385db + +.statusonlyeffects + db EFFECT_SLEEP + db EFFECT_TOXIC + db EFFECT_POISON + db EFFECT_PARALYZE + db $ff +; 385e0 + + + +AIScoring_RedStatMods: ; 385e0 +; Use stat-modifying moves on turn 1. + + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.checkmove + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call AIGetEnemyMove + + ld a, [EnemyMoveEffect] + + cp EFFECT_ATTACK_UP + jr c, .checkmove + cp EFFECT_EVASION_UP + 1 + jr c, .statup + +; cp EFFECT_ATTACK_DOWN - 1 + jr z, .checkmove + cp EFFECT_EVASION_DOWN + 1 + jr c, .statdown + + cp EFFECT_ATTACK_UP_2 + jr c, .checkmove + cp EFFECT_EVASION_UP_2 + 1 + jr c, .statup + +; cp EFFECT_ATTACK_DOWN_2 - 1 + jr z, .checkmove + cp EFFECT_EVASION_DOWN_2 + 1 + jr c, .statdown + + jr .checkmove + +.statup + ld a, [EnemyTurnsTaken] + and a + jr nz, .discourage + + jr .encourage + +.statdown + ld a, [PlayerTurnsTaken] + and a + jr nz, .discourage + +.encourage + call Function_0x39527 + jr c, .checkmove + + dec [hl] + dec [hl] + jr .checkmove + +.discourage + call RNG + cp 30 + jr c, .checkmove + inc [hl] + inc [hl] + jr .checkmove +; 38635 + + + +AIScoring_RedSuperEffective: ; 38635 +; Use super-effective moves. + + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.checkmove + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call AIGetEnemyMove + + push hl + push bc + push de + ld a, 1 + ld [hBattleTurn], a + callab Function0x347c8 + pop de + pop bc + pop hl + + ld a, [$d265] + and a + jr z, .immune + cp 10 ; 1.0 + jr z, .checkmove + jr c, .noteffective + +; effective + ld a, [EnemyMovePower] + and a + jr z, .checkmove + dec [hl] + jr .checkmove + +.noteffective +; Discourage this move if there are any moves +; that do damage of a different type. + push hl + push de + push bc + ld a, [EnemyMoveType] + ld d, a + ld hl, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld c, 0 +.checkmove2 + dec b + jr z, .asm_38693 + + ld a, [hli] + and a + jr z, .asm_38693 + + call AIGetEnemyMove + ld a, [EnemyMoveType] + cp d + jr z, .checkmove2 + ld a, [EnemyMovePower] + and a + jr nz, .asm_38692 + jr .checkmove2 + +.asm_38692 + ld c, a +.asm_38693 + ld a, c + pop bc + pop de + pop hl + and a + jr z, .checkmove + inc [hl] + jr .checkmove + +.immune + call AIDiscourageMove + jr .checkmove +; 386a2 + + + +AIScoring_Offensive: ; 386a2 +; Discourage non-damaging moves. + + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.checkmove + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call AIGetEnemyMove + + ld a, [EnemyMovePower] + and a + jr nz, .checkmove + + inc [hl] + inc [hl] + jr .checkmove +; 386be + + + +AIScoring_Smart: ; 386be +; Context-specific scoring. + + ld hl, Buffer1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.checkmove + dec b + ret z + + ld a, [de] + inc de + and a + ret z + + push de + push bc + push hl + call AIGetEnemyMove + + ld a, [EnemyMoveEffect] + ld hl, .table_386f2 + ld de, 3 + call IsInArray + + inc hl + jr nc, .nextmove + + ld a, [hli] + ld e, a + ld d, [hl] + + pop hl + push hl + + ld bc, .nextmove + push bc + + push de + ret + +.nextmove + pop hl + pop bc + pop de + inc hl + jr .checkmove + +.table_386f2 + dbw EFFECT_SLEEP, AIScoring_Sleep + dbw EFFECT_LEECH_HIT, AIScoring_LeechHit + dbw EFFECT_EXPLOSION, AIScoring_Explosion + dbw EFFECT_DREAM_EATER, AIScoring_DreamEater + dbw EFFECT_MIRROR_MOVE, AIScoring_MirrorMove + dbw EFFECT_EVASION_UP, AIScoring_EvasionUp + dbw EFFECT_ALWAYS_HIT, AIScoring_AlwaysHit + dbw EFFECT_ACCURACY_DOWN, AIScoring_AccuracyDown + dbw EFFECT_HAZE, AIScoring_Haze + dbw EFFECT_BIDE, AIScoring_Bide + dbw EFFECT_WHIRLWIND, AIScoring_Whirlwind + dbw EFFECT_HEAL, AIScoring_Heal + dbw EFFECT_TOXIC, AIScoring_Toxic + dbw EFFECT_LIGHT_SCREEN, AIScoring_LightScreen + dbw EFFECT_OHKO, AIScoring_Ohko + dbw EFFECT_RAZOR_WIND, AIScoring_RazorWind + dbw EFFECT_SUPER_FANG, AIScoring_SuperFang + dbw EFFECT_BIND, AIScoring_Bind + dbw EFFECT_UNUSED_2B, AIScoring_Unused2B + dbw EFFECT_CONFUSE, AIScoring_Confuse + dbw EFFECT_SP_DEFENSE_UP_2, AIScoring_SpDefenseUp2 + dbw EFFECT_REFLECT, AIScoring_Reflect + dbw EFFECT_PARALYZE, AIScoring_Paralyze + dbw EFFECT_SPEED_DOWN_HIT, AIScoring_SpeedDownHit + dbw EFFECT_SUBSTITUTE, AIScoring_Substitute + dbw EFFECT_HYPER_BEAM, AIScoring_HyperBeam + dbw EFFECT_RAGE, AIScoring_Rage + dbw EFFECT_MIMIC, AIScoring_Mimic + dbw EFFECT_LEECH_SEED, AIScoring_LeechSeed + dbw EFFECT_DISABLE, AIScoring_Disable + dbw EFFECT_COUNTER, AIScoring_Counter + dbw EFFECT_ENCORE, AIScoring_Encore + dbw EFFECT_PAIN_SPLIT, AIScoring_PainSplit + dbw EFFECT_SNORE, AIScoring_Snore + dbw EFFECT_CONVERSION2, AIScoring_Conversion2 + dbw EFFECT_LOCK_ON, AIScoring_LockOn + dbw EFFECT_DEFROST_OPPONENT, AIScoring_DefrostOpponent + dbw EFFECT_SLEEP_TALK, AIScoring_SleepTalk + dbw EFFECT_DESTINY_BOND, AIScoring_DestinyBond + dbw EFFECT_REVERSAL, AIScoring_Reversal + dbw EFFECT_SPITE, AIScoring_Spite + dbw EFFECT_HEAL_BELL, AIScoring_HealBell + dbw EFFECT_PRIORITY_HIT, AIScoring_PriorityHit + dbw EFFECT_THIEF, AIScoring_Thief + dbw EFFECT_MEAN_LOOK, AIScoring_MeanLook + dbw EFFECT_NIGHTMARE, AIScoring_Nightmare + dbw EFFECT_FLAME_WHEEL, AIScoring_FlameWheel + dbw EFFECT_CURSE, AIScoring_Curse + dbw EFFECT_PROTECT, AIScoring_Protect + dbw EFFECT_FORESIGHT, AIScoring_Foresight + dbw EFFECT_PERISH_SONG, AIScoring_PerishSong + dbw EFFECT_SANDSTORM, AIScoring_Sandstorm + dbw EFFECT_ENDURE, AIScoring_Endure + dbw EFFECT_ROLLOUT, AIScoring_Rollout + dbw EFFECT_SWAGGER, AIScoring_Swagger + dbw EFFECT_FURY_CUTTER, AIScoring_FuryCutter + dbw EFFECT_ATTRACT, AIScoring_Attract + dbw EFFECT_SAFEGUARD, AIScoring_Safeguard + dbw EFFECT_MAGNITUDE, AIScoring_Magnitude + dbw EFFECT_BATON_PASS, AIScoring_BatonPass + dbw EFFECT_PURSUIT, AIScoring_Pursuit + dbw EFFECT_RAPID_SPIN, AIScoring_RapidSpin + dbw EFFECT_MORNING_SUN, AIScoring_MorningSun + dbw EFFECT_SYNTHESIS, AIScoring_Synthesis + dbw EFFECT_MOONLIGHT, AIScoring_Moonlight + dbw EFFECT_HIDDEN_POWER, AIScoring_HiddenPower + dbw EFFECT_RAIN_DANCE, AIScoring_RainDance + dbw EFFECT_SUNNY_DAY, AIScoring_SunnyDay + dbw EFFECT_BELLY_DRUM, AIScoring_BellyDrum + dbw EFFECT_PSYCH_UP, AIScoring_PsychUp + dbw EFFECT_MIRROR_COAT, AIScoring_MirrorCoat + dbw EFFECT_SKULL_BASH, AIScoring_SkullBash + dbw EFFECT_TWISTER, AIScoring_Twister + dbw EFFECT_EARTHQUAKE, AIScoring_Earthquake + dbw EFFECT_FUTURE_SIGHT, AIScoring_FutureSight + dbw EFFECT_GUST, AIScoring_Gust + dbw EFFECT_STOMP, AIScoring_Stomp + dbw EFFECT_SOLARBEAM, AIScoring_Solarbeam + dbw EFFECT_THUNDER, AIScoring_Thunder + dbw EFFECT_FLY, AIScoring_Fly + db $ff +; 387e3 + + +AIScoring_Sleep: ; 387e3 + ld b, EFFECT_DREAM_EATER + call AIHasMove + jr c, .asm_387f0 + + ld b, EFFECT_NIGHTMARE + call AIHasMove + ret nc + +.asm_387f0 + call Function_0x39527 + ret c + dec [hl] + dec [hl] + ret +; 387f7 + + +AIScoring_LeechHit: ; 387f7 + push hl + ld a, 1 + ld [hBattleTurn], a + callab Function0x347c8 + pop hl + + ld a, [$d265] + cp 10 ; 1.0 + jr c, .asm_38815 + + ret z + call AICheckEnemyMaxHP + + ret c + call Function_0x39521 + + ret c + dec [hl] + ret + +.asm_38815 + call RNG + + cp $64 + ret c + inc [hl] + ret +; 3881d + + +AIScoring_LockOn: ; 3881d + ld a, [PlayerSubStatus5] + bit 5, a + jr nz, .asm_38882 + + push hl + call AICheckEnemyQuarterHP + + jr nc, .asm_38877 + + call AICheckEnemyHalfHP + + jr c, .asm_38834 + + call AICompareSpeed + + jr nc, .asm_38877 + + +.asm_38834 + ld a, [PlayerEvaLevel] + cp $a + jr nc, .asm_3887a + + cp $8 + jr nc, .asm_38875 + + ld a, [EnemyAccLevel] + cp $5 + jr c, .asm_3887a + + cp $7 + jr c, .asm_38875 + + ld hl, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 + +.asm_3884f + dec c + jr z, .asm_38877 + + ld a, [hli] + and a + jr z, .asm_38877 + + call AIGetEnemyMove + + ld a, [EnemyMoveAccuracy] + cp $b4 + jr nc, .asm_3884f + + ld a, $1 + ld [hBattleTurn], a + push hl + push bc + ld a, $d + ld hl, $47c8 + rst FarCall + + ld a, [$d265] + cp $a + pop bc + pop hl + jr c, .asm_3884f + + +.asm_38875 + pop hl + ret + +.asm_38877 + pop hl + inc [hl] + ret + +.asm_3887a + pop hl + call Function_0x39527 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38882 + push hl + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 + +.asm_3888b + inc hl + dec c + jr z, .asm_388a2 + + ld a, [de] + and a + jr z, .asm_388a2 + + inc de + call AIGetEnemyMove + + ld a, [EnemyMoveAccuracy] + cp $b4 + jr nc, .asm_3888b + + dec [hl] + dec [hl] + jr .asm_3888b + + +.asm_388a2 + pop hl + jp AIDiscourageMove + +; 388a6 + + +AIScoring_Explosion: ; 388a6 + push hl + callba Function0x349f4 + pop hl + jr nc, .asm_388b7 + + push hl + call AICheckLastPlayerMon + pop hl + jr nz, .asm_388c6 + +.asm_388b7 + call AICheckEnemyHalfHP + jr c, .asm_388c6 + + call AICheckEnemyQuarterHP + ret nc + + call RNG + cp 20 + ret c + +.asm_388c6 + inc [hl] + inc [hl] + inc [hl] + ret +; 388ca + + +AIScoring_DreamEater: ; 388ca + call RNG + + cp $19 + ret c + dec [hl] + dec [hl] + dec [hl] + ret +; 388d4 + + +AIScoring_EvasionUp: ; 388d4 + ld a, [EnemyEvaLevel] + cp $d + jp nc, AIDiscourageMove + + call AICheckEnemyMaxHP + + jr nc, .asm_388f2 + + ld a, [PlayerSubStatus5] + bit 0, a + jr nz, .asm_388ef + + call RNG + + cp $b2 + jr nc, .asm_38911 + + +.asm_388ef + dec [hl] + dec [hl] + ret + +.asm_388f2 + call AICheckEnemyQuarterHP + + jr nc, .asm_3890f + + call RNG + + cp $a + jr c, .asm_388ef + + call AICheckEnemyHalfHP + + jr nc, .asm_3890a + + call Function_0x39521 + + jr c, .asm_388ef + + jr .asm_38911 + + +.asm_3890a + call Function_0x39527 + + jr c, .asm_38911 + + +.asm_3890f + inc [hl] + inc [hl] + +.asm_38911 + ld a, [PlayerSubStatus5] + bit 0, a + jr nz, .asm_38938 + + ld a, [PlayerSubStatus4] + bit 7, a + jr nz, .asm_38941 + + ld a, [EnemyEvaLevel] + ld b, a + ld a, [PlayerAccLevel] + cp b + jr c, .asm_38936 + + ld a, [PlayerFuryCutterCount] + and a + jr nz, .asm_388ef + + ld a, [PlayerSubStatus1] + bit 6, a + jr nz, .asm_388ef + + +.asm_38936 + inc [hl] + ret + +.asm_38938 + call RNG + cp $50 + ret c + dec [hl] + dec [hl] + ret + +.asm_38941 + call Function_0x39527 + + ret c + dec [hl] + ret +; 38947 + + +AIScoring_AlwaysHit: ; 38947 + ld a, [EnemyAccLevel] + cp $5 + jr c, .asm_38954 + + ld a, [PlayerEvaLevel] + cp $a + ret c + +.asm_38954 + call Function_0x39521 + + ret c + dec [hl] + dec [hl] + ret +; 3895b + + +AIScoring_MirrorMove: ; 3895b + ld a, [LastEnemyCounterMove] + and a + jr nz, .asm_38968 + + call AICompareSpeed + + ret nc + jp AIDiscourageMove + + +.asm_38968 + push hl + ld hl, Table_0x39301 + ld de, 1 + call IsInArray + + pop hl + ret nc + call Function_0x39527 + + ret c + dec [hl] + call AICompareSpeed + + ret nc + call RNG + + cp $19 + ret c + dec [hl] + ret +; 38985 + + +AIScoring_AccuracyDown: ; 38985 + call AICheckPlayerMaxHP + + jr nc, .asm_389a0 + + call AICheckEnemyHalfHP + + jr nc, .asm_389a0 + + ld a, [PlayerSubStatus5] + bit 0, a + jr nz, .asm_3899d + + call RNG + + cp $b2 + jr nc, .asm_389bf + + +.asm_3899d + dec [hl] + dec [hl] + ret + +.asm_389a0 + call AICheckPlayerQuarterHP + + jr nc, .asm_389bd + + call RNG + + cp $a + jr c, .asm_3899d + + call AICheckPlayerHalfHP + + jr nc, .asm_389b8 + + call Function_0x39521 + + jr c, .asm_3899d + + jr .asm_389bf + + +.asm_389b8 + call Function_0x39527 + + jr c, .asm_389bf + + +.asm_389bd + inc [hl] + inc [hl] + +.asm_389bf + ld a, [PlayerSubStatus5] + bit 0, a + jr nz, .asm_389e6 + + ld a, [PlayerSubStatus4] + bit 7, a + jr nz, .asm_389ef + + ld a, [EnemyEvaLevel] + ld b, a + ld a, [PlayerAccLevel] + cp b + jr c, .asm_389e4 + + ld a, [PlayerFuryCutterCount] + and a + jr nz, .asm_3899d + + ld a, [PlayerSubStatus1] + bit 6, a + jr nz, .asm_3899d + + +.asm_389e4 + inc [hl] + ret + +.asm_389e6 + call RNG + cp $50 + ret c + dec [hl] + dec [hl] + ret + +.asm_389ef + call Function_0x39527 + + ret c + dec [hl] + ret +; 389f5 + + +AIScoring_Haze: ; 389f5 + push hl + ld hl, EnemyAtkLevel + ld c, $8 +.asm_389fb + dec c + jr z, .asm_38a05 + ld a, [hli] + cp $5 + jr c, .asm_38a12 + jr .asm_389fb + + +.asm_38a05 + ld hl, PlayerAtkLevel + ld c, $8 +.asm_38a0a + dec c + jr z, .asm_38a1b + ld a, [hli] + cp $a + jr c, .asm_38a0a + +.asm_38a12 + pop hl + call RNG + cp $28 + ret c + dec [hl] + ret + +.asm_38a1b + pop hl + inc [hl] + ret +; 38a1e + + +AIScoring_Bide: ; 38a1e + call AICheckEnemyMaxHP + ret c + call RNG + cp $19 + ret c + inc [hl] + ret +; 38a2a + + +AIScoring_Whirlwind: ; 38a2a + push hl + callab Function0x3484e + ld a, [$c716] + cp $a + pop hl + ret c + inc [hl] + ret +; 38a3a + + +AIScoring_Heal: +AIScoring_MorningSun: +AIScoring_Synthesis: +AIScoring_Moonlight: ; 38a3a + call AICheckEnemyQuarterHP + jr nc, .asm_38a45 + call AICheckEnemyHalfHP + ret nc + inc [hl] + ret + +.asm_38a45 + call RNG + cp $19 + ret c + dec [hl] + dec [hl] + ret +; 38a4e + + +AIScoring_Toxic: +AIScoring_LeechSeed: ; 38a4e + call AICheckPlayerHalfHP + ret c + inc [hl] + ret +; 38a54 + + +AIScoring_LightScreen: +AIScoring_Reflect: ; 38a54 + call AICheckEnemyMaxHP + ret c + call RNG + cp $14 + ret c + inc [hl] + ret +; 38a60 + + +AIScoring_Ohko: ; 38a60 + ld a, [BattleMonLevel] + ld b, a + ld a, [EnemyMonLevel] + cp b + jp c, AIDiscourageMove + call AICheckPlayerHalfHP + ret c + inc [hl] + ret +; 38a71 + + +AIScoring_Bind: ; 38a71 + ld a, [$c730] + and a + jr nz, .asm_38a8b + + ld a, [PlayerSubStatus5] + bit SUBSTATUS_TOXIC, a + jr nz, .asm_38a91 + + ld a, [PlayerSubStatus1] + and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ENCORED | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE + jr nz, .asm_38a91 + + ld a, [PlayerTurnsTaken] + and a + jr z, .asm_38a91 + +.asm_38a8b + call Function_0x39527 + ret c + inc [hl] + ret + +.asm_38a91 + call AICheckEnemyQuarterHP + ret nc + call Function_0x39527 + ret c + dec [hl] + dec [hl] + ret +; 38a9c + + +AIScoring_RazorWind: +AIScoring_Unused2B: ; 38a9c + ld a, [EnemySubStatus1] + bit SUBSTATUS_PERISH, a + jr z, .asm_38aaa + + ld a, [EnemyPerishCount] + cp 3 + jr c, .asm_38ad3 + +.asm_38aaa + push hl + ld hl, PlayerUsedMoves + ld c, 4 + +.asm_38ab0 + ld a, [hli] + and a + jr z, .asm_38ac1 + + call AIGetEnemyMove + + ld a, [EnemyMoveEffect] + cp EFFECT_PROTECT + jr z, .asm_38ad5 + dec c + jr nz, .asm_38ab0 + +.asm_38ac1 + pop hl + ld a, [EnemySubStatus3] + bit SUBSTATUS_CONFUSED, a + jr nz, .asm_38acd + + call AICheckEnemyHalfHP + ret c + +.asm_38acd + call RNG + cp $c8 + ret c + +.asm_38ad3 + inc [hl] + ret + +.asm_38ad5 + pop hl + ld a, [hl] + add 6 + ld [hl], a + ret +; 38adb + + +AIScoring_Confuse: ; 38adb + call AICheckPlayerHalfHP + ret c + call RNG + cp $19 + jr c, .asm_38ae7 + inc [hl] +.asm_38ae7 + call AICheckPlayerQuarterHP + ret c + inc [hl] + ret +; 38aed + + +AIScoring_SpDefenseUp2: ; 38aed + call AICheckEnemyHalfHP + jr nc, .asm_38b10 + + ld a, [EnemySDefLevel] + cp $b + jr nc, .asm_38b10 + cp $9 + ret nc + + ld a, [BattleMonType1] + cp FIRE + jr nc, .asm_38b09 + ld a, [BattleMonType2] + cp FIRE + ret c + +.asm_38b09 + call Function_0x39521 + ret c + dec [hl] + dec [hl] + ret + +.asm_38b10 + inc [hl] + ret +; 38b12 + + +AIScoring_Fly: ; 38b12 + ld a, [PlayerSubStatus3] + and 1<<SUBSTATUS_FLYING | 1<<SUBSTATUS_UNDERGROUND + ret z + call AICompareSpeed + ret nc + dec [hl] + dec [hl] + dec [hl] + ret +; 38b20 + + +AIScoring_SuperFang: ; 38b20 + call AICheckPlayerQuarterHP + ret c + inc [hl] + ret +; 38b26 + + +AIScoring_Paralyze: ; 38b26 + call AICheckPlayerQuarterHP + jr nc, .asm_38b3a + call AICompareSpeed + ret c + call AICheckEnemyQuarterHP + ret nc + call Function_0x39521 + ret c + dec [hl] + dec [hl] + ret + +.asm_38b3a + call Function_0x39527 + ret c + inc [hl] + ret +; 38b40 + + +AIScoring_SpeedDownHit: ; 38b40 + ld a, [EnemyMoveAnimation] + cp ICY_WIND + ret nz + call AICheckEnemyQuarterHP + ret nc + ld a, [PlayerTurnsTaken] + and a + ret nz + call AICompareSpeed + ret c + call RNG + cp 30 + ret c + dec [hl] + dec [hl] + ret +; 38b5c + + +AIScoring_Substitute: ; 38b5c + call AICheckEnemyHalfHP + ret c + jp AIDiscourageMove +; 38b63 + + +AIScoring_HyperBeam: ; 38b63 + call AICheckEnemyHalfHP + jr c, .asm_38b72 + call AICheckEnemyQuarterHP + ret c + call Function_0x39527 + ret c + dec [hl] + ret + +.asm_38b72 + call RNG + cp 40 + ret c + inc [hl] + call Function_0x39527 + ret c + inc [hl] + ret +; 38b7f + + +AIScoring_Rage: ; 38b7f + ld a, [EnemySubStatus4] + bit 6, a + jr z, .asm_38b9b + + call Function_0x39527 + jr c, .asm_38b8c + + dec [hl] + +.asm_38b8c + ld a, [$c72c] + cp $2 + ret c + dec [hl] + ld a, [$c72c] + cp $3 + ret c + dec [hl] + ret + +.asm_38b9b + call AICheckEnemyHalfHP + jr nc, .asm_38ba6 + + call Function_0x39521 + ret nc + dec [hl] + ret + +.asm_38ba6 + inc [hl] + ret +; 38ba8 + + +AIScoring_Mimic: ; 38ba8 + ld a, [LastEnemyCounterMove] + and a + jr z, .asm_38be9 + + call AICheckEnemyHalfHP + jr nc, .asm_38bef + + push hl + ld a, [LastEnemyCounterMove] + call AIGetEnemyMove + + ld a, $1 + ld [hBattleTurn], a + ld hl, $47c8 + ld a, $d + rst FarCall + + ld a, [$d265] + cp $a + pop hl + jr c, .asm_38bef + jr z, .asm_38bd4 + + call Function_0x39527 + jr c, .asm_38bd4 + + dec [hl] + +.asm_38bd4 + ld a, [LastEnemyCounterMove] + push hl + ld hl, Table_0x39301 + ld de, 1 + call IsInArray + + pop hl + ret nc + call Function_0x39527 + ret c + dec [hl] + ret + +.asm_38be9 + call AICompareSpeed + jp c, AIDiscourageMove + +.asm_38bef + inc [hl] + ret +; 38bf1 + + +AIScoring_Counter: ; 38bf1 + push hl + ld hl, PlayerUsedMoves + ld c, 4 + ld b, 0 + +.asm_38bf9 + ld a, [hli] + and a + jr z, .asm_38c0e + + call AIGetEnemyMove + + ld a, [EnemyMovePower] + and a + jr z, .asm_38c0e + + ld a, [EnemyMoveType] + cp $14 + jr nc, .asm_38c0e + + inc b + +.asm_38c0e + dec c + jr nz, .asm_38bf9 + + pop hl + ld a, b + and a + jr z, .asm_38c39 + + cp $3 + jr nc, .asm_38c30 + + ld a, [LastEnemyCounterMove] + and a + jr z, .asm_38c38 + + call AIGetEnemyMove + + ld a, [EnemyMovePower] + and a + jr z, .asm_38c38 + + ld a, [EnemyMoveType] + cp $14 + jr nc, .asm_38c38 + + +.asm_38c30 + call RNG + cp $64 + jr c, .asm_38c38 + + dec [hl] + +.asm_38c38 + ret + +.asm_38c39 + inc [hl] + ret +; 38c3b + + +AIScoring_Encore: ; 38c3b + call AICompareSpeed + jr nc, .asm_38c81 + + ld a, [LastPlayerMove] + and a + jp z, AIDiscourageMove + + call AIGetEnemyMove + + ld a, [EnemyMovePower] + and a + jr z, .asm_38c68 + + push hl + ld a, [EnemyMoveType] + ld hl, EnemyMonType1 + ld a, $41 + call Predef + + pop hl + ld a, [$d265] + cp $a + jr nc, .asm_38c68 + + and a + ret nz + jr .asm_38c78 + +.asm_38c68 + push hl + ld a, [LastEnemyCounterMove] + ld hl, .table_38c85 + ld de, 1 + call IsInArray + pop hl + jr nc, .asm_38c81 + +.asm_38c78 + call RNG + cp $46 + ret c + dec [hl] + dec [hl] + ret + +.asm_38c81 + inc [hl] + inc [hl] + inc [hl] + ret + +.table_38c85 + db SWORDS_DANCE + db WHIRLWIND + db LEER + db ROAR + db DISABLE + db MIST + db LEECH_SEED + db GROWTH + db POISONPOWDER + db STRING_SHOT + db MEDITATE + db AGILITY + db TELEPORT + db SCREECH + db HAZE + db FOCUS_ENERGY + db DREAM_EATER + db POISON_GAS + db SPLASH + db SHARPEN + db CONVERSION + db SUPER_FANG + db SUBSTITUTE + db TRIPLE_KICK + db SPIDER_WEB + db MIND_READER + db FLAME_WHEEL + db AEROBLAST + db COTTON_SPORE + db POWDER_SNOW + db $ff +; 38ca4 + + +AIScoring_PainSplit: ; 38ca4 + push hl + ld hl, EnemyMonHPHi + ld b, [hl] + inc hl + ld c, [hl] + sla c + rl b + ld hl, $c63d + ld a, [hld] + cp c + ld a, [hl] + sbc b + pop hl + ret nc + inc [hl] + ret +; 38cba + + +AIScoring_Snore: +AIScoring_SleepTalk: ; 38cba + ld a, [EnemyMonStatus] + and $7 + cp $1 + jr z, .asm_38cc7 + + dec [hl] + dec [hl] + dec [hl] + ret + +.asm_38cc7 + inc [hl] + inc [hl] + inc [hl] + ret +; 38ccb + + +AIScoring_DefrostOpponent: ; 38ccb + ld a, [EnemyMonStatus] + and $20 + ret z + dec [hl] + dec [hl] + dec [hl] + ret +; 38cd5 + + +AIScoring_Spite: ; 38cd5 + ld a, [LastEnemyCounterMove] + and a + jr nz, .asm_38ce7 + + call AICompareSpeed + jp c, AIDiscourageMove + + call Function_0x39527 + ret c + inc [hl] + ret + +.asm_38ce7 + push hl + ld b, a + ld c, 4 + ld hl, BattleMonMoves + ld de, BattleMonPP + +.asm_38cf1 + ld a, [hli] + cp b + jr z, .asm_38cfb + + inc de + dec c + jr nz, .asm_38cf1 + + pop hl + ret + +.asm_38cfb + pop hl + ld a, [de] + cp $6 + jr c, .asm_38d0d + cp $f + jr nc, .asm_38d0b + + call RNG + cp $64 + ret nc + +.asm_38d0b + inc [hl] + ret + +.asm_38d0d + call RNG + cp $64 + ret c + dec [hl] + dec [hl] + ret +; 38d16 + + +Function_0x38d16; 38d16 + jp AIDiscourageMove +; 38d19 + + +AIScoring_DestinyBond: +AIScoring_Reversal: +AIScoring_SkullBash: ; 38d19 + call AICheckEnemyQuarterHP + ret nc + inc [hl] + ret +; 38d1f + + +AIScoring_HealBell: ; 38d1f + push hl + ld a, [OTPartyCount] + ld b, a + ld c, 0 + ld hl, OTPartyMon1CurHP + ld de, $0030 + +.asm_38d2c + push hl + ld a, [hli] + or [hl] + jr z, .asm_38d37 + + dec hl + dec hl + dec hl + ld a, [hl] + or c + ld c, a + +.asm_38d37 + pop hl + add hl, de + dec b + jr nz, .asm_38d2c + + pop hl + ld a, c + and a + jr z, .asm_38d52 + + ld a, [EnemyMonStatus] + and a + jr z, .asm_38d48 + + dec [hl] + +.asm_38d48 + and $27 + ret z + call Function_0x39527 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38d52 + ld a, [EnemyMonStatus] + and a + ret nz + jp AIDiscourageMove + +; 38d5a + + +AIScoring_PriorityHit: ; 38d5a + call AICompareSpeed + + ret c + ld a, [PlayerSubStatus3] + and $60 + jp nz, AIDiscourageMove + + ld a, $1 + ld [hBattleTurn], a + push hl + ld hl, $53f6 + ld a, $d + rst FarCall + + ld hl, $5612 + ld a, $d + rst FarCall + + ld hl, $46d2 + ld a, $d + rst FarCall + + pop hl + ld a, [$d257] + ld c, a + ld a, [CurDamage] + ld b, a + ld a, [$c63d] + cp c + ld a, [BattleMonHP] + sbc b + ret nc + dec [hl] + dec [hl] + dec [hl] + ret +; 38d93 + + +AIScoring_Thief: ; 38d93 + ld a, [hl] + add $1e + ld [hl], a + ret +; 38d98 + + +AIScoring_Conversion2: ; 38d98 + ld a, [LastPlayerMove] + and a + jr nz, .asm_38dc9 + + push hl + dec a + ld hl, Moves + PlayerMoveType - PlayerMoveStruct + ld bc, Move2 - Move1 + call AddNTimes + + ld a, BANK(Moves) + call GetFarByte + ld [PlayerMoveType], a + + xor a + ld [hBattleTurn], a + + ld hl, $47c8 + ld a, $d + rst FarCall + + ld a, [$d265] + cp $a + pop hl + jr c, .asm_38dc9 + + ret z + call Function_0x39527 + + ret c + dec [hl] + ret + +.asm_38dc9 + call RNG + + cp $19 + ret c + inc [hl] + ret +; 38dd1 + + +AIScoring_Disable: ; 38dd1 + call AICompareSpeed + jr nc, .asm_38df3 + + push hl + ld a, [LastEnemyCounterMove] + ld hl, Table_0x39301 + ld de, 1 + call IsInArray + + pop hl + jr nc, .asm_38dee + + call RNG + cp 100 + ret c + dec [hl] + ret + +.asm_38dee + ld a, [EnemyMovePower] + and a + ret nz + +.asm_38df3 + call RNG + cp 20 + ret c + inc [hl] + ret +; 38dfb + + +AIScoring_MeanLook: ; 38dfb + call AICheckEnemyHalfHP + jr nc, .asm_38e24 + + push hl + call AICheckLastPlayerMon + pop hl + jp z, AIDiscourageMove + + ld a, [EnemySubStatus5] + bit SUBSTATUS_TOXIC, a + jr nz, .asm_38e26 + + ld a, [PlayerSubStatus1] + and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ENCORED | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE + jr nz, .asm_38e26 + + push hl + callab Function0x3484e + ld a, [$c716] + cp $b + pop hl + ret nc + +.asm_38e24 + inc [hl] + ret + +.asm_38e26 + call Function_0x39521 + ret c + dec [hl] + dec [hl] + dec [hl] + ret +; 38e2e + + +AICheckLastPlayerMon: ; 38e2e + ld a, [PartyCount] + ld b, a + ld c, 0 + ld hl, PartyMon1CurHP + ld de, PartyMon2 - PartyMon1 + +.loop + ld a, [CurBattleMon] + cp c + jr z, .asm_38e44 + + ld a, [hli] + or [hl] + ret nz + dec hl + +.asm_38e44 + add hl, de + inc c + dec b + jr nz, .loop + + ret +; 38e4a + + +AIScoring_Nightmare: ; 38e4a + call Function_0x39527 + ret c + dec [hl] + ret +; 38e50 + + +AIScoring_FlameWheel: ; 38e50 + ld a, [EnemyMonStatus] + bit FRZ, a + ret z + dec [hl] + dec [hl] + dec [hl] + dec [hl] + dec [hl] + ret +; 38e5c + + +AIScoring_Curse: ; 38e5c + ld a, [EnemyMonType1] + cp GHOST + jr z, .ghostcurse + ld a, [EnemyMonType2] + cp GHOST + jr z, .ghostcurse + + call AICheckEnemyHalfHP + jr nc, .asm_38e93 + + ld a, [EnemyAtkLevel] + cp $b + jr nc, .asm_38e93 + cp $9 + ret nc + + ld a, [BattleMonType1] + cp GHOST + jr z, .asm_38e92 + cp FIRE + ret nc + ld a, [BattleMonType2] + cp FIRE + ret nc + call Function_0x39521 + ret c + dec [hl] + dec [hl] + ret + +.asm_38e90 + inc [hl] + inc [hl] +.asm_38e92 + inc [hl] +.asm_38e93 + inc [hl] + ret + +.ghostcurse + ld a, [PlayerSubStatus1] + bit SUBSTATUS_CURSE, a + jp nz, AIDiscourageMove + + push hl + callba Function0x349f4 + pop hl + jr nc, .asm_38eb0 + + push hl + call AICheckLastPlayerMon + pop hl + jr nz, .asm_38e90 + + jr .asm_38eb7 + + +.asm_38eb0 + push hl + call AICheckLastPlayerMon + pop hl + jr z, .asm_38ecb + + +.asm_38eb7 + call AICheckEnemyQuarterHP + jp nc, .asm_38e90 + + call AICheckEnemyHalfHP + jr nc, .asm_38e92 + + call AICheckEnemyMaxHP + ret nc + + ld a, [PlayerTurnsTaken] + and a + ret nz + +.asm_38ecb + call Function_0x39527 + + ret c + dec [hl] + dec [hl] + ret +; 38ed2 + + +AIScoring_Protect: ; 38ed2 + ld a, [$c681] + and a + jr nz, .asm_38f13 + + ld a, [PlayerSubStatus5] + bit SUBSTATUS_LOCK_ON, a + jr nz, .asm_38f14 + + ld a, [PlayerFuryCutterCount] + cp 3 + jr nc, .asm_38f0d + + ld a, [PlayerSubStatus3] + bit SUBSTATUS_CHARGED, a + jr nz, .asm_38f0d + + ld a, [PlayerSubStatus5] + bit SUBSTATUS_TOXIC, a + jr nz, .asm_38f0d + ld a, [PlayerSubStatus4] + bit SUBSTATUS_LEECH_SEED, a + jr nz, .asm_38f0d + ld a, [PlayerSubStatus1] + bit SUBSTATUS_CURSE, a + jr nz, .asm_38f0d + + bit SUBSTATUS_ENCORED, a + jr z, .asm_38f14 + + ld a, [PlayerRolloutCount] + cp 3 + jr c, .asm_38f14 + +.asm_38f0d + call Function_0x39521 + ret c + dec [hl] + ret + +.asm_38f13 + inc [hl] + +.asm_38f14 + call RNG + cp 20 + ret c + inc [hl] + inc [hl] + ret +; 38f1d + + +AIScoring_Foresight: ; 38f1d + ld a, [EnemyAccLevel] + cp $5 + jr c, .asm_38f41 + ld a, [PlayerEvaLevel] + cp $a + jr nc, .asm_38f41 + + ld a, [BattleMonType1] + cp GHOST + jr z, .asm_38f41 + ld a, [BattleMonType2] + cp GHOST + jr z, .asm_38f41 + + call RNG + cp 20 + ret c + inc [hl] + ret + +.asm_38f41 + call RNG + cp 100 + ret c + dec [hl] + dec [hl] + ret +; 38f4a + + +AIScoring_PerishSong: ; 38f4a + push hl + callab Function0x349f4 + pop hl + jr c, .asm_38f75 + + ld a, [PlayerSubStatus5] + bit 7, a + jr nz, .asm_38f6f + + push hl + callab Function0x3484e + ld a, [$c716] + cp 10 ; 1.0 + pop hl + ret c + + call Function_0x39527 + ret c + + inc [hl] + ret + +.asm_38f6f + call Function_0x39527 + + ret c + dec [hl] + ret + +.asm_38f75 + ld a, [hl] + add 5 + ld [hl], a + ret +; 38f7a + + +AIScoring_Sandstorm: ; 38f7a + ld a, [BattleMonType1] + push hl + ld hl, .SandstormImmuneTypes + ld de, 1 + call IsInArray + pop hl + jr c, .asm_38fa5 + + ld a, [BattleMonType2] + push hl + ld hl, .SandstormImmuneTypes + ld de, 1 + call IsInArray + pop hl + jr c, .asm_38fa5 + + call AICheckPlayerHalfHP + jr nc, .asm_38fa6 + + call Function_0x39527 + ret c + + dec [hl] + ret + +.asm_38fa5 + inc [hl] + +.asm_38fa6 + inc [hl] + ret + +.SandstormImmuneTypes + db ROCK + db GROUND + db STEEL + db $ff +; 38fac + + +AIScoring_Endure: ; 38fac + ld a, [$c681] + and a + jr nz, .asm_38fd8 + + call AICheckEnemyMaxHP + jr c, .asm_38fd8 + + call AICheckEnemyQuarterHP + jr c, .asm_38fd9 + + ld b, EFFECT_REVERSAL + call AIHasMove + jr nc, .asm_38fcb + + call Function_0x39521 + ret c + + dec [hl] + dec [hl] + dec [hl] + ret + +.asm_38fcb + ld a, [EnemySubStatus5] + bit SUBSTATUS_LOCK_ON, a + ret z + call Function_0x39527 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38fd8 + inc [hl] + +.asm_38fd9 + inc [hl] + ret +; 38fdb + + +AIScoring_FuryCutter: ; 38fdb + ld a, [EnemyFuryCutterCount] + and a + jr z, .end + dec [hl] + + cp 2 + jr c, .end + dec [hl] + dec [hl] + + cp 3 + jr c, .end + dec [hl] + dec [hl] + dec [hl] + +.end + + ; fallthrough +; 38fef + + +AIScoring_Rollout: ; 38fef + ld a, [EnemySubStatus1] + bit SUBSTATUS_IN_LOVE, a + jr nz, .asm_39020 + + ld a, [EnemySubStatus3] + bit SUBSTATUS_CONFUSED, a + jr nz, .asm_39020 + + ld a, [EnemyMonStatus] + bit PAR, a + jr nz, .asm_39020 + + call AICheckEnemyQuarterHP + jr nc, .asm_39020 + + ld a, [EnemyAccLevel] + cp 7 + jr c, .asm_39020 + ld a, [PlayerEvaLevel] + cp 8 + jr nc, .asm_39020 + + call RNG + cp 200 + ret nc + dec [hl] + dec [hl] + ret + +.asm_39020 + call Function_0x39521 + ret c + inc [hl] + ret +; 39026 + + +AIScoring_Swagger: +AIScoring_Attract: ; 39026 + ld a, [PlayerTurnsTaken] + and a + jr z, .asm_39032 + + call Function_0x39521 + ret c + inc [hl] + ret + +.asm_39032 + call RNG + cp 200 + ret nc + dec [hl] + ret +; 3903a + + +AIScoring_Safeguard: ; 3903a + call AICheckPlayerHalfHP + ret c + call Function_0x39521 + ret c + inc [hl] + ret +; 39044 + + +AIScoring_Magnitude: +AIScoring_Earthquake: ; 39044 + ld a, [LastEnemyCounterMove] + cp DIG + ret nz + + ld a, [PlayerSubStatus3] + bit SUBSTATUS_UNDERGROUND, a + jr z, .asm_39058 + + call AICompareSpeed + ret nc + dec [hl] + dec [hl] + ret + +.asm_39058 + call AICompareSpeed + ret c + call Function_0x39527 + ret c + dec [hl] + ret +; 39062 + + +AIScoring_BatonPass: ; 39062 + push hl + callab Function0x3484e + ld a, [$c716] + cp 10 ; 1.0 + pop hl + ret c + inc [hl] + ret +; 39072 + + +AIScoring_Pursuit: ; 39072 + call AICheckPlayerQuarterHP + jr nc, .asm_3907d + call Function_0x39521 + ret c + inc [hl] + ret + +.asm_3907d + call Function_0x39527 + ret c + dec [hl] + dec [hl] + ret +; 39084 + + +AIScoring_RapidSpin: ; 39084 + ld a, [$c731] + and a + jr nz, .asm_39097 + + ld a, [EnemySubStatus4] + bit SUBSTATUS_LEECH_SEED, a + jr nz, .asm_39097 + + ld a, [EnemyScreens] + bit SCREENS_SPIKES, a + ret z + +.asm_39097 + call Function_0x39521 + + ret c + dec [hl] + dec [hl] + ret +; 3909e + + +AIScoring_HiddenPower: ; 3909e + push hl + ld a, 1 + ld [hBattleTurn], a + ld hl, $7ced + ld a, $3e + rst FarCall + callab Function0x347c8 + pop hl + + ld a, [$d265] + cp $a + jr c, .asm_390c9 + + ld a, d + cp $32 + jr c, .asm_390c9 + + ld a, [$d265] + cp $b + jr nc, .asm_390c7 + + ld a, d + cp $46 + ret c + +.asm_390c7 + dec [hl] + ret + +.asm_390c9 + inc [hl] + ret +; 390cb + + +AIScoring_RainDance: ; 390cb + ld a, [BattleMonType1] + cp WATER + jr z, AIBadWeatherType + cp FIRE + jr z, AIGoodWeatherType + + ld a, [BattleMonType2] + cp WATER + jr z, AIBadWeatherType + cp FIRE + jr z, AIGoodWeatherType + + push hl + ld hl, RainDanceMoves + jr AIScoring_WeatherMove +; 390e7 + +RainDanceMoves: ; 390e7 + db WATER_GUN + db HYDRO_PUMP + db SURF + db BUBBLEBEAM + db THUNDER + db WATERFALL + db CLAMP + db BUBBLE + db CRABHAMMER + db OCTAZOOKA + db WHIRLPOOL + db $ff +; 390f3 + + +AIScoring_SunnyDay: ; 390f3 + ld a, [BattleMonType1] + cp FIRE + jr z, AIBadWeatherType + cp WATER + jr z, AIGoodWeatherType + + ld a, [BattleMonType2] + cp FIRE + jr z, AIBadWeatherType + cp WATER + jr z, AIGoodWeatherType + + push hl + ld hl, SunnyDayMoves + + ; fallthrough +; 3910d + + +AIScoring_WeatherMove: ; 3910d + call AIHasMoveInArray + pop hl + jr nc, AIBadWeatherType + + call AICheckPlayerHalfHP + jr nc, AIBadWeatherType + + call Function_0x39527 + ret c + + dec [hl] + ret +; 3911e + +AIBadWeatherType: ; 3911e + inc [hl] + inc [hl] + inc [hl] + ret +; 39122 + +AIGoodWeatherType: ; 39122 + call AICheckPlayerHalfHP + ret nc + + ld a, [PlayerTurnsTaken] + and a + jr z, .good + + ld a, [EnemyTurnsTaken] + and a + ret nz + +.good + dec [hl] + dec [hl] + ret +; 39134 + + +SunnyDayMoves: ; 39134 + db FIRE_PUNCH + db EMBER + db FLAMETHROWER + db FIRE_SPIN + db FIRE_BLAST + db SACRED_FIRE + db MORNING_SUN + db SYNTHESIS + db $ff +; 3913d + + +AIScoring_BellyDrum: ; 3913d + ld a, [EnemyAtkLevel] + cp $a + jr nc, .asm_3914d + + call AICheckEnemyMaxHP + + ret c + inc [hl] + call AICheckEnemyHalfHP + + ret c + +.asm_3914d + ld a, [hl] + add $5 + ld [hl], a + ret +; 39152 + + +AIScoring_PsychUp: ; 39152 + push hl + ld hl, EnemyAtkLevel + ld b, $8 + ld c, $64 + +.asm_3915a + ld a, [hli] + sub $7 + add c + ld c, a + dec b + jr nz, .asm_3915a + + ld hl, PlayerAtkLevel + ld b, $8 + ld d, $64 + +.asm_39169 + ld a, [hli] + sub $7 + add d + ld d, a + dec b + jr nz, .asm_39169 + + ld a, c + sub d + pop hl + jr nc, .asm_39188 + + ld a, [PlayerAccLevel] + cp $6 + ret c + ld a, [EnemyEvaLevel] + cp $8 + ret nc + call Function_0x39521 + + ret c + dec [hl] + ret + +.asm_39188 + inc [hl] + inc [hl] + ret +; 3918b + + +AIScoring_MirrorCoat: ; 3918b + push hl + ld hl, PlayerUsedMoves + ld c, $4 + ld b, $0 + +.asm_39193 + ld a, [hli] + and a + jr z, .asm_391a8 + + call AIGetEnemyMove + + ld a, [EnemyMovePower] + and a + jr z, .asm_391a8 + + ld a, [EnemyMoveType] + cp FIRE + jr c, .asm_391a8 + + inc b + +.asm_391a8 + dec c + jr nz, .asm_39193 + + pop hl + ld a, b + and a + jr z, .asm_391d3 + + cp $3 + jr nc, .asm_391ca + + ld a, [LastEnemyCounterMove] + and a + jr z, .asm_391d2 + + call AIGetEnemyMove + + ld a, [EnemyMovePower] + and a + jr z, .asm_391d2 + + ld a, [EnemyMoveType] + cp FIRE + jr c, .asm_391d2 + + +.asm_391ca + call RNG + cp 100 + jr c, .asm_391d2 + dec [hl] + +.asm_391d2 + ret + +.asm_391d3 + inc [hl] + ret +; 391d5 + + +AIScoring_Twister: +AIScoring_Gust: ; 391d5 + ld a, [LastEnemyCounterMove] + cp FLY + ret nz + + ld a, [PlayerSubStatus3] + bit SUBSTATUS_FLYING, a + jr z, .asm_391e9 + + call AICompareSpeed + ret nc + + dec [hl] + dec [hl] + ret + +.asm_391e9 + call AICompareSpeed + ret c + call Function_0x39527 + ret c + dec [hl] + ret +; 391f3 + + +AIScoring_FutureSight: ; 391f3 + call AICompareSpeed + ret nc + + ld a, [PlayerSubStatus3] + and 1<<SUBSTATUS_FLYING | 1<<SUBSTATUS_UNDERGROUND + ret z + + dec [hl] + dec [hl] + ret +; 39200 + + +AIScoring_Stomp: ; 39200 + ld a, [$c6fe] + and a + ret z + + call Function_0x39521 + ret c + + dec [hl] + ret +; 3920b + + +AIScoring_Solarbeam: ; 3920b + ld a, [Weather] + cp WEATHER_SUN + jr z, .asm_3921e + + cp WEATHER_RAIN + ret nz + + call RNG + cp 25 ; 1/10 + ret c + + inc [hl] + inc [hl] + ret + +.asm_3921e + call Function_0x39521 + ret c + + dec [hl] + dec [hl] + ret +; 39225 + + +AIScoring_Thunder: ; 39225 + ld a, [Weather] + cp WEATHER_SUN + ret nz + + call RNG + cp 25 ; 1/10 + ret c + + inc [hl] + ret +; 39233 + + +AICompareSpeed: ; 39233 + push bc + ld a, [EnemyMonSpd + 1] + ld b, a + ld a, [BattleMonSpd + 1] + cp b + ld a, [EnemyMonSpd] + ld b, a + ld a, [BattleMonSpd] + sbc b + pop bc + ret +; 39246 + + +AICheckPlayerMaxHP: ; 39246 + push hl + push de + push bc + ld de, BattleMonHP + ld hl, BattleMonMaxHP + jr AICheckMaxHP +; 39251 + + +AICheckEnemyMaxHP: ; 39251 + push hl + push de + push bc + ld de, EnemyMonHPHi + ld hl, EnemyMonMaxHPHi + ; fallthrough +; 3925a + + +AICheckMaxHP: ; 3925a +; Return carry if hp at de matches max hp at hl. + ld a, [de] + inc de + cp [hl] + jr nz, .asm_39269 + + inc hl + ld a, [de] + cp [hl] + jr nz, .asm_39269 + + pop bc + pop de + pop hl + scf + ret + +.asm_39269 + pop bc + pop de + pop hl + and a + ret +; 3926e + + +AICheckPlayerHalfHP: ; 3926e + push hl + ld hl, BattleMonHP + ld b, [hl] + inc hl + ld c, [hl] + sla c + rl b + inc hl + inc hl + ld a, [hld] + cp c + ld a, [hl] + sbc b + pop hl + ret +; 39281 + + +AICheckEnemyHalfHP: ; 39281 + push hl + push de + push bc + ld hl, EnemyMonHPHi + ld b, [hl] + inc hl + ld c, [hl] + sla c + rl b + inc hl + inc hl + ld a, [hld] + cp c + ld a, [hl] + sbc b + pop bc + pop de + pop hl + ret +; 39298 + + +AICheckEnemyQuarterHP: ; 39298 + push hl + push de + push bc + ld hl, EnemyMonHPHi + ld b, [hl] + inc hl + ld c, [hl] + sla c + rl b + sla c + rl b + inc hl + inc hl + ld a, [hld] + cp c + ld a, [hl] + sbc b + pop bc + pop de + pop hl + ret +; 392b3 + + +AICheckPlayerQuarterHP: ; 392b3 + push hl + ld hl, BattleMonHP + ld b, [hl] + inc hl + ld c, [hl] + sla c + rl b + sla c + rl b + inc hl + inc hl + ld a, [hld] + cp c + ld a, [hl] + sbc b + pop hl + ret +; 392ca + + +AIHasMove: ; 392ca +; Return carry if the enemy has move b. + push hl + ld hl, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + +.checkmove + ld a, [hli] + and a + jr z, .asm_392e0 + + call AIGetEnemyMove + + ld a, [EnemyMoveEffect] + cp b + jr z, .asm_392e3 + + dec c + jr nz, .checkmove + +.asm_392e0 + pop hl + and a + ret + +.asm_392e3 + pop hl + scf + ret +; 392e6 + + +AIHasMoveInArray: ; 392e6 +; Return carry if the enemy has a move in array hl. + + push hl + push de + push bc + +.asm_392e9 + ld a, [hli] + cp $ff + jr z, .asm_392fd + + ld b, a + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld de, EnemyMonMoves + +.asm_392f4 + dec c + jr z, .asm_392e9 + + ld a, [de] + inc de + cp b + jr nz, .asm_392f4 + + scf + +.asm_392fd + pop bc + pop de + pop hl + ret +; 39301 + + +Table_0x39301: ; 39301 + db DOUBLE_EDGE + db SING + db FLAMETHROWER + db HYDRO_PUMP + db SURF + db ICE_BEAM + db BLIZZARD + db HYPER_BEAM + db SLEEP_POWDER + db THUNDERBOLT + db THUNDER + db EARTHQUAKE + db TOXIC + db PSYCHIC_M + db HYPNOSIS + db RECOVER + db FIRE_BLAST + db SOFTBOILED + db SUPER_FANG + db $ff +; 39315 + + +AIScoring_Opportunist: ; 39315 +; Don't use stall moves when the player's HP is low. + + call AICheckEnemyHalfHP + ret c + + call AICheckEnemyQuarterHP + jr nc, .asm_39322 + + call Function_0x39527 + ret c + +.asm_39322 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 +.checkmove + inc hl + dec c + jr z, .asm_39347 + + ld a, [de] + inc de + and a + jr z, .asm_39347 + + push hl + push de + push bc + ld hl, .stallmoves + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr nc, .checkmove + + inc [hl] + jr .checkmove + +.asm_39347 + ret + +.stallmoves + db SWORDS_DANCE + db TAIL_WHIP + db LEER + db GROWL + db DISABLE + db MIST + db COUNTER + db LEECH_SEED + db GROWTH + db STRING_SHOT + db MEDITATE + db AGILITY + db RAGE + db MIMIC + db SCREECH + db HARDEN + db WITHDRAW + db DEFENSE_CURL + db BARRIER + db LIGHT_SCREEN + db HAZE + db REFLECT + db FOCUS_ENERGY + db BIDE + db AMNESIA + db TRANSFORM + db SPLASH + db ACID_ARMOR + db SHARPEN + db CONVERSION + db SUBSTITUTE + db FLAME_WHEEL + db $ff +; 39369 + + + +AIScoring_Aggressive: ; 39369 +; Use whatever does the most damage. + +; Figure out which attack does the most damage and put it in c. + ld hl, EnemyMonMoves + ld bc, 0 + ld de, 0 +.checkmove + inc b + ld a, b + cp EnemyMonMovesEnd - EnemyMonMoves + 1 + jr z, .gotstrongestmove + + ld a, [hli] + and a + jr z, .gotstrongestmove + + push hl + push de + push bc + call AIGetEnemyMove + ld a, [EnemyMovePower] + and a + jr z, .nodamage + call AIDamageCalc + pop bc + pop de + pop hl + + ld a, [CurDamage + 1] + cp e + ld a, [CurDamage] + sbc d + jr c, .checkmove + + ld a, [CurDamage + 1] + ld e, a + ld a, [CurDamage] + ld d, a + ld c, b + jr .checkmove + +.nodamage + pop bc + pop de + pop hl + jr .checkmove + +.gotstrongestmove +; Nothing we can do if no attacks did damage. + ld a, c + and a + jr z, .done + +; Discourage moves that do less damage unless they're reckless too. + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, 0 +.checkmove2 + inc b + ld a, b + cp EnemyMonMovesEnd - EnemyMonMoves + 1 + jr z, .done + + cp c + ld a, [de] + inc de + inc hl + jr z, .checkmove2 + + call AIGetEnemyMove + + ld a, [EnemyMovePower] + cp 2 + jr c, .checkmove2 + + push hl + push de + push bc + ld a, [EnemyMoveEffect] + ld hl, .aggressivemoves + ld de, 1 + call IsInArray + pop bc + pop de + pop hl + jr c, .checkmove2 + + inc [hl] + jr .checkmove2 + +.done + ret + +.aggressivemoves + db EFFECT_EXPLOSION + db EFFECT_RAMPAGE + db EFFECT_MULTI_HIT + db EFFECT_DOUBLE_HIT + db $ff +; 393e7 + + +AIDamageCalc: ; 393e7 + ld a, 1 + ld [hBattleTurn], a + ld a, [EnemyMoveEffect] + ld de, 1 + ld hl, .ConstantDamageEffects + call IsInArray + jr nc, .asm_39400 + callab BattleCommand3f + ret + +.asm_39400 + callab EnemyAttackDamage + callab BattleCommand62 + callab BattleCommand07 + ret + +.ConstantDamageEffects + db EFFECT_SUPER_FANG + db EFFECT_STATIC_DAMAGE + db EFFECT_LEVEL_DAMAGE + db EFFECT_PSYWAVE + db $ff +; 39418 + + +AIScoring_Cautious: ; 39418 +; Don't use moves with residual effects after turn 1. + + ld a, [EnemyTurnsTaken] + and a + ret z + + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_39425 + inc hl + dec c + ret z + + ld a, [de] + inc de + and a + ret z + + push hl + push de + push bc + ld hl, .residualmoves + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr nc, .asm_39425 + + call RNG + cp 230 + ret nc + + inc [hl] + jr .asm_39425 + +.residualmoves + db MIST + db LEECH_SEED + db POISONPOWDER + db STUN_SPORE + db THUNDER_WAVE + db FOCUS_ENERGY + db BIDE + db POISON_GAS + db TRANSFORM + db CONVERSION + db SUBSTITUTE + db SPIKES + db $ff +; 39453 + + + +AIScoring_StatusImmunity: ; 39453 +; Don't use status moves that don't affect the player. + + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.checkmove + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call AIGetEnemyMove + + ld a, [EnemyMoveEffect] + cp EFFECT_TOXIC + jr z, .poisonimmunity + cp EFFECT_POISON + jr z, .poisonimmunity + cp EFFECT_SLEEP + jr z, .typeimmunity + cp EFFECT_PARALYZE + jr z, .typeimmunity + + ld a, [EnemyMovePower] + and a + jr z, .checkmove + + jr .typeimmunity + +.poisonimmunity + ld a, [BattleMonType1] + cp POISON + jr z, .immune + ld a, [BattleMonType2] + cp POISON + jr z, .immune + +.typeimmunity + push hl + push bc + push de + ld a, 1 + ld [hBattleTurn], a + callab Function0x347c8 + pop de + pop bc + pop hl + + ld a, [$d265] + and a + jr nz, .checkmove + +.immune + call AIDiscourageMove + jr .checkmove +; 394a9 + + + +AIScoring_Risky: ; 394a9 +; Use any move that will KO the opponent. + + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 +.checkmove + inc hl + dec c + ret z + + ld a, [de] + inc de + and a + ret z + + push de + push bc + push hl + call AIGetEnemyMove + + ld a, [EnemyMovePower] + and a + jr z, .nextmove + +; Don't use risky moves at max hp. + ld a, [EnemyMoveEffect] + ld de, 1 + ld hl, .riskymoves + call IsInArray + jr nc, .checkko + + call AICheckEnemyMaxHP + jr c, .nextmove + + call RNG + cp 200 ; 1/5 + jr c, .nextmove + +.checkko + call AIDamageCalc + + ld a, [CurDamage + 1] + ld e, a + ld a, [CurDamage] + ld d, a + ld a, [BattleMonHP + 1] + cp e + ld a, [BattleMonHP] + sbc d + jr nc, .nextmove + + pop hl + dec [hl] + dec [hl] + dec [hl] + dec [hl] + dec [hl] + push hl + +.nextmove + pop hl + pop bc + pop de + jr .checkmove + +.riskymoves + db EFFECT_EXPLOSION + db EFFECT_OHKO + db $ff +; 39502 + + + +AIScoring_None: ; 39502 + ret +; 39503 + + +AIDiscourageMove: ; 39503 + ld a, [hl] + add 10 + ld [hl], a + ret +; 39508 + + +AIGetEnemyMove: ; 39508 + push hl + push de + push bc + dec a + ld hl, Moves + ld bc, Move2 - Move1 + call AddNTimes + + ld de, EnemyMoveStruct + ld a, BANK(Moves) + call FarCopyBytes + + pop bc + pop de + pop hl + ret +; 39521 + + +Function_0x39521: ; 39521 + call RNG + cp 50 ; 1/5 + ret +; 39527 + + +Function_0x39527: ; 39527 + call RNG + cp $80 ; 1/2 + ret +; 3952d + + diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index c6b0c1c7a..39f6b6a6a 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -182,7 +182,7 @@ CheckPlayerTurn: call FarBattleTextBox call CantMove - call $399c + call UpdateBattleMonInParty ld hl, $5f48 call CallBankF ld a, $1 @@ -442,7 +442,7 @@ CheckEnemyTurn: ; 3421f ld hl, WokeUpText call FarBattleTextBox call CantMove - call $39b0 + call UpdateEnemyMonInParty ld hl, $6036 call CallBankF ld a, $1 @@ -496,7 +496,7 @@ CheckEnemyTurn: ; 3421f .CheckDisabled - ld hl, EnemyEncoreCount + ld hl, EnemyDisableCount ld a, [hl] and a jr z, .CheckConfused @@ -507,7 +507,7 @@ CheckEnemyTurn: ; 3421f jr nz, .CheckConfused ld [hl], a - ld [EnemyEncoredMove], a + ld [EnemyDisabledMove], a ; 'disabled no more!' ld hl, DisabledNoMoreText @@ -612,7 +612,7 @@ CheckEnemyTurn: ; 3421f .CheckDisabledMove ; We can't disable a move that doesn't exist. - ld a, [EnemyEncoredMove] + ld a, [EnemyDisabledMove] and a jr z, .CheckParalyzed @@ -664,7 +664,7 @@ MoveDisabled: ; 3438d ld a, BATTLE_VARS_MOVE call CleanGetBattleVarPair ld [$d265], a - call $34f8 + call GetMoveName ; 'disabled!' ld hl, DisabledMoveText @@ -1219,7 +1219,7 @@ Function0x3460b: ; 3460b .asm_34616 ld c, a ld a, 2 - call $3945 + call UserPartyAttr ld a, BATTLE_VARS_MOVE call CleanGetBattleVarPair @@ -1514,7 +1514,7 @@ BattleCommand07: ; 346d2 ld a, [hld] ld [$ffb6], a - call $3119 + call Multiply ld a, [$ffb4] ld b, a @@ -1528,7 +1528,7 @@ BattleCommand07: ; 346d2 ld a, $a ld [$ffb7], a ld b, $4 - call $3124 + call Divide ld a, [$ffb5] ld b, a ld a, [$ffb6] @@ -1578,7 +1578,7 @@ Function0x347d3: ; 347d3 push hl push de push bc - ld a, $f + ld a, BATTLE_VARS_MOVE_TYPE call CleanGetBattleVarPair ld d, a ld b, [hl] @@ -1593,9 +1593,9 @@ Function0x347d3: ; 347d3 jr z, .asm_3482f ; 0x347ea $43 cp $fe jr nz, .asm_347fb ; 0x347ee $b - ld a, $5 + ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 3, a + bit SUBSTATUS_IDENTIFIED, a jr nz, .asm_3482f ; 0x347f7 $36 jr .asm_347e7 ; 0x347f9 $ec .asm_347fb @@ -1675,7 +1675,7 @@ Function0x3484e: ; 3484e jr z, .asm_3489f ; 0x34863 $3a push hl dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .asm_3489b ; 0x3486e $2b @@ -1761,7 +1761,7 @@ Function0x348de: ; 348de inc de dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .loop @@ -2020,10 +2020,10 @@ Function0x34a2a: ; 34a2a ld a, [hl] ld [CurSpecies], a - call GetBaseStats + call GetBaseData ld a, [LastEnemyCounterMove] dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .asm_34a77 @@ -2113,7 +2113,7 @@ Function0x34aa7: ; 34aa7 jr z, .asm_34aef dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .asm_34ae9 @@ -2200,13 +2200,13 @@ Function0x34b20: ; 34b20 push hl ld [CurSpecies], a - call GetBaseStats + call GetBaseData ld a, [LastEnemyCounterMove] and a jr z, .asm_34b4a dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .asm_34b4a @@ -2389,7 +2389,7 @@ BattleCommand09: ; 34d32 ; Perfect-accuracy moves ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $11 + cp EFFECT_ALWAYS_HIT ret z call .StatModifiers @@ -2406,7 +2406,7 @@ BattleCommand09: ; 34d32 push bc call GetOpponentItem ld a, b - cp $4d ; brightpowder + cp HELD_BRIGHTPOWDER ld a, c ; % miss pop bc jr nz, .asm_34d81 @@ -2435,7 +2435,7 @@ BattleCommand09: ; 34d32 ; Keep the damage value intact if we're using (Hi) Jump Kick. ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $2d + cp EFFECT_JUMP_KICK jr z, .Missed call ResetDamage @@ -2450,12 +2450,12 @@ BattleCommand09: ; 34d32 ; a monster that isn't sleeping. ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $8 + cp EFFECT_DREAM_EATER ret nz ld a, BATTLE_VARS_STATUS_OPP call CleanGetBattleVarPair - and 7 ; sleep + and SLP ret @@ -2463,7 +2463,7 @@ BattleCommand09: ; 34d32 ; Return nz if the opponent is protected. ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 2, a + bit SUBSTATUS_PROTECT, a ret z ld c, 40 @@ -2486,13 +2486,13 @@ BattleCommand09: ; 34d32 ; Fissure or Magnitude on a monster that is flying. ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarPair - bit 5, [hl] - res 5, [hl] + bit SUBSTATUS_LOCK_ON, [hl] + res SUBSTATUS_LOCK_ON, [hl] ret z ld a, BATTLE_VARS_SUBSTATUS3_OPP call CleanGetBattleVarPair - bit 6, a ; flying + bit SUBSTATUS_FLYING, a jr z, .LockedOn ld a, BATTLE_VARS_MOVE_ANIM @@ -2513,15 +2513,15 @@ BattleCommand09: ; 34d32 .DrainSub ; Return z if using an HP drain move on a substitute. - call CheckSubstituteOpp ; CheckOpponentSub + call CheckSubstituteOpp jr z, .asm_34e00 ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $3 ; drain + cp EFFECT_LEECH_HIT ret z - cp $8 ; dream eater + cp EFFECT_DREAM_EATER ret z .asm_34e00 @@ -2536,10 +2536,10 @@ BattleCommand09: ; 34d32 ld a, BATTLE_VARS_SUBSTATUS3_OPP call CleanGetBattleVarPair - and $60 ; fly | dig + and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret z - bit 6, a + bit SUBSTATUS_FLYING, a jr z, .DigMoves ld a, BATTLE_VARS_MOVE_ANIM @@ -2570,7 +2570,7 @@ BattleCommand09: ; 34d32 ; Return z if the current move always hits in rain, and it is raining. ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $98 + cp EFFECT_THUNDER ret nz ld a, [Weather] @@ -2582,7 +2582,7 @@ BattleCommand09: ; 34d32 ; Return nz if unleashing energy from Bide. ld a, BATTLE_VARS_SUBSTATUS4 call CleanGetBattleVarPair - bit 0, a + bit SUBSTATUS_UNLEASH, a ret @@ -2611,7 +2611,7 @@ BattleCommand09: ; 34d32 ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 3, a + bit SUBSTATUS_IDENTIFIED, a ret nz .asm_34e6b @@ -2718,12 +2718,12 @@ BattleCommand0a: ; 34eee ld a, BATTLE_VARS_SUBSTATUS4 call CleanGetBattleVarPair - bit 4, a + bit SUBSTATUS_SUBSTITUTE, a ret z ld a, BATTLE_VARS_SUBSTATUS3 call CleanGetBattleVarPair - bit 4, a + bit SUBSTATUS_CHARGED, a jr nz, .asm_34f18 ld a, BATTLE_VARS_MOVE_EFFECT @@ -2841,8 +2841,8 @@ BattleCommand0b: ; 34f60 jp Function0x37ec7 .asm_34fb0 ld a, [$c689] - and $1 - xor $1 + and 1 + xor 1 ld [$c689], a ld a, [de] cp $1 @@ -2850,7 +2850,7 @@ BattleCommand0b: ; 34f60 ld a, BATTLE_VARS_MOVE_ANIM call CleanGetBattleVarPair ld e, a - ld d, $0 + ld d, 0 pop af jp z, PlayFXAnimID xor a @@ -2910,7 +2910,7 @@ BattleCommand93: ; 34ffd BattleCommand0c: ; 35004 ld a, BATTLE_VARS_SUBSTATUS4 call CleanGetBattleVarPair - bit 4, a + bit SUBSTATUS_SUBSTITUTE, a ret z call Function0x37ed5 @@ -2960,8 +2960,8 @@ BattleCommand0d: ; 35023 .asm_3504f ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair - res 5, [hl] - res 6, [hl] + res SUBSTATUS_UNDERGROUND, [hl] + res SUBSTATUS_FLYING, [hl] call Function0x37ece jp EndMoveEffect ; 3505e @@ -2972,7 +2972,7 @@ BattleCommand0e: ; 3505e ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 5, a + bit SUBSTATUS_ENDURE, a jr z, .asm_35072 ; 35065 $b call BattleCommand4b ld b, $0 @@ -2983,7 +2983,7 @@ BattleCommand0e: ; 3505e .asm_35072 call GetOpponentItem ld a, b - cp $4f + cp HELD_FOCUS_BAND ld b, $0 jr nz, .asm_3508b ; 3507a $f call FarBattleRNG @@ -3020,21 +3020,22 @@ BattleCommand0e: ; 3505e call GetOpponentItem ld a, [hl] ld [$d265], a - call $3468 + call GetItemName ld hl, HungOnText jp FarBattleTextBox .asm_50bb - ld a, $8 + ld a, BATTLE_VARS_SUBSTATUS4_OPP call CleanGetBattleVarPair - bit 4, a + bit SUBSTATUS_SUBSTITUTE, a ret nz - ld de, EnemyDamageTaken + + ld de, PlayerDamageTaken + 1 ld a, [hBattleTurn] and a - jr nz, .asm_350ce ; 0x350c9 $3 - ld de, $c685 + jr nz, .asm_350ce + ld de, EnemyDamageTaken + 1 .asm_350ce ld a, [CurDamage + 1] @@ -3063,9 +3064,9 @@ Function0x350e4: ; 350e4 ld a, [TypeModifier] and $7f jr z, .asm_35110 ; 0x350ef $1f - ld a, $d + ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $94 + cp EFFECT_FUTURE_SIGHT ld hl, ButItFailedText ld de, ItFailedText jr z, .asm_35110 ; 0x350fe $10 @@ -3079,9 +3080,9 @@ Function0x350e4: ; 350e4 call Function0x35157 xor a ld [CriticalHit], a - ld a, $d + ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $2d + cp EFFECT_JUMP_KICK ret nz ld a, [TypeModifier] and $7f @@ -3117,7 +3118,7 @@ Function0x350e4: ; 350e4 Function0x35157: ; 35157 ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 2, a ; protect + bit SUBSTATUS_PROTECT, a jr z, .asm_35162 ld h, d ld l, e @@ -3232,7 +3233,7 @@ BattleCommand11: ; 351c0 ld a, BATTLE_VARS_SUBSTATUS5_OPP call CleanGetBattleVarPair - bit 6, a + bit SUBSTATUS_DESTINY_BOND, a jr z, .asm_35231 ld hl, TookDownWithItText @@ -3267,8 +3268,8 @@ BattleCommand11: ; 351c0 ld h, b ld l, c ld a, $b - call $2d83 - call $39c9 + call Predef + call RefreshBattleHuds call SwitchTurn xor a @@ -3315,7 +3316,7 @@ BattleCommand12: ; 35250 ld a, BATTLE_VARS_SUBSTATUS4_OPP call CleanGetBattleVarPair - bit 6, a + bit SUBSTATUS_RAGE, a ret z ld de, $c72c @@ -3929,7 +3930,7 @@ BattleCommanda1: ; 35461 call FarBattleTextBox ld a, [BattleMonSpecies] ld [CurSpecies], a - call GetBaseStats + call GetBaseData ld a, [$d239] ld c, a push bc @@ -3937,7 +3938,7 @@ BattleCommanda1: ; 35461 call Function0x355bd ld a, [hl] ld [CurSpecies], a - call GetBaseStats + call GetBaseData ld a, [$d238] pop bc ld b, a @@ -4270,23 +4271,23 @@ BattleCommand62: ; 35612 TypeBoostItems: ; 35703 - db $32, NORMAL ; Pink/Polkadot Bow - db $33, FIGHTING ; Blackbelt - db $34, FLYING ; Sharp Beak - db $35, POISON ; Poison Barb - db $36, GROUND ; Soft Sand - db $37, ROCK ; Hard Stone - db $38, BUG ; Silverpowder - db $39, GHOST ; Spell Tag - db $3a, FIRE ; Charcoal - db $3b, WATER ; Mystic Water - db $3c, GRASS ; Miracle Seed - db $3d, ELECTRIC ; Magnet - db $3e, PSYCHIC ; Twistedspoon - db $3f, ICE ; Nevermeltice - db $40, DRAGON ; Dragon Scale - db $41, DARK ; Blackglasses - db $42, STEEL ; Metal Coat + 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 @@ -4303,20 +4304,20 @@ BattleCommand3f: ; 35726 .asm_35731 ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $57 ; by level (seismic toss, night shade) + cp EFFECT_LEVEL_DAMAGE ld b, [hl] ld a, 0 jr z, .asm_3578c ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $58 ; variable (psywave) + cp EFFECT_PSYWAVE jr z, .asm_35758 - cp $28 ; half hp (super fang) + cp EFFECT_SUPER_FANG jr z, .asm_3576b - cp $63 ; by hp (flail, reversal) + cp EFFECT_REVERSAL jr z, .asm_35792 ld a, BATTLE_VARS_MOVE_POWER @@ -4382,7 +4383,7 @@ BattleCommand3f: ; 35726 ld [$ffb6], a ld a, $30 ld [$ffb7], a - call $3119 + call Multiply ld a, [hli] ld b, a ld a, [hl] @@ -4410,10 +4411,10 @@ BattleCommand3f: ; 35726 .asm_357d6 ld b, $4 - call $3124 + call Divide ld a, [$ffb6] ld b, a - ld hl, .table_35807 + ld hl, .FlailPower .asm_357e1 ld a, [hli] @@ -4446,13 +4447,14 @@ BattleCommand3f: ; 35726 ld [hl], 1 ret -.table_35807 - db 1, $c8 - db 4, $96 - db 9, $64 - db 16, $50 - db 32, $28 - db 48, $14 +.FlailPower + ; px, bp + db 1, 200 + db 4, 150 + db 9, 100 + db 16, 80 + db 32, 40 + db 48, 20 ; 35813 @@ -4516,7 +4518,7 @@ BattleCommand41: ; 35864 ; encore ld hl, EnemyMonMoves - ld de, EnemyPerishCount + ld de, EnemyEncoreCount ld a, [hBattleTurn] and a jr z, .asm_35875 ; 3586d $6 @@ -4649,7 +4651,7 @@ BattleCommand42: ; 35926 ld [$d10a], a ld hl, $c55e ld a, $b - call $2d83 + call Predef ld hl, EnemyMonHPHi ld a, [hli] ld [$d1ed], a @@ -4665,7 +4667,7 @@ BattleCommand42: ; 35926 call ResetDamage ld hl, $c4ca ld a, $b - call $2d83 + call Predef ld a, $5e ld hl, $4000 rst FarCall @@ -4742,7 +4744,7 @@ BattleCommand43: ; 359d0 ; snore ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair - and $7 + and SLP ret nz call ResetDamage ld a, $1 @@ -4770,11 +4772,11 @@ BattleCommand44: ; 359e6 jr z, .asm_35a50 ; 359fd $51 push hl dec a - ld hl, $5afe + ld hl, Moves + PlayerMoveType - PlayerMoveStruct call GetMoveAttr ld d, a pop hl - cp $13 + cp CURSE_T jr z, .asm_35a50 ; 35a0b $43 call Function0x37e01 @@ -4811,7 +4813,7 @@ BattleCommand44: ; 359e6 ld a, [hl] ld [$d265], a ld a, $29 - call $2d83 + call Predef ld hl, $5452 jp FarBattleTextBox .asm_35a50 @@ -4823,13 +4825,13 @@ BattleCommand45: ; 35a53 ; lockon call CheckSubstituteOpp - jr nz, .asm_35a6e ; 35a56 $16 + jr nz, .asm_35a6e ld a, [AttackMissed] and a - jr nz, .asm_35a6e ; 35a5c $10 + jr nz, .asm_35a6e ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarPair - set 5, [hl] + set SUBSTATUS_LOCK_ON, [hl] call Function0x37e01 ld hl, TookAimText @@ -4852,13 +4854,13 @@ BattleCommand46: ; 35a74 jp PrintNothingHappened .asm_35a83 call CheckSubstituteOpp - jp nz, $5b10 + jp nz, .asm_35b10 ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarPair bit 3, [hl] - jp nz, $5b10 + jp nz, .asm_35b10 ld a, $2 - call $3945 + call UserPartyAttr ld d, h ld e, l ld hl, BattleMonMoves @@ -4873,7 +4875,7 @@ BattleCommand46: ; 35a74 ld b, a and a jr z, .asm_35b10 ; 35aaf $5f - cp $a5 + cp STRUGGLE jr z, .asm_35b10 ; 35ab3 $5b ld c, $4 .asm_35ab7 @@ -4887,7 +4889,7 @@ BattleCommand46: ; 35a74 .asm_35ac1 dec c ld a, [hld] - cp $a6 + cp SKETCH jr nz, .asm_35ac1 ; 35ac5 $fa inc hl ld a, b @@ -4895,7 +4897,7 @@ BattleCommand46: ; 35a74 push bc push hl dec a - ld hl, $5b00 + ld hl, Moves + PlayerMovePP - PlayerMoveStruct call GetMoveAttr pop hl ld bc, $0006 @@ -4932,7 +4934,7 @@ BattleCommand46: ; 35a74 add hl, de ld [hl], a .asm_35b04 - call $34f8 + call GetMoveName call Function0x37e01 ld hl, SketchedText @@ -4988,7 +4990,7 @@ BattleCommand48: ; 35b33 ld d, a jr z, .asm_35b4f ; 35b46 $7 ld hl, EnemyMonMove2 - ld a, [EnemyEncoredMove] + ld a, [EnemyDisabledMove] ld d, a .asm_35b4f ld a, BATTLE_VARS_STATUS @@ -5057,7 +5059,7 @@ BattleCommand48: ; 35b33 ld a, [DisabledMove] jr z, .asm_35bbe - ld a, [EnemyEncoredMove] + ld a, [EnemyDisabledMove] .asm_35bbe ld b, a ld a, $10 @@ -5138,7 +5140,7 @@ BattleCommand4a: ; 35c0f ld a, [AttackMissed] and a - jp nz, $5c91 + jp nz, .asm_35c91 ld bc, $0030 ld hl, EnemyMonMoves ld a, [hBattleTurn] @@ -5170,7 +5172,7 @@ BattleCommand4a: ; 35c0f and $3f jr z, .asm_35c91 ; 35c46 $49 push bc - call $34f8 + call GetMoveName call FarBattleRNG and $3 inc a @@ -5187,7 +5189,7 @@ BattleCommand4a: ; 35c0f ld [hl], a push af ld a, $17 - call $3951 + call OpponentPartyAttr ld d, b pop af pop bc @@ -5385,7 +5387,7 @@ Function0x35d1c: ; 35d1c ld a, $b call Predef .asm_35d7b - jp $39c9 + jp RefreshBattleHuds ; 35d7e @@ -5443,7 +5445,7 @@ Function0x35d7e: ; 35d7e ld a, $b call Predef .asm_35ddd - jp $39c9 + jp RefreshBattleHuds ; 35de0 @@ -5472,7 +5474,7 @@ Function0x35de0: ; 35de0 jr nc, .asm_35e3d .asm_35dff - ld a, $8 + ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVarPair res 4, [hl] @@ -5481,29 +5483,29 @@ Function0x35de0: ; 35de0 call SwitchTurn call BattleCommanda7 - ld a, $2 + ld a, BATTLE_VARS_SUBSTATUS3 call CleanGetBattleVarPair - and $60 + and $60 ; fly | dig call z, Function0x37ec7 call SwitchTurn ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarPair - cp $1d + cp EFFECT_MULTI_HIT jr z, .asm_35e3a - cp $2c + cp EFFECT_DOUBLE_HIT jr z, .asm_35e3a - cp $4d + cp EFFECT_TWINEEDLE jr z, .asm_35e3a - cp $68 + cp EFFECT_TRIPLE_KICK jr z, .asm_35e3a - cp $9a + cp EFFECT_BEAT_UP jr z, .asm_35e3a xor a ld [hl], a .asm_35e3a - call $39c9 + call RefreshBattleHuds .asm_35e3d jp ResetDamage ; 35e40 @@ -5537,7 +5539,7 @@ BattleCommand14: ; 35e5c jr nz, .asm_35e70 ; 35e62 $c ld a, [hl] ld [$d265], a - call $3468 + call GetItemName ld hl, ProtectedByText jr .asm_35ec6 @@ -5581,8 +5583,8 @@ BattleCommand14: ; 35e5c jr z, .asm_35ea4 inc a ld [de], a - call $398e - call $39c9 + call UpdateOpponentInParty + call RefreshBattleHuds ld hl, FellAsleepText call FarBattleTextBox @@ -5659,7 +5661,7 @@ BattleCommand13: ; 35eee call Function0x35ff5 ld de, $0106 call Function0x37e54 - call $39c9 + call RefreshBattleHuds ld hl, WasPoisonedText call FarBattleTextBox @@ -5692,7 +5694,7 @@ BattleCommand2f: ; 35f2c jr nz, .asm_35f5f ; 35f51 $c ld a, [hl] ld [$d265], a - call $3468 + call GetItemName ld hl, ProtectedByText jr .asm_35fb8 ; 35f5d $59 .asm_35f5f @@ -5756,22 +5758,22 @@ BattleCommand2f: ; 35f2c Function0x35fc0: ; 35fc0 call Function0x37e01 call Function0x35ff5 - jp $39c9 + jp RefreshBattleHuds ; 35fc9 Function0x35fc9: ; 35fc9 - ld a, $9 - call $39e7 + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call GetBattleVarPair ld a, [hBattleTurn] and a ld de, $c67c - jr z, .asm_35fd9 ; 0x35fd4 $3 + jr z, .asm_35fd9 ld de, $c674 .asm_35fd9 - ld a, $d + ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $21 + cp EFFECT_TOXIC ret ; 35fe1 @@ -5780,24 +5782,24 @@ Function0x35fe1: ; 35fe1 ld de, EnemyMonType1 ld a, [hBattleTurn] and a - jr z, .asm_35fec ; 0x35fe7 $3 + jr z, .asm_35fec ld de, BattleMonType1 .asm_35fec ld a, [de] inc de - cp $3 + cp POISON ret z ld a, [de] - cp $3 + cp POISON ret ; 35ff5 Function0x35ff5: ; 35ff5 - ld a, $b - call $39e7 - set 3, [hl] - jp $398e + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + set PSN, [hl] + jp UpdateOpponentInParty ; 35fff @@ -5895,8 +5897,8 @@ Function0x36011: ; 36011 ld [$d10a], a ld a, $b call Predef - call $39c9 - jp $399c + call RefreshBattleHuds + jp UpdateBattleMonInParty ; 3608c @@ -5928,12 +5930,12 @@ BattleCommand17: ; 3608c ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarPair set 4, [hl] - call $398e + call UpdateOpponentInParty ld hl, $6c76 call CallBankF ld de, $0105 call Function0x37e54 - call $39c9 + call RefreshBattleHuds ld hl, WasBurnedText call FarBattleTextBox @@ -5965,7 +5967,7 @@ Defrost: ; 360dd call GetPartyLocation xor a ld [hl], a - call $398e + call UpdateOpponentInParty ld hl, DefrostedOpponentText jp FarBattleTextBox @@ -6003,10 +6005,10 @@ BattleCommand18: ; 36102 ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarPair set 5, [hl] - call $398e + call UpdateOpponentInParty ld de, $0108 call Function0x37e54 - call $39c9 + call RefreshBattleHuds ld hl, WasFrozenText call FarBattleTextBox @@ -6054,12 +6056,12 @@ BattleCommand19: ; 36165 ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarPair set 6, [hl] - call $398e + call UpdateOpponentInParty ld hl, $6c39 call CallBankF ld de, $0109 call Function0x37e54 - call $39c9 + call RefreshBattleHuds call PrintParalyze ld hl, $5de9 jp CallBankF @@ -6418,27 +6420,27 @@ Function0x36386: ; 36386 Function0x36391: ; 36391 - ld a, $d + ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $12 - jr c, .asm_363ae ; 0x36398 $14 - cp $19 - jr c, .asm_363b0 ; 0x3639c $12 - cp $3a - jr c, .asm_363ae ; 0x363a0 $c - cp $41 - jr c, .asm_363b0 ; 0x363a4 $a - cp $44 - jr c, .asm_363ae ; 0x363a8 $4 - cp $4b - jr c, .asm_363b0 ; 0x363ac $2 + cp EFFECT_ATTACK_DOWN + jr c, .asm_363ae + cp EFFECT_EVASION_DOWN + 1 + jr c, .asm_363b0 + cp EFFECT_ATTACK_DOWN_2 + jr c, .asm_363ae + cp EFFECT_EVASION_DOWN_2 + 1 + jr c, .asm_363b0 + cp EFFECT_ATTACK_DOWN_HIT + jr c, .asm_363ae + cp EFFECT_EVASION_DOWN_HIT + 1 + jr c, .asm_363b0 .asm_363ae xor a ret .asm_363b0 - ld a, $8 + ld a, BATTLE_VARS_SUBSTATUS4_OPP call CleanGetBattleVarPair - bit 1, a + bit SUBSTATUS_MIST, a ret ; 363b8 @@ -6937,11 +6939,11 @@ BattleCommand21: ; 36671 ld hl, PlayerRolloutCount ld a, [hBattleTurn] and a - jr z, .asm_36684 ; 3667f $3 + jr z, .asm_36684 ld hl, EnemyRolloutCount .asm_36684 dec [hl] - jr nz, .asm_366dc ; 36685 $55 + jr nz, .asm_366dc ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair res 0, [hl] @@ -6951,14 +6953,14 @@ BattleCommand21: ; 36671 ld a, BATTLE_VARS_MOVE_POWER call GetBattleVarPair - ld a, $1 + ld a, 1 ld [hl], a - ld hl, EnemyDamageTaken + ld hl, PlayerDamageTaken + 1 ld de, $c732 ld a, [hBattleTurn] and a - jr z, .asm_366ad ; 366a5 $6 - ld hl, $c685 + jr z, .asm_366ad + ld hl, EnemyDamageTaken + 1 ld de, $c733 .asm_366ad ld a, [hld] @@ -6968,23 +6970,24 @@ BattleCommand21: ; 36671 ld a, [hl] rl a ld [CurDamage], a - jr nc, .asm_366c3 ; 366b9 $8 + jr nc, .asm_366c3 ld a, $ff ld [CurDamage], a ld [CurDamage + 1], a .asm_366c3 or b - jr nz, .asm_366cb ; 366c4 $5 - ld a, $1 + jr nz, .asm_366cb + ld a, 1 ld [AttackMissed], a .asm_366cb xor a ld [hli], a ld [hl], a ld [de], a + ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVarPair - ld a, $75 + ld a, BIDE ld [hl], a ld b, $22 ; unleashenergy @@ -7098,17 +7101,18 @@ BattleCommanda0: ; 36778 ; teleport ld a, [BattleType] - cp $7 ; BATTLE_SHINY + cp BATTLETYPE_SHINY jr z, .asm_367b9 - cp $9 ; ? + cp $9 jr z, .asm_367b9 - cp $b ; ? + cp $b jr z, .asm_367b9 - cp $c ; suicune + cp BATTLETYPE_SUICUNE jr z, .asm_367b9 + ld a, BATTLE_VARS_SUBSTATUS5_OPP call CleanGetBattleVarPair - bit 7, a + bit SUBSTATUS_CANT_RUN, a jr nz, .asm_367b9 ld a, [hBattleTurn] and a @@ -7158,7 +7162,7 @@ BattleCommanda0: ; 36778 cp b jr nc, .asm_367df ; 367dd $0 .asm_367df - call $399c + call UpdateBattleMonInParty xor a ld [$cfca], a inc a @@ -7167,7 +7171,7 @@ BattleCommanda0: ; 36778 call Function0x36804 call BattleCommand0a call Function0x37e36 - ld c, $14 + ld c, 20 call DelayFrames call Function0x36804 @@ -7189,13 +7193,13 @@ BattleCommand23: ; 3680f ; forceswitch ld a, [BattleType] - cp $7 + cp BATTLETYPE_SHINY jp z, .asm_36969 cp $9 jp z, .asm_36969 cp $b jp z, .asm_36969 - cp $c + cp BATTLETYPE_SUICUNE jp z, .asm_36969 ld a, [hBattleTurn] and a @@ -7225,7 +7229,7 @@ BattleCommand23: ; 3680f .asm_36852 jp .asm_36969 .asm_36855 - call $399c + call UpdateBattleMonInParty xor a ld [$cfca], a inc a @@ -7239,7 +7243,7 @@ BattleCommand23: ; 3680f ld a, [$c70f] and a jr z, .asm_368ca ; 36872 $56 - call $39b0 + call UpdateEnemyMonInParty ld a, $1 ld [$c689], a call Function0x37e01 @@ -7318,7 +7322,7 @@ BattleCommand23: ; 3680f jr .asm_36969 .asm_368f5 - call $399c + call UpdateBattleMonInParty xor a ld [$cfca], a inc a @@ -7335,7 +7339,7 @@ BattleCommand23: ; 3680f cp $1 jr z, .asm_368ca - call $399c + call UpdateBattleMonInParty ld a, $1 ld [$c689], a call Function0x37e01 @@ -7453,7 +7457,7 @@ BattleCommand24: ; 369b6 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair bit 2, [hl] - jp nz, $6a43 + jp nz, .asm_36a43 set 2, [hl] ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarPair @@ -7519,6 +7523,8 @@ BattleCommand24: ; 369b6 .asm_36a3f ld a, $1 jr .asm_36a3a ; 36a41 $f7 + +.asm_36a43 ld a, [de] dec a ld [de], a @@ -8016,8 +8022,8 @@ BattleCommand27: ; 36cb2 .asm_36d0c ld [$d10a], a ld a, $b - call $2d83 - call $39c9 + call Predef + call RefreshBattleHuds ld hl, RecoilText jp FarBattleTextBox ; 36d1d @@ -8053,7 +8059,7 @@ BattleCommand2a: ; 36d3b jr nz, .asm_36d53 ld a, [hl] ld [$d265], a - call $3468 + call GetItemName call Function0x37e77 ld hl, ProtectedByText jp FarBattleTextBox @@ -8150,7 +8156,7 @@ BattleCommand30: ; 36dc7 jr nz, .asm_36def ; 36ddd $10 ld a, [hl] ld [$d265], a - call $3468 + call GetItemName call Function0x37e77 ld hl, ProtectedByText jp FarBattleTextBox @@ -8188,10 +8194,10 @@ BattleCommand30: ; 36dc7 ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarPair set 6, [hl] - call $398e + call UpdateOpponentInParty ld hl, $6c39 call CallBankF - call $39d4 + call UpdateBattleHuds call PrintParalyze ld hl, $5de9 jp CallBankF @@ -8310,7 +8316,7 @@ BattleCommand31: ; 36e7c .asm_36eeb ld hl, MadeSubstituteText call FarBattleTextBox - jp $39c9 + jp RefreshBattleHuds .asm_36ef4 call Function0x34548 call nz, BattleCommand0c @@ -8431,7 +8437,7 @@ BattleCommand33: ; 36f46 ld bc, $0006 add hl, bc ld [hl], $5 - call $34f8 + call GetMoveName call Function0x37e01 ld hl, LearnedMoveText jp FarBattleTextBox @@ -8493,7 +8499,7 @@ BattleCommand37: ; 36fed ld a, [AttackMissed] and a jr nz, .asm_37059 ; 36ff1 $66 - ld de, EnemyEncoreCount + ld de, EnemyDisableCount ld hl, EnemyMonMoves ld a, [hBattleTurn] and a @@ -8548,7 +8554,7 @@ BattleCommand37: ; 36fed call CleanGetBattleVarPair ld [hl], a ld [$d265], a - call $34f8 + call GetMoveName ld hl, WasDisabledText jp FarBattleTextBox .asm_37059 @@ -8608,7 +8614,7 @@ BattleCommand1f: ; 3707f push hl push bc dec a - ld hl, $5afe + ld hl, Moves + PlayerMoveType - PlayerMoveStruct call GetMoveAttr ld [de], a inc de @@ -8784,8 +8790,8 @@ BattleCommand2c: ; 3713e ld hl, $4cef call CallBankF call SwitchTurn - call $3995 - call $39c9 + call UpdateUserInParty + call RefreshBattleHuds ld hl, RegainedHealthText jp FarBattleTextBox @@ -8976,8 +8982,8 @@ Function0x372e7: ; 372e7 jr z, .player xor a - ld [EnemyEncoreCount], a - ld [EnemyEncoredMove], a + ld [EnemyDisableCount], a + ld [EnemyDisabledMove], a ret .player @@ -9141,7 +9147,7 @@ BattleCommand1a: ; 37380 ld hl, $6043 rst FarCall call $31f6 - jp $39c9 + jp RefreshBattleHuds ; 373c9 @@ -9174,7 +9180,7 @@ BattleCommand1b: ; 373c9 pop af dec a call GetMoveData - call $34f8 + call GetMoveName call $30d6 call Function0x34548 jr nz, .asm_37412 ; 37405 $b @@ -9360,7 +9366,7 @@ BattleCommand50: ; 37492 ld [hl], a ld [de], a .asm_374f8 - call $3468 + call GetItemName ld hl, StoleText jp FarBattleTextBox @@ -9441,10 +9447,10 @@ BattleCommand53: ; 37563 jr z, .asm_3757f ; 37576 $7 .asm_37578 ld a, $20 - call $3945 + call UserPartyAttr res 5, [hl] .asm_3757f - call $39c9 + call RefreshBattleHuds ld hl, WasDefrostedText jp FarBattleTextBox ; 37588 @@ -9505,7 +9511,7 @@ BattleCommand54: ; 37588 call CallBankF ld hl, $4c3f call CallBankF - call $3995 + call UpdateUserInParty ld hl, PutACurseText jp FarBattleTextBox .asm_37604 @@ -9539,8 +9545,8 @@ Function0x3762c: ; 3762c ld a, [hBattleTurn] and a jr z, .asm_37637 + ld de, $c681 - ld de, PlayerDamageTaken .asm_37637 call Function0x36abf jr nz, .asm_37665 @@ -9596,10 +9602,10 @@ BattleCommand5a: ; 3766f call Function0x3762c ret c -; get substatus1 + ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarPair - set 5, [hl] ; endure + set SUBSTATUS_ENDURE, [hl] call Function0x37e01 ld hl, BracedItselfText jp FarBattleTextBox @@ -9612,16 +9618,19 @@ BattleCommand56: ; 37683 ld hl, EnemyScreens ld a, [hBattleTurn] and a - jr z, .asm_3768e ; 37689 $3 + jr z, .asm_3768e ld hl, PlayerScreens + .asm_3768e bit 0, [hl] - jr nz, .asm_3769d ; 37690 $b + jr nz, .failed + set 0, [hl] call Function0x37e01 ld hl, SpikesText jp FarBattleTextBox -.asm_3769d + +.failed jp Function0x37354 ; 376a0 @@ -9631,14 +9640,14 @@ BattleCommand57: ; 376a0 ld a, [AttackMissed] and a - jr nz, .asm_376bf ; 376a4 $19 + jr nz, .asm_376bf call CheckHiddenOpponent - jr nz, .asm_376bf ; 376a9 $14 + jr nz, .asm_376bf ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVarPair - bit 3, [hl] - jr nz, .asm_376bf ; 376b2 $b - set 3, [hl] + bit SUBSTATUS_IDENTIFIED, [hl] + jr nz, .asm_376bf + set SUBSTATUS_IDENTIFIED, [hl] call Function0x37e01 ld hl, IdentifiedText jp FarBattleTextBox @@ -9652,25 +9661,25 @@ BattleCommand58: ; 376c2 ld hl, PlayerSubStatus1 ld de, EnemySubStatus1 - bit 4, [hl] - jr z, .asm_376d1 ; 376ca $5 + bit SUBSTATUS_PERISH, [hl] + jr z, .asm_376d1 ld a, [de] - bit 4, a - jr nz, .asm_376f2 ; 376cf $21 + bit SUBSTATUS_PERISH, a + jr nz, .asm_376f2 .asm_376d1 - bit 4, [hl] - jr nz, .asm_376dc ; 376d3 $7 - set 4, [hl] - ld a, $4 + bit SUBSTATUS_PERISH, [hl] + jr nz, .asm_376dc + set SUBSTATUS_PERISH, [hl] + ld a, 4 ld [PlayerPerishCount], a .asm_376dc ld a, [de] - bit 4, a - jr nz, .asm_376e9 ; 376df $8 - set 4, a + bit SUBSTATUS_PERISH, a + jr nz, .asm_376e9 + set SUBSTATUS_PERISH, a ld [de], a - ld a, $4 - ld [$c67f], a + ld a, 4 + ld [EnemyPerishCount], a .asm_376e9 call Function0x37e01 ld hl, StartPerishText @@ -9706,13 +9715,13 @@ BattleCommand5b: ; 37718 ld de, PlayerRolloutCount ld a, [hBattleTurn] and a - jr z, .asm_37723 ; 3771e $3 + jr z, .asm_37723 ld de, EnemyRolloutCount .asm_37723 ld a, BATTLE_VARS_SUBSTATUS1 call CleanGetBattleVarPair - bit 6, a - jr z, .asm_37731 ; 3772a $5 + bit SUBSTATUS_ENCORED, a + jr z, .asm_37731 ld b, $4 ; doturn jp SkipToBattleCommand @@ -9962,11 +9971,11 @@ BattleCommand60: ; 3784b ld [$ffb6], a ld a, $a ld [$ffb7], a - call $3119 + call Multiply ld a, $19 ld [$ffb7], a ld b, $4 - call $3124 + call Divide ld a, [$ffb6] ld d, a pop bc @@ -10041,7 +10050,7 @@ BattleCommand61: ; 37874 ld hl, RegainedHealthText call FarBattleTextBox call SwitchTurn - call $398e + call UpdateOpponentInParty jr .asm_37904 ; 378f1 $11 .asm_378f3 call SwitchTurn @@ -10079,11 +10088,11 @@ BattleCommand63: ; 3790e ld [$ffb5], a ld a, $a ld [$ffb7], a - call $3119 + call Multiply ld a, $19 ld [$ffb7], a ld b, $4 - call $3124 + call Divide ld a, [$ffb6] ld d, a pop bc @@ -10199,7 +10208,7 @@ BattleCommand67: ; 379c9 call Function0x37ae9 jp z, Function0x37aab - call $399c + call UpdateBattleMonInParty call Function0x37e01 ld c, 50 @@ -10253,7 +10262,7 @@ BattleCommand67: ; 379c9 call Function0x37af6 jp z, Function0x37aab - call $39b0 + call UpdateEnemyMonInParty call Function0x37e01 call Function0x37a82 @@ -10564,7 +10573,7 @@ BattleCommand6a6c: ; 37b7e rst FarCall ; callab 3ccef call SwitchTurn - call $3995 + call UpdateUserInParty ; 'regained health!' ld hl, RegainedHealthText @@ -10646,7 +10655,7 @@ BattleCommand95: ; 37c1a ld hl, $4c3f ld a, $f rst FarCall - call $3995 + call UpdateUserInParty ld a, $5 .asm_37c41 @@ -10943,13 +10952,13 @@ GetItem: ; 37dd0 ret z push hl - ld hl, $67c3 ; Items + ld hl, ItemAttributes + 2 dec a ld c, a ld b, 0 - ld a, 7 + ld a, Item2Attributes - Item1Attributes call AddNTimes - ld a, $1 ; BANK(Items) + ld a, BANK(ItemAttributes) call GetFarHalfword ld b, l ld c, h diff --git a/constants.asm b/constants.asm index b764c8585..cd461b3b9 100644 --- a/constants.asm +++ b/constants.asm @@ -1464,6 +1464,26 @@ MAP_ROUTE_30_BERRY_SPEECH_HOUSE EQU $09 MAP_MR_POKEMONS_HOUSE EQU $0a MAP_ROUTE_31_VIOLET_GATE EQU $0b + +; elevator floors +_B4F EQU $0 +_B3F EQU $1 +_B2F EQU $2 +_B1F EQU $3 +_1F EQU $4 +_2F EQU $5 +_3F EQU $6 +_4F EQU $7 +_5F EQU $8 +_6F EQU $9 +_7F EQU $a +_8F EQU $b +_9F EQU $c +_10F EQU $d +_11F EQU $e +_ROOF EQU $f + + ; item constants NO_ITEM EQU $00 MASTER_BALL EQU $01 @@ -1689,6 +1709,58 @@ HM_05 EQU $F7 HM_06 EQU $F8 HM_07 EQU $F9 +NUM_TMS EQU HM_01 - TM_01 - 2 + +; pockets +ITEM EQU 1 +KEY_ITEM EQU 2 +BALL EQU 3 +TM_HM EQU 4 + +; item actions +CANT_SELECT EQU %01000000 +CANT_TOSS EQU %10000000 + +; held item effects +HELD_BERRY EQU $01 +HELD_LEFTOVERS EQU $03 +HELD_RESTORE_PP EQU $06 +HELD_CLEANSE_TAG EQU $08 +HELD_HEAL_POISON EQU $0a +HELD_HEAL_FREEZE EQU $0b +HELD_HEAL_BURN EQU $0c +HELD_HEAL_SLEEP EQU $0d +HELD_HEAL_PARALYZE EQU $0e +HELD_HEAL_STATUS EQU $0f +HELD_HEAL_CONFUSION EQU $10 +HELD_METAL_POWDER EQU $2a +HELD_NORMAL_BOOST EQU $32 +HELD_FIGHTING_BOOST EQU $33 +HELD_FLYING_BOOST EQU $34 +HELD_POISON_BOOST EQU $35 +HELD_GROUND_BOOST EQU $36 +HELD_ROCK_BOOST EQU $37 +HELD_BUG_BOOST EQU $38 +HELD_GHOST_BOOST EQU $39 +HELD_FIRE_BOOST EQU $3a +HELD_WATER_BOOST EQU $3b +HELD_GRASS_BOOST EQU $3c +HELD_ELECTRIC_BOOST EQU $3d +HELD_PSYCHIC_BOOST EQU $3e +HELD_ICE_BOOST EQU $3f +HELD_DRAGON_BOOST EQU $40 +HELD_DARK_BOOST EQU $41 +HELD_STEEL_BOOST EQU $42 +HELD_ESCAPE EQU $48 +HELD_CRITICAL_UP EQU $49 +HELD_QUICK_CLAW EQU $4a +HELD_TRADE_EVOLVE EQU $4b +HELD_AMULET_COIN EQU $4c +HELD_BRIGHTPOWDER EQU $4d +HELD_FOCUS_BAND EQU $4f + + + ; days of the week SUNDAY EQU $00 MONDAY EQU $01 @@ -2336,6 +2408,7 @@ EVOLVE_TRADE EQU 3 EVOLVE_HAPPINESS EQU 4 EVOLVE_STAT EQU 5 +BASE_HAPPINESS EQU 70 ; happiness evolution triggers HAPPINESS_TO_EVOLVE EQU 220 TR_ANYTIME EQU 1 @@ -3252,6 +3325,219 @@ MUSIC_MOBILE_CENTER EQU 102 MUSIC_MAHOGANY_MART EQU 100 ; grandfathered from gold + + +; sfx +SFX_DEX_FANFARE_50_79 EQU $00 +SFX_ITEM EQU $01 +SFX_CAUGHT_MON EQU $02 +SFX_POKEBALLS_PLACED_ON_TABLE EQU $03 +SFX_POTION EQU $04 +SFX_FULL_HEAL EQU $05 +SFX_MENU EQU $06 +SFX_READ_TEXT EQU $07 +SFX_READ_TEXT_2 EQU $08 +SFX_DEX_FANFARE_20_49 EQU $09 +SFX_DEX_FANFARE_80_109 EQU $0a +SFX_POISON EQU $0b +SFX_GOT_SAFARI_BALLS EQU $0c +SFX_BOOT_PC EQU $0d +SFX_SHUT_DOWN_PC EQU $0e +SFX_CHOOSE_PC_OPTION EQU $0f +SFX_ESCAPE_ROPE EQU $10 +SFX_PUSH_BUTTON EQU $11 +SFX_SECOND_PART_OF_ITEMFINDER EQU $12 +SFX_WARP_TO EQU $13 +SFX_WARP_FROM EQU $14 +SFX_CHANGE_DEX_MODE EQU $15 +SFX_JUMP_OVER_LEDGE EQU $16 +SFX_GRASS_RUSTLE EQU $17 +SFX_FLY EQU $18 +SFX_WRONG EQU $19 +SFX_SQUEAK EQU $1a +SFX_STRENGTH EQU $1b +SFX_BOAT EQU $1c +SFX_WALL_OPEN EQU $1d +SFX_PLACE_PUZZLE_PIECE_DOWN EQU $1e +SFX_ENTER_DOOR EQU $1f +SFX_SWITCH_POKEMON EQU $20 +SFX_TALLY EQU $21 +SFX_TRANSACTION EQU $22 +SFX_EXIT_BUILDING EQU $23 +SFX_BUMP EQU $24 +SFX_SAVE EQU $25 +SFX_POKEFLUTE EQU $26 +SFX_ELEVATOR_END EQU $27 +SFX_THROW_BALL EQU $28 +SFX_BALL_POOF EQU $29 +SFX_UNKNOWN_3A EQU $2a +SFX_RUN EQU $2b +SFX_SLOT_MACHINE_START EQU $2c +SFX_FANFARE EQU $2d +SFX_PECK EQU $2e +SFX_KINESIS EQU $2f +SFX_LICK EQU $30 +SFX_POUND EQU $31 +SFX_MOVE_PUZZLE_PIECE EQU $32 +SFX_COMET_PUNCH EQU $33 +SFX_MEGA_PUNCH EQU $34 +SFX_SCRATCH EQU $35 +SFX_VICEGRIP EQU $36 +SFX_RAZOR_WIND EQU $37 +SFX_CUT EQU $38 +SFX_WING_ATTACK EQU $39 +SFX_WHIRLWIND EQU $3a +SFX_BIND EQU $3b +SFX_VINE_WHIP EQU $3c +SFX_DOUBLE_KICK EQU $3d +SFX_MEGA_KICK EQU $3e +SFX_HEADBUTT EQU $3f +SFX_HORN_ATTACK EQU $40 +SFX_TACKLE EQU $41 +SFX_POISON_STING EQU $42 +SFX_POWDER EQU $43 +SFX_DOUBLESLAP EQU $44 +SFX_BITE EQU $45 +SFX_JUMP_KICK EQU $46 +SFX_STOMP EQU $47 +SFX_TAIL_WHIP EQU $48 +SFX_KARATE_CHOP EQU $49 +SFX_SUBMISSION EQU $4a +SFX_WATER_GUN EQU $4b +SFX_SWORDS_DANCE EQU $4c +SFX_THUNDER EQU $4d +SFX_SUPERSONIC EQU $4e +SFX_LEER EQU $4f +SFX_EMBER EQU $50 +SFX_BUBBLEBEAM EQU $51 +SFX_HYDRO_PUMP EQU $52 +SFX_SURF EQU $53 +SFX_PSYBEAM EQU $54 +SFX_CHARGE EQU $55 +SFX_THUNDERSHOCK EQU $56 +SFX_PSYCHIC EQU $57 +SFX_SCREECH EQU $58 +SFX_BONE_CLUB EQU $59 +SFX_SHARPEN EQU $5a +SFX_EGG_BOMB EQU $5b +SFX_SING EQU $5c +SFX_HYPER_BEAM EQU $5d +SFX_SHINE EQU $5e +SFX_UNKNOWN_5F EQU $5f +SFX_UNKNOWN_60 EQU $60 +SFX_UNKNOWN_61 EQU $61 +SFX_UNKNOWN_62 EQU $62 +SFX_UNKNOWN_63 EQU $63 +SFX_BURN EQU $64 +SFX_TITLE_SCREEN_ENTRANCE EQU $65 +SFX_UNKNOWN_66 EQU $66 +SFX_GET_COIN_FROM_SLOTS EQU $67 +SFX_PAY_DAY EQU $68 +SFX_METRONOME EQU $69 +SFX_CALL EQU $6a +SFX_HANG_UP EQU $6b +SFX_NO_SIGNAL EQU $6c +SFX_SANDSTORM EQU $6d +SFX_ELEVATOR EQU $6e +SFX_PROTECT EQU $6f +SFX_SKETCH EQU $70 +SFX_RAIN_DANCE EQU $71 +SFX_AEROBLAST EQU $72 +SFX_SPARK EQU $73 +SFX_CURSE EQU $74 +SFX_RAGE EQU $75 +SFX_THIEF EQU $76 +SFX_THIEF_2 EQU $77 +SFX_SPIDER_WEB EQU $78 +SFX_MIND_READER EQU $79 +SFX_NIGHTMARE EQU $7a +SFX_SNORE EQU $7b +SFX_SWEET_KISS EQU $7c +SFX_SWEET_KISS_2 EQU $7d +SFX_BELLY_DRUM EQU $7e +SFX_UNKNOWN_7F EQU $7f +SFX_SLUDGE_BOMB EQU $80 +SFX_FORESIGHT EQU $81 +SFX_SPITE EQU $82 +SFX_OUTRAGE EQU $83 +SFX_PERISH_SONG EQU $84 +SFX_GIGA_DRAIN EQU $85 +SFX_ATTRACT EQU $86 +SFX_KINESIS_2 EQU $87 +SFX_ZAP_CANNON EQU $88 +SFX_MEAN_LOOK EQU $89 +SFX_HEAL_BELL EQU $8a +SFX_RETURN EQU $8b +SFX_EXP_BAR EQU $8c +SFX_MILK_DRINK EQU $8d +SFX_PRESENT EQU $8e +SFX_MORNING_SUN EQU $8f +SFX_LEVEL_UP EQU $90 +SFX_KEY_ITEM EQU $91 +SFX_FANFARE_2 EQU $92 +SFX_REGISTER_PHONE_# EQU $93 +SFX_3RD_PLACE EQU $94 +SFX_GET_EGG_FROM_DAYCARE_MAN EQU $95 +SFX_GET_EGG_FROM_DAYCARE_LADY EQU $96 +SFX_MOVE_DELETED EQU $97 +SFX_2ND_PLACE EQU $98 +SFX_1ST_PLACE EQU $99 +SFX_CHOOSE_A_CARD EQU $9a +SFX_GET_TM EQU $9b +SFX_GET_BADGE EQU $9c +SFX_QUIT_SLOTS EQU $9d +SFX_EGG_CRACK EQU $9e +SFX_DEX_FANFARE_LESS_THAN_20 EQU $9f +SFX_DEX_FANFARE_140_169 EQU $a0 +SFX_DEX_FANFARE_170_199 EQU $a1 +SFX_DEX_FANFARE_200_229 EQU $a2 +SFX_DEX_FANFARE_230_PLUS EQU $a3 +SFX_EVOLVED EQU $a4 +SFX_MASTER_BALL EQU $a5 +SFX_EGG_HATCH EQU $a6 +SFX_GS_INTRO_CHARIZARD_FIREBALL EQU $a7 +SFX_GS_INTRO_POKEMON_APPEARS EQU $a8 +SFX_FLASH EQU $a9 +SFX_GAME_FREAK_LOGO_GS EQU $aa +SFX_NOT_VERY_EFFECTIVE EQU $ab +SFX_DAMAGE EQU $ac +SFX_SUPER_EFFECTIVE EQU $ad +SFX_BALL_BOUNCE EQU $ae +SFX_MOONLIGHT EQU $af +SFX_ENCORE EQU $b0 +SFX_BEAT_UP EQU $b1 +SFX_BATON_PASS EQU $b2 +SFX_BALL_WIGGLE EQU $b3 +SFX_SWEET_SCENT EQU $b4 +SFX_SWEET_SCENT_2 EQU $b5 +SFX_HIT_END_OF_EXP_BAR EQU $b6 +SFX_GIVE_TRADEMON EQU $b7 +SFX_GET_TRADEMON EQU $b8 +SFX_TRAIN_ARRIVED EQU $b9 +SFX_STOP_SLOT EQU $ba +SFX_2_BOOPS EQU $bb +SFX_GLASS_TING EQU $bc +SFX_GLASS_TING_2 EQU $bd +SFX_INTRO_UNOWN_1 EQU $be +SFX_INTRO_UNOWN_2 EQU $bf +SFX_INTRO_UNOWN_3 EQU $c0 +SFX_DITTO_POP_UP EQU $c1 +SFX_DITTO_TRANSFORM EQU $c2 +SFX_INTRO_SUICUNE_1 EQU $c3 +SFX_INTRO_PICHU EQU $c4 +SFX_INTRO_SUICUNE_2 EQU $c5 +SFX_INTRO_SUICUNE_3 EQU $c6 +SFX_DITTO_BOUNCE EQU $c7 +SFX_INTRO_SUICUNE_4 EQU $c8 +SFX_GAME_FREAK_PRESENTS EQU $c9 +SFX_TINGLE EQU $ca +SFX_UNKNOWN_CB EQU $cb +SFX_TWO_PC_BEEPS EQU $cc +SFX_4_NOTE_DITTY EQU $cd +SFX_TWINKLE EQU $ce + + + ; sound _4CH1 EQU $c0 _3CH1 EQU $80 @@ -3359,6 +3645,7 @@ SPECIAL_MONCHECK EQU $0097 ; predefs +PREDEF_FLAG EQU $03 PREDEF_FILLPP EQU $05 PREDEF_ADDPARTYMON EQU $06 PREDEF_FILLSTATS EQU $0C @@ -3366,6 +3653,12 @@ PREDEF_FILLMOVES EQU $1B PREDEF_GETUNOWNLETTER EQU $2D +; flag manipulation +RESET_FLAG EQU 0 +SET_FLAG EQU 1 +CHECK_FLAG EQU 2 + + ; script vars NUM_VARS EQU $1b VAR_MOVEMENT EQU $08 @@ -3450,6 +3743,7 @@ SUBSTATUS_IN_LOVE EQU 7 SUBSTATUS_ENCORED EQU 6 SUBSTATUS_ENDURE EQU 5 SUBSTATUS_PERISH EQU 4 +SUBSTATUS_IDENTIFIED EQU 3 SUBSTATUS_PROTECT EQU 2 SUBSTATUS_CURSE EQU 1 SUBSTATUS_NIGHTMARE EQU 0 @@ -3469,18 +3763,28 @@ SUBSTATUS_RAGE EQU 6 SUBSTATUS_RECHARGE EQU 5 SUBSTATUS_SUBSTITUTE EQU 4 SUBSTATUS_FOCUS_ENERGY EQU 2 +SUBSTATUS_MIST EQU 1 SUBSTATUS_UNLEASH EQU 0 +SUBSTATUS_CANT_RUN EQU 7 SUBSTATUS_DESTINY_BOND EQU 6 SUBSTATUS_LOCK_ON EQU 5 +SUBSTATUS_TOXIC EQU 0 + + +SCREENS_REFLECT EQU 4 +SCREENS_LIGHT_SCREEN EQU 3 +SCREENS_SAFEGUARD EQU 2 +SCREENS_SPIKES EQU 0 ; status -SLP EQU 7 -PSN EQU 1 << 3 -BRN EQU 1 << 4 -FRZ EQU 1 << 5 -PAR EQU 1 << 6 +SLP EQU 7 ; 7 turns + +PSN EQU 3 +BRN EQU 4 +FRZ EQU 5 +PAR EQU 6 @@ -3522,13 +3826,13 @@ EFFECT_TOXIC EQU $21 EFFECT_PAY_DAY EQU $22 EFFECT_LIGHT_SCREEN EQU $23 EFFECT_TRI_ATTACK EQU $24 -; unused EQU $25 +EFFECT_UNUSED_25 EQU $25 ; unused EFFECT_OHKO EQU $26 EFFECT_RAZOR_WIND EQU $27 EFFECT_SUPER_FANG EQU $28 EFFECT_STATIC_DAMAGE EQU $29 EFFECT_BIND EQU $2a -; unused EQU $2b +EFFECT_UNUSED_2B EQU $2b ; unused EFFECT_DOUBLE_HIT EQU $2c EFFECT_JUMP_KICK EQU $2d EFFECT_MIST EQU $2e @@ -3563,7 +3867,7 @@ EFFECT_EVASION_DOWN_HIT EQU $4a EFFECT_SKY_ATTACK EQU $4b EFFECT_CONFUSE_HIT EQU $4c EFFECT_TWINEEDLE EQU $4d -; unused EQU $4e +EFFECT_UNUSED_4E EQU $4e ; unused EFFECT_SUBSTITUTE EQU $4f EFFECT_HYPER_BEAM EQU $50 EFFECT_RAGE EQU $51 @@ -3595,7 +3899,7 @@ EFFECT_MEAN_LOOK EQU $6a EFFECT_NIGHTMARE EQU $6b EFFECT_FLAME_WHEEL EQU $6c EFFECT_CURSE EQU $6d -; unused EQU $6e +EFFECT_UNUSED_6E EQU $6e ; unused EFFECT_PROTECT EQU $6f EFFECT_SPIKES EQU $70 EFFECT_FORESIGHT EQU $71 @@ -3615,8 +3919,8 @@ EFFECT_MAGNITUDE EQU $7e EFFECT_BATON_PASS EQU $7f EFFECT_PURSUIT EQU $80 EFFECT_RAPID_SPIN EQU $81 -; unused EQU $82 -; unused EQU $83 +EFFECT_UNUSED_82 EQU $82 ; unused +EFFECT_UNUSED_83 EQU $83 ; unused EFFECT_MORNING_SUN EQU $84 EFFECT_SYNTHESIS EQU $85 EFFECT_MOONLIGHT EQU $86 diff --git a/extras/chars.py b/extras/chars.py index 159a479a7..1bc25dbe7 100644 --- a/extras/chars.py +++ b/extras/chars.py @@ -99,6 +99,7 @@ chars = { 0xEA: "é", 0xEB: "→", 0xED: "▶", + 0xEE: "▼", 0xEF: "♂", 0xF0: "¥", 0xF1: "×", diff --git a/extras/crystal.py b/extras/crystal.py index 790125222..680a441e3 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -1475,7 +1475,7 @@ ScriptPointerLabelAfterBank.parse = _parse_script_pointer_bytes class PointerLabelToScriptPointer(PointerLabelParam): def parse(self): PointerLabelParam.parse(self) - address = calculate_pointer_from_bytes_at(self.address, bank=self.bank) + address = calculate_pointer_from_bytes_at(self.parsed_address, bank=self.bank) address2 = calculate_pointer_from_bytes_at(address, bank="reverse") # maybe not "reverse"? self.script = parse_script_engine_script_at(address2, origin=False, map_group=self.map_group, map_id=self.map_id, force=self.force, debug=self.debug) @@ -1,5 +1,26 @@ ; Graciously aped from http://nocash.emubase.de/pandocs.htm . +; MBC3 +MBC3SRamEnable EQU $0000 +MBC3RomBank EQU $2000 +MBC3SRamBank EQU $4000 +MBC3LatchClock EQU $6000 +MBC3RTC EQU $a000 + +SRAM_DISABLE EQU $00 +SRAM_ENABLE EQU $0a + +RTC_S EQU $08 ; Seconds 0-59 (0-3Bh) +RTC_M EQU $09 ; Minutes 0-59 (0-3Bh) +RTC_H EQU $0a ; Hours 0-23 (0-17h) +RTC_DL EQU $0b ; Lower 8 bits of Day Counter (0-FFh) +RTC_DH EQU $0c ; Upper 1 bit of Day Counter, Carry Bit, Halt Flag + ; Bit 0 Most significant bit of Day Counter (Bit 8) + ; Bit 6 Halt (0=Active, 1=Stop Timer) + ; Bit 7 Day Counter Carry Bit (1=Counter Overflow) + + +; Hardware registers rJOYP EQU $ff00 ; Joypad (R/W) rSB EQU $ff01 ; Serial transfer data (R/W) rSC EQU $ff02 ; Serial Transfer Control (R/W) diff --git a/items/item_attributes.asm b/items/item_attributes.asm new file mode 100644 index 000000000..94043c32d --- /dev/null +++ b/items/item_attributes.asm @@ -0,0 +1,2053 @@ +Item1Attributes: + +; MASTER BALL + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +Item2Attributes: + +; ULTRA BALL + dw 1200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; BRIGHTPOWDER + dw 10 ; price + db HELD_BRIGHTPOWDER ; effect + db 20 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; GREAT BALL + dw 600 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; # BALL + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; BICYCLE + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_TOSS + db KEY_ITEM + db $60 ; overworld + +; MOON STONE + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; ANTIDOTE + dw 100 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; BURN HEAL + dw 250 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; ICE HEAL + dw 250 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; AWAKENING + dw 250 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; PARLYZ HEAL + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; FULL RESTORE + dw 3000 ; price + db NONE ; effect + db 255 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; MAX POTION + dw 2500 ; price + db NONE ; effect + db 255 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; HYPER POTION + dw 1200 ; price + db NONE ; effect + db 200 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; SUPER POTION + dw 700 ; price + db NONE ; effect + db 50 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; POTION + dw 300 ; price + db NONE ; effect + db 20 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; ESCAPE ROPE + dw 550 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $60 ; overworld + +; REPEL + dw 350 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $40 ; current menu + +; MAX ELIXER + dw 4500 ; price + db NONE ; effect + db 255 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; FIRE STONE + dw 2100 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; THUNDERSTONE + dw 2100 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; WATER STONE + dw 2100 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; HP UP + dw 9800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; PROTEIN + dw 9800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; IRON + dw 9800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; CARBOS + dw 9800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; LUCKY PUNCH + dw 10 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; CALCIUM + dw 9800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; RARE CANDY + dw 4800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; X ACCURACY + dw 950 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $06 ; ball + +; LEAF STONE + dw 2100 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; METAL POWDER + dw 10 ; price + db HELD_METAL_POWDER ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; NUGGET + dw 10000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; # DOLL + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $06 ; ball + +; FULL HEAL + dw 600 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; REVIVE + dw 1500 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; MAX REVIVE + dw 4000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; GUARD SPEC. + dw 700 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $06 ; ball + +; SUPER REPEL + dw 500 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $40 ; current menu + +; MAX REPEL + dw 700 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $40 ; current menu + +; DIRE HIT + dw 650 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $06 ; ball + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; FRESH WATER + dw 200 ; price + db NONE ; effect + db 50 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; SODA POP + dw 300 ; price + db NONE ; effect + db 60 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; LEMONADE + dw 350 ; price + db NONE ; effect + db 80 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; X ATTACK + dw 500 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $06 ; ball + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; X DEFEND + dw 550 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $06 ; ball + +; X SPEED + dw 350 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $06 ; ball + +; X SPECIAL + dw 350 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $06 ; ball + +; COIN CASE + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $40 ; current menu + +; ITEMFINDER + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_TOSS + db KEY_ITEM + db $60 ; overworld + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; EXP.SHARE + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; OLD ROD + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_TOSS + db KEY_ITEM + db $60 ; overworld + +; GOOD ROD + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_TOSS + db KEY_ITEM + db $60 ; overworld + +; SILVER LEAF + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; SUPER ROD + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_TOSS + db KEY_ITEM + db $60 ; overworld + +; PP UP + dw 9800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; ETHER + dw 1200 ; price + db NONE ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; MAX ETHER + dw 2000 ; price + db NONE ; effect + db 255 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; ELIXER + dw 3000 ; price + db NONE ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; RED SCALE + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; SECRETPOTION + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; S.S.TICKET + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; MYSTERY EGG + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; CLEAR BELL + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; SILVER WING + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; MOOMOO MILK + dw 500 ; price + db NONE ; effect + db 100 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; QUICK CLAW + dw 100 ; price + db HELD_QUICK_CLAW ; effect + db 60 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; PSNCUREBERRY + dw 10 ; price + db HELD_HEAL_POISON ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; GOLD LEAF + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; SOFT SAND + dw 100 ; price + db HELD_GROUND_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; SHARP BEAK + dw 100 ; price + db HELD_FLYING_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; PRZCUREBERRY + dw 10 ; price + db HELD_HEAL_PARALYZE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; BURNT BERRY + dw 10 ; price + db HELD_HEAL_FREEZE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; ICE BERRY + dw 10 ; price + db HELD_HEAL_BURN ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; POISON BARB + dw 100 ; price + db HELD_POISON_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; KING'S ROCK + dw 100 ; price + db HELD_TRADE_EVOLVE ; effect + db 30 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BITTER BERRY + dw 10 ; price + db HELD_HEAL_CONFUSION ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $05 ; heal menu (battle only) + +; MINT BERRY + dw 10 ; price + db HELD_HEAL_SLEEP ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; RED APRICORN + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TINYMUSHROOM + dw 500 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BIG MUSHROOM + dw 5000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; SILVERPOWDER + dw 100 ; price + db HELD_BUG_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BLU APRICORN + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; AMULET COIN + dw 100 ; price + db HELD_AMULET_COIN ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; YLW APRICORN + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; GRN APRICORN + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; CLEANSE TAG + dw 200 ; price + db HELD_CLEANSE_TAG ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; MYSTIC WATER + dw 100 ; price + db HELD_WATER_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TWISTEDSPOON + dw 100 ; price + db HELD_PSYCHIC_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; WHT APRICORN + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BLACKBELT + dw 100 ; price + db HELD_FIGHTING_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BLK APRICORN + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; PNK APRICORN + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BLACKGLASSES + dw 100 ; price + db HELD_DARK_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; SLOWPOKETAIL + dw 9800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; PINK BOW + dw 100 ; price + db HELD_NORMAL_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; STICK + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; SMOKE BALL + dw 200 ; price + db HELD_ESCAPE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; NEVERMELTICE + dw 100 ; price + db HELD_ICE_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; MAGNET + dw 100 ; price + db HELD_ELECTRIC_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; MIRACLEBERRY + dw 10 ; price + db HELD_HEAL_STATUS ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; PEARL + dw 1400 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BIG PEARL + dw 7500 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; EVERSTONE + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; SPELL TAG + dw 100 ; price + db HELD_GHOST_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; RAGECANDYBAR + dw 300 ; price + db NONE ; effect + db 20 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; GS BALL + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; BLUE CARD + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $40 ; current menu + +; MIRACLE SEED + dw 100 ; price + db HELD_GRASS_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; THICK CLUB + dw 500 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; FOCUS BAND + dw 200 ; price + db HELD_FOCUS_BAND ; effect + db 30 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; ENERGYPOWDER + dw 500 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; ENERGY ROOT + dw 800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; HEAL POWDER + dw 450 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; REVIVAL HERB + dw 2800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; HARD STONE + dw 100 ; price + db HELD_ROCK_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; LUCKY EGG + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; CARD KEY + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $60 ; overworld + +; MACHINE PART + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; EGG TICKET + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; LOST ITEM + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; STARDUST + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; STAR PIECE + dw 9800 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BASEMENT KEY + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $60 ; overworld + +; PASS + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; CHARCOAL + dw 9800 ; price + db HELD_FIRE_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BERRY JUICE + dw 100 ; price + db HELD_BERRY ; effect + db 20 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; SCOPE LENS + dw 200 ; price + db HELD_CRITICAL_UP ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; METAL COAT + dw 100 ; price + db HELD_STEEL_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; DRAGON FANG + dw 100 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; LEFTOVERS + dw 200 ; price + db HELD_LEFTOVERS ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; MYSTERYBERRY + dw 10 ; price + db HELD_RESTORE_PP ; effect + db 255 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; DRAGON SCALE + dw 2100 ; price + db HELD_DRAGON_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BERSERK GENE + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; SACRED ASH + dw 200 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $60 ; overworld + +; HEAVY BALL + dw 150 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; FLOWER MAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; LEVEL BALL + dw 150 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; LURE BALL + dw 150 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; FAST BALL + dw 150 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; LIGHT BALL + dw 100 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; FRIEND BALL + dw 150 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; MOON BALL + dw 150 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; LOVE BALL + dw 150 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; NORMAL BOX + dw 10 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $40 ; current menu + +; GORGEOUS BOX + dw 10 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $40 ; current menu + +; SUN STONE + dw 2100 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $50 ; party menu + +; POLKADOT BOW + dw 100 ; price + db HELD_NORMAL_BOOST ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; UP-GRADE + dw 2100 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BERRY + dw 10 ; price + db HELD_BERRY ; effect + db 10 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; GOLD BERRY + dw 10 ; price + db HELD_BERRY ; effect + db 30 ; param + db CANT_SELECT + db ITEM + db $55 ; heal menu + +; SQUIRTBOTTLE + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $60 ; overworld + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; PARK BALL + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db BALL + db $06 ; ball + +; RAINBOW WING + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db KEY_ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; BRICK PIECE + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; SURF MAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; LITEBLUEMAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; PORTRAITMAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; LOVELY MAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; EON MAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; MORPH MAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; BLUESKY MAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; MUSIC MAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; MIRAGE MAIL + dw 50 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TM01 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM02 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM03 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM04 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TM05 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM06 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM07 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM08 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM09 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM10 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM11 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM12 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM13 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM14 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM15 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM16 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM17 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM18 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM19 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM20 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM21 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM22 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM23 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM24 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM25 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM26 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM27 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM28 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TM29 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM30 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM31 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM32 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM33 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM34 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM35 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM36 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM37 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM38 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM39 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM40 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM41 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM42 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM43 + dw 1000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM44 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM45 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM46 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM47 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM48 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM49 + dw 3000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; TM50 + dw 2000 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT + db TM_HM + db $50 ; party menu + +; HM01 + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db TM_HM + db $50 ; party menu + +; HM02 + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db TM_HM + db $50 ; party menu + +; HM03 + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db TM_HM + db $50 ; party menu + +; HM04 + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db TM_HM + db $50 ; party menu + +; HM05 + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db TM_HM + db $50 ; party menu + +; HM06 + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db TM_HM + db $50 ; party menu + +; HM07 + dw 0 ; price + db NONE ; effect + db 0 ; param + db CANT_SELECT | CANT_TOSS + db TM_HM + db $50 ; party menu + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; TERU-SAMA + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + +; ? + dw 39321 ; price + db NONE ; effect + db 0 ; param + db 0 ; can select + toss + db ITEM + db $00 ; can't use + + @@ -8,7 +8,7 @@ SECTION "rst8",HOME[$8] ; FarCall SECTION "rst10",HOME[$10] ; Bankswitch ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a ret SECTION "rst18",HOME[$18] ; Unused @@ -207,10 +207,10 @@ AskTimer: ; 591 LatchClock: ; 59c ; latch clock counter data - ld a, $0 - ld [$6000], a - ld a, $1 - ld [$6000], a + ld a, 0 + ld [MBC3LatchClock], a + ld a, 1 + ld [MBC3LatchClock], a ret ; 5a7 @@ -232,37 +232,37 @@ GetClock: ; 5b7 ; store clock data in hRTCDayHi-hRTCSeconds ; enable clock r/w - ld a, $a - ld [$0000], a + ld a, SRAM_ENABLE + ld [MBC3SRamEnable], a ; get clock data ; stored 'backwards' in hram call LatchClock - ld hl, $4000 - ld de, $a000 + ld hl, MBC3SRamBank + ld de, MBC3RTC ; seconds - ld [hl], $8 ; S + ld [hl], RTC_S ld a, [de] and $3f ld [hRTCSeconds], a ; minutes - ld [hl], $9 ; M + ld [hl], RTC_M ld a, [de] and $3f ld [hRTCMinutes], a ; hours - ld [hl], $a ; H + ld [hl], RTC_H ld a, [de] and $1f ld [hRTCHours], a ; day lo - ld [hl], $b ; DL + ld [hl], RTC_DL ld a, [de] ld [hRTCDayLo], a ; day hi - ld [hl], $c ; DH + ld [hl], RTC_DH ld a, [de] ld [hRTCDayHi], a @@ -390,41 +390,41 @@ SetClock: ; 691 ; set clock data from hram ; enable clock r/w - ld a, $a - ld [$0000], a + ld a, SRAM_ENABLE + ld [MBC3SRamEnable], a ; set clock data ; stored 'backwards' in hram call LatchClock - ld hl, $4000 - ld de, $a000 + ld hl, MBC3SRamBank + ld de, MBC3RTC ; seems to be a halt check that got partially commented out ; this block is totally pointless - ld [hl], $c + ld [hl], RTC_DH ld a, [de] bit 6, a ; halt ld [de], a ; seconds - ld [hl], $8 ; S + ld [hl], RTC_S ld a, [hRTCSeconds] ld [de], a ; minutes - ld [hl], $9 ; M + ld [hl], RTC_M ld a, [hRTCMinutes] ld [de], a ; hours - ld [hl], $a ; H + ld [hl], RTC_H ld a, [hRTCHours] ld [de], a ; day lo - ld [hl], $b ; DL + ld [hl], RTC_DL ld a, [hRTCDayLo] ld [de], a ; day hi - ld [hl], $c ; DH + ld [hl], RTC_DH ld a, [hRTCDayHi] res 6, a ; make sure timer is active ld [de], a @@ -1423,7 +1423,7 @@ Char5D: ld a, $e rst FarCall pop hl - ld de, $d073 + ld de, StringBuffer1 jr .asm_126a ; 0x1246 $22 .asm_1248 ld de, $d493 @@ -2699,14 +2699,14 @@ Function2fb1: ; 2fb1 ld b, a push bc .asm_2fbb - call $2f8c + call RNG ld a, [hRandomAdd] ld c, a add b jr c, .asm_2fbb ld a, c pop bc - call $3110 + call SimpleDivide pop bc ret ; 2fcb @@ -2723,25 +2723,25 @@ OpenSRAM: ; 2fd1 ; switch to sram bank a push af ; latch clock data - ld a, $1 - ld [$6000], a + ld a, 1 + ld [MBC3LatchClock], a ; enable sram/clock write - ld a, $a - ld [$0000], a + ld a, SRAM_ENABLE + ld [MBC3SRamEnable], a ; select sram bank pop af - ld [$4000], a + ld [MBC3SRamBank], a ret ; 2fe1 CloseSRAM: ; 2fe1 ; preserve a push af - ld a, $0 + ld a, SRAM_DISABLE ; reset clock latch for next time - ld [$6000], a + ld [MBC3LatchClock], a ; disable sram/clock write - ld [$0000], a + ld [MBC3SRamEnable], a pop af ret ; 2fec @@ -2933,7 +2933,34 @@ AddNTimes: ; 0x30fe ; 0x3105 -INCBIN "baserom.gbc", $3105, $3119 - $3105 +SimpleMultiply: ; 3105 +; Return a * c. + and a + ret z + + push bc + ld b, a + xor a +.loop + add c + dec b + jr nz, .loop + pop bc + ret +; 3110 + + +SimpleDivide: ; 3110 +; Divide a by c. Return quotient b and remainder a. + ld b, 0 +.loop + inc b + sub c + jr nc, .loop + dec b + add c + ret +; 3119 Multiply: ; 3119 @@ -2972,7 +2999,15 @@ Divide: ; 3124 ; 3136 -INCBIN "baserom.gbc", $3136, $313d - $3136 +SubtractSigned: ; 3136 +; Return a - b, sign in carry. + sub b + ret nc + cpl + add 1 + scf + ret +; 313d PrintLetterDelay: ; 313d @@ -3092,7 +3127,30 @@ StringCmp: ; 31db ret ; 0x31e4 -INCBIN "baserom.gbc", $31e4, $31f3 - $31e4 + +CompareLong: ; 31e4 +; Compare bc bytes at de and hl. Return carry if they all match. + + ld a, [de] + cp [hl] + jr nz, .Diff + + inc de + inc hl + dec bc + + ld a, b + or c + jr nz, CompareLong + + scf + ret + +.Diff + and a + ret +; 31f3 + WhiteBGMap: ; 31f3 call ClearPalettes @@ -3164,7 +3222,29 @@ GetSGBLayout: ; 3340 jp Predef ; 334e -INCBIN "baserom.gbc", $334e, $335f - $334e + +SetHPPal: ; 334e +; Set palette for hp bar pixel length e at hl. + call GetHPPal + ld [hl], d + ret +; 3353 + + +GetHPPal: ; 3353 +; Get palette for hp bar pixel length e in d. + + ld d, 0 ; green + ld a, e + cp 24 + ret nc + inc d ; yellow + cp 10 + ret nc + inc d ; red + ret +; 335f + CountSetBits: ; 0x335f ; function to count how many bits are set in a string of bytes @@ -3192,56 +3272,115 @@ CountSetBits: ; 0x335f ret ; 0x3376 -INCBIN "baserom.gbc", $3376, $33ab - $3376 + +GetWeekday: ; 3376 + ld a, [CurDay] +.loop + sub 7 + jr nc, .loop + add 7 + ret +; 3380 + + +SetSeenAndCaughtMon: ; 3380 + push af + ld c, a + ld hl, PokedexSeen + ld b, 1 + call GetWramFlag + pop af + ; fallthrough +; 338b + +SetCaughtMon: ; 338b + ld c, a + ld hl, PokedexCaught + ld b, 1 + jr GetWramFlag +; 3393 + +CheckSeenMon: ; 3393 + ld c, a + ld hl, PokedexSeen + ld b, 2 + jr GetWramFlag +; 339b + +CheckCaughtMon: ; 339b + ld c, a + ld hl, PokedexCaught + ld b, 2 + ; fallthrough +; 33a1 + +GetWramFlag: ; 33a1 + ld d, 0 + ld a, PREDEF_FLAG + call Predef + + ld a, c + and a + ret +; 33ab + NamesPointerTable: ; 33ab dbw BANK(PokemonNames), PokemonNames dbw BANK(MoveNames), MoveNames dbw $00, $0000 dbw BANK(ItemNames), ItemNames - dbw $00, $ddff - dbw $00, $d3a8 + dbw $00, PartyMonOT + dbw $00, OTPartyMonOT dbw BANK(TrainerClassNames), TrainerClassNames dbw $04, $4b52 +; 33c3 + GetName: ; 33c3 +; Return name $cf60 from name list $cf61 in StringBuffer1. ld a, [hROMBank] push af push hl push bc push de ld a, [$cf61] - cp $1 - jr nz, .asm_33e1 ; 0x33ce $11 + cp 1 ; Pokemon names + jr nz, .NotPokeName + ld a, [$cf60] ld [$d265], a - call $343b + call GetPokemonName ld hl, $000b add hl, de ld e, l ld d, h - jr .asm_3403 ; 0x33df $22 -.asm_33e1 + jr .done + +.NotPokeName ld a, [$cf61] dec a ld e, a - ld d, $0 + ld d, 0 ld hl, NamesPointerTable add hl, de add hl, de add hl, de ld a, [hli] - rst Bankswitch ; Bankswitch + rst Bankswitch ld a, [hli] ld h, [hl] ld l, a + ld a, [$cf60] dec a call GetNthString - ld de, $d073 + + ld de, StringBuffer1 ld bc, $000d call CopyBytes -.asm_3403 + +.done ld a, e ld [$d102], a ld a, d @@ -3252,9 +3391,8 @@ GetName: ; 33c3 pop af rst Bankswitch ret -; 0x3411 +; 3411 -INCBIN "baserom.gbc", $3411, $3411 - $3411 GetNthString: ; 3411 ; Starting at hl, this function returns the start address of the ath string. @@ -3266,39 +3404,213 @@ GetNthString: ; 3411 .readChar ld a, [hli] cp c - jr nz, .readChar ; 0x3419 $fc + jr nz, .readChar dec b - jr nz, .readChar ; 0x341c $f9 + jr nz, .readChar pop bc ret -; 0x3420 +; 3420 + + +GetBasePokemonName: ; 3420 +; Discards gender (Nidoran). + push hl + call GetPokemonName + + ld hl, StringBuffer1 +.loop + ld a, [hl] + cp "@" + jr z, .quit + cp "♂" + jr z, .end + cp "♀" + jr z, .end + inc hl + jr .loop +.end + ld [hl], "@" +.quit + pop hl + ret +; 343b -INCBIN "baserom.gbc", $3420, $3468 - $3420 + +GetPokemonName: ; 343b +; Get Pokemon name $d265. + + ld a, [hROMBank] + push af + push hl + ld a, BANK(PokemonNames) + rst Bankswitch + +; Each name is ten characters + ld a, [$d265] + dec a + ld d, 0 + ld e, a + ld h, 0 + ld l, a + add hl, hl + add hl, hl + add hl, de + add hl, hl + ld de, PokemonNames + add hl, de + +; Terminator + ld de, StringBuffer1 + push de + ld bc, PKMN_NAME_LENGTH - 1 + call CopyBytes + ld hl, StringBuffer1 + PKMN_NAME_LENGTH - 1 + ld [hl], "@" + pop de + + pop hl + pop af + rst Bankswitch + ret +; 3468 GetItemName: ; 3468 +; Get item name $d265. + push hl push bc - ld a, [$d265] ; Get the item - cp $bf ; Is it a TM? - jr nc, .tm ; 0x346f $d + ld a, [$d265] + + cp TM_01 + jr nc, .TM + ld [$cf60], a - ld a, $4 ; Item names + ld a, 4 ; Item names ld [$cf61], a call GetName - jr .copied ; 0x347c $3 -.tm - call $3487 -.copied - ld de, $d073 + jr .Copied +.TM + call GetTMHMName +.Copied + ld de, StringBuffer1 pop bc pop hl ret ; 3487 -INCBIN "baserom.gbc", $3487, $34f8 - $3487 +GetTMHMName: ; 3487 +; Get TM/HM name by item id $d265. + + push hl + push de + push bc + ld a, [$d265] + push af + +; TM/HM prefix + cp HM_01 + push af + jr c, .TM + + ld hl, .HMText + ld bc, .HMTextEnd - .HMText + jr .asm_34a1 + +.TM + ld hl, .TMText + ld bc, .TMTextEnd - .TMText + +.asm_34a1 + ld de, StringBuffer1 + call CopyBytes + +; TM/HM number + push de + ld a, [$d265] + ld c, a + callab GetTMHMNumber + pop de + +; HM numbers start from 51, not 1 + pop af + ld a, c + jr c, .asm_34b9 + sub NUM_TMS + +; Divide and mod by 10 to get the top and bottom digits respectively +.asm_34b9 + ld b, "0" +.mod10 + sub 10 + jr c, .asm_34c2 + inc b + jr .mod10 +.asm_34c2 + add 10 + + push af + ld a, b + ld [de], a + inc de + pop af + + ld b, "0" + add b + ld [de], a + +; End the string + inc de + ld a, "@" + ld [de], a + + pop af + ld [$d265], a + pop bc + pop de + pop hl + ret + +.TMText + db "TM" +.TMTextEnd + db "@" + +.HMText + db "HM" +.HMTextEnd + db "@" +; 34df + + +IsHM: ; 34df + cp HM_01 + jr c, .NotHM + scf + ret +.NotHM + and a + ret +; 34e7 + + +IsHMMove: ; 34e7 + ld hl, .HMMoves + ld de, 1 + jp IsInArray + +.HMMoves + db CUT + db FLY + db SURF + db STRENGTH + db FLASH + db WATERFALL + db WHIRLPOOL + db $ff +; 34f8 GetMoveName: ; 34f8 @@ -3320,30 +3632,27 @@ GetMoveName: ; 34f8 INCBIN "baserom.gbc", $350c, $3856 - $350c -GetBaseStats: ; 3856 +GetBaseData: ; 3856 push bc push de push hl - -; Save bank ld a, [hROMBank] push af -; Bankswitch - ld a, BANK(BaseStats) + ld a, BANK(BaseData) rst Bankswitch -; Egg doesn't have base stats +; Egg doesn't have BaseData ld a, [CurSpecies] cp EGG jr z, .egg -; Get base stats +; Get BaseData dec a - ld bc, BaseStats1 - BaseStats0 - ld hl, BaseStats + ld bc, BaseData1 - BaseData0 + ld hl, BaseData call AddNTimes - ld de, CurBaseStats - ld bc, BaseStats1 - BaseStats0 + ld de, CurBaseData + ld bc, BaseData1 - BaseData0 call CopyBytes jr .end @@ -3352,12 +3661,12 @@ GetBaseStats: ; 3856 ld de, $7d9c ; Sprite dimensions - ld b, $55 - ld hl, $d247 + ld b, $55 ; 5x5 + ld hl, BasePicSize ld [hl], b ; ???? - ld hl, $d248 + ld hl, BasePadding ld [hl], e inc hl ld [hl], d @@ -3370,44 +3679,43 @@ GetBaseStats: ; 3856 .end ; Replace Pokedex # with species ld a, [CurSpecies] - ld [CurBaseStats], a + ld [BaseDexNo], a -; Restore bank pop af rst Bankswitch - pop hl pop de pop bc ret ; 389c -INCBIN "baserom.gbc", $389c, $38a2 - $389c -GetNick: ; 38a2 -; get the nickname of a partymon -; write nick to StringBuffer1 +GetCurNick; 389c + ld a, [CurPartyMon] + ld hl, PartyMonNicknames -; input: a = which mon (0-5) +GetNick: ; 38a2 +; Get nickname a from list hl. push hl push bc - ; skip [a] nicks + call SkipNames ld de, StringBuffer1 - ; write nick + push de ld bc, PKMN_NAME_LENGTH call CopyBytes - ; error-check pop de + callab CheckNickErrors - ; we're done + pop bc pop hl ret ; 38bb + PrintBCDNumber: ; 38bb ; function to print a BCD (Binary-coded decimal) number ; de = address of BCD number @@ -3509,11 +3817,37 @@ GetPartyLocation: ; 3927 ; 392d -INCBIN "baserom.gbc", $392d, $395d - $392d +INCBIN "baserom.gbc", $392d, $3945 - $392d + + +UserPartyAttr: ; 3945 + push af + ld a, [hBattleTurn] + and a + jr nz, .asm_394e + pop af + jr BattlePartyAttr +.asm_394e + pop af + jr OTPartyAttr +; 3951 + + +OpponentPartyAttr: ; 3951 + push af + ld a, [hBattleTurn] + and a + jr z, .asm_395a + pop af + jr BattlePartyAttr +.asm_395a + pop af + jr OTPartyAttr +; 395d BattlePartyAttr: ; 395d -; Get attribute a from the active monster's party struct. +; Get attribute a from the active BattleMon's party struct. push bc ld c, a ld b, 0 @@ -3526,7 +3860,18 @@ BattlePartyAttr: ; 395d ; 396d -INCBIN "baserom.gbc", $396d, $397d - $396d +OTPartyAttr: ; 396d +; Get attribute a from the active EnemyMon's party struct. + push bc + ld c, a + ld b, 0 + ld hl, OTPartyMon1Species + add hl, bc + ld a, [CurOTMon] + call GetPartyLocation + pop bc + ret +; 397d ResetDamage: ; 397d @@ -3548,7 +3893,72 @@ SetEnemyTurn: ; 3989 ret ; 398e -INCBIN "baserom.gbc", $398e, $39e1 - $398e + +UpdateOpponentInParty: ; 398e + ld a, [hBattleTurn] + and a + jr z, UpdateEnemyMonInParty + jr UpdateBattleMonInParty +; 3995 + +UpdateUserInParty: ; 3995 + ld a, [hBattleTurn] + and a + jr z, UpdateBattleMonInParty + jr UpdateEnemyMonInParty +; 399c + +UpdateBattleMonInParty: ; 399c +; Update level, status, current HP + + ld a, [CurBattleMon] + ld hl, PartyMon1Level + call GetPartyLocation + + ld d, h + ld e, l + ld hl, BattleMonLevel + ld bc, BattleMonMaxHP - BattleMonLevel + jp CopyBytes +; 39b0 + +UpdateEnemyMonInParty: ; 39b0 +; Update level, status, current HP + +; No wildmons. + ld a, [IsInBattle] + dec a + ret z + + ld a, [CurOTMon] + ld hl, OTPartyMon1Level + call GetPartyLocation + + ld d, h + ld e, l + ld hl, EnemyMonLevel + ld bc, EnemyMonMaxHP - EnemyMonLevel + jp CopyBytes +; 39c9 + + +RefreshBattleHuds: ; 39c9 + call UpdateBattleHuds + ld c, 3 + call DelayFrames + jp WaitBGMap +; 39d4 + +UpdateBattleHuds: ; 39d4 + ld a, $f + ld hl, $5f48 + rst FarCall ; UpdatePlayerHud + ld a, $f + ld hl, $6036 + rst FarCall ; UpdateEnemyHud + ret +; 39e1 + CleanGetBattleVarPair: ; 39e1 ; Preserves hl. @@ -3742,61 +4152,123 @@ BattleTextBox: ; 3ac3 FarBattleTextBox: ; 3ad5 -; save bank - ld a, [$ff9d] ; bank +; Open a textbox and print text at 20:hl. + + ld a, [hROMBank] push af -; bank 20 + ld a, $20 - rst $10 -; print text at hl + rst Bankswitch + call BattleTextBox -; restore bank + pop af - rst $10 + rst Bankswitch ret ; 3ae1 -INCBIN "baserom.gbc", $3ae1, $3b86 - $3ae1 +INCBIN "baserom.gbc", $3ae1, $3b4e - $3ae1 + + +CleanSoundRestart: ; 3b4e + + push hl + push de + push bc + push af + + ld a, [hROMBank] + push af + ld a, BANK(SoundRestart) + ld [hROMBank], a + ld [MBC3RomBank], a + + call SoundRestart + + pop af + ld [hROMBank], a + ld [MBC3RomBank], a + + pop af + pop bc + pop de + pop hl + ret +; 3b6a + + +CleanUpdateSound: ; 3b6a + + push hl + push de + push bc + push af + + ld a, [hROMBank] + push af + ld a, BANK(UpdateSound) + ld [hROMBank], a + ld [MBC3RomBank], a + + call UpdateSound + + pop af + ld [hROMBank], a + ld [MBC3RomBank], a + + pop af + pop bc + pop de + pop hl + ret +; 3b86 + LoadMusicByte: ; 3b86 -; load music data into CurMusicByte -; input: -; a: bank -; de: address +; CurMusicByte = [a:de] + ld [hROMBank], a - ld [$2000], a ; bankswitch + ld [MBC3RomBank], a + ld a, [de] ld [CurMusicByte], a ld a, $3a ; manual bank restore + ld [hROMBank], a - ld [$2000], a ; bankswitch + ld [MBC3RomBank], a ret ; 3b97 + StartMusic: ; 3b97 -; input: -; e = song number +; Play music de. + push hl push de push bc push af - ld a, [hROMBank] ; save bank + + ld a, [hROMBank] push af - ld a, BANK(LoadMusic) + ld a, BANK(LoadMusic) ; and BANK(SoundRestart) ld [hROMBank], a - ld [$2000], a ; bankswitch - ld a, e ; song number + ld [MBC3RomBank], a + + ld a, e and a jr z, .nomusic + call LoadMusic jr .end + .nomusic call SoundRestart + .end pop af - ld [hROMBank], a ; restore bank - ld [$2000], a + ld [hROMBank], a + ld [MBC3RomBank], a pop af pop bc pop de @@ -3804,25 +4276,58 @@ StartMusic: ; 3b97 ret ; 3bbc -INCBIN "baserom.gbc", $3bbc, $3be3 - $3bbc + +StartMusic2: ; 3bbc +; Stop playing music, then play music de. + + push hl + push de + push bc + push af + + ld a, [hROMBank] + push af + ld a, BANK(LoadMusic) + ld [hROMBank], a + ld [MBC3RomBank], a + + push de + ld de, MUSIC_NONE + call LoadMusic + call DelayFrame + pop de + call LoadMusic + + pop af + ld [hROMBank], a + ld [MBC3RomBank], a + + pop af + pop bc + pop de + pop hl + ret + +; 3be3 + PlayCryHeader: ; 3be3 ; Play a cry given parameters in header de - + push hl push de push bc push af - + ; Save current bank ld a, [hROMBank] push af - + ; Cry headers are stuck in one bank. ld a, BANK(CryHeaders) ld [hROMBank], a - ld [$2000], a - + ld [MBC3RomBank], a + ; Each header is 6 bytes long: ld hl, CryHeaders add hl, de @@ -3831,36 +4336,30 @@ PlayCryHeader: ; 3be3 add hl, de add hl, de add hl, de - -; Header struct: -; id ld e, [hl] inc hl ld d, [hl] inc hl -; pitch + ld a, [hli] ld [CryPitch], a -; echo ld a, [hli] ld [CryEcho], a -; length ld a, [hli] ld [CryLength], a ld a, [hl] ld [CryLength+1], a - -; That's it for the header + ld a, BANK(PlayCry) ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a + call PlayCry - -; Restore bank + pop af ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a pop af pop bc @@ -3871,32 +4370,36 @@ PlayCryHeader: ; 3be3 StartSFX: ; 3c23 -; sfx id order is by priority (highest to lowest) -; to disable this, remove the check! -; input: de = sfx id +; Play sound effect de. +; Sound effects are ordered by priority (lowest to highest) + push hl push de push bc push af - ; is something already playing? + +; Is something already playing? call CheckSFX - jr nc, .asm_3c32 - ; only play sfx if it has priority + jr nc, .play +; Does it have priority? ld a, [CurSFX] cp e jr c, .quit -.asm_3c32 - ld a, [hROMBank] ; save bank + +.play + ld a, [hROMBank] push af - ld a, $3a ; music bank + ld a, BANK(LoadSFX) ld [hROMBank], a - ld [$2000], a ; bankswitch + ld [MBC3RomBank], a ; bankswitch + ld a, e ld [CurSFX], a call LoadSFX + pop af - ld [hROMBank], a ; restore bank - ld [$2000], a ; bankswitch + ld [hROMBank], a + ld [MBC3RomBank], a ; bankswitch .quit pop af pop bc @@ -3905,31 +4408,37 @@ StartSFX: ; 3c23 ret ; 3c4e -INCBIN "baserom.gbc", $3c4e, $3c55-$3c4e + +WaitPlaySFX: ; 3c4e + call WaitSFX + call StartSFX + ret +; 3c55 + WaitSFX: ; 3c55 ; infinite loop until sfx is done playing + push hl .loop ; ch5 on? - ld hl, $c1cc ; Channel5Flags + ld hl, Channel5 + Channel1Flags - Channel1 bit 0, [hl] jr nz, .loop ; ch6 on? - ld hl, $c1fe ; Channel6Flags + ld hl, Channel6 + Channel1Flags - Channel1 bit 0, [hl] jr nz, .loop ; ch7 on? - ld hl, $c230 ; Channel7Flags + ld hl, Channel7 + Channel1Flags - Channel1 bit 0, [hl] jr nz, .loop ; ch8 on? - ld hl, $c262 ; Channel8Flags + ld hl, Channel8 + Channel1Flags - Channel1 bit 0, [hl] jr nz, .loop - ; we're done pop hl ret ; 3c74 @@ -4355,7 +4864,12 @@ _Divide: ; 673e ; 67c1 -INCBIN "baserom.gbc", $67c1, $6eef - $67c1 +ItemAttributes: ; 67c1 +INCLUDE "items/item_attributes.asm" +; 6ec1 + + +INCBIN "baserom.gbc", $6ec1, $6eef - $6ec1 DrawGraphic: ; 6eef @@ -4408,7 +4922,7 @@ SpecialGiveShuckle: ; 7305 ld b, 0 ld a, $13 ld hl, $5ba3 - rst $8 + rst FarCall ; Holding a Berry. ld bc, PartyMon2 - PartyMon1 @@ -4530,7 +5044,7 @@ PredefPointers: ; 856b dwb $4eef, $0a dwb $4b3e, $0b dwb $5f48, $0f - dwb $6f6e, $0b + dwb FillBox, BANK(FillBox) dwb $5873, $0f dwb $6036, $0f dwb $74c1, $0f @@ -5259,7 +5773,138 @@ AskSurfText: ; ca36 db "@" ; Want to SURF? ; ca3b -INCBIN "baserom.gbc", $ca3b, $fa0b - $ca3b + +INCBIN "baserom.gbc", $ca3b, $d407 - $ca3b + + +GetTMHMNumber: ; d407 +; Return the number of a TM/HM by item id c. + + ld a, c + +; Skip any dummy items. + cp $c3 ; TM04-05 + jr c, .done + cp $dc ; TM28-29 + jr c, .skip + + dec a +.skip + dec a +.done + sub TM_01 + inc a + ld c, a + ret +; d417 + + +GetNumberedTMHM: ; d417 +; Return the item id of a TM/HM by number c. + + ld a, c + +; Skip any gaps. + cp 5 + jr c, .done + cp 29 + jr c, .skip + + inc a +.skip + inc a +.done + add TM_01 + dec a + ld c, a + ret +; d427 + + +CheckTossableItem: ; d427 +; Return 1 in $d142 and carry if CurItem can't be removed from the bag. + ld a, 4 + call GetItemAttr + bit 7, a + jr nz, Function0xd47f + and a + ret +; d432 + +CheckSelectableItem: ; d432 +; Return 1 in $d142 and carry if CurItem can't be selected. + ld a, 4 + call GetItemAttr + bit 6, a + jr nz, Function0xd47f + and a + ret +; d43d + +CheckItemPocket: ; d43d +; Return the pocket for CurItem in $d142. + ld a, 5 + call GetItemAttr + and $f + ld [$d142], a + ret +; d448 + +CheckItemContext: ; d448 +; Return the context for CurItem in $d142. + ld a, 6 + call GetItemAttr + and $f + ld [$d142], a + ret +; d453 + +CheckItemMenu: ; d453 +; Return the menu for CurItem in $d142. + ld a, 6 + call GetItemAttr + swap a + and $f + ld [$d142], a + ret +; d460 + +GetItemAttr: ; d460 +; Get attribute a of CurItem. + + push hl + push bc + + ld hl, ItemAttributes + ld c, a + ld b, 0 + add hl, bc + + xor a + ld [$d142], a + + ld a, [CurItem] + dec a + ld c, a + ld a, 7 + call AddNTimes + ld a, BANK(ItemAttributes) + call GetFarByte + + pop bc + pop hl + ret +; d47f + +Function0xd47f: ; d47f + ld a, 1 + ld [$d142], a + scf + ret +; d486 + + +INCBIN "baserom.gbc", $d486, $fa0b - $d486 SECTION "bank4",DATA,BANK[$4] @@ -5373,26 +6018,26 @@ OpenPartyMenu: ; $12976 .menu ; 12986 ld a, $14 ld hl, $404f - rst $8 ; load gfx + rst FarCall ; load gfx ld a, $14 ld hl, $4405 - rst $8 ; setup menu? + rst FarCall ; setup menu? ld a, $14 ld hl, $43e0 - rst $8 ; load menu pokémon sprites + rst FarCall ; load menu pokémon sprites .menunoreload ; 12998 ld a, BANK(WritePartyMenuTilemap) ld hl, WritePartyMenuTilemap - rst $8 + rst FarCall ld a, BANK(PrintPartyMenuText) ld hl, PrintPartyMenuText - rst $8 + rst FarCall call $31f6 call $32f9 ; load regular palettes? call DelayFrame ld a, BANK(PartyMenuSelect) ld hl, PartyMenuSelect - rst $8 + rst FarCall jr c, .return ; if cancelled or pressed B call PokemonActionSubmenu cp $3 @@ -5423,7 +6068,7 @@ PokemonActionSubmenu ; 0x12a88 call $0fb6 ; draw box ld a, $9 ld hl, $4d19 - rst $8 + rst FarCall call $389c ld a, [$cf74] ; menu selection? ld hl, PokemonSubmenuActionPointerTable @@ -6159,90 +6804,233 @@ TrainerClassNames: ; 2c1ef db "ROCKET@" db "MYSTICALMAN@" -INCBIN "baserom.gbc", $2C41a, $2ee8f - $2C41a -; XXX this is not the start of the routine -; determine what music plays in battle - ld a, [OtherTrainerClass] ; are we fighting a trainer? +INCBIN "baserom.gbc", $2c41a, $2ee6c - $2c41a + + +PlayBattleMusic: ; 2ee6c + + push hl + push de + push bc + + xor a + ld [MusicFade], a + ld de, MUSIC_NONE + call StartMusic + call DelayFrame + call MaxVolume + + ld a, [BattleType] + cp BATTLETYPE_SUICUNE + ld de, MUSIC_SUICUNE_BATTLE + jp z, .done + cp BATTLETYPE_ROAMING + jp z, .done + + ; Are we fighting a trainer? + ld a, [OtherTrainerClass] and a jr nz, .trainermusic + ld a, BANK(RegionCheck) ld hl, RegionCheck rst FarCall ld a, e and a jr nz, .kantowild - ld de, $0029 ; johto daytime wild battle music - ld a, [TimeOfDay] ; check time of day - cp $2 ; nighttime? - jr nz, .done ; if no, then done - ld de, $004a ; johto nighttime wild battle music + + ld de, MUSIC_JOHTO_WILD_BATTLE + ld a, [TimeOfDay] + cp NITE + jr nz, .done + ld de, MUSIC_JOHTO_WILD_BATTLE_NIGHT jr .done + .kantowild - ld de, $0008 ; kanto wild battle music + ld de, MUSIC_KANTO_WILD_BATTLE jr .done .trainermusic - ld de, $002f ; lance battle music + ld de, MUSIC_CHAMPION_BATTLE cp CHAMPION jr z, .done cp RED jr z, .done ; really, they should have included admins and scientists here too... - ld de, $0031 ; rocket battle music + ld de, MUSIC_ROCKET_BATTLE cp GRUNTM jr z, .done cp GRUNTF jr z, .done - ld de, $0006 ; kanto gym leader battle music + ld de, MUSIC_KANTO_GYM_LEADER_BATTLE ld a, BANK(IsKantoGymLeader) ld hl, IsKantoGymLeader rst FarCall jr c, .done - ld de, $002e ; johto gym leader battle music + ld de, MUSIC_JOHTO_GYM_LEADER_BATTLE ld a, BANK(IsJohtoGymLeader) ld hl, IsJohtoGymLeader rst FarCall jr c, .done - ld de, $0030 ; rival battle music + ld de, MUSIC_RIVAL_BATTLE ld a, [OtherTrainerClass] cp RIVAL1 jr z, .done cp RIVAL2 jr nz, .othertrainer - ld a, [OtherTrainerID] ; which rival are we fighting? - cp $4 - jr c, .done ; if it's not the fight inside Indigo Plateau, we're done - ld de, $002f ; rival indigo plateau battle music + + ld a, [OtherTrainerID] + cp 4 ; Rival in Indigo Plateau + jr c, .done + ld de, MUSIC_CHAMPION_BATTLE jr .done .othertrainer ld a, [InLinkBattle] and a - jr nz, .linkbattle + jr nz, .johtotrainer + ld a, BANK(RegionCheck) ld hl, RegionCheck rst FarCall ld a, e and a jr nz, .kantotrainer -.linkbattle - ld de, $002a ; johto trainer battle music + +.johtotrainer + ld de, MUSIC_JOHTO_TRAINER_BATTLE jr .done + .kantotrainer - ld de, $0007 ; kanto trainer battle music + ld de, MUSIC_KANTO_TRAINER_BATTLE + .done - call $3b97 + call StartMusic + pop bc pop de pop hl ret +; 2ef18 + + +ClearBattleRAM: ; 2ef18 + xor a + ld [$d0ec], a + ld [$d0ee], a + + ld hl, $d0d8 + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + + ld [$d0e4], a + ld [CriticalHit], a + ld [BattleMonSpecies], a + ld [$c664], a + ld [CurBattleMon], a + ld [$d232], a + ld [TimeOfDayPal], a + ld [PlayerTurnsTaken], a + ld [EnemyTurnsTaken], a + ld [EvolvableFlags], a + + ld hl, PlayerHPPal + ld [hli], a + ld [hl], a + + ld hl, BattleMonDVs + ld [hli], a + ld [hl], a + + ld hl, EnemyMonDVs + ld [hli], a + ld [hl], a + +; Clear the entire BattleMons area + ld hl, EnemyMoveStruct + ld bc, $0139 + xor a + call ByteFill + + ld hl, $5867 + ld a, $f + rst FarCall + + call $1fbf + + ld hl, $ffd6 + xor a + ld [hli], a + ld [hl], $98 + ret +; 2ef6e + + +FillBox: ; 2ef6e +; Fill $c2c6-aligned box width b height c +; with iterating tile starting from $ffad at hl. +; Predef $13 + + ld de, 20 + + ld a, [$c2c6] + and a + jr nz, .left + + ld a, [$ffad] +.x1 + push bc + push hl + +.y1 + ld [hl], a + add hl, de + inc a + dec c + jr nz, .y1 + + pop hl + inc hl + pop bc + dec b + jr nz, .x1 + ret + +.left +; Right-aligned. + push bc + ld b, 0 + dec c + add hl, bc + pop bc + + ld a, [$ffad] +.x2 + push bc + push hl + +.y2 + ld [hl], a + add hl, de + inc a + dec c + jr nz, .y2 + + pop hl + dec hl + pop bc + dec b + jr nz, .x2 + ret +; 2ef9f -INCBIN "baserom.gbc", $2ef18, $2ef9f - $2ef18 SECTION "bankC",DATA,BANK[$C] @@ -6344,7 +7132,15 @@ INCLUDE "battle/effect_commands.asm" SECTION "bankE",DATA,BANK[$E] -INCBIN "baserom.gbc", $38000, $39999 - $38000 +INCBIN "baserom.gbc", $38000, $38591 - $38000 + + +AIScoring: ; 38591 +INCLUDE "battle/ai/scoring.asm" + + +INCBIN "baserom.gbc", $3952d, $39999 - $3952d + TrainerGroups: ; 0x39999 INCLUDE "trainers/trainer_pointers.asm" @@ -6511,7 +7307,7 @@ LoadEnemyMon: ; 3e8eb ; Clear the whole EnemyMon struct xor a ld hl, EnemyMonSpecies - ld bc, $0027 + ld bc, EnemyMonEnd - EnemyMon call ByteFill ; We don't need to be here if we're in a link battle @@ -6529,8 +7325,8 @@ LoadEnemyMon: ; 3e8eb ld [CurSpecies], a ld [CurPartySpecies], a -; Grab the base stats for this species - call GetBaseStats +; Grab the BaseData for this species + call GetBaseData ; Let's get the item: @@ -6549,13 +7345,13 @@ LoadEnemyMon: ; 3e8eb .WildItem -; In a wild battle, we pull from the item slots in base stats +; In a wild battle, we pull from the item slots in BaseData ; Force Item1 ; Used for Ho-Oh, Lugia and Snorlax encounters ld a, [BattleType] cp BATTLETYPE_FORCEITEM - ld a, [$d241] ; BufferMonItem1 + ld a, [BaseItems] jr z, .UpdateItem ; Failing that, it's all up to chance @@ -6566,16 +7362,16 @@ LoadEnemyMon: ; 3e8eb ; 25% chance of getting an item call FarBattleRNG - cp a, $c0 ; $c0/$100 = 75% + cp a, $c0 ld a, NO_ITEM jr c, .UpdateItem ; From there, an 8% chance for Item2 call FarBattleRNG - cp a, $14 ; 8% of 25% = 2% Item2 - ld a, [$d241] ; BaseStatsItem1 + cp a, $14 ; 8% of 25% = 2% Item2 + ld a, [BaseItems] jr nc, .UpdateItem - ld a, [$d242] ; BaseStatsItem2 + ld a, [BaseItems+1] .UpdateItem @@ -6590,7 +7386,7 @@ LoadEnemyMon: ; 3e8eb jr z, .InitDVs ; ???? - ld a, [$c671] + ld a, [EnemySubStatus5] bit 3, a jr z, .InitDVs @@ -6777,7 +7573,7 @@ LoadEnemyMon: ; 3e8eb .Happiness ; Set happiness - ld a, 70 ; BASE_HAPPINESS + ld a, BASE_HAPPINESS ld [EnemyMonHappiness], a ; Set level ld a, [CurPartyLevel] @@ -6872,8 +7668,8 @@ LoadEnemyMon: ; 3e8eb .Moves ; ???? - ld hl, $d23d - ld de, $d224 + ld hl, BaseType1 + ld de, EnemyMonType1 ld a, [hli] ld [de], a inc de @@ -6932,52 +7728,54 @@ LoadEnemyMon: ; 3e8eb call CopyBytes .Finish -; ???? - ld hl, $d237 - ld de, $d226 - ld b, 5 ; # bytes to copy -; Copy $d237-a to $d226-9 +; Only the first five base stats are copied... + ld hl, BaseStats + ld de, EnemyMonBaseStats + ld b, BaseSpecialDefense - BaseStats .loop ld a, [hli] ld [de], a inc de dec b jr nz, .loop -; Copy $d23f to $d22a - ld a, [$d23f] + + ld a, [BaseCatchRate] ld [de], a inc de -; Copy $d240 to $d22b - ld a, [$d240] + + ld a, [BaseExp] ld [de], a -; copy TempEnemyMonSpecies to $d265 + ld a, [TempEnemyMonSpecies] ld [$d265], a -; ???? - call $343b -; If wild, we're done + + call GetPokemonName + +; Did we catch it? ld a, [IsInBattle] and a ret z + ; Update enemy nick ld hl, StringBuffer1 ld de, EnemyMonNick ld bc, PKMN_NAME_LENGTH call CopyBytes -; ???? + +; Caught this mon ld a, [TempEnemyMonSpecies] dec a ld c, a - ld b, $01 - ld hl, $deb9 - ld a, $03 ; PREDEF_ + ld b, 1 ; set + ld hl, PokedexCaught + ld a, PREDEF_FLAG call Predef -; Fill EnemyMon stats - ld hl, EnemyMonAtk + + ld hl, EnemyMonStats ld de, $c6c1 - ld bc, 2*(NUM_STATS-1) ; 2 bytes for each non-HP stat + ld bc, EnemyMonStatsEnd - EnemyMonStats call CopyBytes -; We're done + ret ; 3eb38 @@ -7225,85 +8023,104 @@ GetRoamMonDVs: ; 3fa19 INCBIN "baserom.gbc", $3fa31, $3fc8b - $3fa31 -; I have no clue what most of this does -BattleStartMessage: - ld a, [$d22d] +BattleStartMessage ; 3fc8b + ld a, [IsInBattle] dec a - jr z, .asm_3fcaa ; 0x3fc8f $19 - ld de, $005e - call $3c23 + jr z, .asm_3fcaa + + ld de, SFX_SHINE + call StartSFX call WaitSFX - ld c, $14 - call $0468 + + ld c, 20 + call DelayFrames + ld a, $e ld hl, $5939 rst FarCall - ld hl, $47a9 - jr .asm_3fd0e ; 0x3fca8 $64 + + ld hl, WantsToBattleText + jr .asm_3fd0e + .asm_3fcaa call $5a79 - jr nc, .asm_3fcc2 ; 0x3fcad $13 + jr nc, .asm_3fcc2 + xor a ld [$cfca], a - ld a, $1 + ld a, 1 ld [hBattleTurn], a - ld a, $1 + ld a, 1 ld [$c689], a ld de, $0101 call $6e17 + .asm_3fcc2 ld a, $f ld hl, $6b38 rst FarCall - jr c, .messageSelection ; 0x3fcc8 $21 + jr c, .asm_3fceb + ld a, $13 ld hl, $6a44 rst FarCall - jr c, .asm_3fce0 ; 0x3fcd0 $e - ld hl, $c4ac + jr c, .asm_3fce0 + + hlcoord 12, 0 ld d, $0 ld e, $1 ld a, $47 - call $2d83 - jr .messageSelection ; 0x3fcde $b + call Predef + jr .asm_3fceb + .asm_3fce0 - ld a, $f - ld [$c2bd], a - ld a, [$d204] + ld a, $0f + ld [CryTracks], a + ld a, [TempEnemyMonSpecies] call $37b6 -.messageSelection - ld a, [$d230] - cp $4 - jr nz, .asm_3fcfd ; 0x3fcf0 $b + +.asm_3fceb + ld a, [BattleType] + cp BATTLETYPE_FISH + jr nz, .asm_3fcfd + ld a, $41 ld hl, $6086 rst FarCall + ld hl, HookedPokemonAttackedText - jr .asm_3fd0e ; 0x3fcfb $11 + jr .asm_3fd0e + .asm_3fcfd ld hl, PokemonFellFromTreeText - cp $8 - jr z, .asm_3fd0e ; 0x3fd02 $a + cp BATTLETYPE_TREE + jr z, .asm_3fd0e ld hl, WildPokemonAppearedText2 cp $b - jr z, .asm_3fd0e ; 0x3fd09 $3 + jr z, .asm_3fd0e ld hl, WildPokemonAppearedText + .asm_3fd0e push hl ld a, $b ld hl, $4000 rst FarCall + pop hl - call $3ad5 + call FarBattleTextBox + call $7830 + ret nz + ld c, $2 ld a, $13 ld hl, $6a0a rst FarCall + ret -; 0x3fd26 +; 3fd26 dw $0000 ; padding @@ -7340,11 +8157,389 @@ INCLUDE "stats/evos_attacks.asm" SECTION "bank11",DATA,BANK[$11] -INCBIN "baserom.gbc", $44000, $44378 - $44000 +FruitTreeScript: ; 44000 + 3callasm BANK(GetCurTreeFruit), GetCurTreeFruit + loadfont + copybytetovar CurFruit + itemtotext $0, $0 + 2writetext FruitBearingTreeText + keeptextopen + 3callasm BANK(TryResetFruitTrees), TryResetFruitTrees + 3callasm BANK(CheckFruitTree), CheckFruitTree + iffalse .fruit + 2writetext NothingHereText + closetext + 2jump .end + +.fruit + 2writetext HeyItsFruitText + copybytetovar CurFruit + giveitem $ff, 1 + iffalse .packisfull + keeptextopen + 2writetext ObtainedFruitText + 3callasm BANK(PickedFruitTree), PickedFruitTree + specialsound + itemnotify + 2jump .end + +.packisfull + keeptextopen + 2writetext FruitPackIsFullText + closetext + +.end + loadmovesprites + end +; 44041 + +GetCurTreeFruit: ; 44041 + ld a, [CurFruitTree] + dec a + call GetFruitTreeItem + ld [CurFruit], a + ret +; 4404c + +TryResetFruitTrees: ; 4404c + ld hl, $dc1e + bit 4, [hl] + ret nz + jp ResetFruitTrees +; 44055 + +CheckFruitTree: ; 44055 + ld b, 2 + call GetFruitTreeFlag + ld a, c + ld [ScriptVar], a + ret +; 4405f + +PickedFruitTree: ; 4405f + ld a, $41 + ld hl, $609b + rst FarCall ; empty function + + ld b, 1 + jp GetFruitTreeFlag +; 4406a + +ResetFruitTrees: ; 4406a + xor a + ld hl, FruitTreeFlags + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ld hl, $dc1e + set 4, [hl] + ret +; 44078 + +GetFruitTreeFlag: ; 44078 + push hl + push de + ld a, [CurFruitTree] + dec a + ld e, a + ld d, 0 + ld hl, FruitTreeFlags + call BitTableFunc + pop de + pop hl + ret +; 4408a + +GetFruitTreeItem: ; 4408a + push hl + push de + ld e, a + ld d, 0 + ld hl, FruitTreeItems + add hl, de + ld a, [hl] + pop de + pop hl + ret +; 44097 + +FruitTreeItems: ; 44097 + db BERRY + db BERRY + db BERRY + db BERRY + db PSNCUREBERRY + db PSNCUREBERRY + db BITTER_BERRY + db BITTER_BERRY + db PRZCUREBERRY + db PRZCUREBERRY + db MYSTERYBERRY + db MYSTERYBERRY + db ICE_BERRY + db ICE_BERRY + db MINT_BERRY + db BURNT_BERRY + db RED_APRICORN + db BLU_APRICORN + db BLK_APRICORN + db WHT_APRICORN + db PNK_APRICORN + db GRN_APRICORN + db YLW_APRICORN + db BERRY + db PSNCUREBERRY + db BITTER_BERRY + db PRZCUREBERRY + db ICE_BERRY + db MINT_BERRY + db BURNT_BERRY +; 440b5 + +FruitBearingTreeText: ; 440b5 + text_jump _FruitBearingTreeText, BANK(_FruitBearingTreeText) + db "@" +; 440ba + +HeyItsFruitText: ; 440ba + text_jump _HeyItsFruitText, BANK(_HeyItsFruitText) + db "@" +; 440bf + +ObtainedFruitText: ; 440bf + text_jump _ObtainedFruitText, BANK(_ObtainedFruitText) + db "@" +; 440c4 + +FruitPackIsFullText: ; 440c4 + text_jump _FruitPackIsFullText, BANK(_FruitPackIsFullText) + db "@" +; 440c9 + +NothingHereText: ; 440c9 + text_jump _NothingHereText, BANK(_NothingHereText) + db "@" +; 440ce + + + +AIChooseMove: ; 440ce +; Score each move in EnemyMonMoves starting from Buffer1. Lower is better. +; Pick the move with the lowest score. + +; Wildmons attack at random. + ld a, [IsInBattle] + dec a + ret z + + ld a, [InLinkBattle] + and a + ret nz + +; No use picking a move if there's no choice. + ld a, $f + ld hl, $68d1 + rst FarCall ; CheckLockedEnemyMove + ret nz + + +; The default score is 20. Unusable moves are given a score of 80. + ld a, 20 + ld hl, Buffer1 + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + +; Don't pick disabled moves. + ld a, [EnemyDisabledMove] + and a + jr z, .CheckPP + + ld hl, EnemyMonMove1 + ld c, 0 +.CheckDisabledMove + cp [hl] + jr z, .ScoreDisabledMove + inc c + inc hl + jr .CheckDisabledMove +.ScoreDisabledMove + ld hl, Buffer1 + ld b, 0 + add hl, bc + ld [hl], 80 + +; Don't pick moves with 0 PP. +.CheckPP + ld hl, Buffer1 - 1 + ld de, EnemyMonPP + ld b, 0 +.CheckMovePP + inc b + ld a, b + cp EnemyMonMovesEnd - EnemyMonMoves + 1 + jr z, .ApplyLayers + inc hl + ld a, [de] + inc de + and $3f + jr nz, .CheckMovePP + ld [hl], 80 + jr .CheckMovePP + + +; Apply AI scoring layers depending on the trainer class. +.ApplyLayers + ld hl, $559f ; TrainerAI + 3 ; e:559c-5771 + + ld a, [$cfc0] + bit 0, a + jr nz, .asm_4412f + + ld a, [TrainerClass] + dec a + ld bc, 7 ; Trainer2AI - Trainer1AI + call AddNTimes + +.asm_4412f + ld bc, (CHECK_FLAG << 8) | 0 + push bc + push hl + +.CheckLayer + pop hl + pop bc + + ld a, c + cp 16 ; up to 16 scoring layers + jr z, .asm_4415e + + push bc + ld d, $e ; BANK(TrainerAI) + ld a, PREDEF_FLAG + call Predef + ld d, c + pop bc + + inc c + push bc + push hl + + ld a, d + and a + jr z, .CheckLayer + + ld hl, AIScoringPointers + dec c + ld b, 0 + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld a, BANK(AIScoring) + call FarJpHl + + jr .CheckLayer + +.asm_4415e + ld hl, Buffer1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves +.asm_44166 + ld a, [de] + inc de + and a + jr z, .asm_4415e + + dec [hl] + jr z, .asm_44174 + + inc hl + dec c + jr z, .asm_4415e + + jr .asm_44166 + +.asm_44174 + ld a, c +.asm_44175 + inc [hl] + dec hl + inc a + cp EnemyMonMovesEnd - EnemyMonMoves + 1 + jr nz, .asm_44175 + + ld hl, Buffer1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves +.asm_44184 + ld a, [de] + and a + jr nz, .asm_44189 + ld [hl], a +.asm_44189 + ld a, [hl] + dec a + jr z, .asm_44191 + xor a + ld [hli], a + jr .asm_44193 +.asm_44191 + ld a, [de] + ld [hli], a +.asm_44193 + inc de + dec c + jr nz, .asm_44184 + +.asm_44197 + ld hl, Buffer1 + call RNG + and 3 + ld c, a + ld b, 0 + add hl, bc + ld a, [hl] + and a + jr z, .asm_44197 + + ld [CurEnemyMove], a + ld a, c + ld [CurEnemyMoveNum], a + ret +; 441af + + +AIScoringPointers: ; 441af + dw AIScoring_RedStatus + dw AIScoring_RedStatMods + dw AIScoring_RedSuperEffective + dw AIScoring_Offensive + dw AIScoring_Smart + dw AIScoring_Opportunist + dw AIScoring_Aggressive + dw AIScoring_Cautious + dw AIScoring_StatusImmunity + dw AIScoring_Risky + dw AIScoring_None + dw AIScoring_None + dw AIScoring_None + dw AIScoring_None + dw AIScoring_None + dw AIScoring_None +; 441cf + + +INCBIN "baserom.gbc", $441cf, $44378 - $441cf + PokedexDataPointerTable: ; 0x44378 INCLUDE "stats/pokedex/entry_pointers.asm" + INCBIN "baserom.gbc", $4456e, $44997 - $4456e @@ -8255,7 +9450,7 @@ StatsScreenInit: ; 4dc8a call $1ad2 ld a, $3e ld hl, $753e - rst $8 ; this loads graphics + rst FarCall ; this loads graphics pop hl call JpHl call $31f3 @@ -8332,7 +9527,7 @@ EggStatsScreen: ; 4e33a xor a ld [hBGMapMode], a ld hl, $cda1 - call $334e ; SetHPPal + call SetHPPal ld b, $3 call GetSGBLayout call $5f8f @@ -8373,12 +9568,13 @@ EggStatsScreen: ; 4e33a call $3786 ld a, $41 ld hl, $402d - rst $8 + rst FarCall call $6497 - ld a, [$d129] - cp $6 + + ld a, [TempMonHappiness] + cp 6 ret nc - ld de, $00bb + ld de, SFX_2_BOOPS call StartSFX ret ; 0x4e3c0 @@ -8469,13 +9665,15 @@ PartyMenuSelect: ; 0x50457 add hl, bc ld a, [hl] ld [CurPartySpecies], a - ld de, $0008 + + ld de, SFX_READ_TEXT_2 call StartSFX call WaitSFX and a ret + .exitmenu - ld de, $0008 + ld de, SFX_READ_TEXT_2 call StartSFX call WaitSFX scf @@ -8758,12 +9956,12 @@ GetGender: ; 50bdd push bc ld a, [CurPartySpecies] dec a - ld hl, BaseStats + 13 ; BASE_GENDER - ld bc, BaseStats1 - BaseStats + ld hl, BaseData + BaseGender - CurBaseData + ld bc, BaseData1 - BaseData call AddNTimes pop bc - ld a, BANK(BaseStats) + ld a, BANK(BaseData) call GetFarByte @@ -8798,7 +9996,7 @@ GetGender: ; 50bdd INCBIN "baserom.gbc", $50c50, $51424 - $50c50 -BaseStats: +BaseData: INCLUDE "stats/base_stats.asm" PokemonNames: @@ -9154,7 +10352,7 @@ WildPokemonAppearedText2: ; 0x80793 db "appeared!", $58 ; 0x807a9 -BattleText_0x807a9: ; 0x807a9 +WantsToBattleText: ; 0x807a9 db $0, $3f, $4f db "wants to battle!", $58 ; 0x807bd @@ -9214,7 +10412,7 @@ BattleText_0x80880: ; 0x80880 db $0, $59, $4f db "recovered with", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, ".", $58 ; 0x80899 @@ -9222,7 +10420,7 @@ BattleText_0x80899: ; 0x80899 db $0, $5a, $4f db "recovered PP using", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, ".", $58 ; 0x808b6 @@ -9238,13 +10436,13 @@ BattleText_0x808d2: ; 0x808d2 ; 0x808e7 BattleText_0x808e7: ; 0x808e7 - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, " #MON's", $4f db "LIGHT SCREEN fell!", $58 ; 0x80905 BattleText_0x80905: ; 0x80905 - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, " #MON's", $4f db "REFLECT faded!", $58 ; 0x8091f @@ -9391,7 +10589,7 @@ BattleText_0x80b89: ; 0x80b89 db $0, $5a, $4f db "fled using a", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "!", $58 ; 0x80ba0 @@ -9408,14 +10606,14 @@ RecoveredUsingText: ; 0x80bc2 db $0, $59, $4f db "recovered using a", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "!", $58 ; 0x80bde BattleText_0x80bde: ; 0x80bde db $0, $5a, "'s", $4f db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, $55 db "activated!", $58 ; 0x80bf3 @@ -9459,7 +10657,7 @@ BattleText_0x80c8a: ; 0x80c8a ; 0x80c9c BattleText_0x80c9c: ; 0x80c9c - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, " grew to", $4f db "level @" deciram $d143, $13 @@ -9538,7 +10736,7 @@ BecameConfusedText: ; 0x80d97 BattleText_0x80dab: ; 0x80dab db $0, "A @" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, " rid", $4f db $59, $55 db "of its confusion.", $58 @@ -9553,7 +10751,7 @@ BattleText_0x80de2: ; 0x80de2 db $0, $5a, "'s", $4f db "hurt by", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "!", $58 ; 0x80df5 @@ -9561,7 +10759,7 @@ BattleText_0x80df5: ; 0x80df5 db $0, $5a, $4f db "was released from", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "!", $58 ; 0x80e11 @@ -9607,7 +10805,7 @@ HungOnText: ; 0x80e99 db $0, $59, $4f db "hung on with", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "!", $58 ; 0x80eb0 @@ -9631,7 +10829,7 @@ InfatuationText: ; 0x80eda DisabledMoveText: ; 0x80f02 db $0, $5a, "'s", $4f db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, " is", $55 db "DISABLED!", $58 ; 0x80f19 @@ -9775,7 +10973,7 @@ SketchedText: ; 0x81143 db $0, $5a, $4f db "SKETCHED", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "!", $58 ; 0x81156 @@ -9788,7 +10986,7 @@ DestinyBondEffectText: ; 0x81156 SpiteEffectText: ; 0x8117f db $0, $59, "'s", $4f db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, " was", $55 db "reduced by @" deciram $d265, $11 @@ -9944,7 +11142,7 @@ LearnedMoveText: ; 0x813e6 db $0, $5a, $4f db "learned", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "!", $58 ; 0x813f8 @@ -9961,7 +11159,7 @@ EvadedText: ; 0x81407 WasDisabledText: ; 0x8141d db $0, $59, "'s", $4f db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, " was", $55 db "DISABLED!", $58 ; 0x81435 @@ -9975,7 +11173,7 @@ TransformedTypeText: ; 0x81452 db $0, $5a, $4f db "transformed into", $55 db "the @" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "-type!", $58 ; 0x81476 @@ -9988,7 +11186,7 @@ TransformedText: ; 0x81499 db $0, $5a, $4f db "TRANSFORMED into", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "!", $58 ; 0x814b4 @@ -10055,7 +11253,7 @@ ProtectedByText: ; 0x815a9 db $0, $59, "'s", $4f db "protected by", $55 db "@" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "!", $58 ; 0x815c1 @@ -10066,7 +11264,7 @@ MirrorMoveFailedText: ; 0x815c1 StoleText: ; 0x815da db $0, $5a, $4f db "stole @" - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, $55 db "from its foe!", $58 ; 0x815f7 @@ -10198,7 +11396,7 @@ ForesawAttackText: ; 0x81817 ; 0x8182d BeatUpAttackText: ; 0x8182d - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "'s", $4f db "attack!", $57 ; 0x8183b @@ -10487,7 +11685,7 @@ HallOfFame3: ; 0x8640e ld a, $5 ld hl, $4da0 - rst $8 + rst FarCall ld hl, $d95e ld a, [hl] cp $c8 @@ -10496,11 +11694,11 @@ HallOfFame3: ; 0x8640e .asm_86436 ld a, $5 ld hl, $4b85 - rst $8 + rst FarCall call $653f ld a, $5 ld hl, $4b5f - rst $8 + rst FarCall xor a ld [$c2cd], a call $64c3 @@ -10508,7 +11706,7 @@ HallOfFame3: ; 0x8640e ld b, a ld a, $42 ld hl, $5847 - rst $8 + rst FarCall ret ; 0x86455 @@ -16080,7 +17278,7 @@ StartTitleScreen: ; 10ed67 ; Play starting sound effect call SFXChannelsOff - ld de, $0065 + ld de, SFX_TITLE_SCREEN_ENTRANCE call StartSFX ret @@ -17784,7 +18982,36 @@ INCLUDE "stats/pokedex/entries_2.asm" SECTION "bank6F",DATA,BANK[$6F] -INCBIN "baserom.gbc", $1bc000, $1be08d - $1bc000 +_FruitBearingTreeText: ; 0x1bc000 + db $0, "It's a fruit-", $4f + db "bearing tree.", $57 +; 0x1bc01c + +_HeyItsFruitText: ; 0x1bc01c + db $0, "Hey! It's", $4f + db "@" + text_from_ram StringBuffer3 + db $0, "!", $57 +; 0x1bc02d + +_ObtainedFruitText: ; 0x1bc02d + db $0, "Obtained", $4f + db "@" + text_from_ram StringBuffer3 + db $0, "!", $57 +; 0x1bc03e + +_FruitPackIsFullText: ; 0x1bc03e + db $0, "But the PACK is", $4f + db "full…", $57 +; 0x1bc055 + +_NothingHereText: ; 0x1bc055 + db $0, "There's nothing", $4f + db "here…", $57 +; 0x1bc06b + +INCBIN "baserom.gbc", $1bc06b, $1be08d - $1bc06b SECTION "bank70",DATA,BANK[$70] diff --git a/maps/BattleTower1F.asm b/maps/BattleTower1F.asm index 475835442..ecfa62f21 100644 --- a/maps/BattleTower1F.asm +++ b/maps/BattleTower1F.asm @@ -4,7 +4,7 @@ BattleTower1F_MapScriptHeader: ; 0x9e393 ; triggers dw UnknownScript_0x9e39d, $0000 - dw $63d3, $0000 + dw UnknownScript_0x9e3d3, $0000 ; callback count db 0 @@ -39,6 +39,7 @@ UnknownScript_0x9e3c7: ; 0x9e3c7 special $0086 UnknownScript_0x9e3d1: ; 0x9e3d1 dotrigger $1 +UnknownScript_0x9e3d3: ; 0x9e3d3 end ; 0x9e3d4 @@ -57,7 +58,7 @@ UnknownScript_0x9e3e0: ; 0x9e3e0 UnknownScript_0x9e3e2: ; 0x9e3e2 writebyte $2 special $0086 - if_equal $3, $74e4 ; wtf ? + if_equal $3, BattleTowerBattleRoomScript_0x9f4e4 loadfont 2writetext UnknownText_0x9e5ab keeptextopen @@ -119,7 +120,7 @@ UnknownScript_0x9e454: ; 0x9e454 warpsound disappear $2 stopfollow - applymovement $0, $6576 + applymovement $0, MovementData_0x9e576 warpcheck end ; 0x9e47a @@ -177,9 +178,21 @@ UnknownScript_0x9e4bb: ; 0x9e4bb end ; 0x9e4be -INCBIN "baserom.gbc",$9e4be,$9e4e4 - $9e4be -UnknownScript_0x9e4e4: ; 0x9e4e4 +UnknownScript_0x9e4be: ; 0x9e4be + 2writetext UnknownText_0x9ef1f + yesorno + iffalse UnknownScript_0x9e3fc + special $0004 + iffalse UnknownScript_0x9e3fc + writebyte $1 + special $0086 + special $0075 + if_equal $a, UnknownScript_0x9e3fc + if_not_equal $0, UnknownScript_0x9e550 + 2writetext UnknownText_0x9e9eb + spriteface $2, $2 + 2writetext UnknownText_0x9ea1b closetext spriteface $2, $0 loadmovesprites @@ -282,6 +295,7 @@ MovementData_0x9e571: ; 0x9e571 step_up step_up step_up +MovementData_0x9e576: ; 0x9e576 step_up step_end ; 0x9e578 diff --git a/maps/BattleTowerBattleRoom.asm b/maps/BattleTowerBattleRoom.asm index 06755369f..8297da4f2 100644 --- a/maps/BattleTowerBattleRoom.asm +++ b/maps/BattleTowerBattleRoom.asm @@ -108,6 +108,7 @@ UnknownScript_0x9f4d9: ; 0x9f4d9 pause 60 special $002f warpfacing $1, GROUP_BATTLE_TOWER_1F, MAP_BATTLE_TOWER_1F, $7, $7 +BattleTowerBattleRoomScript_0x9f4e4: ; 0x9f4e4 loadfont 2writetext UnknownText_0x9eaef 2jump UnknownScript_0x9e47a @@ -136,7 +137,12 @@ UnknownScript_0x9f4f7: ; 0x9f4f7 end ; 0x9f50b -INCBIN "baserom.gbc",$9f50b,$9f52e-$9f50b + +UnknownText_0x9f50b: ; 0x9f50b + db $0, "You'll be returned", $4f + db "after you SAVE.", $57 +; 0x9f52e + BattleTowerBattleRoom_MapEventHeader: ; 0x9f52e ; filler diff --git a/maps/BattleTowerHallway.asm b/maps/BattleTowerHallway.asm index 172e5f0f7..dd74470a7 100644 --- a/maps/BattleTowerHallway.asm +++ b/maps/BattleTowerHallway.asm @@ -21,11 +21,25 @@ UnknownScript_0x9f5c0: ; 0x9f5c0 UnknownScript_0x9f5c1: ; 0x9f5c1 follow $2, $0 - 3callasm $27, $75cb + 3callasm BANK(Function_0x9f5cb), Function_0x9f5cb 2jump UnknownScript_0x9f5dc ; 0x9f5cb -INCBIN "baserom.gbc",$9f5cb,$9f5dc - $9f5cb + +Function_0x9f5cb: ; 0x9f5cb + ld a, [rSVBK] + push af + + ld a, 3 + ld [rSVBK], a + ld a, [$d800] + ld [ScriptVar], a + + pop af + ld [rSVBK], a + ret +; 0x9f5dc + UnknownScript_0x9f5dc: ; 0x9f5dc if_equal $3, UnknownScript_0x9f603 diff --git a/maps/BlackthornGym2F.asm b/maps/BlackthornGym2F.asm index cdf7b11e7..fb191e358 100644 --- a/maps/BlackthornGym2F.asm +++ b/maps/BlackthornGym2F.asm @@ -11,11 +11,59 @@ BlackthornGym2F_MapScriptHeader: ; 0x195722 ; 0x195727 UnknownScript_0x195727: ; 0x195727 - writecmdqueue $572b + writecmdqueue CmdQueue_0x19572b return ; 0x19572b -INCBIN "baserom.gbc",$19572b,$33 +CmdQueue_0x19572b: ; 0x19572b + dbw 2, StoneTable_0x195730 ; check if any stones are sitting on a warp + db 0, 0 ; filler +; 0x195730 + +StoneTable_0x195730: ; 0x195730 + db 5, 4 ; warp, person + dw UnknownScript_0x19573d + + db 3, 5 ; warp, person + dw UnknownScript_0x195742 + + db 4, 6 ; warp, person + dw UnknownScript_0x195747 + + db $ff ; end +; 0x19573d + +UnknownScript_0x19573d: ; 0x19573d + disappear 4 + 2jump UnknownScript_0x19574c +; 0x195742 + +UnknownScript_0x195742: ; 0x195742 + disappear 5 + 2jump UnknownScript_0x19574c +; 0x195747 + +UnknownScript_0x195747: ; 0x195747 + disappear 6 + 2jump UnknownScript_0x19574c +; 0x19574c + +UnknownScript_0x19574c: ; 0x19574c + pause 30 + 2call UnknownScript_0x195758 + loadfont + 2writetext UnknownText_0x1958a5 + closetext + loadmovesprites + end +; 0x195758 + +UnknownScript_0x195758: ; 0x195758 + playsound $001b + earthquake 80 + end +; 0x19575e + UnknownScript_0x19575e: ; 0x19575e jumpstd $000e diff --git a/maps/CeladonDeptStore6F.asm b/maps/CeladonDeptStore6F.asm index bf4efc687..d5218388b 100644 --- a/maps/CeladonDeptStore6F.asm +++ b/maps/CeladonDeptStore6F.asm @@ -28,7 +28,7 @@ MapCeladonDeptStore6FSignpost5Script: ; 0x71180 2writetext UnknownText_0x71250 UnknownScript_0x71184: ; 0x71184 special $0051 - loadmenudata $5203 + loadmenudata MenuDataHeader_0x71203 interpretmenu2 writebackup if_equal $1, UnknownScript_0x7119a @@ -89,8 +89,24 @@ UnknownScript_0x711fc: ; 0x711fc 2jump UnknownScript_0x71184 ; 0x71203 -; menu data -INCBIN "baserom.gbc",$71203,$47 + +MenuDataHeader_0x71203: ; 0x71203 + db $40 ; flags + db 02, 00 ; start coords + db 11, 19 ; end coords + dw MenuData2_0x7120b + db 1 ; default option +; 0x7120b + +MenuData2_0x7120b: ; 0x7120b + db $80 ; flags + db 4 ; items + db "FRESH WATER ¥200@" + db "SODA POP ¥300@" + db "LEMONADE ¥350@" + db "CANCEL@" +; 0x71249 + MapCeladonDeptStore6FSignpost0Script: ; 0x7124a jumptext UnknownText_0x7133e diff --git a/maps/CeladonDeptStoreElevator.asm b/maps/CeladonDeptStoreElevator.asm index 4b390f0ab..aa2ed2cf8 100644 --- a/maps/CeladonDeptStoreElevator.asm +++ b/maps/CeladonDeptStoreElevator.asm @@ -8,7 +8,7 @@ CeladonDeptStoreElevator_MapScriptHeader: ; 0x713ab MapCeladonDeptStoreElevatorSignpost0Script: ; 0x713ad loadfont - elevator $53be + elevator Elevator_0x713be loadmovesprites iffalse UnknownScript_0x713bd pause 5 @@ -19,19 +19,18 @@ UnknownScript_0x713bd: ; 0x713bd end ; 0x713be -; elevator -UnknownText_0x713be: ; 0x713be - text_waitbutton - text_box $1504, 5, 5 - store_at $615 - text_waitbutton - store_at $715 - text_dunno2 - store_at $815 - start_asm -; 0x713d0 - -INCBIN "baserom.gbc",$713d0,$713d8 - $713d0 + +Elevator_0x713be: ; 0x713be + db 6 ; floors + db _1F, 4, GROUP_CELADON_DEPT_STORE_1F, MAP_CELADON_DEPT_STORE_1F + db _2F, 3, GROUP_CELADON_DEPT_STORE_2F, MAP_CELADON_DEPT_STORE_2F + db _3F, 3, GROUP_CELADON_DEPT_STORE_3F, MAP_CELADON_DEPT_STORE_3F + db _4F, 3, GROUP_CELADON_DEPT_STORE_4F, MAP_CELADON_DEPT_STORE_4F + db _5F, 3, GROUP_CELADON_DEPT_STORE_5F, MAP_CELADON_DEPT_STORE_5F + db _6F, 2, GROUP_CELADON_DEPT_STORE_6F, MAP_CELADON_DEPT_STORE_6F + db $ff ; end +; 0x713d8 + CeladonDeptStoreElevator_MapEventHeader: ; 0x713d8 ; filler diff --git a/maps/CeladonGameCornerPrizeRoom.asm b/maps/CeladonGameCornerPrizeRoom.asm index 0098cd3d8..eb4fa063d 100644 --- a/maps/CeladonGameCornerPrizeRoom.asm +++ b/maps/CeladonGameCornerPrizeRoom.asm @@ -24,7 +24,7 @@ MapCeladonGameCornerPrizeRoomSignpost0Script: ; 0x726ef 2writetext UnknownText_0x72974 UnknownScript_0x726fd: ; 0x726fd special $004f - loadmenudata $6790 + loadmenudata MenuDataHeader_0x72790 interpretmenu2 writebackup if_equal $1, UnknownScript_0x72714 @@ -111,8 +111,24 @@ UnknownScript_0x7278a: ; 0x7278a end ; 0x72790 -; menu data -INCBIN "baserom.gbc",$72790,$38 + +MenuDataHeader_0x72790: ; 0x72790 + db $40 ; flags + db 02, 00 ; start coords + db 11, 15 ; end coords + dw MenuData2_0x72798 + db 1 ; default option +; 0x72798 + +MenuData2_0x72798: ; 0x72798 + db $80 ; flags + db 4 ; items + db "TM32 1500@" + db "TM29 3500@" + db "TM15 7500@" + db "CANCEL@" +; 0x727c8 + MapCeladonGameCornerPrizeRoomSignpost1Script: ; 0x727c8 faceplayer @@ -124,7 +140,7 @@ MapCeladonGameCornerPrizeRoomSignpost1Script: ; 0x727c8 UnknownScript_0x727d3: ; 0x727d3 2writetext UnknownText_0x72974 special $004f - loadmenudata $6877 + loadmenudata MenuDataHeader_0x72877 interpretmenu2 writebackup if_equal $1, UnknownScript_0x727ed @@ -190,8 +206,24 @@ UnknownScript_0x72849: ; 0x72849 2jump UnknownScript_0x727d3 ; 0x72877 -; menu data -INCBIN "baserom.gbc",$72877,$41 + +MenuDataHeader_0x72877: ; 0x72877 + db $40 ; flags + db 02, 00 ; start coords + db 11, 17 ; end coords + dw MenuData2_0x7287f + db 1 ; default option +; 0x7287f + +MenuData2_0x7287f: ; 0x7287f + db $80 ; flags + db 4 ; items + db "PIKACHU 2222@" + db "PORYGON 5555@" + db "LARVITAR 8888@" + db "CANCEL@" +; 0x728b8 + UnknownText_0x728b8: ; 0x728b8 db $0, "I wanted PORYGON,", $4f diff --git a/maps/DragonShrine.asm b/maps/DragonShrine.asm index cdebae792..24b701ef1 100644 --- a/maps/DragonShrine.asm +++ b/maps/DragonShrine.asm @@ -29,7 +29,7 @@ UnknownScript_0x18d030: ; 0x18d030 setbit1 $0001 2writetext UnknownText_0x18d3bc keeptextopen - loadmenudata $5215 + loadmenudata MenuDataHeader_0x18d215 interpretmenu2 writebackup if_equal $1, UnknownScript_0x18d0a9 @@ -42,7 +42,7 @@ UnknownScript_0x18d049: ; 0x18d049 setbit1 $0002 2writetext UnknownText_0x18d3d3 keeptextopen - loadmenudata $5234 + loadmenudata MenuDataHeader_0x18d234 interpretmenu2 writebackup if_equal $1, UnknownScript_0x18d0a9 @@ -52,7 +52,7 @@ UnknownScript_0x18d061: ; 0x18d061 setbit1 $0003 2writetext UnknownText_0x18d3f3 keeptextopen - loadmenudata $5258 + loadmenudata MenuDataHeader_0x18d258 interpretmenu2 writebackup if_equal $1, UnknownScript_0x18d0cb @@ -62,7 +62,7 @@ UnknownScript_0x18d079: ; 0x18d079 setbit1 $0004 2writetext UnknownText_0x18d420 keeptextopen - loadmenudata $5283 + loadmenudata MenuDataHeader_0x18d283 interpretmenu2 writebackup if_equal $1, UnknownScript_0x18d0a9 @@ -72,7 +72,7 @@ UnknownScript_0x18d091: ; 0x18d091 setbit1 $0005 2writetext UnknownText_0x18d44a keeptextopen - loadmenudata $52a5 + loadmenudata MenuDataHeader_0x18d2a5 interpretmenu2 writebackup if_equal $1, UnknownScript_0x18d0cb @@ -274,7 +274,91 @@ UnknownScript_0x18d20d: ; 0x18d20d end ; 0x18d215 -INCBIN "baserom.gbc",$18d215,$aa + +MenuDataHeader_0x18d215: ; 0x18d215 + db $40 ; flags + db 04, 08 ; start coords + db 11, 19 ; end coords + dw MenuData2_0x18d21d + db 1 ; default option +; 0x18d21d + +MenuData2_0x18d21d: ; 0x18d21d + db $81 ; flags + db 3 ; items + db "Pal@" + db "Underling@" + db "Friend@" +; 0x18d234 + + +MenuDataHeader_0x18d234: ; 0x18d234 + db $40 ; flags + db 04, 09 ; start coords + db 11, 19 ; end coords + dw MenuData2_0x18d23c + db 1 ; default option +; 0x18d23c + +MenuData2_0x18d23c: ; 0x18d23c + db $81 ; flags + db 3 ; items + db "Strategy@" + db "Raising@" + db "Cheating@" +; 0x18d258 + + +MenuDataHeader_0x18d258: ; 0x18d258 + db $40 ; flags + db 04, 05 ; start coords + db 11, 19 ; end coords + dw MenuData2_0x18d260 + db 1 ; default option +; 0x18d260 + +MenuData2_0x18d260: ; 0x18d260 + db $81 ; flags + db 3 ; items + db "Weak person@" + db "Tough person@" + db "Anybody@" +; 0x18d283 + + +MenuDataHeader_0x18d283: ; 0x18d283 + db $40 ; flags + db 04, 08 ; start coords + db 11, 19 ; end coords + dw MenuData2_0x18d28b + db 1 ; default option +; 0x18d28b + +MenuData2_0x18d28b: ; 0x18d28b + db $81 ; flags + db 3 ; items + db "Love@" + db "Violence@" + db "Knowledge@" +; 0x18d2a5 + + +MenuDataHeader_0x18d2a5: ; 0x18d2a5 + db $40 ; flags + db 04, 12 ; start coords + db 11, 19 ; end coords + dw MenuData2_0x18d2ad + db 1 ; default option +; 0x18d2ad + +MenuData2_0x18d2ad: ; 0x18d2ad + db $81 ; flags + db 3 ; items + db "Tough@" + db "Both@" + db "Weak@" +; 0x18d2bf + MovementData_0x18d2bf: ; 0x18d2bf slow_step_up diff --git a/maps/DragonsDenB1F.asm b/maps/DragonsDenB1F.asm index 317253e02..d57796fbd 100644 --- a/maps/DragonsDenB1F.asm +++ b/maps/DragonsDenB1F.asm @@ -143,9 +143,7 @@ CooltrainerfCaraScript: ; 0x18c92a end ; 0x18c932 -INCBIN "baserom.gbc",$18c932,$14 - -TrainerTwinsLeaandpia1: ; 0x18c946 +TrainerTwinsLeaandpia1: ; 0x18c932 ; bit/flag number dw $5bf @@ -156,17 +154,45 @@ TrainerTwinsLeaandpia1: ; 0x18c946 dw TwinsLeaandpia1SeenText ; text when trainer beaten - ;dw TwinsLeaandpia1BeatenText - dw $4f06 + dw TwinsLeaandpia1BeatenText ; script when lost dw $0000 ; script when talk again dw TwinsLeaandpia1Script +; 0x18c93e + +TwinsLeaandpia1Script: ; 0x18c93e + talkaftercancel + loadfont + 2writetext UnknownText_0x18ced3 + closetext + loadmovesprites + end +; 0x18c946 + +TrainerTwinsLeaandpia2: ; 0x18c946 + ; bit/flag number + dw $5bf + + ; trainer group && trainer id + db TWINS, LEAANDPIA1 + + ; text when seen + dw TwinsLeaandpia2SeenText + + ; text when trainer beaten + dw TwinsLeaandpia2BeatenText + + ; script when lost + dw $0000 + + ; script when talk again + dw TwinsLeaandpia2Script ; 0x18c952 -TwinsLeaandpia1Script: ; 0x18c952 +TwinsLeaandpia2Script: ; 0x18c952 talkaftercancel loadfont 2writetext UnknownText_0x18cf0f @@ -395,7 +421,7 @@ UnknownText_0x18ce11: ; 0x18ce11 db "approval.", $57 ; 0x18ceab -UnknownText_0x18ceab: ; 0x18ceab +TwinsLeaandpia1SeenText: ; 0x18ceab db $0, "It's a stranger we", $4f db "don't know.", $57 ; 0x18cec9 @@ -409,11 +435,11 @@ UnknownText_0x18ced3: ; 0x18ced3 db "to battle LANCE.", $57 ; 0x18cef8 -TwinsLeaandpia1SeenText: ; 0x18cef8 +TwinsLeaandpia2SeenText: ; 0x18cef8 db $0, "Who are you?", $57 ; 0x18cf06 -UnknownText_0x18cf06: ; 0x18cf06 +TwinsLeaandpia2BeatenText: ; 0x18cf06 db $0, "Meanie.", $57 ; 0x18cf0f @@ -464,7 +490,7 @@ DragonsDenB1F_MapEventHeader: ; 0x18cf73 person_event $23, 12, 24, $7, $0, 255, 255, $82, 4, TrainerCooltrainermDarin, $ffff person_event $24, 12, 12, $6, $0, 255, 255, $82, 3, TrainerCooltrainerfCara, $ffff person_event $26, 21, 8, $9, $0, 255, 255, $82, 1, $4932, $ffff - person_event $26, 22, 8, $9, $0, 255, 255, $82, 1, TrainerTwinsLeaandpia1, $ffff + person_event $26, 22, 8, $9, $0, 255, 255, $82, 1, TrainerTwinsLeaandpia2, $ffff person_event $54, 8, 34, $1, $0, 255, 255, $1, 0, ItemFragment_0x18c9a1, $07bf person_event $54, 24, 9, $1, $0, 255, 255, $1, 0, ItemFragment_0x18c9a3, $07c0 ; 0x18d014 diff --git a/maps/EarlsPokemonAcademy.asm b/maps/EarlsPokemonAcademy.asm index e0aa6f725..141de61b2 100644 --- a/maps/EarlsPokemonAcademy.asm +++ b/maps/EarlsPokemonAcademy.asm @@ -65,7 +65,7 @@ MapEarlsPokemonAcademySignpost3Script: ; 0x68a9f loadfont 2writetext UnknownText_0x68eb2 UnknownScript_0x68aa3: ; 0x68aa3 - loadmenudata $4ae1 + loadmenudata MenuDataHeader_0x68ae1 interpretmenu writebackup if_equal $1, UnknownScript_0x68abe @@ -107,8 +107,32 @@ UnknownScript_0x68ada: ; 0x68ada 2jump UnknownScript_0x68aa3 ; 0x68ae1 -; menu data -INCBIN "baserom.gbc",$68ae1,$2a + +MenuDataHeader_0x68ae1: ; 0x68ae1 + db $40 ; flags + db 00, 00 ; start coords + db 08, 11 ; end coords + dw MenuData2_0x68ae9 + db 1 ; default option +; 0x68ae9 + +MenuData2_0x68ae9: ; 0x68ae9 + db $80 ; flags + dn 3, 2 ; rows, columns + db 5 ; spacing + dbw BANK(UnknownText_0x68af2), UnknownText_0x68af2 + dbw $1a, $0000 +; 0x68af2 + +UnknownText_0x68af2: ; 0x68af2 + db "PSN@" + db "PAR@" + db "SLP@" + db "BRN@" + db "FRZ@" + db "QUIT@" +; 0x68b0b + UnknownScript_0x68b0b: ; 0x68b0b loadfont diff --git a/maps/GoldenrodCity.asm b/maps/GoldenrodCity.asm index 7470b6602..4251f96b7 100644 --- a/maps/GoldenrodCity.asm +++ b/maps/GoldenrodCity.asm @@ -56,7 +56,7 @@ UnknownScript_0x198909: ; 0x198909 checkcoins 4000 if_equal $2, UnknownScript_0x1989dd 2writetext UnknownText_0x1990ce - loadmenudata $4967 + loadmenudata MenuDataHeader_0x198967 interpretmenu2 writebackup if_equal $1, UnknownScript_0x19893a @@ -89,7 +89,24 @@ UnknownScript_0x198958: ; 0x198958 2jump UnknownScript_0x1989d7 ; 0x198967 -INCBIN "baserom.gbc",$198967,$33 + +MenuDataHeader_0x198967: ; 0x198967 + db $40 ; flags + db 02, 00 ; start coords + db 11, 15 ; end coords + dw MenuData2_0x19896f + db 1 ; default option +; 0x19896f + +MenuData2_0x19896f: ; 0x19896f + db $80 ; flags + db 4 ; items + db "FLAMETHROWER@" + db "THUNDERBOLT@" + db "ICE BEAM@" + db "CANCEL@" +; 0x19899a + UnknownScript_0x19899a: ; 0x19899a 2writetext UnknownText_0x1990b4 diff --git a/maps/GoldenrodDeptStore6F.asm b/maps/GoldenrodDeptStore6F.asm index 2e97c5555..78098e8ac 100644 --- a/maps/GoldenrodDeptStore6F.asm +++ b/maps/GoldenrodDeptStore6F.asm @@ -11,7 +11,7 @@ MapGoldenrodDeptStore6FSignpost5Script: ; 0x563f5 2writetext UnknownText_0x564cb UnknownScript_0x563f9: ; 0x563f9 special $0051 - loadmenudata $6478 + loadmenudata MenuDataHeader_0x56478 interpretmenu2 writebackup if_equal $1, UnknownScript_0x5640f @@ -72,8 +72,24 @@ UnknownScript_0x56471: ; 0x56471 2jump UnknownScript_0x563f9 ; 0x56478 -; menu data -INCBIN "baserom.gbc",$56478,$564bf - $56478 + +MenuDataHeader_0x56478: ; 0x56478 + db $40 ; flags + db 02, 00 ; start coords + db 11, 19 ; end coords + dw MenuData2_0x56480 + db 1 ; default option +; 0x56480 + +MenuData2_0x56480: ; 0x56480 + db $80 ; flags + db 4 ; items + db "FRESH WATER ¥200@" + db "SODA POP ¥300@" + db "LEMONADE ¥350@" + db "CANCEL@" +; 0x564bf + UnknownScript_0x564bf: ; 0x564bf jumptextfaceplayer UnknownText_0x5654b diff --git a/maps/GoldenrodDeptStoreElevator.asm b/maps/GoldenrodDeptStoreElevator.asm index e6ea29231..651fcf7f6 100644 --- a/maps/GoldenrodDeptStoreElevator.asm +++ b/maps/GoldenrodDeptStoreElevator.asm @@ -8,7 +8,7 @@ GoldenrodDeptStoreElevator_MapScriptHeader: ; 0x56697 MapGoldenrodDeptStoreElevatorSignpost0Script: ; 0x56699 loadfont - elevator $66e0 + elevator Elevator_0x566e0 loadmovesprites iffalse UnknownScript_0x566df pause 5 @@ -48,7 +48,19 @@ UnknownScript_0x566df: ; 0x566df end ; 0x566e0 -INCBIN "baserom.gbc",$566e0,$566fe - $566e0 + +Elevator_0x566e0: ; 0x566e0 + db 7 ; floors + db _B1F, 2, GROUP_GOLDENROD_DEPT_STORE_B1F, MAP_GOLDENROD_DEPT_STORE_B1F + db _1F, 4, GROUP_GOLDENROD_DEPT_STORE_1F, MAP_GOLDENROD_DEPT_STORE_1F + db _2F, 3, GROUP_GOLDENROD_DEPT_STORE_2F, MAP_GOLDENROD_DEPT_STORE_2F + db _3F, 3, GROUP_GOLDENROD_DEPT_STORE_3F, MAP_GOLDENROD_DEPT_STORE_3F + db _4F, 3, GROUP_GOLDENROD_DEPT_STORE_4F, MAP_GOLDENROD_DEPT_STORE_4F + db _5F, 3, GROUP_GOLDENROD_DEPT_STORE_5F, MAP_GOLDENROD_DEPT_STORE_5F + db _6F, 2, GROUP_GOLDENROD_DEPT_STORE_6F, MAP_GOLDENROD_DEPT_STORE_6F + db $ff ; end +; 0x566fe + GoldenrodDeptStoreElevator_MapEventHeader: ; 0x566fe ; filler diff --git a/maps/GoldenrodGameCorner.asm b/maps/GoldenrodGameCorner.asm index bb7378897..2f8df16f3 100644 --- a/maps/GoldenrodGameCorner.asm +++ b/maps/GoldenrodGameCorner.asm @@ -55,7 +55,7 @@ UnknownScript_0x56c28: ; 0x56c28 2writetext UnknownText_0x56e8b UnknownScript_0x56c36: ; 056c36 special $004f - loadmenudata $6cc9 + loadmenudata MenuDataHeader_0x56cc9 interpretmenu2 writebackup if_equal $1, UnknownScript_0x56c4d @@ -142,8 +142,24 @@ UnknownScript_0x56cc3: ; 0x56cc3 end ; 0x56cc9 -; menu data -INCBIN "baserom.gbc",$56cc9,$38 + +MenuDataHeader_0x56cc9: ; 0x56cc9 + db $40 ; flags + db 02, 00 ; start coords + db 11, 15 ; end coords + dw MenuData2_0x56cd1 + db 1 ; default option +; 0x56cd1 + +MenuData2_0x56cd1: ; 0x56cd1 + db $80 ; flags + db 4 ; items + db "TM25 5500@" + db "TM14 5500@" + db "TM38 5500@" + db "CANCEL@" +; 0x56d01 + UnknownScript_0x56d01: ; 0x56d01 faceplayer @@ -155,7 +171,7 @@ UnknownScript_0x56d01: ; 0x56d01 UnknownScript_0x56d0c: ; 0x56d0c 2writetext UnknownText_0x56e8b special $004f - loadmenudata $6db0 + loadmenudata MenuDataHeader_0x56db0 interpretmenu2 writebackup if_equal $1, UnknownScript_0x56d26 @@ -221,8 +237,24 @@ UnknownScript_0x56d82: ; 0x56d82 2jump UnknownScript_0x56d0c ; 0x56db0 -; menu data -INCBIN "baserom.gbc",$56db0,$56df1 - $56db0 + +MenuDataHeader_0x56db0: ; 0x56db0 + db $40 ; flags + db 02, 00 ; start coords + db 11, 17 ; end coords + dw MenuData2_0x56db8 + db 1 ; default option +; 0x56db8 + +MenuData2_0x56db8: ; 0x56db8 + db $80 ; flags + db 4 ; items + db "ABRA 100@" + db "CUBONE 800@" + db "WOBBUFFET 1500@" + db "CANCEL@" +; 0x56df1 + UnknownScript_0x56df1: ; 0x56df1 faceplayer diff --git a/maps/GoldenrodPokeComCenter2FMobile.asm b/maps/GoldenrodPokeComCenter2FMobile.asm index 41e412788..0e94da1e9 100644 --- a/maps/GoldenrodPokeComCenter2FMobile.asm +++ b/maps/GoldenrodPokeComCenter2FMobile.asm @@ -24,7 +24,7 @@ MapGoldenrodPokeComCenter2FMobileSignpost0Script: ; 0x625da closetext UnknownScript_0x625df: ; 0x625df reloadmappart - loadmenudata $6602 + loadmenudata MenuDataHeader_0x62602 interpretmenu2 writebackup if_equal $1, UnknownScript_0x625f0 @@ -51,7 +51,23 @@ UnknownScript_0x62600: ; 0x62600 end ; 0x62602 -INCBIN "baserom.gbc",$62602,$62624 - $62602 + +MenuDataHeader_0x62602: ; 0x62602 + db $40 ; flags + db 00, 00 ; start coords + db 08, 15 ; end coords + dw MenuData2_0x6260a + db 1 ; default option +; 0x6260a + +MenuData2_0x6260a: ; 0x6260a + db $80 ; flags + db 3 ; items + db "# つうしん クラブ@" ; # COM CLUB + db "モバイルセンター@" ; MOBILE CENTER + db "やめる@" ; QUIT +; 0x62624 + MapGoldenrodPokeComCenter2FMobileSignpost1Script: ; 0x62624 loadfont @@ -86,8 +102,23 @@ UnknownScript_0x6264a: ; 0x6264a end ; 0x6264c -; menu data -INCBIN "baserom.gbc",$6264c,$25 + +MenuDataHeader_0x6264c: ; 0x6264c + db $40 ; flags + db 00, 00 ; start coords + db 08, 15 ; end coords + dw MenuData2_0x62654 + db 1 ; default option +; 0x62654 + +MenuData2_0x62654: ; 0x62654 + db $80 ; flags + db 3 ; items + db "でんわ",$1f,"つかうとき@" ; Use phone + db "でんわ",$4a,"つながらないとき@" ; Don't use phone + db "やめる@" ; QUIT +; 0x62673 + MapGoldenrodPokeComCenter2FMobileSignpost2Script: ; 0x62671 jumptext UnknownText_0x62b26 diff --git a/maps/IcePathB1F.asm b/maps/IcePathB1F.asm index 98fa1f27c..302fa9234 100644 --- a/maps/IcePathB1F.asm +++ b/maps/IcePathB1F.asm @@ -11,11 +11,71 @@ IcePathB1F_MapScriptHeader: ; 0x7e4b9 ; 0x7e4be UnknownScript_0x7e4be: ; 0x7e4be - writecmdqueue $64c2 + writecmdqueue CmdQueue_0x7e4c2 return ; 0x7e4c2 -INCBIN "baserom.gbc",$7e4c2,$7e50a - $7e4c2 +CmdQueue_0x7e4c2: ; 0x7e4c2 + dbw 2, StoneTable_0x7e4c7 ; check if any stones are sitting on a warp + db 0, 0 ; filler +; 0x7e4c7 + +StoneTable_0x7e4c7: ; 0x7e4c7 + db 3, 2 ; warp, person + dw UnknownScript_0x7e4d8 + + db 4, 3 ; warp, person + dw UnknownScript_0x7e4e0 + + db 5, 4 ; warp, person + dw UnknownScript_0x7e4e8 + + db 6, 5 ; warp, person + dw UnknownScript_0x7e4f0 + + db $ff ; end +; 0x7e4d8 + +UnknownScript_0x7e4d8: ; 0x7e4d8 + disappear 2 + clearbit1 $070d + 2jump UnknownScript_0x7e4f8 +; 0x7e4e0 + +UnknownScript_0x7e4e0: ; 0x7e4e0 + disappear 3 + clearbit1 $070e + 2jump UnknownScript_0x7e4f8 +; 0x7e4e8 + +UnknownScript_0x7e4e8: ; 0x7e4e8 + disappear 4 + clearbit1 $070f + 2jump UnknownScript_0x7e4f8 +; 0x7e4f0 + +UnknownScript_0x7e4f0: ; 0x7e4f0 + disappear 5 + clearbit1 $0710 + 2jump UnknownScript_0x7e4f8 +; 0x7e4f8 + +UnknownScript_0x7e4f8: ; 0x7e4f8 + pause 30 + 2call UnknownScript_0x7e504 + loadfont + 2writetext UnknownText_0x7e512 + closetext + loadmovesprites + end +; 0x7e504 + +UnknownScript_0x7e504: ; 0x7e504 + playsound $001b + earthquake 80 + end +; 0x7e50a + UnknownScript_0x7e50a: ; 0x7e50a jumpstd $000e @@ -30,7 +90,12 @@ MapIcePathB1FSignpostItem0: ; 0x7e50f db MAX_POTION ; 0x7e512 -INCBIN "baserom.gbc",$7e512,$1b + +UnknownText_0x7e512: ; 0x7e512 + db $0, "The boulder fell", $4f + db "through.", $57 +; 0x7e52d + IcePathB1F_MapEventHeader: ; 0x7e52d ; filler diff --git a/maps/KrissHouse2F.asm b/maps/KrissHouse2F.asm index f4f8aadfa..e16872dd6 100644 --- a/maps/KrissHouse2F.asm +++ b/maps/KrissHouse2F.asm @@ -34,7 +34,9 @@ UnknownScript_0x7abc5: ; 0x7abc5 return ; 0x7abc9 -INCBIN "baserom.gbc",$7abc9,$7abcc - $7abc9 + + db 0, 0, 0 ; filler + UnknownScript_0x7abcc: ; 0x7abcc describedecoration $1 diff --git a/maps/RuinsofAlphOutside.asm b/maps/RuinsofAlphOutside.asm index 0f4408684..daa5f07e7 100644 --- a/maps/RuinsofAlphOutside.asm +++ b/maps/RuinsofAlphOutside.asm @@ -141,22 +141,37 @@ PsychicNathanScript: ; 0x58095 end ; 0x5809d -UnknownScript_0x5809d: ; 0x5809d - musicfadeout $2905, $1 -; 0x580a2 - -; probably not a script? -UnknownScript_0x580a2: ; 0x580a2 - db $e5 - itemtotext THUNDERSTONE, $42 - 2call $a900 - pokenamemem EXEGGCUTE, $47 + +TrainerSuperNerdStan: ; 0x5809d + ; bit/flag number + dw $581 + + ; trainer group && trainer id + db SUPER_NERD, STAN + + ; text when seen + dw UnknownText_0x581e5 + + ; text when trainer beaten + dw UnknownText_0x58217 + + ; script when lost + dw $0000 + + ; script when talk again + dw UnknownScript_0x580a9 +; 0x580a9 + +UnknownScript_0x580a9: ; 0x580a9 + talkaftercancel + loadfont 2writetext UnknownText_0x58250 closetext loadmovesprites end ; 0x580b1 + MapRuinsofAlphOutsideSignpost0Script: ; 0x580b1 jumptext UnknownText_0x58325 ; 0x580b4 diff --git a/preprocessor.py b/preprocessor.py index 10447295f..0d68c74ba 100644 --- a/preprocessor.py +++ b/preprocessor.py @@ -287,6 +287,7 @@ chars = { "é": 0xEA, "→": 0xEB, "▶": 0xED, +"▼": 0xEE, "♂": 0xEF, "¥": 0xF0, "×": 0xF1, diff --git a/scripting.asm b/scripting.asm index b029b7865..2875781f0 100644 --- a/scripting.asm +++ b/scripting.asm @@ -252,7 +252,7 @@ Script_jumptextfaceplayer: ; 0x96e45 ld [$d450], a ld b, $25 ld hl, $6e79 - jp $759d + jp ScriptJump ; 0x96e5f Script_jumptext: ; 0x96e5f @@ -268,7 +268,7 @@ Script_jumptext: ; 0x96e5f ld [$d450], a ld b, $25 ld hl, $6e7a - jp $759d + jp ScriptJump ; 0x96e79 INCBIN "baserom.gbc",$96e79,$96e81 - $96e79 @@ -286,7 +286,7 @@ Script_3jumptext: ; 0x96e81 ld [$d450], a ld b, $25 ld hl, $6e7a - jp $759d + jp ScriptJump ; 0x96e9b Script_2writetext: ; 0x96e9b @@ -550,13 +550,13 @@ Script_specialsound: ; 0x96fe4 ld hl, $543d rst $8 ld a, [$d142] - cp $4 - ld de, $009b - jr z, .asm_96ff7 ; 0x96ff2 $3 - ld de, $0001 -.asm_96ff7 + cp TM_HM + ld de, SFX_GET_TM + jr z, .play + ld de, SFX_ITEM +.play call StartSFX - call $3c55 + call WaitSFX ret ; 0x96ffe @@ -681,7 +681,7 @@ Script_describedecoration: ; 0x970df rst $8 ld h, d ld l, e - jp $759d + jp ScriptJump ; 0x970ee Script_fruittree: ; 0x970ee @@ -690,10 +690,10 @@ Script_fruittree: ; 0x970ee ; tree_id (SingleByteParam) call GetScriptByte - ld [$d03e], a - ld b, $11 - ld hl, $4000 - jp $759d + ld [CurFruitTree], a + ld b, BANK(FruitTreeScript) + ld hl, FruitTreeScript + jp ScriptJump ; 0x970fc Script_loadwilddata: ; 0x970fc @@ -743,7 +743,7 @@ Script_scripttalkafter: ; 0x97125 ld l, a ld a, [$d03e] ld b, a - jp $759d + jp ScriptJump ; 0x97132 Script_trainerstatus: ; 0x97132 @@ -877,7 +877,7 @@ Script_playsound: ; 0x971b7 Script_waitbutton: ; 0x971c3 ; script command 0x86 - call $3c55 + call WaitSFX ret ; 0x971c7 @@ -1417,7 +1417,7 @@ Script_returnafterbattle: ; 0x97459 jr nz, .asm_97470 ; 0x97466 $8 ld b, $4 ld hl, $64c1 - jp $759d + jp ScriptJump .asm_97470 bit 0, d jr z, .asm_9747c ; 0x97472 $8 @@ -1510,14 +1510,14 @@ ScriptCall: ; 0x974cb ld [hli], a ld a, [ScriptPos] ld [hli], a - ld a, [$d43b] + ld a, [ScriptPos + 1] ld [hl], a ld a, b ld [ScriptBank], a ld a, e ld [ScriptPos], a ld a, d - ld [$d43b], a + ld [ScriptPos + 1], a ret ; 0x974f3 @@ -1539,7 +1539,7 @@ Script_2jump: ; 0x974fe ld h, a ld a, [ScriptBank] ld b, a - jp $759d + jp ScriptJump ; 0x9750d Script_3jump: ; 0x9750d @@ -1553,7 +1553,7 @@ Script_3jump: ; 0x9750d ld l, a call GetScriptByte ld h, a - jp $759d + jp ScriptJump ; 0x9751c Script_2ptjump: ; 0x9751c @@ -1570,7 +1570,7 @@ Script_2ptjump: ; 0x9751c ld a, [hli] ld h, [hl] ld l, a - jp $759d + jp ScriptJump ; 0x9752c Script_iffalse: ; 0x9752c @@ -1655,7 +1655,7 @@ Script_jumpstd: ; 0x9756e ; predefined_script (MultiByteParam) call $757b - jr Unknown_9759d ; 0x97571 $2a + jr ScriptJump ; 0x97571 $2a ; 0x97573 Script_callstd: ; 0x97573 @@ -1693,13 +1693,13 @@ Unknown_97596: ; 0x97596 ret ; 0x9759d -Unknown_9759d: ; 0x9759d +ScriptJump: ; 0x9759d ld a, b ld [ScriptBank], a ld a, l ld [ScriptPos], a ld a, h - ld [$d43b], a + ld [ScriptPos + 1], a ret ; 0x975aa @@ -3041,7 +3041,7 @@ Unknown_0x97b9a: ; 0x97b9a ld [ScriptPos], a ld a, [hl] ld d, a - ld [$d43b], a + ld [ScriptPos + 1], a and a ret .asm_97bbe diff --git a/stats/base_stats.asm b/stats/base_stats.asm index 7f0e2ce2c..47459af94 100644 --- a/stats/base_stats.asm +++ b/stats/base_stats.asm @@ -1,6 +1,6 @@ -BaseStats0: +BaseData0: -BulbasaurBaseStats: ; 0x51424 +BulbasaurBaseData: ; 0x51424 db BULBASAUR ; 001 db 45, 49, 49, 45, 65, 65 @@ -31,9 +31,9 @@ BulbasaurBaseStats: ; 0x51424 db %00000000 ; end -BaseStats1: +BaseData1: -IvysaurBaseStats: ; 0x51444 +IvysaurBaseData: ; 0x51444 db IVYSAUR ; 002 db 60, 62, 63, 60, 80, 80 @@ -64,7 +64,7 @@ IvysaurBaseStats: ; 0x51444 db %00000000 ; end -VenusaurBaseStats: ; 0x51464 +VenusaurBaseData: ; 0x51464 db VENUSAUR ; 003 db 80, 82, 83, 80, 100, 100 @@ -95,7 +95,7 @@ VenusaurBaseStats: ; 0x51464 db %00000000 ; end -CharmanderBaseStats: ; 0x51484 +CharmanderBaseData: ; 0x51484 db CHARMANDER ; 004 db 39, 52, 43, 65, 60, 50 @@ -126,7 +126,7 @@ CharmanderBaseStats: ; 0x51484 db %00000010 ; end -CharmeleonBaseStats: ; 0x514a4 +CharmeleonBaseData: ; 0x514a4 db CHARMELEON ; 005 db 58, 64, 58, 80, 80, 65 @@ -157,7 +157,7 @@ CharmeleonBaseStats: ; 0x514a4 db %00000010 ; end -CharizardBaseStats: ; 0x514c4 +CharizardBaseData: ; 0x514c4 db CHARIZARD ; 006 db 78, 84, 78, 100, 109, 85 @@ -188,7 +188,7 @@ CharizardBaseStats: ; 0x514c4 db %00000010 ; end -SquirtleBaseStats: ; 0x514e4 +SquirtleBaseData: ; 0x514e4 db SQUIRTLE ; 007 db 44, 48, 65, 43, 50, 64 @@ -219,7 +219,7 @@ SquirtleBaseStats: ; 0x514e4 db %00001001 ; end -WartortleBaseStats: ; 0x51504 +WartortleBaseData: ; 0x51504 db WARTORTLE ; 008 db 59, 63, 80, 58, 65, 80 @@ -250,7 +250,7 @@ WartortleBaseStats: ; 0x51504 db %00001001 ; end -BlastoiseBaseStats: ; 0x51524 +BlastoiseBaseData: ; 0x51524 db BLASTOISE ; 009 db 79, 83, 100, 78, 85, 105 @@ -281,7 +281,7 @@ BlastoiseBaseStats: ; 0x51524 db %00001001 ; end -CaterpieBaseStats: ; 0x51544 +CaterpieBaseData: ; 0x51544 db CATERPIE ; 010 db 45, 30, 35, 45, 20, 20 @@ -312,7 +312,7 @@ CaterpieBaseStats: ; 0x51544 db %00000000 ; end -MetapodBaseStats: ; 0x51564 +MetapodBaseData: ; 0x51564 db METAPOD ; 011 db 50, 20, 55, 30, 25, 25 @@ -343,7 +343,7 @@ MetapodBaseStats: ; 0x51564 db %00000000 ; end -ButterfreeBaseStats: ; 0x51584 +ButterfreeBaseData: ; 0x51584 db BUTTERFREE ; 012 db 60, 45, 50, 70, 80, 80 @@ -374,7 +374,7 @@ ButterfreeBaseStats: ; 0x51584 db %00000000 ; end -WeedleBaseStats: ; 0x515a4 +WeedleBaseData: ; 0x515a4 db WEEDLE ; 013 db 40, 35, 30, 50, 20, 20 @@ -405,7 +405,7 @@ WeedleBaseStats: ; 0x515a4 db %00000000 ; end -KakunaBaseStats: ; 0x515c4 +KakunaBaseData: ; 0x515c4 db KAKUNA ; 014 db 45, 25, 50, 35, 25, 25 @@ -436,7 +436,7 @@ KakunaBaseStats: ; 0x515c4 db %00000000 ; end -BeedrillBaseStats: ; 0x515e4 +BeedrillBaseData: ; 0x515e4 db BEEDRILL ; 015 db 65, 80, 40, 75, 45, 80 @@ -467,7 +467,7 @@ BeedrillBaseStats: ; 0x515e4 db %00000000 ; end -PidgeyBaseStats: ; 0x51604 +PidgeyBaseData: ; 0x51604 db PIDGEY ; 016 db 40, 45, 40, 56, 35, 35 @@ -498,7 +498,7 @@ PidgeyBaseStats: ; 0x51604 db %00000000 ; end -PidgeottoBaseStats: ; 0x51624 +PidgeottoBaseData: ; 0x51624 db PIDGEOTTO ; 017 db 63, 60, 55, 71, 50, 50 @@ -529,7 +529,7 @@ PidgeottoBaseStats: ; 0x51624 db %00000000 ; end -PidgeotBaseStats: ; 0x51644 +PidgeotBaseData: ; 0x51644 db PIDGEOT ; 018 db 83, 80, 75, 91, 70, 70 @@ -560,7 +560,7 @@ PidgeotBaseStats: ; 0x51644 db %00000000 ; end -RattataBaseStats: ; 0x51664 +RattataBaseData: ; 0x51664 db RATTATA ; 019 db 30, 56, 35, 72, 25, 35 @@ -591,7 +591,7 @@ RattataBaseStats: ; 0x51664 db %00000000 ; end -RaticateBaseStats: ; 0x51684 +RaticateBaseData: ; 0x51684 db RATICATE ; 020 db 55, 81, 60, 97, 50, 70 @@ -622,7 +622,7 @@ RaticateBaseStats: ; 0x51684 db %00001100 ; end -SpearowBaseStats: ; 0x516a4 +SpearowBaseData: ; 0x516a4 db SPEAROW ; 021 db 40, 60, 30, 70, 31, 31 @@ -653,7 +653,7 @@ SpearowBaseStats: ; 0x516a4 db %00000000 ; end -FearowBaseStats: ; 0x516c4 +FearowBaseData: ; 0x516c4 db FEAROW ; 022 db 65, 90, 65, 100, 61, 61 @@ -684,7 +684,7 @@ FearowBaseStats: ; 0x516c4 db %00000000 ; end -EkansBaseStats: ; 0x516e4 +EkansBaseData: ; 0x516e4 db EKANS ; 023 db 35, 60, 44, 55, 40, 54 @@ -715,7 +715,7 @@ EkansBaseStats: ; 0x516e4 db %00000000 ; end -ArbokBaseStats: ; 0x51704 +ArbokBaseData: ; 0x51704 db ARBOK ; 024 db 60, 85, 69, 80, 65, 79 @@ -746,7 +746,7 @@ ArbokBaseStats: ; 0x51704 db %00000000 ; end -PikachuBaseStats: ; 0x51724 +PikachuBaseData: ; 0x51724 db PIKACHU ; 025 db 35, 55, 30, 90, 50, 40 @@ -777,7 +777,7 @@ PikachuBaseStats: ; 0x51724 db %00000100 ; end -RaichuBaseStats: ; 0x51744 +RaichuBaseData: ; 0x51744 db RAICHU ; 026 db 60, 90, 55, 100, 90, 80 @@ -808,7 +808,7 @@ RaichuBaseStats: ; 0x51744 db %00000100 ; end -SandshrewBaseStats: ; 0x51764 +SandshrewBaseData: ; 0x51764 db SANDSHREW ; 027 db 50, 75, 85, 40, 20, 30 @@ -839,7 +839,7 @@ SandshrewBaseStats: ; 0x51764 db %00000000 ; end -SandslashBaseStats: ; 0x51784 +SandslashBaseData: ; 0x51784 db SANDSLASH ; 028 db 75, 100, 110, 65, 45, 55 @@ -870,7 +870,7 @@ SandslashBaseStats: ; 0x51784 db %00000000 ; end -Nidoran_FBaseStats: ; 0x517a4 +Nidoran_FBaseData: ; 0x517a4 db NIDORAN_F ; 029 db 55, 47, 52, 41, 40, 40 @@ -901,7 +901,7 @@ Nidoran_FBaseStats: ; 0x517a4 db %00000100 ; end -NidorinaBaseStats: ; 0x517c4 +NidorinaBaseData: ; 0x517c4 db NIDORINA ; 030 db 70, 62, 67, 56, 55, 55 @@ -932,7 +932,7 @@ NidorinaBaseStats: ; 0x517c4 db %00001100 ; end -NidoqueenBaseStats: ; 0x517e4 +NidoqueenBaseData: ; 0x517e4 db NIDOQUEEN ; 031 db 90, 82, 87, 76, 75, 85 @@ -963,7 +963,7 @@ NidoqueenBaseStats: ; 0x517e4 db %00001110 ; end -Nidoran_MBaseStats: ; 0x51804 +Nidoran_MBaseData: ; 0x51804 db NIDORAN_M ; 032 db 46, 57, 40, 50, 40, 40 @@ -994,7 +994,7 @@ Nidoran_MBaseStats: ; 0x51804 db %00000100 ; end -NidorinoBaseStats: ; 0x51824 +NidorinoBaseData: ; 0x51824 db NIDORINO ; 033 db 61, 72, 57, 65, 55, 55 @@ -1025,7 +1025,7 @@ NidorinoBaseStats: ; 0x51824 db %00001100 ; end -NidokingBaseStats: ; 0x51844 +NidokingBaseData: ; 0x51844 db NIDOKING ; 034 db 81, 92, 77, 85, 85, 75 @@ -1056,7 +1056,7 @@ NidokingBaseStats: ; 0x51844 db %00001110 ; end -ClefairyBaseStats: ; 0x51864 +ClefairyBaseData: ; 0x51864 db CLEFAIRY ; 035 db 70, 45, 48, 35, 60, 65 @@ -1087,7 +1087,7 @@ ClefairyBaseStats: ; 0x51864 db %00001110 ; end -ClefableBaseStats: ; 0x51884 +ClefableBaseData: ; 0x51884 db CLEFABLE ; 036 db 95, 70, 73, 60, 85, 90 @@ -1118,7 +1118,7 @@ ClefableBaseStats: ; 0x51884 db %00001110 ; end -VulpixBaseStats: ; 0x518a4 +VulpixBaseData: ; 0x518a4 db VULPIX ; 037 db 38, 41, 40, 65, 50, 65 @@ -1149,7 +1149,7 @@ VulpixBaseStats: ; 0x518a4 db %00000010 ; end -NinetalesBaseStats: ; 0x518c4 +NinetalesBaseData: ; 0x518c4 db NINETALES ; 038 db 73, 76, 75, 100, 81, 100 @@ -1180,7 +1180,7 @@ NinetalesBaseStats: ; 0x518c4 db %00000010 ; end -JigglypuffBaseStats: ; 0x518e4 +JigglypuffBaseData: ; 0x518e4 db JIGGLYPUFF ; 039 db 115, 45, 20, 20, 45, 25 @@ -1211,7 +1211,7 @@ JigglypuffBaseStats: ; 0x518e4 db %00001110 ; end -WigglytuffBaseStats: ; 0x51904 +WigglytuffBaseData: ; 0x51904 db WIGGLYTUFF ; 040 db 140, 70, 45, 45, 75, 50 @@ -1242,7 +1242,7 @@ WigglytuffBaseStats: ; 0x51904 db %00001110 ; end -ZubatBaseStats: ; 0x51924 +ZubatBaseData: ; 0x51924 db ZUBAT ; 041 db 40, 45, 35, 55, 30, 40 @@ -1273,7 +1273,7 @@ ZubatBaseStats: ; 0x51924 db %00000000 ; end -GolbatBaseStats: ; 0x51944 +GolbatBaseData: ; 0x51944 db GOLBAT ; 042 db 75, 80, 70, 90, 65, 75 @@ -1304,7 +1304,7 @@ GolbatBaseStats: ; 0x51944 db %00000000 ; end -OddishBaseStats: ; 0x51964 +OddishBaseData: ; 0x51964 db ODDISH ; 043 db 45, 50, 55, 30, 75, 65 @@ -1335,7 +1335,7 @@ OddishBaseStats: ; 0x51964 db %00000000 ; end -GloomBaseStats: ; 0x51984 +GloomBaseData: ; 0x51984 db GLOOM ; 044 db 60, 65, 70, 40, 85, 75 @@ -1366,7 +1366,7 @@ GloomBaseStats: ; 0x51984 db %00000000 ; end -VileplumeBaseStats: ; 0x519a4 +VileplumeBaseData: ; 0x519a4 db VILEPLUME ; 045 db 75, 80, 85, 50, 100, 90 @@ -1397,7 +1397,7 @@ VileplumeBaseStats: ; 0x519a4 db %00000000 ; end -ParasBaseStats: ; 0x519c4 +ParasBaseData: ; 0x519c4 db PARAS ; 046 db 35, 70, 55, 25, 45, 55 @@ -1428,7 +1428,7 @@ ParasBaseStats: ; 0x519c4 db %00000000 ; end -ParasectBaseStats: ; 0x519e4 +ParasectBaseData: ; 0x519e4 db PARASECT ; 047 db 60, 95, 80, 30, 60, 80 @@ -1459,7 +1459,7 @@ ParasectBaseStats: ; 0x519e4 db %00000000 ; end -VenonatBaseStats: ; 0x51a04 +VenonatBaseData: ; 0x51a04 db VENONAT ; 048 db 60, 55, 50, 45, 40, 55 @@ -1490,7 +1490,7 @@ VenonatBaseStats: ; 0x51a04 db %00000000 ; end -VenomothBaseStats: ; 0x51a24 +VenomothBaseData: ; 0x51a24 db VENOMOTH ; 049 db 70, 65, 60, 90, 90, 75 @@ -1521,7 +1521,7 @@ VenomothBaseStats: ; 0x51a24 db %00000000 ; end -DiglettBaseStats: ; 0x51a44 +DiglettBaseData: ; 0x51a44 db DIGLETT ; 050 db 10, 55, 25, 95, 35, 45 @@ -1552,7 +1552,7 @@ DiglettBaseStats: ; 0x51a44 db %00000000 ; end -DugtrioBaseStats: ; 0x51a64 +DugtrioBaseData: ; 0x51a64 db DUGTRIO ; 051 db 35, 80, 50, 120, 50, 70 @@ -1583,7 +1583,7 @@ DugtrioBaseStats: ; 0x51a64 db %00000000 ; end -MeowthBaseStats: ; 0x51a84 +MeowthBaseData: ; 0x51a84 db MEOWTH ; 052 db 40, 45, 35, 90, 40, 40 @@ -1614,7 +1614,7 @@ MeowthBaseStats: ; 0x51a84 db %00000100 ; end -PersianBaseStats: ; 0x51aa4 +PersianBaseData: ; 0x51aa4 db PERSIAN ; 053 db 65, 70, 60, 115, 65, 65 @@ -1645,7 +1645,7 @@ PersianBaseStats: ; 0x51aa4 db %00000100 ; end -PsyduckBaseStats: ; 0x51ac4 +PsyduckBaseData: ; 0x51ac4 db PSYDUCK ; 054 db 50, 52, 48, 55, 65, 50 @@ -1676,7 +1676,7 @@ PsyduckBaseStats: ; 0x51ac4 db %00001001 ; end -GolduckBaseStats: ; 0x51ae4 +GolduckBaseData: ; 0x51ae4 db GOLDUCK ; 055 db 80, 82, 78, 85, 95, 80 @@ -1707,7 +1707,7 @@ GolduckBaseStats: ; 0x51ae4 db %00001001 ; end -MankeyBaseStats: ; 0x51b04 +MankeyBaseData: ; 0x51b04 db MANKEY ; 056 db 40, 80, 35, 70, 35, 45 @@ -1738,7 +1738,7 @@ MankeyBaseStats: ; 0x51b04 db %00000100 ; end -PrimeapeBaseStats: ; 0x51b24 +PrimeapeBaseData: ; 0x51b24 db PRIMEAPE ; 057 db 65, 105, 60, 95, 60, 70 @@ -1769,7 +1769,7 @@ PrimeapeBaseStats: ; 0x51b24 db %00000100 ; end -GrowlitheBaseStats: ; 0x51b44 +GrowlitheBaseData: ; 0x51b44 db GROWLITHE ; 058 db 55, 70, 45, 60, 70, 50 @@ -1800,7 +1800,7 @@ GrowlitheBaseStats: ; 0x51b44 db %00000010 ; end -ArcanineBaseStats: ; 0x51b64 +ArcanineBaseData: ; 0x51b64 db ARCANINE ; 059 db 90, 110, 80, 95, 100, 80 @@ -1831,7 +1831,7 @@ ArcanineBaseStats: ; 0x51b64 db %00000010 ; end -PoliwagBaseStats: ; 0x51b84 +PoliwagBaseData: ; 0x51b84 db POLIWAG ; 060 db 40, 50, 40, 90, 40, 40 @@ -1862,7 +1862,7 @@ PoliwagBaseStats: ; 0x51b84 db %00001001 ; end -PoliwhirlBaseStats: ; 0x51ba4 +PoliwhirlBaseData: ; 0x51ba4 db POLIWHIRL ; 061 db 65, 65, 65, 90, 50, 50 @@ -1893,7 +1893,7 @@ PoliwhirlBaseStats: ; 0x51ba4 db %00001001 ; end -PoliwrathBaseStats: ; 0x51bc4 +PoliwrathBaseData: ; 0x51bc4 db POLIWRATH ; 062 db 90, 85, 95, 70, 70, 90 @@ -1924,7 +1924,7 @@ PoliwrathBaseStats: ; 0x51bc4 db %00001001 ; end -AbraBaseStats: ; 0x51be4 +AbraBaseData: ; 0x51be4 db ABRA ; 063 db 25, 20, 15, 90, 105, 55 @@ -1955,7 +1955,7 @@ AbraBaseStats: ; 0x51be4 db %00000000 ; end -KadabraBaseStats: ; 0x51c04 +KadabraBaseData: ; 0x51c04 db KADABRA ; 064 db 40, 35, 30, 105, 120, 70 @@ -1986,7 +1986,7 @@ KadabraBaseStats: ; 0x51c04 db %00000000 ; end -AlakazamBaseStats: ; 0x51c24 +AlakazamBaseData: ; 0x51c24 db ALAKAZAM ; 065 db 55, 50, 45, 120, 135, 85 @@ -2017,7 +2017,7 @@ AlakazamBaseStats: ; 0x51c24 db %00000000 ; end -MachopBaseStats: ; 0x51c44 +MachopBaseData: ; 0x51c44 db MACHOP ; 066 db 70, 80, 50, 35, 35, 35 @@ -2048,7 +2048,7 @@ MachopBaseStats: ; 0x51c44 db %00000010 ; end -MachokeBaseStats: ; 0x51c64 +MachokeBaseData: ; 0x51c64 db MACHOKE ; 067 db 80, 100, 70, 45, 50, 60 @@ -2079,7 +2079,7 @@ MachokeBaseStats: ; 0x51c64 db %00000010 ; end -MachampBaseStats: ; 0x51c84 +MachampBaseData: ; 0x51c84 db MACHAMP ; 068 db 90, 130, 80, 55, 65, 85 @@ -2110,7 +2110,7 @@ MachampBaseStats: ; 0x51c84 db %00000010 ; end -BellsproutBaseStats: ; 0x51ca4 +BellsproutBaseData: ; 0x51ca4 db BELLSPROUT ; 069 db 50, 75, 35, 40, 70, 30 @@ -2141,7 +2141,7 @@ BellsproutBaseStats: ; 0x51ca4 db %00000000 ; end -WeepinbellBaseStats: ; 0x51cc4 +WeepinbellBaseData: ; 0x51cc4 db WEEPINBELL ; 070 db 65, 90, 50, 55, 85, 45 @@ -2172,7 +2172,7 @@ WeepinbellBaseStats: ; 0x51cc4 db %00000000 ; end -VictreebelBaseStats: ; 0x51ce4 +VictreebelBaseData: ; 0x51ce4 db VICTREEBEL ; 071 db 80, 105, 65, 70, 100, 60 @@ -2203,7 +2203,7 @@ VictreebelBaseStats: ; 0x51ce4 db %00000000 ; end -TentacoolBaseStats: ; 0x51d04 +TentacoolBaseData: ; 0x51d04 db TENTACOOL ; 072 db 40, 40, 35, 70, 50, 100 @@ -2234,7 +2234,7 @@ TentacoolBaseStats: ; 0x51d04 db %00001000 ; end -TentacruelBaseStats: ; 0x51d24 +TentacruelBaseData: ; 0x51d24 db TENTACRUEL ; 073 db 80, 70, 65, 100, 80, 120 @@ -2265,7 +2265,7 @@ TentacruelBaseStats: ; 0x51d24 db %00001000 ; end -GeodudeBaseStats: ; 0x51d44 +GeodudeBaseData: ; 0x51d44 db GEODUDE ; 074 db 40, 80, 100, 20, 30, 30 @@ -2296,7 +2296,7 @@ GeodudeBaseStats: ; 0x51d44 db %00000010 ; end -GravelerBaseStats: ; 0x51d64 +GravelerBaseData: ; 0x51d64 db GRAVELER ; 075 db 55, 95, 115, 35, 45, 45 @@ -2327,7 +2327,7 @@ GravelerBaseStats: ; 0x51d64 db %00000010 ; end -GolemBaseStats: ; 0x51d84 +GolemBaseData: ; 0x51d84 db GOLEM ; 076 db 80, 110, 130, 45, 55, 65 @@ -2358,7 +2358,7 @@ GolemBaseStats: ; 0x51d84 db %00000010 ; end -PonytaBaseStats: ; 0x51da4 +PonytaBaseData: ; 0x51da4 db PONYTA ; 077 db 50, 85, 55, 90, 65, 65 @@ -2389,7 +2389,7 @@ PonytaBaseStats: ; 0x51da4 db %00000010 ; end -RapidashBaseStats: ; 0x51dc4 +RapidashBaseData: ; 0x51dc4 db RAPIDASH ; 078 db 65, 100, 70, 105, 80, 80 @@ -2420,7 +2420,7 @@ RapidashBaseStats: ; 0x51dc4 db %00000010 ; end -SlowpokeBaseStats: ; 0x51de4 +SlowpokeBaseData: ; 0x51de4 db SLOWPOKE ; 079 db 90, 65, 65, 15, 40, 40 @@ -2451,7 +2451,7 @@ SlowpokeBaseStats: ; 0x51de4 db %00001010 ; end -SlowbroBaseStats: ; 0x51e04 +SlowbroBaseData: ; 0x51e04 db SLOWBRO ; 080 db 95, 75, 110, 30, 100, 80 @@ -2482,7 +2482,7 @@ SlowbroBaseStats: ; 0x51e04 db %00001010 ; end -MagnemiteBaseStats: ; 0x51e24 +MagnemiteBaseData: ; 0x51e24 db MAGNEMITE ; 081 db 25, 35, 70, 45, 95, 55 @@ -2513,7 +2513,7 @@ MagnemiteBaseStats: ; 0x51e24 db %00000100 ; end -MagnetonBaseStats: ; 0x51e44 +MagnetonBaseData: ; 0x51e44 db MAGNETON ; 082 db 50, 60, 95, 70, 120, 70 @@ -2544,7 +2544,7 @@ MagnetonBaseStats: ; 0x51e44 db %00000100 ; end -Farfetch_DBaseStats: ; 0x51e64 +Farfetch_DBaseData: ; 0x51e64 db FARFETCH_D ; 083 db 52, 65, 55, 60, 58, 62 @@ -2575,7 +2575,7 @@ Farfetch_DBaseStats: ; 0x51e64 db %00000000 ; end -DoduoBaseStats: ; 0x51e84 +DoduoBaseData: ; 0x51e84 db DODUO ; 084 db 35, 85, 45, 75, 35, 35 @@ -2606,7 +2606,7 @@ DoduoBaseStats: ; 0x51e84 db %00000000 ; end -DodrioBaseStats: ; 0x51ea4 +DodrioBaseData: ; 0x51ea4 db DODRIO ; 085 db 60, 110, 70, 100, 60, 60 @@ -2637,7 +2637,7 @@ DodrioBaseStats: ; 0x51ea4 db %00000000 ; end -SeelBaseStats: ; 0x51ec4 +SeelBaseData: ; 0x51ec4 db SEEL ; 086 db 65, 45, 55, 45, 45, 70 @@ -2668,7 +2668,7 @@ SeelBaseStats: ; 0x51ec4 db %00001001 ; end -DewgongBaseStats: ; 0x51ee4 +DewgongBaseData: ; 0x51ee4 db DEWGONG ; 087 db 90, 70, 80, 70, 70, 95 @@ -2699,7 +2699,7 @@ DewgongBaseStats: ; 0x51ee4 db %00001001 ; end -GrimerBaseStats: ; 0x51f04 +GrimerBaseData: ; 0x51f04 db GRIMER ; 088 db 80, 80, 50, 25, 40, 50 @@ -2730,7 +2730,7 @@ GrimerBaseStats: ; 0x51f04 db %00000110 ; end -MukBaseStats: ; 0x51f24 +MukBaseData: ; 0x51f24 db MUK ; 089 db 105, 105, 75, 50, 65, 100 @@ -2761,7 +2761,7 @@ MukBaseStats: ; 0x51f24 db %00000110 ; end -ShellderBaseStats: ; 0x51f44 +ShellderBaseData: ; 0x51f44 db SHELLDER ; 090 db 30, 65, 100, 40, 45, 25 @@ -2792,7 +2792,7 @@ ShellderBaseStats: ; 0x51f44 db %00001000 ; end -CloysterBaseStats: ; 0x51f64 +CloysterBaseData: ; 0x51f64 db CLOYSTER ; 091 db 50, 95, 180, 70, 85, 45 @@ -2823,7 +2823,7 @@ CloysterBaseStats: ; 0x51f64 db %00001000 ; end -GastlyBaseStats: ; 0x51f84 +GastlyBaseData: ; 0x51f84 db GASTLY ; 092 db 30, 35, 30, 80, 100, 35 @@ -2854,7 +2854,7 @@ GastlyBaseStats: ; 0x51f84 db %00000100 ; end -HaunterBaseStats: ; 0x51fa4 +HaunterBaseData: ; 0x51fa4 db HAUNTER ; 093 db 45, 50, 45, 95, 115, 55 @@ -2885,7 +2885,7 @@ HaunterBaseStats: ; 0x51fa4 db %00000100 ; end -GengarBaseStats: ; 0x51fc4 +GengarBaseData: ; 0x51fc4 db GENGAR ; 094 db 60, 65, 60, 110, 130, 75 @@ -2916,7 +2916,7 @@ GengarBaseStats: ; 0x51fc4 db %00000100 ; end -OnixBaseStats: ; 0x51fe4 +OnixBaseData: ; 0x51fe4 db ONIX ; 095 db 35, 45, 160, 70, 30, 45 @@ -2947,7 +2947,7 @@ OnixBaseStats: ; 0x51fe4 db %00000000 ; end -DrowzeeBaseStats: ; 0x52004 +DrowzeeBaseData: ; 0x52004 db DROWZEE ; 096 db 60, 48, 45, 42, 43, 90 @@ -2978,7 +2978,7 @@ DrowzeeBaseStats: ; 0x52004 db %00000000 ; end -HypnoBaseStats: ; 0x52024 +HypnoBaseData: ; 0x52024 db HYPNO ; 097 db 85, 73, 70, 67, 73, 115 @@ -3009,7 +3009,7 @@ HypnoBaseStats: ; 0x52024 db %00000000 ; end -KrabbyBaseStats: ; 0x52044 +KrabbyBaseData: ; 0x52044 db KRABBY ; 098 db 30, 105, 90, 50, 25, 25 @@ -3040,7 +3040,7 @@ KrabbyBaseStats: ; 0x52044 db %00001000 ; end -KinglerBaseStats: ; 0x52064 +KinglerBaseData: ; 0x52064 db KINGLER ; 099 db 55, 130, 115, 75, 50, 50 @@ -3071,7 +3071,7 @@ KinglerBaseStats: ; 0x52064 db %00001000 ; end -VoltorbBaseStats: ; 0x52084 +VoltorbBaseData: ; 0x52084 db VOLTORB ; 100 db 40, 30, 50, 100, 55, 55 @@ -3102,7 +3102,7 @@ VoltorbBaseStats: ; 0x52084 db %00000100 ; end -ElectrodeBaseStats: ; 0x520a4 +ElectrodeBaseData: ; 0x520a4 db ELECTRODE ; 101 db 60, 50, 70, 140, 80, 80 @@ -3133,7 +3133,7 @@ ElectrodeBaseStats: ; 0x520a4 db %00000100 ; end -ExeggcuteBaseStats: ; 0x520c4 +ExeggcuteBaseData: ; 0x520c4 db EXEGGCUTE ; 102 db 60, 40, 80, 40, 60, 45 @@ -3164,7 +3164,7 @@ ExeggcuteBaseStats: ; 0x520c4 db %00000000 ; end -ExeggutorBaseStats: ; 0x520e4 +ExeggutorBaseData: ; 0x520e4 db EXEGGUTOR ; 103 db 95, 95, 85, 55, 125, 65 @@ -3195,7 +3195,7 @@ ExeggutorBaseStats: ; 0x520e4 db %00000000 ; end -CuboneBaseStats: ; 0x52104 +CuboneBaseData: ; 0x52104 db CUBONE ; 104 db 50, 50, 95, 35, 40, 50 @@ -3226,7 +3226,7 @@ CuboneBaseStats: ; 0x52104 db %00001010 ; end -MarowakBaseStats: ; 0x52124 +MarowakBaseData: ; 0x52124 db MAROWAK ; 105 db 60, 80, 110, 45, 50, 80 @@ -3257,7 +3257,7 @@ MarowakBaseStats: ; 0x52124 db %00001010 ; end -HitmonleeBaseStats: ; 0x52144 +HitmonleeBaseData: ; 0x52144 db HITMONLEE ; 106 db 50, 120, 53, 87, 35, 110 @@ -3288,7 +3288,7 @@ HitmonleeBaseStats: ; 0x52144 db %00000000 ; end -HitmonchanBaseStats: ; 0x52164 +HitmonchanBaseData: ; 0x52164 db HITMONCHAN ; 107 db 50, 105, 79, 76, 35, 110 @@ -3319,7 +3319,7 @@ HitmonchanBaseStats: ; 0x52164 db %00000000 ; end -LickitungBaseStats: ; 0x52184 +LickitungBaseData: ; 0x52184 db LICKITUNG ; 108 db 90, 55, 75, 30, 60, 75 @@ -3350,7 +3350,7 @@ LickitungBaseStats: ; 0x52184 db %00001110 ; end -KoffingBaseStats: ; 0x521a4 +KoffingBaseData: ; 0x521a4 db KOFFING ; 109 db 40, 65, 95, 35, 60, 45 @@ -3381,7 +3381,7 @@ KoffingBaseStats: ; 0x521a4 db %00000110 ; end -WeezingBaseStats: ; 0x521c4 +WeezingBaseData: ; 0x521c4 db WEEZING ; 110 db 65, 90, 120, 60, 85, 70 @@ -3412,7 +3412,7 @@ WeezingBaseStats: ; 0x521c4 db %00000110 ; end -RhyhornBaseStats: ; 0x521e4 +RhyhornBaseData: ; 0x521e4 db RHYHORN ; 111 db 80, 85, 95, 25, 30, 30 @@ -3443,7 +3443,7 @@ RhyhornBaseStats: ; 0x521e4 db %00001110 ; end -RhydonBaseStats: ; 0x52204 +RhydonBaseData: ; 0x52204 db RHYDON ; 112 db 105, 130, 120, 40, 45, 45 @@ -3474,7 +3474,7 @@ RhydonBaseStats: ; 0x52204 db %00001110 ; end -ChanseyBaseStats: ; 0x52224 +ChanseyBaseData: ; 0x52224 db CHANSEY ; 113 db 250, 05, 05, 50, 35, 105 @@ -3505,7 +3505,7 @@ ChanseyBaseStats: ; 0x52224 db %00001110 ; end -TangelaBaseStats: ; 0x52244 +TangelaBaseData: ; 0x52244 db TANGELA ; 114 db 65, 55, 115, 60, 100, 40 @@ -3536,7 +3536,7 @@ TangelaBaseStats: ; 0x52244 db %00000000 ; end -KangaskhanBaseStats: ; 0x52264 +KangaskhanBaseData: ; 0x52264 db KANGASKHAN ; 115 db 105, 95, 80, 90, 40, 80 @@ -3567,7 +3567,7 @@ KangaskhanBaseStats: ; 0x52264 db %00001110 ; end -HorseaBaseStats: ; 0x52284 +HorseaBaseData: ; 0x52284 db HORSEA ; 116 db 30, 40, 70, 60, 70, 25 @@ -3598,7 +3598,7 @@ HorseaBaseStats: ; 0x52284 db %00001001 ; end -SeadraBaseStats: ; 0x522a4 +SeadraBaseData: ; 0x522a4 db SEADRA ; 117 db 55, 65, 95, 85, 95, 45 @@ -3629,7 +3629,7 @@ SeadraBaseStats: ; 0x522a4 db %00001001 ; end -GoldeenBaseStats: ; 0x522c4 +GoldeenBaseData: ; 0x522c4 db GOLDEEN ; 118 db 45, 67, 60, 63, 35, 50 @@ -3660,7 +3660,7 @@ GoldeenBaseStats: ; 0x522c4 db %00001001 ; end -SeakingBaseStats: ; 0x522e4 +SeakingBaseData: ; 0x522e4 db SEAKING ; 119 db 80, 92, 65, 68, 65, 80 @@ -3691,7 +3691,7 @@ SeakingBaseStats: ; 0x522e4 db %00001001 ; end -StaryuBaseStats: ; 0x52304 +StaryuBaseData: ; 0x52304 db STARYU ; 120 db 30, 45, 55, 85, 70, 55 @@ -3722,7 +3722,7 @@ StaryuBaseStats: ; 0x52304 db %00001101 ; end -StarmieBaseStats: ; 0x52324 +StarmieBaseData: ; 0x52324 db STARMIE ; 121 db 60, 75, 85, 115, 100, 85 @@ -3753,7 +3753,7 @@ StarmieBaseStats: ; 0x52324 db %00001101 ; end -Mr__MimeBaseStats: ; 0x52344 +Mr__MimeBaseData: ; 0x52344 db MR__MIME ; 122 db 40, 45, 65, 90, 100, 120 @@ -3784,7 +3784,7 @@ Mr__MimeBaseStats: ; 0x52344 db %00000100 ; end -ScytherBaseStats: ; 0x52364 +ScytherBaseData: ; 0x52364 db SCYTHER ; 123 db 70, 110, 80, 105, 55, 80 @@ -3815,7 +3815,7 @@ ScytherBaseStats: ; 0x52364 db %00000000 ; end -JynxBaseStats: ; 0x52384 +JynxBaseData: ; 0x52384 db JYNX ; 124 db 65, 50, 35, 95, 115, 95 @@ -3846,7 +3846,7 @@ JynxBaseStats: ; 0x52384 db %00001000 ; end -ElectabuzzBaseStats: ; 0x523a4 +ElectabuzzBaseData: ; 0x523a4 db ELECTABUZZ ; 125 db 65, 83, 57, 105, 95, 85 @@ -3877,7 +3877,7 @@ ElectabuzzBaseStats: ; 0x523a4 db %00000100 ; end -MagmarBaseStats: ; 0x523c4 +MagmarBaseData: ; 0x523c4 db MAGMAR ; 126 db 65, 95, 57, 93, 100, 85 @@ -3908,7 +3908,7 @@ MagmarBaseStats: ; 0x523c4 db %00000010 ; end -PinsirBaseStats: ; 0x523e4 +PinsirBaseData: ; 0x523e4 db PINSIR ; 127 db 65, 125, 100, 85, 55, 70 @@ -3939,7 +3939,7 @@ PinsirBaseStats: ; 0x523e4 db %00000000 ; end -TaurosBaseStats: ; 0x52404 +TaurosBaseData: ; 0x52404 db TAUROS ; 128 db 75, 100, 95, 110, 40, 70 @@ -3970,7 +3970,7 @@ TaurosBaseStats: ; 0x52404 db %00001110 ; end -MagikarpBaseStats: ; 0x52424 +MagikarpBaseData: ; 0x52424 db MAGIKARP ; 129 db 20, 10, 55, 80, 15, 20 @@ -4001,7 +4001,7 @@ MagikarpBaseStats: ; 0x52424 db %00000000 ; end -GyaradosBaseStats: ; 0x52444 +GyaradosBaseData: ; 0x52444 db GYARADOS ; 130 db 95, 125, 79, 81, 60, 100 @@ -4032,7 +4032,7 @@ GyaradosBaseStats: ; 0x52444 db %00001111 ; end -LaprasBaseStats: ; 0x52464 +LaprasBaseData: ; 0x52464 db LAPRAS ; 131 db 130, 85, 80, 60, 85, 95 @@ -4063,7 +4063,7 @@ LaprasBaseStats: ; 0x52464 db %00001100 ; end -DittoBaseStats: ; 0x52484 +DittoBaseData: ; 0x52484 db DITTO ; 132 db 48, 48, 48, 48, 48, 48 @@ -4094,7 +4094,7 @@ DittoBaseStats: ; 0x52484 db %00000000 ; end -EeveeBaseStats: ; 0x524a4 +EeveeBaseData: ; 0x524a4 db EEVEE ; 133 db 55, 55, 50, 55, 45, 65 @@ -4125,7 +4125,7 @@ EeveeBaseStats: ; 0x524a4 db %00000000 ; end -VaporeonBaseStats: ; 0x524c4 +VaporeonBaseData: ; 0x524c4 db VAPOREON ; 134 db 130, 65, 60, 65, 110, 95 @@ -4156,7 +4156,7 @@ VaporeonBaseStats: ; 0x524c4 db %00001001 ; end -JolteonBaseStats: ; 0x524e4 +JolteonBaseData: ; 0x524e4 db JOLTEON ; 135 db 65, 65, 60, 130, 110, 95 @@ -4187,7 +4187,7 @@ JolteonBaseStats: ; 0x524e4 db %00000100 ; end -FlareonBaseStats: ; 0x52504 +FlareonBaseData: ; 0x52504 db FLAREON ; 136 db 65, 130, 60, 65, 95, 110 @@ -4218,7 +4218,7 @@ FlareonBaseStats: ; 0x52504 db %00000010 ; end -PorygonBaseStats: ; 0x52524 +PorygonBaseData: ; 0x52524 db PORYGON ; 137 db 65, 60, 70, 40, 85, 75 @@ -4249,7 +4249,7 @@ PorygonBaseStats: ; 0x52524 db %00001100 ; end -OmanyteBaseStats: ; 0x52544 +OmanyteBaseData: ; 0x52544 db OMANYTE ; 138 db 35, 40, 100, 35, 90, 55 @@ -4280,7 +4280,7 @@ OmanyteBaseStats: ; 0x52544 db %00001000 ; end -OmastarBaseStats: ; 0x52564 +OmastarBaseData: ; 0x52564 db OMASTAR ; 139 db 70, 60, 125, 55, 115, 70 @@ -4311,7 +4311,7 @@ OmastarBaseStats: ; 0x52564 db %00001000 ; end -KabutoBaseStats: ; 0x52584 +KabutoBaseData: ; 0x52584 db KABUTO ; 140 db 30, 80, 90, 55, 55, 45 @@ -4342,7 +4342,7 @@ KabutoBaseStats: ; 0x52584 db %00001000 ; end -KabutopsBaseStats: ; 0x525a4 +KabutopsBaseData: ; 0x525a4 db KABUTOPS ; 141 db 60, 115, 105, 80, 65, 70 @@ -4373,7 +4373,7 @@ KabutopsBaseStats: ; 0x525a4 db %00001000 ; end -AerodactylBaseStats: ; 0x525c4 +AerodactylBaseData: ; 0x525c4 db AERODACTYL ; 142 db 80, 105, 65, 130, 60, 75 @@ -4404,7 +4404,7 @@ AerodactylBaseStats: ; 0x525c4 db %00000010 ; end -SnorlaxBaseStats: ; 0x525e4 +SnorlaxBaseData: ; 0x525e4 db SNORLAX ; 143 db 160, 110, 65, 30, 65, 110 @@ -4435,7 +4435,7 @@ SnorlaxBaseStats: ; 0x525e4 db %00001110 ; end -ArticunoBaseStats: ; 0x52604 +ArticunoBaseData: ; 0x52604 db ARTICUNO ; 144 db 90, 85, 100, 85, 95, 125 @@ -4466,7 +4466,7 @@ ArticunoBaseStats: ; 0x52604 db %00001000 ; end -ZapdosBaseStats: ; 0x52624 +ZapdosBaseData: ; 0x52624 db ZAPDOS ; 145 db 90, 90, 85, 100, 125, 90 @@ -4497,7 +4497,7 @@ ZapdosBaseStats: ; 0x52624 db %00000100 ; end -MoltresBaseStats: ; 0x52644 +MoltresBaseData: ; 0x52644 db MOLTRES ; 146 db 90, 100, 90, 90, 125, 85 @@ -4528,7 +4528,7 @@ MoltresBaseStats: ; 0x52644 db %00000010 ; end -DratiniBaseStats: ; 0x52664 +DratiniBaseData: ; 0x52664 db DRATINI ; 147 db 41, 64, 45, 50, 50, 50 @@ -4559,7 +4559,7 @@ DratiniBaseStats: ; 0x52664 db %00001111 ; end -DragonairBaseStats: ; 0x52684 +DragonairBaseData: ; 0x52684 db DRAGONAIR ; 148 db 61, 84, 65, 70, 70, 70 @@ -4590,7 +4590,7 @@ DragonairBaseStats: ; 0x52684 db %00001111 ; end -DragoniteBaseStats: ; 0x526a4 +DragoniteBaseData: ; 0x526a4 db DRAGONITE ; 149 db 91, 134, 95, 80, 100, 100 @@ -4621,7 +4621,7 @@ DragoniteBaseStats: ; 0x526a4 db %00001111 ; end -MewtwoBaseStats: ; 0x526c4 +MewtwoBaseData: ; 0x526c4 db MEWTWO ; 150 db 106, 110, 90, 130, 154, 90 @@ -4652,7 +4652,7 @@ MewtwoBaseStats: ; 0x526c4 db %00001110 ; end -MewBaseStats: ; 0x526e4 +MewBaseData: ; 0x526e4 db MEW ; 151 db 100, 100, 100, 100, 100, 100 @@ -4683,7 +4683,7 @@ MewBaseStats: ; 0x526e4 db %00001111 ; end -ChikoritaBaseStats: ; 0x52704 +ChikoritaBaseData: ; 0x52704 db CHIKORITA ; 152 db 45, 49, 65, 45, 49, 65 @@ -4714,7 +4714,7 @@ ChikoritaBaseStats: ; 0x52704 db %00000000 ; end -BayleefBaseStats: ; 0x52724 +BayleefBaseData: ; 0x52724 db BAYLEEF ; 153 db 60, 62, 80, 60, 63, 80 @@ -4745,7 +4745,7 @@ BayleefBaseStats: ; 0x52724 db %00000000 ; end -MeganiumBaseStats: ; 0x52744 +MeganiumBaseData: ; 0x52744 db MEGANIUM ; 154 db 80, 82, 100, 80, 83, 100 @@ -4776,7 +4776,7 @@ MeganiumBaseStats: ; 0x52744 db %00000000 ; end -CyndaquilBaseStats: ; 0x52764 +CyndaquilBaseData: ; 0x52764 db CYNDAQUIL ; 155 db 39, 52, 43, 65, 60, 50 @@ -4807,7 +4807,7 @@ CyndaquilBaseStats: ; 0x52764 db %00000010 ; end -QuilavaBaseStats: ; 0x52784 +QuilavaBaseData: ; 0x52784 db QUILAVA ; 156 db 58, 64, 58, 80, 80, 65 @@ -4838,7 +4838,7 @@ QuilavaBaseStats: ; 0x52784 db %00000010 ; end -TyphlosionBaseStats: ; 0x527a4 +TyphlosionBaseData: ; 0x527a4 db TYPHLOSION ; 157 db 78, 84, 78, 100, 109, 85 @@ -4869,7 +4869,7 @@ TyphlosionBaseStats: ; 0x527a4 db %00000010 ; end -TotodileBaseStats: ; 0x527c4 +TotodileBaseData: ; 0x527c4 db TOTODILE ; 158 db 50, 65, 64, 43, 44, 48 @@ -4900,7 +4900,7 @@ TotodileBaseStats: ; 0x527c4 db %00001000 ; end -CroconawBaseStats: ; 0x527e4 +CroconawBaseData: ; 0x527e4 db CROCONAW ; 159 db 65, 80, 80, 58, 59, 63 @@ -4931,7 +4931,7 @@ CroconawBaseStats: ; 0x527e4 db %00001000 ; end -FeraligatrBaseStats: ; 0x52804 +FeraligatrBaseData: ; 0x52804 db FERALIGATR ; 160 db 85, 105, 100, 78, 79, 83 @@ -4962,7 +4962,7 @@ FeraligatrBaseStats: ; 0x52804 db %00001000 ; end -SentretBaseStats: ; 0x52824 +SentretBaseData: ; 0x52824 db SENTRET ; 161 db 35, 46, 34, 20, 35, 45 @@ -4993,7 +4993,7 @@ SentretBaseStats: ; 0x52824 db %00000000 ; end -FurretBaseStats: ; 0x52844 +FurretBaseData: ; 0x52844 db FURRET ; 162 db 85, 76, 64, 90, 45, 55 @@ -5024,7 +5024,7 @@ FurretBaseStats: ; 0x52844 db %00000000 ; end -HoothootBaseStats: ; 0x52864 +HoothootBaseData: ; 0x52864 db HOOTHOOT ; 163 db 60, 30, 30, 50, 36, 56 @@ -5055,7 +5055,7 @@ HoothootBaseStats: ; 0x52864 db %00000000 ; end -NoctowlBaseStats: ; 0x52884 +NoctowlBaseData: ; 0x52884 db NOCTOWL ; 164 db 100, 50, 50, 70, 76, 96 @@ -5086,7 +5086,7 @@ NoctowlBaseStats: ; 0x52884 db %00000000 ; end -LedybaBaseStats: ; 0x528a4 +LedybaBaseData: ; 0x528a4 db LEDYBA ; 165 db 40, 20, 30, 55, 40, 80 @@ -5117,7 +5117,7 @@ LedybaBaseStats: ; 0x528a4 db %00000000 ; end -LedianBaseStats: ; 0x528c4 +LedianBaseData: ; 0x528c4 db LEDIAN ; 166 db 55, 35, 50, 85, 55, 110 @@ -5148,7 +5148,7 @@ LedianBaseStats: ; 0x528c4 db %00000000 ; end -SpinarakBaseStats: ; 0x528e4 +SpinarakBaseData: ; 0x528e4 db SPINARAK ; 167 db 40, 60, 40, 30, 40, 40 @@ -5179,7 +5179,7 @@ SpinarakBaseStats: ; 0x528e4 db %00000000 ; end -AriadosBaseStats: ; 0x52904 +AriadosBaseData: ; 0x52904 db ARIADOS ; 168 db 70, 90, 70, 40, 60, 60 @@ -5210,7 +5210,7 @@ AriadosBaseStats: ; 0x52904 db %00000000 ; end -CrobatBaseStats: ; 0x52924 +CrobatBaseData: ; 0x52924 db CROBAT ; 169 db 85, 90, 80, 130, 70, 80 @@ -5241,7 +5241,7 @@ CrobatBaseStats: ; 0x52924 db %00000000 ; end -ChinchouBaseStats: ; 0x52944 +ChinchouBaseData: ; 0x52944 db CHINCHOU ; 170 db 75, 38, 38, 67, 56, 56 @@ -5272,7 +5272,7 @@ ChinchouBaseStats: ; 0x52944 db %00001101 ; end -LanturnBaseStats: ; 0x52964 +LanturnBaseData: ; 0x52964 db LANTURN ; 171 db 125, 58, 58, 67, 76, 76 @@ -5303,7 +5303,7 @@ LanturnBaseStats: ; 0x52964 db %00001101 ; end -PichuBaseStats: ; 0x52984 +PichuBaseData: ; 0x52984 db PICHU ; 172 db 20, 40, 15, 60, 35, 35 @@ -5334,7 +5334,7 @@ PichuBaseStats: ; 0x52984 db %00000100 ; end -CleffaBaseStats: ; 0x529a4 +CleffaBaseData: ; 0x529a4 db CLEFFA ; 173 db 50, 25, 28, 15, 45, 55 @@ -5365,7 +5365,7 @@ CleffaBaseStats: ; 0x529a4 db %00000010 ; end -IgglybuffBaseStats: ; 0x529c4 +IgglybuffBaseData: ; 0x529c4 db IGGLYBUFF ; 174 db 90, 30, 15, 15, 40, 20 @@ -5396,7 +5396,7 @@ IgglybuffBaseStats: ; 0x529c4 db %00000010 ; end -TogepiBaseStats: ; 0x529e4 +TogepiBaseData: ; 0x529e4 db TOGEPI ; 175 db 35, 20, 65, 20, 40, 65 @@ -5427,7 +5427,7 @@ TogepiBaseStats: ; 0x529e4 db %00000010 ; end -TogeticBaseStats: ; 0x52a04 +TogeticBaseData: ; 0x52a04 db TOGETIC ; 176 db 55, 40, 85, 40, 80, 105 @@ -5458,7 +5458,7 @@ TogeticBaseStats: ; 0x52a04 db %00000010 ; end -NatuBaseStats: ; 0x52a24 +NatuBaseData: ; 0x52a24 db NATU ; 177 db 40, 50, 45, 70, 70, 45 @@ -5489,7 +5489,7 @@ NatuBaseStats: ; 0x52a24 db %00000000 ; end -XatuBaseStats: ; 0x52a44 +XatuBaseData: ; 0x52a44 db XATU ; 178 db 65, 75, 70, 95, 95, 70 @@ -5520,7 +5520,7 @@ XatuBaseStats: ; 0x52a44 db %00000000 ; end -MareepBaseStats: ; 0x52a64 +MareepBaseData: ; 0x52a64 db MAREEP ; 179 db 55, 40, 40, 35, 65, 45 @@ -5551,7 +5551,7 @@ MareepBaseStats: ; 0x52a64 db %00000100 ; end -FlaaffyBaseStats: ; 0x52a84 +FlaaffyBaseData: ; 0x52a84 db FLAAFFY ; 180 db 70, 55, 55, 45, 80, 60 @@ -5582,7 +5582,7 @@ FlaaffyBaseStats: ; 0x52a84 db %00000100 ; end -AmpharosBaseStats: ; 0x52aa4 +AmpharosBaseData: ; 0x52aa4 db AMPHAROS ; 181 db 90, 75, 75, 55, 115, 90 @@ -5613,7 +5613,7 @@ AmpharosBaseStats: ; 0x52aa4 db %00000100 ; end -BellossomBaseStats: ; 0x52ac4 +BellossomBaseData: ; 0x52ac4 db BELLOSSOM ; 182 db 75, 80, 85, 50, 90, 100 @@ -5644,7 +5644,7 @@ BellossomBaseStats: ; 0x52ac4 db %00000000 ; end -MarillBaseStats: ; 0x52ae4 +MarillBaseData: ; 0x52ae4 db MARILL ; 183 db 70, 20, 50, 40, 20, 50 @@ -5675,7 +5675,7 @@ MarillBaseStats: ; 0x52ae4 db %00001001 ; end -AzumarillBaseStats: ; 0x52b04 +AzumarillBaseData: ; 0x52b04 db AZUMARILL ; 184 db 100, 50, 80, 50, 50, 80 @@ -5706,7 +5706,7 @@ AzumarillBaseStats: ; 0x52b04 db %00001001 ; end -SudowoodoBaseStats: ; 0x52b24 +SudowoodoBaseData: ; 0x52b24 db SUDOWOODO ; 185 db 70, 100, 115, 30, 30, 65 @@ -5737,7 +5737,7 @@ SudowoodoBaseStats: ; 0x52b24 db %00000000 ; end -PolitoedBaseStats: ; 0x52b44 +PolitoedBaseData: ; 0x52b44 db POLITOED ; 186 db 90, 75, 75, 70, 90, 100 @@ -5768,7 +5768,7 @@ PolitoedBaseStats: ; 0x52b44 db %00001001 ; end -HoppipBaseStats: ; 0x52b64 +HoppipBaseData: ; 0x52b64 db HOPPIP ; 187 db 35, 35, 40, 50, 35, 55 @@ -5799,7 +5799,7 @@ HoppipBaseStats: ; 0x52b64 db %00000000 ; end -SkiploomBaseStats: ; 0x52b84 +SkiploomBaseData: ; 0x52b84 db SKIPLOOM ; 188 db 55, 45, 50, 80, 45, 65 @@ -5830,7 +5830,7 @@ SkiploomBaseStats: ; 0x52b84 db %00000000 ; end -JumpluffBaseStats: ; 0x52ba4 +JumpluffBaseData: ; 0x52ba4 db JUMPLUFF ; 189 db 75, 55, 70, 110, 55, 85 @@ -5861,7 +5861,7 @@ JumpluffBaseStats: ; 0x52ba4 db %00000000 ; end -AipomBaseStats: ; 0x52bc4 +AipomBaseData: ; 0x52bc4 db AIPOM ; 190 db 55, 70, 55, 85, 40, 55 @@ -5892,7 +5892,7 @@ AipomBaseStats: ; 0x52bc4 db %00000100 ; end -SunkernBaseStats: ; 0x52be4 +SunkernBaseData: ; 0x52be4 db SUNKERN ; 191 db 30, 30, 30, 30, 30, 30 @@ -5923,7 +5923,7 @@ SunkernBaseStats: ; 0x52be4 db %00000000 ; end -SunfloraBaseStats: ; 0x52c04 +SunfloraBaseData: ; 0x52c04 db SUNFLORA ; 192 db 75, 75, 55, 30, 105, 85 @@ -5954,7 +5954,7 @@ SunfloraBaseStats: ; 0x52c04 db %00000000 ; end -YanmaBaseStats: ; 0x52c24 +YanmaBaseData: ; 0x52c24 db YANMA ; 193 db 65, 65, 45, 95, 75, 45 @@ -5985,7 +5985,7 @@ YanmaBaseStats: ; 0x52c24 db %00000000 ; end -WooperBaseStats: ; 0x52c44 +WooperBaseData: ; 0x52c44 db WOOPER ; 194 db 55, 45, 45, 15, 25, 25 @@ -6016,7 +6016,7 @@ WooperBaseStats: ; 0x52c44 db %00001000 ; end -QuagsireBaseStats: ; 0x52c64 +QuagsireBaseData: ; 0x52c64 db QUAGSIRE ; 195 db 95, 85, 85, 35, 65, 65 @@ -6047,7 +6047,7 @@ QuagsireBaseStats: ; 0x52c64 db %00001000 ; end -EspeonBaseStats: ; 0x52c84 +EspeonBaseData: ; 0x52c84 db ESPEON ; 196 db 65, 65, 60, 110, 130, 95 @@ -6078,7 +6078,7 @@ EspeonBaseStats: ; 0x52c84 db %00000000 ; end -UmbreonBaseStats: ; 0x52ca4 +UmbreonBaseData: ; 0x52ca4 db UMBREON ; 197 db 95, 65, 110, 65, 60, 130 @@ -6109,7 +6109,7 @@ UmbreonBaseStats: ; 0x52ca4 db %00000000 ; end -MurkrowBaseStats: ; 0x52cc4 +MurkrowBaseData: ; 0x52cc4 db MURKROW ; 198 db 60, 85, 42, 91, 85, 42 @@ -6140,7 +6140,7 @@ MurkrowBaseStats: ; 0x52cc4 db %00000000 ; end -SlowkingBaseStats: ; 0x52ce4 +SlowkingBaseData: ; 0x52ce4 db SLOWKING ; 199 db 95, 75, 80, 30, 100, 110 @@ -6171,7 +6171,7 @@ SlowkingBaseStats: ; 0x52ce4 db %00001010 ; end -MisdreavusBaseStats: ; 0x52d04 +MisdreavusBaseData: ; 0x52d04 db MISDREAVUS ; 200 db 60, 60, 60, 85, 85, 85 @@ -6202,7 +6202,7 @@ MisdreavusBaseStats: ; 0x52d04 db %00000100 ; end -UnownBaseStats: ; 0x52d24 +UnownBaseData: ; 0x52d24 db UNOWN ; 201 db 48, 72, 48, 48, 72, 48 @@ -6233,7 +6233,7 @@ UnownBaseStats: ; 0x52d24 db %00000000 ; end -WobbuffetBaseStats: ; 0x52d44 +WobbuffetBaseData: ; 0x52d44 db WOBBUFFET ; 202 db 190, 33, 58, 33, 33, 58 @@ -6264,7 +6264,7 @@ WobbuffetBaseStats: ; 0x52d44 db %00000000 ; end -GirafarigBaseStats: ; 0x52d64 +GirafarigBaseData: ; 0x52d64 db GIRAFARIG ; 203 db 70, 80, 65, 85, 90, 65 @@ -6295,7 +6295,7 @@ GirafarigBaseStats: ; 0x52d64 db %00000100 ; end -PinecoBaseStats: ; 0x52d84 +PinecoBaseData: ; 0x52d84 db PINECO ; 204 db 50, 65, 90, 15, 35, 35 @@ -6326,7 +6326,7 @@ PinecoBaseStats: ; 0x52d84 db %00000000 ; end -ForretressBaseStats: ; 0x52da4 +ForretressBaseData: ; 0x52da4 db FORRETRESS ; 205 db 75, 90, 140, 40, 60, 60 @@ -6357,7 +6357,7 @@ ForretressBaseStats: ; 0x52da4 db %00000000 ; end -DunsparceBaseStats: ; 0x52dc4 +DunsparceBaseData: ; 0x52dc4 db DUNSPARCE ; 206 db 100, 70, 70, 45, 65, 65 @@ -6388,7 +6388,7 @@ DunsparceBaseStats: ; 0x52dc4 db %00000110 ; end -GligarBaseStats: ; 0x52de4 +GligarBaseData: ; 0x52de4 db GLIGAR ; 207 db 65, 75, 105, 85, 35, 65 @@ -6419,7 +6419,7 @@ GligarBaseStats: ; 0x52de4 db %00000000 ; end -SteelixBaseStats: ; 0x52e04 +SteelixBaseData: ; 0x52e04 db STEELIX ; 208 db 75, 85, 200, 30, 55, 65 @@ -6450,7 +6450,7 @@ SteelixBaseStats: ; 0x52e04 db %00000000 ; end -SnubbullBaseStats: ; 0x52e24 +SnubbullBaseData: ; 0x52e24 db SNUBBULL ; 209 db 60, 80, 50, 30, 40, 40 @@ -6481,7 +6481,7 @@ SnubbullBaseStats: ; 0x52e24 db %00000100 ; end -GranbullBaseStats: ; 0x52e44 +GranbullBaseData: ; 0x52e44 db GRANBULL ; 210 db 90, 120, 75, 45, 60, 60 @@ -6512,7 +6512,7 @@ GranbullBaseStats: ; 0x52e44 db %00000100 ; end -QwilfishBaseStats: ; 0x52e64 +QwilfishBaseData: ; 0x52e64 db QWILFISH ; 211 db 65, 95, 75, 85, 55, 55 @@ -6543,7 +6543,7 @@ QwilfishBaseStats: ; 0x52e64 db %00001001 ; end -ScizorBaseStats: ; 0x52e84 +ScizorBaseData: ; 0x52e84 db SCIZOR ; 212 db 70, 130, 100, 65, 55, 80 @@ -6574,7 +6574,7 @@ ScizorBaseStats: ; 0x52e84 db %00000000 ; end -ShuckleBaseStats: ; 0x52ea4 +ShuckleBaseData: ; 0x52ea4 db SHUCKLE ; 213 db 20, 10, 230, 05, 10, 230 @@ -6605,7 +6605,7 @@ ShuckleBaseStats: ; 0x52ea4 db %00000000 ; end -HeracrossBaseStats: ; 0x52ec4 +HeracrossBaseData: ; 0x52ec4 db HERACROSS ; 214 db 80, 125, 75, 85, 40, 95 @@ -6636,7 +6636,7 @@ HeracrossBaseStats: ; 0x52ec4 db %00000000 ; end -SneaselBaseStats: ; 0x52ee4 +SneaselBaseData: ; 0x52ee4 db SNEASEL ; 215 db 55, 95, 55, 115, 35, 75 @@ -6667,7 +6667,7 @@ SneaselBaseStats: ; 0x52ee4 db %00001000 ; end -TeddiursaBaseStats: ; 0x52f04 +TeddiursaBaseData: ; 0x52f04 db TEDDIURSA ; 216 db 60, 80, 50, 40, 50, 50 @@ -6698,7 +6698,7 @@ TeddiursaBaseStats: ; 0x52f04 db %00000000 ; end -UrsaringBaseStats: ; 0x52f24 +UrsaringBaseData: ; 0x52f24 db URSARING ; 217 db 90, 130, 75, 55, 75, 75 @@ -6729,7 +6729,7 @@ UrsaringBaseStats: ; 0x52f24 db %00000000 ; end -SlugmaBaseStats: ; 0x52f44 +SlugmaBaseData: ; 0x52f44 db SLUGMA ; 218 db 40, 40, 40, 20, 70, 40 @@ -6760,7 +6760,7 @@ SlugmaBaseStats: ; 0x52f44 db %00000010 ; end -MagcargoBaseStats: ; 0x52f64 +MagcargoBaseData: ; 0x52f64 db MAGCARGO ; 219 db 50, 50, 120, 30, 80, 80 @@ -6791,7 +6791,7 @@ MagcargoBaseStats: ; 0x52f64 db %00000010 ; end -SwinubBaseStats: ; 0x52f84 +SwinubBaseData: ; 0x52f84 db SWINUB ; 220 db 50, 50, 40, 50, 30, 30 @@ -6822,7 +6822,7 @@ SwinubBaseStats: ; 0x52f84 db %00001000 ; end -PiloswineBaseStats: ; 0x52fa4 +PiloswineBaseData: ; 0x52fa4 db PILOSWINE ; 221 db 100, 100, 80, 50, 60, 60 @@ -6853,7 +6853,7 @@ PiloswineBaseStats: ; 0x52fa4 db %00001000 ; end -CorsolaBaseStats: ; 0x52fc4 +CorsolaBaseData: ; 0x52fc4 db CORSOLA ; 222 db 55, 55, 85, 35, 65, 85 @@ -6884,7 +6884,7 @@ CorsolaBaseStats: ; 0x52fc4 db %00001000 ; end -RemoraidBaseStats: ; 0x52fe4 +RemoraidBaseData: ; 0x52fe4 db REMORAID ; 223 db 35, 65, 35, 65, 65, 35 @@ -6915,7 +6915,7 @@ RemoraidBaseStats: ; 0x52fe4 db %00001010 ; end -OctilleryBaseStats: ; 0x53004 +OctilleryBaseData: ; 0x53004 db OCTILLERY ; 224 db 75, 105, 75, 45, 105, 75 @@ -6946,7 +6946,7 @@ OctilleryBaseStats: ; 0x53004 db %00001010 ; end -DelibirdBaseStats: ; 0x53024 +DelibirdBaseData: ; 0x53024 db DELIBIRD ; 225 db 45, 55, 45, 75, 65, 45 @@ -6977,7 +6977,7 @@ DelibirdBaseStats: ; 0x53024 db %00001000 ; end -MantineBaseStats: ; 0x53044 +MantineBaseData: ; 0x53044 db MANTINE ; 226 db 65, 40, 70, 70, 80, 140 @@ -7008,7 +7008,7 @@ MantineBaseStats: ; 0x53044 db %00001001 ; end -SkarmoryBaseStats: ; 0x53064 +SkarmoryBaseData: ; 0x53064 db SKARMORY ; 227 db 65, 80, 140, 70, 40, 70 @@ -7039,7 +7039,7 @@ SkarmoryBaseStats: ; 0x53064 db %00000000 ; end -HoundourBaseStats: ; 0x53084 +HoundourBaseData: ; 0x53084 db HOUNDOUR ; 228 db 45, 60, 30, 65, 80, 50 @@ -7070,7 +7070,7 @@ HoundourBaseStats: ; 0x53084 db %00000010 ; end -HoundoomBaseStats: ; 0x530a4 +HoundoomBaseData: ; 0x530a4 db HOUNDOOM ; 229 db 75, 90, 50, 95, 110, 80 @@ -7101,7 +7101,7 @@ HoundoomBaseStats: ; 0x530a4 db %00000010 ; end -KingdraBaseStats: ; 0x530c4 +KingdraBaseData: ; 0x530c4 db KINGDRA ; 230 db 75, 95, 95, 85, 95, 95 @@ -7132,7 +7132,7 @@ KingdraBaseStats: ; 0x530c4 db %00001001 ; end -PhanpyBaseStats: ; 0x530e4 +PhanpyBaseData: ; 0x530e4 db PHANPY ; 231 db 90, 60, 60, 40, 40, 40 @@ -7163,7 +7163,7 @@ PhanpyBaseStats: ; 0x530e4 db %00000000 ; end -DonphanBaseStats: ; 0x53104 +DonphanBaseData: ; 0x53104 db DONPHAN ; 232 db 90, 120, 120, 50, 60, 60 @@ -7194,7 +7194,7 @@ DonphanBaseStats: ; 0x53104 db %00000000 ; end -Porygon2BaseStats: ; 0x53124 +Porygon2BaseData: ; 0x53124 db PORYGON2 ; 233 db 85, 80, 90, 60, 105, 95 @@ -7225,7 +7225,7 @@ Porygon2BaseStats: ; 0x53124 db %00001100 ; end -StantlerBaseStats: ; 0x53144 +StantlerBaseData: ; 0x53144 db STANTLER ; 234 db 73, 95, 62, 85, 85, 65 @@ -7256,7 +7256,7 @@ StantlerBaseStats: ; 0x53144 db %00000000 ; end -SmeargleBaseStats: ; 0x53164 +SmeargleBaseData: ; 0x53164 db SMEARGLE ; 235 db 55, 20, 35, 75, 20, 45 @@ -7287,7 +7287,7 @@ SmeargleBaseStats: ; 0x53164 db %00000000 ; end -TyrogueBaseStats: ; 0x53184 +TyrogueBaseData: ; 0x53184 db TYROGUE ; 236 db 35, 35, 35, 35, 35, 35 @@ -7318,7 +7318,7 @@ TyrogueBaseStats: ; 0x53184 db %00000000 ; end -HitmontopBaseStats: ; 0x531a4 +HitmontopBaseData: ; 0x531a4 db HITMONTOP ; 237 db 50, 95, 95, 70, 35, 110 @@ -7349,7 +7349,7 @@ HitmontopBaseStats: ; 0x531a4 db %00000000 ; end -SmoochumBaseStats: ; 0x531c4 +SmoochumBaseData: ; 0x531c4 db SMOOCHUM ; 238 db 45, 30, 15, 65, 85, 65 @@ -7380,7 +7380,7 @@ SmoochumBaseStats: ; 0x531c4 db %00001000 ; end -ElekidBaseStats: ; 0x531e4 +ElekidBaseData: ; 0x531e4 db ELEKID ; 239 db 45, 63, 37, 95, 65, 55 @@ -7411,7 +7411,7 @@ ElekidBaseStats: ; 0x531e4 db %00000100 ; end -MagbyBaseStats: ; 0x53204 +MagbyBaseData: ; 0x53204 db MAGBY ; 240 db 45, 75, 37, 83, 70, 55 @@ -7442,7 +7442,7 @@ MagbyBaseStats: ; 0x53204 db %00000010 ; end -MiltankBaseStats: ; 0x53224 +MiltankBaseData: ; 0x53224 db MILTANK ; 241 db 95, 80, 105, 100, 40, 70 @@ -7473,7 +7473,7 @@ MiltankBaseStats: ; 0x53224 db %00001100 ; end -BlisseyBaseStats: ; 0x53244 +BlisseyBaseData: ; 0x53244 db BLISSEY ; 242 db 255, 10, 10, 55, 75, 135 @@ -7504,7 +7504,7 @@ BlisseyBaseStats: ; 0x53244 db %00001110 ; end -RaikouBaseStats: ; 0x53264 +RaikouBaseData: ; 0x53264 db RAIKOU ; 243 db 90, 85, 75, 115, 115, 100 @@ -7535,7 +7535,7 @@ RaikouBaseStats: ; 0x53264 db %00000100 ; end -EnteiBaseStats: ; 0x53284 +EnteiBaseData: ; 0x53284 db ENTEI ; 244 db 115, 115, 85, 100, 90, 75 @@ -7566,7 +7566,7 @@ EnteiBaseStats: ; 0x53284 db %00000010 ; end -SuicuneBaseStats: ; 0x532a4 +SuicuneBaseData: ; 0x532a4 db SUICUNE ; 245 db 100, 75, 115, 85, 90, 115 @@ -7597,7 +7597,7 @@ SuicuneBaseStats: ; 0x532a4 db %00001001 ; end -LarvitarBaseStats: ; 0x532c4 +LarvitarBaseData: ; 0x532c4 db LARVITAR ; 246 db 50, 64, 50, 41, 45, 50 @@ -7628,7 +7628,7 @@ LarvitarBaseStats: ; 0x532c4 db %00000000 ; end -PupitarBaseStats: ; 0x532e4 +PupitarBaseData: ; 0x532e4 db PUPITAR ; 247 db 70, 84, 70, 51, 65, 70 @@ -7659,7 +7659,7 @@ PupitarBaseStats: ; 0x532e4 db %00000000 ; end -TyranitarBaseStats: ; 0x53304 +TyranitarBaseData: ; 0x53304 db TYRANITAR ; 248 db 100, 134, 110, 61, 95, 100 @@ -7690,7 +7690,7 @@ TyranitarBaseStats: ; 0x53304 db %00001110 ; end -LugiaBaseStats: ; 0x53324 +LugiaBaseData: ; 0x53324 db LUGIA ; 249 db 106, 90, 130, 110, 90, 154 @@ -7721,7 +7721,7 @@ LugiaBaseStats: ; 0x53324 db %00001101 ; end -Ho_OhBaseStats: ; 0x53344 +Ho_OhBaseData: ; 0x53344 db HO_OH ; 250 db 106, 130, 90, 90, 110, 154 @@ -7752,7 +7752,7 @@ Ho_OhBaseStats: ; 0x53344 db %00000110 ; end -CelebiBaseStats: ; 0x53364 +CelebiBaseData: ; 0x53364 db CELEBI ; 251 db 100, 100, 100, 100, 100, 100 @@ -510,7 +510,7 @@ PlayerSubStatus1: ; c668 ; 6 encore ; 5 endure ; 4 perish song -; 3 +; 3 identified ; 2 protect ; 1 curse ; 0 nightmare @@ -528,7 +528,7 @@ PlayerSubStatus2: ; c669 ds 1 PlayerSubStatus3: ; c66a ; bit -; 7 confusion +; 7 confused ; 6 flying ; 5 underground ; 4 charged @@ -545,19 +545,19 @@ PlayerSubStatus4: ; c66b ; 4 substitute ; 3 ; 2 focus energy -; 1 +; 1 mist ; 0 bide: unleashed energy ds 1 PlayerSubStatus5: ; c66c ; bit -; 7 +; 7 cant run ; 6 destiny bond ; 5 lock-on ; 4 ; 3 ; 2 ; 1 -; 0 +; 0 toxic ds 1 EnemySubStatus1: ; c66d @@ -596,20 +596,22 @@ EnemyRolloutCount: ; c67a EnemyConfuseCount: ; c67b ds 1 ds 1 -EnemyEncoreCount: ; c67d +EnemyDisableCount: ; c67d ds 1 -EnemyPerishCount: ; c67e +EnemyEncoreCount: ; c67e ds 1 +EnemyPerishCount: ; c67f ds 1 EnemyFuryCutterCount: ; c680 ds 1 + ds 1 -PlayerDamageTaken: ; c681 +PlayerDamageTaken: ; c682 ds 2 -EnemyDamageTaken: ; c683 +EnemyDamageTaken: ; c684 ds 2 - ds 4 + ds 3 ds 1 @@ -688,7 +690,7 @@ AlreadyDisobeyed: ; c6f4 DisabledMove: ; c6f5 ds 1 -EnemyEncoredMove: ; c6f6 +EnemyDisabledMove: ; c6f6 ds 1 ds 1 @@ -706,13 +708,15 @@ AlreadyFailed: ; c6fb ds 3 PlayerScreens: ; c6ff -; bit 4: reflect -; bit 3: light screen +; bit +; 4 reflect +; 3 light screen +; 2 safeguard +; 0 spikes ds 1 EnemyScreens: ; c700 -; bit 4: reflect -; bit 3: light screen +; see PlayerScreens ds 1 ds 1 @@ -893,7 +897,14 @@ StartFlypoint: ; d005 EndFlypoint: ; d006 ds 1 - ds 108 + ds 55 + +CurFruitTree: ; d03e + ds 1 +CurFruit: ; d03f + ds 1 + + ds 51 StringBuffer1: ; d073 ds 19 @@ -918,7 +929,12 @@ VramState: ; d0ed ; flickers when climbing waterfall ds 1 - ds 26 + ds 24 + +CurItem: ; d106 + ds 1 + + ds 1 CurPartySpecies: ; d108 ds 1 @@ -1043,17 +1059,16 @@ MagikarpLength: ; d1ea Buffer2: ; d1eb ds 1 -SECTION "prng2",BSS[$d1fa] +SECTION "BattleMons2",BSS[$d1fa] LinkBattleRNs: ; d1fa ds 10 -SECTION "BattleMons2",BSS[$d204] - TempEnemyMonSpecies: ; d204 ds 1 TempBattleMonSpecies: ; d205 ds 1 - + +EnemyMon: EnemyMonSpecies: ; d206 ds 1 EnemyMonItem: ; d207 @@ -1068,6 +1083,7 @@ EnemyMonMove3: ; d20a ds 1 EnemyMonMove4: ; d20b ds 1 +EnemyMonMovesEnd EnemyMonDVs: EnemyMonAtkDefDV: ; d20c @@ -1105,6 +1121,7 @@ EnemyMonMaxHPHi: ; d218 EnemyMonMaxHPLo: ; d219 ds 1 +EnemyMonStats: EnemyMonAtk: ; d21a ds 2 EnemyMonDef: ; d21c @@ -1115,14 +1132,23 @@ EnemyMonSpclAtk: ; d220 ds 2 EnemyMonSpclDef: ; d222 ds 2 +EnemyMonStatsEnd EnemyMonType1: ; d224 ds 1 EnemyMonType2: ; d225 ds 1 +EnemyMonBaseStats: ; d226 + ds 5 + +EnemyMonCatchRate: ; d22b + ds 1 +EnemyMonBaseExp: ; d22c + ds 1 + +EnemyMonEnd -SECTION "Battle",BSS[$d22d] IsInBattle: ; d22d ; 0: overworld @@ -1158,19 +1184,67 @@ OtherTrainerID: ; d231 ; (Joey, Mikey, Albert, etc.) ds 1 - ds 2 + ds 1 + +TrainerClass: ; d233 + ds 1 UnownLetter: ; d234 ds 1 ds 1 -CurBaseStats: ; d236 - ds 32 +CurBaseData: ; d236 +BaseDexNo: ; d236 + ds 1 +BaseStats: ; d237 +BaseHP: ; d237 + ds 1 +BaseAttack: ; d238 + ds 1 +BaseDefense: ; d239 + ds 1 +BaseSpeed: ; d23a + ds 1 +BaseSpecialAttack: ; d23b + ds 1 +BaseSpecialDefense: ; d23c + ds 1 +BaseType: ; d23d +BaseType1: ; d23d + ds 1 +BaseType2: ; d23e + ds 1 +BaseCatchRate: ; d23f + ds 1 +BaseExp: ; d240 + ds 1 +BaseItems: ; d241 + ds 2 +BaseGender: ; d243 + ds 1 +BaseUnknown1: ; d244 + ds 1 +BaseEggSteps: ; d245 + ds 1 +BaseUnknown2: ; d246 + ds 1 +BasePicSize: ; d247 + ds 1 +BasePadding: ; d248 + ds 4 +BaseGrowthRate: ; d24c + ds 1 +BaseEggGroups: ; d24d + ds 1 +BaseTMHM: ; d24e + ds 8 + CurDamage: ; d256 ds 2 + SECTION "TimeOfDay",BSS[$d269] TimeOfDay: ; d269 @@ -1482,6 +1556,10 @@ Box13Name: ; dbe1 Box14Name: ; dbea ds 9 +SECTION "fruittrees", BSS[$dc27] +FruitTreeFlags: ; dc27 + ds 1 + SECTION "steps", BSS[$dc73] StepCount: ; dc73 ds 1 @@ -1620,6 +1698,7 @@ PartyMon5OT: ; de2b PartyMon6OT: ; de36 ds 11 +PartyMonNicknames: PartyMon1Nickname: ; de41 ds 11 PartyMon2Nickname: ; de4c |