From a1ed7e76583127562c73bf12766ba2958451b9dc Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sun, 3 Mar 2013 21:42:35 -0600 Subject: [PATCH 001/112] vba - basic cheating infrastructure --- extras/vba.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/extras/vba.py b/extras/vba.py index 8ed0d7b5a..c1ff3538d 100644 --- a/extras/vba.py +++ b/extras/vba.py @@ -564,6 +564,66 @@ def call(bank, address): else: registers["pc"] = address +class cheats: + """ + Helpers to manage the cheating infrastructure. + + import vba; vba.load_rom(); vba.cheats.add_gameshark("0100CFCF", "text speedup 1"); vba.cheats.add_gameshark("0101CCCF", "text speedup 2"); vba.go() + """ + + @staticmethod + def enable(id): + """ + void gbCheatEnable(int i) + """ + Gb.cheatEnable(id) + + @staticmethod + def disable(id): + """ + void gbCheatDisable(int i) + """ + Gb.cheatDisable(id) + + @staticmethod + def load_file(filename): + """ + Loads a .clt file. By default each cheat is disabled. + """ + Gb.loadCheatsFromFile(filename) + + @staticmethod + def remove_all(): + """ + Removes all cheats from memory. + + void gbCheatRemoveAll() + """ + Gb.cheatRemoveAll() + + @staticmethod + def remove_cheat(id): + """ + Removes a specific cheat from memory by id. + + void gbCheatRemove(int i) + """ + Gb.cheatRemove(id) + + @staticmethod + def add_gamegenie(code, description=""): + """ + void gbAddGgCheat(const char *code, const char *desc) + """ + Gb.cheatAddGamegenie(code, description) + + @staticmethod + def add_gameshark(code, description=""): + """ + gbAddGsCheat(const char *code, const char *desc) + """ + Gb.cheatAddGameshark(code, description) + class crystal: """ Just a simple namespace to store a bunch of functions for Pokémon Crystal. From 0fa5d9a16217993922c88f7ec83ae99857a31267 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Mon, 4 Mar 2013 03:08:00 -0600 Subject: [PATCH 002/112] vba - keyboard input optimization --- extras/vba.py | 36 +++ extras/vba_keyboard.py | 563 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 599 insertions(+) create mode 100644 extras/vba_keyboard.py diff --git a/extras/vba.py b/extras/vba.py index c1ff3538d..b8c3dc9d3 100644 --- a/extras/vba.py +++ b/extras/vba.py @@ -104,6 +104,11 @@ Gb.loadVBA() from vba_config import * +try: + import vba_keyboard as keyboard +except ImportError: + print "Not loading the keyboard module (which uses networkx)." + if not os.path.exists(rom_path): raise Exception("rom_path is not configured properly; edit vba_config.py?") @@ -163,6 +168,10 @@ def button_combiner(buttons): buttons.replace("select", "") result |= button_masks["select"] + if isinstance(buttons, list): + if len(buttons) > 9: + raise Exception("can't combine more than 9 buttons at a time") + for each in buttons: result |= button_masks[each] @@ -826,6 +835,25 @@ class crystal: return output + @staticmethod + def keyboard_apply(button_sequence): + """ + Applies a sequence of buttons to the on-screen keyboard. + """ + for buttons in button_sequence: + press(buttons) + nstep(2) + press([]) + + @staticmethod + def write(something="TrAiNeR"): + """ + Uses a planning algorithm to type out a word in the most efficient way + possible. + """ + button_sequence = keyboard.plan_typing(something) + crystal.keyboard_apply([[x] for x in button_sequence]) + @staticmethod def set_partymon2(): """ @@ -896,6 +924,14 @@ class TestEmulator(unittest.TestCase): self.assertTrue("TRAINER" in text) +class TestWriter(unittest.TestCase): + def test_very_basic(self): + button_sequence = keyboard.plan_typing("an") + expected_result = ["select", "a", "d", "r", "r", "r", "r", "a"] + + self.assertEqual(len(expected_result), len(button_sequence)) + self.assertEqual(expected_result, button_sequence) + if __name__ == "__main__": unittest.main() diff --git a/extras/vba_keyboard.py b/extras/vba_keyboard.py new file mode 100644 index 000000000..bbe85b051 --- /dev/null +++ b/extras/vba_keyboard.py @@ -0,0 +1,563 @@ +# -*- encoding: utf-8 -*- +""" +This file constructs a networkx.DiGraph object called graph, which can be used +to find the shortest path of keypresses on the keyboard to type a word. +""" + +import itertools +import networkx + +graph = networkx.DiGraph() + +graph_data = """ +A a select +A B r +A I l +A lower-upper-column-1 u +A J d + +B b select +B A l +B C r +B lower-upper-column-2 u +B K d + +C c select +C D r +C B l +C lower-upper-column-3 u +C L d + +D d select +D E r +D C l +D del-upper-column-1 u +D M d + +E e select +E del-upper-column-2 u +E N d +E D l +E F r + +F f select +F del-upper-column-3 u +F O d +F E l +F G r + +G g select +G end-upper-column-1 u +G P d +G F l +G H r + +H h select +H end-upper-column-2 u +H Q d +H G l +H I r + +I i select +I end-upper-column-3 u +I R d +I H l +I A r + +J j select +J A u +J S d +J R l +J K r + +K k select +K B u +K T d +K J l +K L r + +L l select +L C u +L U d +L K l +L M r + +M m select +M D u +M V d +M L l +M N r + +N n select +N E u +N W d +N M l +N O r + +O o select +O F u +O X d +O N l +O P r + +P p select +P G u +P Y d +P O l +P Q r + +Q q select +Q H u +Q Z d +Q P l +Q R r + +R r select +R I u +R space-upper-x8-y2 d +R Q l +R J r + +S s select +S J u +S - d +S space-upper-x8-y2 l + +T t select +T K u +T ? d +T S l +T U r + +U u select +U L u +U ! d +U T l +U V r + +V v select +V M u +V / d +V U l +V W r + +W w select +W N u +W . d +W V l +W X r + +X x select +X O u +X , d +X W l +X Y r + +Y y select +Y P u +Y space-upper-x6-y3 d +Y X l +Y Z r + +Z z select +Z Q u +Z space-upper-x7-y3 d +Z Y l +Z space-upper-x8-y2 r + +end-upper-column-1 lower-upper-column-1 r +end-upper-column-2 lower-upper-column-1 r +end-upper-column-3 lower-upper-column-1 r +end-upper-column-1 del-upper-column-1 l +end-upper-column-2 del-upper-column-1 l +end-upper-column-3 del-upper-column-1 l +lower-upper-column-1 end-upper-column-1 l +lower-upper-column-2 end-upper-column-1 l +lower-upper-column-3 end-upper-column-1 l +lower-upper-column-1 del-upper-column-1 r +lower-upper-column-2 del-upper-column-1 r +lower-upper-column-3 del-upper-column-1 r +del-upper-column-1 lower-upper-column-1 l +del-upper-column-2 lower-upper-column-1 l +del-upper-column-3 lower-upper-column-1 l +del-upper-column-1 end-upper-column-1 r +del-upper-column-2 end-upper-column-1 r +del-upper-column-3 end-upper-column-1 r + +lower-upper-column-1 A d +lower-upper-column-2 B d +lower-upper-column-3 C d +lower-upper-column-1 - u +lower-upper-column-2 ? u +lower-upper-column-3 ! u + +del-upper-column-1 D d +del-upper-column-2 E d +del-upper-column-3 F d +del-upper-column-1 / u +del-upper-column-2 . u +del-upper-column-3 , u + +end-upper-column-1 G d +end-upper-column-2 H d +end-upper-column-3 I d +end-upper-column-1 space-upper-x6-y3 u +end-upper-column-2 space-upper-x7-y3 u +end-upper-column-3 space-upper-x8-y3 u + +space-upper-x8-y2 space-lower-x8-y2 select +space-upper-x8-y2 R u +space-upper-x8-y2 space-upper-x8-y3 d +space-upper-x8-y2 Z l +space-upper-x8-y2 S r + +space-upper-x8-y3 MN select +space-upper-x8-y3 space-upper-x8-y2 u +space-upper-x8-y3 end-upper-column-3 d +space-upper-x8-y3 space-upper-x7-y3 l +space-upper-x8-y3 - r + +space-upper-x7-y3 PK select +space-upper-x7-y3 Z u +space-upper-x7-y3 end-upper-column-2 d +space-upper-x7-y3 space-upper-x6-y3 l +space-upper-x7-y3 space-upper-x8-y3 r + +space-upper-x6-y3 ] select +space-upper-x6-y3 Y u +space-upper-x6-y3 end-upper-column-1 d +space-upper-x6-y3 , l +space-upper-x6-y3 space-upper-x7-y3 r + +end-upper-column-1 end-lower-column-1 select +end-upper-column-2 end-lower-column-2 select +end-upper-column-3 end-lower-column-3 select +lower-upper-column-1 lower-lower-column-1 select +lower-upper-column-2 lower-lower-column-2 select +lower-upper-column-3 lower-lower-column-3 select +del-upper-column-1 del-lower-column-1 select +del-upper-column-2 del-lower-column-2 select +del-upper-column-3 del-lower-column-3 select + +lower-lower-column-1 × u +lower-lower-column-2 ( u +lower-lower-column-3 ) u +lower-lower-column-1 a d +lower-lower-column-2 b d +lower-lower-column-3 c d + +end-lower-column-1 ] u +end-lower-column-2 PK u +end-lower-column-3 MN u +end-lower-column-1 g d +end-lower-column-2 h d +end-lower-column-3 i d + +del-lower-column-1 : u +del-lower-column-2 ; u +del-lower-column-3 [ u +del-lower-column-1 d d +del-lower-column-2 e d +del-lower-column-3 f d + +- × select +- S u +- lower-upper-column-1 d +- space-upper-x8-y3 l +- ? r + +? ( select +? T u +? lower-upper-column-2 d +? - l +? ! r + +! ) select +! U u +! lower-upper-column-3 d +! ? l +! / r + +/ : select +/ V u +/ del-upper-column-1 d +/ ! l +/ . r + +. ; select +. W u +. del-upper-column-2 d +. / l +. , r + +, [ select +, X u +, del-upper-column-3 d +, . l +, space-upper-x6-y3 r + +× - select +× s u +× upper-lower-column-1 d +× MN l +× ( r + +( ? select +( t u +( upper-lower-column-2 d +( × l +( ) r + +) ! select +) u u +) upper-lower-column-3 d +) ( l +) : r + +: / select +: v u +: del-lower-column-1 d +: ) l +: ; r + +; . select +; w u +; del-lower-column-2 d +; : l +; [ r + +[ , select +[ x u +[ del-lower-column-3 d +[ ; l +[ ] r + +] space-upper-x6-y3 select +] y u +] end-lower-column-1 d +] [ l +] PK r + +PK space-upper-x7-y3 select +PK z u +PK end-lower-column-2 d +PK ] l +PK MN r + +MN space-upper-x8-y3 select +MN space-lower-x8-y2 u +MN end-lower-column-3 d +MN PK l +MN × r + +space-lower-x8-y2 space-upper-x8-y2 select +space-lower-x8-y2 r u +space-lower-x8-y2 MN d +space-lower-x8-y2 z l +space-lower-x8-y2 s r + +a A select +a upper-lower-column-1 u +a j d +a i l +a b r + +b B select +b upper-lower-column-2 u +b k d +b a l +b c r + +c C select +c upper-lower-column-3 u +c l d +c b l +c d r + +d D select +d del-lower-column-1 u +d m d +d c l +d e r + +e E select +e del-lower-column-2 u +e n d +e d l +e f r + +f F select +f del-lower-column-3 u +f o d +f e l +f g r + +g G select +g end-lower-column-1 u +g p d +g f l +g h r + +h H select +h end-lower-column-2 u +h q d +h g l +h i r + +i I select +i end-lower-column-3 u +i r d +i h l +i a r + +j J select +j a u +j s d +j r l +j k r + +k K select +k b u +k t d +k j l +k l r + +l L select +l c u +l u d +l k l +l m r + +m M select +m d u +m v d +m l l +m n r + +n N select +n e u +n w d +n m l +n o r + +o O select +o f u +o x d +o n l +o p r + +p P select +p g u +p y d +p o l +p q r + +q Q select +q h u +q z d +q p l +q r r + +r R select +r i u +r space-lower-x8-y2 d +r q l +r j r + +s S select +s j u +s × d +s space-lower-x8-y2 l +s t r + +t T select +t k u +t ( d +t s l +t u r + +u U select +u l u +u ) d +u t l +u v r + +v V select +v m u +v : d +v u l +v w r + +w W select +w n u +w ; d +w v l +w x r + +x X select +x o u +x [ d +x w l +x y r + +y Y select +y p u +y ] d +y x l +y z r + +z Z select +z q u +z PK d +z y l +z space-lower-x8-y2 r""" + +for line in graph_data.split("\n"): + if line == "": + continue + elif line[0] == "#": + continue + + (node1, node2, edge_name) = line.split(" ") + graph.add_edge(node1, node2, key=edge_name) + + #print "Adding edge ("+edge_name+") "+node1+" -> "+node2 + +def shortest_path(node1, node2): + """ + Figures out the shortest list of button presses to move from one letter to + another. + """ + buttons = [] + last = None + path = networkx.shortest_path(graph, node1, node2) + for each in path: + if last != None: + buttons.append(convert_nodes_to_button_press(last, each)) + last = each + return buttons + #return [convert_nodes_to_button_press(node3, node4) for (node3, node4) in zip(*(iter(networkx.shortest_path(graph, node1, node2)),) * 2)] + +def convert_nodes_to_button_press(node1, node2): + """ + Determines the button necessary to switch from node1 to node2. + """ + print "getting button press for state transition: " + node1 + " -> " + node2 + return graph.get_edge_data(node1, node2)["key"] + +def plan_typing(text, current="A"): + """ + Plans a sequence of button presses to spell out the given text. + """ + buttons = [] + for target in text: + if target == current: + buttons.append("a") + else: + print "Finding the shortest path between " + current + " and " + target + more_buttons = shortest_path(current, target) + buttons.extend(more_buttons) + buttons.append("a") + current = target + return buttons + From 6a3cf4e39391560ec978432ec797ce77d13cd76b Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Tue, 5 Mar 2013 01:56:25 -0600 Subject: [PATCH 003/112] vba - record/replay button sequences --- extras/vba.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/extras/vba.py b/extras/vba.py index b8c3dc9d3..b57e8e699 100644 --- a/extras/vba.py +++ b/extras/vba.py @@ -443,6 +443,69 @@ def press(buttons, steplimit=1): for step_counter in range(0, steplimit): Gb.step(number) +def get_buttons(): + """ + Returns the currentButtons[0] value (an integer with bits set for which + buttons are currently pressed). + """ + return Gb.getCurrentButtons() + +class State(RomList): + name = None + +class Recording: + def __init__(self): + self.frames = [] + self.states = {} + + def _get_frame_count(self): + return len(self.frames) + + frame_count = property(fget=_get_frame_count) + + def save(self, name=None): + """ + Saves the current state. + """ + state = State(get_state()) + state.name = name + self.states[self.frame_count] = state + + def load(self, name): + """ + Loads a state by name in the state list. + """ + for state in self.states.items(): + if state.name == name: + set_state(state) + return state + return False + + def step(self, stepcount=1, first_frame=0, replay=False): + """ + Records button presses for each frame. + """ + if replay: + stepcount = len(self.frames[first_name:]) + + for counter in range(first_frame, stepcount): + if replay: + press(self.frames[counter], steplimit=0) + else: + self.frames.append(get_buttons()) + nstep(1) + + def replay_from(self, thing): + """ + Replays based on a State or the name of a saved state. + """ + if isinstance(thing, State): + set_state(thing) + else: + thing = self.load(thing) + frame_id = self.states.index(thing) + self.step(first_frame=frame_id, replay=True) + class Registers: order = [ "pc", From 91b24953f615569d5130cb1ccceffa8149cc42c0 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 7 Mar 2013 23:27:55 -0500 Subject: [PATCH 004/112] vba - suppress joypad input message --- extras/vba.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/vba.py b/extras/vba.py index 8ed0d7b5a..61265765d 100644 --- a/extras/vba.py +++ b/extras/vba.py @@ -166,7 +166,7 @@ def button_combiner(buttons): for each in buttons: result |= button_masks[each] - print "button: " + str(result) + #print "button: " + str(result) return result def load_rom(path=None): From a46a4b35a2fa3ceefb6a283480a4e6a9efe8424c Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 7 Mar 2013 23:39:21 -0500 Subject: [PATCH 005/112] vba - generalize project path in config --- extras/vba_config.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/extras/vba_config.py b/extras/vba_config.py index 8377c8818..4433f16c0 100644 --- a/extras/vba_config.py +++ b/extras/vba_config.py @@ -2,13 +2,10 @@ # -*- encoding: utf-8 -*- import os -# by default we assume the user has things in their $HOME -home = os.path.expanduser("~") # or System.getProperty("user.home") +# by default we assume the user has vba in pokecrystal/extras +project_path = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..')) -# and that the pokecrystal project folder is in there somewhere -project_path = os.path.join(home, os.path.join("code", "pokecrystal")) - -# save states are in ~/code/pokecrystal/save-states/ +# save states are in pokecrystal/save-states/ save_state_path = os.path.join(project_path, "save-states") # where is your rom? From c19dcb996c26111d5ccda8cb783ccbb15348992b Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 18 Mar 2013 00:30:37 -0400 Subject: [PATCH 006/112] Fix unused function parse_map_header_by_id 'Dunno' exception always fired even if parameters were correct --- extras/crystal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/crystal.py b/extras/crystal.py index b3f29a12f..0fe1aa30c 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -6201,7 +6201,7 @@ def parse_map_header_by_id(*args, **kwargs): elif len(args) == 1 and type(args[0]) == str: map_group = int(args[0].split(".")[0]) map_id = int(args[0].split(".")[1]) - else: + elif map_group == None and map_id == None: raise Exception("dunno what to do with input") offset = map_names[map_group]["offset"] map_header_offset = offset + ((map_id - 1) * map_header_byte_size) From bcf9eadadfba10e0904eb5c09190b338d5af7c9f Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 18 Mar 2013 00:40:27 -0400 Subject: [PATCH 007/112] Parse and dump tilesets Metatiles (blocks), palette maps, collision, tile animations --- main.asm | 1616 ++++++++++++++++++++++++++++++++--- tilesets/00_collision.bin | Bin 0 -> 256 bytes tilesets/00_metatiles.bin | Bin 0 -> 1024 bytes tilesets/00_palette_map.bin | Bin 0 -> 112 bytes tilesets/01_collision.bin | Bin 0 -> 512 bytes tilesets/01_metatiles.bin | Bin 0 -> 2048 bytes tilesets/01_palette_map.bin | Bin 0 -> 112 bytes tilesets/02_collision.bin | Bin 0 -> 512 bytes tilesets/02_metatiles.bin | Bin 0 -> 2048 bytes tilesets/02_palette_map.bin | Bin 0 -> 112 bytes tilesets/03_collision.bin | Bin 0 -> 512 bytes tilesets/03_metatiles.bin | Bin 0 -> 2048 bytes tilesets/03_palette_map.bin | Bin 0 -> 112 bytes tilesets/04_collision.bin | Bin 0 -> 512 bytes tilesets/04_metatiles.bin | Bin 0 -> 2048 bytes tilesets/04_palette_map.bin | Bin 0 -> 112 bytes tilesets/05_collision.bin | Bin 0 -> 256 bytes tilesets/05_metatiles.bin | Bin 0 -> 1024 bytes tilesets/05_palette_map.bin | Bin 0 -> 112 bytes tilesets/06_collision.bin | Bin 0 -> 256 bytes tilesets/06_metatiles.bin | Bin 0 -> 1024 bytes tilesets/06_palette_map.bin | Bin 0 -> 112 bytes tilesets/07_collision.bin | Bin 0 -> 256 bytes tilesets/07_metatiles.bin | Bin 0 -> 1024 bytes tilesets/07_palette_map.bin | Bin 0 -> 112 bytes tilesets/08_collision.bin | Bin 0 -> 256 bytes tilesets/08_metatiles.bin | Bin 0 -> 1024 bytes tilesets/08_palette_map.bin | Bin 0 -> 112 bytes tilesets/09_collision.bin | Bin 0 -> 256 bytes tilesets/09_metatiles.bin | 65 ++ tilesets/09_palette_map.bin | Bin 0 -> 112 bytes tilesets/10_collision.bin | Bin 0 -> 256 bytes tilesets/10_metatiles.bin | Bin 0 -> 1024 bytes tilesets/10_palette_map.bin | Bin 0 -> 112 bytes tilesets/11_collision.bin | Bin 0 -> 256 bytes tilesets/11_metatiles.bin | 8 + tilesets/11_palette_map.bin | Bin 0 -> 112 bytes tilesets/12_collision.bin | Bin 0 -> 256 bytes tilesets/12_metatiles.bin | 3 + tilesets/12_palette_map.bin | Bin 0 -> 112 bytes tilesets/13_collision.bin | Bin 0 -> 256 bytes tilesets/13_metatiles.bin | 5 + tilesets/13_palette_map.bin | Bin 0 -> 112 bytes tilesets/14_collision.bin | Bin 0 -> 256 bytes tilesets/14_metatiles.bin | Bin 0 -> 1024 bytes tilesets/14_palette_map.bin | Bin 0 -> 112 bytes tilesets/15_collision.bin | Bin 0 -> 256 bytes tilesets/15_metatiles.bin | Bin 0 -> 1024 bytes tilesets/15_palette_map.bin | Bin 0 -> 112 bytes tilesets/16_collision.bin | Bin 0 -> 256 bytes tilesets/16_metatiles.bin | Bin 0 -> 1024 bytes tilesets/16_palette_map.bin | Bin 0 -> 112 bytes tilesets/17_collision.bin | Bin 0 -> 256 bytes tilesets/17_metatiles.bin | Bin 0 -> 1024 bytes tilesets/17_palette_map.bin | Bin 0 -> 112 bytes tilesets/18_collision.bin | Bin 0 -> 256 bytes tilesets/18_metatiles.bin | 15 + tilesets/18_palette_map.bin | Bin 0 -> 112 bytes tilesets/19_collision.bin | Bin 0 -> 256 bytes tilesets/19_metatiles.bin | Bin 0 -> 1024 bytes tilesets/19_palette_map.bin | Bin 0 -> 112 bytes tilesets/20_collision.bin | Bin 0 -> 256 bytes tilesets/20_metatiles.bin | Bin 0 -> 1024 bytes tilesets/20_palette_map.bin | Bin 0 -> 112 bytes tilesets/21_collision.bin | Bin 0 -> 256 bytes tilesets/21_metatiles.bin | 2 + tilesets/21_palette_map.bin | Bin 0 -> 112 bytes tilesets/22_collision.bin | Bin 0 -> 256 bytes tilesets/22_metatiles.bin | Bin 0 -> 1024 bytes tilesets/22_palette_map.bin | Bin 0 -> 112 bytes tilesets/23_collision.bin | Bin 0 -> 256 bytes tilesets/23_metatiles.bin | 2 + tilesets/23_palette_map.bin | Bin 0 -> 112 bytes tilesets/24_collision.bin | Bin 0 -> 256 bytes tilesets/24_metatiles.bin | 6 + tilesets/24_palette_map.bin | Bin 0 -> 112 bytes tilesets/25_collision.bin | Bin 0 -> 256 bytes tilesets/25_metatiles.bin | Bin 0 -> 1024 bytes tilesets/25_palette_map.bin | Bin 0 -> 112 bytes tilesets/26_collision.bin | Bin 0 -> 256 bytes tilesets/26_metatiles.bin | Bin 0 -> 1024 bytes tilesets/26_palette_map.bin | Bin 0 -> 112 bytes tilesets/27_collision.bin | Bin 0 -> 256 bytes tilesets/27_metatiles.bin | Bin 0 -> 1024 bytes tilesets/27_palette_map.bin | Bin 0 -> 112 bytes tilesets/28_collision.bin | Bin 0 -> 256 bytes tilesets/28_metatiles.bin | 2 + tilesets/28_palette_map.bin | Bin 0 -> 112 bytes tilesets/29_collision.bin | Bin 0 -> 256 bytes tilesets/29_metatiles.bin | 3 + tilesets/29_palette_map.bin | Bin 0 -> 112 bytes tilesets/30_collision.bin | Bin 0 -> 256 bytes tilesets/30_metatiles.bin | 6 + tilesets/30_palette_map.bin | Bin 0 -> 112 bytes tilesets/31_collision.bin | Bin 0 -> 256 bytes tilesets/31_metatiles.bin | 1 + tilesets/31_palette_map.bin | 1 + tilesets/32_collision.bin | Bin 0 -> 256 bytes tilesets/32_metatiles.bin | 17 + tilesets/32_palette_map.bin | Bin 0 -> 112 bytes tilesets/33_collision.bin | Bin 0 -> 256 bytes tilesets/33_metatiles.bin | 17 + tilesets/33_palette_map.bin | Bin 0 -> 112 bytes tilesets/34_collision.bin | Bin 0 -> 256 bytes tilesets/34_metatiles.bin | 17 + tilesets/34_palette_map.bin | Bin 0 -> 112 bytes tilesets/35_collision.bin | Bin 0 -> 256 bytes tilesets/35_metatiles.bin | 17 + tilesets/35_palette_map.bin | Bin 0 -> 112 bytes tilesets/36_collision.bin | Bin 0 -> 256 bytes tilesets/36_metatiles.bin | 17 + tilesets/36_palette_map.bin | Bin 0 -> 112 bytes tilesets/dark.pal | Bin 0 -> 64 bytes tilesets/day.pal | Bin 0 -> 64 bytes tilesets/morn.pal | Bin 0 -> 64 bytes tilesets/nite.pal | Bin 0 -> 64 bytes 116 files changed, 1717 insertions(+), 103 deletions(-) create mode 100644 tilesets/00_collision.bin create mode 100644 tilesets/00_metatiles.bin create mode 100644 tilesets/00_palette_map.bin create mode 100644 tilesets/01_collision.bin create mode 100644 tilesets/01_metatiles.bin create mode 100644 tilesets/01_palette_map.bin create mode 100644 tilesets/02_collision.bin create mode 100644 tilesets/02_metatiles.bin create mode 100644 tilesets/02_palette_map.bin create mode 100644 tilesets/03_collision.bin create mode 100644 tilesets/03_metatiles.bin create mode 100644 tilesets/03_palette_map.bin create mode 100644 tilesets/04_collision.bin create mode 100644 tilesets/04_metatiles.bin create mode 100644 tilesets/04_palette_map.bin create mode 100644 tilesets/05_collision.bin create mode 100644 tilesets/05_metatiles.bin create mode 100644 tilesets/05_palette_map.bin create mode 100644 tilesets/06_collision.bin create mode 100644 tilesets/06_metatiles.bin create mode 100644 tilesets/06_palette_map.bin create mode 100644 tilesets/07_collision.bin create mode 100644 tilesets/07_metatiles.bin create mode 100644 tilesets/07_palette_map.bin create mode 100644 tilesets/08_collision.bin create mode 100644 tilesets/08_metatiles.bin create mode 100644 tilesets/08_palette_map.bin create mode 100644 tilesets/09_collision.bin create mode 100644 tilesets/09_metatiles.bin create mode 100644 tilesets/09_palette_map.bin create mode 100644 tilesets/10_collision.bin create mode 100644 tilesets/10_metatiles.bin create mode 100644 tilesets/10_palette_map.bin create mode 100644 tilesets/11_collision.bin create mode 100644 tilesets/11_metatiles.bin create mode 100644 tilesets/11_palette_map.bin create mode 100644 tilesets/12_collision.bin create mode 100644 tilesets/12_metatiles.bin create mode 100644 tilesets/12_palette_map.bin create mode 100644 tilesets/13_collision.bin create mode 100644 tilesets/13_metatiles.bin create mode 100644 tilesets/13_palette_map.bin create mode 100644 tilesets/14_collision.bin create mode 100644 tilesets/14_metatiles.bin create mode 100644 tilesets/14_palette_map.bin create mode 100644 tilesets/15_collision.bin create mode 100644 tilesets/15_metatiles.bin create mode 100644 tilesets/15_palette_map.bin create mode 100644 tilesets/16_collision.bin create mode 100644 tilesets/16_metatiles.bin create mode 100644 tilesets/16_palette_map.bin create mode 100644 tilesets/17_collision.bin create mode 100644 tilesets/17_metatiles.bin create mode 100644 tilesets/17_palette_map.bin create mode 100644 tilesets/18_collision.bin create mode 100644 tilesets/18_metatiles.bin create mode 100644 tilesets/18_palette_map.bin create mode 100644 tilesets/19_collision.bin create mode 100644 tilesets/19_metatiles.bin create mode 100644 tilesets/19_palette_map.bin create mode 100644 tilesets/20_collision.bin create mode 100644 tilesets/20_metatiles.bin create mode 100644 tilesets/20_palette_map.bin create mode 100644 tilesets/21_collision.bin create mode 100644 tilesets/21_metatiles.bin create mode 100644 tilesets/21_palette_map.bin create mode 100644 tilesets/22_collision.bin create mode 100644 tilesets/22_metatiles.bin create mode 100644 tilesets/22_palette_map.bin create mode 100644 tilesets/23_collision.bin create mode 100644 tilesets/23_metatiles.bin create mode 100644 tilesets/23_palette_map.bin create mode 100644 tilesets/24_collision.bin create mode 100644 tilesets/24_metatiles.bin create mode 100644 tilesets/24_palette_map.bin create mode 100644 tilesets/25_collision.bin create mode 100644 tilesets/25_metatiles.bin create mode 100644 tilesets/25_palette_map.bin create mode 100644 tilesets/26_collision.bin create mode 100644 tilesets/26_metatiles.bin create mode 100644 tilesets/26_palette_map.bin create mode 100644 tilesets/27_collision.bin create mode 100644 tilesets/27_metatiles.bin create mode 100644 tilesets/27_palette_map.bin create mode 100644 tilesets/28_collision.bin create mode 100644 tilesets/28_metatiles.bin create mode 100644 tilesets/28_palette_map.bin create mode 100644 tilesets/29_collision.bin create mode 100644 tilesets/29_metatiles.bin create mode 100644 tilesets/29_palette_map.bin create mode 100644 tilesets/30_collision.bin create mode 100644 tilesets/30_metatiles.bin create mode 100644 tilesets/30_palette_map.bin create mode 100644 tilesets/31_collision.bin create mode 100644 tilesets/31_metatiles.bin create mode 100644 tilesets/31_palette_map.bin create mode 100644 tilesets/32_collision.bin create mode 100644 tilesets/32_metatiles.bin create mode 100644 tilesets/32_palette_map.bin create mode 100644 tilesets/33_collision.bin create mode 100644 tilesets/33_metatiles.bin create mode 100644 tilesets/33_palette_map.bin create mode 100644 tilesets/34_collision.bin create mode 100644 tilesets/34_metatiles.bin create mode 100644 tilesets/34_palette_map.bin create mode 100644 tilesets/35_collision.bin create mode 100644 tilesets/35_metatiles.bin create mode 100644 tilesets/35_palette_map.bin create mode 100644 tilesets/36_collision.bin create mode 100644 tilesets/36_metatiles.bin create mode 100644 tilesets/36_palette_map.bin create mode 100644 tilesets/dark.pal create mode 100644 tilesets/day.pal create mode 100644 tilesets/morn.pal create mode 100644 tilesets/nite.pal diff --git a/main.asm b/main.asm index 0b99b9c22..e7204e98a 100644 --- a/main.asm +++ b/main.asm @@ -4054,7 +4054,25 @@ INCBIN "baserom.gbc",$b0ae,$b0d2 - $b0ae TrainerPalettes: INCLUDE "gfx/trainers/palette_pointers.asm" -INCBIN "baserom.gbc",$b1de,$b825 - $b1de +INCBIN "baserom.gbc",$b1de,$b319 - $b1de + +MornPal: ; 0xb319 +INCBIN "tilesets/morn.pal" +; 0xb359 + +DayPal: ; 0xb359 +INCBIN "tilesets/day.pal" +; 0xb399 + +NitePal: ; 0xb399 +INCBIN "tilesets/nite.pal" +; 0xb3d9 + +DarkPal: ; 0xb3d9 +INCBIN "tilesets/dark.pal" +; 0xb419 + +INCBIN "baserom.gbc",$b419,$b825 - $b419 SECTION "bank3",DATA,BANK[$3] @@ -4950,65 +4968,180 @@ INCBIN "baserom.gbc",$1531f,$174ba - $1531f SECTION "bank6",DATA,BANK[$6] -Tileset03GFX: ; 18000 +Tileset03GFX: ; 0x18000 INCBIN "gfx/tilesets/03.lz" -; 18605 +; 0x18605 -INCBIN "baserom.gbc", $18605, $19006 - $18605 + db $00 -Tileset00GFX: -Tileset01GFX: ; 19006 +Tileset03Meta: ; 0x18606 +INCBIN "tilesets/03_metatiles.bin" +; 0x18e06 + +Tileset03Coll: ; 0x18e06 +INCBIN "tilesets/03_collision.bin" +; 0x19006 + +Tileset00GFX: ; 0x19006 +Tileset01GFX: ; 0x19006 INCBIN "gfx/tilesets/01.lz" -; 19c0d +; 0x19c0d -INCBIN "baserom.gbc", $19c0d, $1a60e - $19c0d + db $00 -Tileset29GFX: ; 1a60e +Tileset00Meta: ; 0x19c0e +Tileset01Meta: ; 0x19c0e +INCBIN "tilesets/01_metatiles.bin" +; 0x1a40e + +Tileset00Coll: ; 0x1a40e +Tileset01Coll: ; 0x1a40e +INCBIN "tilesets/01_collision.bin" +; 0x1a60e + +Tileset29GFX: ; 0x1a60e INCBIN "gfx/tilesets/29.lz" -; 1af38 +; 0x1af38 -INCBIN "baserom.gbc", $1af38, $1b43e - $1af38 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset20GFX: ; 1b43e +Tileset29Meta: ; 0x1af3e +INCBIN "tilesets/29_metatiles.bin" +; 0x1b33e + +Tileset29Coll: ; 0x1b33e +INCBIN "tilesets/29_collision.bin" +; 0x1b43e + +Tileset20GFX: ; 0x1b43e INCBIN "gfx/tilesets/20.lz" -; 1b8f1 +; 0x1b8f1 -INCBIN "baserom.gbc", $1b8f1, $1bdfe - $1b8f1 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + +Tileset20Meta: ; 0x1b8fe +INCBIN "tilesets/20_metatiles.bin" +; 0x1bcfe + +Tileset20Coll: ; 0x1bcfe +INCBIN "tilesets/20_collision.bin" +; 0x1bdfe SECTION "bank7",DATA,BANK[$7] INCBIN "baserom.gbc", $1c000, $1c30c - $1c000 -Tileset07GFX: ; 1c30c +Tileset07GFX: ; 0x1c30c INCBIN "gfx/tilesets/07.lz" -; 1c73b +; 0x1c73b -INCBIN "baserom.gbc", $1c73b, $1cc3c - $1c73b + db $00 -Tileset09GFX: ; 1cc3c +Tileset07Meta: ; 0x1c73c +INCBIN "tilesets/07_metatiles.bin" +; 0x1cb3c + +Tileset07Coll: ; 0x1cb3c +INCBIN "tilesets/07_collision.bin" +; 0x1cc3c + +Tileset09GFX: ; 0x1cc3c INCBIN "gfx/tilesets/09.lz" -; 1d047 +; 0x1d047 -INCBIN "baserom.gbc", $1d047, $1d54c - $1d047 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset06GFX: ; 1d54c +Tileset09Meta: ; 0x1d04c +INCBIN "tilesets/09_metatiles.bin" +; 0x1d44c + +Tileset09Coll: ; 0x1d44c +INCBIN "tilesets/09_collision.bin" +; 0x1d54c + +Tileset06GFX: ; 0x1d54c INCBIN "gfx/tilesets/06.lz" -; 1d924 +; 0x1d924 -INCBIN "baserom.gbc", $1d924, $1de2c - $1d924 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset13GFX: ; 1de2c +Tileset06Meta: ; 0x1d92c +INCBIN "tilesets/06_metatiles.bin" +; 0x1dd2c + +Tileset06Coll: ; 0x1dd2c +INCBIN "tilesets/06_collision.bin" +; 0x1de2c + +Tileset13GFX: ; 0x1de2c INCBIN "gfx/tilesets/13.lz" -; 1e58c +; 0x1e58c -INCBIN "baserom.gbc", $1e58c, $1ea8c - $1e58c +Tileset13Meta: ; 0x1e58c +INCBIN "tilesets/13_metatiles.bin" +; 0x1e98c -Tileset24GFX: ; 1ea8c +Tileset13Coll: ; 0x1e98c +INCBIN "tilesets/13_collision.bin" +; 0x1ea8c + +Tileset24GFX: ; 0x1ea8c INCBIN "gfx/tilesets/24.lz" -; 1ee0e +; 0x1ee0e -INCBIN "baserom.gbc", $1ee0e, $1f31c - $1ee0e + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + +Tileset24Meta: ; 0x1ee1c +Tileset30Meta: ; 0x1ee1c +INCBIN "tilesets/30_metatiles.bin" +; 0x1f21c + +Tileset24Coll: ; 0x1f21c +Tileset30Coll: ; 0x1f21c +INCBIN "tilesets/30_collision.bin" +; 0x1f31c ; Songs i @@ -5021,35 +5154,116 @@ SECTION "bank8",DATA,BANK[$8] INCBIN "baserom.gbc", $20000, $20181 - $20000 -Tileset23GFX: ; 20181 +Tileset23GFX: ; 0x20181 INCBIN "gfx/tilesets/23.lz" -; 206d2 +; 0x206d2 -INCBIN "baserom.gbc", $206d2, $20be1 - $206d2 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset10GFX: ; 20be1 +Tileset23Meta: ; 0x206e1 +INCBIN "tilesets/23_metatiles.bin" +; 0x20ae1 + +Tileset23Coll: ; 0x20ae1 +INCBIN "tilesets/23_collision.bin" +; 0x20be1 + +Tileset10GFX: ; 0x20be1 INCBIN "gfx/tilesets/10.lz" -; 213e0 +; 0x213e0 -INCBIN "baserom.gbc", $213e0, $218e1 - $213e0 + db $00 -Tileset12GFX: ; 218e1 +Tileset10Meta: ; 0x213e1 +INCBIN "tilesets/10_metatiles.bin" +; 0x217e1 + +Tileset10Coll: ; 0x217e1 +INCBIN "tilesets/10_collision.bin" +; 0x218e1 + +Tileset12GFX: ; 0x218e1 INCBIN "gfx/tilesets/12.lz" -; 22026 +; 0x22026 -INCBIN "baserom.gbc", $22026, $22531 - $22026 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset14GFX: ; 22531 +Tileset12Meta: ; 0x22031 +INCBIN "tilesets/12_metatiles.bin" +; 0x22431 + +Tileset12Coll: ; 0x22431 +INCBIN "tilesets/12_collision.bin" +; 0x22531 + +Tileset14GFX: ; 0x22531 INCBIN "gfx/tilesets/14.lz" -; 22ae2 +; 0x22ae2 -INCBIN "baserom.gbc", $22ae2, $22ff1 - $22ae2 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset17GFX: ; 22ff1 +Tileset14Meta: ; 0x22af1 +INCBIN "tilesets/14_metatiles.bin" +; 0x22ef1 + +Tileset14Coll: ; 0x22ef1 +INCBIN "tilesets/14_collision.bin" +; 0x22ff1 + +Tileset17GFX: ; 0x22ff1 INCBIN "gfx/tilesets/17.lz" -; 23391 +; 0x23391 -INCBIN "baserom.gbc",$23391,$23b11 - $23391 +Tileset17Meta: ; 0x23391 +INCBIN "tilesets/17_metatiles.bin" +; 0x23791 + +Tileset17Coll: ; 0x23791 +INCBIN "tilesets/17_collision.bin" +; 0x23891 + +; todo +Tileset31Meta: ; 0x23891 +INCBIN "tilesets/31_metatiles.bin", $0, $280 +; 0x23b11 EggMovePointers: ; 0x23b11 INCLUDE "stats/egg_move_pointers.asm" @@ -5402,33 +5616,92 @@ INCBIN "baserom.gbc",$2ef18,$2ef9f - $2ef18 SECTION "bankC",DATA,BANK[$C] -Tileset15GFX: ; 30000 +Tileset15GFX: ; 0x30000 INCBIN "gfx/tilesets/15.lz" -; 304d7 +; 0x304d7 -INCBIN "baserom.gbc", $304d7, $309e0 - $304d7 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset25GFX: ; 309e0 +Tileset15Meta: ; 0x304e0 +INCBIN "tilesets/15_metatiles.bin" +; 0x308e0 + +Tileset15Coll: ; 0x308e0 +INCBIN "tilesets/15_collision.bin" +; 0x309e0 + +Tileset25GFX: ; 0x309e0 INCBIN "gfx/tilesets/25.lz" -; 30e78 +; 0x30e78 -INCBIN "baserom.gbc", $30e78, $31380 - $30e78 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset27GFX: ; 31380 +Tileset25Meta: ; 0x30e80 +INCBIN "tilesets/25_metatiles.bin" +; 0x31280 + +Tileset25Coll: ; 0x31280 +INCBIN "tilesets/25_collision.bin" +; 0x31380 + +Tileset27GFX: ; 0x31380 INCBIN "gfx/tilesets/27.lz" -; 318dc +; 0x318dc -INCBIN "baserom.gbc", $318dc, $31de0 - $318dc + db $00 + db $00 + db $00 + db $00 -Tileset28GFX: ; 31de0 +Tileset27Meta: ; 0x318e0 +INCBIN "tilesets/27_metatiles.bin" +; 0x31ce0 + +Tileset27Coll: ; 0x31ce0 +INCBIN "tilesets/27_collision.bin" +; 0x31de0 + +Tileset28GFX: ; 0x31de0 INCBIN "gfx/tilesets/28.lz" -; 321a6 +; 0x321a6 -INCBIN "baserom.gbc", $321a6, $326b0 - $321a6 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset30GFX: ; 326b0 +Tileset28Meta: ; 0x321b0 +INCBIN "tilesets/28_metatiles.bin" +; 0x325b0 + +Tileset28Coll: ; 0x325b0 +INCBIN "tilesets/28_collision.bin" +; 0x326b0 + +Tileset30GFX: ; 0x326b0 INCBIN "gfx/tilesets/30.lz" -; 329ed +; 0x329ed INCBIN "baserom.gbc",$329ed,$333f0 - $329ed @@ -6737,7 +7010,138 @@ INCBIN "baserom.gbc",$4a843,$4ae78 - $4a843 SECTION "bank13",DATA,BANK[$13] -INCBIN "baserom.gbc",$4C000,$4ce1f - $4C000 +INCBIN "baserom.gbc", $4c000, $4c075 - $4c000 + +Tileset03PalMap: ; 0x4c075 +INCBIN "tilesets/03_palette_map.bin" +; 0x4c0e5 + +Tileset00PalMap: ; 0x4c0e5 +Tileset01PalMap: ; 0x4c0e5 +INCBIN "tilesets/01_palette_map.bin" +; 0x4c155 + +Tileset02PalMap: ; 0x4c155 +INCBIN "tilesets/02_palette_map.bin" +; 0x4c1c5 + +Tileset05PalMap: ; 0x4c1c5 +INCBIN "tilesets/05_palette_map.bin" +; 0x4c235 + +Tileset06PalMap: ; 0x4c235 +INCBIN "tilesets/06_palette_map.bin" +; 0x4c2a5 + +Tileset07PalMap: ; 0x4c2a5 +INCBIN "tilesets/07_palette_map.bin" +; 0x4c315 + +Tileset08PalMap: ; 0x4c315 +INCBIN "tilesets/08_palette_map.bin" +; 0x4c385 + +Tileset09PalMap: ; 0x4c385 +INCBIN "tilesets/09_palette_map.bin" +; 0x4c3f5 + +Tileset10PalMap: ; 0x4c3f5 +INCBIN "tilesets/10_palette_map.bin" +; 0x4c465 + +Tileset11PalMap: ; 0x4c465 +INCBIN "tilesets/11_palette_map.bin" +; 0x4c4d5 + +Tileset12PalMap: ; 0x4c4d5 +INCBIN "tilesets/12_palette_map.bin" +; 0x4c545 + +Tileset13PalMap: ; 0x4c545 +INCBIN "tilesets/13_palette_map.bin" +; 0x4c5b5 + +Tileset14PalMap: ; 0x4c5b5 +INCBIN "tilesets/14_palette_map.bin" +; 0x4c625 + +Tileset15PalMap: ; 0x4c625 +INCBIN "tilesets/15_palette_map.bin" +; 0x4c695 + +Tileset16PalMap: ; 0x4c695 +INCBIN "tilesets/16_palette_map.bin" +; 0x4c705 + +Tileset23PalMap: ; 0x4c705 +INCBIN "tilesets/23_palette_map.bin" +; 0x4c775 + +Tileset24PalMap: ; 0x4c775 +Tileset30PalMap: ; 0x4c775 +INCBIN "tilesets/30_palette_map.bin" +; 0x4c7e5 + +Tileset25PalMap: ; 0x4c7e5 +INCBIN "tilesets/25_palette_map.bin" +; 0x4c855 + +Tileset26PalMap: ; 0x4c855 +Tileset32PalMap: ; 0x4c855 +Tileset33PalMap: ; 0x4c855 +Tileset34PalMap: ; 0x4c855 +Tileset35PalMap: ; 0x4c855 +Tileset36PalMap: ; 0x4c855 +INCBIN "tilesets/36_palette_map.bin" +; 0x4c8c5 + +Tileset27PalMap: ; 0x4c8c5 +INCBIN "tilesets/27_palette_map.bin" +; 0x4c935 + +Tileset17PalMap: ; 0x4c935 +INCBIN "tilesets/17_palette_map.bin" +; 0x4c9a5 + +Tileset28PalMap: ; 0x4c9a5 +INCBIN "tilesets/28_palette_map.bin" +; 0x4ca15 + +Tileset18PalMap: ; 0x4ca15 +INCBIN "tilesets/18_palette_map.bin" +; 0x4ca85 + +Tileset19PalMap: ; 0x4ca85 +INCBIN "tilesets/19_palette_map.bin" +; 0x4caf5 + +Tileset20PalMap: ; 0x4caf5 +INCBIN "tilesets/20_palette_map.bin" +; 0x4cb65 + +INCBIN "baserom.gbc",$4cb65,$4cbd5-$4cb65 + +Tileset29PalMap: ; 0x4cbd5 +INCBIN "tilesets/29_palette_map.bin" +; 0x4cc45 + +Tileset31PalMap: ; 0x4cc45 +INCBIN "tilesets/31_palette_map.bin" +; 0x4ccb5 + +Tileset21PalMap: ; 0x4ccb5 +INCBIN "tilesets/21_palette_map.bin" +; 0x4cd25 + +Tileset22PalMap: ; 0x4cd25 +INCBIN "tilesets/22_palette_map.bin" +; 0x4cd95 + +Tileset04PalMap: ; 0x4cd95 +INCBIN "tilesets/04_palette_map.bin" +; 0x4ce05 + +INCBIN "baserom.gbc", $4ce05, $4ce1f - $4ce05 TileTypeTable: ; 4ce1f ; 256 tiletypes @@ -6779,7 +7183,309 @@ TileTypeTable: ; 4ce1f db $00, $00, $00, $00, $00, $00, $00, $0f ; 4cf1f -INCBIN "baserom.gbc",$4cf1f,$4d860 - $4cf1f +INCBIN "baserom.gbc", $4cf1f, $4d596 - $4cf1f + +Tilesets: + +Tileset00: ; 0x4d596 + dbw BANK(Tileset00GFX), Tileset00GFX + dbw BANK(Tileset00Meta), Tileset00Meta + dbw BANK(Tileset00Coll), Tileset00Coll + dw Tileset00Anim + dw $0000 + dw Tileset00PalMap + +Tileset01: ; 0x4d5a5 + dbw BANK(Tileset01GFX), Tileset01GFX + dbw BANK(Tileset01Meta), Tileset01Meta + dbw BANK(Tileset01Coll), Tileset01Coll + dw Tileset01Anim + dw $0000 + dw Tileset01PalMap + +Tileset02: ; 0x4d5b4 + dbw BANK(Tileset02GFX), Tileset02GFX + dbw BANK(Tileset02Meta), Tileset02Meta + dbw BANK(Tileset02Coll), Tileset02Coll + dw Tileset02Anim + dw $0000 + dw Tileset02PalMap + +Tileset03: ; 0x4d5c3 + dbw BANK(Tileset03GFX), Tileset03GFX + dbw BANK(Tileset03Meta), Tileset03Meta + dbw BANK(Tileset03Coll), Tileset03Coll + dw Tileset03Anim + dw $0000 + dw Tileset03PalMap + +Tileset04: ; 0x4d5d2 + dbw BANK(Tileset04GFX), Tileset04GFX + dbw BANK(Tileset04Meta), Tileset04Meta + dbw BANK(Tileset04Coll), Tileset04Coll + dw Tileset04Anim + dw $0000 + dw Tileset04PalMap + +Tileset05: ; 0x4d5e1 + dbw BANK(Tileset05GFX), Tileset05GFX + dbw BANK(Tileset05Meta), Tileset05Meta + dbw BANK(Tileset05Coll), Tileset05Coll + dw Tileset05Anim + dw $0000 + dw Tileset05PalMap + +Tileset06: ; 0x4d5f0 + dbw BANK(Tileset06GFX), Tileset06GFX + dbw BANK(Tileset06Meta), Tileset06Meta + dbw BANK(Tileset06Coll), Tileset06Coll + dw Tileset06Anim + dw $0000 + dw Tileset06PalMap + +Tileset07: ; 0x4d5ff + dbw BANK(Tileset07GFX), Tileset07GFX + dbw BANK(Tileset07Meta), Tileset07Meta + dbw BANK(Tileset07Coll), Tileset07Coll + dw Tileset07Anim + dw $0000 + dw Tileset07PalMap + +Tileset08: ; 0x4d60e + dbw BANK(Tileset08GFX), Tileset08GFX + dbw BANK(Tileset08Meta), Tileset08Meta + dbw BANK(Tileset08Coll), Tileset08Coll + dw Tileset08Anim + dw $0000 + dw Tileset08PalMap + +Tileset09: ; 0x4d61d + dbw BANK(Tileset09GFX), Tileset09GFX + dbw BANK(Tileset09Meta), Tileset09Meta + dbw BANK(Tileset09Coll), Tileset09Coll + dw Tileset09Anim + dw $0000 + dw Tileset09PalMap + +Tileset10: ; 0x4d62c + dbw BANK(Tileset10GFX), Tileset10GFX + dbw BANK(Tileset10Meta), Tileset10Meta + dbw BANK(Tileset10Coll), Tileset10Coll + dw Tileset10Anim + dw $0000 + dw Tileset10PalMap + +Tileset11: ; 0x4d63b + dbw BANK(Tileset11GFX), Tileset11GFX + dbw BANK(Tileset11Meta), Tileset11Meta + dbw BANK(Tileset11Coll), Tileset11Coll + dw Tileset11Anim + dw $0000 + dw Tileset11PalMap + +Tileset12: ; 0x4d64a + dbw BANK(Tileset12GFX), Tileset12GFX + dbw BANK(Tileset12Meta), Tileset12Meta + dbw BANK(Tileset12Coll), Tileset12Coll + dw Tileset12Anim + dw $0000 + dw Tileset12PalMap + +Tileset13: ; 0x4d659 + dbw BANK(Tileset13GFX), Tileset13GFX + dbw BANK(Tileset13Meta), Tileset13Meta + dbw BANK(Tileset13Coll), Tileset13Coll + dw Tileset13Anim + dw $0000 + dw Tileset13PalMap + +Tileset14: ; 0x4d668 + dbw BANK(Tileset14GFX), Tileset14GFX + dbw BANK(Tileset14Meta), Tileset14Meta + dbw BANK(Tileset14Coll), Tileset14Coll + dw Tileset14Anim + dw $0000 + dw Tileset14PalMap + +Tileset15: ; 0x4d677 + dbw BANK(Tileset15GFX), Tileset15GFX + dbw BANK(Tileset15Meta), Tileset15Meta + dbw BANK(Tileset15Coll), Tileset15Coll + dw Tileset15Anim + dw $0000 + dw Tileset15PalMap + +Tileset16: ; 0x4d686 + dbw BANK(Tileset16GFX), Tileset16GFX + dbw BANK(Tileset16Meta), Tileset16Meta + dbw BANK(Tileset16Coll), Tileset16Coll + dw Tileset16Anim + dw $0000 + dw Tileset16PalMap + +Tileset17: ; 0x4d695 + dbw BANK(Tileset17GFX), Tileset17GFX + dbw BANK(Tileset17Meta), Tileset17Meta + dbw BANK(Tileset17Coll), Tileset17Coll + dw Tileset17Anim + dw $0000 + dw Tileset17PalMap + +Tileset18: ; 0x4d6a4 + dbw BANK(Tileset18GFX), Tileset18GFX + dbw BANK(Tileset18Meta), Tileset18Meta + dbw BANK(Tileset18Coll), Tileset18Coll + dw Tileset18Anim + dw $0000 + dw Tileset18PalMap + +Tileset19: ; 0x4d6b3 + dbw BANK(Tileset19GFX), Tileset19GFX + dbw BANK(Tileset19Meta), Tileset19Meta + dbw BANK(Tileset19Coll), Tileset19Coll + dw Tileset19Anim + dw $0000 + dw Tileset19PalMap + +Tileset20: ; 0x4d6c2 + dbw BANK(Tileset20GFX), Tileset20GFX + dbw BANK(Tileset20Meta), Tileset20Meta + dbw BANK(Tileset20Coll), Tileset20Coll + dw Tileset20Anim + dw $0000 + dw Tileset20PalMap + +Tileset21: ; 0x4d6d1 + dbw BANK(Tileset21GFX), Tileset21GFX + dbw BANK(Tileset21Meta), Tileset21Meta + dbw BANK(Tileset21Coll), Tileset21Coll + dw Tileset21Anim + dw $0000 + dw Tileset21PalMap + +Tileset22: ; 0x4d6e0 + dbw BANK(Tileset22GFX), Tileset22GFX + dbw BANK(Tileset22Meta), Tileset22Meta + dbw BANK(Tileset22Coll), Tileset22Coll + dw Tileset22Anim + dw $0000 + dw Tileset22PalMap + +Tileset23: ; 0x4d6ef + dbw BANK(Tileset23GFX), Tileset23GFX + dbw BANK(Tileset23Meta), Tileset23Meta + dbw BANK(Tileset23Coll), Tileset23Coll + dw Tileset23Anim + dw $0000 + dw Tileset23PalMap + +Tileset24: ; 0x4d6fe + dbw BANK(Tileset24GFX), Tileset24GFX + dbw BANK(Tileset24Meta), Tileset24Meta + dbw BANK(Tileset24Coll), Tileset24Coll + dw Tileset24Anim + dw $0000 + dw Tileset24PalMap + +Tileset25: ; 0x4d70d + dbw BANK(Tileset25GFX), Tileset25GFX + dbw BANK(Tileset25Meta), Tileset25Meta + dbw BANK(Tileset25Coll), Tileset25Coll + dw Tileset25Anim + dw $0000 + dw Tileset25PalMap + +Tileset26: ; 0x4d71c + dbw BANK(Tileset26GFX), Tileset26GFX + dbw BANK(Tileset26Meta), Tileset26Meta + dbw BANK(Tileset26Coll), Tileset26Coll + dw Tileset26Anim + dw $0000 + dw Tileset26PalMap + +Tileset27: ; 0x4d72b + dbw BANK(Tileset27GFX), Tileset27GFX + dbw BANK(Tileset27Meta), Tileset27Meta + dbw BANK(Tileset27Coll), Tileset27Coll + dw Tileset27Anim + dw $0000 + dw Tileset27PalMap + +Tileset28: ; 0x4d73a + dbw BANK(Tileset28GFX), Tileset28GFX + dbw BANK(Tileset28Meta), Tileset28Meta + dbw BANK(Tileset28Coll), Tileset28Coll + dw Tileset28Anim + dw $0000 + dw Tileset28PalMap + +Tileset29: ; 0x4d749 + dbw BANK(Tileset29GFX), Tileset29GFX + dbw BANK(Tileset29Meta), Tileset29Meta + dbw BANK(Tileset29Coll), Tileset29Coll + dw Tileset29Anim + dw $0000 + dw Tileset29PalMap + +Tileset30: ; 0x4d758 + dbw BANK(Tileset30GFX), Tileset30GFX + dbw BANK(Tileset30Meta), Tileset30Meta + dbw BANK(Tileset30Coll), Tileset30Coll + dw Tileset30Anim + dw $0000 + dw Tileset30PalMap + +Tileset31: ; 0x4d767 + dbw BANK(Tileset31GFX), Tileset31GFX + dbw BANK(Tileset31Meta), Tileset31Meta + dbw BANK(Tileset31Coll), Tileset31Coll + dw Tileset31Anim + dw $0000 + dw Tileset31PalMap + +Tileset32: ; 0x4d776 + dbw BANK(Tileset32GFX), Tileset32GFX + dbw BANK(Tileset32Meta), Tileset32Meta + dbw BANK(Tileset32Coll), Tileset32Coll + dw Tileset32Anim + dw $0000 + dw Tileset32PalMap + +Tileset33: ; 0x4d785 + dbw BANK(Tileset33GFX), Tileset33GFX + dbw BANK(Tileset33Meta), Tileset33Meta + dbw BANK(Tileset33Coll), Tileset33Coll + dw Tileset33Anim + dw $0000 + dw Tileset33PalMap + +Tileset34: ; 0x4d794 + dbw BANK(Tileset34GFX), Tileset34GFX + dbw BANK(Tileset34Meta), Tileset34Meta + dbw BANK(Tileset34Coll), Tileset34Coll + dw Tileset34Anim + dw $0000 + dw Tileset34PalMap + +Tileset35: ; 0x4d7a3 + dbw BANK(Tileset35GFX), Tileset35GFX + dbw BANK(Tileset35Meta), Tileset35Meta + dbw BANK(Tileset35Coll), Tileset35Coll + dw Tileset35Anim + dw $0000 + dw Tileset35PalMap + +Tileset36: ; 0x4d7b2 + dbw BANK(Tileset36GFX), Tileset36GFX + dbw BANK(Tileset36Meta), Tileset36Meta + dbw BANK(Tileset36Coll), Tileset36Coll + dw Tileset36Anim + dw $0000 + dw Tileset36PalMap + +; 0x4d7c1 + +INCBIN "baserom.gbc", $4d7c1, $4d860 - $4d7c1 CheckPokerus: ; 4d860 ; Return carry if a monster in your party has Pokerus @@ -11704,36 +12410,119 @@ GoldenrodDeptStoreRoof_BlockData: ; 0xb1b22 SECTION "bank2D",DATA,BANK[$2D] -Tileset21GFX: ; b4000 +Tileset21GFX: ; 0xb4000 INCBIN "gfx/tilesets/21.lz" -; b4893 +; 0xb4893 -INCBIN "baserom.gbc", $b4893, $b4da0 - $b4893 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset22GFX: ; b4da0 +Tileset21Meta: ; 0xb48a0 +INCBIN "tilesets/21_metatiles.bin" +; 0xb4ca0 + +Tileset21Coll: ; 0xb4ca0 +INCBIN "tilesets/21_collision.bin" +; 0xb4da0 + +Tileset22GFX: ; 0xb4da0 INCBIN "gfx/tilesets/22.lz" -; b50d1 +; 0xb50d1 -INCBIN "baserom.gbc", $b50d1, $b55e0 - $b50d1 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset08GFX: ; b55e0 +Tileset22Meta: ; 0xb50e0 +INCBIN "tilesets/22_metatiles.bin" +; 0xb54e0 + +Tileset22Coll: ; 0xb54e0 +INCBIN "tilesets/22_collision.bin" +; 0xb55e0 + +Tileset08GFX: ; 0xb55e0 INCBIN "gfx/tilesets/08.lz" -; b59db +; 0xb59db -INCBIN "baserom.gbc", $b59db, $b5ee0 - $b59db + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset02GFX: -Tileset04GFX: ; b5ee0 +Tileset08Meta: ; 0xb59e0 +INCBIN "tilesets/08_metatiles.bin" +; 0xb5de0 + +Tileset08Coll: ; 0xb5de0 +INCBIN "tilesets/08_collision.bin" +; 0xb5ee0 + +Tileset02GFX: ; 0xb5ee0 +Tileset04GFX: ; 0xb5ee0 INCBIN "gfx/tilesets/04.lz" -; b6ae7 +; 0xb6ae7 -INCBIN "baserom.gbc", $b6ae7, $b74e8 - $b6ae7 + db $00 -Tileset16GFX: ; b74e8 +Tileset02Meta: ; 0xb6ae8 +INCBIN "tilesets/02_metatiles.bin" +; 0xb72e8 + +Tileset02Coll: ; 0xb72e8 +INCBIN "tilesets/02_collision.bin" +; 0xb74e8 + +Tileset16GFX: ; 0xb74e8 INCBIN "gfx/tilesets/16.lz" -; b799a +; 0xb799a -INCBIN "baserom.gbc", $b799a, $b7ea8 - $b799a + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + +Tileset16Meta: ; 0xb79a8 +INCBIN "tilesets/16_metatiles.bin" +; 0xb7da8 + +Tileset16Coll: ; 0xb7da8 +INCBIN "tilesets/16_collision.bin" +; 0xb7ea8 SECTION "bank2E",DATA,BANK[$2E] @@ -12505,35 +13294,116 @@ INCLUDE "gfx/pics/unown_frames.asm" SECTION "bank37",DATA,BANK[$37] -Tileset31GFX: ; dc000 +Tileset31GFX: ; 0xdc000 INCBIN "gfx/tilesets/31.lz" -; dc3ce +; 0xdc3ce -INCBIN "baserom.gbc", $dc3ce, $dc3d0 - $dc3ce + db $00 + db $00 -Tileset18GFX: ; dc3d0 +Tileset18GFX: ; 0xdc3d0 INCBIN "gfx/tilesets/18.lz" -; dcc4e +; 0xdcc4e -INCBIN "baserom.gbc", $dcc4e, $dd150 - $dcc4e + db $00 + db $00 -Tileset05GFX: ; dd150 +Tileset18Meta: ; 0xdcc50 +INCBIN "tilesets/18_metatiles.bin" +; 0xdd050 + +Tileset18Coll: ; 0xdd050 +INCBIN "tilesets/18_collision.bin" +; 0xdd150 + +Tileset05GFX: ; 0xdd150 INCBIN "gfx/tilesets/05.lz" -; dd5f8 +; 0xdd5f8 -INCBIN "baserom.gbc", $dd5f8, $ddb00 - $dd5f8 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset19GFX: ; ddb00 +Tileset05Meta: ; 0xdd600 +INCBIN "tilesets/05_metatiles.bin" +; 0xdda00 + +Tileset05Coll: ; 0xdda00 +INCBIN "tilesets/05_collision.bin" +; 0xddb00 + +Tileset19GFX: ; 0xddb00 INCBIN "gfx/tilesets/19.lz" -; ddf64 +; 0xddf64 -INCBIN "baserom.gbc", $ddf64, $de570 - $ddf64 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 -Tileset11GFX: ; de570 +Tileset19Meta: ; 0xddf70 +INCBIN "tilesets/19_metatiles.bin" +; 0xde370 + +Tileset19Coll: ; 0xde370 +INCBIN "tilesets/19_collision.bin" +; 0xde470 + +Tileset31Coll: ; 0xde470 +INCBIN "tilesets/31_collision.bin" +; 0xde570 + +Tileset11GFX: ; 0xde570 INCBIN "gfx/tilesets/11.lz" -; de98a +; 0xde98a -INCBIN "baserom.gbc", $de98a, $dfd14 - $de98a + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + +Tileset11Meta: ; 0xde990 +INCBIN "tilesets/11_metatiles.bin" +; 0xded90 + +Tileset11Coll: ; 0xded90 +INCBIN "tilesets/11_collision.bin" +; 0xdee90 + +Tileset04Meta: ; 0xdee90 +INCBIN "tilesets/04_metatiles.bin" +; 0xdf690 + +Tileset04Coll: ; 0xdf690 +INCBIN "tilesets/04_collision.bin" +; 0xdf890 + +Tileset32Meta: ; 0xdf890 +INCBIN "tilesets/32_metatiles.bin" +; 0xdfc90 + +Tileset32Coll: ; 0xdfc90 +Tileset33Coll: ; 0xdfc90 +Tileset34Coll: ; 0xdfc90 +Tileset35Coll: ; 0xdfc90 +Tileset36Coll: ; 0xdfc90 +INCBIN "tilesets/36_collision.bin" +; 0xdfd90 SECTION "bank38",DATA,BANK[$38] @@ -12869,9 +13739,525 @@ INCBIN "baserom.gbc",$fbccf,$fbe91 - $fbccf SECTION "bank3F",DATA,BANK[$3F] -DoTileAnimation: +DoTileAnimation: ; fc000 +; Iterate over a given pointer array of animation functions +; (one per frame). +; Typically in wra1, vra0 -INCBIN "baserom.gbc",$FC000,$fcdc2-$fc000 +; Beginning of animation pointer array + ld a, [TileSetAnim] + ld e, a + ld a, [TileSetAnim + 1] + ld d, a + +; Play this frame. + ld a, [$ffdf] ; frame count + ld l, a + inc a + ld [$ffdf], a + +; Each pointer has: + ld h, 0 + add hl, hl + add hl, hl + add hl, de + +; 2-byte parameter (all functions take input de) + ld e, [hl] + inc hl + ld d, [hl] + inc hl + +; Function address + ld a, [hli] + ld h, [hl] + ld l, a + + jp [hl] +; fc01b + +Tileset00Anim: ; 0xfc01b +Tileset02Anim: ; 0xfc01b +Tileset03Anim: ; 0xfc01b +; param, function + dw $9140, AnimateWaterTile + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, TileAnimationPalette + dw $0000, WaitTileAnimation + dw $0000, AnimateFlowerTile + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, NextTileFrame8 + dw $0000, DoneTileAnimation +; 0xfc047 + +Tileset25Anim: ; 0xfc047 +; param, function + dw $9140, AnimateWaterTile + dw $0000, WaitTileAnimation + dw $95f0, $4387 + dw $0000, WaitTileAnimation + dw $0000, TileAnimationPalette + dw $0000, WaitTileAnimation + dw $0000, AnimateFlowerTile + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, NextTileFrame8 + dw $0000, DoneTileAnimation +; 0xfc073 + +Tileset31Anim: ; 0xfc073 +; param, function + dw $0000, $445c + dw $0000, $44c4 + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, $44f2 + dw $0000, $451c + dw $0000, AnimateFlowerTile + dw $9140, AnimateWaterTile + dw $0000, TileAnimationPalette + dw $0000, NextTileFrame8 + dw $0000, DoneTileAnimation +; 0xfc0a3 + +Tileset01Anim: ; 0xfc0a3 +; param, function + dw $9140, AnimateWaterTile + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, TileAnimationPalette + dw $0000, WaitTileAnimation + dw $0000, AnimateFlowerTile + dw $4a98, AnimateWhirlpoolTile + dw $4a9c, AnimateWhirlpoolTile + dw $4aa0, AnimateWhirlpoolTile + dw $4aa4, AnimateWhirlpoolTile + dw $0000, WaitTileAnimation + dw $0000, NextTileFrame8 + dw $0000, DoneTileAnimation +; 0xfc0d7 + +INCBIN "baserom.gbc",$fc0d7,$fc12f-$fc0d7 + +Tileset09Anim: ; 0xfc12f +; param, function + dw $9140, AnimateWaterTile + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, TileAnimationPalette + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, NextTileFrame8 + dw $0000, DoneTileAnimation +; 0xfc15f + +Tileset15Anim: ; 0xfc15f +; param, function + dw $0000, $45eb + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, $45cc + dw $0000, WaitTileAnimation + dw $0000, NextTileFrame8 + dw $0000, DoneTileAnimation +; 0xfc17f + +INCBIN "baserom.gbc",$fc17f,$fc1e7-$fc17f + +Tileset24Anim: ; 0xfc1e7 +Tileset30Anim: ; 0xfc1e7 +; param, function + dw $9140, $46a2 + dw $0000, $471e + dw $cf41, $4309 + dw $0000, $471e + dw $9140, $4696 + dw $0000, $471e + dw $0000, TileAnimationPalette + dw $0000, $471e + dw $9400, $46a2 + dw $0000, $471e + dw $cf41, $436a + dw $0000, $471e + dw $cf41, $436a + dw $0000, $471e + dw $cf41, $436a + dw $0000, $471e + dw $9400, $4696 + dw $0000, $471e + dw $0000, DoneTileAnimation +; 0xfc233 + +Tileset29Anim: ; 0xfc233 +; param, function + dw $9350, $46a2 + dw $0000, $471e + dw $cf41, $4309 + dw $0000, $471e + dw $9350, $4696 + dw $0000, $471e + dw $0000, TileAnimationPalette + dw $0000, $471e + dw $9310, $46a2 + dw $0000, $471e + dw $cf41, $436a + dw $0000, $471e + dw $cf41, $436a + dw $0000, $471e + dw $cf41, $436a + dw $0000, $471e + dw $9310, $4696 + dw $0000, $471e + dw $0000, DoneTileAnimation +; 0xfc27f + +Tileset23Anim: ; 0xfc27f +; param, function + dw $4770, $4645 + dw $4774, $4645 + dw $4768, $4645 + dw $476c, $4645 + dw $4760, $4645 + dw $4764, $4645 + dw $4758, $4645 + dw $475c, $4645 + dw $4750, $4645 + dw $4754, $4645 + dw $0000, NextTileFrame + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, DoneTileAnimation +; 0xfc2bf + +INCBIN "baserom.gbc",$fc2bf,$fc2e7-$fc2bf + +Tileset04Anim: ; 0xfc2e7 +Tileset05Anim: ; 0xfc2e7 +Tileset06Anim: ; 0xfc2e7 +Tileset07Anim: ; 0xfc2e7 +Tileset08Anim: ; 0xfc2e7 +Tileset10Anim: ; 0xfc2e7 +Tileset11Anim: ; 0xfc2e7 +Tileset12Anim: ; 0xfc2e7 +Tileset13Anim: ; 0xfc2e7 +Tileset14Anim: ; 0xfc2e7 +Tileset16Anim: ; 0xfc2e7 +Tileset17Anim: ; 0xfc2e7 +Tileset18Anim: ; 0xfc2e7 +Tileset19Anim: ; 0xfc2e7 +Tileset20Anim: ; 0xfc2e7 +Tileset21Anim: ; 0xfc2e7 +Tileset22Anim: ; 0xfc2e7 +Tileset26Anim: ; 0xfc2e7 +Tileset27Anim: ; 0xfc2e7 +Tileset28Anim: ; 0xfc2e7 +Tileset32Anim: ; 0xfc2e7 +Tileset33Anim: ; 0xfc2e7 +Tileset34Anim: ; 0xfc2e7 +Tileset35Anim: ; 0xfc2e7 +Tileset36Anim: ; 0xfc2e7 +; param, function + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, WaitTileAnimation + dw $0000, DoneTileAnimation +; 0xfc2fb + +DoneTileAnimation: ; fc2fb +; Reset the animation command loop. + xor a + ld [$ffdf], a + +WaitTileAnimation: ; fc2fe +; Do nothing this frame. + ret +; fc2ff + +NextTileFrame8: ; fc2ff + ld a, [TileAnimationTimer] + inc a + and a, 7 + ld [TileAnimationTimer], a + ret +; fc309 + +INCBIN "baserom.gbc", $fc309, $fc402 - $fc309 + +AnimateWaterTile: ; fc402 +; Draw a water tile for the current frame in VRAM tile at de. + +; Save sp in bc (see WriteTile). + ld hl, [sp+0] + ld b, h + ld c, l + + ld a, [TileAnimationTimer] + +; 4 tile graphics, updated every other frame. + and 3 << 1 + +; 2 x 8 = 16 bytes per tile + add a + add a + add a + + add WaterTileFrames % $100 + ld l, a + ld a, 0 + adc WaterTileFrames / $100 + ld h, a + +; Stack now points to the start of the tile for this frame. + ld sp, hl + + ld l, e + ld h, d + + jp WriteTile +; fc41c + +WaterTileFrames: ; fc41c +; Frames 0-3 +; INCBIN "gfx/tilesets/water.2bpp" +INCBIN "baserom.gbc", $fc41c, $fc45c - $fc41c +; fc45c + +INCBIN "baserom.gbc", $fc45c, $fc56d - $fc45c + +AnimateFlowerTile: ; fc56d +; No parameters. + +; Save sp in bc (see WriteTile). + ld hl, [sp+0] + ld b, h + ld c, l + +; Alternate tile graphc every other frame + ld a, [TileAnimationTimer] + and 1 << 1 + ld e, a + +; CGB has different color mappings for flowers. + ld a, [$ffe6] + and 1 + + add e + swap a ; << 4 (16 bytes) + ld e, a + ld d, 0 + ld hl, FlowerTileFrames + add hl, de + ld sp, hl + + ld hl, VTiles2 + $30 ; tile 4 + + jp WriteTile +; fc58c + +FlowerTileFrames: ; fc58c +; frame 0 dmg +; frame 0 cgb +; frame 1 dmg +; frame 1 sgb +; INCBIN "gfx/tilesets/flower.2bpp" +INCBIN "baserom.gbc", $fc58c, $fc5cc - $fc58c +; fc5cc + +INCBIN "baserom.gbc", $fc5cc, $fc673 - $fc5cc + +NextTileFrame: ; fc673 + ld hl, TileAnimationTimer + inc [hl] + ret +; fc678 + + +AnimateWhirlpoolTile: ; fc678 +; Update whirlpool tile using struct at de. + +; Struct: +; VRAM address +; Address of the first tile + +; Only does one of 4 tiles at a time. + +; Save sp in bc (see WriteTile). + ld hl, [sp+0] + ld b, h + ld c, l + +; de = VRAM address + ld l, e + ld h, d + ld e, [hl] + inc hl + ld d, [hl] + inc hl +; Tile address is now at hl. + +; Get the tile for this frame. + ld a, [TileAnimationTimer] + and %11 ; 4 frames x2 + swap a ; * 16 bytes per tile + + add [hl] + inc hl + ld h, [hl] + ld l, a + ld a, 0 + adc h + ld h, a + +; Stack now points to the desired frame. + ld sp, hl + + ld l, e + ld h, d + + jr WriteTile +; fc696 + + +WriteTileFromBuffer: ; fc696 +; Write tiledata at $cf41 to de. +; $cf41 is loaded to sp for WriteTile. + + ld hl, [sp+0] + ld b, h + ld c, l + + ld hl, $cf41 + ld sp, hl + + ld h, d + ld l, e + jr WriteTile +; fc6a2 + + +WriteTileToBuffer: ; fc6a2 +; Write tiledata de to $cf41. +; de is loaded to sp for WriteTile. + + ld hl, [sp+0] + ld b, h + ld c, l + + ld h, d + ld l, e + ld sp, hl + + ld hl, $cf41 + + ; fallthrough + +WriteTile: ; fc6ac +; Write one 8x8 tile ($10 bytes) from sp to hl. + +; Warning: sp is saved in bc so we can abuse pop. +; sp is restored to address bc. Save sp in bc before calling. + + pop de + ld [hl], e + inc hl + ld [hl], d + +rept 7 + pop de + inc hl + ld [hl], e + inc hl + ld [hl], d +endr + +; restore sp + ld h, b + ld l, c + ld sp, hl + ret +; fc6d7 + + +TileAnimationPalette: ; fc6d7 +; Transition between color values 0-2 for color 0 in palette 3. + +; No palette changes on DMG. + ld a, [$ffe6] + and a + ret z + +; We don't want to mess with non-standard palettes. + ld a, [$ff47] ; BGP + cp %11100100 + ret nz + +; Only update on even frames. + ld a, [TileAnimationTimer] + ld l, a + and 1 ; odd + ret nz + +; Ready for BGPD input... + ld a, %10011000 ; auto increment, index $18 (pal 3 color 0) + ld [rBGPI], a + + ld a, [rSVBK] + push af + ld a, 5 ; wra5: gfx + ld [rSVBK], a + +; Update color 0 in order 0 1 2 1 + + ld a, l + and %110 ; frames 0 2 4 6 + + jr z, .color0 + + cp 4 + jr z, .color2 + +.color1 + ld hl, $d01a ; pal 3 color 1 + ld a, [hli] + ld [rBGPD], a + ld a, [hli] + ld [rBGPD], a + jr .end + +.color0 + ld hl, $d018 ; pal 3 color 0 + ld a, [hli] + ld [rBGPD], a + ld a, [hli] + ld [rBGPD], a + jr .end + +.color2 + ld hl, $d01c ; pal 3 color 2 + ld a, [hli] + ld [rBGPD], a + ld a, [hli] + ld [rBGPD], a + +.end + pop af + ld [rSVBK], a + ret +; fc71e + +INCBIN "baserom.gbc", $fc71e, $fcdc2 - $fc71e LoadTradesPointer: ; 0xfcdc2 ld d, 0 @@ -14994,16 +16380,26 @@ SECTION "bank77",DATA,BANK[$77] INCBIN "baserom.gbc", $1dc000, $1dc5a1 - $1dc000 -Tileset26GFX: -Tileset32GFX: -Tileset33GFX: -Tileset34GFX: -Tileset35GFX: -Tileset36GFX: ; 1dc5a1 -INCBIN "gfx/tilesets/26.lz" -; 1dd1a8 +Tileset26GFX: ; 0x1dc5a1 +Tileset32GFX: ; 0x1dc5a1 +Tileset33GFX: ; 0x1dc5a1 +Tileset34GFX: ; 0x1dc5a1 +Tileset35GFX: ; 0x1dc5a1 +Tileset36GFX: ; 0x1dc5a1 +INCBIN "gfx/tilesets/36.lz" +; 0x1dd1a8 -INCBIN "baserom.gbc", $1dd1a8, $1de29f - $1dd1a8 + db $00 + +Tileset26Meta: ; 0x1dd1a9 +INCBIN "tilesets/26_metatiles.bin" +; 0x1dd5a9 + +Tileset26Coll: ; 0x1dd5a9 +INCBIN "tilesets/26_collision.bin" +; 0x1dd6a9 + +INCBIN "baserom.gbc", $1dd6a9, $1de29f - $1dd6a9 DudeAutoInput_A: ; 1de29f @@ -15046,7 +16442,21 @@ INCBIN "baserom.gbc",$1de5c7,$1df238 - $1de5c7 SECTION "bank78",DATA,BANK[$78] -INCBIN "baserom.gbc",$1e0000,$1e1000 - $1e0000 +Tileset33Meta: ; 0x1e0000 +INCBIN "tilesets/33_metatiles.bin" +; 0x1e0400 + +Tileset34Meta: ; 0x1e0400 +INCBIN "tilesets/34_metatiles.bin" +; 0x1e0800 + +Tileset35Meta: ; 0x1e0800 +INCBIN "tilesets/35_metatiles.bin" +; 0x1e0c00 + +Tileset36Meta: ; 0x1e0c00 +INCBIN "tilesets/36_metatiles.bin" +; 0x1e1000 SECTION "bank79",DATA,BANK[$79] diff --git a/tilesets/00_collision.bin b/tilesets/00_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..085171e36d880112756366a4af494eaf2953201b GIT binary patch literal 256 zcmZusK?=Yi3~NumK-dEY!Qbf)9)0_oYEi}lHfd8zR8^IQ%Rre7kKslEb)ZY9TSaP; uAtUA=ZmSOt`{)lD?l1eEmz?JUd1;>m77~RIOm0*hGke=EzzdllJjx4?aTA09 literal 0 HcmV?d00001 diff --git a/tilesets/00_metatiles.bin b/tilesets/00_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..763df1997b23b3f63e271fb4d3d9a329835ef079 GIT binary patch literal 1024 zcmaJ=X;0fg5CucxLLf9%1k|kw_&-sATwEak8jSSac~yjXDEwRP8x zMwQHGGMQ4PQX$!@)oO4TVU|hYZaMd6JE4^`+wkgWbaG?(RCy&JJZ197jcZ zs~rdHSh{UnQo}Z27`CmG?$LcfYWaz#82SbW4d)v00LHkWT#Xw+b z*)&&HH4Ua^;(1BaKIk7oZwd4d<$yPD58nO!_507~!!KXSfB)g*r@#M>PmaEQ|52*f z>-1iplp5Y947l>Wc+K)OUe7Czv*tK!<{J&K*%Cs4Uq`!IBH8d#X(5=GH4@2eE0t!R z*R=9N?B(e`(LEv_gZK^4YoeXt{5+C0i+z}jkaByzmq@lmDoruaw?Vf+-*emG8>s@( zJ8+t_{5kMBc5bq&U|vV}R-B%lU+m)?v#-_jcCz=+F}h5X$f$4cwhO W6AJF$z1w@^Zf{4&4P*=yMF9Y%R6a2P literal 0 HcmV?d00001 diff --git a/tilesets/01_collision.bin b/tilesets/01_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..b3276e1cf694881028e59e501711b085e8edd478 GIT binary patch literal 512 zcmZusNe+WB40KMuBU$PLDp~m*^uVPOZvoMMfERYgNoa%^h{tO@Nhu|%cmQ-2cmYq( zPQPK6nblEbR9R$c`3p}qZrsXU+_|lK%h4CctTd3TA9;6(^vvT_4$6U|efn43d4utR zok0pyoD}682p^vr)Kyh?CO6$yUG?Oz>W3FsF3WS?cl6_&F=lPRYBL-%RG17wk)*1j ls~Xy^$iP}XRPYx)6dm$JkAq?f=H4{n#ancWuxX&oD}G(*Eam_J literal 0 HcmV?d00001 diff --git a/tilesets/01_metatiles.bin b/tilesets/01_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..9024f2ad6c761ca47759645ed12017236ed7e208 GIT binary patch literal 2048 zcmaJ?X;TwH5QX3-Y7~tG(Ig~Q9^q6ArNXgnvM4CR1~frUD22Zw-ijBJg$4cKec$)( zU-R`0y|YP)4?5jF-LHFgXLhElsvQ0bXcbsh0THgzYVa@2cp{$Iy+{6~GwDpA0(@OKmvEXt-XDh-q&Z4j96CIH2r?B@N_38OtV;| zh=gg%k@9TQ#B^eTWHKf+>jl_Z~F83Jgv*N{*rwJ23)Z&_WZz3EYC3>XU*fRnI9?H^9zpSfS*UXTvKz& zZfSKK=IN29W__Whm3j7j%y67VgZ2~cBjPcLU$X6alyf-Vfgtr_A7&?H!0m50H7__V ztuzMuIOs9Z7Yia&f*`UM}3M zmrHRkm*OY!W8j6bz&!<5XF)v|h!Nif`OIU@Jk~B52F)&>sH;zB1{=8u?{{8x_ABFR zUvOq!y`~K|vZu8C-c%hG@$Rd-`gmfnF`ZFS$y=!}*OOheq^4@#p2NV@Hm#nfSaZBj6e|!breLd)efk!l`UE;0%sgNWLd{gSQhP{5o>A5 zvreKf`^3Rox}dX}z~?jP`Tg?C$-0@YG2&VsO}ee&!Dt8>sgGMb&d$!lJ#%61;-zad*KfeR^%r%fXC?pu literal 0 HcmV?d00001 diff --git a/tilesets/01_palette_map.bin b/tilesets/01_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..91a8f594d68cd428f0fec368aba7b369e7745116 GIT binary patch literal 112 zcmWF#RT2F}h5X$f$4cwhO W6AJF$z1w@^Zf{4&4P*=yMF9Y%R6a2P literal 0 HcmV?d00001 diff --git a/tilesets/02_collision.bin b/tilesets/02_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..6e5addd6d72562c905c5dfae206348c74f5fa264 GIT binary patch literal 512 zcmZWm+YN&-5c8iWKjWwqy-Kpq1Rnz{s4@dDa`-? literal 0 HcmV?d00001 diff --git a/tilesets/02_metatiles.bin b/tilesets/02_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..a15c0c2c7e29ff3686e963adaa85bf92cbaecb01 GIT binary patch literal 2048 zcmaJ?3ttjJ5Jzm65;HN<;^Cw63e>JB0!5NuMshrY9^RSoae91#9-pfRD9KmpKf5=_ zdHw9K!|d$Le`a>?ZZ{M<4Hng<>SKxfKpm{);m+GbB`p_!wRyp*pHRFcJ}uuX;OwA(C2H2+ynBhM{Uue>ZNT zAW$eKlawFBR1)hUP3uAa7;-BhfAnZL93J)i{iDHP@Mkm{-Ff@uY3uI&PHQFIX&J^p z+HD_OgiQlL9}WinexW!RY;KK4KHduW2IWg5UmE#fcD(h#pfRA<15;`66^}LZSbKaB z-RGr}&=1xZR=iF=--0Z!N=ZD`6ZG;*dX?T!dN294-uDoX@9&dn#9fSS?L`^Y=hbU^ z|Me_$ndR4~BNms07*`i!?EQaT?t}XduA|WuqT3UK=NnDO>Go_p6mlFHBCWqS_Oo_? zJ=?bT@ZFP;4b$dhz_r=E_Y&~0&U3i@MpMdekJ(C}3gP~R&>ge$jJni^3Ss}4FN9?s z9F!2?7no(gltAzc%(7qnT%0eKp9{0@=aS#gCI5T;l(8W!Fb`ptSdh;He8l%aHuG3B zkF`g}fYzJIX0o+vt(wWcc~`6E^O>v=FRDVYE+M7{;UX4RYt`8j0-x(KKKJ7fA3uHm z^7Y$y?w|LUdP40u+jVy>Y$N^{qlS8-UMNwQ1tK zo5MLbjdLr7?{~h0gWWGU=F5H&xB%9CF}Mx{{2LtOaq)2I`S3g*O&Ml=+XZ-lxdx^7_V|9$_l!F4>CAWKAwa>Tsa8<`1qql*8~^|S literal 0 HcmV?d00001 diff --git a/tilesets/02_palette_map.bin b/tilesets/02_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..509f2f810fde3461f5fbdbcffdbeb2ab6dff5672 GIT binary patch literal 112 zcmWF#RZ0*{0|GVWP{B}EB?eK(kkHUjfdE!k2OvW!kRdeGG$51#$Y)??2xa(>25!t< z^h zY--8R7G~UL&OYVbcM+0@tx{<3RaT{@9s5rQ=Yo%QiOwRER$?8ceauiSRrkOl9$d(L qi5^g25^jzp9le=NgDdFBK@u)M43pLo;yo+pm3XVC=Ue@#jQIkttR;Z} literal 0 HcmV?d00001 diff --git a/tilesets/03_metatiles.bin b/tilesets/03_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..41b0cfffd435a479a313984a5191fe86e76040ac GIT binary patch literal 2048 zcmZuy3t!qW5SNLf(Sb!Avp$$Dph9)5RBJ&U?BR=z!Vuk@%J=^k`(M&)gYN(9^&Uwt z$@T6sGcyev2e}~z|M7iCgAW8TE-r)M?mhz)0oxTe{F~ZzDgJtax%ts(?IfRHd<60{8Z9j5 z^C#;>wC_&0(;W;4L*|vL5IM`TazcnLtY>}v49&8j3R<7e3AMDeEJ_=j=4q{7tGC*% zcESsVR=ZGOog}ib9)=VfCKahbv#8npRRNf`#NmNJ@ycdxdpx#n<{W=suStNHn3Q@8 zlcZ=Es=|+czyI+3{7m#XnM|PmjMN9HPdm1~f;A+O`~jdf2_*0C8iu4}-^b${M!8Jn z`yR;m@ZnDEK*=l6V~W3z{P6b)R|({=8pbN-BsikAjuKr-I29c|#*_l9o=?7)PAB;- zEc*X?yh-kK4-N;zv-3{ZaRx)j;ktNeg7?8X z*O}Yv;pz2|e**burc!Tk&@x^s&XuZbJtEI@ma0$J-P?!yB!pFh`%_~(mD=Wi1fBx) znAPfz(`xHcQF3BWPU3rmVI0^<(Esla@S5SwhhY%BE$bA`ktssok`Fy! zI38iBJm}vd-#p$q@6vI2=Za5jG@I>Q$LjoCKg`)LbGD1*hdVh-s1YwWg1I5hw31d zxs=%lhn?=(`C!QY_`C_9juXcbX>hAk+;?Ck*^T?B8}-j-Q}s*LH*>;uWj(k;ay?u^v78nDc06r7(M$icGG#UZ!!^Yh`%J&V* lwoF9%o{Xz`h+ouCRQ*FmiYlP~O^zqUl==a5IgYSP{tpJfQ#=3w literal 0 HcmV?d00001 diff --git a/tilesets/03_palette_map.bin b/tilesets/03_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..b9ae628fbad792a5da3d24b135f739d5cdd68d09 GIT binary patch literal 112 zcmWF#O-)O4VPOpjOHNA*U}a@sNDWJ4P+|%N0yYK(CM5=j(9i$|0i`6MKmY^7e>8Ao z?%Q|o&h+%&xcBgc$8_eRHzRj+^oH##~1a~M4p literal 0 HcmV?d00001 diff --git a/tilesets/04_collision.bin b/tilesets/04_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..5ca0e39547d91fe10bdddca1475abea684803d31 GIT binary patch literal 512 zcmdUq(FwpH3`8$qo#3DYbd^rgC3OFv-boZe3jX$mNOCz1MnoVvh08;9&GigWN;3@6 xek--=aGhhfE2Lj0J)vms+_}0xl-$tP+5!a?;(`Nsoa1L|wz=h;bNk{ijV~Ch35oy! literal 0 HcmV?d00001 diff --git a/tilesets/04_metatiles.bin b/tilesets/04_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..c4390bcba4b3c49bd0eaebdce44da93f1b4a5005 GIT binary patch literal 2048 zcmeH_OIOoC6vr=x%)&yo=EQ~JBs(^=$E6^h#JvI5$pXGgq3EWG5DKi?s`v&KC~puU zw1Thr{6KOi!`K==0q69W{O6zCd1dYm!2ggKQjD$`QFo`*iFfp<>6$Jp{4z|#ycL7( zMxrfwTg^{+`Ra@>-18<2zCT+M-k-^2hjKZ}bkDMer|v(Pnwwvk6VAV$z}<5IG#x-z z97k4c+c1k0o>!jnec|4uTk&TruJAnWzmFpO?+@6~Up|H>uUFS<%a4BU67p+r@#(Y0 z8nU^yxwXBsz4IJiysE8lEbabz`)2PqA>Op>KAd(B4?Y}5nL7%C;Pewf^AO9ks)KhD3G6-r`1-A0U#Wy)#Z4orbCO6lhX=)mQm!C4E&zNkH5%UwVHlQ*AA_L$ z1)%t&UN2*S<(uU>RwhZr#X7=8T(~H=gV@N(C?R9xB1*^*Ccah8FXJmpSfKuvF<36C z^#uRsV)5{{#C$9z#n)jxZUpPGaGfU6SSy1xV;7&|_2Jd$e}G}ywx(Z8%Sum*$uO@Z z)7Jq~SD73q+0FWIsmhVmykXb^TZ88vN=tsS;M3hoeGx~N|_AvZ<}@o+8JnP I;F4zG4Ag0z=Kufz literal 0 HcmV?d00001 diff --git a/tilesets/04_palette_map.bin b/tilesets/04_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..71013e70713488a39539ec542b774434a5e0447f GIT binary patch literal 112 zcmWF#RT2F}h5X$f$4eWgV s?%m9nJ9qB}((m5QoB0yRg@BW1=FHqZd*-~CGhfb|2^5?&3#i~F02ymPqW}N^ literal 0 HcmV?d00001 diff --git a/tilesets/05_collision.bin b/tilesets/05_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..e11da73309459b6a96df247c32d39487913fc565 GIT binary patch literal 256 zcmb7-K@NZ*5CePbcZ~<%0a42Z4Ao26vzM?(!Va{6+Z00U1}J-%y&>WMzXGeSuUFs;csbd5T9zeeGOa)Z zmc0}>ZX^s3RxDeT9hVv~`mh)l^M!#y{^E+~6D^z*ZLAu5PcP8b4NOb|W8I+=t<_~RCU2X&GXnV)-pL=zWXl6DH_75WA z`LX2d1*!s324n>wIz1zLc{Ooo7esIGM20u_r2sfSF+5lSIEU`WZ~vQHfCYGZ2DpC9 z1{_xm>vK&W-QRqHd+hn1-;C29dK}d~U}hHBKhV6dADEiv{_*`gI=6R5MwtPDf?&+e z3vqWZ#NuY1@*)+QbLZJd!pxoT!eZHx>NnfkmBdn%^}8^2UtR$ppSm_))p12BBNh3# zY%Omsmv&1vT=id9Ivd`d-G3g%=^@FN&5BA@C_vxnXv!> literal 0 HcmV?d00001 diff --git a/tilesets/05_palette_map.bin b/tilesets/05_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..55423dc338fb7936e27605bc0f988483ded77153 GIT binary patch literal 112 zcmZ97Q3-%B6h$AHKx{B<@K^yG$hZ}j<$(!?4TcTI3fMr#&7$wydk^O<^R6K%;LTYe rNWiKt2QeuWG9k{`AOgIW zw6`4$HgR%F3t$NuxjjHQ0z_k+XTMoJ7)U-5zq8+Ru3OB6sF}2G zSSIt+Sw%H%-5|QTCHnZ}Jki}f(bqS}ifWmVi+o=K;(@;1Sc+mlF!BeFxG2(&xEa0HAefV{@) rzVaHYn0pI7%QT%mNGK|x8_p)2`>*em^URyhrn9+g?)oe5`serosA_Ux literal 0 HcmV?d00001 diff --git a/tilesets/06_palette_map.bin b/tilesets/06_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..addf636aca83b0a806d575a3b54c082345ea7a55 GIT binary patch literal 112 zcmWFtRWuG|Um<*xDp{xu*02YJL|IxsWyDN9!?dZ6B_wG#~eHVm) STnMw{?(Vz29Y6pUgU|pC&O0*z literal 0 HcmV?d00001 diff --git a/tilesets/07_collision.bin b/tilesets/07_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..5e58e03c94cd1e856bd7dc95bd6a3b0c501ee719 GIT binary patch literal 256 zcmY*TK@Pw$2;#;@0RXAtQC literal 0 HcmV?d00001 diff --git a/tilesets/07_metatiles.bin b/tilesets/07_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..c96c4843b3ba046ec1494f049fb671c32180daf2 GIT binary patch literal 1024 zcmb7CX;a%U5UoVZ(dJ+|Y-oWbwzx^iA*3ECBt7iJ=16F{k^p~!|Np7-h^-RObQqpz zN3-6yyVCAcY7%Sf8-;^%Fi?{D6U0SB}{RcumegdEdc|u4YU}_Um;2KOr z$4L^(WF~!{Sv+Da2r+KT6-$IvYXGe_rH-2zA&v`>&24Ra{?2Z_Vfi|q*KuuAo7o(I z>67#_5E1|_2ssB}%(51bgk(%eLK038V%GN`0GGefOU`~Dpx47cKYs!Ix%&5hiuXy^ z7t-^C(B4-_A%oENo1C^%)1ok%7UjyG+8YH*D~FV-lPEsF7z{BlefBka z8k|QlW0t2gRbt4;dE#{KK0bd*_R;AA+}LL&IqK8Q<4p=SZuFbF&a2(OXPc`k literal 0 HcmV?d00001 diff --git a/tilesets/07_palette_map.bin b/tilesets/07_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..e993af8eca4db338cdbd2a8886e526408ac22f1e GIT binary patch literal 112 zcmZ9=K@os33`Efd3^WdqP$m{?0SjnZz(C^w31wmd3s}GcX28$N&*7NS%nF1i!y(^M`C+Pj~XzXtA55H4oWo<`?T~X1szwAsRBN literal 0 HcmV?d00001 diff --git a/tilesets/08_collision.bin b/tilesets/08_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..5876a3fbed864d61b3cb0dc7f912b63196bba76c GIT binary patch literal 256 zcmYL^!4AM62t#}8@9GX7cGx#G*$=M;7eS&8@IauA1ZbPH@791M2Lz09ltjw)l?HG3 zB&92ZwD;kC`-SNoX7U|9>O92#v8jeXx>t zwYyrao@=!-P(hYwxgfX%-rBFgFb%WSZnginUvd9OwH?dy{2=sv*Cl~v*-j8Pny%a5 z13aJ4WYh_}1f_xeEGr0CapdKaC|$*{##w`q>$e>tbbfUo+u_qdqVwqbv;6TBA)db| z^qogSJbhN^+>doUpG?p-@w~NN{#E<8>APOXKpfLQiDM~~4alQo8Ie;&Lqda;Q8Zga z_ajXw(=;88qex0}oV|Jb?(oCMPoE`$T_@A|d^DcVrHtbl9iy^=)2_fKwrZT5p1tS3 z>G)MS2QQQ4;xb{|tJlD$lr`SbsMmqwy|h+lTdfAz4$x=<{XKrWEH_Lc3O*TTmbcmk z|MdInS@rkJSJ(aa9k}|@J1_IqFni~l@m0R+YN-wj2twfc2Kf0)+qpVsq317dJ^yaW zYxV*LL!i@D+++SJ0T#Ew-LjZfCT*?SIm_0zl1>-Ud>IS}!%mkiRS%W#_aETzy;}2V VQJq{@^}gzRQtVeZQN7mR#{>)MH&'()345?@AB*678CDE+,-39:PQXYZFGHIRRSSZ[\\IJKLT,-U]^^^MNOVW_ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ"""""""" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  ""1111  + + + + + + + + + + + + + + + + ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ \ No newline at end of file diff --git a/tilesets/09_palette_map.bin b/tilesets/09_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..d197c5d4cb5012ac7d73b63c04db76f4f02a94d3 GIT binary patch literal 112 zcmXqD76=Vx5DYXk77h(H6J!WYO#_0&G&T^01^h$DqnLRf4wnDa2*I^%32O?5~oz|HTB`4jM b)d!4;$lB?s;ur22eks$zHzQp>>*sv{WvB^y literal 0 HcmV?d00001 diff --git a/tilesets/10_metatiles.bin b/tilesets/10_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..62da01e8b79d9335e4f8e89e7a47341e89029901 GIT binary patch literal 1024 zcmZQzKm`Ig022@h0RgIN1_oAkR(56<2ox3(7UAIJ;FOS*kVH3zm5q%}R7^|^CeFsr z$1f%>C(j53fdr=24jP0HFad3fB;Y)MFeIZOqB{8 zFfpm92noTss63dcii(M@o}P)Vot+5~fJF85^iAyS>_J>GAIyLfAbDi}o0^%LfkaeP zghfDdAfTnKtz%_vZR6nR;201X5D0Uhle3F!P;f}7o4dPbSa?Jv%)J5vUfu!%QPBv# zkFS70Oss%_pTB@WTs$gIK)@UdVCv1yL1GAuV8KKoDq;E*6crQ=3=Irn`UM19+Zvmi zTP9ALJZ0gc#Y;LmJKJYWoi=^N(q+q!96i)N$@PuHo_XS%@h{i~<1n16S9 z*YOi4yU+l#T9DqZ>o;z8-MW3JYwy1OAoU&HJ?%4Q&zZiWw{LmZ+<6f5X3m4tROlKD8~%MAQ}Yzqk)c&jvc#!07~ud26NZ0 L0*TE85oiDaF(Noi literal 0 HcmV?d00001 diff --git a/tilesets/11_collision.bin b/tilesets/11_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..ee03c45284146318c73443081662a8b28d7e3534 GIT binary patch literal 256 zcmY*TTMoc52;$G{Hv8Nu=#5t%Te7CL3Wx&0jGp2-SKiFtD$D5)kF}hh(4Ka?4E0AM rti1$t+n0f2W8Bj;N26Z$%hV~{O!Zn3WHlCKD|c6v+<1d5&L#N(`~nIP literal 0 HcmV?d00001 diff --git a/tilesets/11_metatiles.bin b/tilesets/11_metatiles.bin new file mode 100644 index 000000000..f6089d29c --- /dev/null +++ b/tilesets/11_metatiles.bin @@ -0,0 +1,8 @@ +6666666666666666""""""""&&&&@B@B + + + + &&&&88889999&& !&&&&&01&&&&&@B@B()()()()*+()&&&&&&&& &&,-""<=""./&>?&"",-""<=&./&>? &&&&''''7777,-&<=&./&>?&&,-&<=&./&>?@AABPQQRPHIRS::T&&&@A&PQ&&AAABQQQREEFEUUVU + K +[EFEEUVUU K + [&PQ&S:&&QQQR:::T&&EFE;UVU;JKJ;Z[Z;6666666666666666AAABMMMN88889999""""""""#$$%WXXY""""@B""PRPRPRPRPR""23""CD&&&&""""""@B&PR&PR;;;;;;;;&&&&&&&&;;;;;;;;""""@B""PR&PR&PR&PR&PR&PR&PR&PR&PR@APRLM&&&&&@A&LM&&&&AB&MN&&&&&@B@APRLM&&&& &&@AABPHIR &&&&&&@B&PR&PR&PR&PR&&@BPR#$$%WXXY&&&&PRPRPRPR@B&PR&PR&PR&@AAALMMM&&&&AAABMMMN&&&&&@B&PR&PR&PR&&&&AAAAMMMM""""""""&&AAAAMMMM&&&&&PR&PR&PR&PR&@A&PQ&PQ&S:@AAALMMM88889999&PR&PRABPRMNPR""""""\]&^_&@B@APRLMPR&PR&AB@BMNPR&PR&PRPR&PR&PR@ALM&PR&PRABPRMN \ No newline at end of file diff --git a/tilesets/11_palette_map.bin b/tilesets/11_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..f2e77186c15bc7a3af55fce22e0193ce487868c8 GIT binary patch literal 112 zcmZ9-u?c`M6h+Y>*qapudr{mY%^Sf#OAykV6$196xQERf!M}q3+Ed)y!#EGIiWA5% vdZ2~0zVUW+)r5c=sAmbzy+1om%v7sJr51^8G8D+1Mk39vkm+gi5 MtDNp=+U=Wp0PMgb8vp?>?*+ !01JK ‰Š§¨./�‘‘‘�‘‘‘�°±²�¶·¸*;;;>?>?>?;;;;&'67()89@AB+PQRECD\]STU VWVWXYXYZ[Z[ PQPQPQPQ^_^_ÄÅÆÇÔÕÖ×ÈÉÊËØ‘‘‘*+>?>?,-<=*;;;>?>?::>?::;;;+>?::>?::>?>?:: ::>? F:F:F::G:G:G"#23$%45 LMLMLMLMNONO !HH01HH>?HH>?HHHH&'HH67HH()HH89––––––––––––––––  +II *+PQ>?PQ>?^_HH&'HH67HH()HH89/HHHHHHHHHHHHHHHHHHHH HHHHHHHHHHHHHHHH;;;;&'67()89>?>?.ÀÁÂÃÐÑÒÓ�‘ÙÚ�‘ÛÜ����‘‘‘‘‘‘‘‘‘‘‘‘�‘"#�‘23�‘$%�‘‹Œ�‘‘‘�‘‘‘ ¡¡¡––––‘‘‘‘‘‘‘‘¡¡¡¡––––‘‘™š‘‘©ª¡¡¡¢––––‘‘‘’‘‘‘’‘‘™š‘‘©ª���‚‘‘‘’‘‘‘’‘‘‘’®¯¯¯‘‘‘‘‘‘‘‘‘‘‘‘����‘‘‘‘‘‘‡ˆ‘‘—˜‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ƒ„…†“””•¡¡¡¡––––���œŽŽŽ¬žžž¬¬›���«�ŽŽ«žžž«ž¯¯¯­‘‘‘‘‘‘‘‘‘‘‘‘�°±²�¹º³�»¼µ�½¾¸ \ No newline at end of file diff --git a/tilesets/12_palette_map.bin b/tilesets/12_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..d8e843c15fd4482148b6581a0d3a62a0f156fbb9 GIT binary patch literal 112 zcmZ=@U|>)ZW=I24456ZF4h({V#>OBHh-L&a1O%CsfRv+4T3VW5=zlcOv0_!%idj2f mcbquW*U{Z^rlVuV?9Pskj+sDk^X}bVAQK8!t?KBWeHQ>H*D}EX literal 0 HcmV?d00001 diff --git a/tilesets/13_collision.bin b/tilesets/13_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..a07b03bce106fc2894af18bc527b5db831fca97e GIT binary patch literal 256 zcmYL@!4<$D2t&DLUA($QC+G^gVe>&>(L@0glse*s6fq4=gY$=?7d2NirRQz+QwJ8b zrnNu={pppa{hE)n>ua0Xnj4a~pO6pFVb=Xc#M;Zv%$ijq-hqm`bY{L;SwJ1sY2o_; DU_BAT literal 0 HcmV?d00001 diff --git a/tilesets/13_metatiles.bin b/tilesets/13_metatiles.bin new file mode 100644 index 000000000..d4506328f --- /dev/null +++ b/tilesets/13_metatiles.bin @@ -0,0 +1,5 @@ + +  +  EU((((6868$%"#4523236778FGGHFGGHVWWX68"#./23^_*+,-:;<=JKLMZ[&' +   +  !0168"#*+23:; ,-<=LMJKZ[*+,-:;<=JKLMZ[ÃÂÂÂÃÀÀÀ“���ÂÂÂÂÂÂÂÂÀÀÀÀ����‡‡‡Â‡‡‡ƒÀÀÀ“���ÂÂÃÂÂÂÃÂÀÀÁÂ��ÆÂ€€�‚��‘’¡¢Â±²‚‚…†’’•–£¤¥¦³´µ¶�‚‚‚‘’’’¡¢£¤±²³´…€€€•���¥ Âµ°ÂÂÃÂFGÃÂFGÃÂ\ÃÂ\GGGHGGGH !]01]ÃÂÂÂÃÂÂÂÃÂ67ÃÂFGÂÂÂÂÂÂÂÂ7778GGGHÂÂÂÄÂÂÂÄÀÀÀ„���”ÂÂÂÄÂÂÂÄÂÂÂÄÂÂÂÄÂÂÃÂÂÂÃÂÂÂÃÂÂÂÃÂÅÅÅÅÅÅÅÅ((((ÅÅÅÅÅÅÅÅÅŽ�ÅÅžŸÅÐÑÓ)œITTÒ×——œ×‡‡9ÓÕÖTTY�——ÇÔ‡‡Ç�9ÓŠ‹TTš›——ß«‡‡Ý»ªªº&'ºˆ‰‰ˆ¸¹¼½Š‹Ó)š›TT®ß——¾Ý‡‡§§&··'ˆ‰‰ˆ¸¹¨©‡‡ßˇ‡ÜÏÀÀÛØ��ÚÙÈÉÌͯ¯Œ�¿¿ÎÜÅÅÞÚË߇‡Ï܇‡ØÛÀÀÙÚ��Èɬ­¯¯˜Ê¿¿ÝÜÅÅ™ÚÒׇ‡œ×‡‡Òׇ‡œ×‡‡‡‡ÇÔ‡‡Ç�‡‡ÇÔ‡‡Ç�‡‡‡Â‡‡‡Â‡‡‡Â‡‡‡‡‡‡Â‡‡‡Â‡‡‡Â‡‡‡ÂÒׇ‡œ×‡‡Ò׃Àœ×“�‡‡ÇÔ‡‡Ç�À„ÇÔ�”Ç�‡‡‡Â‡‡‡ÂÀÀÀ„���” \ No newline at end of file diff --git a/tilesets/13_palette_map.bin b/tilesets/13_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..2e25b5d1e939d05edf1887a9f60168c0edb7ca74 GIT binary patch literal 112 zcmZ9?u?>JQ3`EfzffYca2fPT4cXGi3*#KpNNMV3Txt+jH$!}isPuT&8Od><5Vpd&T iT|;c40*5R5{<_RarfO!bGl!O1dO{A%&0d*3ANc`ieK?f> literal 0 HcmV?d00001 diff --git a/tilesets/14_collision.bin b/tilesets/14_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..2bfcad418d0c83ad8205019350ac29684cd426bd GIT binary patch literal 256 zcmbVG$q@h{49bsoErpVWupSRzixXrV2m(L};dA?qf_aUs@{VD)4oJXbuyk6t+F5TC av`<+UT=&%`_}~Q66@NmvwZGA;|I!3s{uJr} literal 0 HcmV?d00001 diff --git a/tilesets/14_metatiles.bin b/tilesets/14_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..24beba2d38c24405851e5fd8f072e6a6530f3698 GIT binary patch literal 1024 zcmdPZMForki~@o}fHUfc<3-po*4*) zfdJjT%a$)&uB5D_tfj4`ZDnm`jp|!nU0)zL66os-v#-6w*LV611Yc4|Qb*H9)5enD zl3zttMHOT|3o8?oh$y3gh^U|toNnRcvjsX(kC#_phKEPiE+D{ug`fXQxI7N^F!#gk z=i=t#mXZdAA0!^of}4R+ptVgUS?1Y*PFfFy)t?554dVQ8T_$-VT0;55k<#AEYydVxgGMFc*r<=}dp1KEe{;DAF0D?+=WwKQM8y z6qC;r<#I&KSb;T}lX{3Zc~KYp(jBP+`#>CYK}gi?5y3)__41ffxnyh!^U&36)q1c3*iSQ`%L|K3<*(m9jypa+IX*c(J3T`mK^TPHo}QS& zeR5s*;n96`pC07LWnNxk-q>VbtuSwGPkPL#yAy*vL_c?l_VyG1%R15bAJgY*SsnSL zb484vn=78lK;1z}G*W`SX|P|1;D?n1^mU?)v8X=JxLP4iTn$ z6kQ0Hg6#yM=XZOsL1;VOp6A1&pI^VtL(!PGBz4Wcao-1rQFJuaF3o)%91U2J%0Uba48q1~|IxsU znJ?FMty;Bu$L^Q+=B`+^YGy}w$Bd2_w?OpHj*gif9XIao-o5+X>RTNh9kX}80{{sH BH#-0T literal 0 HcmV?d00001 diff --git a/tilesets/16_collision.bin b/tilesets/16_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..499a1d071b81c17adfe29265988e0f5c58372bc8 GIT binary patch literal 256 zcmYjLTMED+3@dDq>&gzWGfWVF_u)mCq{>XOk2Gxsgcd;WKw7st_BSLfq{2w(qa6zuMW|ef;|1;0>IMIT+`q(z@a$Gy%x%yE|E0mpGnQc5$%ajbNXTrWpql+u{E9xB2J6^zqNX-woO&2*KF>imh6 zqqZK`<7F5%`u>gYdP;{8=->Os%a6ZxCFk)l;bmUvDmVGkS-v26@)VP|?+%Z?{}>EE zeg5+G=lR7ixX<{r=Ssi-z{^D1ek2kTU8SauWTtDe+ubhXIZ`^M@INYCk7i-iZF9089Bv}zdOJUC3k5r%Mqex=A?Dh&ciaN l4;~iM%%JNr9!AF5jF;{CZ0a44g_umNo*KXxJ9Ohe;}1`_uYUjl literal 0 HcmV?d00001 diff --git a/tilesets/16_palette_map.bin b/tilesets/16_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..14a4191b8a94eafd0c9768e9659b459ea56ca91c GIT binary patch literal 112 zcmWGAW@HEj0pmc1P#_D4SOb7uAk7G(LqnB1e5`s(_L2>nGvyxheeNpTUK*{ i)sT>N>B624_g;(x9h-}3Iq&bT|2JA9Em!;9{Ne>jX$^A# literal 0 HcmV?d00001 diff --git a/tilesets/17_metatiles.bin b/tilesets/17_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..9bbdd0bd20f504d9543d56b740eeb51c2a7d8fad GIT binary patch literal 1024 zcmah{XHx<}3{@BfPRD`;Jj=<9ieOuG6cn;UvCyS1MbW=v`QvT~nd6QRzMGv~Ub4yC z-6RrDWOLbEzK}1#1lb$_dTg0zd#!P!A^(A2Bdl?ICuK4v<^6+{>5P=N@As!O;V{=- z(KygZri7SY(`~SCqY2Pz)9Q2qJYM??ZUi>~oEgs3CKA@dqOrNPZ5|z;L=UY?%P<0l zY3`W5t5`HNr~QCoXxEI#d{@?GXwFz#w#?nV{rK7Wg-&0!G_dCS1crvGajJna;exG> z{`kCXdoEOK)!O^$eZ-c_v9DYxmXzublqy%08opt0mO+;9x6y1gTW$I}-A=dB?Dbl0 zTAeP6aWa^Xc`TFlU`<5*wf_3?`SD4f-FzlypNHyG&FOP8PaQa$J5f)}{{t@Z%XR<& literal 0 HcmV?d00001 diff --git a/tilesets/17_palette_map.bin b/tilesets/17_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..8c3cbd31a34303aa9bce592893da2700d81d2c22 GIT binary patch literal 112 zcmZQjVgLa~1}Lonbjog{p$+|7c+M?hX*>>{tb%R{*IV aAnpcpUv!)~vwQd5j#ax?@4CAdL<0a{{4sF= literal 0 HcmV?d00001 diff --git a/tilesets/18_collision.bin b/tilesets/18_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..cf77d603ec7f87e64f745522f962685afedd06eb GIT binary patch literal 256 zcmYk0(G37G2txUD-KLXt7AHI(o=q_Us{|VXWRivU$aPd$EAC?N^0s-j90UO8!1H2O o1zpWhrc`2|SNI*mEhdep^}wcCqC}W{@W1@b9}g{P=X@#R1H(28`~Uy| literal 0 HcmV?d00001 diff --git a/tilesets/18_metatiles.bin b/tilesets/18_metatiles.bin new file mode 100644 index 000000000..a2adb197a --- /dev/null +++ b/tilesets/18_metatiles.bin @@ -0,0 +1,15 @@ +  *() 89+,!!   %'!!  5 5 5 5 5&&01    %&&'677:"##$2334°°°°´ÕַרØÙÚÛÛÜ  +,+, *() 89 SSSSSSSSSSSSSSSSFGFGVWVWFGSSVWSS FGFGVWVWSSFGSSVW�]•—‚]]]%&&'XYXYÑ£¤Ñ¥¦§¨©ª«¬­®¯ÔSSSSSSSSFGFGVWVWÇÈÒÒÓÓÓÓÓÓÒÓÓÓÓÒFGSSVWSSFGSSVWSSSSFGSSVWSSFGSSVW./SS>?SSNOSS^_SSSS./SS>?SSNOSS^_S@HH@PQQPPQQPPQQHHHHQQQQQQQQQQQQHHBSQQRBQQRRQQRR----------------PPQQPPQQPCDDCDDDQQQQQQQQTUTUTUTUQQRRQQRRDDERDDDESSSSSSSS + SS + SS + SSSS + FG + VW + FG + VWFG + VW + FG + VW + SS + SS + SS + SSʰ°°Ë±Ý±Ì²Þ²ÉÀÀÀ°°°Î±Ý±Ï²Þ²ÐÀÀÀÍFGFGVWVWFGFGVWVW————]]]]%&&'XYXY°°ÁÂݱÃÄÞ²ÅÆÀÀÅÆÁ°°ÃıÝÅÆ²ÞÅÆÀÀ°°°°´µ¶·¸¹º»¼½¾¿�]ˆ‰‚]ˆ‰‚]ˆ‰€]ˆ‰‹Œ]…‹Œ]†‹Œ]‡‹Œ]„;<<=;<<=;<<=;<<=ÒÒÇÈÒÓÓÓÓÒÓÓÓÓÒÓ````````````````;<<=;<<=%&&'XYXY˜™——š›——œ�——žŸ————˜™——š›——œ�——žŸ—–]…]]]†%&&'XYXY�]•—‚]]—ƒ]]•€]•——–]…—]]†–]]‡—–]„�]ˆ‰‚]ˆ‰ƒ]ˆ�€]�Ž‹Œ]…‹Œ]†’Œ]‡Ž�]„————————————————ÓÓÓÓ;<<=””””““““¡ÓÓÓ¢ÒÓÒ‘‘‘‘ŽŽŽŽÒÓÓ¡ÒÒÓ¢‘‘‘‘ŽŽŽŽ \ No newline at end of file diff --git a/tilesets/18_palette_map.bin b/tilesets/18_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..13ed4766431f70884e0e067e1d617bec484f9a37 GIT binary patch literal 112 zcmY#TVq{aoP%sn-SPhdILPHrs8G!VEG_V^8IzV7XCxn_e X6AVD&AaMKc-Mf2%^z4qEAZ|AR?FBS) literal 0 HcmV?d00001 diff --git a/tilesets/19_collision.bin b/tilesets/19_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..f15ac266a4c3600d19e3999067ea63a378cbc5c5 GIT binary patch literal 256 zcmY+7u?@f=3X~>ElIy u?#-Ky`IzrQY`VPwg literal 0 HcmV?d00001 diff --git a/tilesets/19_metatiles.bin b/tilesets/19_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..21ca0f09a4cf9b43f0470246e7c3c4ca0262dfac GIT binary patch literal 1024 zcmZ8g30K=N3?^-8S&P8+h#@6{Z5_u(W&>HdlC3)_XCE+bHux)BIDR+sif9_W_$iY0 zNuLzOar$L2iXx9(e8`Nl5oDIgR(#x?*w`9Lp(unT0R*H6UQ{Z>emxA>1}qODj8Cv# z9s(SnKo}VnVrsgF%je;E*0x?&m^W*>d**82t$&&Ly%It!62F0*aIOrVUC((4{)XVM z3BDAST-Q;JhBMop6VGqv36)DfVCR>`YqQxl`t(ej+dHH0A1sXSX?`Q4Qcg|J&AaaE zT5rhQ_gj*WB(`3*ALhk~E}vS>Q$l!3%5Ht<$?}w^06m4ky5Gv&Q-8J&-$&7mvVAm2 zxR%w-kLpCW57zu0wb6zio!30%>znJFo!yFckTwD11i|7ze3J6$7vS$d2+RX;Ya8MG0&ug9aC!!KdxvoUVB_t- zFjh~SaS|s&6pFM*^q=&{ah@KZckhi}-^lL=&+GE)^2*MO?M|oPW%-R_ya9XHm5efCvh9EGQsFKuIi!1-n=P`TxJr!zGj8Ox}HP&15qB?3I@! zF4r*hgU3s>7&|@N*?oE@5|ZfQ5d(u2%}V)A3+$Vf^1Bw;w^aS{$S5#72du6E zxkG^SFIo*j*h!)PwlyV22A(dI0FF5$TtxH literal 0 HcmV?d00001 diff --git a/tilesets/21_collision.bin b/tilesets/21_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..0dfed1d9197933e34a55a5e0c12cb09daf8b7da3 GIT binary patch literal 256 zcmZWjK@Pwm4D!ZzjmN!W$v!L;$uyEwicl*6G~(f@PLd@^f5k8FRfR@_1J29dXB_d} h>O*-p+N|Bd>DLF#?&Jwo|mc}(pY%|`z@U;?*(2xR~O literal 0 HcmV?d00001 diff --git a/tilesets/21_metatiles.bin b/tilesets/21_metatiles.bin new file mode 100644 index 000000000..097a882fd --- /dev/null +++ b/tilesets/21_metatiles.bin @@ -0,0 +1,2 @@ +================"#23"#23±±%,-./<==?LMNOƒƒ +  !01@A544$$$$ÂÃÒÓ 44$$$$4444$$$$±R,/±RLO±R\]±�‘ƒ±±%4”$ ¡†‡,/–—LO:;\]�‘ 5$$$$±R&'±R±R±·�¶±–§—±†¦‡±·�¶±·�¶±–§—±JK£±Z[%444 $$$±¦¦‡± �¶±4444$$$$4444$$$$¦¦¦¦§§§§ƒƒŠ‹°²ˆ‰·�˜š·�ˆ‰·�˜™–§�¶Œ��¶›��¶Œ�§—œ�4444$$$$ÄÅÔÕ================¨©ª«¸¹º»ÈÉÊËØÙÚÛª«¬­º»¼½ÊËÌÍÚÛÜ݈‰·�˜š·�ˆ‰·�˜š·��¶Œ��¶›��¶Œ��¶›�ØÝŽŽ¶4ŽŽ¶$ŽŽ¶§§—ª«ª«º»º»ÊËÊËÚÛÚÛ¶’“·¶¢£·¦¦§§§§ƒƒŠ‹†¦¦·ŽŽƒƒŠ‹¦¦‡ŽŽ¶¶’“·¶¢£·¶ÀÁ·¶ÐÑ·ŽŽŽŽŽŽŽŽŽŽŽŽ§§§§ƒƒŠ‹¦¦¦¦ŽŽŽŽDETUQQQQPPPPHIHIXYXY4·ŽŽ$·ŽŽ€·ŽŽ>–§§Š‹Š‹°²°²ЋЋ°²°² 44ЋЋ°²°²4444®¯®¯ÞßÞß®¯®¯¾¿¾¿^_^_„…()„…89”•:;‚‚‚‚$$$$ÆÇ‚‚Ö×��‚‚��()$$89ÆÇ:;Öׂ‚‚‚¦¦¦¦§§ ¶BC·¶¢S·®¯®¯¾¿¾¿ÎϾ¿ÞßÞß���������������� 4$$$• 444±¤¥$±´µ¦±–§§��������4444$$$$ž‰†¦˜š·�ˆ‰·�˜š·�¦‡ŒŸ�¶›��¶Œ��¶›� \ No newline at end of file diff --git a/tilesets/21_palette_map.bin b/tilesets/21_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..b4a0afde2b7281aefe8ccb7a6684a9e726037600 GIT binary patch literal 112 zcmXpo1_A~~V?zUDL1P95CI&%6W5G}c1`rJ-nHh|Y4PA@{7zKf7*Ca3<4vVRupA1lgWe_xU1P}wikI3Z!T^C$18i6EBvYJv;8bjZer~CjLc_uREN}KFr7{&oJgSZhHhn#pI zE`%eJoJa=p_0#5ZM7rK5Bv`OprdgT`Vc5V}(Dn+z**PFiQ6Wx&lR|MHxVQww>A$!_sx_i^$90MSq9{ANY`s>* zK9oMk_pRP**sRAP-e<42dXF>SD=#a5iV1m&U{n7WUt_=iJElw)e!eH`0o6JQ3`9}00anBwM4o{GD7@3L0hSmf$Qz)fr(gzF05>%J=IO2%l1S4hXA)9P roJSf|=UG`|Okv_KKfg-xyTWbV-4`4NbJXS=tT>v5aa?|y87hDmX`nZy literal 0 HcmV?d00001 diff --git a/tilesets/23_collision.bin b/tilesets/23_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..878803fb8dcb6c1ab50efd91ab86a5dea4ef2d44 GIT binary patch literal 256 zcmZWkTMmFQ20~WGbuTyqS6_`^{ z^r0ZBxvv92ll!2geXQ8P&Ll-?y%UD{F=xc#WZC(&|Gi8uCkRUPH*y{dT=uw`zKp&P Aa{vGU literal 0 HcmV?d00001 diff --git a/tilesets/23_metatiles.bin b/tilesets/23_metatiles.bin new file mode 100644 index 000000000..b6668fcd4 --- /dev/null +++ b/tilesets/23_metatiles.bin @@ -0,0 +1,2 @@ + @ !!A1A1!!!!!!@ A1A1 + A1A1A1A1A1A1A1A1A1A1!!!!!!!!A1A1!!!! -.=><>MN./>?,NO()89*+:;()89*+:;MN]^NO^_A1A1@ !!A1A1!!@ !!!!^^^^"#23&'67"#23&'67PQPQPQPQPQPQPQPQ$$$$  "#23!!67"#!!2367%545%545%545%545 ^^  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿFV GW PQPQRSRSBCHZ[!XL\67IBCY!Z[L\67JKZ[L\67JKZ[L\67DETU!!!!PPPPPPPPFV   GW  \ No newline at end of file diff --git a/tilesets/23_palette_map.bin b/tilesets/23_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..086080a7de63c107f7a319f850772298d654fffd GIT binary patch literal 112 zcmWFy4HXp(1p)>r4P*&2fCS()m;)pJqk+43@6MeGB<^-VX&`H62S@-)p8>MY+yM)K FXaHzlLaG1& literal 0 HcmV?d00001 diff --git a/tilesets/24_collision.bin b/tilesets/24_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..701de1c0b6b1023c5767d9659eab79b91ee578b2 GIT binary patch literal 256 zcmZvW!3}^g387zccc4oS$Qg^^{Q;@jzJ9UH_E|W%p;oxe NPR>Hff7>6i#sgng89o32 literal 0 HcmV?d00001 diff --git a/tilesets/24_metatiles.bin b/tilesets/24_metatiles.bin new file mode 100644 index 000000000..a41b5b080 --- /dev/null +++ b/tilesets/24_metatiles.bin @@ -0,0 +1,6 @@ +$$$$$$$$*+:;"#23%&&%&&&&&&&&&&&&&'&&&' +& +&  &&67&&67&&&&$$$$*+:;$$$$"#23     ()89       !01     $$&&&&    @@@@@@@@@@@@@@@@%&&&%&&&%&&&%&&&&&&&&&&&&&&&&&&&&&&'&&&'&&&'&&&'67&&67&&$$%&&'%' &&&&&&&&  +& +67'67&'&&&&&&&&&&&&%&&&&&&&&&&'&&&  +&&& \ No newline at end of file diff --git a/tilesets/24_palette_map.bin b/tilesets/24_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..b6c9713932f9fdea6e03128543429bab6c03e081 GIT binary patch literal 112 zcmZ9=(Fp(`6hcv<)taDqI|;4U1ckHI^Ro_I5Cbg`2|Z9f48Ag;;B`LY5|y~c>0$Jh Hk%O-b(UUll literal 0 HcmV?d00001 diff --git a/tilesets/25_collision.bin b/tilesets/25_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..29e6fa56d32dc079aa76aafb017b4197cdf078b2 GIT binary patch literal 256 zcmah@F%rNa3}WL09bEfEU*OvdiH-IgiUT2#M3Tfr6W&^F-h$ZxddI*>l^qY-vTM2o hk)Dm9&5hJ2zhag5*xY80{dMxtkt{p!FZo;fzYkr32hsol literal 0 HcmV?d00001 diff --git a/tilesets/25_metatiles.bin b/tilesets/25_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..1fe93164077396a5d16a8bf62333bf5c08a8ea1e GIT binary patch literal 1024 zcmZvaiBiHa5QYM?krP!GJI1&?|mhX`KC0E1UWM#cM8)F;q4_TRKArNd6Pn=i?~ zO*V;4OinE=udHtG?Cu?(oSrd*89LLMibEkA4jCV08rRU|OeB;)7BUtmi^b4fkH;B$ zKB|2helOk${f0p1$5-#=~PTKj%v8>eYFe zQE%w%;nCN3OiS3gy!x+cnN}`O?CMRcBXW5gdvMLPI0xH@rBbPhVmDE7xCSgy@n!v8 zJ_5DCEey77mB5Ql+*41Fl~PQ>@3f>IIVeKbmm;9op1R$xtHVk(ATe}Y{vY@p`n^3J zjYij!$)s{%6zCgp29Q!7)YC>tx1Y^s&#TocIWP&#qALxU0v-S^$l3MHt^W4@q3%KH zDBiW(Z7K3TKw_z*2)zHq1N+A34^Dl0a3LEoJS#e&UvyStQOka}wDvT{-1YR+Su1<)ji1{pPs5ZZO&RTq$QtiZ4U2hR!Sxqb;U`SkFk{Ce?&1SC DHuwqk literal 0 HcmV?d00001 diff --git a/tilesets/26_metatiles.bin b/tilesets/26_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..61ef041b5b3833fd531334d8d2ef24df131d7f13 GIT binary patch literal 1024 zcmd5)XKTYS5UuV&*i!2OX#yE`26Uy^Negk(6gypXe#q$l|39Qs#Gxc5{aj&udeXb0 zcgNWJ@_f#t`2HbDPr7+=G3MO!AD^PQdzz%<%e>ePgAmmZ5Kw&(gu$NrfUx6oF63ER zNI)SGxLVhxPJ`|>9-cQx7CY`;i`YWa&cx|gERXZ6YNNM`OYN*?vIxn!vgx2cOP z#Uo36vW{zZ#0PX-gx_(t@hGmTcT}Y~+xV1M*IVfeY4v6-FBl`e8B0=qLh%j`0gsLm zJRdNM5t0-zFHq_3`3O-An4}1nPdxG`p7kT0*8Qk%`>wzBG4Gz#DUW{FZO!Uu?r)kj zWxD@^a%*C-<93EZ65g~+e!ZR1IpqmL#|?wkJV7XA7-+tlw`byM{IW7{bPmWEf{x1h yH`;le&H(2Ntt;s>ogvH@gm*TU>EEE9q_1yz@wx0@JB#A?57ob~yx5@sJNN?-cPkhG literal 0 HcmV?d00001 diff --git a/tilesets/26_palette_map.bin b/tilesets/26_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..e5d3715e4517bb0dbab342abf64f8fbaa6c2e06e GIT binary patch literal 112 ucmZPw4GlFmc42S{bpZhe7Z;#_AR~x&aRJjH;gC=U2B0_){6_ErF*yT-v>8D&cDV2oQ35hh6#jiB77cTXNU2hW?UgZR}2`T literal 0 HcmV?d00001 diff --git a/tilesets/27_metatiles.bin b/tilesets/27_metatiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..01c0b4aa55ac97a611101aa2c1c322445ec835c2 GIT binary patch literal 1024 zcmZuw33t*!5O&nC3G~=iX$tfRmfDgB3a#3rpq2aR0aQ6^U;9@$JX`g7-^X8dmUWEb z`Q$!79>`^}I_xdCGk;@o-8FJ7X@LQG6@J~!{=LU07-6g3ZHx?!4>GsZloY0gl7 z7I6Wgv4e=;G+)Hx0O<^XZaB-2Zzqz8WH6*Iug~i%mWrivrCiAu@`Y-xTAP>@Vs75y z7h-Cf^Mys?aiYcmJ7Oo^Q+f5zjGJh)@`bhI|`(m za*9&76}G~%UfgfBwFjLpp7SrihWwHlzzPFIZFwhgdC3Z|tuJ3$TfcELo6`eUST~|J zxsph_)v6kRRvVzxmFlLZg;-d0{E!-=cGS-1)b;E+z+ecFF91|)qxuv4J;gPOq>C7d z0s9w`{c}%CDkVfB+1w9?>WyFs!0X%Hi^Y$Q)0uIdSkJH?=fUlmw1+=TB;gPjc6)rO zeLT-0DN&KJR@*c?-B^5kN6rl)7S|2M?pDAe8qS|?^!mO2U^p1k{Pg5Q5^c_z180I%P?efR#u$4{TXeEs(Q$IoB?|C+2+{X{h?./>?@ANOP]^_&'67             01 01@AAAPQQQPQQQAAABQQQRQQQR@AABPQQRPQQRPQQRPQQRPQQRPQQRPQQRPQQRPQQRPQQR@B@B()89()89 \ No newline at end of file diff --git a/tilesets/28_palette_map.bin b/tilesets/28_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..3d90cf959f31b2d4650fb0a9a9536d7cf4872934 GIT binary patch literal 112 zcmZQDG!|wwHf9h2(V?MAp$uT41fdv083ICC!E7k~9}RTu+&#N<_wJ4vAo}jzRd+kU RU=@VwxZ82#Y!8?Xr2+WOG4lWb literal 0 HcmV?d00001 diff --git a/tilesets/29_collision.bin b/tilesets/29_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..a4498cbee052e6ace5305eea83198b9d30f7c18f GIT binary patch literal 256 zcmYLE!4be94C2QiF6IcH-!7wPyMPlGjJ7<4C?OF5D2R;8Nz4g|d{={{Bo;*O*p)r5 zgTTvC#{p!wE$b55&http!JS`(1Rrt?^7gRK-q>U*kzuEslFlvuO(IzX7B*EC@rPK$ L!-Y~jN8(TRRRR,--.IJHKRRRRS)SS9? V)RRRRSSSS  >TLM \]XYZ[8//9WGGGU? NO^_ ›››››ª«ª + ª›ª›šªªª*+ª:;˜™šš¨©šš¸¹®¯Èɾ¿ššœ�šš¬­®¯¼½¾¿Ì͈‰Œ�˜™œ�¸¹¼½ÈÉÌÍ&' 67EF   šššš›ššš€�¹º�‘ÉÊ4444444444444444 \ No newline at end of file diff --git a/tilesets/29_palette_map.bin b/tilesets/29_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..017e9c52dc460ae858c966a2d2e8f66e1f657707 GIT binary patch literal 112 zcmYdIOG^t&3pGv!(rG|CIW3LBIL+AD)YuqEGZ?$LFc}yFK_~-=G&cT^2Hp_{tDs82 FGyp+-NO1rF literal 0 HcmV?d00001 diff --git a/tilesets/30_collision.bin b/tilesets/30_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..701de1c0b6b1023c5767d9659eab79b91ee578b2 GIT binary patch literal 256 zcmZvW!3}^g387zccc4oS$Qg^^{Q;@jzJ9UH_E|W%p;oxe NPR>Hff7>6i#sgng89o32 literal 0 HcmV?d00001 diff --git a/tilesets/30_metatiles.bin b/tilesets/30_metatiles.bin new file mode 100644 index 000000000..a41b5b080 --- /dev/null +++ b/tilesets/30_metatiles.bin @@ -0,0 +1,6 @@ +$$$$$$$$*+:;"#23%&&%&&&&&&&&&&&&&'&&&' +& +&  &&67&&67&&&&$$$$*+:;$$$$"#23     ()89       !01     $$&&&&    @@@@@@@@@@@@@@@@%&&&%&&&%&&&%&&&&&&&&&&&&&&&&&&&&&&'&&&'&&&'&&&'67&&67&&$$%&&'%' &&&&&&&&  +& +67'67&'&&&&&&&&&&&&%&&&&&&&&&&'&&&  +&&& \ No newline at end of file diff --git a/tilesets/30_palette_map.bin b/tilesets/30_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..b6c9713932f9fdea6e03128543429bab6c03e081 GIT binary patch literal 112 zcmZ9=(Fp(`6hcv<)taDqI|;4U1ckHI^Ro_I5Cbg`2|Z9f48Ag;;B`LY5|y~c>0$Jh Hk%O-b(UUll literal 0 HcmV?d00001 diff --git a/tilesets/31_collision.bin b/tilesets/31_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..9f66b5fdd58cd19a55309eafe8279782041266e0 GIT binary patch literal 256 zcmcJI(G7q=2t)h#{!JLd@m%0`F{gW42xsB|mJ6jV;Q(apjhtkM#hn=?;zn literal 0 HcmV?d00001 diff --git a/tilesets/31_metatiles.bin b/tilesets/31_metatiles.bin new file mode 100644 index 000000000..d932c1ef1 --- /dev/null +++ b/tilesets/31_metatiles.bin @@ -0,0 +1 @@ + ,-./<=>?**** ,-./<=>? ***&'&'6767&'67&'&'6767&'67&'67*** &'67&'67(9&'8:67&'67&'&'6767&'&'6767&'67&'&'6767&'67&'67&'67&'67)**********+** !!! !!! !!!!!!!!!!!!!!!!!!"!!!"!!!"02 !!!0111#$$$#$!!!!1111$$$$$$!!!"1112$$$%$%#$$$#$$$#$34#$$$#$$$#$$$3444$$$$$$$$$$$$4444$$$%$$$%$$$%4445}PP }PP}PPPPPPPP}PP}P&}P,}PPP2}P8}PP@}PPPPH}PPPN}PT}PPY}Pa}Pe}Pk}Pp}Py}P€}P†}PPŒ}PP�}PP•}PP›}P¡}PP¤}P«}PPP°}¶}P¼}PÃ}PÇ}PÍ}PPÑ}Ô}P×}PPPÝ}Pã}PPPë}ï}Põ}Pý}~~ ~P~PPP~~PPP#~PPP&~P)~PPPP,~P2~P8~<~PPP>~PPPPC~PPJ~PPQ~PPX~P^~Pe~Pi~PPo~Ps~y~€~„~PŠ~P�~PPP—~P ~P¢~PPª~PP \ No newline at end of file diff --git a/tilesets/31_palette_map.bin b/tilesets/31_palette_map.bin new file mode 100644 index 000000000..78f51b99a --- /dev/null +++ b/tilesets/31_palette_map.bin @@ -0,0 +1 @@ +P$ETU""USUUU""UUU"RU""UUU""RR%UUUUUUUUUUUUUUUUÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿØ�¬ÍÜݪªÝ�ÛÝÝݪªÝÝݪÚݪªÝÝݪªÚÚ­ÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝ \ No newline at end of file diff --git a/tilesets/32_collision.bin b/tilesets/32_collision.bin new file mode 100644 index 0000000000000000000000000000000000000000..a4da351d387cf2a73c5e0ad2c60b1268112ccff8 GIT binary patch literal 256 mcmZQ)XJ==iA^;f&G7)AflnoLE3W5lR1fUueKt=0GHVOdJIssh( literal 0 HcmV?d00001 diff --git a/tilesets/32_metatiles.bin b/tilesets/32_metatiles.bin new file mode 100644 index 000000000..47c531b2e --- /dev/null +++ b/tilesets/32_metatiles.bin @@ -0,0 +1,17 @@ +ÂÀ�ÒÓ�‘®¯€�¾¿�‘¬­Œ�¼½œ�Ž�®¯žŸ¾¿€�„…�‘”•Œ�Ž�œ�žŸŽ�„…žŸ”•ÆÇ¦§Ö×¶· ¡ÀÁ°±ÐÑŽ�žŸ ¡¦§°±¶·®¯¦§¾¿¶·‚ƒ€�’“�‘¤¥Ž�´µžŸ ¡Ž�°±žŸÆÇ€�Ö×�‘¢£ÀÁ²³Ðц‡€�–—�‘  +  +  +  !"#®¯¾¿@ABC 89 +  +  + +  +  +  +  +  +  +  + TVXY  + C 6!@ #8 + 6"7¬­¦§¼½¶·¤¥Š‹´µš›¤¥¦§´µ¶·¨©¦§¸¹¶· ¡ˆ‰°±˜™¢£¦§²³¶·¤¥´µððððððððððððððððÀÁÐÑððððððððððððððððˆ‰¤¥˜™´µª«ÀÁº»ÐÑðððððððððððððððð ¡€�°±�‘ª«ˆ‰º»˜™ª«€�º»�‘Ž�¬­žŸ¼½€�ÄÅ�‘ÔÕ¬­€�¼½�‘„…„…”•”•¬­ÀÁ¼½ÐÑ„…Œ�”•œ�Ž� ¡žŸ°±€�ª«�‘º»€��‘ÀÁ¢£ÐѲ³®¯¬­¾¿¼½ÀÁÄÅÐÑÔÕ¦§ÀÁ¶·ÐÑ¢£ˆ‰²³˜™‚ƒŽ�’“žŸ \ No newline at end of file diff --git a/tilesets/32_palette_map.bin b/tilesets/32_palette_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..e5d3715e4517bb0dbab342abf64f8fbaa6c2e06e GIT binary patch literal 112 ucmZPw4GlFmc42S{bpZhe7Z;#_AR~x&aRJjH;gC=U2B0_){6_2sOi`SnS0lFwznY3r~bWqdC4zrLfku?8gmUtXRKL`TSd;RVs}>s9N3 M^3MOA^%xl#01v_*g#Z8m literal 0 HcmV?d00001 diff --git a/tilesets/morn.pal b/tilesets/morn.pal new file mode 100644 index 0000000000000000000000000000000000000000..279a064e2ca194ae3442b59d813a3d8984aa33bc GIT binary patch literal 64 zcmez4yftjC>2sMs&h<%glFwznY3r~bWqdC4zrLfku?8gmUtXRKL`TSd;RVs}>s9N3 M^3MOA^%xl#0Ps&8t^fc4 literal 0 HcmV?d00001 diff --git a/tilesets/nite.pal b/tilesets/nite.pal new file mode 100644 index 0000000000000000000000000000000000000000..8c1079f093c3e7c25709f28253ad99585f613da6 GIT binary patch literal 64 zcmX?~nC<)AfPvwB;yV{!1rWW$H^CG{FLg=QU|_hXf5G#DCWx;4sr literal 0 HcmV?d00001 From b570c4d6e660ffe36427a29ee34f87298b77bfda Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 18 Mar 2013 16:36:30 -0400 Subject: [PATCH 008/112] fix path handling in png make target lz files were being decompressed to the top directory (gfx/) --- Makefile | 10 +++++----- extras/gfx.py | 32 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 5c7c0d246..3d917f941 100644 --- a/Makefile +++ b/Makefile @@ -44,15 +44,15 @@ pokecrystal.gbc: pokecrystal.o lzs: ${VERTGFX} ${HORIZGFX} pngs: - cd extras; python gfx.py mass-decompress; python gfx.py dump-pngs + cd extras && python gfx.py mass-decompress && python gfx.py dump-pngs front.png: tiles.png - cd extras; python gfx.py png-to-lz --front $@ $(OBJECT_DIRECTORY)/tiles.2bpp + cd extras && python gfx.py png-to-lz --front $@ $(OBJECT_DIRECTORY)/tiles.2bpp tiles.png: - cd extras; python gfx.py png-to-2bpp $@ + cd extras && python gfx.py png-to-2bpp $@ .png: ${VERTGFX} - cd extras; python gfx.py png-to-lz --vert $@ + cd extras && python gfx.py png-to-lz --vert $@ .png: ${HORIZGFX} - cd extras; python gfx.py png-to-lz $@ + cd extras && python gfx.py png-to-lz $@ diff --git a/extras/gfx.py b/extras/gfx.py index 3aa98b3ca..3d8e950bc 100644 --- a/extras/gfx.py +++ b/extras/gfx.py @@ -1436,8 +1436,8 @@ def mass_to_colored_png(debug=False): for name in files: if debug: print os.path.splitext(name), os.path.join(root, name) if os.path.splitext(name)[1] == '.2bpp': - if name[:5]+'.pal' in files: - to_png(os.path.join(root, name), None, os.path.join(root, name[:-5]+'.pal')) + if os.path.splitext(name)[0]+'.pal' in files: + to_png(os.path.join(root, name), None, os.path.join(root, os.path.splitext(name)[0]+'.pal')) else: to_png(os.path.join(root, name)) @@ -1459,26 +1459,26 @@ def mass_to_colored_png(debug=False): def mass_decompress(debug=False): for root, dirs, files in os.walk('../gfx/'): - for file in files: - if 'lz' in file: + for name in files: + if 'lz' in name: if '/pics' in root: - if 'front' in file: + if 'front' in name: id = root.split('pics/')[1][:3] if id != 'egg': - with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert', sizes[int(id)-1]) + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', sizes[int(id)-1]) else: - with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4) - to_file(root+'/'+'front.2bpp', de.pic) - to_file(root+'/'+'tiles.2bpp', de.animtiles) - elif 'back' in file: - with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert') - to_file(root+'/'+'back.2bpp', de.output) + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4) + to_file(os.path.join(root, 'front.2bpp'), de.pic) + to_file(os.path.join(root, 'tiles.2bpp'), de.animtiles) + elif 'back' in name: + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert') + to_file(os.path.join(root, 'back.2bpp'), de.output) elif '/trainers' in root or '/fx' in root: - with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert') - to_file(root+'/'+file[:-3]+'.2bpp', de.output) + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert') + to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output) else: - with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read()) - to_file(root+file[:-3]+'.2bpp', de.output) + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read()) + to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output) def append_terminator_to_lzs(directory): # fix lzs that were extracted with a missing terminator From d7757676513e9e02fc67d99a7c60c02f74344292 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 20 Mar 2013 22:55:09 -0400 Subject: [PATCH 009/112] Flesh out HRAM labels --- hram.asm | 50 +++++++++ joypad.asm | 54 +++++----- main.asm | 268 ++++++++++++++++++++++++------------------------ pokecrystal.asm | 1 + vblank.asm | 8 +- 5 files changed, 216 insertions(+), 165 deletions(-) create mode 100644 hram.asm diff --git a/hram.asm b/hram.asm new file mode 100644 index 000000000..fd9ed2134 --- /dev/null +++ b/hram.asm @@ -0,0 +1,50 @@ +hPushOAM EQU $ff80 + +hBuffer EQU $ff8b + +hRTCDayHi EQU $ff8d +hRTCDayLo EQU $ff8e +hRTCHours EQU $ff8f +hRTCMinutes EQU $ff90 +hRTCSeconds EQU $ff91 + +hHours EQU $ff94 + +hMinutes EQU $ff96 + +hSeconds EQU $ff98 + +hROMBank EQU $ff9d + +hJoypadReleased EQU $ffa2 +hJoypadPressed EQU $ffa3 +hJoypadDown EQU $ffa4 +hJoypadSum EQU $ffa5 +hJoyReleased EQU $ffa6 +hJoyPressed EQU $ffa7 +hJoyDown EQU $ffa8 + +hPastLeadingZeroes EQU $ffb3 + +hLCDStatCustom EQU $ffc6 + +hBGMapMode EQU $ffd4 +hBGMapThird EQU $ffd5 +hBGMapAddress EQU $ffd6 + +hOAMUpdate EQU $ffd8 +hSPBuffer EQU $ffd9 + +hBGMapUpdate EQU $ffdb + +hTileAnimFrame EQU $ffdf + +hRandomAdd EQU $ffe1 +hRandomSub EQU $ffe2 + +hBattleTurn EQU $ffe4 +hCGBPalUpdate EQU $ffe5 +hCGB EQU $ffe6 +hSGB EQU $ffe7 +hDMATransfer EQU $ffe8 + diff --git a/joypad.asm b/joypad.asm index 099bfbef6..b9702d33a 100644 --- a/joypad.asm +++ b/joypad.asm @@ -9,9 +9,9 @@ JoypadInt: ; 92e ClearJoypadPublic: ; 92f xor a ; Pressed this frame (delta) - ld [$ffa7], a + ld [hJoyPressed], a ; Currently pressed - ld [$ffa8], a + ld [hJoyDown], a ret ; 935 @@ -22,10 +22,10 @@ Joypad: ; 935 ; Updates: -; $ffa2: released this frame (delta) -; $ffa3: pressed this frame (delta) -; $ffa4: currently pressed -; $ffa5: pressed so far +; hJoypadReleased: released this frame (delta) +; hJoypadPressed: pressed this frame (delta) +; hJoypadDown: currently pressed +; hJoypadSum: pressed so far ; Any of these three bits can be used to disable input. ld a, [$cfbe] @@ -76,27 +76,27 @@ Joypad: ; 935 ld [rJOYP], a ; To get the delta we xor the last frame's input with the new one. - ld a, [$ffa4] ; last frame + ld a, [hJoypadDown] ; last frame ld e, a xor b ld d, a ; Released this frame: and e - ld [$ffa2], a + ld [hJoypadReleased], a ; Pressed this frame: ld a, d and b - ld [$ffa3], a + ld [hJoypadPressed], a ; Add any new presses to the list of collective presses: ld c, a - ld a, [$ffa5] + ld a, [hJoypadSum] or c - ld [$ffa5], a + ld [hJoypadSum], a ; Currently pressed: ld a, b - ld [$ffa4], a + ld [hJoypadDown], a ; Now that we have the input, we can do stuff with it. @@ -110,11 +110,11 @@ Joypad: ; 935 GetJoypadPublic: ; 984 -; Update mirror joypad input from $ffa4 (real input) +; Update mirror joypad input from hJoypadDown (real input) -; $ffa6: released this frame (delta) -; $ffa7: pressed this frame (delta) -; $ffa8: currently pressed +; hJoyReleased: released this frame (delta) +; hJoyPressed: pressed this frame (delta) +; hJoyDown: currently pressed ; bit 0 A ; 1 B @@ -137,28 +137,28 @@ GetJoypadPublic: ; 984 jr z, .auto ; To get deltas, take this and last frame's input. - ld a, [$ffa4] ; real input + ld a, [hJoypadDown] ; real input ld b, a - ld a, [$ffa8] ; last frame mirror + ld a, [hJoyDown] ; last frame mirror ld e, a ; Released this frame: xor b ld d, a and e - ld [$ffa6], a + ld [hJoyReleased], a ; Pressed this frame: ld a, d and b - ld [$ffa7], a + ld [hJoyPressed], a ; It looks like the collective presses got commented out here. ld c, a ; Currently pressed: ld a, b - ld [$ffa8], a ; frame input + ld [hJoyDown], a ; frame input .quit pop bc @@ -174,7 +174,7 @@ GetJoypadPublic: ; 984 ; A value of $ff will immediately end the stream. ; Read from the input stream. - ld a, [$ff9d] + ld a, [hROMBank] push af ld a, [AutoInputBank] rst Bankswitch @@ -232,8 +232,8 @@ GetJoypadPublic: ; 984 pop af rst Bankswitch ld a, b - ld [$ffa7], a ; pressed - ld [$ffa8], a ; input + ld [hJoyPressed], a ; pressed + ld [hJoyDown], a ; input jr .quit ; 9ee @@ -251,9 +251,9 @@ StartAutoInput: ; 9ee ld [AutoInputLength], a ; Reset input mirrors. xor a - ld [$ffa7], a ; pressed this frame - ld [$ffa6], a ; released this frame - ld [$ffa8], a ; currently pressed + ld [hJoyPressed], a ; pressed this frame + ld [hJoyReleased], a ; released this frame + ld [hJoyDown], a ; currently pressed ld a, AUTO_INPUT ld [InputType], a diff --git a/main.asm b/main.asm index e7204e98a..22f7e3b83 100644 --- a/main.asm +++ b/main.asm @@ -7,7 +7,7 @@ SECTION "rst8",HOME[$8] ; FarCall jp FarJpHl SECTION "rst10",HOME[$10] ; Bankswitch - ld [$ff9d], a + ld [hROMBank], a ld [$2000], a ret @@ -219,7 +219,7 @@ UpdateTime: ; 5a7 ; 5b7 GetClock: ; 5b7 -; store clock data in $ff8d-$ff91 +; store clock data in hRTCDayHi-hRTCSeconds ; enable clock r/w ld a, $a @@ -236,25 +236,25 @@ GetClock: ; 5b7 ld [hl], $8 ; S ld a, [de] and $3f - ld [$ff91], a + ld [hRTCSeconds], a ; minutes ld [hl], $9 ; M ld a, [de] and $3f - ld [$ff90], a + ld [hRTCMinutes], a ; hours ld [hl], $a ; H ld a, [de] and $1f - ld [$ff8f], a + ld [hRTCHours], a ; day lo ld [hl], $b ; DL ld a, [de] - ld [$ff8e], a + ld [hRTCDayLo], a ; day hi ld [hl], $c ; DH ld a, [de] - ld [$ff8d], a + ld [hRTCDayHi], a ; cleanup call CloseSRAM ; unlatch clock, disable clock r/w @@ -267,16 +267,16 @@ FixDays: ; 5e8 ; mod by 140 ; check if day count > 255 (bit 8 set) - ld a, [$ff8d] ; DH + ld a, [hRTCDayHi] ; DH bit 0, a jr z, .daylo ; reset dh (bit 8) res 0, a - ld [$ff8d], a ; DH + ld [hRTCDayHi], a ; DH ; mod 140 ; mod twice since bit 8 (DH) was set - ld a, [$ff8e] ; DL + ld a, [hRTCDayLo] ; DL .modh sub 140 jr nc, .modh @@ -286,7 +286,7 @@ FixDays: ; 5e8 add 140 ; update dl - ld [$ff8e], a ; DL + ld [hRTCDayLo], a ; DL ; unknown output ld a, $40 ; %1000000 @@ -294,7 +294,7 @@ FixDays: ; 5e8 .daylo ; quit if fewer than 140 days have passed - ld a, [$ff8e] ; DL + ld a, [hRTCDayLo] ; DL cp 140 jr c, .quit @@ -305,7 +305,7 @@ FixDays: ; 5e8 add 140 ; update dl - ld [$ff8e], a ; DL + ld [hRTCDayLo], a ; DL ; unknown output ld a, $20 ; %100000 @@ -327,10 +327,10 @@ FixDays: ; 5e8 FixTime: ; 61d ; add ingame time (set at newgame) to current time ; day hr min sec -; store time in CurDay, $ff94, $ff96, $ff98 +; store time in CurDay, hHours, hMinutes, hSeconds ; second - ld a, [$ff91] ; S + ld a, [hRTCSeconds] ; S ld c, a ld a, [StartSecond] add c @@ -338,11 +338,11 @@ FixTime: ; 61d jr nc, .updatesec add 60 .updatesec - ld [$ff98], a + ld [hSeconds], a ; minute ccf ; carry is set, so turn it off - ld a, [$ff90] ; M + ld a, [hRTCMinutes] ; M ld c, a ld a, [StartMinute] adc c @@ -350,11 +350,11 @@ FixTime: ; 61d jr nc, .updatemin add 60 .updatemin - ld [$ff96], a + ld [hMinutes], a ; hour ccf ; carry is set, so turn it off - ld a, [$ff8f] ; H + ld a, [hRTCHours] ; H ld c, a ld a, [StartHour] adc c @@ -362,11 +362,11 @@ FixTime: ; 61d jr nc, .updatehr add 24 .updatehr - ld [$ff94], a + ld [hHours], a ; day ccf ; carry is set, so turn it off - ld a, [$ff8e] ; DL + ld a, [hRTCDayLo] ; DL ld c, a ld a, [StartDay] adc c @@ -399,23 +399,23 @@ SetClock: ; 691 ; seconds ld [hl], $8 ; S - ld a, [$ff91] + ld a, [hRTCSeconds] ld [de], a ; minutes ld [hl], $9 ; M - ld a, [$ff90] + ld a, [hRTCMinutes] ld [de], a ; hours ld [hl], $a ; H - ld a, [$ff8f] + ld a, [hRTCHours] ld [de], a ; day lo ld [hl], $b ; DL - ld a, [$ff8e] + ld a, [hRTCDayLo] ld [de], a ; day hi ld [hl], $c ; DH - ld a, [$ff8d] + ld a, [hRTCDayHi] res 6, a ; make sure timer is active ld [de], a @@ -438,7 +438,7 @@ FarDecompress: ; b40 ; put a away for a sec ld [$c2c4], a ; save bank - ld a, [$ff9d] + ld a, [hROMBank] push af ; bankswitch ld a, [$c2c4] @@ -808,14 +808,14 @@ UpdatePalsIfCGB: ; c2f ; return carry if successful ; check cgb - ld a, [$ffe6] + ld a, [hCGB] and a ret z UpdateCGBPals: ; c33 ; return carry if successful ; any pals to update? - ld a, [$ffe5] + ld a, [hCGBPalUpdate] and a ret z @@ -924,7 +924,7 @@ ForceUpdateCGBPals: ; c37 ld [rSVBK], a ; clear pal update queue xor a - ld [$ffe5], a + ld [hCGBPalUpdate], a ; successfully updated palettes scf ret @@ -939,7 +939,7 @@ DmgToCgbBGPals: ; c9f push af ; check cgb - ld a, [$ffe6] + ld a, [hCGB] and a jr z, .end @@ -964,7 +964,7 @@ DmgToCgbBGPals: ; c9f call CopyPals ; request pal update ld a, $1 - ld [$ffe5], a + ld [hCGBPalUpdate], a ; restore wram bank pop af ld [$ff70], a @@ -988,7 +988,7 @@ DmgToCgbObjPals: ; ccb ld [rOBP1], a ; check cgb - ld a, [$ffe6] + ld a, [hCGB] and a ret z @@ -1015,7 +1015,7 @@ DmgToCgbObjPals: ; ccb call CopyPals ; request pal update ld a, $1 - ld [$ffe5], a + ld [hCGBPalUpdate], a ; restore wram bank pop af ld [$ff70], a @@ -1083,10 +1083,10 @@ INCBIN "baserom.gbc",$d79,$e8d - $d79 ; copy bc bytes from a:hl to de FarCopyBytes: ; e8d - ld [$ff8b], a - ld a, [$ff9d] ; save old bank + ld [hBuffer], a + ld a, [hROMBank] ; save old bank push af - ld a, [$ff8b] + ld a, [hBuffer] rst Bankswitch call CopyBytes pop af @@ -1096,10 +1096,10 @@ FarCopyBytes: ; e8d ; copy bc*2 source bytes from a:hl to de, doubling each byte in process FarCopyBytesDouble: ; e9b - ld [$ff8b], a - ld a, [$ff9d] ; save current bank + ld [hBuffer], a + ld a, [hROMBank] ; save current bank push af - ld a, [$ff8b] + ld a, [hBuffer] rst Bankswitch ; bankswitch ld a, h ; switcheroo, de <> hl ld h, d @@ -1332,7 +1332,7 @@ CheckDict: INCBIN "baserom.gbc",$117b,$1203 - $117b Char5D: - ld a, [$ffe4] + ld a, [hBattleTurn] push de and a jr nz, .asm_120e ; 0x1207 $5 @@ -1422,14 +1422,14 @@ DMATransfer: ; 15d8 ; return carry if successful ; anything to transfer? - ld a, [$ffe8] + ld a, [hDMATransfer] and a ret z ; start transfer ld [rHDMA5], a ; indicate that transfer has occurred xor a - ld [$ffe8], a + ld [hDMATransfer], a ; successful transfer scf ret @@ -1443,14 +1443,14 @@ UpdateBGMapBuffer: ; 15e3 ; return carry if successful ; any tiles to update? - ld a, [$ffdb] + ld a, [hBGMapUpdate] and a ret z ; save wram bank ld a, [rVBK] push af ; save sp - ld [$ffd9], sp + ld [hSPBuffer], sp ; temp stack ld hl, BGMapBufferPtrs @@ -1531,7 +1531,7 @@ UpdateBGMapBuffer: ; 15e3 ; restore sp - ld a, [$ffd9] + ld a, [hSPBuffer] ld l, a ld a, [$ffda] ld h, a @@ -1543,7 +1543,7 @@ UpdateBGMapBuffer: ; 15e3 ; we don't need to update bg map until new tiles are loaded xor a - ld [$ffdb], a + ld [hBGMapUpdate], a ; successfully updated bg map scf @@ -1552,12 +1552,12 @@ UpdateBGMapBuffer: ; 15e3 WaitTop: ; 163a - ld a, [$ffd4] + ld a, [hBGMapMode] and a ret z ; wait until top third of bg map can be updated - ld a, [$ffd5] + ld a, [hBGMapThird] and a jr z, .quit @@ -1566,14 +1566,14 @@ WaitTop: ; 163a .quit xor a - ld [$ffd4], a + ld [hBGMapMode], a ret ; 164c UpdateBGMap: ; 164c ; get mode - ld a, [$ffd4] + ld a, [hBGMapMode] and a ret z @@ -1585,7 +1585,7 @@ UpdateBGMap: ; 164c dec a ; ? ; save bg map address - ld a, [$ffd6] + ld a, [hBGMapAddress] ld l, a ld a, [$ffd7] ld h, a @@ -1593,12 +1593,12 @@ UpdateBGMap: ; 164c ; bg map 1 ($9c00) xor a - ld [$ffd6], a + ld [hBGMapAddress], a ld a, $9c ld [$ffd7], a ; get mode again - ld a, [$ffd4] + ld a, [hBGMapMode] push af cp 3 call z, .tiles @@ -1609,7 +1609,7 @@ UpdateBGMap: ; 164c ; restore bg map address pop hl ld a, l - ld [$ffd6], a + ld [hBGMapAddress], a ld a, h ld [$ffd7], a ret @@ -1632,10 +1632,10 @@ UpdateBGMap: ; 164c .getthird ; save sp - ld [$ffd9], sp + ld [hSPBuffer], sp ; # tiles to move down * 6 (which third?) - ld a, [$ffd5] + ld a, [hBGMapThird] and a ; 0 jr z, .top dec a ; 1 @@ -1650,7 +1650,7 @@ UpdateBGMap: ; 164c ; get bg map address ld a, [$ffd7] ld h, a - ld a, [$ffd6] + ld a, [hBGMapAddress] ld l, a ; move 12 tiles down ld de, $0180 ; bgm(0,12) @@ -1668,7 +1668,7 @@ UpdateBGMap: ; 164c ; get bg map address ld a, [$ffd7] ld h, a - ld a, [$ffd6] + ld a, [hBGMapAddress] ld l, a ; move 6 tiles down ld de, $00c0 ; bgm(0,6) @@ -1683,14 +1683,14 @@ UpdateBGMap: ; 164c ; get bg map address ld a, [$ffd7] ld h, a - ld a, [$ffd6] + ld a, [hBGMapAddress] ld l, a ; start at middle next time ld a, 1 .start ; which third to draw next update - ld [$ffd5], a + ld [hBGMapThird], a ; # rows per third ld a, 6 ; SCREEN_HEIGHT / 3 ; # tiles from the edge of the screen to the next row @@ -1754,7 +1754,7 @@ UpdateBGMap: ; 164c jr nz, .row ; restore sp - ld a, [$ffd9] + ld a, [hSPBuffer] ld l, a ld a, [$ffda] ld h, a @@ -1780,7 +1780,7 @@ SafeLoadTiles2: ; 170a GetTiles2: ; 1717 ; load [$cf6c] tiles from [$cf6d-e] to [$cf6f-70] ; save sp - ld [$ffd9], sp + ld [hSPBuffer], sp ; sp = [$cf6d-e] tile source ld hl, $cf6d @@ -1856,7 +1856,7 @@ GetTiles2: ; 1717 ld [$cf6d], sp ; restore sp - ld a, [$ffd9] + ld a, [hSPBuffer] ld l, a ld a, [$ffda] ld h, a @@ -1892,7 +1892,7 @@ GetTiles: ; 177d ; load [$cf67] tiles from [$cf68-9] to [$cf6a-b] ; save sp - ld [$ffd9], sp + ld [hSPBuffer], sp ; sp = [$cf68-9] tile source ld hl, $cf68 @@ -1971,7 +1971,7 @@ GetTiles: ; 177d ld [$cf68], sp ; restore sp - ld a, [$ffd9] + ld a, [hSPBuffer] ld l, a ld a, [$ffda] ld h, a @@ -1997,7 +1997,7 @@ SafeTileAnimation: ; 17d3 ; save affected banks ; switch to new banks - ld a, [$ff9d] + ld a, [hROMBank] push af ; save bank ld a, BANK(DoTileAnimation) rst Bankswitch ; bankswitch @@ -2036,7 +2036,7 @@ GetTileType: ; 185d ld e, a ld d, $00 add hl, de - ld a, [$ff9d] ; current bank + ld a, [hROMBank] ; current bank push af ld a, BANK(TileTypeTable) rst Bankswitch @@ -2252,7 +2252,7 @@ GetScriptByte: ; 0x26d4 push hl push bc - ld a, [$ff9d] + ld a, [hROMBank] push af ld a, [ScriptBank] @@ -2342,7 +2342,7 @@ GetMapHeaderMember: ; 0x2c04 GetAnyMapHeaderMember: ; 0x2c0c ; bankswitch - ld a, [$ff9d] + ld a, [hROMBank] push af ld a, BANK(MapGroupPointers) rst Bankswitch @@ -2396,10 +2396,10 @@ FarJpHl: ; 2d63 ; Preserves all registers besides a. ; Switch to the new bank. - ld [$ff8b], a - ld a, [$ff9d] + ld [hBuffer], a + ld a, [hROMBank] push af - ld a, [$ff8b] + ld a, [hBuffer] rst Bankswitch call .hl @@ -2451,7 +2451,7 @@ Predef: ; 2d83 ld [$cfb4], a ; save bank - ld a, [$ff9d] ; current bank + ld a, [hROMBank] ; current bank push af ; get Predef function to call @@ -2595,15 +2595,15 @@ RNG: ; 2f8c ; Added value ld a, [rDIV] ld b, a - ld a, [$ffe1] + ld a, [hRandomAdd] adc b - ld [$ffe1], a + ld [hRandomAdd], a ; Subtracted value ld a, [rDIV] ld b, a - ld a, [$ffe2] + ld a, [hRandomSub] sbc b - ld [$ffe2], a + ld [hRandomSub], a pop bc ret ; 2f9f @@ -2614,7 +2614,7 @@ FarBattleRNG: ; 2f9f ; allowing link battles to remain in sync using a shared PRNG. ; Save bank - ld a, [$ff9d] ; bank + ld a, [hROMBank] ; bank push af ; Bankswitch ld a, BANK(BattleRNG) @@ -2642,7 +2642,7 @@ Function2fb1: ; 2fb1 push bc .asm_2fbb call $2f8c - ld a, [$ffe1] + ld a, [hRandomAdd] ld c, a add b jr c, .asm_2fbb @@ -2775,31 +2775,31 @@ ByteFill: ; 0x3041 GetFarByte: ; 0x304d ; retrieve a single byte from a:hl, and return it in a. ; bankswitch to new bank - ld [$ff8b], a - ld a, [$ff9d] + ld [hBuffer], a + ld a, [hROMBank] push af - ld a, [$ff8b] + ld a, [hBuffer] rst Bankswitch ; get byte from new bank ld a, [hl] - ld [$ff8b], a + ld [hBuffer], a ; bankswitch to previous bank pop af rst Bankswitch ; return retrieved value in a - ld a, [$ff8b] + ld a, [hBuffer] ret GetFarHalfword: ; 0x305d ; retrieve a halfword from a:hl, and return it in hl. ; bankswitch to new bank - ld [$ff8b], a - ld a, [$ff9d] + ld [hBuffer], a + ld a, [hROMBank] push af - ld a, [$ff8b] + ld a, [hBuffer] rst Bankswitch ; get halfword from new bank, put it in hl @@ -2926,7 +2926,7 @@ PrintLetterDelay: ; 313d push bc ; save oam update status - ld hl, $ffd8 + ld hl, hOAMUpdate ld a, [hl] push af ; orginally turned oam update off, commented out @@ -2957,7 +2957,7 @@ PrintLetterDelay: ; 313d jr nz, .wait ; wait one frame if holding a - ld a, [$ffa8] ; joypad + ld a, [hJoyDown] ; joypad bit 0, a ; A jr z, .checkb jr .delay @@ -2981,7 +2981,7 @@ PrintLetterDelay: ; 313d .end ; restore oam update flag (not touched in this fn anymore) pop af - ld [$ffd8], a + ld [hOAMUpdate], a pop bc pop de pop hl @@ -3026,7 +3026,7 @@ WhiteBGMap: ; 31f3 WaitBGMap: ; 31f6 ; Tell VBlank to update BG Map ld a, 1 ; BG Map 0 tiles - ld [$ffd4], a + ld [hBGMapMode], a ; Wait for it to do its magic ld c, 4 call DelayFrames @@ -3039,7 +3039,7 @@ ClearPalettes: ; 3317 ; Make all palettes white ; For CGB we make all the palette colors white - ld a, [$ffe6] + ld a, [hCGB] and a jr nz, .cgb @@ -3067,7 +3067,7 @@ ClearPalettes: ; 3317 ld [$ff70], a ; Request palette update ld a, 1 - ld [$ffe5], a + ld [hCGBPalUpdate], a ret ; 333e @@ -3077,12 +3077,12 @@ GetSGBLayout: ; 3340 ; load sgb packets unless dmg ; check cgb - ld a, [$ffe6] + ld a, [hCGB] and a jr nz, .dosgb ; check sgb - ld a, [$ffe7] + ld a, [hSGB] and a ret z @@ -3132,7 +3132,7 @@ NamesPointerTable: ; 33ab dbw $04, $4b52 GetName: ; 33c3 - ld a, [$ff9d] + ld a, [hROMBank] push af push hl push bc @@ -3230,7 +3230,7 @@ GetBaseStats: ; 3856 push hl ; Save bank - ld a, [$ff9d] + ld a, [hROMBank] push af ; Bankswitch ld a, BANK(BaseStats) @@ -3422,12 +3422,12 @@ LoadMusicByte: ; 3b86 ; input: ; a: bank ; de: address - ld [$ff9d], a + ld [hROMBank], a ld [$2000], a ; bankswitch ld a, [de] ld [CurMusicByte], a ld a, $3a ; manual bank restore - ld [$ff9d], a + ld [hROMBank], a ld [$2000], a ; bankswitch ret ; 3b97 @@ -3439,10 +3439,10 @@ StartMusic: ; 3b97 push de push bc push af - ld a, [$ff9d] ; save bank + ld a, [hROMBank] ; save bank push af ld a, BANK(LoadMusic) - ld [$ff9d], a + ld [hROMBank], a ld [$2000], a ; bankswitch ld a, e ; song number and a @@ -3453,7 +3453,7 @@ StartMusic: ; 3b97 call SoundRestart .end pop af - ld [$ff9d], a ; restore bank + ld [hROMBank], a ; restore bank ld [$2000], a pop af pop bc @@ -3473,12 +3473,12 @@ PlayCryHeader: ; 3be3 push af ; Save current bank - ld a, [$ff9d] + ld a, [hROMBank] push af ; Cry headers are stuck in one bank. ld a, BANK(CryHeaders) - ld [$ff9d], a + ld [hROMBank], a ld [$2000], a ; Each header is 6 bytes long: @@ -3511,13 +3511,13 @@ PlayCryHeader: ; 3be3 ; That's it for the header ld a, BANK(PlayCry) - ld [$ff9d], a + ld [hROMBank], a ld [$2000], a call PlayCry ; Restore bank pop af - ld [$ff9d], a + ld [hROMBank], a ld [$2000], a pop af @@ -3544,16 +3544,16 @@ StartSFX: ; 3c23 cp e jr c, .quit .asm_3c32 - ld a, [$ff9d] ; save bank + ld a, [hROMBank] ; save bank push af ld a, $3a ; music bank - ld [$ff9d], a + ld [hROMBank], a ld [$2000], a ; bankswitch ld a, e ld [CurSFX], a call LoadSFX pop af - ld [$ff9d], a ; restore bank + ld [hROMBank], a ; restore bank ld [$2000], a ; bankswitch .quit pop af @@ -3723,7 +3723,7 @@ TitleScreenEntrance: ; 62bc ld hl, $cf63 inc [hl] xor a - ld [$ffc6], a + ld [hLCDStatCustom], a ; Play the title screen music. ld de, MUSIC_TITLE @@ -4326,11 +4326,11 @@ INCBIN "baserom.gbc",$c472,$c478 - $c472 SpecialGameboyCheck: ; c478 ; check cgb - ld a, [$ffe6] + ld a, [hCGB] and a jr nz, .cgb ; check sgb - ld a, [$ffe7] + ld a, [hSGB] and a jr nz, .sgb ; gb @@ -4376,7 +4376,7 @@ PrintNumber_AdvancePointer: ; c64a jr nz, .incrementPointer\@ bit 6, d ; left alignment or right alignment? jr z, .incrementPointer\@ - ld a, [$ffb3] ; was H_PASTLEADINGZEROES + ld a, [hPastLeadingZeroes] and a ret z .incrementPointer\@ @@ -4898,7 +4898,7 @@ INCBIN "baserom.gbc",$14000,$14032 - $14000 GetTimeOfDay: ; 14032 ; get time of day based on the current hour - ld a, [$ff94] ; hour + ld a, [hHours] ; hour ld hl, TimeOfDayTable .check @@ -6538,7 +6538,7 @@ BattleStartMessage: xor a ld [$cfca], a ld a, $1 - ld [$ffe4], a + ld [hBattleTurn], a ld a, $1 ld [$c689], a ld de, $0101 @@ -7614,7 +7614,7 @@ INCBIN "baserom.gbc",$4e226,$4e33a - $4e226 EggStatsScreen: ; 4e33a xor a - ld [$ffd4], a + ld [hBGMapMode], a ld hl, $cda1 call $334e ; SetHPPal ld b, $3 @@ -7706,7 +7706,7 @@ WritePartyMenuTilemap: ; 0x5005f push af set 4, [hl] ; Disable text delay xor a - ld [$ffd4], a + ld [hBGMapMode], a ld hl, TileMap ld bc, $0168 ld a, " " @@ -10090,7 +10090,7 @@ INCBIN "baserom.gbc",$8c15e,$8c17c - $8c15e GetTimePalFade: ; 8c17c ; check cgb - ld a, [$ffe6] + ld a, [hCGB] and a jr nz, .cgb @@ -11000,18 +11000,18 @@ TownMapBGUpdate: ; 91ee4 ; BG Map address ld a, l - ld [$ffd6], a + ld [hBGMapAddress], a ld a, h ld [$ffd7], a ; Only update palettes on CGB - ld a, [$ffe6] + ld a, [hCGB] and a jr z, .tiles ; BG Map mode 2 (palettes) ld a, 2 - ld [$ffd4], a + ld [hBGMapMode], a ; The BG Map is updated in thirds, so we wait ; 3 frames to update the whole screen's palettes. @@ -11024,7 +11024,7 @@ TownMapBGUpdate: ; 91ee4 ; Turn off BG Map update xor a - ld [$ffd4], a + ld [hBGMapMode], a ret ; 91eff @@ -13751,10 +13751,10 @@ DoTileAnimation: ; fc000 ld d, a ; Play this frame. - ld a, [$ffdf] ; frame count + ld a, [hTileAnimFrame] ; frame count ld l, a inc a - ld [$ffdf], a + ld [hTileAnimFrame], a ; Each pointer has: ld h, 0 @@ -13978,7 +13978,7 @@ Tileset36Anim: ; 0xfc2e7 DoneTileAnimation: ; fc2fb ; Reset the animation command loop. xor a - ld [$ffdf], a + ld [hTileAnimFrame], a WaitTileAnimation: ; fc2fe ; Do nothing this frame. @@ -14050,7 +14050,7 @@ AnimateFlowerTile: ; fc56d ld e, a ; CGB has different color mappings for flowers. - ld a, [$ffe6] + ld a, [hCGB] and 1 add e @@ -14194,7 +14194,7 @@ TileAnimationPalette: ; fc6d7 ; Transition between color values 0-2 for color 0 in palette 3. ; No palette changes on DMG. - ld a, [$ffe6] + ld a, [hCGB] and a ret z @@ -14367,7 +14367,7 @@ StartTitleScreen: ; 10ed67 ; Turn BG Map update off xor a - ld [$ffd4], a + ld [hBGMapMode], a ; Reset timing variables ld hl, $cf63 @@ -14552,7 +14552,7 @@ StartTitleScreen: ; 10ed67 ; Let LCD Stat know we're messing around with SCX ld a, rSCX - rJOYP - ld [$ffc6], a + ld [hLCDStatCustom], a ; Restore WRAM bank pop af @@ -14579,10 +14579,10 @@ StartTitleScreen: ; 10ed67 ld [$ffd2], a ld a, $1 - ld [$ffe5], a + ld [hCGBPalUpdate], a ; Update BG Map 0 (bank 0) - ld [$ffd4], a + ld [hBGMapMode], a xor a ld [$d002], a @@ -14869,7 +14869,7 @@ Function117b31: jp Function117cdd Function117b4f: - ld a, [$ffa7] + ld a, [hJoyPressed] cp $2 jr z, .asm_117ba4 ; 0x117b53 $4f cp $1 @@ -14927,7 +14927,7 @@ Function117b4f: Function117bb6: call Function117c89 ld a, $1 - ld [$ffd4], a + ld [hBGMapMode], a ld a, $46 ld hl, $4284 rst FarCall diff --git a/pokecrystal.asm b/pokecrystal.asm index fe71bfa29..0155e0ca9 100644 --- a/pokecrystal.asm +++ b/pokecrystal.asm @@ -1,4 +1,5 @@ INCLUDE "wram.asm" INCLUDE "constants.asm" INCLUDE "gbhw.asm" +INCLUDE "hram.asm" INCLUDE "main.tx" diff --git a/vblank.asm b/vblank.asm index 8201c1e5c..5080a56ad 100644 --- a/vblank.asm +++ b/vblank.asm @@ -128,7 +128,7 @@ VBlank0: ; 2b1 jr nz, .vblankoccurred ; update oam by dma transfer - call $ff80 + call hPushOAM ; 403f: ; ld a, $c4 ; ld [rDMA], a @@ -230,7 +230,7 @@ VBlank1: ; 337 call UpdateBGMap call LoadTiles ; update oam by dma transfer - call $ff80 + call hPushOAM ; 403f: ; ld a, $c4 ; ld [rDMA], a @@ -339,7 +339,7 @@ VBlank3: ; 396 call LoadTiles ; update oam by dma transfer - call $ff80 + call hPushOAM ; 403f: ; ld a, $c4 ; Sprites / $100 ; ld [rDMA], a @@ -411,7 +411,7 @@ VBlank4: ; 3df call SafeLoadTiles ; update oam by dma transfer - call $ff80 + call hPushOAM ; 403f: ; ld a, $c4 ; ld [rDMA], a From f0346a9982ed2cda3f8d0aa5f14cfb1b8b84602e Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 22 Mar 2013 04:08:47 -0400 Subject: [PATCH 010/112] various minor additions -battle variable constants -step counters -turn update fns --- constants.asm | 26 ++++++++++++++++++++++++++ main.asm | 16 +++++++++++++++- wram.asm | 11 +++++++---- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/constants.asm b/constants.asm index 8a3d4d080..03df937c1 100644 --- a/constants.asm +++ b/constants.asm @@ -3249,6 +3249,8 @@ MUSIC_SUICUNE_BATTLE EQU 100 MUSIC_BATTLE_TOWER_LOBBY EQU 101 MUSIC_MOBILE_CENTER EQU 102 +MUSIC_MAHOGANY_MART EQU 100 ; grandfathered from gold + ; sound _4CH1 EQU $c0 _3CH1 EQU $80 @@ -3416,6 +3418,30 @@ BATTLETYPE_FORCEITEM EQU $0a BATTLETYPE_SUICUNE EQU $0c +; battle variables +BATTLE_VARS_SUBSTATUS1 EQU 0 +BATTLE_VARS_SUBSTATUS2 EQU 1 +BATTLE_VARS_SUBSTATUS3 EQU 2 +BATTLE_VARS_SUBSTATUS4 EQU 3 +BATTLE_VARS_SUBSTATUS5 EQU 4 +BATTLE_VARS_SUBSTATUS1_OPP EQU 5 +BATTLE_VARS_SUBSTATUS2_OPP EQU 6 +BATTLE_VARS_SUBSTATUS3_OPP EQU 7 +BATTLE_VARS_SUBSTATUS4_OPP EQU 8 +BATTLE_VARS_SUBSTATUS5_OPP EQU 9 +BATTLE_VARS_STATUS EQU 10 +BATTLE_VARS_STATUS_OPP EQU 11 +BATTLE_VARS_MOVE_ANIM EQU 12 +BATTLE_VARS_MOVE_EFFECT EQU 13 +BATTLE_VARS_MOVE_POWER EQU 14 +BATTLE_VARS_MOVE_TYPE EQU 15 +BATTLE_VARS_MOVE EQU 16 +BATTLE_VARS_LAST_COUNTER_MOVE EQU 17 +BATTLE_VARS_LAST_COUNTER_MOVE_OPP EQU 18 +BATTLE_VARS_LAST_MOVE EQU 19 +BATTLE_VARS_LAST_MOVE_OPP EQU 20 + + ; joypad BUTTONS EQU %00010000 D_PAD EQU %00100000 diff --git a/main.asm b/main.asm index 22f7e3b83..2eb22f10d 100644 --- a/main.asm +++ b/main.asm @@ -3415,7 +3415,21 @@ GetPartyLocation: ; 3927 jp AddNTimes ; 392d -INCBIN "baserom.gbc",$392d,$3b86 - $392d +INCBIN "baserom.gbc", $392d, $3985 - $392d + +SetPlayerTurn: ; 3985 + xor a + ld [hBattleTurn], a + ret +; 3989 + +SetEnemyTurn: ; 3989 + ld a, 1 + ld [hBattleTurn], a + ret +; 398e + +INCBIN "baserom.gbc", $398e, $3b86 - $398e LoadMusicByte: ; 3b86 ; load music data into CurMusicByte diff --git a/wram.asm b/wram.asm index a693e28c7..444856409 100644 --- a/wram.asm +++ b/wram.asm @@ -565,10 +565,8 @@ EnemyDamageTaken: ; c684 BattleScriptBuffer: ; c68a ds 40 -BattleScriptBufferLocLo: ; c6b2 - ds 1 -BattleScriptBufferLocHi: ; c6b3 - ds 1 +BattleScriptBufferLoc: ; c6b2 + ds 2 ds 25 @@ -1286,6 +1284,11 @@ Box13Name: ; dbe1 Box14Name: ; dbea ds 9 +SECTION "steps", BSS[$dc73] +StepCount: ; dc73 + ds 1 +PoisonStepCount: ; dc74 + ds 1 SECTION "FlypointPermissions", BSS[$dca5] FlypointPerms: ; dca5 From 87c36ebbc0504cea089ef484b0c6d61b640ced1e Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 22 Mar 2013 04:16:49 -0400 Subject: [PATCH 011/112] Fishing encounter data and related asm --- main.asm | 9 +- stats/wild/fish.asm | 502 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 510 insertions(+), 1 deletion(-) create mode 100644 stats/wild/fish.asm diff --git a/main.asm b/main.asm index 2eb22f10d..52f7109a7 100644 --- a/main.asm +++ b/main.asm @@ -11214,7 +11214,14 @@ INCBIN "baserom.gbc", $91fff, $92168 - $91fff KantoMap: INCBIN "baserom.gbc", $92168, $922d1 - $92168 -INCBIN "baserom.gbc", $922d1, $93a31 - $922d1 + +INCBIN "baserom.gbc", $922d1, $92402 - $922d1 + + +INCLUDE "stats/wild/fish.asm" + + +INCBIN "baserom.gbc", $926c7, $93a31 - $926c7 SECTION "bank25",DATA,BANK[$25] diff --git a/stats/wild/fish.asm b/stats/wild/fish.asm new file mode 100644 index 000000000..75f49d6c4 --- /dev/null +++ b/stats/wild/fish.asm @@ -0,0 +1,502 @@ +FishAction: ; 92402 +; Using a fishing rod. +; Fish for monsters with rod e in encounter group d. +; Return monster e at level d. + + push af + push bc + push hl + +; Get the fishing group for this map. + ld b, e + call GetFishGroupHeader + + ld hl, FishGroupHeaders + ; encounter chance + add hl, de + ; pointer to old rod data + add hl, de + add hl, de + ; pointer to good rod data + add hl, de + add hl, de + ; pointer to super rod data + add hl, de + add hl, de + + call Fish + + pop hl + pop bc + pop af + ret +; 9241a + + +Fish: ; 9241a +; Grandfathered from Red. + +; Fish for monsters with rod b from encounter data in FishGroup at hl. +; Return monster e at level d. + + call RNG + +; Got a bite? + cp [hl] + jr nc, .NoBite + +; Get encounter data by rod: +; 0: Old +; 1: Good +; 2: Super + inc hl + ld e, b + ld d, 0 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + +; Encounter chance for this monster: + call RNG + +.CheckEncounter + cp [hl] + jr z, .ReadMon + jr c, .ReadMon + +; Next monster... + inc hl + inc hl + inc hl + jr .CheckEncounter + +.ReadMon +; We're done with the encounter chance + inc hl + +; Species 0 triggers a read from a time-based encounter table. + ld a, [hli] + ld d, a + and a + call z, .TimeEncounter + +; Level + ld e, [hl] + ret + +.NoBite + ld de, 0 + ret + +.TimeEncounter + +; The level byte is repurposed as the index for the new table. + ld e, [hl] + ld d, 0 + ld hl, TimeFishGroups + add hl, de + add hl, de + add hl, de + add hl, de + +; One nightmon, then one daymon + ld a, [TimeOfDay] + and 3 + cp NITE + jr c, .TimeSpecies + inc hl + inc hl + +.TimeSpecies + ld d, [hl] + inc hl + ret +; 9245b + + + + +GetFishGroupHeader: ; 9245b +; Return fishing encounter group header d in de. + + push hl + ld hl, $dc1e + bit 2, [hl] + pop hl + jr z, .end + +; Groups 11 and 12 have special attributes. + ld a, d + cp 11 + jr z, .group11 + cp 12 + jr z, .group12 + +.end + dec d + ld e, d + ld d, 0 + ret + +.group11 + ld a, [$dfce] + cp 1 + jr nz, .end + ld d, 6 + jr .end + +.group12 + ld a, [$dfce] + cp 2 + jr nz, .end + ld d, 7 + jr .end +; 92488 + + +FishGroupHeaders: + +FishGroup1Header: ; 92488 + db $80 ; 50% + dw FishGroup1_Old + dw FishGroup1_Good + dw FishGroup1_Super + +FishGroup2Header: ; 9248f + db $80 ; 50% + dw FishGroup2_Old + dw FishGroup2_Good + dw FishGroup2_Super + +FishGroup3Header: ; 92496 + db $80 ; 50% + dw FishGroup3_Old + dw FishGroup3_Good + dw FishGroup3_Super + +FishGroup4Header: ; 9249d + db $80 ; 50% + dw FishGroup4_Old + dw FishGroup4_Good + dw FishGroup4_Super + +FishGroup5Header: ; 924a4 + db $80 ; 50% + dw FishGroup5_Old + dw FishGroup5_Good + dw FishGroup5_Super + +FishGroup6Header: ; 924ab + db $80 ; 50% + dw FishGroup6_Old + dw FishGroup6_Good + dw FishGroup6_Super + +FishGroup7Header: ; 924b2 + db $80 ; 50% + dw FishGroup7_Old + dw FishGroup7_Good + dw FishGroup7_Super + +FishGroup8Header: ; 924b9 + db $80 ; 50% + dw FishGroup8_Old + dw FishGroup8_Good + dw FishGroup8_Super + +FishGroup9Header: ; 924c0 + db $80 ; 50% + dw FishGroup9_Old + dw FishGroup9_Good + dw FishGroup9_Super + +FishGroup10Header: ; 924c7 + db $80 ; 50% + dw FishGroup10_Old + dw FishGroup10_Good + dw FishGroup10_Super + +FishGroup11Header: ; 924ce + db $80 ; 50% + dw FishGroup11_Old + dw FishGroup11_Good + dw FishGroup11_Super + +FishGroup12Header: ; 924d5 + db $80 ; 50% + dw FishGroup12_Old + dw FishGroup12_Good + dw FishGroup12_Super + +FishGroup13Header: ; 924dc + db $80 ; 50% + dw FishGroup11_Old + dw FishGroup11_Good + dw FishGroup11_Super + +FishGroup1: +FishGroup1_Old: ; 924e3 + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, KRABBY, 10 +FishGroup1_Good: ; 924ec + db $59, MAGIKARP, 20 + db $b2, KRABBY, 20 + db $e6, KRABBY, 20 + db $ff, $0, 0 +FishGroup1_Super: ; 924f8 + db $66, KRABBY, 40 + db $b2, $0, 1 + db $e6, KRABBY, 40 + db $ff, KINGLER, 40 + +FishGroup2: +FishGroup2_Old: ; 92504 + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, TENTACOOL, 10 +FishGroup2_Good: ; 9250d + db $59, MAGIKARP, 20 + db $b2, TENTACOOL, 20 + db $e6, CHINCHOU, 20 + db $ff, $0, 2 +FishGroup2_Super: ; 92519 + db $66, CHINCHOU, 40 + db $b2, $0, 3 + db $e6, TENTACRUEL, 40 + db $ff, LANTURN, 40 + +FishGroup3: +FishGroup3_Old: ; 92525 + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, GOLDEEN, 10 +FishGroup3_Good: ; 9252e + db $59, MAGIKARP, 20 + db $b2, GOLDEEN, 20 + db $e6, GOLDEEN, 20 + db $ff, $0, 4 +FishGroup3_Super: ; 9253a + db $66, GOLDEEN, 40 + db $b2, $0, 5 + db $e6, MAGIKARP, 40 + db $ff, SEAKING, 40 + +FishGroup4: +FishGroup4_Old: ; 92546 + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, POLIWAG, 10 +FishGroup4_Good: ; 9254f + db $59, MAGIKARP, 20 + db $b2, POLIWAG, 20 + db $e6, POLIWAG, 20 + db $ff, $0, 6 +FishGroup4_Super: ; 9255b + db $66, POLIWAG, 40 + db $b2, $0, 7 + db $e6, MAGIKARP, 40 + db $ff, POLIWAG, 40 + +FishGroup5: +FishGroup5_Old: ; 92567 + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, MAGIKARP, 10 +FishGroup5_Good: ; 92570 + db $59, MAGIKARP, 20 + db $b2, MAGIKARP, 20 + db $e6, MAGIKARP, 20 + db $ff, $0, 8 +FishGroup5_Super: ; 9257c + db $66, MAGIKARP, 40 + db $b2, $0, 9 + db $e6, MAGIKARP, 40 + db $ff, DRAGONAIR, 40 + +FishGroup6: +FishGroup6_Old: ; 92588 + db $b3, MAGIKARP, 5 + db $d9, MAGIKARP, 5 + db $ff, QWILFISH, 5 +FishGroup6_Good: ; 92591 + db $59, MAGIKARP, 20 + db $b2, QWILFISH, 20 + db $e6, QWILFISH, 20 + db $ff, $0, 10 +FishGroup6_Super: ; 9259d + db $66, QWILFISH, 40 + db $b2, $0, 11 + db $e6, QWILFISH, 40 + db $ff, QWILFISH, 40 + +FishGroup7: +FishGroup7_Old: ; 925a9 + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, REMORAID, 10 +FishGroup7_Good: ; 925b2 + db $59, MAGIKARP, 20 + db $b2, REMORAID, 20 + db $e6, REMORAID, 20 + db $ff, $0, 12 +FishGroup7_Super: ; 925be + db $66, REMORAID, 40 + db $b2, $0, 13 + db $e6, REMORAID, 40 + db $ff, REMORAID, 40 + +FishGroup8: +FishGroup8_Old: ; 925ca + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, MAGIKARP, 10 +FishGroup8_Good: ; 925d3 + db $59, MAGIKARP, 20 + db $b2, MAGIKARP, 20 + db $e6, MAGIKARP, 20 + db $ff, $0, 14 +FishGroup8_Super: ; 925df + db $66, MAGIKARP, 40 + db $b2, $0, 15 + db $e6, MAGIKARP, 40 + db $ff, MAGIKARP, 40 + +FishGroup9: +FishGroup9_Old: ; 925eb + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, MAGIKARP, 10 +FishGroup9_Good: ; 925f4 + db $59, MAGIKARP, 10 + db $b2, MAGIKARP, 10 + db $e6, MAGIKARP, 10 + db $ff, $0, 16 +FishGroup9_Super: ; 92600 + db $66, MAGIKARP, 10 + db $b2, $0, 17 + db $e6, MAGIKARP, 10 + db $ff, DRAGONAIR, 10 + +FishGroup10: +FishGroup10_Old: ; 9260c + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, KRABBY, 10 +FishGroup10_Good: ; 92615 + db $59, MAGIKARP, 20 + db $b2, KRABBY, 20 + db $e6, KRABBY, 20 + db $ff, $0, 18 +FishGroup10_Super: ; 92621 + db $66, KRABBY, 40 + db $b2, $0, 19 + db $e6, KINGLER, 40 + db $ff, SEADRA, 40 + +FishGroup11: +FishGroup11_Old: ; 9262d + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, TENTACOOL, 10 +FishGroup11_Good: ; 92636 + db $59, MAGIKARP, 20 + db $b2, TENTACOOL, 20 + db $e6, TENTACOOL, 20 + db $ff, $0, 20 +FishGroup11_Super: ; 92642 + db $66, TENTACOOL, 40 + db $b2, $0, 21 + db $e6, MAGIKARP, 40 + db $ff, QWILFISH, 40 + +FishGroup12: +FishGroup12_Old: ; 9264e + db $b3, MAGIKARP, 10 + db $d9, MAGIKARP, 10 + db $ff, POLIWAG, 10 +FishGroup12_Good: ; 92657 + db $59, MAGIKARP, 20 + db $b2, POLIWAG, 20 + db $e6, POLIWAG, 20 + db $ff, $0, 6 +FishGroup12_Super: ; 92663 + db $66, POLIWAG, 40 + db $b2, $0, 7 + db $e6, MAGIKARP, 40 + db $ff, REMORAID, 40 + +; 9266f + +TimeFishGroups: ; 9266f +; 0 + db CORSOLA, 20 ; nite + db STARYU, 20 ; day +; 1 + db CORSOLA, 40 ; nite + db STARYU, 40 ; day +; 2 + db SHELLDER, 20 ; nite + db SHELLDER, 20 ; day +; 3 + db SHELLDER, 40 ; nite + db SHELLDER, 40 ; day +; 4 + db GOLDEEN, 20 ; nite + db GOLDEEN, 20 ; day +; 5 + db GOLDEEN, 40 ; nite + db GOLDEEN, 40 ; day +; 6 + db POLIWAG, 20 ; nite + db POLIWAG, 20 ; day +; 7 + db POLIWAG, 40 ; nite + db POLIWAG, 40 ; day +; 8 + db DRATINI, 20 ; nite + db DRATINI, 20 ; day +; 9 + db DRATINI, 40 ; nite + db DRATINI, 40 ; day +; 10 + db QWILFISH, 20 ; nite + db QWILFISH, 20 ; day +; 11 + db QWILFISH, 40 ; nite + db QWILFISH, 40 ; day +; 12 + db REMORAID, 20 ; nite + db REMORAID, 20 ; day +; 13 + db REMORAID, 40 ; nite + db REMORAID, 40 ; day +; 14 + db GYARADOS, 20 ; nite + db GYARADOS, 20 ; day +; 15 + db GYARADOS, 40 ; nite + db GYARADOS, 40 ; day +; 16 + db DRATINI, 10 ; nite + db DRATINI, 10 ; day +; 17 + db DRATINI, 10 ; nite + db DRATINI, 10 ; day +; 18 + db HORSEA, 20 ; nite + db HORSEA, 20 ; day +; 19 + db HORSEA, 40 ; nite + db HORSEA, 40 ; day +; 20 + db TENTACOOL, 20 ; nite + db TENTACOOL, 20 ; day +; 21 + db TENTACOOL, 40 ; nite + db TENTACOOL, 40 ; day + +; 926c7 + From edfffec83190310e03e161542212af3b5a7f1547 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 26 Mar 2013 05:22:22 -0400 Subject: [PATCH 012/112] Various battle-related bank0 asm and wram/constants --- constants.asm | 16 +++ main.asm | 308 ++++++++++++++++++++++++++++++++++++++++++++++++-- wram.asm | 135 +++++++++++++++++++--- 3 files changed, 430 insertions(+), 29 deletions(-) diff --git a/constants.asm b/constants.asm index 03df937c1..b835db3cf 100644 --- a/constants.asm +++ b/constants.asm @@ -3442,6 +3442,22 @@ BATTLE_VARS_LAST_MOVE EQU 19 BATTLE_VARS_LAST_MOVE_OPP EQU 20 +; battle animations +; animations below fc are 1:1 with move constants +ANIM_CONFUSED EQU $103 +ANIM_SLEEP EQU $104 + +ANIM_INLOVE EQU $10a + + +WEATHER_RAIN EQU 1 +WEATHER_SUN EQU 2 +WEATHER_SANDSTORM EQU 3 +WEATHER_RAIN_END EQU 4 +WEATHER_SUN_END EQU 5 +WEATHER_SANDSTORM_END EQU 6 + + ; joypad BUTTONS EQU %00010000 D_PAD EQU %00100000 diff --git a/main.asm b/main.asm index 52f7109a7..91e74aa03 100644 --- a/main.asm +++ b/main.asm @@ -1128,6 +1128,7 @@ FarCopyBytesDouble: ; e9b INCBIN "baserom.gbc",$eba,$fc8 - $eba + ClearTileMap: ; fc8 ; Fill the tile map with blank tiles ld hl, TileMap @@ -1142,7 +1143,26 @@ ClearTileMap: ; fc8 jp WaitBGMap ; fdb -INCBIN "baserom.gbc",$fdb,$ff1 - $fdb + +INCBIN "baserom.gbc",$fdb,$fe8 - $fdb + + +TextBox: ; fe8 +; draw a text box of given location/size +; ? hl +; size bc +; ? de + +; draw border + push bc + push hl + call TextBoxBorder + pop hl + pop bc +; fill textbox area with palette 7 + jr TextBoxPalette +; ff1 + TextBoxBorder: ; ff1 ; draw a text box @@ -1197,11 +1217,62 @@ NPlaceChar: ; 0x101e ret ; 0x1024 -INCBIN "baserom.gbc",$1024,$1078 - $1024 -PlaceString: ; $1078 +TextBoxPalette: ; 1024 +; fill textbox area with pal 07 +; hl: tile address +; b: height +; c: width + ld de, AttrMap - TileMap + add hl, de + inc b + inc b + inc c + inc c + ld a, $07 ; palette +.gotoy + push bc push hl -PlaceNextChar: +.gotox + ld [hli], a + dec c + jr nz, .gotox + pop hl + ld de, $0014 ; screen width in tiles (20) + add hl, de + pop bc + dec b + jr nz, .gotoy + ret +; 103e + + +SpeechTextBox: ; 103e +; Standard textbox. + ld hl, $c590 ; tile 0, 12 + ld b, $4 ; height + ld c, $12 ; width ; SCREEN_WIDTH - 2 (border) + jp TextBox +; 1048 + + +INCBIN "baserom.gbc", $1048, $1065 - $1048 + + +PrintTextBoxText: ; 1065 + ld bc, $c5b9 ; TileMap(1,14) + call $13e5 ; PrintText + ret +; 106c + + +INCBIN "baserom.gbc", $106c, $1078 - $106c + + +PlaceString: ; 1078 + push hl + +PlaceNextChar: ; 1079 ld a, [de] cp "@" jr nz, CheckDict @@ -1215,7 +1286,7 @@ NextChar: ; 1083 inc de jp PlaceNextChar -CheckDict: +CheckDict: ; 1087 cp $15 jp z, $117b cp $4f @@ -3407,15 +3478,19 @@ GetPartyParamLocation: ; 3917 ; 3927 GetPartyLocation: ; 3927 -; Add the length of a PartyMon struct to hl a times -; input: -; a: partymon # -; hl: partymon struct - ld bc, $0030 ; PARTYMON_LENGTH +; Add the length of a PartyMon struct to hl a times. + ld bc, PartyMon2 - PartyMon1 jp AddNTimes ; 392d -INCBIN "baserom.gbc", $392d, $3985 - $392d +INCBIN "baserom.gbc", $392d, $397d - $392d + +ResetDamage: ; 397d + xor a + ld [CurDamage], a + ld [CurDamage + 1], a + ret +; 3985 SetPlayerTurn: ; 3985 xor a @@ -3429,7 +3504,216 @@ SetEnemyTurn: ; 3989 ret ; 398e -INCBIN "baserom.gbc", $398e, $3b86 - $398e +INCBIN "baserom.gbc", $398e, $39e1 - $398e + +CleanGetBattleVarPair: ; 39e1 +; Preserves hl. + push hl + call GetBattleVarPair + pop hl + ret +; 39e7 + +GetBattleVarPair: ; 39e7 +; Get variable from pair a, depending on whose turn it is. +; There are 21 variable pairs. + + push bc + +; get var pair + ld hl, .battlevarpairs + ld c, a + ld b, 0 + add hl, bc + add hl, bc + + ld a, [hli] + ld h, [hl] + ld l, a + +; Enemy turn uses the second byte instead. +; This lets battle variable calls be side-neutral. + ld a, [hBattleTurn] + and a + jr z, .getvar + inc hl + +.getvar +; get var id + ld a, [hl] + ld c, a + ld b, $0 + +; seek + ld hl, .vars + add hl, bc + add hl, bc + +; get var address + ld a, [hli] + ld h, [hl] + ld l, a + + ld a, [hl] + + pop bc + ret + + +.battlevarpairs + dw .substatus1 ; 0 + dw .substatus2 ; 1 + dw .substatus3 ; 2 + dw .substatus4 ; 3 + dw .substatus5 ; 4 + dw .substatus1opp ; 5 + dw .substatus2opp ; 6 + dw .substatus3opp ; 7 + dw .substatus4opp ; 8 + dw .substatus5opp ; 9 + dw .status ; a + dw .statusopp ; b + dw .animation ; c + dw .effect ; d + dw .power ; e + dw .type ; f + dw .curmove ; 10 + dw .lastcountermove ; 11 + dw .lastcountermoveopp ; 12 + dw .lastmove ; 13 + dw .lastmoveopp ; 14 + + ; player enemy +.substatus1 + db $00, $01 ; PLAYER_SUBSTATUS1, ENEMY_SUBSTATUS1 +.substatus1opp + db $01, $00 ; ENEMY_SUBSTATUS1, PLAYER_SUBSTATUS1 +.substatus2 + db $02, $03 ; PLAYER_SUBSTATUS2, ENEMY_SUBSTATUS2 +.substatus2opp + db $03, $02 ; ENEMY_SUBSTATUS2, PLAYER_SUBSTATUS2 +.substatus3 + db $04, $05 ; PLAYER_SUBSTATUS3, ENEMY_SUBSTATUS3 +.substatus3opp + db $05, $04 ; ENEMY_SUBSTATUS3, PLAYER_SUBSTATUS3 +.substatus4 + db $06, $07 ; PLAYER_SUBSTATUS4, ENEMY_SUBSTATUS4 +.substatus4opp + db $07, $06 ; ENEMY_SUBSTATUS4, PLAYER_SUBSTATUS4 +.substatus5 + db $08, $09 ; PLAYER_SUBSTATUS5, ENEMY_SUBSTATUS5 +.substatus5opp + db $09, $08 ; ENEMY_SUBSTATUS5, PLAYER_SUBSTATUS5 +.status + db $0a, $0b ; PLAYER_STATUS, ENEMY_STATUS +.statusopp + db $0b, $0a ; ENEMY_STATUS, PLAYER_STATUS +.animation + db $0c, $0d ; PLAYER_MOVE_ANIMATION, ENEMY_MOVE_ANIMATION +.effect + db $0e, $0f ; PLAYER_MOVE_EFFECT, ENEMY_MOVE_EFFECT +.power + db $10, $11 ; PLAYER_MOVE_POWER, ENEMY_MOVE_POWER +.type + db $12, $13 ; PLAYER_MOVE_TYPE, ENEMY_MOVE_TYPE +.curmove + db $14, $15 ; PLAYER_CUR_MOVE, ENEMY_CUR_MOVE +.lastcountermove + db $16, $17 ; ENEMY_LAST_COUNTER_MOVE, PLAYER_LAST_COUNTER_MOVE +.lastcountermoveopp + db $17, $16 ; PLAYER_LAST_COUNTER_MOVE, ENEMY_LAST_COUNTER_MOVE +.lastmove + db $18, $19 ; PLAYER_LAST_MOVE, ENEMY_LAST_MOVE +.lastmoveopp + db $19, $18 ; ENEMY_LAST_MOVE, PLAYER_LAST_MOVE + +.vars + dw PlayerSubStatus1 + dw EnemySubStatus1 + + dw PlayerSubStatus2 + dw EnemySubStatus2 + + dw PlayerSubStatus3 + dw EnemySubStatus3 + + dw PlayerSubStatus4 + dw EnemySubStatus4 + + dw PlayerSubStatus5 + dw EnemySubStatus5 + + dw BattleMonStatus + dw EnemyMonStatus + + dw PlayerMoveAnimation + dw EnemyMoveAnimation + + dw PlayerMoveEffect + dw EnemyMoveEffect + + dw PlayerMovePower + dw EnemyMovePower + + dw PlayerMoveType + dw EnemyMoveType + + dw CurPlayerMove + dw CurEnemyMove + + dw LastEnemyCounterMove + dw LastPlayerCounterMove + + dw LastPlayerMove + dw LastEnemyMove +; 3a90 + +INCBIN "baserom.gbc", $3a90, $3ab2 - $3a90 + + +MobileTextBorder: ; 3ab2 +; For mobile link battles only. + ld a, [InLinkBattle] + cp 4 + ret c +; Draw a cell phone icon at the top right corner of the border. + ld hl, $c5a3 ; TileMap(19,12) + ld [hl], $5e ; cell phone top + ld hl, $c5b7 ; TileMap(19,13) + ld [hl], $5f ; cell phone bottom + ret +; 3ac3 + + +BattleTextBox: ; 3ac3 + push hl + call SpeechTextBox + call MobileTextBorder + call $1ad2 ; UpdateSprites + call $321c ; refresh? + pop hl + call PrintTextBoxText + ret +; 3ad5 + + +FarBattleTextBox: ; 3ad5 +; save bank + ld a, [$ff9d] ; bank + push af +; bank 20 + ld a, $20 + rst $10 +; print text at hl + call BattleTextBox +; restore bank + pop af + rst $10 + ret +; 3ae1 + + +INCBIN "baserom.gbc", $3ae1, $3b86 - $3ae1 LoadMusicByte: ; 3b86 ; load music data into CurMusicByte diff --git a/wram.asm b/wram.asm index 444856409..2966b480c 100644 --- a/wram.asm +++ b/wram.asm @@ -476,12 +476,33 @@ BattleMonSpclAtk: ; c646 BattleMonSpclDef: ; c648 ds 2 - ds 25 +BattleMonType1: ; c64a + ds 1 +BattleMonType2: ; c64b + ds 1 + + ds 23 CurOTMon: ; c663 ds 1 - ds 4 + ds 1 + +TypeModifier: ; c665 +; >10: super-effective +; 10: normal +; <10: not very effective + +; bit 7 is used for something else + ds 1 + +CriticalHit: ; c666 +; nonzero for a critical hit + ds 1 + +AttackMissed: ; c667 +; nonzero for a miss + ds 1 PlayerSubStatus1: ; c668 ; bit @@ -495,15 +516,23 @@ PlayerSubStatus1: ; c668 ; 0 nightmare ds 1 PlayerSubStatus2: ; c669 -; unknown +; bit +; 7 +; 6 +; 5 +; 4 +; 3 +; 2 +; 1 +; 0 ds 1 PlayerSubStatus3: ; c66a ; bit ; 7 confusion -; 6 -; 5 +; 6 flying +; 5 underground ; 4 charged -; 3 +; 3 flinch ; 2 ; 1 rollout ; 0 bide @@ -515,18 +544,26 @@ PlayerSubStatus4: ; c66b ; 5 recharge ; 4 substitute ; 3 +; 2 focus energy +; 1 +; 0 bide: unleashed energy + ds 1 +PlayerSubStatus5: ; c66c +; bit +; 7 +; 6 +; 5 lock-on +; 4 +; 3 ; 2 ; 1 ; 0 ds 1 -PlayerSubStatus5: ; c66c -; unknown - ds 1 EnemySubStatus1: ; c66d ; see PlayerSubStatus1 ds 1 -EnemySubstatus2: ; c66e +EnemySubStatus2: ; c66e ; see PlayerSubStatus2 ds 1 EnemySubStatus3: ; c66f @@ -539,8 +576,15 @@ EnemySubStatus5: ; c671 ; see PlayerSubStatus5 ds 1 - ds 4 + ds 1 + +PlayerConfuseCount: ; c673 + ds 1 + + ds 1 +PlayerDisableCount: ; c675 + ds 1 PlayerEncoreCount: ; c676 ds 1 PlayerPerishCount: ; c677 @@ -572,10 +616,42 @@ BattleScriptBufferLoc: ; c6b2 PlayerStatLevels: ; c6cc ; 07 neutral - ds 8 +PlayerAtkLevel: ; c6cc + ds 1 +PlayerDefLevel: ; c6cd + ds 1 +PlayerSpdLevel: ; c6ce + ds 1 +PlayerSAtkLevel: ; c6cf + ds 1 +PlayerSDefLevel: ; c6d0 + ds 1 +PlayerAccLevel: ; c6d1 + ds 1 +PlayerEvaLevel: ; c6d2 + ds 1 +; c6d3 + ds 1 +PlayerStatLevelsEnd + EnemyStatLevels: ; c6d4 ; 07 neutral - ds 8 +EnemyAtkLevel: ; c6d4 + ds 1 +EnemyDefLevel: ; c6d5 + ds 1 +EnemySpdLevel: ; c6d6 + ds 1 +EnemySAtkLevel: ; c6d7 + ds 1 +EnemySDefLevel: ; c6d8 + ds 1 +EnemyAccLevel: ; c6d9 + ds 1 +EnemyEvaLevel: ; c6da + ds 1 +; c6db + ds 1 EnemyTurnsTaken: ; c6dc ds 1 @@ -593,12 +669,21 @@ LinkBattleRNCount: ; c6e5 ; how far through the prng stream ds 1 - ds 15 + ds 3 + +CurEnemyMoveNum: ; c6e9 + ds 1 + + ds 10 + +AlreadyDisobeyed: ; c6f4 + ds 1 DisabledMove: ; c6f5 ds 1 - - ds 2 +EnemyEncoredMove: ; c6f6 + ds 1 + ds 1 ; exists so you can't counter on switch LastEnemyCounterMove: ; c6f8 @@ -606,7 +691,14 @@ LastEnemyCounterMove: ; c6f8 LastPlayerCounterMove: ; c6f9 ds 1 - ds 8 + ds 5 + +PlayerScreens: ; c6ff +; bit 4: reflect +; bit 3: light screen + ds 1 + + ds 2 PlayerLightScreenCount: ; c702 ds 1 @@ -928,6 +1020,12 @@ EnemyMonSpclAtk: ; d220 EnemyMonSpclDef: ; d222 ds 2 +EnemyMonType1: ; d224 + ds 1 +EnemyMonType2: ; d225 + ds 1 + + SECTION "Battle",BSS[$d22d] IsInBattle: ; d22d @@ -974,6 +1072,9 @@ UnownLetter: ; d234 CurBaseStats: ; d236 ds 32 +CurDamage: ; d256 + ds 2 + SECTION "TimeOfDay",BSS[$d269] TimeOfDay: ; d269 From b582066865787dfa21193cd7754395c7d8ee3a85 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 26 Mar 2013 07:01:21 -0400 Subject: [PATCH 013/112] Give labels to some BattleTexts --- main.asm | 158 +++++++++++++++++++++++++++---------------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/main.asm b/main.asm index 91e74aa03..f9e181803 100644 --- a/main.asm +++ b/main.asm @@ -8984,52 +8984,52 @@ BattleText_0x80cd1: ; 0x80cd1 db "is angry!", $58 ; 0x80ce7 -BattleText_0x80ce7: ; 0x80ce7 +FastAsleepText: ; 0x80ce7 db $0, $5a, $4f db "is fast asleep!", $58 ; 0x80cfa -BattleText_0x80cfa: ; 0x80cfa +WokeUpText: ; 0x80cfa db $0, $5a, $4f db "woke up!", $58 ; 0x80d06 -BattleText_0x80d06: ; 0x80d06 +FrozenSolidText: ; 0x80d06 db $0, $5a, $4f db "is frozen solid!", $58 ; 0x80d1a -BattleText_0x80d1a: ; 0x80d1a +FlinchedText: ; 0x80d1a db $0, $5a, $4f db "flinched!", $58 ; 0x80d27 -BattleText_0x80d27: ; 0x80d27 +MustRechargeText: ; 0x80d27 db $0, $5a, $4f db "must recharge!", $58 ; 0x80d39 -BattleText_0x80d39: ; 0x80d39 +DisabledNoMoreText: ; 0x80d39 db $0, $5a, "'s", $4f db "disabled no more!", $58 ; 0x80d4f -BattleText_0x80d4f: ; 0x80d4f +IsConfusedText: ; 0x80d4f db $0, $5a, $4f db "is confused!", $58 ; 0x80d5f -BattleText_0x80d5f: ; 0x80d5f +HurtItselfText: ; 0x80d5f db $0, "It hurt itself in", $4f db "its confusion!", $58 ; 0x80d81 -BattleText_0x80d81: ; 0x80d81 +ConfusedNoMoreText: ; 0x80d81 db $0, $5a, "'s", $4f db "confused no more!", $58 ; 0x80d97 -BattleText_0x80d97: ; 0x80d97 +BecameConfusedText: ; 0x80d97 db $0, $59, $4f db "became confused!", $58 ; 0x80dab @@ -9042,7 +9042,7 @@ BattleText_0x80dab: ; 0x80dab db "of its confusion.", $58 ; 0x80dcc -BattleText_0x80dcc: ; 0x80dcc +AlreadyConfusedText: ; 0x80dcc db $0, $59, "'s", $4f db "already confused!", $58 ; 0x80de2 @@ -9063,29 +9063,29 @@ BattleText_0x80df5: ; 0x80df5 db $0, "!", $58 ; 0x80e11 -BattleText_0x80e11: ; 0x80e11 +UsedBindText: ; 0x80e11 db $0, $5a, $4f db "used BIND on", $55 db $59, "!", $58 ; 0x80e24 -BattleText_0x80e24: ; 0x80e24 +WhirlpoolTrapText: ; 0x80e24 db $0, $59, $4f db "was trapped!", $58 ; 0x80e34 -BattleText_0x80e34: ; 0x80e34 +FireSpinTrapText: ; 0x80e34 db $0, $59, $4f db "was trapped!", $58 ; 0x80e44 -BattleText_0x80e44: ; 0x80e44 +WrappedByText: ; 0x80e44 db $0, $59, $4f db "was WRAPPED by", $55 db $5a, "!", $58 ; 0x80e59 -BattleText_0x80e59: ; 0x80e59 +ClampedByText: ; 0x80e59 db $0, $59, $4f db "was CLAMPED by", $55 db $5a, "!", $58 @@ -9114,19 +9114,19 @@ BattleText_0x80eb0: ; 0x80eb0 db "ENDURED the hit!", $58 ; 0x80ec4 -BattleText_0x80ec4: ; 0x80ec4 +InLoveWithText: ; 0x80ec4 db $0, $5a, $4f db "is in love with", $55 db $59, "!", $58 ; 0x80eda -BattleText_0x80eda: ; 0x80eda +InfatuationText: ; 0x80eda db $0, $5a, "'s", $4f db "infatuation kept", $55 db "it from attacking!", $58 ; 0x80f02 -BattleText_0x80f02: ; 0x80f02 +DisabledMoveText: ; 0x80f02 db $0, $5a, "'s", $4f db "@" text_from_ram $d073 @@ -9134,31 +9134,31 @@ BattleText_0x80f02: ; 0x80f02 db "DISABLED!", $58 ; 0x80f19 -BattleText_0x80f19: ; 0x80f19 +LoafingAroundText: ; 0x80f19 text_from_ram $c621 db $0, " is", $4f db "loafing around.", $58 ; 0x80f31 -BattleText_0x80f31: ; 0x80f31 +BeganToNapText: ; 0x80f31 text_from_ram $c621 db $0, " began", $4f db "to nap!", $58 ; 0x80f44 -BattleText_0x80f44: ; 0x80f44 +WontObeyText: ; 0x80f44 text_from_ram $c621 db $0, " won't", $4f db "obey!", $58 ; 0x80f54 -BattleText_0x80f54: ; 0x80f54 +TurnedAwayText: ; 0x80f54 text_from_ram $c621 db $0, " turned", $4f db "away!", $58 ; 0x80f66 -BattleText_0x80f66: ; 0x80f66 +IgnoredOrdersText: ; 0x80f66 text_from_ram $c621 db $0, " ignored", $4f db "orders!", $58 @@ -9183,18 +9183,18 @@ BattleText_0x80fba: ; 0x80fba db $0, "!", $58 ; 0x80fd7 -BattleText_0x80fd7: ; 0x80fd7 +WentToSleepText: ; 0x80fd7 db $0, $5a, $4f db "went to sleep!", $57 ; 0x80fe9 -BattleText_0x80fe9: ; 0x80fe9 +RestedText: ; 0x80fe9 db $0, $5a, $4f db "fell asleep and", $55 db "became healthy!", $57 ; 0x8100c -BattleText_0x8100c: ; 0x8100c +RegainedHealthText: ; 0x8100c db $0, $5a, $4f db "regained health!", $58 ; 0x81020 @@ -9220,7 +9220,7 @@ BattleText_0x81061: ; 0x81061 db "unaffected!", $58 ; 0x81071 -BattleText_0x81071: ; 0x81071 +DoesntAffectText: ; 0x81071 db $0, "It doesn't affect", $4f db $59, "!", $58 ; 0x81086 @@ -9348,7 +9348,7 @@ BattleText_0x8125d: ; 0x8125d db "was frozen solid!", $58 ; 0x81272 -BattleText_0x81272: ; 0x81272 +WontRiseAnymoreText: ; 0x81272 db $0, $5a, "'s", $4f db "@" text_from_ram $d086 @@ -9391,7 +9391,7 @@ BattleText_0x812f8: ; 0x812f8 db $0, " times!", $58 ; 0x8130b -BattleText_0x8130b: ; 0x8130b +MistText: ; 0x8130b db $0, $5a, "'s", $4f db "shrouded in MIST!", $58 ; 0x81321 @@ -9401,28 +9401,28 @@ BattleText_0x81321: ; 0x81321 db "protected by MIST.", $58 ; 0x81338 -BattleText_0x81338: ; 0x81338 +GettingPumpedText: ; 0x81338 interpret_data db $0, $5a, "'s", $4f db "getting pumped!", $58 ; 0x8134d -BattleText_0x8134d: ; 0x8134d +RecoilText: ; 0x8134d db $0, $5a, "'s", $4f db "hit with recoil!", $58 ; 0x81362 -BattleText_0x81362: ; 0x81362 +MadeSubstituteText: ; 0x81362 db $0, $5a, $4f db "made a SUBSTITUTE!", $58 ; 0x81378 -BattleText_0x81378: ; 0x81378 +HasSubstituteText: ; 0x81378 db $0, $5a, $4f db "has a SUBSTITUTE!", $58 ; 0x8138d -BattleText_0x8138d: ; 0x8138d +TooWeakSubText: ; 0x8138d db $0, "Too weak to make", $4f db "a SUBSTITUTE!", $58 ; 0x813ad @@ -9438,7 +9438,7 @@ BattleText_0x813d0: ; 0x813d0 db "SUBSTITUTE faded!", $58 ; 0x813e6 -BattleText_0x813e6: ; 0x813e6 +LearnedMoveText: ; 0x813e6 db $0, $5a, $4f db "learned", $55 db "@" @@ -9446,17 +9446,17 @@ BattleText_0x813e6: ; 0x813e6 db $0, "!", $58 ; 0x813f8 -BattleText_0x813f8: ; 0x813f8 +WasSeededText: ; 0x813f8 db $0, $59, $4f db "was seeded!", $58 ; 0x81407 -BattleText_0x81407: ; 0x81407 +EvadedText: ; 0x81407 db $0, $59, $4f db "evaded the attack!", $58 ; 0x8141d -BattleText_0x8141d: ; 0x8141d +WasDisabledText: ; 0x8141d db $0, $59, "'s", $4f db "@" text_from_ram $d073 @@ -9464,12 +9464,12 @@ BattleText_0x8141d: ; 0x8141d db "DISABLED!", $58 ; 0x81435 -BattleText_0x81435: ; 0x81435 +CoinsScatteredText: ; 0x81435 db $0, "Coins scattered", $4f db "everywhere!", $58 ; 0x81452 -BattleText_0x81452: ; 0x81452 +TransformedTypeText: ; 0x81452 db $0, $5a, $4f db "transformed into", $55 db "the @" @@ -9477,12 +9477,12 @@ BattleText_0x81452: ; 0x81452 db $0, "-type!", $58 ; 0x81476 -BattleText_0x81476: ; 0x81476 +EliminatedStatsText: ; 0x81476 db $0, "All stat changes", $4f db "were eliminated!", $58 ; 0x81499 -BattleText_0x81499: ; 0x81499 +TransformedText: ; 0x81499 db $0, $5a, $4f db "TRANSFORMED into", $55 db "@" @@ -9500,30 +9500,30 @@ BattleText_0x814c7: ; 0x814c7 db "DEFENSE rose!", $58 ; 0x814d9 -BattleText_0x814d9: ; 0x814d9 +NothingHappenedText: ; 0x814d9 db $0, "But nothing", $4f db "happened.", $58 ; 0x814f0 -BattleText_0x814f0: ; 0x814f0 +ButItFailedText: ; 0x814f0 db $0, "But it failed!", $58 ; 0x81500 -BattleText_0x81500: ; 0x81500 +ItFailedText: ; 0x81500 db $0, "It failed!", $58 ; 0x8150c -BattleText_0x8150c: ; 0x8150c +DidntAffect1Text: ; 0x8150c db $0, "It didn't affect", $4f db $59, "!", $58 ; 0x81520 -BattleText_0x81520: ; 0x81520 +DidntAffect2Text: ; 0x81520 db $0, "It didn't affect", $4f db $59, "!", $58 ; 0x81534 -BattleText_0x81534: ; 0x81534 +HPIsFullText: ; 0x81534 db $0, $5a, "'s", $4f db "HP is full!", $58 ; 0x81544 @@ -9533,23 +9533,23 @@ BattleText_0x81544: ; 0x81544 db "was dragged out!", $58 ; 0x81558 -BattleText_0x81558: ; 0x81558 +ParalyzedText: ; 0x81558 db $0, $59, "'s", $4f db "paralyzed! Maybe", $55 db "it can't attack!", $58 ; 0x8157d -BattleText_0x8157d: ; 0x8157d +FullyParalyzedText: ; 0x8157d db $0, $5a, "'s", $4f db "fully paralyzed!", $58 ; 0x81592 -BattleText_0x81592: ; 0x81592 +AlreadyParalyzedText: ; 0x81592 db $0, $59, "'s", $4f db "already paralyzed!", $58 ; 0x815a9 -BattleText_0x815a9: ; 0x815a9 +ProtectedByText: ; 0x815a9 db $0, $59, "'s", $4f db "protected by", $55 db "@" @@ -9557,11 +9557,11 @@ BattleText_0x815a9: ; 0x815a9 db $0, "!", $58 ; 0x815c1 -BattleText_0x815c1: ; 0x815c1 +MirrorMoveFailedText: ; 0x815c1 db $0, "The MIRROR MOVE", $4e, "failed!", $58 ; 0x815da -BattleText_0x815da: ; 0x815da +StoleText: ; 0x815da db $0, $5a, $4f db "stole @" text_from_ram $d073 @@ -9569,30 +9569,30 @@ BattleText_0x815da: ; 0x815da db "from its foe!", $58 ; 0x815f7 -BattleText_0x815f7: ; 0x815f7 +CantEscapeNowText: ; 0x815f7 db $0, $59, $4f db "can't escape now!", $58 ; 0x8160b -BattleText_0x8160b: ; 0x8160b +StartedNightmareText: ; 0x8160b db $0, $59, $4f db "started to have a", $55 db "NIGHTMARE!", $58 ; 0x8162b -BattleText_0x8162b: ; 0x8162b +WasDefrostedText: ; 0x8162b db $0, $5a, $4f db "was defrosted!", $58 ; 0x8163d -BattleText_0x8163d: ; 0x8163d +PutACurseText: ; 0x8163d db $0, $5a, $4f db "cut its own HP and", $51 db "put a CURSE on", $4f db $59, "!", $58 ; 0x81665 -BattleText_0x81665: ; 0x81665 +ProtectedItselfText: ; 0x81665 db $0, $5a, $4f db "PROTECTED itself!", $58 ; 0x8167a @@ -9602,106 +9602,106 @@ BattleText_0x8167a: ; 0x8167a db "PROTECTING itself!", $57 ; 0x81691 -BattleText_0x81691: ; 0x81691 +SpikesText: ; 0x81691 db $0, "SPIKES scattered", $4f db "all around", $55 db $59, "!", $58 ; 0x816b1 -BattleText_0x816b1: ; 0x816b1 +IdentifiedText: ; 0x816b1 db $0, $5a, $4f db "identified", $55 db $59, "!", $58 ; 0x816c2 -BattleText_0x816c2: ; 0x816c2 +StartPerishText: ; 0x816c2 db $0, "Both #MON will", $4f db "faint in 3 turns!", $58 ; 0x816e4 -BattleText_0x816e4: ; 0x816e4 +SandstormBrewedText: ; 0x816e4 db $0, "A SANDSTORM", $4f db "brewed!", $58 ; 0x816f9 -BattleText_0x816f9: ; 0x816f9 +BracedItselfText: ; 0x816f9 db $0, $5a, $4f db "braced itself!", $58 ; 0x8170b -BattleText_0x8170b: ; 0x8170b +FellInLoveText: ; 0x8170b db $0, $59, $4f db "fell in love!", $58 ; 0x8171c -BattleText_0x8171c: ; 0x8171c +CoveredByVeilText: ; 0x8171c db $0, $5a, "'s", $4f db "covered by a veil!", $58 ; 0x81733 -BattleText_0x81733: ; 0x81733 +SafeguardProtectText: ; 0x81733 db $0, $59, $4f db "is protected by", $55 db "SAFEGUARD!", $58 ; 0x81751 -BattleText_0x81751: ; 0x81751 +MagnitudeText: ; 0x81751 db $0, "Magnitude @" deciram $d265, $11 db $0, "!", $58 ; 0x81764 -BattleText_0x81764: ; 0x81764 +ReleasedByText: ; 0x81764 db $0, $5a, $4f db "was released by", $55 db $59, "!", $58 ; 0x8177a -BattleText_0x8177a: ; 0x8177a +ShedLeechSeedText: ; 0x8177a db $0, $5a, $4f db "shed LEECH SEED!", $58 ; 0x8178e -BattleText_0x8178e: ; 0x8178e +BlewSpikesText: ; 0x8178e db $0, $5a, $4f db "blew away SPIKES!", $58 ; 0x817a3 -BattleText_0x817a3: ; 0x817a3 +DownpourText: ; 0x817a3 db $0, "A downpour", $4f db "started!", $58 ; 0x817b8 -BattleText_0x817b8: ; 0x817b8 +SunGotBrightText: ; 0x817b8 db $0, "The sunlight got", $4f db "bright!", $58 ; 0x817d2 -BattleText_0x817d2: ; 0x817d2 +BellyDrumText: ; 0x817d2 db $0, $5a, $4f db "cut its HP and", $55 db "maximized ATTACK!", $58 ; 0x817f6 -BattleText_0x817f6: ; 0x817f6 +CopiedStatsText: ; 0x817f6 db $0, $5a, $4f db "copied the stat", $51 db "changes of", $4f db $59, "!", $58 ; 0x81817 -BattleText_0x81817: ; 0x81817 +ForesawAttackText: ; 0x81817 db $0, $5a, $4f db "foresaw an attack!", $58 ; 0x8182d -BattleText_0x8182d: ; 0x8182d +BeatUpAttackText: ; 0x8182d text_from_ram $d073 db $0, "'s", $4f db "attack!", $57 ; 0x8183b -BattleText_0x8183b: ; 0x8183b +RefusedGiftText: ; 0x8183b db $0, $59, $4f db "refused the gift!", $58 ; 0x81850 From 3e6c37fe5242d78ba915192a03e183dfbf031110 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 26 Mar 2013 20:39:44 -0400 Subject: [PATCH 014/112] Move effect commands dump --- battle/effect_command_pointers.asm | 177 + battle/effect_commands.asm | 10511 +++++++++++++++++++++++++++ main.asm | 550 +- wram.asm | 4 +- 4 files changed, 11222 insertions(+), 20 deletions(-) create mode 100644 battle/effect_command_pointers.asm create mode 100644 battle/effect_commands.asm diff --git a/battle/effect_command_pointers.asm b/battle/effect_command_pointers.asm new file mode 100644 index 000000000..a8f382693 --- /dev/null +++ b/battle/effect_command_pointers.asm @@ -0,0 +1,177 @@ +; 3fd28 + dw BattleCommand01 ; 34084 + dw BattleCommand02 ; 343db + dw BattleCommand03 ; 34541 + dw BattleCommand04 ; 34555 + dw BattleCommand05 ; 34631 + dw BattleCommand06 ; 352dc + dw BattleCommand07 ; 346d2 + dw BattleCommand08 ; 34cfd + dw BattleCommand09 ; 34d32 + dw BattleCommand0a ; 34eee + dw BattleCommand0b ; 34f60 + dw BattleCommand0c ; 35004 + dw BattleCommand0d ; 35023 + dw BattleCommand0e ; 3505e + dw BattleCommand0f ; 35175 + dw BattleCommand10 ; 351ad + dw BattleCommand11 ; 351c0 + dw BattleCommand12 ; 35250 + dw BattleCommand13 ; 35eee + dw BattleCommand14 ; 35e5c + dw BattleCommand15 ; 35fff + dw BattleCommand16 ; 36008 + dw BattleCommand17 ; 3608c + dw BattleCommand18 ; 36102 + dw BattleCommand19 ; 36165 + dw BattleCommand1a ; 37380 + dw BattleCommand1b ; 373c9 + dw BattleCommand1c ; 361e4 + dw BattleCommand1d ; 362e3 + dw BattleCommand1e ; 3705c + dw BattleCommand1f ; 3707f + dw BattleCommand20 ; 3710e + dw BattleCommand21 ; 36671 + dw BattleCommand22 ; 366e5 + dw BattleCommand23 ; 3680f + dw BattleCommand24 ; 369b6 + dw BattleCommand25 ; 36aa0 + dw BattleCommand26 ; 36af3 + dw BattleCommand27 ; 36cb2 + dw BattleCommand28 ; 36c7e + dw BattleCommand29 ; 36c98 + dw BattleCommand2a ; 36d3b + dw BattleCommand2b ; 36d1d + dw BattleCommand2c ; 3713e + dw BattleCommand2d ; 371cd + dw BattleCommand2e ; 372fc + dw BattleCommand2f ; 35f2c + dw BattleCommand30 ; 36dc7 + dw BattleCommand31 ; 36e7c + dw BattleCommand32 ; 36f0b + dw BattleCommand33 ; 36f46 + dw BattleCommand34 ; 37418 + dw BattleCommand35 ; 36f9d + dw BattleCommand36 ; 36fe1 + dw BattleCommand37 ; 36fed + dw BattleCommand38 ; 37e85 + dw BattleCommand39 ; 36b4d + dw BattleCommand3a ; 36b3a + dw BattleCommand3b ; 36c2d + dw BattleCommand3c ; 36c2c + dw BattleCommand3d ; 36751 + dw BattleCommand3e ; 3671a + dw BattleCommand3f ; 35726 + dw BattleCommand40 ; 35813 + dw BattleCommand41 ; 35864 + dw BattleCommand42 ; 35926 + dw BattleCommand43 ; 359d0 + dw BattleCommand44 ; 359e6 + dw BattleCommand45 ; 35a53 + dw BattleCommand46 ; 35a74 + dw BattleCommand47 ; 35b16 + dw BattleCommand48 ; 35b33 + dw BattleCommand49 ; 35bff + dw BattleCommand4a ; 35c0f + dw BattleCommand4b ; 35c94 + dw BattleCommand4c ; 35cc9 + dw BattleCommand4d ; 36ac9 + dw BattleCommand4e ; 346b2 + dw BattleCommand4f ; 346cd + dw BattleCommand50 ; 37492 + dw BattleCommand51 ; 37517 + dw BattleCommand52 ; 37536 + dw BattleCommand53 ; 37563 + dw BattleCommand54 ; 37588 + dw BattleCommand55 ; 37618 + dw BattleCommand56 ; 37683 + dw BattleCommand57 ; 376a0 + dw BattleCommand58 ; 376c2 + dw BattleCommand59 ; 376f8 + dw BattleCommand5a ; 3766f + dw BattleCommand5b ; 37718 + dw BattleCommand5c ; 37734 + dw BattleCommand5d ; 37791 + dw BattleCommand5e ; 37792 + dw BattleCommand5f ; 377ce + dw BattleCommand60 ; 3784b + dw BattleCommand61 ; 37874 + dw BattleCommand62 ; 35612 + dw BattleCommand63 ; 3790e + dw BattleCommand64 ; 37939 + dw BattleCommand65 ; 37972 + dw BattleCommand66 ; 37991 + dw BattleCommand67 ; 379c9 + dw BattleCommand68 ; 37b1d + dw BattleCommand69 ; 37b39 + dw BattleCommand6a ; 37b74 + dw BattleCommand6b ; 37b78 + dw BattleCommand6c ; 37b7c + dw BattleCommand6d ; 37be8 + dw BattleCommand6e ; 37bf4 + dw BattleCommand6f ; 37c07 + dw BattleCommand70 ; 361ac + dw BattleCommand71 ; 361b0 + dw BattleCommand72 ; 361b4 + dw BattleCommand73 ; 361b8 + dw BattleCommand74 ; 361bc + dw BattleCommand75 ; 361c0 + dw BattleCommand76 ; 361c4 + dw BattleCommand77 ; 361c8 + dw BattleCommand78 ; 361cc + dw BattleCommand79 ; 361d0 + dw BattleCommand7a ; 361d4 + dw BattleCommand7b ; 361d8 + dw BattleCommand7c ; 361dc + dw BattleCommand7d ; 361e0 + dw BattleCommand7e ; 362ad + dw BattleCommand7f ; 362b1 + dw BattleCommand80 ; 362b5 + dw BattleCommand81 ; 362b9 + dw BattleCommand82 ; 362bd + dw BattleCommand83 ; 362c1 + dw BattleCommand84 ; 362c5 + dw BattleCommand85 ; 362c9 + dw BattleCommand86 ; 362cd + dw BattleCommand87 ; 362d1 + dw BattleCommand88 ; 362d5 + dw BattleCommand89 ; 362d9 + dw BattleCommand8a ; 362dd + dw BattleCommand8b ; 362e1 + dw BattleCommand8c ; 363b8 + dw BattleCommand8d ; 363e9 + dw BattleCommand8e ; 3644c + dw BattleCommand8f ; 3646a + dw BattleCommand90 ; 34ecc + dw BattleCommand91 ; 34fdb + dw BattleCommand92 ; 34fd1 + dw BattleCommand93 ; 34ffd + dw BattleCommand94 ; 36a82 + dw BattleCommand95 ; 37c1a + dw BattleCommand96 ; 37c55 + dw BattleCommand97 ; 36f1d + dw BattleCommand98 ; 36f25 + dw BattleCommand99 ; 36f2f + dw BattleCommand9a ; 37c95 + dw BattleCommand9b ; 37d0d + dw BattleCommand9c ; 37d34 + dw BattleCommand9d ; 37ce6 + dw BattleCommand9e ; 37d02 + dw BattleCommand9f ; 37d94 + dw BattleCommanda0 ; 36778 + dw BattleCommanda1 ; 35461 + dw BattleCommanda2 ; 3527b + dw BattleCommanda3 ; 34833 + dw BattleCommanda4 ; 36500 + dw BattleCommanda5 ; 35165 + dw BattleCommanda6 ; 365af + dw BattleCommanda7 ; 365c3 + dw BattleCommanda8 ; 355b5 + dw BattleCommanda9 ; 355d5 + dw BattleCommandaa ; 37e80 + dw BattleCommandab ; 34f57 + dw BattleCommandac ; 3658f + dw BattleCommandad ; 351a5 + dw BattleCommandae ; 35197 + dw BattleCommandaf ; 365a7 +; 3fe86 diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm new file mode 100644 index 000000000..69d2f9084 --- /dev/null +++ b/battle/effect_commands.asm @@ -0,0 +1,10511 @@ +DoPlayerTurn: ; 34000 + call SetPlayerTurn + + ld a, [$d0ec] + and a + ret nz + + jr DoTurn +; 3400a + + +DoEnemyTurn: ; 3400a + call SetEnemyTurn + + ld a, [InLinkBattle] + and a + jr z, DoTurn + + ld a, [$d430] + cp $e + jr z, DoTurn + cp $4 + ret nc + + ; fallthrough +; 3401d + + +DoTurn: ; 3401d +; Read in and execute the user's move effects for this turn. + + xor a + ld [$c6b4], a + +; Effect command checkturn is called for every move. + call CheckTurn + + ld a, [$c6b4] + and a + ret nz + + call UpdateMoveData +; 3402c + + +DoMove: ; 3402c +; Get the user's move effect. + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + ld c, a + ld b, 0 + ld hl, MoveEffectsPointers + add hl, bc + add hl, bc + ld a, BANK(MoveEffectsPointers) + call GetFarHalfword + + ld de, BattleScriptBuffer + +.GetMoveEffect + ld a, BANK(MoveEffects) + call GetFarByte + inc hl + ld [de], a + inc de + cp $ff + jr nz, .GetMoveEffect + +; Start at the first command. + ld hl, BattleScriptBuffer + ld a, l + ld [BattleScriptBufferLoc], a + ld a, h + ld [BattleScriptBufferLoc + 1], a + +.ReadMoveEffectCommand + +; ld a, [BattleScriptBufferLoc++] + ld a, [BattleScriptBufferLoc] + ld l, a + ld a, [BattleScriptBufferLoc + 1] + ld h, a + + ld a, [hli] + + push af + ld a, l + ld [BattleScriptBufferLoc], a + ld a, h + ld [BattleScriptBufferLoc + 1], a + pop af + +; $fe is used to terminate branches without ending the read cycle. + cp $fe + ret nc + +; The rest of the commands (01-af) are read from BattleCommandPointers. + push bc + dec a + ld c, a + ld b, 0 + ld hl, BattleCommandPointers + add hl, bc + add hl, bc + pop bc + + ld a, BANK(BattleCommandPointers) + call GetFarHalfword + + call .DoMoveEffectCommand + + jr .ReadMoveEffectCommand + +.DoMoveEffectCommand + jp [hl] +; 34084 + + +CheckTurn: +BattleCommand01: ; 34084 +; checkturn + +; Repurposed as hardcoded turn handling. Useless as a command. + +; Move $ff immediately ends the turn. + ld a, BATTLE_VARS_MOVE + call CleanGetBattleVarPair + inc a + jp z, Function0x34385 + + xor a + ld [AttackMissed], a + ld [$c70d], a + ld [$c689], a + ld [AlreadyDisobeyed], a + ld [$c6fb], a + ld [$c73e], a + + ld a, 10 ; 1.0 + ld [TypeModifier], a + + ld a, [hBattleTurn] + and a + jp nz, CheckEnemyTurn + + +CheckPlayerTurn: + +; check recharge + ld hl, PlayerSubStatus4 + bit 5, [hl] + jr z, .CheckSleep + res 5, [hl] + +; 'must recharge!' + ld hl, MustRechargeText + call FarBattleTextBox + + call CantMove + jp Function0x34385 + + +.CheckSleep + ld hl, BattleMonStatus + ld a, [hl] + and $7 + jr z, .CheckFrozen + dec a + ld [BattleMonStatus], a + and $7 + jr z, .WokeUp + xor a + ld [$cfca], a + ld de, ANIM_SLEEP + call FarPlayBattleAnimation + jr .FastAsleep + + +.WokeUp +; 'woke up!' + ld hl, WokeUpText + call FarBattleTextBox + + call CantMove + call $399c + ld hl, $5f48 + call $7e73 + ld a, $1 + ld [$ffd4], a + ld hl, PlayerSubStatus1 + res 0, [hl] + jr .CheckFrozen + + +.FastAsleep +; 'fast asleep!' + ld hl, FastAsleepText + call FarBattleTextBox + +; Snore and Sleep Talk bypass sleep. + ld a, [CurPlayerMove] + cp SNORE + jr z, .CheckFrozen + cp SLEEP_TALK + jr z, .CheckFrozen + call CantMove + jp Function0x34385 + + +.CheckFrozen + ld hl, BattleMonStatus + bit 5, [hl] + jr z, .CheckFlinch + +; Flame Wheel and Sacred Fire thaw the user. + ld a, [CurPlayerMove] + cp FLAME_WHEEL + jr z, .CheckFlinch + cp SACRED_FIRE + jr z, .CheckFlinch + +; 'frozen solid!' + ld hl, FrozenSolidText + call FarBattleTextBox + + call CantMove + jp Function0x34385 + + +.CheckFlinch + ld hl, PlayerSubStatus3 + bit 3, [hl] ; flinch + jr z, .CheckDisabled + + res 3, [hl] + +; 'flinched!' + ld hl, FlinchedText + call FarBattleTextBox + + call CantMove + jp Function0x34385 + + +.CheckDisabled + ld hl, PlayerDisableCount + ld a, [hl] + and a + jr z, .CheckConfused + dec a + ld [hl], a + and $f + jr nz, .CheckConfused + ld [hl], a + ld [DisabledMove], a + +; 'disabled no more!' + ld hl, DisabledNoMoreText + call FarBattleTextBox + + +.CheckConfused + ld a, [PlayerSubStatus3] + add a + jr nc, .CheckAttract + ld hl, PlayerConfuseCount + dec [hl] + jr nz, .Confused + + ld hl, PlayerSubStatus3 + res 7, [hl] + +; 'confused no more!' + ld hl, ConfusedNoMoreText + call FarBattleTextBox + + jr .CheckAttract + + +.Confused +; 'confused!' + ld hl, IsConfusedText + call FarBattleTextBox + + xor a + ld [$cfca], a + ld de, ANIM_CONFUSED + call FarPlayBattleAnimation + +; 50% chance of hitting itself + call FarBattleRNG + cp $80 + jr nc, .CheckAttract + + ld hl, PlayerSubStatus3 + ld a, [hl] + and $80 + ld [hl], a + + call HitConfusion + + call CantMove + jp Function0x34385 + + +.CheckAttract + ld a, [PlayerSubStatus1] + add a ; check bit 7 + jr nc, .CheckDisabledMove + +; 'in love with' + ld hl, InLoveWithText + call FarBattleTextBox + + xor a + ld [$cfca], a + + ld de, ANIM_INLOVE + call FarPlayBattleAnimation + +; 50% chance of infatuation + call FarBattleRNG + cp $80 + jr c, .CheckDisabledMove + +; 'infatuation kept it from attacking!' + ld hl, InfatuationText + call FarBattleTextBox + + call CantMove + jp Function0x34385 + + +.CheckDisabledMove +; We can't disable a move that doesn't exist. + ld a, [DisabledMove] + and a + jr z, .CheckParalyzed + +; Are we using the disabled move? + ld hl, CurPlayerMove + cp [hl] + jr nz, .CheckParalyzed + + call MoveDisabled + call CantMove + jp Function0x34385 + + +.CheckParalyzed + ld hl, BattleMonStatus + bit 6, [hl] + ret z + +; 25% chance to be fully paralyzed + call FarBattleRNG + cp $3f + ret nc + +; 'fully paralyzed!' + ld hl, FullyParalyzedText + call FarBattleTextBox + call CantMove + jp Function0x34385 +; 341f0 + + +CantMove: ; 341f0 + ld a, BATTLE_VARS_SUBSTATUS1 + call GetBattleVarPair + res 6, [hl] + + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + ld a, [hl] + and $ec + ld [hl], a + + call Function0x377be + + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + cp FLY + jr z, .asm_3420f + + cp $5b + ret nz + +.asm_3420f + res 5, [hl] + res 6, [hl] + jp $7ece +; 34216 + + + +Function0x34216: ; 34216 + call $4ffd + call CantMove + jp $4ffd +; 3421f + + + +CheckEnemyTurn: ; 3421f + +; check recharge + ld hl, EnemySubStatus4 + bit 5, [hl] + jr z, .CheckSleep + res 5, [hl] + +; 'must recharge!' + ld hl, MustRechargeText + call FarBattleTextBox + call CantMove + jp Function0x34385 + + +.CheckSleep + ld hl, EnemyMonStatus + ld a, [hl] + and $7 + jr z, .CheckFrozen + dec a + ld [EnemyMonStatus], a + and a + jr z, .WokeUp + +; 'fast asleep!' + ld hl, FastAsleepText + call FarBattleTextBox + xor a + ld [$cfca], a + ld de, ANIM_SLEEP + call FarPlayBattleAnimation + jr .FastAsleep + + +.WokeUp +; 'woke up!' + ld hl, WokeUpText + call FarBattleTextBox + call CantMove + call $39b0 + ld hl, $6036 + call $7e73 + ld a, $1 + ld [$ffd4], a + ld hl, EnemySubStatus1 + res 0, [hl] + jr .CheckFrozen + + +.FastAsleep +; Snore and Sleep Talk bypass sleep. + ld a, [CurEnemyMove] + cp SNORE + jr z, .CheckFrozen + cp SLEEP_TALK + jr z, .CheckFrozen + call CantMove + jp Function0x34385 + + +.CheckFrozen + ld hl, EnemyMonStatus + bit 5, [hl] + jr z, .CheckFlinch + ld a, [CurEnemyMove] + cp $ac + jr z, .CheckFlinch + cp $dd + jr z, .CheckFlinch + +; 'frozen solid!' + ld hl, FrozenSolidText + call FarBattleTextBox + call CantMove + jp Function0x34385 + + +.CheckFlinch + ld hl, EnemySubStatus3 + bit 3, [hl] + jr z, .CheckDisabled + + res 3, [hl] + +; 'flinched!' + ld hl, FlinchedText + call FarBattleTextBox + + call CantMove + jp Function0x34385 + + +.CheckDisabled + ld hl, EnemyEncoreCount + ld a, [hl] + and a + jr z, .CheckConfused + + dec a + ld [hl], a + and $f + jr nz, .CheckConfused + + ld [hl], a + ld [EnemyEncoredMove], a + +; 'disabled no more!' + ld hl, DisabledNoMoreText + call FarBattleTextBox + + +.CheckConfused + ld a, [EnemySubStatus3] + add a + jr nc, .CheckAttract + + ld hl, $c67b + dec [hl] + jr nz, .Confused + + ld hl, EnemySubStatus3 + res 7, [hl] + +; 'confused no more!' + ld hl, ConfusedNoMoreText + call FarBattleTextBox + + jr .CheckAttract + + +.Confused +; 'confused!' + ld hl, IsConfusedText + call FarBattleTextBox + + xor a + ld [$cfca], a + ld de, ANIM_CONFUSED + call FarPlayBattleAnimation + +; 50% chance of hitting itself + call FarBattleRNG + cp $80 + jr nc, .CheckAttract + + ld hl, EnemySubStatus3 + ld a, [hl] + and %10000000 + ld [hl], a + +; 'hurt itself in its confusion!' + ld hl, HurtItselfText + call FarBattleTextBox + + call Function0x355dd + + call $5612 + + call BattleCommand0a + + xor a + ld [$cfca], a + +; Flicker the monster pic unless flying or underground. + ld de, $0115 + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call CleanGetBattleVarPair + and $60 + call z, PlayFXAnimID + + ld c, $1 + call Function0x35d1c + + call $5004 + + call CantMove + jp Function0x34385 + + +.CheckAttract + ld a, [EnemySubStatus1] + add a ; check bit 7 + jr nc, .CheckDisabledMove + +; 'in love with' + ld hl, InLoveWithText + call FarBattleTextBox + + xor a + ld [$cfca], a + + ld de, ANIM_INLOVE + call FarPlayBattleAnimation + +; 50% chance of infatuation + call FarBattleRNG + cp $80 + jr c, .CheckDisabledMove + +; 'infatuation kept it from attacking!' + ld hl, InfatuationText + call FarBattleTextBox + + call CantMove + jp Function0x34385 + + +.CheckDisabledMove +; We can't disable a move that doesn't exist. + ld a, [EnemyEncoredMove] + and a + jr z, .CheckParalyzed + +; Are we using the disabled move? + ld hl, CurEnemyMove + cp [hl] + jr nz, .CheckParalyzed + + call MoveDisabled + + call CantMove + jp Function0x34385 + + +.CheckParalyzed + ld hl, EnemyMonStatus + bit 6, [hl] + ret z + +; 25% chance to be fully paralyzed + call FarBattleRNG + cp $3f + ret nc + +; 'fully paralyzed!' + ld hl, FullyParalyzedText + call FarBattleTextBox + + call CantMove + + ; fallthrough +; 34385 + + +Function0x34385: ; 34385 + ld a, $1 + ld [$c6b4], a + jp ResetDamage +; 3438d + + +MoveDisabled: ; 3438d + +; Make sure any charged moves fail + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + res 4, [hl] + + ld a, BATTLE_VARS_MOVE + call CleanGetBattleVarPair + ld [$d265], a + call $34f8 + +; 'disabled!' + ld hl, DisabledMoveText + jp FarBattleTextBox +; 343a5 + + +HitConfusion: ; 343a5 + +; 'hurt itself in its confusion!' + ld hl, HurtItselfText + call FarBattleTextBox + + xor a + ld [CriticalHit], a + + call Function0x355dd + + call $5612 + + call BattleCommand0a + + xor a + ld [$cfca], a + +; Flicker the monster pic unless flying or underground. + ld de, $0115 + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call CleanGetBattleVarPair + and $60 + call z, PlayFXAnimID + + ld hl, $5f48 + call $7e73 + + ld a, $1 + ld [$ffd4], a + + ld c, $1 + call Function0x35d7e + + jp $5004 +; 343db + + +BattleCommand02: ; 343db +; checkobedience + +; Enemy can't disobey + ld a, [hBattleTurn] + and a + ret nz + + call Function0x34548 + ret nz + +; If we've already checked this turn + ld a, [AlreadyDisobeyed] + and a + ret nz + + xor a + ld [AlreadyDisobeyed], a + +; No obedience in link battles (since no handling exists for enemy) + ld a, [InLinkBattle] + and a + ret nz + + ld a, [$cfc0] + and a + ret nz + +; If the monster's id doesn't match the player's, +; some conditions need to be met. + ld a, PartyMon1ID - PartyMon1 + call BattlePartyAttr + + ld a, [PlayerID] + cp [hl] + jr nz, .obeylevel + inc hl + ld a, [PlayerID + 1] + cp [hl] + ret z + + +.obeylevel +; The maximum obedience level is constrained by owned badges: + ld hl, JohtoBadges + +; risingbadge + bit 7, [hl] + ld a, 101 + jr nz, .getlevel + +; stormbadge + bit 5, [hl] + ld a, 70 + jr nz, .getlevel + +; fogbadge + bit 3, [hl] + ld a, 50 + jr nz, .getlevel + +; hivebadge + bit 1, [hl] + ld a, 30 + jr nz, .getlevel + +; no badges + ld a, 10 + + +.getlevel +; c = obedience level +; d = monster level +; b = c + d + + ld b, a + ld c, a + + ld a, [BattleMonLevel] + ld d, a + + add b + ld b, a + +; No overflow (this should never happen) + jr nc, .checklevel + ld b, $ff + + +.checklevel +; If the monster's level is lower than the obedience level, it will obey. + ld a, c + cp d + ret nc + + +; Random number from 0 to obedience level + monster level +.rand1 + call FarBattleRNG + swap a + cp b + jr nc, .rand1 + +; The higher above the obedience level the monster is, +; the more likely it is to disobey. + cp c + ret c + +; Sleep-only moves have separate handling, and a higher chance of +; being ignored. Lazy monsters like their sleep. + call IgnoreSleepOnly + ret c + + +; Another random number from 0 to obedience level + monster level +.rand2 + call FarBattleRNG + cp b + jr nc, .rand2 + +; A second chance. + cp c + jr c, .UseInstead + + +; No hope of using a move now. + +; b = number of levels the monster is above the obedience level + ld a, d + sub c + ld b, a + +; The chance of napping is the difference out of 256. + call FarBattleRNG + swap a + sub b + jr c, .Nap + +; The chance of not hitting itself is the same. + cp b + jr nc, .DoNothing + +; 'won't obey!' + ld hl, WontObeyText + call FarBattleTextBox + + call HitConfusion + + jp $450c + + +.Nap + call FarBattleRNG + add a + swap a + and 7 + jr z, .Nap + + ld [BattleMonStatus], a + +; 'began to nap!' + ld hl, BeganToNapText + jr .Print + + +.DoNothing + call FarBattleRNG + and 3 + +; 'loafing around!' + ld hl, LoafingAroundText + and a + jr z, .Print + +; 'won't obey!' + ld hl, WontObeyText + dec a + jr z, .Print + +; 'turned away!' + ld hl, TurnedAwayText + dec a + jr z, .Print + +; 'ignored orders!' + ld hl, IgnoredOrdersText + +.Print + call FarBattleTextBox + jp $450c + + +.UseInstead + +; Can't use another move if the monster only has one! + ld a, [BattleMonMove2] + and a + jr z, .DoNothing + +; Don't bother trying to handle Disable. + ld a, [DisabledMove] + and a + jr nz, .DoNothing + + + ld hl, BattleMonPP + ld de, BattleMonMoves + ld b, 0 + ld c, NUM_MOVES + +.GetTotalPP + ld a, [hli] + and $3f ; exclude pp up + add b + ld b, a + + dec c + jr z, .CheckMovePP + +; Stop at undefined moves. + inc de + ld a, [de] + and a + jr nz, .GetTotalPP + + +.CheckMovePP + ld hl, BattleMonPP + ld a, [CurMoveNum] + ld e, a + ld d, 0 + add hl, de + +; Can't use another move if only one move has PP. + ld a, [hl] + and $3f + cp b + jr z, .DoNothing + + +; Make sure we can actually use the move once we get there. + ld a, 1 + ld [AlreadyDisobeyed], a + + ld a, [$cfa3] + ld b, a + +; Save the move we originally picked for afterward. + ld a, [CurMoveNum] + ld c, a + push af + + +.RandomMove + call FarBattleRNG + and 3 + + cp b + jr nc, .RandomMove + +; Not the move we were trying to use. + cp c + jr z, .RandomMove + +; Make sure it has PP. + ld [CurMoveNum], a + ld hl, BattleMonPP + ld e, a + ld d, 0 + add hl, de + ld a, [hl] + and $3f + jr z, .RandomMove + + +; Use it. + ld a, [CurMoveNum] + ld c, a + ld b, 0 + ld hl, BattleMonMoves + add hl, bc + ld a, [hl] + ld [CurPlayerMove], a + + call SetPlayerTurn + call UpdateMoveData + call DoMove + + +; Restore original move choice. + pop af + ld [CurMoveNum], a + + xor a + ld [LastPlayerMove], a + ld [LastEnemyCounterMove], a + + ld hl, PlayerSubStatus5 + res 4, [hl] + +; Break encore too. + xor a + ld [PlayerEncoreCount], a + + jp EndMoveEffect +; 3451f + + +IgnoreSleepOnly: ; 3451f + + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + + cp SNORE + jr z, .CheckSleep + cp SLEEP_TALK + jr z, .CheckSleep + and a + ret + +.CheckSleep + ld a, BATTLE_VARS_STATUS + call CleanGetBattleVarPair + and 7 + ret z + +; 'ignored orders…sleeping!' + ld hl, $4f7b + call FarBattleTextBox + + call EndMoveEffect + + scf + ret +; 34541 + + +BattleCommand03: ; 34541 +; usedmovetext + callba DisplayUsedMoveText + ret +; 34548 + + +Function0x34548: ; 34548 + + ld a, [hBattleTurn] + and a + ld a, [$c732] ; player + jr z, .end + ld a, [$c733] ; enemy +.end + and a + ret +; 34555 + + +BattleCommand04: ; 34555 + call Function0x34548 + ret nz + + ld hl, BattleMonPP + ld de, PlayerSubStatus3 + ld bc, PlayerTurnsTaken + + ld a, [hBattleTurn] + and a + jr z, .asm_34570 + + ld hl, EnemyMonPP + ld de, EnemySubStatus3 + ld bc, EnemyTurnsTaken + +.asm_34570 +; If we've gotten this far, this counts as a turn. + ld a, [bc] + inc a + ld [bc], a + + ld a, BATTLE_VARS_MOVE + call CleanGetBattleVarPair + cp STRUGGLE + ret z + + ld a, [de] + and %111 ; rollout | bide | ??? + ret nz + + call .asm_345ad + ld a, b + and a + jp nz, EndMoveEffect + +; SubStatus5 + inc de + inc de + + ld a, [de] + bit 3, a + ret nz + + ld a, [hBattleTurn] + and a + + ld hl, PartyMon1PP + ld a, [CurBattleMon] + jr z, .asm_345a4 + +; skip this part entirely if wildbattle + ld a, [IsInBattle] + dec a + jr z, .asm_345c5 + + ld hl, OTPartyMon1PP + ld a, [CurOTMon] + +.asm_345a4 + call GetPartyLocation + push hl + call Function0x3460b + pop hl + ret c + +.asm_345ad + ld a, [hBattleTurn] + and a + ld a, [CurMoveNum] + jr z, .asm_345b8 + ld a, [CurEnemyMoveNum] + +.asm_345b8 + ld c, a + ld b, $0 + add hl, bc + ld a, [hl] + and $3f + jr z, .asm_345e3 + dec [hl] + ld b, $0 + ret + +.asm_345c5 + ld hl, EnemyMonMoves + ld a, [CurEnemyMoveNum] + ld c, a + ld b, $0 + add hl, bc + ld a, [hl] + cp MIMIC + jr z, .asm_345dc + ld hl, $c735 + add hl, bc + ld a, [hl] + cp MIMIC + ret z + +.asm_345dc + ld hl, $c739 + call .asm_345ad + ret + +.asm_345e3 + call $7e80 +; get move effect + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair +; continuous? + ld hl, .continuousmoves + ld de, $0001 ; don't skip + call IsInArray + +; 'has no pp left for [move]' + ld hl, $4fba + jr c, .print +; 'but no pp is left for the move' + ld hl, $4f99 +.print + call FarBattleTextBox + ld b, $1 + ret +; 34602 + +.continuousmoves ; 34602 + db $27 ; RAZOR_WIND + db $4b ; SKY_ATTACK + db $91 ; SKULL_BASH + db $97 ; SOLARBEAM + db $9b ; FLY, DIG + db $75 ; ROLLOUT + db $1a ; BIDE + db $1b ; THRASH, PETAL_DANCE, OUTRAGE + db $ff ; end +; 3460b + +Function0x3460b: ; 3460b + ld a, [hBattleTurn] + and a + ld a, [CurMoveNum] + jr z, .asm_34616 + ld a, [CurEnemyMoveNum] + +.asm_34616 + ld c, a + ld a, 2 + call $3945 + + ld a, BATTLE_VARS_MOVE + call CleanGetBattleVarPair + cp MIMIC + jr z, .asm_3462f + + ld b, 0 + add hl, bc + ld a, [hl] + cp MIMIC + jr nz, .asm_3462f + + scf + ret + +.asm_3462f + and a + ret +; 34631 + + +BattleCommand05: ; 34631 +; critical + +; Determine whether this attack's hit will be critical. + + xor a + ld [CriticalHit], a + + ld a, BATTLE_VARS_MOVE_POWER + call CleanGetBattleVarPair + and a + ret z + + ld a, [hBattleTurn] + and a + ld hl, EnemyMonItem + ld a, [EnemyMonSpecies] + jr nz, .Item + ld hl, BattleMonItem + ld a, [BattleMonSpecies] + +.Item + ld c, 0 + + cp CHANSEY + jr nz, .Farfetchd + ld a, [hl] + cp LUCKY_PUNCH + jr nz, .FocusEnergy + +; +2 critical level + ld c, 2 + jr .Tally + +.Farfetchd + cp FARFETCH_D + jr nz, .FocusEnergy + ld a, [hl] + cp STICK + jr nz, .FocusEnergy + +; +2 critical level + ld c, 2 + jr .Tally + +.FocusEnergy + ld a, BATTLE_VARS_SUBSTATUS4 + call CleanGetBattleVarPair + bit 2, a + jr z, .CheckCritical + +; +1 critical level + inc c + +.CheckCritical + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + ld de, 1 + ld hl, .Criticals + push bc + call IsInArray + pop bc + jr nc, .ScopeLens + +; +2 critical level + inc c + inc c + +.ScopeLens + push bc + call GetUserItem + ld a, b + cp $49 ; Increased critical chance. Only Scope Lens has this. + pop bc + jr nz, .Tally + +; +1 critical level + inc c + +.Tally + ld hl, .Chances + ld b, 0 + add hl, bc + call FarBattleRNG + cp [hl] + ret nc + ld a, 1 + ld [CriticalHit], a + ret + +.Criticals + db KARATE_CHOP, RAZOR_WIND, RAZOR_LEAF, CRABHAMMER, SLASH, AEROBLAST, CROSS_CHOP, $ff +.Chances + ; 6.25% 12.1% 24.6% 33.2% 49.6% 49.6% 49.6% + db $11, $20, $40, $55, $80, $80, $80 + ; 0 1 2 3 4 5 6 +; 346b2 + + +BattleCommand4e: ; 346b2 + ld a, [$c689] + ld b, a + inc b + ld hl, CurDamage + 1 + ld a, [hld] + ld e, a + ld a, [hli] + ld d, a +.asm_346be + dec b + ret z + ld a, [hl] + add e + ld [hld], a + ld a, [hl] + adc d + ld [hli], a + jr nc, .asm_346be ; 346c6 $f6 + ld a, $ff + ld [hld], a + ld [hl], a + ret +; 346cd + + +BattleCommand4f: ; 346cd + ld hl, $c689 + inc [hl] + ret +; 346d2 + + +BattleCommand07: ; 346d2 + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + cp STRUGGLE + ret z + + ld hl, BattleMonType1 + ld a, [hli] + ld b, a + ld c, [hl] + ld hl, EnemyMonType1 + ld a, [hli] + ld d, a + ld e, [hl] + ld a, [hBattleTurn] + and a + jr z, .asm_346f7 + + ld hl, EnemyMonType1 + ld a, [hli] + ld b, a + ld c, [hl] + ld hl, BattleMonType1 + ld a, [hli] + ld d, a + ld e, [hl] + +.asm_346f7 + ld a, BATTLE_VARS_MOVE_TYPE + call GetBattleVarPair + ld [$d265], a + + push hl + push de + push bc + ld a, $3e + ld hl, $7da4 + rst FarCall + pop bc + pop de + pop hl + + push de + push bc + ld a, $3e + ld hl, $7e24 + rst FarCall + pop bc + pop de + + ld a, [$d265] + cp b + jr z, .asm_34720 + cp c + jr z, .asm_34720 + jr .asm_3473a + +.asm_34720 + ld hl, CurDamage + 1 + ld a, [hld] + ld h, [hl] + ld l, a + ld b, h + ld c, l + srl b + rr c + add hl, bc + ld a, h + ld [CurDamage], a + ld a, l + ld [CurDamage + 1], a + ld hl, TypeModifier + set 7, [hl] +.asm_3473a + ld a, BATTLE_VARS_MOVE_TYPE + call CleanGetBattleVarPair + ld b, a + ld hl, TypeMatchup +.asm_34743 + ld a, [hli] + cp $ff + jr z, .asm_347b7 ; 34746 $6f + cp $fe + jr nz, .asm_34757 ; 3474a $b + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call CleanGetBattleVarPair + bit 3, a + jr nz, .asm_347b7 ; 34753 $62 + jr .asm_34743 ; 34755 $ec +.asm_34757 + cp b + jr nz, .asm_347b3 ; 34758 $59 + ld a, [hl] + cp d + jr z, .asm_34763 ; 3475c $5 + cp e + jr z, .asm_34763 ; 3475f $2 + jr .asm_347b3 ; 34761 $50 +.asm_34763 + push hl + push bc + inc hl + ld a, [TypeModifier] + and %10000000 + ld b, a + ld a, [hl] + and a + jr nz, .asm_34775 ; 3476e $5 + inc a + ld [AttackMissed], a + xor a +.asm_34775 + ld [$ffb7], a + add b + ld [TypeModifier], a + xor a + ld [$ffb4], a + ld hl, CurDamage + ld a, [hli] + ld [$ffb5], a + ld a, [hld] + ld [$ffb6], a + call $3119 + ld a, [$ffb4] + ld b, a + ld a, [$ffb5] + or b + ld b, a + ld a, [$ffb6] + or b + jr z, .asm_347ab ; 34794 $15 + ld a, $a + ld [$ffb7], a + ld b, $4 + call $3124 + ld a, [$ffb5] + ld b, a + ld a, [$ffb6] + or b + jr nz, .asm_347ab ; 347a5 $4 + ld a, $1 + ld [$ffb6], a +.asm_347ab + ld a, [$ffb5] + ld [hli], a + ld a, [$ffb6] + ld [hl], a + pop bc + pop hl +.asm_347b3 + inc hl + inc hl + jr .asm_34743 ; 347b5 $8c +.asm_347b7 + call Function0x347c8 + ld a, [$d265] + ld b, a + ld a, [TypeModifier] + and $80 + or b + ld [TypeModifier], a + ret +; 347c8 + + +Function0x347c8: ; 347c8 + ld hl, EnemyMonType1 + ld a, [hBattleTurn] + and a + jr z, .asm_347d3 ; 0x347ce $3 + ld hl, BattleMonType1 +.asm_347d3 + push hl + push de + push bc + ld a, $f + call CleanGetBattleVarPair + ld d, a + ld b, [hl] + inc hl + ld c, [hl] + ld a, $a + ld [$d265], a + ld hl, TypeMatchup +.asm_347e7 + ld a, [hli] + cp $ff + jr z, .asm_3482f ; 0x347ea $43 + cp $fe + jr nz, .asm_347fb ; 0x347ee $b + ld a, $5 + call CleanGetBattleVarPair + bit 3, a + jr nz, .asm_3482f ; 0x347f7 $36 + jr .asm_347e7 ; 0x347f9 $ec +.asm_347fb + cp d + jr nz, .asm_34807 ; 0x347fc $9 + ld a, [hli] + cp b + jr z, .asm_3480b ; 0x34800 $9 + cp c + jr z, .asm_3480b ; 0x34803 $6 + jr .asm_34808 ; 0x34805 $1 +.asm_34807 + inc hl +.asm_34808 + inc hl + jr .asm_347e7 ; 0x34809 $dc +.asm_3480b + xor a + ld [$ffb3], a + ld [$ffb4], a + ld [$ffb5], a + ld a, [hli] + ld [$ffb6], a + ld a, [$d265] + ld [$ffb7], a + call Multiply + ld a, $a + ld [$ffb7], a + push bc + ld b, $4 + call Divide + pop bc + ld a, [$ffb6] + ld [$d265], a + jr .asm_347e7 ; 0x3482d $b8 +.asm_3482f + pop bc + pop de + pop hl + ret +; 34833 + + +BattleCommanda3: ; 34833 + call Function0x347c8 + ld a, [$d265] + and a + ld a, $a + jr nz, .asm_3484a ; 3483c $c + call ResetDamage + xor a + ld [TypeModifier], a + inc a + ld [AttackMissed], a + ret +.asm_3484a + ld [$d265], a + ret +; 3484e + + +; 3484e + push hl + push de + push bc + ld a, $a + ld [$c716], a + ld hl, PlayerUsedMoves + ld a, [hl] + and a + jr z, .asm_348b0 ; 0x3485b $53 + ld d, $4 + ld e, $0 +.asm_34861 + ld a, [hli] + and a + jr z, .asm_3489f ; 0x34863 $3a + push hl + dec a + ld hl, $5afd + call $7ea1 + and a + jr z, .asm_3489b ; 0x3486e $2b + inc hl + call $7ebb + ld hl, EnemyMonType1 + call $47d3 + ld a, [$d265] + cp $b + jr nc, .asm_34895 ; 0x3487f $14 + and a + jr z, .asm_3489b ; 0x34882 $17 + cp $a + jr nc, .asm_34891 ; 0x34886 $9 + ld a, e + cp $1 + jr nc, .asm_3489b ; 0x3488b $e + ld e, $1 + jr .asm_3489b ; 0x3488f $a +.asm_34891 + ld e, $2 + jr .asm_3489b ; 0x34893 $6 +.asm_34895 + call $4931 + pop hl + jr .asm_348d7 ; 0x34899 $3c +.asm_3489b + pop hl + dec d + jr nz, .asm_34861 ; 0x3489d $c2 +.asm_3489f + ld a, e + cp $2 + jr z, .asm_348d7 ; 0x348a2 $33 + call $4939 + ld a, e + and a + jr nz, .asm_348d7 ; 0x348a9 $2c + call $4939 + jr .asm_348d7 ; 0x348ae $27 +.asm_348b0 + ld a, [BattleMonType1] + ld b, a + ld hl, EnemyMonType1 + call $47d3 + ld a, [$d265] + cp $b + jr c, .asm_348c4 ; 0x348bf $3 + call $4931 +.asm_348c4 + ld a, [BattleMonType2] + cp b + jr z, .asm_348d7 ; 0x348c8 $d + call $47d3 + ld a, [$d265] + cp $b + jr c, .asm_348d7 ; 0x348d2 $3 + call $4931 +.asm_348d7 + call $48de + pop bc + pop de + pop hl + ret +; 348de + + +; 348de + ld de, EnemyMonMove1 + ld b, 5 + ld c, 0 + + ld a, [$d265] + push af + +.loop + dec b + jr z, .exit + + ld a, [de] + and a + jr z, .exit + + inc de + dec a + ld hl, $5afd + call $7ea1 + and a + jr z, .loop + + inc hl + call $7ebb + ld hl, BattleMonType1 + call $47d3 + ld a, [$d265] + and a + jr z, .loop + + inc c + cp $a + jr c, .loop + + inc c + inc c + inc c + inc c + inc c + + cp $a + jr z, .loop + + ld c, $64 + jr .loop +.exit + + pop af + ld [$d265], a + + ld a, c + and a + jr z, .doubledown + cp $5 + jr c, .down + cp $64 + ret c + jr .up + +.doubledown + call .down + +.down + ld a, [$c716] + dec a + ld [$c716], a + ret + +.up + ld a, [$c716] + inc a + ld [$c716], a + ret +; 34941 + + +; 34941 + xor a + ld [$c717], a + call $49f4 + ret c + + ld a, [EnemySubStatus1] + bit 4, a + jr z, .asm_34986 + + ld a, [$c67f] + cp $1 + jr nz, .asm_34986 + + call $49f4 + call $4b77 + call $4b20 + call $4a85 + ld a, e + cp $2 + jr nz, .asm_34971 + + ld a, [$c716] + add $30 + ld [$c717], a + ret + +.asm_34971 + call $49f4 + sla c + sla c + ld b, $ff + +.asm_3497a + inc b + sla c + jr nc, .asm_3497a + + ld a, b + add $30 + ld [$c717], a + ret + +.asm_34986 + call $484e + ld a, [$c716] + cp $b + ret nc + + ld a, [LastEnemyCounterMove] + and a + jr z, .asm_349d2 + + call $4a2a + ld a, [$c716] + and a + jr z, .asm_349d2 + + ld c, a + call $4aa7 + ld a, [$c716] + cp $ff + ret z + + ld b, a + ld a, e + cp $2 + jr z, .asm_349be + + call $484e + ld a, [$c716] + cp $a + ret nc + + ld a, b + add $10 + ld [$c717], a + ret + +.asm_349be + ld c, $10 + call $484e + ld a, [$c716] + cp $a + jr nc, .asm_349cc + ld c, $20 + +.asm_349cc + ld a, b + add c + ld [$c717], a + ret + +.asm_349d2 + call $484e + ld a, [$c716] + cp $a + ret nc + + call $49f4 + call $4b77 + call $4b20 + call $4a85 + + ld a, e + cp $2 + ret nz + + ld a, [$c716] + add $10 + ld [$c717], a + ret +; 349f4 + + +; 349f4 + ld a, [OTPartyCount] + cp $2 + jr c, .asm_34a26 + + ld d, a + ld e, $0 + ld b, $20 + ld c, $0 + ld hl, OTPartyMon1CurHP + +.asm_34a05 + ld a, [CurOTMon] + cp e + jr z, .asm_34a16 + + push bc + ld b, [hl] + inc hl + ld a, [hld] + or b + pop bc + jr z, .asm_34a16 + + ld a, c + or b + ld c, a +.asm_34a16 + srl b + push bc + ld bc, $0030 + add hl, bc + pop bc + inc e + dec d + jr nz, .asm_34a05 + + ld a, c + and a + jr nz, .asm_34a28 + +.asm_34a26 + scf + ret + +.asm_34a28 + and a + ret +; 34a2a + + +; 34a2a + ld hl, OTPartyMon1Species2 + ld a, [OTPartyCount] + ld b, a + ld c, $20 + ld d, 0 + xor a + ld [$c716], a + +.asm_34a39 + ld a, [CurOTMon] + cp d + push hl + jr z, .asm_34a77 + + push hl + push bc + ld bc, $0022 + add hl, bc + pop bc + ld a, [hli] + or [hl] + pop hl + jr z, .asm_34a77 + + ld a, [hl] + ld [CurSpecies], a + call GetBaseStats + ld a, [LastEnemyCounterMove] + dec a + ld hl, $5afd + call $7ea1 + and a + jr z, .asm_34a77 + + inc hl + call $7ebb + ld hl, $d23d + call $47d3 + ld a, [$d265] + and a + jr nz, .asm_34a77 + + ld a, [$c716] + or c + ld [$c716], a +.asm_34a77 + pop hl + dec b + ret z + + push bc + ld bc, $30 + add hl, bc + pop bc + + inc d + srl c + jr .asm_34a39 + + push bc + ld a, [OTPartyCount] + ld e, a + ld hl, OTPartyMon1CurHP + ld b, $20 + ld c, $0 +.asm_34a91 + ld a, [hli] + or [hl] + jr z, .asm_34a98 + + ld a, b + or c + ld c, a +.asm_34a98 + srl b + push bc + ld bc, $002f + add hl, bc + pop bc + dec e + jr nz, .asm_34a91 + + ld a, c + pop bc + + and c + ld c, a + ld a, $ff + ld [$c716], a + ld hl, OTPartyMon1Move1 + ld b, $20 + ld d, $0 + ld e, $0 +.asm_34ab5 + ld a, b + and c + jr z, .asm_34b00 + + push hl + push bc + ld b, $4 + ld c, $0 +.asm_34abf + ld a, [hli] + and a + push hl + jr z, .asm_34aef + + dec a + ld hl, $5afd + call $7ea1 + and a + jr z, .asm_34ae9 + + inc hl + call $7ebb + ld hl, BattleMonType1 + call $47d3 + ld a, [$d265] + cp $a + jr c, .asm_34ae9 + + ld e, $1 + cp $b + jr c, .asm_34ae9 + + ld e, $2 + jr .asm_34aef + +.asm_34ae9 + pop hl + dec b + jr nz, .asm_34abf + + jr .asm_34af0 + +.asm_34aef + pop hl +.asm_34af0 + ld a, e + pop bc + pop hl + cp $2 + jr z, .asm_34b0e + + cp $1 + jr nz, .asm_34b00 + + ld a, d + or b + ld d, a + jr .asm_34b00 + +.asm_34b00 + push bc + ld bc, $0030 + add hl, bc + pop bc + srl b + jr nc, .asm_34ab5 + + ld a, d + ld b, a + and a + ret z + +.asm_34b0e + push bc + sla b + sla b + ld c, $ff +.asm_34b15 + inc c + sla b + jr nc, .asm_34b15 + + ld a, c + ld [$c716], a + pop bc + ret +; 34b20 + + +; 34b20 + push bc + ld hl, OTPartySpecies + ld b, $20 + ld c, $0 + +.asm_34b28 + ld a, [hli] + cp $ff + jr z, .asm_34b72 + + push hl + ld [CurSpecies], a + call GetBaseStats + ld a, [LastEnemyCounterMove] + and a + jr z, .asm_34b4a + + dec a + ld hl, $5afd + call $7ea1 + and a + jr z, .asm_34b4a + + inc hl + call $7ebb + jr .asm_34b5d + +.asm_34b4a + ld a, [BattleMonType1] + ld hl, $d23d + call $47d3 + ld a, [$d265] + cp $b + jr nc, .asm_34b6d + ld a, [BattleMonType2] + +.asm_34b5d + ld hl, $d23d + call $47d3 + ld a, [$d265] + cp $b + jr nc, .asm_34b6d + + ld a, b + or c + ld c, a + +.asm_34b6d + srl b + pop hl + jr .asm_34b28 + +.asm_34b72 + ld a, c + pop bc + and c + ld c, a + ret +; 34b77 + + +; 34b77 + push bc + ld de, OTPartySpecies + ld b, $20 + ld c, $0 + ld hl, OTPartyMon1CurHP + +.asm_34b82 + ld a, [de] + inc de + cp $ff + jr z, .asm_34bac + + push hl + push bc + ld b, [hl] + inc hl + ld c, [hl] + inc hl + inc hl + srl c + rl b + srl c + rl b + ld a, [hld] + cp c + ld a, [hl] + sbc b + pop bc + jr nc, .asm_34ba1 + + ld a, b + or c + ld c, a + +.asm_34ba1 + srl b + pop hl + push bc + ld bc, $0030 + add hl, bc + pop bc + jr .asm_34b82 + +.asm_34bac + ld a, c + pop bc + and c + ld c, a + ret +; 34bb1 + + +TypeMatchup: ; 34bb1 +INCLUDE "battle/type_matchup.asm" +; 34cfd + + +BattleCommand08: ; 34cfd +; damagevariation + +; Modify the damage spread between 85% and 100%. + +; Because of the method of division the probability distribution +; is not consistent. This makes the highest damage multipliers +; rarer than normal. + + +; No point in reducing 1 or 0 damage. + ld hl, CurDamage + ld a, [hli] + and a + jr nz, .go + ld a, [hl] + cp 2 + ret c + +.go +; Start with the maximum damage. + xor a + ld [$ffb4], a + dec hl + ld a, [hli] + ld [$ffb5], a + ld a, [hl] + ld [$ffb6], a + +; Multiply by 85-100%... +.loop + call FarBattleRNG + rrca + cp $d9 ; 85% + jr c, .loop + + ld [$ffb7], a + call Multiply + +; ...divide by 100%... + ld a, $ff ; 100% + ld [$ffb7], a + ld b, $4 + call Divide + +; ...to get .85-1.00x damage. + ld a, [$ffb5] + ld hl, CurDamage + ld [hli], a + ld a, [$ffb6] + ld [hl], a + ret +; 34d32 + + +BattleCommand09: ; 34d32 +; checkhit + + call .DreamEater + jp z, .Miss + + call .Protect + jp nz, .Miss + + call .DrainSub + jp z, .Miss + + call .LockOn + ret nz + + call .FlyDigMoves + jp nz, .Miss + + call .ThunderRain + ret z + + call .UnleashedEnergy + ret nz + +; Perfect-accuracy moves + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $11 + ret z + + call .StatModifiers + + ld a, [PlayerMoveAccuracy] + ld b, a + ld a, [hBattleTurn] + and a + jr z, .BrightPowder + ld a, [EnemyMoveAccuracy] + ld b, a + +.BrightPowder + push bc + call GetOpponentItem + ld a, b + cp $4d ; brightpowder + ld a, c ; % miss + pop bc + jr nz, .asm_34d81 + + ld c, a + ld a, b + sub c + ld b, a + jr nc, .asm_34d81 + ld b, 0 + +.asm_34d81 + ld a, b + cp $ff + jr z, .Hit + + call FarBattleRNG + cp b + jr nc, .Miss + +.Hit + ret + + +.Miss +; Keep the damage value intact if we're using (Hi) Jump Kick. + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $2d + jr z, .Missed + call ResetDamage + +.Missed + ld a, 1 + ld [AttackMissed], a + ret + + +.DreamEater +; Return z if we're trying to eat the dream of +; a monster that isn't sleeping. + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $8 + ret nz + + ld a, BATTLE_VARS_STATUS_OPP + call CleanGetBattleVarPair + and 7 ; sleep + ret + + +.Protect +; Return nz if the opponent is protected. + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call CleanGetBattleVarPair + bit 2, a + ret z + + ld c, 40 + call DelayFrames + +; 'protecting itself!' + ld hl, BattleText_0x8167a + call FarBattleTextBox + + ld c, 40 + call DelayFrames + + ld a, 1 + and a + ret + + +.LockOn +; Return nz if we are locked-on and aren't trying to use Earthquake, +; Fissure or Magnitude on a monster that is flying. + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call GetBattleVarPair + bit 5, [hl] + res 5, [hl] + ret z + + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call CleanGetBattleVarPair + bit 6, a ; flying + jr z, .LockedOn + + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + + cp EARTHQUAKE + ret z + cp FISSURE + ret z + cp MAGNITUDE + ret z + +.LockedOn + ld a, 1 + and a + ret + + +.DrainSub +; Return z if using an HP drain move on a substitute. + call CheckSubstituteOpp ; CheckOpponentSub + jr z, .asm_34e00 + + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + + cp $3 ; drain + ret z + cp $8 ; dream eater + ret z + +.asm_34e00 + ld a, 1 + and a + ret + + +.FlyDigMoves +; Check for moves that can hit underground/flying opponents. +; Return z if the current move can hit the opponent. + + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call CleanGetBattleVarPair + and $60 ; fly | dig + ret z + + bit 6, a + jr z, .DigMoves + + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + + cp GUST + ret z + cp WHIRLWIND + ret z + cp THUNDER + ret z + cp TWISTER + ret + +.DigMoves + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + + cp EARTHQUAKE + ret z + cp FISSURE + ret z + cp MAGNITUDE + ret + + +.ThunderRain +; Return z if the current move always hits in rain, and it is raining. + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $98 + ret nz + + ld a, [Weather] + cp WEATHER_RAIN + ret + + +.UnleashedEnergy +; Return nz if unleashing energy from Bide. + ld a, BATTLE_VARS_SUBSTATUS4 + call CleanGetBattleVarPair + bit 0, a + ret + + +.StatModifiers + + ld a, [hBattleTurn] + and a + + ld hl, PlayerMoveAccuracy + ld a, [PlayerAccLevel] + ld b, a + ld a, [EnemyEvaLevel] + ld c, a + + jr z, .asm_34e60 + + ld hl, EnemyMoveAccuracy + ld a, [EnemyAccLevel] + ld b, a + ld a, [PlayerEvaLevel] + ld c, a + +.asm_34e60 + cp b + jr c, .asm_34e6b + + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call CleanGetBattleVarPair + bit 3, a + ret nz + +.asm_34e6b + ld a, $e + sub c + ld c, a + xor a + ld [$ffb4], a + ld [$ffb5], a + ld a, [hl] + ld [$ffb6], a + push hl + ld d, $2 + +.asm_34e7a + push bc + ld hl, .AccProb + dec b + sla b + ld c, b + ld b, 0 + add hl, bc + pop bc + ld a, [hli] + ld [$ffb7], a + call Multiply + ld a, [hl] + ld [$ffb7], a + ld b, $4 + call Divide + ld a, [$ffb6] + ld b, a + ld a, [$ffb5] + or b + jr nz, .asm_34ea2 + ld [$ffb5], a + ld a, $1 + ld [$ffb6], a + +.asm_34ea2 + ld b, c + dec d + jr nz, .asm_34e7a + + ld a, [$ffb5] + and a + ld a, [$ffb6] + jr z, .asm_34eaf + ld a, $ff + +.asm_34eaf + pop hl + ld [hl], a + ret + +.AccProb + db 33, 100 ; 33% -6 + db 36, 100 ; 36% -5 + db 43, 100 ; 43% -4 + db 50, 100 ; 50% -3 + db 60, 100 ; 60% -2 + db 75, 100 ; 75% -1 + db 1, 1 ; 100% 0 + db 133, 100 ; 133% +1 + db 166, 100 ; 166% +2 + db 2, 1 ; 200% +3 + db 233, 100 ; 233% +4 + db 133, 50 ; 266% +5 + db 3, 1 ; 300% +6 + +; 34ecc + + +BattleCommand90: ; 34ecc + xor a + ld [$c70d], a + call CheckSubstituteOpp + jr nz, .asm_34ee7 ; 34ed3 $12 + push hl + ld hl, PlayerMoveEffectChance + ld a, [hBattleTurn] + and a + jr z, .asm_34ee1 ; 34edc $3 + ld hl, EnemyMoveEffectChance +.asm_34ee1 + call FarBattleRNG + cp [hl] + pop hl + ret c +.asm_34ee7 + ld a, $1 + ld [$c70d], a + and a + ret +; 34eee + + +BattleCommand0a: ; 34eee + ld a, BATTLE_VARS_SUBSTATUS4 + call CleanGetBattleVarPair + bit 4, a + ret z + + ld a, BATTLE_VARS_SUBSTATUS3 + call CleanGetBattleVarPair + bit 4, a + jr nz, .asm_34f18 + + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $27 ; razor wind + jr z, .asm_34f21 + cp $4b ; sky attack + jr z, .asm_34f21 + cp $91 ; skull bash + jr z, .asm_34f21 + cp $97 ; solarbeam + jr z, .asm_34f21 + cp $9b ; fly / dig + jr z, .asm_34f21 + +.asm_34f18 + call .Rampage + jr z, .asm_34f21 + + call Function0x34548 + ret nz + +.asm_34f21 + call $7ed5 + jr c, .asm_34f36 + + xor a + ld [$cfca], a + ld [FXAnimIDHi], a + inc a + ld [$c689], a + ld a, $a4 + jp $7e44 + +.asm_34f36 + call $65c3 + jp $7e80 + +.Rampage + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $75 ; rollout + jr z, .asm_34f4d + cp $1b ; rampage + jr z, .asm_34f4d + + ld a, 1 + and a + ret + +.asm_34f4d + ld a, [$c73e] + and a + ld a, 0 + ld [$c73e], a + ret +; 34f57 + + +BattleCommandab: ; 34f57 +; hittarget + call BattleCommand0a + call BattleCommand0b + jp BattleCommand0c +; 34f60 + + +BattleCommand0b: ; 34f60 + ld a, [AttackMissed] + and a + jp nz, $7e80 + + ld a, [hBattleTurn] + and a + ld de, $c672 + ld a, 1 + jr z, .asm_34f76 + ld de, $c67a + ld a, 4 + +.asm_34f76 + ld [$cfca], a + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $1d ; multihit + jr z, .asm_34fb0 + cp $1e ; conversion + jr z, .asm_34fb0 + cp $2c ; double kick / bonemerang + jr z, .asm_34fb0 + cp $4d ; twineedle + jr z, .asm_34fb0 + cp $68 ; triple kick + jr z, .asm_34f96 + xor a + ld [$c689], a + +.asm_34f96 + + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + ld e, a + ld d, 0 + call PlayFXAnimID + + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + cp FLY + jr z, .asm_34fad + cp DIG + ret nz + +.asm_34fad +; clear sprite + jp $7ec7 +.asm_34fb0 + ld a, [$c689] + and $1 + xor $1 + ld [$c689], a + ld a, [de] + cp $1 + push af + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + ld e, a + ld d, $0 + pop af + jp z, PlayFXAnimID + xor a + ld [$cfca], a + jp PlayFXAnimID +; 34fd1 + + +BattleCommand92: ; 34fd1 + ld a, [AttackMissed] + and a + jp nz, $7e80 + + xor a + jr BattleCommand91_92 +; 34fdb + + +BattleCommand91: ; 34fdb + ld a, [AttackMissed] + and a + jp nz, $7e80 + + ld a, [hBattleTurn] + and a + ld a, 2 + jr z, BattleCommand91_92 + ld a, 5 + + ; fallthrough +; 34feb + + +BattleCommand91_92: ; 34feb + ld [$cfca], a + xor a + ld [$c689], a + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + ld e, a + ld d, 0 + jp PlayFXAnimID +; 34ffd + + +BattleCommand93: ; 34ffd + ld a, [hBattleTurn] + xor $1 + ld [hBattleTurn], a + ret +; 35004 + + +BattleCommand0c: ; 35004 + ld a, BATTLE_VARS_SUBSTATUS4 + call CleanGetBattleVarPair + bit 4, a + ret z + call $7ed5 + jp c, BattleCommanda6 + xor a + ld [$cfca], a + ld [FXAnimIDHi], a + ld a, $2 + ld [$c689], a + ld a, $a4 + jp $7e44 +; 35023 + + +BattleCommand0d: ; 35023 + ld a, [AttackMissed] + and a + ret z + call $50e4 + ld a, BATTLE_VARS_MOVE_ANIM + call GetBattleVarPair + cp $13 + jr z, .asm_3504f ; 35032 $1b + cp $5b + jr z, .asm_3504f ; 35036 $17 + inc hl + ld a, [hl] + cp $1d + jr z, .asm_35049 ; 3503c $b + cp $2c + jr z, .asm_35049 ; 35040 $7 + cp $4d + jr z, .asm_35049 ; 35044 $3 + jp EndMoveEffect +.asm_35049 + call BattleCommand0c + jp EndMoveEffect +.asm_3504f + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + res 5, [hl] + res 6, [hl] + call $7ece + jp EndMoveEffect +; 3505e + + +BattleCommand0e: ; 3505e + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call CleanGetBattleVarPair + bit 5, a + jr z, .asm_35072 ; 35065 $b + call $5c94 + ld b, $0 + jr nc, .asm_3508b ; 3506c $1d + ld b, $1 + jr .asm_3508b ; 35070 $19 + +.asm_35072 + call GetOpponentItem + ld a, b + cp $4f + ld b, $0 + jr nz, .asm_3508b ; 3507a $f + call FarBattleRNG + cp c + jr nc, .asm_3508b ; 35080 $9 + call $5c94 + ld b, $0 + jr nc, .asm_3508b ; 35087 $2 + ld b, $2 +.asm_3508b + push bc + call .asm_50bb + ld c, $0 + ld a, [hBattleTurn] + and a + jr nz, .asm_3509b + call Function0x35d1c + jr .asm_3509e + +.asm_3509b + call Function0x35d7e + +.asm_3509e + pop bc + ld a, b + and a + ret z + dec a + jr nz, .asm_350ab ; 350a3 $6 + ld hl, $4eb0 + jp FarBattleTextBox + +.asm_350ab + call GetOpponentItem + ld a, [hl] + ld [$d265], a + call $3468 + ld hl, $4e99 + jp FarBattleTextBox + +.asm_50bb + ld a, $8 + call CleanGetBattleVarPair + bit 4, a + ret nz + ld de, EnemyDamageTaken + ld a, [hBattleTurn] + and a + jr nz, .asm_350ce ; 0x350c9 $3 + ld de, $c685 + +.asm_350ce + ld a, [CurDamage + 1] + ld b, a + ld a, [de] + add b + ld [de], a + dec de + ld a, [CurDamage] + ld b, a + ld a, [de] + adc b + ld [de], a + ret nc + ld a, $ff + ld [de], a + inc de + ld [de], a + ret +; 350e4 + + +; 350e4 + ld hl, $5071 + ld de, $5071 + ld a, [TypeModifier] + and $7f + jr z, .asm_35110 ; 0x350ef $1f + ld a, $d + call CleanGetBattleVarPair + cp $94 + ld hl, $54f0 + ld de, $5500 + jr z, .asm_35110 ; 0x350fe $10 + ld hl, $5020 + ld de, $5033 + ld a, [CriticalHit] + cp $ff + jr nz, .asm_35110 ; 0x3510b $3 + ld hl, $5061 +.asm_35110 + call Function0x35157 + xor a + ld [CriticalHit], a + ld a, $d + call CleanGetBattleVarPair + cp $2d + ret nz + ld a, [TypeModifier] + and $7f + ret z + ld hl, CurDamage + ld a, [hli] + ld b, [hl] + srl a + rr b + srl a + rr b + srl a + rr b + ld [hl], b + dec hl + ld [hli], a + or b + jr nz, .asm_3513e ; 0x3513a $2 + inc a + ld [hl], a +.asm_3513e + ld hl, $5046 + call FarBattleTextBox + ld a, $1 + ld [$c689], a + call $7e36 + ld c, $1 + ld a, [hBattleTurn] + and a + jp nz, Function0x35d1c + jp Function0x35d7e + +Function0x35157: ; 35157 + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call CleanGetBattleVarPair + bit 2, a ; protect + jr z, .asm_35162 + ld h, d + ld l, e +.asm_35162 + jp FarBattleTextBox +; 35165 + + +BattleCommanda5: ; 35165 + ld a, [AttackMissed] + and a + ret z + + ld a, [TypeModifier] + and $7f + jp z, PrintDoesntAffect + jp $734e +; 35175 + + +BattleCommand0f: ; 35175 +; criticaltext +; Prints the message for critical hits or one-hit KOs. + +; If there is no message to be printed, wait 20 frames. + ld a, [CriticalHit] + and a + jr z, .wait + + dec a + add a + ld hl, .ptrs + ld b, 0 + ld c, a + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + call FarBattleTextBox + + xor a + ld [CriticalHit], a + +.wait + ld c, 20 + jp DelayFrames + +.ptrs + dw BattleText_0x81086 ; 'critical hit' + dw BattleText_0x81097 ; 'one-hit ko' +; 35197 + + +BattleCommandae: ; 35197 +; player + ld hl, $c672 + ld a, [hBattleTurn] + and a + jr z, .asm_351a2 +; enemy + ld hl, $c67a + +.asm_351a2 + xor a + ld [hl], a + ret +; 351a5 + + +BattleCommandad: ; 351a5 + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + bit 2, a + ret nz + + ; fallthrough +; 351ad + + +BattleCommand10: ; 351ad + ld a, [TypeModifier] + and $7f + cp 10 ; 1.0 + ret z + ld hl, BattleText_0x810aa ; 'super-effective' + jr nc, .print + ld hl, BattleText_0x810c1 ; 'not very effective' +.print + jp FarBattleTextBox +; 351c0 + + +BattleCommand11: ; 351c0 + ld hl, EnemyMonHPHi + ld a, [hBattleTurn] + and a + jr z, .asm_351cb + ld hl, BattleMonHP +.asm_351cb + ld a, [hli] + or [hl] + ret nz + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call CleanGetBattleVarPair + bit 6, a + jr z, .asm_35231 ; 351d5 $5a + ld hl, $50da + call FarBattleTextBox + ld a, [hBattleTurn] + and a + ld hl, EnemyMonMaxHPLo + ld bc, $c4ca + ld a, $0 + jr nz, .asm_351f2 ; 351e8 $8 + ld hl, $c63f + ld bc, $c55e + ld a, $1 +.asm_351f2 + ld [$d10a], a + ld a, [hld] + ld [$d1ea], a + ld a, [hld] + ld [$d1eb], a + ld a, [hl] + ld [$d1ec], a + xor a + ld [hld], a + ld a, [hl] + ld [$d1ed], a + xor a + ld [hl], a + ld [$d1ee], a + ld [$d1ef], a + ld h, b + ld l, c + ld a, $b + call $2d83 + call $39c9 + call $4ffd + xor a + ld [$cfca], a + ld [FXAnimIDHi], a + inc a + ld [$c689], a + ld a, $c2 + call $7e44 + call $4ffd + jr .asm_3524d ; 3522f $1c +.asm_35231 + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $1d + jr z, .asm_3524a ; 35238 $10 + cp $2c + jr z, .asm_3524a ; 3523c $c + cp $4d + jr z, .asm_3524a ; 35240 $8 + cp $68 + jr z, .asm_3524a ; 35244 $4 + cp $9a + jr nz, .asm_3524d ; 35248 $3 +.asm_3524a + call BattleCommand0c +.asm_3524d + jp EndMoveEffect +; 35250 + + +BattleCommand12: ; 35250 + jp .start +.start + ld a, [AttackMissed] + and a + ret nz + ld a, $8 + call CleanGetBattleVarPair + bit 6, a + ret z + ld de, $c72c + ld a, [hBattleTurn] + and a + jr z, .asm_3526b + ld de, $c72b +.asm_3526b + ld a, [de] + inc a + ret z + ld [de], a + call $4ffd + ld hl, $50f3 + call FarBattleTextBox + jp $4ffd +; 3527b + + +BattleCommanda2: ; 3527b + ld a, [CurDamage] + ld h, a + ld b, a + ld a, [CurDamage + 1] + ld l, a + ld c, a + ld a, [hBattleTurn] + and a + ld a, [$c72b] + jr z, .asm_35290 ; 3528b $3 + ld a, [$c72c] +.asm_35290 + and a + jr z, .asm_3529a ; 35291 $7 + dec a + add hl, bc + jr nc, .asm_35290 ; 35295 $f9 + ld hl, $ffff +.asm_3529a + ld a, h + ld [CurDamage], a + ld a, l + ld [CurDamage + 1], a + ret +; 352a3 + + +EndMoveEffect: ; 352a3 + ld a, [BattleScriptBufferLoc] + ld l, a + ld a, [BattleScriptBufferLoc + 1] + ld h, a + ld a, $ff + ld [hli], a + ld [hli], a + ld [hl], a + ret +; 352b1 + + +DittoMetalPowder: ; 352b1 + ld a, PartyMon1Species - PartyMon1 + call BattlePartyAttr + ld a, [hBattleTurn] + and a + ld a, [hl] + jr nz, .Ditto + ld a, [TempEnemyMonSpecies] + +.Ditto + cp DITTO + ret nz + + push bc + call GetOpponentItem + ld a, [hl] + cp METAL_POWDER + pop bc + ret nz + + ld a, c + srl a + add c + ld c, a + ret nc + + srl b + ld a, b + and a + jr nz, .asm_352d8 + inc b +.asm_352d8 + scf + rr c + ret +; 352dc + + +BattleCommand06: ; 352dc +; damagecalc + + ld a, [hBattleTurn] + and a + jp nz, EnemyAttackDamage + + ; fallthrough +; 352e2 + + +PlayerAttackDamage: ; 352e2 + + call ResetDamage + ld hl, PlayerMovePower + ld a, [hli] + and a + ld d, a + ret z + ld a, [hl] + cp $14 + jr nc, .asm_35315 ; 352ef $24 + ld hl, EnemyMonDef + ld a, [hli] + ld b, a + ld c, [hl] + ld a, [$c700] + bit 4, a + jr z, .asm_35302 ; 352fc $4 + sla c + rl b +.asm_35302 + ld hl, BattleMonAtk + call GetDamageStatsCritical + jr c, .asm_3533c ; 35308 $32 + ld hl, $c6c3 + ld a, [hli] + ld b, a + ld c, [hl] + ld hl, $c6b6 + jr .asm_3533c ; 35313 $27 +.asm_35315 + ld hl, EnemyMonSpclDef + ld a, [hli] + ld b, a + ld c, [hl] + ld a, [$c700] + bit 3, a + jr z, .asm_35326 ; 35320 $4 + sla c + rl b +.asm_35326 + ld hl, BattleMonSpclAtk + call GetDamageStatsCritical + jr c, .asm_35337 ; 3532c $9 + ld hl, $c6c9 + ld a, [hli] + ld b, a + ld c, [hl] + ld hl, $c6bc +.asm_35337 + call $53c3 + jr .asm_3533f ; 3533a $3 +.asm_3533c + call $53b5 +.asm_3533f + call .asm_3534d + ld a, [BattleMonLevel] + ld e, a + call DittoMetalPowder + ld a, 1 + and a + ret + +.asm_3534d + ld a, h + or b + jr z, .asm_3536b ; 0x3534f $1a + srl b + rr c + srl b + rr c + ld a, c + or b + jr nz, .asm_3535e ; 0x3535b $1 + inc c +.asm_3535e + srl h + rr l + srl h + rr l + ld a, l + or h + jr nz, .asm_3536b ; 0x35368 $1 + inc l +.asm_3536b + ld a, [InLinkBattle] + cp $3 + jr z, .asm_35376 ; 0x35370 $4 + ld a, h + or b + jr nz, .asm_3534d ; 0x35374 $d7 +.asm_35376 + ld b, l + ret +; 35378 + + +GetDamageStatsCritical: ; 35378 +; Return carry if non-critical. + + ld a, [CriticalHit] + and a + scf + ret z + + ; fallthrough +; 3537e + + +GetDamageStats: ; 3537e +; Return the attacker's offensive stat and the defender's defensive +; stat based on whether the attacking type is physical or special. + + push hl + push bc + ld a, [hBattleTurn] + and a + jr nz, .enemy + ld a, [PlayerMoveType] + cp FIRE +; special + ld a, [PlayerSAtkLevel] + ld b, a + ld a, [EnemySDefLevel] + jr nc, .end +; physical + ld a, [PlayerAtkLevel] + ld b, a + ld a, [EnemyDefLevel] + jr .end + +.enemy + ld a, [EnemyMoveType] + cp FIRE +; special + ld a, [EnemySAtkLevel] + ld b, a + ld a, [PlayerSDefLevel] + jr nc, .end +; physical + ld a, [EnemyAtkLevel] + ld b, a + ld a, [PlayerDefLevel] +.end + cp b + pop bc + pop hl + ret +; 353b5 + + +ThickClubBoost: ; 353b5 +; If the attacking monster is Cubone or Marowak and +; it's holding a Thick Club, double stat value hl. + push bc + push de + ld b, CUBONE + ld c, MAROWAK + ld d, THICK_CLUB + call SpeciesItemBoost + pop de + pop bc + ret +; 353c3 + + +LightBallBoost: ; 353c3 +; If the attacking monster is Pikachu and it's +; holding a Light Ball, double stat value hl. + push bc + push de + ld b, PIKACHU + ld c, PIKACHU + ld d, LIGHT_BALL + call SpeciesItemBoost + pop de + pop bc + ret +; 353d1 + + +SpeciesItemBoost: ; 353d1 +; If the attacking monster is species b or c and +; it's holding item d, double stat value hl. + + ld a, [hli] + ld l, [hl] + ld h, a + + push hl + ld a, PartyMon1Species - PartyMon1 + call BattlePartyAttr + + ld a, [hBattleTurn] + and a + ld a, [hl] + jr z, .CompareSpecies + ld a, [TempEnemyMonSpecies] +.CompareSpecies + pop hl + + cp b + jr z, .GetItem + cp c + ret nz + +.GetItem + push hl + call GetUserItem + ld a, [hl] + pop hl + cp d + ret nz + +; Double the stat + sla l + rl h + ret +; 353f6 + + +EnemyAttackDamage: ; 353f6 + call ResetDamage + +; No damage dealt with 0 power. + ld hl, EnemyMovePower + ld a, [hli] ; hl = EnemyMoveType + ld d, a + and a + ret z + + ld a, [hl] + cp FIRE + jr nc, .Special + + +; Physical + ld hl, BattleMonDef + ld a, [hli] + ld b, a + ld c, [hl] + +; Reflect + ld a, [PlayerScreens] + bit 4, a + jr z, .asm_35416 + sla c + rl b + +.asm_35416 + ld hl, EnemyMonAtk + call GetDamageStatsCritical + jr c, .asm_35450 + + ld hl, $c6b8 + ld a, [hli] + ld b, a + ld c, [hl] + ld hl, $c6c1 + jr .asm_35450 + + +.Special + ld hl, BattleMonSpclDef + ld a, [hli] + ld b, a + ld c, [hl] + +; Light Screen + ld a, [PlayerScreens] + bit 3, a + jr z, .asm_3543a + sla c + rl b + +.asm_3543a + ld hl, EnemyMonSpclAtk + call GetDamageStatsCritical + jr c, .asm_3544b + ld hl, $c6be + ld a, [hli] + ld b, a + ld c, [hl] + ld hl, $c6c7 + +.asm_3544b + call $53c3 + jr .asm_35453 + +.asm_35450 + call $53b5 + +.asm_35453 + call $534d + ld a, [EnemyMonLevel] + ld e, a + call $52b1 + ld a, 1 + and a + ret +; 35461 + + +BattleCommanda1: ; 35461 +; beatup + + call ResetDamage + ld a, [hBattleTurn] + and a + jp nz, .asm_354ef + ld a, [PlayerSubStatus3] + bit 2, a + jr nz, .asm_35482 ; 3546f $11 + ld c, $14 + call DelayFrames + xor a + ld [$c672], a + ld [DefaultFlypoint], a + ld [$c72d], a + jr .asm_3548d ; 35480 $b +.asm_35482 + ld a, [$c672] + ld b, a + ld a, [PartyCount] + sub b + ld [DefaultFlypoint], a +.asm_3548d + ld a, [DefaultFlypoint] + ld hl, PartyMon1Nickname + call $38a2 + ld a, $22 + call Function0x355bd + ld a, [hli] + or [hl] + jp z, $55b0 + ld a, [DefaultFlypoint] + ld c, a + ld a, [CurBattleMon] + cp [hl] + ld hl, BattleMonStatus + jr z, .asm_354b2 ; 354ab $5 + ld a, $20 + call Function0x355bd +.asm_354b2 + ld a, [hl] + and a + jp nz, $55b0 + ld a, $1 + ld [$c72d], a + ld hl, BeatUpAttackText + call FarBattleTextBox + ld a, [EnemyMonSpecies] + ld [CurSpecies], a + call $3856 + ld a, [$d239] + ld c, a + push bc + ld a, $0 + call Function0x355bd + ld a, [hl] + ld [CurSpecies], a + call $3856 + ld a, [$d238] + pop bc + ld b, a + push bc + ld a, $1f + call Function0x355bd + ld a, [hl] + ld e, a + pop bc + ld a, [PlayerMovePower] + ld d, a + ret + +.asm_354ef + ld a, [EnemySubStatus3] + bit 2, a + jr nz, .asm_35502 + + xor a + ld [$c67a], a + ld [DefaultFlypoint], a + ld [$c72d], a + jr .asm_3550d + +.asm_35502 + ld a, [$c67a] + ld b, a + ld a, [OTPartyCount] + sub b + ld [DefaultFlypoint], a +.asm_3550d + ld a, [IsInBattle] + dec a + jr z, .asm_3556b + + ld a, [InLinkBattle] + and a + jr nz, .asm_35532 + + ld a, [$cfc0] + and a + jr nz, .asm_35532 + + ld a, [DefaultFlypoint] + ld c, a + ld b, $0 + ld hl, OTPartySpecies + add hl, bc + ld a, [hl] + ld [$d265], a + call $343b + jr .asm_35544 + +.asm_35532 + ld a, [DefaultFlypoint] + ld hl, OTPartyMon1Nickname + ld bc, $000b + call AddNTimes + ld de, StringBuffer1 + call CopyBytes +.asm_35544 + ld a, $22 + call Function0x355bd + ld a, [hli] + or [hl] + jp z, $55b0 + ld a, [DefaultFlypoint] + ld b, a + ld a, [CurOTMon] + cp b + ld hl, EnemyMonStatus + jr z, .asm_35560 + + ld a, $20 + call Function0x355bd +.asm_35560 + ld a, [hl] + and a + jr nz, .asm_355b0 + + ld a, $1 + ld [$c72d], a + jr .asm_3557d + +.asm_3556b + ld a, [EnemyMonSpecies] + ld [$d265], a + call $343b + ld hl, BeatUpAttackText + call FarBattleTextBox + jp $53f6 +.asm_3557d + ld hl, BeatUpAttackText + call FarBattleTextBox + ld a, [BattleMonSpecies] + ld [CurSpecies], a + call GetBaseStats + ld a, [$d239] + ld c, a + push bc + ld a, $0 + call Function0x355bd + ld a, [hl] + ld [CurSpecies], a + call GetBaseStats + ld a, [$d238] + pop bc + ld b, a + push bc + ld a, $1f + call Function0x355bd + ld a, [hl] + ld e, a + pop bc + ld a, [EnemyMovePower] + ld d, a + ret + +.asm_355b0 + ld b, $12 + jp $7e8c +; 355b5 + + +BattleCommanda8: ; 355b5 + ld a, [$c72d] + and a + ret nz + jp $734e +; 355bd + + +Function0x355bd: ; 355bd + push bc + ld c, a + ld b, 0 + ld a, [hBattleTurn] + and a + ld hl, PartyMon1Species + jr z, .asm_355cc + + ld hl, OTPartyMon1Species2 +.asm_355cc + ld a, [DefaultFlypoint] + add hl, bc + call GetPartyLocation + pop bc + ret +; 355d5 + + +BattleCommanda9: ; 355d5 + ld a, [AttackMissed] + and a + ret z + jp ResetDamage +; 355dd + + +Function0x355dd: ; 355dd + call ResetDamage + ld a, [hBattleTurn] + and a + ld hl, BattleMonDef + ld de, PlayerScreens + ld a, [BattleMonLevel] + jr z, .asm_355f7 + + ld hl, EnemyMonDef + ld de, $c700 + ld a, [EnemyMonLevel] +.asm_355f7 + push af + ld a, [hli] + ld b, a + ld c, [hl] + ld a, [de] + bit 4, a + jr z, .asm_35604 + + sla c + rl b +.asm_35604 + dec hl + dec hl + dec hl + ld a, [hli] + ld l, [hl] + ld h, a + call $534d + ld d, $28 + pop af + ld e, a + ret +; 35612 + + +BattleCommand62: ; 35612 + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $7 + jr nz, .asm_35620 ; 35619 $5 + srl c + jr nz, .asm_35620 ; 3561d $1 + inc c +.asm_35620 + cp $1d + jr z, .asm_3562b ; 35622 $7 + cp $1e + jr z, .asm_3562b ; 35626 $3 + ld a, d + and a + ret z +.asm_3562b + ld a, c + and a + jr nz, .asm_35631 ; 3562d $2 + ld c, $1 +.asm_35631 + xor a + ld hl, $ffb3 + ld [hli], a + ld [hli], a + ld [hl], a + ld a, e + add a + jr nc, .asm_3563e ; 3563a $2 + ld [hl], $1 +.asm_3563e + inc hl + ld [hli], a + ld a, $5 + ld [hld], a + push bc + ld b, $4 + call $3124 + pop bc + inc [hl] + inc [hl] + inc hl + ld [hl], d + call $3119 + ld [hl], b + call $3119 + ld [hl], c + ld b, $4 + call $3124 + ld [hl], $32 + ld b, $4 + call $3124 + call GetUserItem + ld a, b + and a + jr z, .asm_3568f ; 35667 $26 + ld hl, TypeBoostItems +.asm_3566c + ld a, [hli] + cp $ff + jr z, .asm_3568f ; 3566f $1e + cp b + ld a, [hli] + jr nz, .asm_3566c ; 35673 $f7 + ld b, a + ld a, BATTLE_VARS_MOVE_TYPE + call CleanGetBattleVarPair + cp b + jr nz, .asm_3568f ; 3567c $11 + ld a, c + add $64 + ld [$ffb7], a + call $3119 + ld a, $64 + ld [$ffb7], a + ld b, $4 + call $3124 +.asm_3568f + call Function0x356eb + ld hl, CurDamage + ld b, [hl] + ld a, [$ffb6] + add b + ld [$ffb6], a + jr nc, .asm_356a5 ; 3569b $8 + ld a, [$ffb5] + inc a + ld [$ffb5], a + and a + jr z, .asm_356d9 ; 356a3 $34 +.asm_356a5 + ld a, [$ffb3] + ld b, a + ld a, [$ffb4] + or a + jr nz, .asm_356d9 ; 356ab $2c + ld a, [$ffb5] + cp $3 + jr c, .asm_356bd ; 356b1 $a + cp $4 + jr nc, .asm_356d9 ; 356b5 $22 + ld a, [$ffb6] + cp $e6 + jr nc, .asm_356d9 ; 356bb $1c +.asm_356bd + inc hl + ld a, [$ffb6] + ld b, [hl] + add b + ld [hld], a + ld a, [$ffb5] + ld b, [hl] + adc b + ld [hl], a + jr c, .asm_356d9 ; 356c8 $f + ld a, [hl] + cp $3 + jr c, .asm_356df ; 356cd $10 + cp $4 + jr nc, .asm_356d9 ; 356d1 $6 + inc hl + ld a, [hld] + cp $e6 + jr c, .asm_356df ; 356d7 $6 +.asm_356d9 + ld a, $3 + ld [hli], a + ld a, $e5 + ld [hld], a +.asm_356df + inc hl + ld a, [hl] + add $2 + ld [hld], a + jr nc, .asm_356e7 ; 356e4 $1 + inc [hl] +.asm_356e7 + ld a, $1 + and a + ret +; 356eb + + +Function0x356eb: ; 356eb + ld a, [CriticalHit] + and a + ret z + + ld a, [$ffb6] + add a + ld [$ffb6], a + ld a, [$ffb5] + rl a + ld [$ffb5], a + ret nc + + ld a, $ff + ld [$ffb5], a + ld [$ffb6], a + ret +; 35703 + + +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 $ff +; 35726 + + +BattleCommand3f: ; 35726 + + ld hl, BattleMonLevel + ld a, [hBattleTurn] + and a + jr z, .asm_35731 + ld hl, EnemyMonLevel + +.asm_35731 + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $57 + ld b, [hl] + ld a, 0 + jr z, .asm_3578c + + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $58 + jr z, .asm_35758 + + cp $28 + jr z, .asm_3576b + + cp $63 + jr z, .asm_35792 + + ld a, BATTLE_VARS_MOVE_POWER + call CleanGetBattleVarPair + ld b, a + ld a, $0 + jr .asm_3578c + +.asm_35758 + ld a, b + srl a + add b + ld b, a +.asm_3575d + call FarBattleRNG + and a + jr z, .asm_3575d ; 35761 $fa + cp b + jr nc, .asm_3575d ; 35764 $f7 + ld b, a + ld a, $0 + jr .asm_3578c ; 35769 $21 +.asm_3576b + ld hl, EnemyMonHPHi + ld a, [hBattleTurn] + and a + jr z, .asm_35776 ; 35771 $3 + ld hl, BattleMonHP +.asm_35776 + ld a, [hli] + srl a + ld b, a + ld a, [hl] + rr a + push af + ld a, b + pop bc + and a + jr nz, .asm_3578c ; 35781 $9 + or b + ld a, $0 + jr nz, .asm_3578c ; 35786 $4 + ld b, $1 + jr .asm_3578c ; 3578a $0 +.asm_3578c + ld hl, CurDamage + ld [hli], a + ld [hl], b + ret +.asm_35792 + ld hl, BattleMonHP + ld a, [hBattleTurn] + and a + jr z, .asm_3579d ; 35798 $3 + ld hl, EnemyMonHPHi +.asm_3579d + xor a + ld [$ffb3], a + ld [$ffb4], a + ld a, [hli] + ld [$ffb5], a + ld a, [hli] + ld [$ffb6], a + ld a, $30 + ld [$ffb7], a + call $3119 + ld a, [hli] + ld b, a + ld a, [hl] + ld [$ffb7], a + ld a, b + and a + jr z, .asm_357d6 + + ld a, [$ffb7] + srl b + rr a + srl b + rr a + ld [$ffb7], a + ld a, [$ffb5] + ld b, a + srl b + ld a, [$ffb6] + rr a + srl b + rr a + ld [$ffb6], a + ld a, b + ld [$ffb5], a + +.asm_357d6 + ld b, $4 + call $3124 + ld a, [$ffb6] + ld b, a + ld hl, .table_35807 + +.asm_357e1 + ld a, [hli] + cp b + jr nc, .asm_357e8 + inc hl + jr .asm_357e1 + +.asm_357e8 + ld a, [hBattleTurn] + and a + ld a, [hl] + jr nz, .asm_357f8 + + ld hl, PlayerMovePower + ld [hl], a + push hl + call PlayerAttackDamage + jr .asm_35800 + +.asm_357f8 + ld hl, EnemyMovePower + ld [hl], a + push hl + call EnemyAttackDamage + +.asm_35800 + call $5612 + pop hl + ld [hl], 1 + ret + +.table_35807 + db 1, $c8 + db 4, $96 + db 9, $64 + db 16, $50 + db 32, $28 + db 48, $14 +; 35813 + + +BattleCommand40: ; 35813 + ld a, $1 + ld [AttackMissed], a + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + and a + ret z + ld b, a + ld hl, $45ec + ld a, $f + rst FarCall + ld a, b + cp $59 + ret z + call $4833 + ld a, [$d265] + and a + ret z + call Function0x36abf + ret z + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + dec a + ld de, StringBuffer1 + call GetMoveData + ld a, [$d075] + and a + ret z + ld a, [$d076] + cp $14 + ret nc + ld hl, CurDamage + ld a, [hli] + or [hl] + ret z + ld a, [hl] + add a + ld [hld], a + ld a, [hl] + adc a + ld [hl], a + jr nc, .asm_3585f ; 35859 $4 + ld a, $ff + ld [hli], a + ld [hl], a +.asm_3585f + xor a + ld [AttackMissed], a + ret +; 35864 + + +BattleCommand41: ; 35864 + ld hl, EnemyMonMoves + ld de, EnemyPerishCount + ld a, [hBattleTurn] + and a + jr z, .asm_35875 ; 3586d $6 + ld hl, BattleMonMoves + ld de, PlayerEncoreCount +.asm_35875 + ld a, BATTLE_VARS_LAST_MOVE_OPP + call CleanGetBattleVarPair + and a + jp z, $5923 + cp $a5 + jp z, $5923 + cp $e3 + jp z, $5923 + cp $77 + jp z, $5923 + ld b, a +.asm_3588e + ld a, [hli] + cp b + jr nz, .asm_3588e ; 35890 $fc + ld bc, $0005 + add hl, bc + ld a, [hl] + and $3f + jp z, $5923 + ld a, [AttackMissed] + and a + jp nz, $5923 + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call GetBattleVarPair + bit 4, [hl] + jp nz, $5923 + set 4, [hl] + call FarBattleRNG + and $3 + inc a + inc a + inc a + ld [de], a + call Function0x36abf + jr nz, .asm_3591a ; 358bb $5d + ld a, [hBattleTurn] + and a + jr z, .asm_358ef ; 358c0 $2d + push hl + ld a, [LastPlayerMove] + ld b, a + ld c, $0 + ld hl, BattleMonMoves +.asm_358cc + ld a, [hli] + cp b + jr z, .asm_358dd ; 358ce $d + inc c + ld a, c + cp $4 + jr c, .asm_358cc ; 358d4 $f6 + pop hl + res 4, [hl] + xor a + ld [de], a + jr .asm_35923 ; 358db $46 +.asm_358dd + pop hl + ld a, c + ld [CurMoveNum], a + ld a, b + ld [CurPlayerMove], a + dec a + ld de, PlayerMoveStruct + call GetMoveData + jr .asm_3591a ; 358ed $2b +.asm_358ef + push hl + ld a, [LastEnemyMove] + ld b, a + ld c, $0 + ld hl, EnemyMonMoves +.asm_358f9 + ld a, [hli] + cp b + jr z, .asm_3590a ; 358fb $d + inc c + ld a, c + cp $4 + jr c, .asm_358f9 ; 35901 $f6 + pop hl + res 4, [hl] + xor a + ld [de], a + jr .asm_35923 ; 35908 $19 +.asm_3590a + pop hl + ld a, c + ld [CurEnemyMoveNum], a + ld a, b + ld [CurEnemyMove], a + dec a + ld de, EnemyMoveStruct + call GetMoveData +.asm_3591a + call $7e01 + ld hl, $5109 + jp FarBattleTextBox +.asm_35923 + jp PrintDidntAffect2 +; 35926 + + +BattleCommand42: ; 35926 + ld a, [AttackMissed] + and a + jp nz, .asm_359cd + call CheckSubstituteOpp + jp nz, .asm_359cd + call $7e01 + ld hl, $c63f + ld de, EnemyMonMaxHPLo + call .asm_3597d + ld a, $1 + ld [$d10a], a + ld hl, $c55e + ld a, $b + call $2d83 + ld hl, EnemyMonHPHi + ld a, [hli] + ld [$d1ed], a + ld a, [hli] + ld [$d1ec], a + ld a, [hli] + ld [$d1eb], a + ld a, [hl] + ld [$d1ea], a + call $59ac + xor a + ld [$d10a], a + call ResetDamage + ld hl, $c4ca + ld a, $b + call $2d83 + ld a, $5e + ld hl, $4000 + rst FarCall + ld hl, $511b + jp FarBattleTextBox + +.asm_3597d + ld a, [hld] + ld [$d1ea], a + ld a, [hld] + ld [$d1eb], a + ld a, [hld] + ld b, a + ld [$d1ec], a + ld a, [hl] + ld [$d1ed], a + dec de + dec de + ld a, [de] + dec de + add b + ld [$d257], a + ld b, [hl] + ld a, [de] + adc b + srl a + ld [CurDamage], a + ld a, [$d257] + rr a + ld [$d257], a + inc hl + inc hl + inc hl + inc de + inc de + inc de + ld c, [hl] + dec hl + ld a, [$d257] + sub c + ld b, [hl] + dec hl + ld a, [CurDamage] + sbc b + jr nc, .asm_359c2 + + ld a, [CurDamage] + ld b, a + ld a, [$d257] + ld c, a +.asm_359c2 + ld a, c + ld [hld], a + ld [$d1ee], a + ld a, b + ld [hli], a + ld [$d1ef], a + ret + +.asm_359cd + jp $7366 +; 359d0 + + +BattleCommand43: ; 359d0 + ld a, BATTLE_VARS_STATUS + call CleanGetBattleVarPair + and $7 + ret nz + call ResetDamage + ld a, $1 + ld [AttackMissed], a + call Function0x37354 + jp EndMoveEffect +; 359e6 + + +BattleCommand44: ; 359e6 + ld a, [AttackMissed] + and a + jr nz, .asm_35a50 ; 359ea $64 + ld hl, BattleMonType1 + ld a, [hBattleTurn] + and a + jr z, .asm_359f7 ; 359f2 $3 + ld hl, EnemyMonType1 +.asm_359f7 + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + and a + jr z, .asm_35a50 ; 359fd $51 + push hl + dec a + ld hl, $5afe + call $7ea1 + ld d, a + pop hl + cp $13 + jr z, .asm_35a50 ; 35a0b $43 + call $7e01 + call $4ffd +.asm_35a13 + call FarBattleRNG + and $1f + cp $a + jr c, .asm_35a24 ; 35a1a $8 + cp $14 + jr c, .asm_35a13 ; 35a1e $f3 + cp $1c + jr nc, .asm_35a13 ; 35a22 $ef +.asm_35a24 + ld [hli], a + ld [hld], a + push hl + ld a, BATTLE_VARS_MOVE_TYPE + call GetBattleVarPair + push af + push hl + ld a, d + ld [hl], a + call Function0x347c8 + pop hl + pop af + ld [hl], a + pop hl + ld a, [$d265] + cp $a + jr nc, .asm_35a13 ; 35a3c $d5 + call $4ffd + ld a, [hl] + ld [$d265], a + ld a, $29 + call $2d83 + ld hl, $5452 + jp FarBattleTextBox +.asm_35a50 + jp Function0x37354 +; 35a53 + + +BattleCommand45: ; 35a53 + call CheckSubstituteOpp + jr nz, .asm_35a6e ; 35a56 $16 + ld a, [AttackMissed] + and a + jr nz, .asm_35a6e ; 35a5c $10 + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call GetBattleVarPair + set 5, [hl] + call $7e01 + ld hl, $5136 + jp FarBattleTextBox +.asm_35a6e + call $7e77 + jp PrintDidntAffect +; 35a74 + + +BattleCommand46: ; 35a74 + call Function0x372d8 + ld a, [InLinkBattle] + and a + jr z, .asm_35a83 ; 35a7b $6 + call $7e77 + jp PrintNothingHappened +.asm_35a83 + call CheckSubstituteOpp + jp nz, $5b10 + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call GetBattleVarPair + bit 3, [hl] + jp nz, $5b10 + ld a, $2 + call $3945 + ld d, h + ld e, l + ld hl, BattleMonMoves + ld a, [hBattleTurn] + and a + jr z, .asm_35aa5 ; 35aa0 $3 + ld hl, EnemyMonMoves +.asm_35aa5 + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + ld [$d265], a + ld b, a + and a + jr z, .asm_35b10 ; 35aaf $5f + cp $a5 + jr z, .asm_35b10 ; 35ab3 $5b + ld c, $4 +.asm_35ab7 + ld a, [hli] + cp b + jr z, .asm_35b10 ; 35ab9 $55 + dec c + jr nz, .asm_35ab7 ; 35abc $f9 + dec hl + ld c, $4 +.asm_35ac1 + dec c + ld a, [hld] + cp $a6 + jr nz, .asm_35ac1 ; 35ac5 $fa + inc hl + ld a, b + ld [hl], a + push bc + push hl + dec a + ld hl, $5b00 + call $7ea1 + pop hl + ld bc, $0006 + add hl, bc + ld [hl], a + pop bc + ld a, [hBattleTurn] + and a + jr z, .asm_35af6 ; 35add $17 + ld a, [IsInBattle] + dec a + jr nz, .asm_35af6 ; 35ae3 $11 + ld a, [hl] + push bc + ld hl, $c739 + ld b, $0 + add hl, bc + ld [hl], a + ld hl, $c735 + add hl, bc + pop bc + ld [hl], b + jr .asm_35b04 ; 35af4 $e +.asm_35af6 + ld a, [hl] + push af + ld l, c + ld h, $0 + add hl, de + ld a, b + ld [hl], a + pop af + ld de, $0015 + add hl, de + ld [hl], a +.asm_35b04 + call $34f8 + call $7e01 + ld hl, $5143 + jp FarBattleTextBox +.asm_35b10 + call $7e77 + jp PrintDidntAffect +; 35b16 + + +BattleCommand47: ; 35b16 + call $7e01 + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + call Function0x360dd + ld a, BATTLE_VARS_MOVE_EFFECT + call GetBattleVarPair + ld a, [hl] + push hl + push af + ld a, $a + ld [hl], a + call BattleCommand1c + pop af + pop hl + ld [hl], a + ret +; 35b33 + + +BattleCommand48: ; 35b33 + call Function0x372d8 + ld a, [AttackMissed] + and a + jr nz, .asm_35ba3 ; 35b3a $67 + ld a, [hBattleTurn] + and a + ld hl, BattleMonMove2 + ld a, [DisabledMove] + ld d, a + jr z, .asm_35b4f ; 35b46 $7 + ld hl, EnemyMonMove2 + ld a, [EnemyEncoredMove] + ld d, a +.asm_35b4f + ld a, BATTLE_VARS_STATUS + call CleanGetBattleVarPair + and $7 + jr z, .asm_35ba3 ; 35b56 $4b + ld a, [hl] + and a + jr z, .asm_35ba3 ; 35b5a $47 + call .asm_35ba9 + jr c, .asm_35ba3 ; 35b5f $42 + dec hl +.asm_35b62 + push hl + call FarBattleRNG + and $3 + ld c, a + ld b, $0 + add hl, bc + ld a, [hl] + pop hl + and a + jr z, .asm_35b62 ; 35b6f $f1 + ld e, a + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + cp e + jr z, .asm_35b62 ; 35b78 $e8 + ld a, e + cp d + jr z, .asm_35b62 ; 35b7c $e4 + call .asm_35bdf + jr z, .asm_35b62 ; 35b81 $df + ld a, BATTLE_VARS_MOVE + call GetBattleVarPair + ld a, e + ld [hl], a + call Function0x34548 + jr nz, .asm_35b9a ; 35b8d $b + ld a, [$c689] + push af + call BattleCommand0a + pop af + ld [$c689], a +.asm_35b9a + call $7e36 + call UpdateMoveData + jp ResetTurn +.asm_35ba3 + call $7e77 + jp $7349 + +.asm_35ba9 + push hl + push de + push bc + call .asm_35bb3 + pop bc + pop de + pop hl + ret + +.asm_35bb3 + ld a, [$ffe4] + and a + ld a, [DisabledMove] + jr z, .asm_35bbe + + ld a, [EnemyEncoredMove] +.asm_35bbe + ld b, a + ld a, $10 + call CleanGetBattleVarPair + ld c, a + dec hl + ld d, $4 +.asm_35bc8 + ld a, [hl] + and a + jr z, .asm_35bdb + + cp c + jr z, .asm_35bd7 + + cp b + jr z, .asm_35bd7 + + call .asm_35bdf + jr nz, .asm_35bdd + +.asm_35bd7 + inc hl + dec d + jr nz, .asm_35bc8 + +.asm_35bdb + scf + ret + +.asm_35bdd + and a + ret + +.asm_35bdf + push hl + push de + push bc + + ld b, a + ld hl, $45ec + ld a, $f + rst $8 + ld a, b + + pop bc + pop de + pop hl + + cp $91 + ret z + + cp $27 + ret z + + cp $4b + ret z + + cp $97 + ret z + + cp $9b + ret z + + cp $1a + ret +; 35bff + + +BattleCommand49: ; 35bff + ld a, BATTLE_VARS_SUBSTATUS5 + call GetBattleVarPair + set 6, [hl] + call $7e01 + ld hl, $5156 + jp FarBattleTextBox +; 35c0f + + +BattleCommand4a: ; 35c0f + ld a, [AttackMissed] + and a + jp nz, $5c91 + ld bc, $0030 + ld hl, EnemyMonMoves + ld a, [hBattleTurn] + and a + jr z, .asm_35c24 ; 35c1f $3 + ld hl, BattleMonMoves +.asm_35c24 + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + and a + jr z, .asm_35c91 ; 35c2a $65 + cp $a5 + jr z, .asm_35c91 ; 35c2e $61 + ld b, a + ld c, $ff +.asm_35c33 + inc c + ld a, [hli] + cp b + jr nz, .asm_35c33 ; 35c36 $fb + ld [$d265], a + dec hl + ld b, $0 + push bc + ld c, $6 + add hl, bc + pop bc + ld a, [hl] + and $3f + jr z, .asm_35c91 ; 35c46 $49 + push bc + call $34f8 + call FarBattleRNG + and $3 + inc a + inc a + ld b, a + ld a, [hl] + and $3f + cp b + jr nc, .asm_35c5b ; 35c58 $1 + ld b, a +.asm_35c5b + ld a, [hl] + sub b + ld [hl], a + push af + ld a, $17 + call $3951 + ld d, b + pop af + pop bc + add hl, bc + ld e, a + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call CleanGetBattleVarPair + bit 3, a + jr nz, .asm_35c82 ; 35c70 $10 + ld a, [hBattleTurn] + and a + jr nz, .asm_35c81 ; 35c75 $a + ld a, [IsInBattle] + dec a + jr nz, .asm_35c81 ; 35c7b $4 + ld hl, $c739 + add hl, bc +.asm_35c81 + ld [hl], e +.asm_35c82 + push de + call $7e01 + pop de + ld a, d + ld [$d265], a + ld hl, $517f + jp FarBattleTextBox +.asm_35c91 + jp PrintDidntAffect2 +; 35c94 + + +BattleCommand4b: ; 35c94 + ld hl, EnemyMonHPHi + ld a, [hBattleTurn] + and a + jr z, .asm_35c9f ; 35c9a $3 + ld hl, BattleMonHP +.asm_35c9f + ld de, CurDamage + ld c, $2 + push hl + push de + call StringCmp + pop de + pop hl + jr c, .asm_35cc7 ; 35cab $1a + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + dec a + ld [de], a + inc a + jr nz, .asm_35cba ; 35cb4 $4 + dec de + ld a, [de] + dec a + ld [de], a +.asm_35cba + ld a, [CriticalHit] + cp $2 + jr nz, .asm_35cc5 ; 35cbf $4 + xor a + ld [CriticalHit], a +.asm_35cc5 + scf + ret +.asm_35cc7 + and a + ret +; 35cc9 + + +BattleCommand4c: ; 35cc9 + ld a, BATTLE_VARS_SUBSTATUS1 + call GetBattleVarPair + res 0, [hl] + ld de, PartyMon1Status + ld a, [hBattleTurn] + and a + jr z, .asm_35cdb ; 35cd6 $3 + ld de, OTPartyMon1Status +.asm_35cdb + ld a, BATTLE_VARS_STATUS + call GetBattleVarPair + xor a + ld [hl], a + ld h, d + ld l, e + ld bc, $0030 + ld d, $6 +.asm_35ce9 + ld [hl], a + add hl, bc + dec d + jr nz, .asm_35ce9 ; 35cec $fb + call $7e01 + ld hl, $51a0 + call FarBattleTextBox + ld a, [hBattleTurn] + and a + jp z, Function0x365d7 + jp Function0x365fd +; 35d00 + + +FarPlayBattleAnimation: ; 35d00 +; play animation de + +; battle animations disabled? + ld a, BATTLE_VARS_SUBSTATUS3 + call CleanGetBattleVarPair + and $60 ; bit 6 | 5 + ret nz + + ; fallthrough +; 35d08 + +PlayFXAnimID: ; 35d08 + ld a, e + ld [FXAnimIDLo], a + ld a, d + ld [FXAnimIDHi], a + + ld c, 3 + call DelayFrames + + ld hl, $40d6 + ld a, $33 + rst FarCall ; callab SafePlayBattleAnimation + + ret +; 35d1c + + +Function0x35d1c: ; 35d1c + ld hl, CurDamage + ld a, [hli] + ld b, a + ld a, [hl] + or b + jr z, .asm_35d7b + + ld a, c + and a + jr nz, .asm_35d31 + + ld a, [EnemySubStatus4] + bit 4, a + jp nz, Function0x35de0 +.asm_35d31 + ld a, [hld] + ld b, a + ld a, [EnemyMonHPLo] + ld [$d1ec], a + sub b + ld [EnemyMonHPLo], a + ld a, [hl] + ld b, a + ld a, [EnemyMonHPHi] + ld [$d1ed], a + sbc b + ld [EnemyMonHPHi], a + jr nc, .asm_35d59 + + ld a, [$d1ed] + ld [hli], a + ld a, [$d1ec] + ld [hl], a + xor a + ld hl, EnemyMonHPHi + ld [hli], a + ld [hl], a +.asm_35d59 + ld hl, EnemyMonMaxHPHi + ld a, [hli] + ld [$d1eb], a + ld a, [hl] + ld [$d1ea], a + ld hl, EnemyMonHPHi + ld a, [hli] + ld [$d1ef], a + ld a, [hl] + ld [$d1ee], a + ld hl, $c4ca + xor a + ld [$d10a], a + ld a, $b + call Predef +.asm_35d7b + jp $39c9 +; 35d7e + + +Function0x35d7e: ; 35d7e + ld hl, CurDamage + ld a, [hli] + ld b, a + ld a, [hl] + or b + jr z, .asm_35ddd + + ld a, c + and a + jr nz, .asm_35d93 + + ld a, [PlayerSubStatus4] + bit 4, a + jp nz, Function0x35de0 +.asm_35d93 + ld a, [hld] + ld b, a + ld a, [$c63d] + ld [$d1ec], a + sub b + ld [$c63d], a + ld [$d1ee], a + ld b, [hl] + ld a, [BattleMonHP] + ld [$d1ed], a + sbc b + ld [BattleMonHP], a + ld [$d1ef], a + jr nc, .asm_35dc5 + + ld a, [$d1ed] + ld [hli], a + ld a, [$d1ec] + ld [hl], a + xor a + ld hl, BattleMonHP + ld [hli], a + ld [hl], a + ld hl, $d1ee + ld [hli], a + ld [hl], a +.asm_35dc5 + ld hl, BattleMonMaxHP + ld a, [hli] + ld [$d1eb], a + ld a, [hl] + ld [$d1ea], a + ld hl, $c55e + ld a, $1 + ld [$d10a], a + ld a, $b + call Predef +.asm_35ddd + jp $39c9 +; 35de0 + + +Function0x35de0: ; 35de0 + ld hl, $53ad + call FarBattleTextBox + ld de, $c6e0 + ld a, [$ffe4] + and a + jr z, .asm_35df1 + + ld de, $c6df +.asm_35df1 + ld hl, CurDamage + ld a, [hli] + and a + jr nz, .asm_35dff + + ld a, [de] + sub [hl] + ld [de], a + jr z, .asm_35dff + + jr nc, .asm_35e3d + +.asm_35dff + ld a, $8 + call GetBattleVarPair + res 4, [hl] + ld hl, $53d0 + call FarBattleTextBox + call $4ffd + call $65c3 + ld a, $2 + call CleanGetBattleVarPair + and $60 + call z, $7ec7 + call $4ffd + ld a, $d + call GetBattleVarPair + cp $1d + jr z, .asm_35e3a + + cp $2c + jr z, .asm_35e3a + + cp $4d + jr z, .asm_35e3a + + cp $68 + jr z, .asm_35e3a + + cp $9a + jr z, .asm_35e3a + + xor a + ld [hl], a +.asm_35e3a + call $39c9 +.asm_35e3d + jp ResetDamage +; 35e40 + + +UpdateMoveData: ; 35e40 + + ld a, BATTLE_VARS_MOVE_ANIM + call GetBattleVarPair + ld d, h + ld e, l + + ld a, BATTLE_VARS_MOVE + call CleanGetBattleVarPair + ld [$cf60], a ; not CurSpecies + ld [$d265], a + + dec a + call GetMoveData + call GetMoveName + jp CopyName1 +; 35e5c + + +BattleCommand14: ; 35e5c +; sleeptarget + call GetOpponentItem + ld a, b + cp $17 + jr nz, .asm_35e70 ; 35e62 $c + ld a, [hl] + ld [$d265], a + call $3468 + ld hl, $55a9 + jr .asm_35ec6 ; 35e6e $56 +.asm_35e70 + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + ld d, h + ld e, l + ld a, [de] + and $7 + ld hl, $51c1 + jr nz, .asm_35ec6 ; 35e7d $47 + ld a, [AttackMissed] + and a + jp nz, PrintDidntAffect2 + ld hl, $550c + call Function0x35ece + jr c, .asm_35ec6 ; 35e8c $38 + ld a, [de] + and a + jr nz, .asm_35ec6 ; 35e90 $34 + call CheckSubstituteOpp + jr nz, .asm_35ec6 ; 35e95 $2f + call $7e01 + ld b, $7 + ld a, [$cfc0] + and a + jr z, .asm_35ea4 ; 35ea0 $2 + ld b, $3 +.asm_35ea4 + call FarBattleRNG + and b + jr z, .asm_35ea4 ; 35ea8 $fa + cp $7 + jr z, .asm_35ea4 ; 35eac $f6 + inc a + ld [de], a + call $398e + call $39c9 + ld hl, $51b1 + call FarBattleTextBox + ld a, $f + ld hl, $5de9 + rst FarCall + jp z, $4216 + ret +.asm_35ec6 + push hl + call $7e77 + pop hl + jp FarBattleTextBox +; 35ece + + +Function0x35ece: ; 35ece +; Enemy turn + ld a, [hBattleTurn] + and a + jr z, .asm_35eec + +; Not in link battle + ld a, [InLinkBattle] + and a + jr nz, .asm_35eec + + + ld a, [$cfc0] + and a + jr nz, .asm_35eec + +; Not locked-on by the enemy + ld a, [PlayerSubStatus5] + bit 5, a + jr nz, .asm_35eec + + call FarBattleRNG + cp $40 + ret c + +.asm_35eec + xor a + ret +; 35eee + + +BattleCommand13: ; 35eee + call CheckSubstituteOpp + ret nz + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + and a + ret nz + ld a, [TypeModifier] + and $7f + ret z + call Function0x35fe1 + ret z + call GetOpponentItem + ld a, b + cp $14 + ret z + ld a, [$c70d] + and a + ret nz + call Function0x37962 + ret nz + call Function0x35ff5 + ld de, $0106 + call $7e54 + call $39c9 + ld hl, $51d5 + call FarBattleTextBox + ld a, $f + ld hl, $5de9 + rst FarCall + ret +; 35f2c + + +BattleCommand2f: ; 35f2c + ld hl, $5071 + ld a, [TypeModifier] + and $7f + jp z, $5fb8 + call Function0x35fe1 + jp z, $5fb8 + ld a, BATTLE_VARS_STATUS_OPP + call CleanGetBattleVarPair + ld b, a + ld hl, $51fa + and $8 + jp nz, $5fb8 + call GetOpponentItem + ld a, b + cp $14 + jr nz, .asm_35f5f ; 35f51 $c + ld a, [hl] + ld [$d265], a + call $3468 + ld hl, $55a9 + jr .asm_35fb8 ; 35f5d $59 +.asm_35f5f + ld hl, $550c + ld a, BATTLE_VARS_STATUS_OPP + call CleanGetBattleVarPair + and a + jr nz, .asm_35fb8 ; 35f68 $4e + ld a, [hBattleTurn] + and a + jr z, .asm_35f89 ; 35f6d $1a + ld a, [InLinkBattle] + and a + jr nz, .asm_35f89 ; 35f73 $14 + ld a, [$cfc0] + and a + jr nz, .asm_35f89 ; 35f79 $e + ld a, [PlayerSubStatus5] + bit 5, a + jr nz, .asm_35f89 ; 35f80 $7 + call FarBattleRNG + cp $40 + jr c, .asm_35fb8 ; 35f87 $2f +.asm_35f89 + call CheckSubstituteOpp + jr nz, .asm_35fb8 ; 35f8c $2a + ld a, [AttackMissed] + and a + jr nz, .asm_35fb8 ; 35f92 $24 + call Function0x35fc9 + jr z, .asm_35fa4 ; 35f97 $b + call Function0x35fc0 + ld hl, $51d5 + call FarBattleTextBox + jr .asm_35fb1 ; 35fa2 $d +.asm_35fa4 + set 0, [hl] + xor a + ld [de], a + call Function0x35fc0 + ld hl, $51e6 + call FarBattleTextBox +.asm_35fb1 + ld a, $f + ld hl, $5de9 + rst FarCall + ret +.asm_35fb8 + push hl + call $7e77 + pop hl + jp FarBattleTextBox +; 35fc0 + + +Function0x35fc0: ; 35fc0 + call $7e01 + call Function0x35ff5 + jp $39c9 +; 35fc9 + + +Function0x35fc9: ; 35fc9 + ld a, $9 + call $39e7 + ld a, [hBattleTurn] + and a + ld de, $c67c + jr z, .asm_35fd9 ; 0x35fd4 $3 + ld de, $c674 +.asm_35fd9 + ld a, $d + call CleanGetBattleVarPair + cp $21 + ret +; 35fe1 + + +Function0x35fe1: ; 35fe1 + ld de, EnemyMonType1 + ld a, [hBattleTurn] + and a + jr z, .asm_35fec ; 0x35fe7 $3 + ld de, BattleMonType1 +.asm_35fec + ld a, [de] + inc de + cp $3 + ret z + ld a, [de] + cp $3 + ret +; 35ff5 + + +Function0x35ff5: ; 35ff5 + ld a, $b + call $39e7 + set 3, [hl] + jp $398e +; 35fff + + +BattleCommand15: ; 35fff + call Function0x36011 + ld hl, $5210 + jp FarBattleTextBox +; 36008 + + +BattleCommand16: ; 36008 + call Function0x36011 + ld hl, $5227 + jp FarBattleTextBox +; 36011 + + +Function0x36011: ; 36011 + ld hl, CurDamage + ld a, [hli] + srl a + ld [$ffb3], a + ld b, a + ld a, [hl] + rr a + ld [$ffb4], a + or b + jr nz, .asm_36026 ; 0x36020 $4 + ld a, $1 + ld [$ffb4], a +.asm_36026 + ld hl, BattleMonHP + ld de, BattleMonMaxHP + ld a, [hBattleTurn] + and a + jr z, .asm_36037 ; 0x3602f $6 + ld hl, EnemyMonHPHi + ld de, EnemyMonMaxHPHi +.asm_36037 + ld bc, $d1ed + ld a, [hli] + ld [bc], a + ld a, [hl] + dec bc + ld [bc], a + ld a, [de] + dec bc + ld [bc], a + inc de + ld a, [de] + dec bc + ld [bc], a + ld a, [$ffb4] + ld b, [hl] + add b + ld [hld], a + ld [$d1ee], a + ld a, [$ffb3] + ld b, [hl] + adc b + ld [hli], a + ld [$d1ef], a + jr c, .asm_36064 ; 0x36056 $c + ld a, [hld] + ld b, a + ld a, [de] + dec de + sub b + ld a, [hli] + ld b, a + ld a, [de] + inc de + sbc b + jr nc, .asm_36070 ; 0x36062 $c +.asm_36064 + ld a, [de] + ld [hld], a + ld [$d1ee], a + dec de + ld a, [de] + ld [hli], a + ld [$d1ef], a + inc de +.asm_36070 + ld a, [hBattleTurn] + and a + ld hl, $c55e + ld a, $1 + jr z, .asm_3607e ; 0x36078 $4 + ld hl, $c4ca + xor a +.asm_3607e + ld [$d10a], a + ld a, $b + call Predef + call $39c9 + jp $399c +; 3608c + + +BattleCommand17: ; 3608c + xor a + ld [$cfca], a + call CheckSubstituteOpp + ret nz + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + and a + jp nz, Function0x360dd + ld a, [TypeModifier] + and $7f + ret z + call Function0x36e5b + ret z + call GetOpponentItem + ld a, b + cp $15 + ret z + ld a, [$c70d] + and a + ret nz + call Function0x37962 + ret nz + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + set 4, [hl] + call $398e + ld hl, $6c76 + call $7e73 + ld de, $0105 + call $7e54 + call $39c9 + ld hl, $523c + call FarBattleTextBox + ld a, $f + ld hl, $5de9 + rst FarCall + ret +; 360dd + + +Function0x360dd: ; 360dd + ld a, [hl] + and $20 + ret z + xor a + ld [hl], a + ld a, [hBattleTurn] + and a + ld a, [CurOTMon] + ld hl, OTPartyMon1Status + jr z, .asm_360f4 ; 0x360ec $6 + ld hl, PartyMon1Status + ld a, [CurBattleMon] +.asm_360f4 + call GetPartyLocation + xor a + ld [hl], a + call $398e + ld hl, $524b + jp FarBattleTextBox +; 36102 + + +BattleCommand18: ; 36102 + xor a + ld [$cfca], a + call CheckSubstituteOpp + ret nz + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + and a + ret nz + ld a, [TypeModifier] + and $7f + ret z + ld a, [Weather] + cp $2 + ret z + call Function0x36e5b + ret z + call GetOpponentItem + ld a, b + cp $16 + ret z + ld a, [$c70d] + and a + ret nz + call Function0x37962 + ret nz + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + set 5, [hl] + call $398e + ld de, $0108 + call $7e54 + call $39c9 + ld hl, $525d + call FarBattleTextBox + ld a, $f + ld hl, $5de9 + rst FarCall + ret nz + call $4216 + call EndRechargeOpp + ld hl, $c740 + ld a, [hBattleTurn] + and a + jr z, .asm_36162 ; 3615d $3 + ld hl, $c73f +.asm_36162 + ld [hl], $1 + ret +; 36165 + + +BattleCommand19: ; 36165 + xor a + ld [$cfca], a + call CheckSubstituteOpp + ret nz + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + and a + ret nz + ld a, [TypeModifier] + and $7f + ret z + call GetOpponentItem + ld a, b + cp $18 + ret z + ld a, [$c70d] + and a + ret nz + call Function0x37962 + ret nz + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + set 6, [hl] + call $398e + ld hl, $6c39 + call $7e73 + ld de, $0109 + call $7e54 + call $39c9 + call PrintParalyze + ld hl, $5de9 + jp $7e73 +; 361ac + + +BattleCommand70: ; 361ac +; attackup + ld b, $0 + jr BattleCommand1c +BattleCommand71: ; 361b0 +; defenseup + ld b, $1 + jr BattleCommand1c +BattleCommand72: ; 361b4 +; speedup + ld b, $2 + jr BattleCommand1c +BattleCommand73: ; 361b8 +; specialattackup + ld b, $3 + jr BattleCommand1c +BattleCommand74: ; 361bc +; specialdefenseup + ld b, $4 + jr BattleCommand1c +BattleCommand75: ; 361c0 +; accuracyup + ld b, $5 + jr BattleCommand1c +BattleCommand76: ; 361c4 +; evasionup + ld b, $6 + jr BattleCommand1c +BattleCommand77: ; 361c8 +; attackup2 + ld b, $10 + jr BattleCommand1c +BattleCommand78: ; 361cc +; defenseup2 + ld b, $11 + jr BattleCommand1c +BattleCommand79: ; 361d0 +; speedup2 + ld b, $12 + jr BattleCommand1c +BattleCommand7a: ; 361d4 +; specialattackup2 + ld b, $13 + jr BattleCommand1c +BattleCommand7b: ; 361d8 +; specialdefenseup2 + ld b, $14 + jr BattleCommand1c +BattleCommand7c: ; 361dc +; accuracyup2 + ld b, $15 + jr BattleCommand1c +BattleCommand7d: ; 361e0 +; evasionup2 + ld b, $16 + jr BattleCommand1c +BattleCommand1c: ; 361e4 +; statup + call Function0x361ef + ld a, [$c70e] + and a + ret nz + jp Function0x36281 +; 361ef + + +Function0x361ef: ; 361ef + ld a, b + ld [$c70c], a + ld hl, PlayerStatLevels + ld a, [hBattleTurn] + and a + jr z, .asm_361fe ; 0x361f9 $3 + ld hl, EnemyStatLevels +.asm_361fe + ld a, [AttackMissed] + and a + jp nz, Function0x3627b + ld a, [$c70d] + and a + jp nz, Function0x3627b + ld a, [$c70c] + and $f + ld c, a + ld b, $0 + add hl, bc + ld b, [hl] + inc b + ld a, $d + cp b + jp c, $6270 + ld a, [$c70c] + and $f0 + jr z, .asm_3622b ; 0x36222 $7 + inc b + ld a, $d + cp b + jr nc, .asm_3622b ; 0x36228 $1 + ld b, a +.asm_3622b + ld [hl], b + push hl + ld a, c + cp $5 + jr nc, .asm_36268 ; 0x36230 $36 + ld hl, $c641 + ld de, $c6b6 + ld a, [hBattleTurn] + and a + jr z, .asm_36243 ; 0x3623b $6 + ld hl, $d21b + ld de, $c6c1 +.asm_36243 + push bc + sla c + ld b, $0 + add hl, bc + ld a, c + add e + ld e, a + jr nc, .asm_3624f ; 0x3624c $1 + inc d +.asm_3624f + pop bc + ld a, [hld] + sub $e7 + jr nz, .asm_3625b ; 0x36253 $6 + ld a, [hl] + sbc $3 + jp z, Function0x3626e +.asm_3625b + ld a, [hBattleTurn] + and a + jr z, .asm_36265 ; 0x3625e $5 + call Function0x365fd + jr .asm_36268 ; 0x36263 $3 +.asm_36265 + call Function0x365d7 +.asm_36268 + pop hl + xor a + ld [$c70e], a + ret +; 3626e + +Function0x3626e: ; 3626e + pop hl + dec [hl] + ld a, $2 + ld [$c70e], a + ld a, $1 + ld [AttackMissed], a + ret +; 3627b + +Function0x3627b: ; 3627b + ld a, $1 + ld [$c70e], a + ret +; 36281 + +Function0x36281: ; 36281 + ld bc, $c6fe + ld hl, $7447 + ld a, [hBattleTurn] + and a + jr z, .asm_36292 ; 0x3628a $6 + ld bc, $c6fa + ld hl, $7486 +.asm_36292 + ld a, $c + call CleanGetBattleVarPair + cp $6b + ret nz + ld a, $1 + ld [bc], a + call $7ed5 + ret nc + xor a + ld [$ffd4], a + call $7e73 + call WaitBGMap + jp $7e80 +; 362ad + + +BattleCommand7e: ; 362ad +; attackdown + ld a, $0 + jr BattleCommand1d +BattleCommand7f: ; 362b1 +; defensedown + ld a, $1 + jr BattleCommand1d +BattleCommand80: ; 362b5 +; speeddown + ld a, $2 + jr BattleCommand1d +BattleCommand81: ; 362b9 +; specialattackdown + ld a, $3 + jr BattleCommand1d +BattleCommand82: ; 362bd +; specialdefensedown + ld a, $4 + jr BattleCommand1d +BattleCommand83: ; 362c1 +; accuracydown + ld a, $5 + jr BattleCommand1d +BattleCommand84: ; 362c5 +; evasiondown + ld a, $6 + jr BattleCommand1d +BattleCommand85: ; 362c9 +; attackdown2 + ld a, $10 + jr BattleCommand1d +BattleCommand86: ; 362cd +; defensedown2 + ld a, $11 + jr BattleCommand1d +BattleCommand87: ; 362d1 +; speeddown2 + ld a, $12 + jr BattleCommand1d +BattleCommand88: ; 362d5 +; specialattackdown2 + ld a, $13 + jr BattleCommand1d +BattleCommand89: ; 362d9 +; specialdefensedown2 + ld a, $14 + jr BattleCommand1d +BattleCommand8a: ; 362dd +; accuracydown2 + ld a, $15 + jr BattleCommand1d +BattleCommand8b: ; 362e1 +; evasiondown2 + ld a, $16 + +BattleCommand1d: ; 362e3 +; statdown + ld [$c70c], a + call Function0x36391 + jp nz, Function0x36386 + ld hl, EnemyStatLevels + ld a, [hBattleTurn] + and a + jr z, .asm_362f7 ; 362f2 $3 + ld hl, PlayerStatLevels +.asm_362f7 + ld a, [$c70c] + and $f + ld c, a + ld b, $0 + add hl, bc + ld b, [hl] + dec b + jp z, $6372 + ld a, [$c70c] + and $f0 + jr z, .asm_36310 ; 3630a $4 + dec b + jr nz, .asm_36310 ; 3630d $1 + inc b +.asm_36310 + ld a, [hBattleTurn] + and a + jr z, .asm_36338 ; 36313 $23 + ld a, [InLinkBattle] + and a + jr nz, .asm_36338 ; 36319 $1d + ld a, [$cfc0] + and a + jr nz, .asm_36338 ; 3631f $17 + ld a, [PlayerSubStatus5] + bit 5, a + jr nz, .asm_36338 ; 36326 $10 + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $49 + jr z, .asm_36338 ; 3632f $7 + call FarBattleRNG + cp $40 + jr c, .asm_3637d ; 36336 $45 +.asm_36338 + call CheckSubstituteOpp + jr nz, .asm_3637d ; 3633b $40 + ld a, [AttackMissed] + and a + jr nz, .asm_3637d ; 36341 $3a + ld a, [$c70d] + and a + jr nz, .asm_3637d ; 36347 $34 + call CheckHiddenOpponent + jr nz, .asm_3637d ; 3634c $2f + ld [hl], b + ld a, c + cp $5 + jr nc, .asm_3636c ; 36352 $18 + push hl + ld hl, $d21b + ld de, $c6c1 + ld a, [hBattleTurn] + and a + jr z, .asm_36366 ; 3635e $6 + ld hl, $c641 + ld de, $c6b6 +.asm_36366 + call Function0x3641a + pop hl + jr z, .asm_36371 ; 3636a $5 +.asm_3636c + xor a + ld [$c70e], a + ret +.asm_36371 + inc [hl] + ld a, $3 + ld [$c70e], a + ld a, $1 + ld [AttackMissed], a + ret +.asm_3637d + ld a, $1 + ld [$c70e], a + ld [AttackMissed], a + ret +; 36386 + + +Function0x36386: ; 36386 + ld a, $2 + ld [$c70e], a + ld a, $1 + ld [AttackMissed], a + ret +; 36391 + + +Function0x36391: ; 36391 + ld a, $d + 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 +.asm_363ae + xor a + ret +.asm_363b0 + ld a, $8 + call CleanGetBattleVarPair + bit 1, a + ret +; 363b8 + + +BattleCommand8c: ; 363b8 + ld a, [$c70e] + and a + ret nz + ld a, [$c70c] + and $f + ld b, a + inc b + call $648f + ld hl, .stat + jp BattleTextBox + +.stat + TX_FAR UnknownText_0x1c0cc6 + start_asm + + ld hl, .up + ld a, [$c70c] + and $f0 + ret z + ld hl, .wayup + ret + +.wayup + TX_FAR UnknownText_0x1c0cd0 + db "@" + +.up + TX_FAR UnknownText_0x1c0ce0 + db "@" + +; 363e9 + + +BattleCommand8d: ; 363e9 + ld a, [$c70e] + and a + ret nz + ld a, [$c70c] + and $f + ld b, a + inc b + call $648f + ld hl, .stat + jp BattleTextBox + +.stat + TX_FAR UnknownText_0x1c0ceb + start_asm + + ld hl, .fell + ld a, [$c70c] + and $f0 + ret z + ld hl, .sharplyfell + ret + +.sharplyfell + TX_FAR UnknownText_0x1c0cf5 + db "@" +.fell + TX_FAR UnknownText_0x1c0d06 + db "@" + +; 3641a + + +Function0x3641a: ; 3641a + push bc + sla c + ld b, $0 + add hl, bc + ld a, c + add e + ld e, a + jr nc, .asm_36426 ; 0x36423 $1 + inc d +.asm_36426 + pop bc + ld a, [hld] + sub $1 + jr nz, .asm_3642f ; 0x3642a $3 + ld a, [hl] + and a + ret z +.asm_3642f + ld a, [hBattleTurn] + and a + jr z, .asm_3643f ; 0x36432 $b + call $4ffd + call Function0x365d7 + call $4ffd + jr .asm_36448 ; 0x3643d $9 +.asm_3643f + call $4ffd + call Function0x365fd + call $4ffd +.asm_36448 + ld a, $1 + and a + ret +; 3644c + + +BattleCommand8e: ; 3644c +; applystatuser + ld a, [$c70e] + and a + ret z + push af + call $7e80 + pop af + dec a + jp z, $7349 + ld a, [$c70c] + and $f + ld b, a + inc b + call $648f + ld hl, $5272 + jp FarBattleTextBox +; 3646a + + +BattleCommand8f: ; 3646a +; applystattarget + ld a, [$c70e] + and a + ret z + push af + call $7e80 + pop af + dec a + jp z, $7349 + dec a + ld hl, $5321 + jp z, FarBattleTextBox + ld a, [$c70c] + and $f + ld b, a + inc b + call $648f + ld hl, $528f + jp FarBattleTextBox +; 3648f + + +GetStatName: ; 3648f + ld hl, .names + ld c, "@" +.CheckName + dec b + jr z, .Copy +.GetName + ld a, [hli] + cp c + jr z, .CheckName + jr .GetName +.Copy + ld de, StringBuffer2 + ld bc, StringBuffer3 - StringBuffer2 + jp CopyBytes + +.names + db "ATTACK@" + db "DEFENSE@" + db "SPEED@" + db "SPCL.ATK@" + db "SPCL.DEF@" + db "ACCURACY@" + db "EVASION@" + db "ABILITY@" +; 364e6 + + +Table0x364e6: ; 364e6 + dw $6419 + dw $641c + dw $6421 + dw $6428 + dw $6432 + dw $6442 +; 364f2 + + +StatLevelMulipliers: ; 364f2 + db 1, 1 ; 1.0x + db 15, 10 ; 1.5x + db 2, 1 ; 2.0x + db 25, 10 ; 2.5x + db 3, 1 ; 3.0x + db 35, 10 ; 3.5x + db 4, 1 ; 4.0x +; 36500 + + +BattleCommanda4: ; 36500 + call ResetMiss + call BattleCommand70 + call $63b8 + + call ResetMiss + call $61b0 + call $63b8 + + call ResetMiss + call $61b4 + call $63b8 + + call ResetMiss + call $61b8 + call $63b8 + + call ResetMiss + call $61bc + jp $63b8 +; 3652d + + +ResetMiss: ; 3652d + xor a + ld [AttackMissed], a + ret +; 36532 + + +Function0x36532: ; 36532 + ld [$c70c], a + + ld hl, PlayerStatLevels + ld a, [hBattleTurn] + and a + jr z, .asm_36540 + ld hl, EnemyStatLevels + +.asm_36540 + ld a, [$c70c] + and $f + ld c, a + ld b, 0 + add hl, bc + ld b, [hl] + dec b + jr z, .asm_36589 + + ld a, [$c70c] + and $f0 + jr z, .asm_36558 + dec b + jr nz, .asm_36558 + inc b + +.asm_36558 + ld [hl], b + ld a, c + cp 5 + jr nc, .asm_36576 + + push hl + ld hl, $c641 + ld de, $c6b6 + ld a, [hBattleTurn] + and a + jr z, .asm_36570 + ld hl, $d21b + ld de, $c6c1 + +.asm_36570 + call $641a + pop hl + jr z, .asm_36588 + +.asm_36576 + ld a, [hBattleTurn] + and a + jr z, .asm_36580 + + call Function0x365fd + + jr .asm_36583 + +.asm_36580 + call Function0x365d7 + +.asm_36583 + xor a + ld [$c70e], a + ret + +.asm_36588 + inc [hl] + +.asm_36589 + ld a, 2 + ld [$c70e], a + ret +; 3658f + + +BattleCommandac: ; 3658f +; + call $4ecc + +; get bit 4-5 +; ensure result is nonzero +; (this makes the chance of each result 1/3) +.loop + call FarBattleRNG + swap a + and %11 + jr z, .loop +; jump + dec a + ld hl, .ptrs + rst $28 + ret +.ptrs + dw $6165 + dw $6102 + dw $608c +; 365a7 + + +BattleCommandaf: ; 365a7 + ld a, BATTLE_VARS_SUBSTATUS2 + call GetBattleVarPair + set 0, [hl] + ret +; 365af + + +BattleCommanda6: ; 365af + ld hl, $743d + ld a, [hBattleTurn] + and a + jr z, .asm_365ba ; 365b5 $3 + ld hl, $747c +.asm_365ba + xor a + ld [$ffd4], a + call $7e73 + jp $31f6 +; 365c3 + + +BattleCommanda7: ; 365c3 + ld hl, $7447 + ld a, [hBattleTurn] + and a + jr z, .asm_365ce ; 365c9 $3 + ld hl, $7486 +.asm_365ce + xor a + ld [$ffd4], a + call $7e73 + jp $31f6 +; 365d7 + + +Function0x365d7: ; 365d7 + ld hl, PlayerAtkLevel + ld de, $c6b6 + ld bc, BattleMonAtk + + ld a, $5 + call Function0x3661d + + ld hl, $6d45 + call $7e73 + + call $4ffd + + ld hl, $6c39 + call $7e73 + + ld hl, $6c76 + call $7e73 + + jp $4ffd +; 365fd + + +Function0x365fd: ; 365fd + ld hl, EnemyAtkLevel + ld de, $c6c1 + ld bc, EnemyMonAtk + + ld a, $5 + call Function0x3661d + + call $4ffd + + ld hl, $6c39 + call $7e73 + + ld hl, $6c76 + call $7e73 + + jp $4ffd +; 3661d + + +Function0x3661d: ; 3661d +.asm_3661d + push af + ld a, [hli] + push hl + push bc + ld c, a + dec c + ld b, 0 + ld hl, Table0x364e6 + add hl, bc + add hl, bc + xor a + ld [$ffb4], a + ld a, [de] + ld [$ffb5], a + inc de + ld a, [de] + ld [$ffb6], a + inc de + ld a, [hli] + ld [$ffb7], a + call Multiply + + ld a, [hl] + ld [$ffb7], a + ld b, $4 + call Divide + + ld a, [$ffb5] + ld b, a + ld a, [$ffb6] + or b + jr nz, .asm_36651 + + ld a, $1 + ld [$ffb6], a + jr .asm_36662 + +.asm_36651 + ld a, [$ffb6] + cp $e7 + ld a, b + sbc $3 + jr c, .asm_36662 + + ld a, $e7 + ld [$ffb6], a + ld a, $3 + ld [$ffb5], a +.asm_36662 + pop bc + ld a, [$ffb5] + ld [bc], a + inc bc + ld a, [$ffb6] + ld [bc], a + inc bc + pop hl + pop af + dec a + jr nz, .asm_3661d + + ret +; 36671 + + +BattleCommand21: ; 36671 + ld a, BATTLE_VARS_SUBSTATUS3 + call CleanGetBattleVarPair + bit 0, a + ret z + ld hl, $c672 + ld a, [hBattleTurn] + and a + jr z, .asm_36684 ; 3667f $3 + ld hl, $c67a +.asm_36684 + dec [hl] + jr nz, .asm_366dc ; 36685 $55 + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + res 0, [hl] + ld hl, $4e84 + call FarBattleTextBox + ld a, BATTLE_VARS_MOVE_POWER + call GetBattleVarPair + ld a, $1 + ld [hl], a + ld hl, EnemyDamageTaken + ld de, $c732 + ld a, [hBattleTurn] + and a + jr z, .asm_366ad ; 366a5 $6 + ld hl, $c685 + ld de, $c733 +.asm_366ad + ld a, [hld] + add a + ld b, a + ld [CurDamage + 1], a + ld a, [hl] + rl a + ld [CurDamage], a + jr nc, .asm_366c3 ; 366b9 $8 + ld a, $ff + ld [CurDamage], a + ld [CurDamage + 1], a +.asm_366c3 + or b + jr nz, .asm_366cb ; 366c4 $5 + 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 [hl], a + ld b, $22 + jp $7e8c +.asm_366dc + ld hl, $4e6e + call FarBattleTextBox + jp EndMoveEffect +; 366e5 + + +BattleCommand22: ; 366e5 + ld de, $c682 + ld bc, $c672 + ld a, [hBattleTurn] + and a + jr z, .asm_366f6 ; 366ee $6 + ld de, $c684 + ld bc, $c67a +.asm_366f6 + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + set 0, [hl] + xor a + ld [de], a + inc de + ld [de], a + ld [PlayerMoveEffect], a + ld [EnemyMoveEffect], a + call FarBattleRNG + and $1 + inc a + inc a + ld [bc], a + ld a, $1 + ld [$c689], a + call $7e01 + jp EndMoveEffect +; 3671a + + +BattleCommand3e: ; 3671a + ld de, $c672 + ld a, [hBattleTurn] + and a + jr z, .asm_36725 ; 36720 $3 + ld de, $c67a +.asm_36725 + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + bit 1, [hl] + ret z + ld a, [de] + dec a + ld [de], a + jr nz, .asm_3674c ; 36730 $1a + res 1, [hl] + call $4ffd + call Function0x37962 + push af + call $4ffd + pop af + jr nz, .asm_3674c ; 3673f $b + set 7, [hl] + call FarBattleRNG + and $1 + inc a + inc a + inc de + ld [de], a +.asm_3674c + ld b, $3d + jp $7e8c +; 36751 + + +BattleCommand3d: ; 36751 + ld a, BATTLE_VARS_STATUS + call CleanGetBattleVarPair + and $7 + ret nz + ld de, $c672 + ld a, [hBattleTurn] + and a + jr z, .asm_36764 ; 3675f $3 + ld de, $c67a +.asm_36764 + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + set 1, [hl] + call FarBattleRNG + and $1 + inc a + ld [de], a + ld a, $1 + ld [$c73e], a + ret +; 36778 + + +BattleCommanda0: ; 36778 +; run + ld a, [BattleType] + cp $7 ; BATTLE_SHINY + jr z, .asm_367b9 + cp $9 ; ? + jr z, .asm_367b9 + cp $b ; ? + jr z, .asm_367b9 + cp $c ; suicune + jr z, .asm_367b9 + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call CleanGetBattleVarPair + bit 7, a + jr nz, .asm_367b9 + ld a, [hBattleTurn] + and a + jr nz, .asm_367bf + ld a, [IsInBattle] + dec a + jr nz, .asm_367b9 + ld a, [$d143] + ld b, a + ld a, [BattleMonLevel] + cp b + jr nc, .asm_367df + add b + ld c, a + inc c +.asm_367ac + call FarBattleRNG + cp c + jr nc, .asm_367ac ; 367b0 $fa + srl b + srl b + cp b + jr nc, .asm_367df ; 367b7 $26 + +.asm_367b9 + call $7e77 + jp $734e + +.asm_367bf + ld a, [IsInBattle] + dec a + jr nz, .asm_367b9 ; 367c3 $f4 + ld a, [BattleMonLevel] + ld b, a + ld a, [$d143] + cp b + jr nc, .asm_367df ; 367cd $10 + add b + ld c, a + inc c +.asm_367d2 + call FarBattleRNG + cp c + jr nc, .asm_367d2 ; 367d6 $fa + srl b + srl b + cp b + jr nc, .asm_367df ; 367dd $0 +.asm_367df + call $399c + xor a + ld [$cfca], a + inc a + ld [$d232], a + ld [$c689], a + call Function0x36804 + call BattleCommand0a + call $7e36 + ld c, $14 + call DelayFrames + call Function0x36804 + ld hl, $52ac + jp FarBattleTextBox +; 36804 + + +Function0x36804: ; 36804 + ld a, [$d0ee] + and $c0 + or $2 + ld [$d0ee], a + ret +; 3680f + + +BattleCommand23: ; 3680f + ld a, [BattleType] + cp $7 + jp z, $6969 + cp $9 + jp z, $6969 + cp $b + jp z, $6969 + cp $c + jp z, $6969 + ld a, [hBattleTurn] + and a + jp nz, .asm_368cd + ld a, [AttackMissed] + and a + jr nz, .asm_36852 ; 36830 $20 + ld a, [IsInBattle] + dec a + jr nz, .asm_36869 ; 36836 $31 + ld a, [$d143] + ld b, a + ld a, [BattleMonLevel] + cp b + jr nc, .asm_36855 ; 36840 $13 + add b + ld c, a + inc c +.asm_36845 + call FarBattleRNG + cp c + jr nc, .asm_36845 ; 36849 $fa + srl b + srl b + cp b + jr nc, .asm_36855 ; 36850 $3 +.asm_36852 + jp $6969 +.asm_36855 + call $399c + xor a + ld [$cfca], a + inc a + ld [$d232], a + call Function0x36804 + ld a, [PlayerMoveAnimation] + jp $6975 +.asm_36869 + call $49f4 + jr c, .asm_368ca ; 3686c $5c + ld a, [$c70f] + and a + jr z, .asm_368ca ; 36872 $56 + call $39b0 + ld a, $1 + ld [$c689], a + call $7e01 + ld c, $14 + call DelayFrames + ld hl, $c4a1 + ld bc, $040a + call ClearBox + ld c, $14 + call DelayFrames + ld a, [OTPartyCount] + ld b, a + ld a, [CurOTMon] + ld c, a +.asm_3689a + call FarBattleRNG + and $7 + cp b + jr nc, .asm_3689a ; 368a0 $f8 + cp c + jr z, .asm_3689a ; 368a3 $f5 + push af + push bc + ld hl, OTPartyMon1CurHP + call GetPartyLocation + ld a, [hli] + or [hl] + pop bc + pop de + jr z, .asm_3689a ; 368b1 $e7 + ld a, d + inc a + ld [$c718], a + ld hl, $54c3 + ld a, $f + rst FarCall + ld hl, $5544 + call FarBattleTextBox + ld hl, $5c23 + jp $7e73 +.asm_368ca + jp $6969 + +.asm_368cd + ld a, [AttackMissed] + and a + jr nz, .asm_368f3 + + ld a, [IsInBattle] + dec a + jr nz, .asm_36908 + + ld a, [BattleMonLevel] + ld b, a + ld a, [$d143] + cp b + jr nc, .asm_368f5 + + add b + ld c, a + inc c +.asm_368e6 + call FarBattleRNG + cp c + jr nc, .asm_368e6 + + srl b + srl b + cp b + jr nc, .asm_368f5 + +.asm_368f3 + jr .asm_36969 + +.asm_368f5 + call $399c + xor a + ld [$cfca], a + inc a + ld [$d232], a + call $6804 + ld a, [EnemyMoveAnimation] + jr .asm_36975 + +.asm_36908 + call Function0x36994 + jr c, .asm_36969 + + ld a, [$c70f] + cp $1 + jr z, .asm_368ca + + call $399c + ld a, $1 + ld [$c689], a + call $7e01 + ld c, $14 + call DelayFrames + ld hl, $c535 + ld bc, $050b + call $0fb6 + ld c, $14 + call DelayFrames + ld a, [PartyCount] + ld b, a + ld a, [CurBattleMon] + ld c, a +.asm_3693a + call FarBattleRNG + and $7 + cp b + jr nc, .asm_3693a + + cp c + jr z, .asm_3693a + + push af + push bc + ld hl, PartyMon1CurHP + call GetPartyLocation + ld a, [hli] + or [hl] + pop bc + pop de + jr z, .asm_3693a + + ld a, d + ld [CurPartyMon], a + ld hl, $5b32 + call $7e73 + ld hl, $5544 + call FarBattleTextBox + ld hl, $5c23 + jp $7e73 +.asm_36969 + call $4eee + call $7e80 + call $5004 + jp $734e +.asm_36975 + push af + call $6804 + ld a, $1 + ld [$c689], a + call $7e01 + ld c, $14 + call DelayFrames + pop af + ld hl, $52c1 + cp $2e + jr z, .asm_36991 + + ld hl, $52d2 +.asm_36991 + jp FarBattleTextBox +; 36994 + + +Function0x36994: ; 36994 + ld a, [PartyCount] + ld d, a + ld e, 0 + ld bc, $30 +.asm_3699d + ld a, [CurBattleMon] + cp e + jr z, .asm_369ae + + ld a, e + ld hl, PartyMon1CurHP + call AddNTimes + ld a, [hli] + or [hl] + jr nz, .asm_369b4 + +.asm_369ae + inc e + dec d + jr nz, .asm_3699d + + scf + ret + +.asm_369b4 + and a + ret +; 369b6 + + +BattleCommand24: ; 369b6 + ld de, $c672 + ld bc, $c682 + ld a, [hBattleTurn] + and a + jr z, .asm_369c7 ; 369bf $6 + ld de, $c67a + ld bc, $c684 +.asm_369c7 + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + bit 2, [hl] + jp nz, $6a43 + set 2, [hl] + ld a, BATTLE_VARS_MOVE_EFFECT + call GetBattleVarPair + ld a, [hl] + cp $4d + jr z, .asm_36a3f ; 369db $62 + cp $2c + ld a, $1 + jr z, .asm_36a3a ; 369e1 $57 + ld a, [hl] + cp $9a + jr z, .asm_369fb ; 369e6 $13 + cp $68 + jr nz, .asm_36a2b ; 369ea $3f +.asm_369ec + call FarBattleRNG + and $3 + jr z, .asm_369ec ; 369f1 $f9 + dec a + jr nz, .asm_36a3a ; 369f4 $44 + ld a, $1 + ld [bc], a + jr .asm_36a48 ; 369f9 $4d +.asm_369fb + ld a, [hBattleTurn] + and a + jr nz, .asm_36a0b ; 369fe $b + ld a, [PartyCount] + cp $1 + jp z, $6a1e + dec a + jr .asm_36a3a ; 36a09 $2f +.asm_36a0b + ld a, [IsInBattle] + cp $1 + jp z, $6a1e + ld a, [OTPartyCount] + cp $1 + jp z, $6a1e + dec a + jr .asm_36a3a ; 36a1c $1c + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + res 2, [hl] + call $55b5 + jp EndMoveEffect +.asm_36a2b + call FarBattleRNG + and $3 + cp $2 + jr c, .asm_36a39 ; 36a32 $5 + call FarBattleRNG + and $3 +.asm_36a39 + inc a +.asm_36a3a + ld [de], a + inc a + ld [bc], a + jr .asm_36a6b ; 36a3d $2c +.asm_36a3f + ld a, $1 + jr .asm_36a3a ; 36a41 $f7 + ld a, [de] + dec a + ld [de], a + jr nz, .asm_36a6b ; 36a46 $23 +.asm_36a48 + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + res 2, [hl] + ld hl, $52e5 + ld a, [hBattleTurn] + and a + jr z, .asm_36a5a ; 36a55 $3 + ld hl, $52f8 +.asm_36a5a + push bc + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $9a + jr z, .asm_36a67 ; 36a62 $3 + call FarBattleTextBox +.asm_36a67 + pop bc + xor a + ld [bc], a + ret +.asm_36a6b + ld a, [BattleScriptBufferLoc + 1] + ld h, a + ld a, [BattleScriptBufferLoc] + ld l, a +.asm_36a73 + ld a, [hld] + cp $5 + jr nz, .asm_36a73 ; 36a76 $fb + inc hl + ld a, h + ld [BattleScriptBufferLoc + 1], a + ld a, l + ld [BattleScriptBufferLoc], a + ret +; 36a82 + + +BattleCommand94: ; 36a82 + ld a, [AttackMissed] + and a + ret nz + call CheckSubstituteOpp + jr nz, .asm_36a9a ; 36a8a $e + ld a, BATTLE_VARS_STATUS_OPP + call CleanGetBattleVarPair + and $27 + jr nz, .asm_36a9a ; 36a93 $5 + call Function0x36abf + jr z, Function0x36ab5 ; 36a98 $1b +.asm_36a9a + ld a, 1 + ld [AttackMissed], a + ret +; 36aa0 + + +BattleCommand25: ; 36aa0 + call CheckSubstituteOpp + ret nz + ld a, BATTLE_VARS_STATUS_OPP + call CleanGetBattleVarPair + and $27 + ret nz + call Function0x36abf + ret nz + ld a, [$c70d] + and a + ret nz + + ; fallthrough +; 36ab5 + + +Function0x36ab5: ; 36ab5 + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call GetBattleVarPair + set 3, [hl] + jp EndRechargeOpp +; 36abf + + +Function0x36abf: ; 36abf + push bc + ld a, [$c70f] + ld b, a + ld a, [hBattleTurn] + xor b + pop bc + ret +; 36ac9 + + +BattleCommand4d: ; 36ac9 + ld a, [AttackMissed] + and a + ret nz + call GetUserItem + ld a, b + cp $4b + ret nz + call CheckSubstituteOpp + ret nz + ld a, BATTLE_VARS_MOVE_EFFECT + call GetBattleVarPair + ld d, h + ld e, l + call GetUserItem + call FarBattleRNG + cp c + ret nc + call EndRechargeOpp + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call GetBattleVarPair + set 3, [hl] + ret +; 36af3 + + +BattleCommand26: ; 36af3 + call ResetDamage + ld a, [TypeModifier] + and $7f + jr z, .asm_36b2f ; 36afb $32 + ld hl, EnemyMonLevel + ld de, BattleMonLevel + ld bc, PlayerMoveAccuracy + ld a, [hBattleTurn] + and a + jr z, .asm_36b12 ; 36b09 $7 + push hl + ld h, d + ld l, e + pop de + ld bc, EnemyMoveAccuracy +.asm_36b12 + ld a, [de] + sub [hl] + jr c, .asm_36b2f ; 36b14 $19 + add a + ld e, a + ld a, [bc] + add e + jr nc, .asm_36b1e ; 36b1a $2 + ld a, $ff +.asm_36b1e + ld [bc], a + call $4d32 + ld hl, CurDamage + ld a, $ff + ld [hli], a + ld [hl], a + ld a, $2 + ld [CriticalHit], a + ret +.asm_36b2f + ld a, $ff + ld [CriticalHit], a + ld a, $1 + ld [AttackMissed], a + ret +; 36b3a + + +BattleCommand3a: ; 36b3a + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair +; charged? + bit 4, [hl] + ret z +; go to town + res 4, [hl] + res 5, [hl] + res 6, [hl] + ld b, $39 + jp $7e8c +; 36b4d + + +BattleCommand39: ; 36b4d + call $7e85 + ld a, BATTLE_VARS_STATUS + call CleanGetBattleVarPair + and $7 + jr z, .asm_36b65 ; 36b57 $c + call $7e80 + call BattleCommand0c + call $734e + jp EndMoveEffect +.asm_36b65 + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + set 4, [hl] + ld hl, $5850 + ld a, [AlreadyDisobeyed] + and a + call nz, FarBattleTextBox + call BattleCommand0a + xor a + ld [$cfca], a + inc a + ld [$c689], a + call $7e36 + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + cp $13 + jr z, .asm_36b96 ; 36b8b $9 + cp $5b + jr z, .asm_36b96 ; 36b8f $5 + call BattleCommand0c + jr .asm_36b99 ; 36b94 $3 +.asm_36b96 + call $7ec0 +.asm_36b99 + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarPair + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + ld b, a + cp $13 + jr z, .asm_36bb0 ; 36ba6 $8 + cp $5b + jr nz, .asm_36bb2 ; 36baa $6 + set 5, [hl] + jr .asm_36bb2 ; 36bae $2 + +.asm_36bb0 + set 6, [hl] + +.asm_36bb2 + call Function0x34548 + jr nz, .asm_36bc3 ; 36bb5 $c + ld a, BATTLE_VARS_LAST_COUNTER_MOVE + call GetBattleVarPair + ld [hl], b + ld a, BATTLE_VARS_LAST_MOVE + call GetBattleVarPair + ld [hl], b + +.asm_36bc3 + call ResetDamage + + ld hl, .text_36bdb + call BattleTextBox + + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $91 ; skull bash + ld b, $fe + jp z, $7e8c + jp EndMoveEffect + +.text_36bdb +; [user] + TX_FAR UnknownText_0x1c0d0e + start_asm + + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + cp RAZOR_WIND + ld hl, .RazorWind + jr z, .asm_36c0d + + cp SOLARBEAM + ld hl, .Solarbeam + jr z, .asm_36c0d + + cp SKULL_BASH + ld hl, .SkullBash + jr z, .asm_36c0d + + cp SKY_ATTACK + ld hl, .SkyAttack + jr z, .asm_36c0d + + cp FLY + ld hl, .Fly + jr z, .asm_36c0d + + cp DIG + ld hl, .Dig + +.asm_36c0d + ret + +.RazorWind +; 'made a whirlwind!' + TX_FAR UnknownText_0x1c0d12 + db "@" + +.Solarbeam +; 'took in sunlight!' + TX_FAR UnknownText_0x1c0d26 + db "@" + +.SkullBash +; 'lowered its head!' + TX_FAR UnknownText_0x1c0d3a + db "@" + +.SkyAttack +; 'is glowing!' + TX_FAR UnknownText_0x1c0d4e + db "@" + +.Fly +; 'flew up high!' + TX_FAR UnknownText_0x1c0d5c + db "@" + +.Dig +; 'dug a hole!' + TX_FAR UnknownText_0x1c0d6c + db "@" +; 36c2c + + +BattleCommand3c: ; 36c2c +; unused + ret +; 36c2d + + +BattleCommand3b: ; 36c2d + ld a, [AttackMissed] + and a + ret nz + ld hl, $c731 + ld de, $c72f + ld a, [hBattleTurn] + and a + jr z, .asm_36c43 + ld hl, $c730 + ld de, $c72e + +.asm_36c43 + ld a, [hl] + and a + ret nz + ld a, BATTLE_VARS_SUBSTATUS4_OPP + call CleanGetBattleVarPair + bit 4, a + ret nz + call FarBattleRNG + and 3 + inc a + inc a + inc a + ld [hl], a + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + ld [de], a + ld b, a + ld hl, .Traps + +.asm_36c61 + ld a, [hli] + cp b + jr z, .asm_36c69 + inc hl + inc hl + jr .asm_36c61 + +.asm_36c69 + ld a, [hli] + ld h, [hl] + ld l, a + jp FarBattleTextBox + +.Traps + dbw BIND, UsedBindText ; 'used BIND on' + dbw WRAP, WrappedByText ; 'was WRAPPED by' + dbw FIRE_SPIN, FireSpinTrapText ; 'was trapped!' + dbw CLAMP, ClampedByText ; 'was CLAMPED by' + dbw WHIRLPOOL, WhirlpoolTrapText ; 'was trapped!' +; 36c7e + + +BattleCommand28: ; 36c7e + ld a, BATTLE_VARS_SUBSTATUS4 + call GetBattleVarPair + bit 1, [hl] + jr nz, .asm_36c92 ; 36c85 $b + set 1, [hl] + call $7e01 + ld hl, MistText + jp FarBattleTextBox +.asm_36c92 + call $7e77 + jp $734e +; 36c98 + + +BattleCommand29: ; 36c98 + ld a, BATTLE_VARS_SUBSTATUS4 + call GetBattleVarPair + bit 2, [hl] + jr nz, .asm_36cac ; 36c9f $b + set 2, [hl] + call $7e01 + ld hl, GettingPumpedText + jp FarBattleTextBox +.asm_36cac + call $7e77 + jp $734e +; 36cb2 + + +BattleCommand27: ; 36cb2 + ld hl, BattleMonMaxHP + ld a, [hBattleTurn] + and a + jr z, .asm_36cbd ; 36cb8 $3 + ld hl, EnemyMonMaxHPHi +.asm_36cbd + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + ld d, a + ld a, [CurDamage] + ld b, a + ld a, [CurDamage + 1] + ld c, a + srl b + rr c + srl b + rr c + ld a, b + or c + jr nz, .asm_36cd8 ; 36cd5 $1 + inc c +.asm_36cd8 + ld a, [hli] + ld [$d1eb], a + ld a, [hl] + ld [$d1ea], a + dec hl + dec hl + ld a, [hl] + ld [$d1ec], a + sub c + ld [hld], a + ld [$d1ee], a + ld a, [hl] + ld [$d1ed], a + sbc b + ld [hl], a + ld [$d1ef], a + jr nc, .asm_36cfe ; 36cf4 $8 + xor a + ld [hli], a + ld [hl], a + ld hl, $d1ee + ld [hli], a + ld [hl], a +.asm_36cfe + ld hl, $c55e + ld a, [hBattleTurn] + and a + ld a, $1 + jr z, .asm_36d0c ; 36d06 $4 + ld hl, $c4ca + xor a +.asm_36d0c + ld [$d10a], a + ld a, $b + call $2d83 + call $39c9 + ld hl, RecoilText + jp FarBattleTextBox +; 36d1d + + +BattleCommand2b: ; 36d1d +; battleanimation + confuse + call GetOpponentItem + ld a, b + cp $19 + ret z + ld a, [$c70d] + and a + ret nz + call Function0x37962 + ret nz + call CheckSubstituteOpp + ret nz + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call GetBattleVarPair + bit 7, [hl] + ret nz + jr Function0x36d70 + +BattleCommand2a: ; 36d3b + call GetOpponentItem + ld a, b + cp $19 + jr nz, .asm_36d53 + ld a, [hl] + ld [$d265], a + call $3468 + call $7e77 + ld hl, ProtectedByText + jp FarBattleTextBox + +.asm_36d53 + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call GetBattleVarPair + bit 7, [hl] + jr z, .asm_36d65 + call $7e77 + ld hl, AlreadyConfusedText + jp FarBattleTextBox + +.asm_36d65 + call CheckSubstituteOpp + jr nz, Function0x36db6 + ld a, [AttackMissed] + and a + jr nz, Function0x36db6 + + ; fallthrough +; 36d70 + + +Function0x36d70: ; 36d70 + ld bc, $c67b + ld a, [hBattleTurn] + and a + jr z, .asm_36d7b ; 36d76 $3 + ld bc, PlayerConfuseCount +.asm_36d7b + set 7, [hl] + call FarBattleRNG + and $3 + inc a + inc a + ld [bc], a + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $4c + jr z, .asm_36d99 + cp $5c + jr z, .asm_36d99 + cp $76 + jr z, .asm_36d99 + call $7e01 +.asm_36d99 + ld de, $0103 + call $7e54 + ld hl, BecameConfusedText + call FarBattleTextBox + call GetOpponentItem + ld a, b + cp $f + jr z, .asm_36db0 + cp $10 + ret nz +.asm_36db0 + ld hl, $5e51 + jp $7e73 +; 36db6 + +Function0x36db6: ; 36db6 + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $4c + ret z + cp $5c + ret z + cp $76 + ret z + jp PrintDidntAffect2 +; 36dc7 + + +BattleCommand30: ; 36dc7 + ld a, BATTLE_VARS_STATUS_OPP + call CleanGetBattleVarPair + bit 6, a + jr nz, .asm_36e49 ; 36dce $79 + ld a, [TypeModifier] + and $7f + jr z, .asm_36e55 ; 36dd5 $7e + call GetOpponentItem + ld a, b + cp $18 + jr nz, .asm_36def ; 36ddd $10 + ld a, [hl] + ld [$d265], a + call $3468 + call $7e77 + ld hl, ProtectedByText + jp FarBattleTextBox +.asm_36def + ld a, [hBattleTurn] + and a + jr z, .asm_36e0e ; 36df2 $1a + ld a, [InLinkBattle] + and a + jr nz, .asm_36e0e ; 36df8 $14 + ld a, [$cfc0] + and a + jr nz, .asm_36e0e ; 36dfe $e + ld a, [PlayerSubStatus5] + bit 5, a + jr nz, .asm_36e0e ; 36e05 $7 + call FarBattleRNG + cp $40 + jr c, .asm_36e52 ; 36e0c $44 +.asm_36e0e + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + and a + jr nz, .asm_36e52 ; 36e14 $3c + ld a, [AttackMissed] + and a + jr nz, .asm_36e52 ; 36e1a $36 + call CheckSubstituteOpp + jr nz, .asm_36e52 ; 36e1f $31 + ld c, $1e + call DelayFrames + call $7e01 + ld a, $1 + ld [$ffd4], a + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + set 6, [hl] + call $398e + ld hl, $6c39 + call $7e73 + call $39d4 + call PrintParalyze + ld hl, $5de9 + jp $7e73 +.asm_36e49 + call $7e77 + ld hl, AlreadyParalyzedText + jp FarBattleTextBox +.asm_36e52 + jp PrintDidntAffect2 +.asm_36e55 + call $7e77 + jp PrintDoesntAffect +; 36e5b + + +Function0x36e5b: ; 36e5b +; Compare move type to user type. +; Return z if matching the user type (unless the move is Normal). + + push hl + + ld hl, EnemyMonType1 + ld a, [hBattleTurn] + and a + jr z, .ok + ld hl, BattleMonType1 +.ok + + ld a, BATTLE_VARS_MOVE_TYPE + call CleanGetBattleVarPair + cp NORMAL + jr z, .normal + + cp [hl] + jr z, .return + + inc hl + cp [hl] + +.return + pop hl + ret + +.normal + ld a, 1 + and a + pop hl + ret +; 36e7c + + +BattleCommand31: ; 36e7c + call $7e80 + ld hl, BattleMonMaxHP + ld de, $c6df + ld a, [hBattleTurn] + and a + jr z, .asm_36e90 ; 36e88 $6 + ld hl, EnemyMonMaxHPHi + ld de, $c6e0 +.asm_36e90 + ld a, BATTLE_VARS_SUBSTATUS4 + call CleanGetBattleVarPair + bit 4, a + jr nz, .asm_36ef4 ; 36e97 $5b + ld a, [hli] + ld b, [hl] + srl a + rr b + srl a + rr b + dec hl + dec hl + ld a, b + ld [de], a + ld a, [hld] + sub b + ld e, a + ld a, [hl] + sbc $0 + ld d, a + jr c, .asm_36eff ; 36eae $4f + ld a, d + or e + jr z, .asm_36eff ; 36eb2 $4b + ld [hl], d + inc hl + ld [hl], e + ld a, BATTLE_VARS_SUBSTATUS4 + call GetBattleVarPair + set 4, [hl] + ld hl, $c730 + ld de, $c72e + ld a, [hBattleTurn] + and a + jr z, .asm_36ecf ; 36ec7 $6 + ld hl, $c731 + ld de, $c72f +.asm_36ecf + xor a + ld [hl], a + ld [de], a + call $7ed5 + jr c, .asm_36ee8 ; 36ed5 $11 + xor a + ld [$cfca], a + ld [FXAnimIDHi], a + ld [$c689], a + ld a, $a4 + call $7e44 + jr .asm_36eeb ; 36ee6 $3 +.asm_36ee8 + call BattleCommanda6 +.asm_36eeb + ld hl, MadeSubstituteText + call FarBattleTextBox + jp $39c9 +.asm_36ef4 + call Function0x34548 + call nz, BattleCommand0c + ld hl, HasSubstituteText + jr .asm_36f08 ; 36efd $9 +.asm_36eff + call Function0x34548 + call nz, BattleCommand0c + ld hl, TooWeakSubText +.asm_36f08 + jp FarBattleTextBox +; 36f0b + +BattleCommand32: ; 36f0b + ld a, BATTLE_VARS_SUBSTATUS4 + call GetBattleVarPair + set 5, [hl] + ret +; 36f13 + + +EndRechargeOpp: ; 36f13 + push hl + ld a, BATTLE_VARS_SUBSTATUS4_OPP + call GetBattleVarPair + res 5, [hl] + pop hl + ret +; 36f1d + + +BattleCommand97: ; 36f1d + ld a, BATTLE_VARS_SUBSTATUS4 + call GetBattleVarPair + set 6, [hl] + ret +; 36f25 + + +BattleCommand98: ; 36f25 + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call CleanGetBattleVarPair + bit 6, a + ret z + jr BattleCommand9899 +; 36f2f + + +BattleCommand99: ; 36f2f + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call CleanGetBattleVarPair + bit 5, a ; recharge + ret z + + ; fallthrough +; 36f37 + + +BattleCommand9899: ; 36f37 + ld hl, CurDamage + 1 + sla [hl] + dec hl + rl [hl] + jr nc, .quit + + ld a, $ff + ld [hli], a + ld [hl], a +.quit + ret +; 36f46 + + +BattleCommand33: ; 36f46 + call Function0x372d8 + call $7e80 + ld a, [AttackMissed] + and a + jr nz, .asm_36f9a ; 36f50 $48 + ld hl, BattleMonMoves + ld a, [hBattleTurn] + and a + jr z, .asm_36f5d ; 36f58 $3 + ld hl, EnemyMonMoves +.asm_36f5d + call CheckHiddenOpponent + jr nz, .asm_36f9a ; 36f60 $38 + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + and a + jr z, .asm_36f9a ; 36f68 $30 + cp $a5 + jr z, .asm_36f9a ; 36f6c $2c + ld b, a + ld c, $4 +.asm_36f71 + ld a, [hli] + cp b + jr z, .asm_36f9a ; 36f73 $25 + dec c + jr nz, .asm_36f71 ; 36f76 $f9 + dec hl +.asm_36f79 + ld a, [hld] + cp $66 + jr nz, .asm_36f79 ; 36f7c $fb + inc hl + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + ld [hl], a + ld [$d265], a + ld bc, $0006 + add hl, bc + ld [hl], $5 + call $34f8 + call $7e01 + ld hl, LearnedMoveText + jp FarBattleTextBox +.asm_36f9a + jp $7357 +; 36f9d + + +BattleCommand35: ; 36f9d +; leechseed + ld a, [AttackMissed] + and a + jr nz, .asm_36fd8 ; 36fa1 $35 + call CheckSubstituteOpp + jr nz, .asm_36fd8 ; 36fa6 $30 + ld de, EnemyMonType1 + ld a, [hBattleTurn] + and a + jr z, .asm_36fb3 ; 36fae $3 + ld de, BattleMonType1 +.asm_36fb3 + ld a, [de] + cp $16 + jr z, .asm_36fd2 ; 36fb6 $1a + inc de + ld a, [de] + cp $16 + jr z, .asm_36fd2 ; 36fbc $14 + ld a, BATTLE_VARS_SUBSTATUS4_OPP + call GetBattleVarPair + bit 7, [hl] + jr nz, .asm_36fd8 ; 36fc5 $11 + set 7, [hl] + call $7e01 + ld hl, WasSeededText + jp FarBattleTextBox +.asm_36fd2 + call $7e77 + jp PrintDoesntAffect +.asm_36fd8 + call $7e77 + ld hl, EvadedText + jp FarBattleTextBox +; 36fe1 + + +BattleCommand36: ; 36fe1 + call $7e01 + ld a, $41 + ld hl, $60e5 + rst FarCall + jp PrintNothingHappened +; 36fed + + +BattleCommand37: ; 36fed +; disable + + ld a, [AttackMissed] + and a + jr nz, .asm_37059 ; 36ff1 $66 + ld de, EnemyEncoreCount + ld hl, EnemyMonMoves + ld a, [hBattleTurn] + and a + jr z, .asm_37004 ; 36ffc $6 + ld de, PlayerDisableCount + ld hl, BattleMonMoves +.asm_37004 + ld a, [de] + and a + jr nz, .asm_37059 ; 37006 $51 + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + and a + jr z, .asm_37059 ; 3700e $49 + cp $a5 + jr z, .asm_37059 ; 37012 $45 + ld b, a + ld c, $ff +.asm_37017 + inc c + ld a, [hli] + cp b + jr nz, .asm_37017 ; 3701a $fb + ld a, [hBattleTurn] + and a + ld hl, EnemyMonPPMove1 + jr z, .asm_37027 ; 37022 $3 + ld hl, BattleMonPP +.asm_37027 + ld b, $0 + add hl, bc + ld a, [hl] + and a + jr z, .asm_37059 ; 3702c $2b +.asm_3702e + call FarBattleRNG + and $7 + jr z, .asm_3702e ; 37033 $f9 + inc a + inc c + swap c + add c + ld [de], a + call $7e01 + ld hl, DisabledMove + ld a, [hBattleTurn] + and a + jr nz, .asm_37047 ; 37044 $1 + inc hl +.asm_37047 + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + ld [hl], a + ld [$d265], a + call $34f8 + ld hl, WasDisabledText + jp FarBattleTextBox +.asm_37059 + jp Function0x37354 +; 3705c + + +BattleCommand1e: ; 3705c + xor a + ld hl, StringBuffer1 + ld [hli], a + ld a, [hBattleTurn] + and a + ld a, [BattleMonLevel] + jr z, .asm_3706c ; 37067 $3 + ld a, [EnemyMonLevel] +.asm_3706c + add a + ld hl, $c6ee + add [hl] + ld [hld], a + jr nc, .asm_37079 ; 37072 $5 + inc [hl] + dec hl + jr nz, .asm_37079 ; 37076 $1 + inc [hl] +.asm_37079 + ld hl, CoinsScatteredText + jp FarBattleTextBox +; 3707f + + +BattleCommand1f: ; 3707f + ld hl, BattleMonMoves + ld de, BattleMonType1 + ld a, [hBattleTurn] + and a + jr z, .asm_37090 ; 37088 $6 + ld hl, EnemyMonMoves + ld de, EnemyMonType1 +.asm_37090 + push de + ld c, $0 + ld de, StringBuffer1 +.asm_37096 + push hl + ld b, $0 + add hl, bc + ld a, [hl] + pop hl + and a + jr z, .asm_370b2 ; 3709d $13 + push hl + push bc + dec a + ld hl, $5afe + call $7ea1 + ld [de], a + inc de + pop bc + pop hl + inc c + ld a, c + cp $4 + jr c, .asm_37096 ; 370b0 $e4 +.asm_370b2 + ld a, $ff + ld [de], a + inc de + ld [de], a + inc de + ld [de], a + pop de + ld hl, StringBuffer1 +.asm_370bd + ld a, [hl] + cp $ff + jr z, .asm_370d3 ; 370c0 $11 + cp $13 + jr z, .asm_370d0 ; 370c4 $a + ld a, [de] + cp [hl] + jr z, .asm_370d0 ; 370c8 $6 + inc de + ld a, [de] + dec de + cp [hl] + jr nz, .asm_370d9 ; 370ce $9 +.asm_370d0 + inc hl + jr .asm_370bd ; 370d1 $ea +.asm_370d3 + call $7e77 + jp $734e +.asm_370d9 + call FarBattleRNG + and $3 + ld c, a + ld b, $0 + ld hl, StringBuffer1 + add hl, bc + ld a, [hl] + cp $ff + jr z, .asm_370d9 ; 370e8 $ef + cp $13 + jr z, .asm_370d9 ; 370ec $eb + ld a, [de] + cp [hl] + jr z, .asm_370d9 ; 370f0 $e7 + inc de + ld a, [de] + dec de + cp [hl] + jr z, .asm_370d9 ; 370f6 $e1 + ld a, [hl] + ld [de], a + inc de + ld [de], a + ld [$d265], a + ld a, $14 + ld hl, $4964 + rst FarCall + call $7e01 + ld hl, TransformedTypeText + jp FarBattleTextBox +; 3710e + + +BattleCommand20: ; 3710e +; resetstats + ld a, 7 ; neutral + ld hl, PlayerStatLevels + call .Fill + ld hl, EnemyStatLevels + call .Fill + + ld a, [hBattleTurn] + push af + + call SetPlayerTurn + call Function0x365d7 + call SetEnemyTurn + call Function0x365fd + + pop af + ld [hBattleTurn], a + + call $7e01 + + ld hl, EliminatedStatsText + jp FarBattleTextBox + +.Fill + ld b, PlayerStatLevelsEnd - PlayerStatLevels +.asm_37139 + ld [hli], a + dec b + jr nz, .asm_37139 + ret +; 3713e + + +BattleCommand2c: ; 3713e + ld de, BattleMonHP + ld hl, BattleMonMaxHP + ld a, [hBattleTurn] + and a + jr z, .asm_3714f ; 37147 $6 + ld de, EnemyMonHPHi + ld hl, EnemyMonMaxHPHi +.asm_3714f + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + ld b, a + push hl + push de + push bc + ld c, $2 + call StringCmp + pop bc + pop de + pop hl + jp z, .asm_371c4 + ld a, b + cp $9c + jr nz, .asm_37199 ; 37166 $31 + push hl + push de + push af + call $7e80 + ld a, BATTLE_VARS_SUBSTATUS5 + call GetBattleVarPair + res 0, [hl] + ld a, BATTLE_VARS_STATUS + call GetBattleVarPair + ld a, [hl] + and a + ld [hl], $3 + ld hl, WentToSleepText + jr z, .asm_37186 ; 37181 $3 + ld hl, RestedText +.asm_37186 + call FarBattleTextBox + ld a, [hBattleTurn] + and a + jr nz, .asm_37193 ; 3718c $5 + call Function0x365d7 + jr .asm_37196 ; 37191 $3 +.asm_37193 + call Function0x365fd +.asm_37196 + pop af + pop de + pop hl +.asm_37199 + jr z, .asm_371a3 ; 37199 $8 + ld hl, $4c9f + call $7e73 + jr .asm_371a9 ; 371a1 $6 +.asm_371a3 + ld hl, $4cac + call $7e73 +.asm_371a9 + call $7e01 + call $4ffd + ld hl, $4cef + call $7e73 + call $4ffd + call $3995 + call $39c9 + ld hl, RegainedHealthText + jp FarBattleTextBox + +.asm_371c4 + call $7e77 + ld hl, HPIsFullText + jp FarBattleTextBox +; 371cd + + +BattleCommand2d: ; 371cd +; transform + + call Function0x372d8 + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call GetBattleVarPair + bit 3, [hl] + jp nz, Function0x372d2 + call CheckHiddenOpponent + jp nz, Function0x372d2 + xor a + ld [$cfca], a + ld [FXAnimIDHi], a + ld a, $1 + ld [$c689], a + ld a, BATTLE_VARS_SUBSTATUS4 + call GetBattleVarPair + bit 4, [hl] + push af + jr z, .asm_37200 ; 371f4 $a + call Function0x34548 + jr nz, .asm_37200 ; 371f9 $5 + ld a, $a4 + call $7e44 +.asm_37200 + ld a, BATTLE_VARS_SUBSTATUS5 + call GetBattleVarPair + set 3, [hl] + call $72e7 + ld hl, BattleMonSpecies + ld de, EnemyMonSpecies + ld a, [hBattleTurn] + and a + jr nz, .asm_3721f ; 37213 $a + ld hl, EnemyMonSpecies + ld de, BattleMonSpecies + xor a + ld [CurMoveNum], a +.asm_3721f + push hl + ld a, [hli] + ld [de], a + inc hl + inc de + inc de + ld bc, $0004 + call $3026 + ld a, [hBattleTurn] + and a + jr z, .asm_3723a ; 3722e $a + ld a, [de] + ld [$c6f2], a + inc de + ld a, [de] + ld [$c6f3], a + dec de +.asm_3723a + ld a, [hli] + ld [de], a + inc de + ld a, [hli] + ld [de], a + inc de + ld bc, $000c + add hl, bc + push hl + ld h, d + ld l, e + add hl, bc + ld d, h + ld e, l + pop hl + ld bc, $000c + call $3026 + ld bc, $ffe2 + add hl, bc + push de + ld d, h + ld e, l + pop hl + ld bc, $ffe8 + add hl, bc + ld b, $4 +.asm_3725f + ld a, [de] + inc de + and a + jr z, .asm_3726c ; 37262 $8 + cp $a6 + ld a, $1 + jr z, .asm_3726c ; 37268 $2 + ld a, $5 +.asm_3726c + ld [hli], a + dec b + jr nz, .asm_3725f ; 3726e $ef + pop hl + ld a, [hl] + ld [$d265], a + call $343b + ld hl, $c6c1 + ld de, $c6b6 + ld bc, $000a + call BattleSideCopy + ld hl, EnemyStatLevels + ld de, PlayerStatLevels + ld bc, $0008 + call BattleSideCopy + call $7ed5 + jr c, .asm_372a8 ; 37293 $13 + ld a, [hBattleTurn] + and a + ld a, [$c6fe] + jr z, .asm_372a0 ; 3729b $3 + ld a, [$c6fa] +.asm_372a0 + and a + jr nz, .asm_372a8 ; 372a1 $5 + call $7e36 + jr .asm_372ae ; 372a6 $6 +.asm_372a8 + call $7e80 + call BattleCommanda6 +.asm_372ae + xor a + ld [$cfca], a + ld [FXAnimIDHi], a + ld a, $2 + ld [$c689], a + pop af + ld a, $a4 + call nz, $7e44 + ld hl, TransformedText + jp FarBattleTextBox +; 372c6 + + +BattleSideCopy: ; 372c6 +; Copy bc bytes from hl to de if it's the player's turn. +; Copy bc bytes from de to hl if it's the enemy's turn. + ld a, [hBattleTurn] + and a + jr z, .copy + +; Swap hl and de + push hl + ld h, d + ld l, e + pop de +.copy + jp CopyBytes +; 372d2 + + +Function0x372d2: ; 372d2 + call $7e77 + jp $734e +; 372d8 + + +Function0x372d8: ; 372d8 + ld a, BATTLE_VARS_LAST_COUNTER_MOVE + call GetBattleVarPair + xor a + ld [hl], a + + ld a, BATTLE_VARS_LAST_MOVE + call GetBattleVarPair + xor a + ld [hl], a + ret +; 372e7 + + +; 372e7 + ld a, [hBattleTurn] + and a + jr z, .player + + xor a + ld [EnemyEncoreCount], a + ld [EnemyEncoredMove], a + ret + +.player + xor a + ld [PlayerDisableCount], a + ld [DisabledMove], a + ret +; 372fc + + +BattleCommand2e: ; 372fc + ld hl, PlayerScreens + ld bc, PlayerLightScreenCount + ld a, [hBattleTurn] + and a + jr z, .asm_3730d ; 37305 $6 + ld hl, $c700 + ld bc, $c706 +.asm_3730d + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + cp $23 + jr nz, .asm_37324 ; 37314 $e + bit 3, [hl] + jr nz, .asm_37337 ; 37318 $1d + set 3, [hl] + ld a, $5 + ld [bc], a + ld hl, $54b4 + jr .asm_37331 ; 37322 $d +.asm_37324 + bit 4, [hl] + jr nz, .asm_37337 ; 37326 $f + set 4, [hl] + inc bc + ld a, $5 + ld [bc], a + ld hl, $54c7 +.asm_37331 + call $7e01 + jp FarBattleTextBox +.asm_37337 + call $7e77 + jp $734e +; 3733d + + +PrintDoesntAffect: ; 3733d +; 'it doesn't affect' + ld hl, DoesntAffectText + jp FarBattleTextBox +; 37343 + + +PrintNothingHappened: ; 37343 +; 'but nothing happened!' + ld hl, NothingHappenedText + jp FarBattleTextBox +; 37349 + + +PrintButItFailed: ; 37349 + ld a, [$c6fb] + and a + ret nz + +; 'but it failed!' + ld hl, ButItFailedText + jp FarBattleTextBox +; 37354 + + +Function0x37354: ; 37354 + call $7e77 + ld hl, ButItFailedText ; 'but it failed!' + ld de, ItFailedText ; 'it failed!' + jp Function0x35157 +; 37360 + + +PrintDidntAffect; 37360 +; 'it didn't affect' + ld hl, DidntAffect1Text + jp FarBattleTextBox +; 37366 + + +PrintDidntAffect2: ; 37366 + call $7e77 + ld hl, DidntAffect1Text ; 'it didn't affect' + ld de, DidntAffect2Text ; 'it didn't affect' + jp Function0x35157 +; 37372 + + +PrintParalyze: ; 37372 +; 'paralyzed! maybe it can't attack!' + ld hl, ParalyzedText + jp FarBattleTextBox +; 37378 + + +CheckSubstituteOpp: ; 37378 + ld a, BATTLE_VARS_SUBSTATUS4_OPP + call CleanGetBattleVarPair + bit 4, a + ret +; 37380 + + +BattleCommand1a: ; 37380 + ld a, $41 + ld hl, $610d + rst FarCall + ld a, $4 + ld [$cfca], a + ld c, $3 + call DelayFrames + ld a, BATTLE_VARS_STATUS + call GetBattleVarPair + xor a + ld [hli], a + inc hl + ld [hli], a + ld [hl], a + ld a, $1 + ld [$c689], a + call BattleCommand0a + call $7e36 + ld a, BATTLE_VARS_SUBSTATUS4 + call GetBattleVarPair + res 7, [hl] + ld a, BATTLE_VARS_SUBSTATUS5_OPP + call GetBattleVarPair + res 6, [hl] + call $7ed5 + ret nc + ld a, $f + ld hl, $5f58 + rst FarCall + ld a, $f + ld hl, $6043 + rst FarCall + call $31f6 + jp $39c9 +; 373c9 + + +BattleCommand1b: ; 373c9 +; mirrormove + + call Function0x372d8 + ld a, BATTLE_VARS_MOVE + call GetBattleVarPair + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + and a + jr z, .asm_373de ; 373d7 $5 + call CheckUserMove + jr nz, .asm_373ea ; 373dc $c +.asm_373de + call $7e77 + ld hl, MirrorMoveFailedText + call FarBattleTextBox + jp EndMoveEffect +.asm_373ea + ld a, b + ld [hl], a + ld [$d265], a + push af + ld a, BATTLE_VARS_MOVE_ANIM + call GetBattleVarPair + ld d, h + ld e, l + pop af + dec a + call GetMoveData + call $34f8 + call $30d6 + call Function0x34548 + jr nz, .asm_37412 ; 37405 $b + ld a, [$c689] + push af + call BattleCommand0a + pop af + ld [$c689], a +.asm_37412 + call $7e80 + jp ResetTurn +; 37418 + + +BattleCommand34: ; 37418 +; metronome + + call Function0x372d8 + call Function0x34548 + jr nz, .asm_3742b + + ld a, [$c689] + push af + call BattleCommand0a + pop af + ld [$c689], a + +.asm_3742b + call $7e36 + +.GetMove + call FarBattleRNG + +; No invalid moves. + cp BEAT_UP + 1 + jr nc, .GetMove + +; None of the moves in MetronomeExcepts. + push af + ld de, 1 + ld hl, MetronomeExcepts + call IsInArray + pop bc + jr c, .GetMove + +; No moves the user already has. + ld a, b + call CheckUserMove + jr z, .GetMove + + + ld a, BATTLE_VARS_MOVE + call GetBattleVarPair + ld [hl], b + call UpdateMoveData + jp ResetTurn +; 37454 + + +MetronomeExcepts: ; 37454 + db $00 + db METRONOME + db STRUGGLE + db SKETCH + db MIMIC + db COUNTER + db MIRROR_COAT + db PROTECT + db DETECT + db ENDURE + db DESTINY_BOND + db SLEEP_TALK + db THIEF + db $ff +; 37462 + + +CheckUserMove: ; 37462 +; Return z if the user has move a. + ld b, a + ld de, BattleMonMoves + ld a, [hBattleTurn] + and a + jr z, .ok + ld de, EnemyMonMoves +.ok + + ld c, NUM_MOVES +.loop + ld a, [de] + inc de + cp b + ret z + + dec c + jr nz, .loop + + ld a, 1 + and a + ret +; 3747b + + +ResetTurn: ; 3747b + ld hl, $c732 + ld a, [hBattleTurn] + and a + jr z, .asm_37486 + ld hl, $c733 + +.asm_37486 + ld [hl], 1 + xor a + ld [AlreadyDisobeyed], a + call $402c + jp $52a3 +; 37492 + + +BattleCommand50: ; 37492 +; thief + + ld a, [hBattleTurn] + and a + jr nz, .asm_374ce ; 37495 $37 + call .asm_37501 + ld a, [hl] + and a + ret nz + call .asm_3750c + ld a, [hl] + and a + ret z + ld [$d265], a + ld d, a + ld a, $2e + ld hl, $5e76 + rst FarCall + ret c + ld a, [$c70d] + and a + ret nz + ld a, [InLinkBattle] + and a + jr z, .asm_374be ; 374b7 $5 + ld a, [IsInBattle] + dec a + ret z +.asm_374be + call .asm_3750c + xor a + ld [hl], a + ld [de], a + call .asm_37501 + ld a, [$d265] + ld [hl], a + ld [de], a + jr .asm_374f8 ; 374cc $2a +.asm_374ce + call .asm_3750c + ld a, [hl] + and a + ret nz + call .asm_37501 + ld a, [hl] + and a + ret z + ld [$d265], a + ld d, a + ld a, $2e + ld hl, $5e76 + rst FarCall + ret c + ld a, [$c70d] + and a + ret nz + call .asm_37501 + xor a + ld [hl], a + ld [de], a + call .asm_3750c + ld a, [$d265] + ld [hl], a + ld [de], a +.asm_374f8 + call $3468 + ld hl, StoleText + jp FarBattleTextBox + +.asm_37501 + ld a, 1 + call BattlePartyAttr + ld d, h + ld e, l + ld hl, BattleMonItem + ret + +.asm_3750c + ld a, 1 + call $396d ; GetOTStat_Battle + ld d, h + ld e, l + ld hl, EnemyMonItem + ret +; 37517 + + +BattleCommand51: ; 37517 +; arenatrap + call CheckHiddenOpponent + jr nz, .asm_37530 ; 3751a $14 + ld a, BATTLE_VARS_SUBSTATUS5 + call GetBattleVarPair + bit 7, [hl] + jr nz, .asm_37530 ; 37523 $b + set 7, [hl] + call $7e01 + ld hl, CantEscapeNowText + jp FarBattleTextBox +.asm_37530 + call $7e77 + jp $734e +; 37536 + + +BattleCommand52: ; 37536 +; nightmare + + call CheckHiddenOpponent + jr nz, .asm_3755d ; 37539 $22 + call CheckSubstituteOpp + jr nz, .asm_3755d ; 3753e $1d + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + and $7 + jr z, .asm_3755d ; 37547 $14 + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call GetBattleVarPair + bit 0, [hl] + jr nz, .asm_3755d ; 37550 $b + set 0, [hl] + call $7e01 + ld hl, StartedNightmareText + jp FarBattleTextBox +.asm_3755d + call $7e77 + jp $734e +; 37563 + + +BattleCommand53: ; 37563 +; defrost + + ld a, BATTLE_VARS_STATUS + call GetBattleVarPair + bit 5, [hl] + ret z + res 5, [hl] + ld a, [hBattleTurn] + and a + jr z, .asm_37578 ; 37570 $6 + ld a, [IsInBattle] + dec a + jr z, .asm_3757f ; 37576 $7 +.asm_37578 + ld a, $20 + call $3945 + res 5, [hl] +.asm_3757f + call $39c9 + ld hl, WasDefrostedText + jp FarBattleTextBox +; 37588 + + +BattleCommand54: ; 37588 +; curse + + ld de, BattleMonType1 + ld bc, PlayerStatLevels + ld a, [hBattleTurn] + and a + jr z, .asm_37599 ; 37591 $6 + ld de, EnemyMonType1 + ld bc, EnemyStatLevels +.asm_37599 + ld a, [de] + cp $8 + jr z, .asm_375d7 ; 3759c $39 + inc de + ld a, [de] + cp $8 + jr z, .asm_375d7 ; 375a2 $33 + ld a, [bc] + cp $d + jr c, .asm_375af ; 375a7 $6 + inc bc + ld a, [bc] + cp $d + jr nc, .asm_3760a ; 375ad $5b +.asm_375af + ld a, $1 + ld [$c689], a + call $7e01 + ld a, $2 + call Function0x36532 + call $4ffd + call $63e9 + call ResetMiss + call $4ffd + call BattleCommand70 + call $63b8 + call ResetMiss + call $61b0 + jp $63b8 +.asm_375d7 + call CheckHiddenOpponent + jr nz, .asm_37604 ; 375da $28 + call CheckSubstituteOpp + jr nz, .asm_37604 ; 375df $23 + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call GetBattleVarPair + bit 1, [hl] + jr nz, .asm_37604 ; 375e8 $1a + set 1, [hl] + call $7e01 + ld hl, $4c9f + call $7e73 + ld hl, $4c3f + call $7e73 + call $3995 + ld hl, PutACurseText + jp FarBattleTextBox +.asm_37604 + call $7e77 + jp $734e +.asm_3760a + ld b, $8 + call $648f + call $7e77 + ld hl, WontRiseAnymoreText + jp FarBattleTextBox +; 37618 + + +BattleCommand55: ; 37618 +; protect + + call Function0x3762c + ret c + ld a, BATTLE_VARS_SUBSTATUS1 + call GetBattleVarPair + set 2, [hl] + call $7e01 + ld hl, ProtectedItselfText + jp FarBattleTextBox +; 3762c + + +Function0x3762c: ; 3762c + ld de, $c679 + ld a, [hBattleTurn] + and a + jr z, .asm_37637 + + ld de, PlayerDamageTaken +.asm_37637 + call $6abf + jr nz, .asm_37665 + + ld a, $3 + call CleanGetBattleVarPair + bit 4, a + jr nz, .asm_37665 + + ld b, $ff + ld a, [de] + ld c, a +.asm_37649 + ld a, c + and a + jr z, .asm_37656 + + dec c + srl b + ld a, b + and a + jr nz, .asm_37649 + + jr .asm_37665 + +.asm_37656 + call FarBattleRNG + and a + jr z, .asm_37656 + + dec a + cp b + jr nc, .asm_37665 + + ld a, [de] + inc a + ld [de], a + and a + ret + +.asm_37665 + xor a + ld [de], a + call $7e77 + call $734e + scf + ret +; 3766f + + +BattleCommand5a: ; 3766f +; endure + + call Function0x3762c + ret c +; get substatus1 + ld a, BATTLE_VARS_SUBSTATUS1 + call GetBattleVarPair + set 5, [hl] ; endure + call $7e01 + ld hl, BracedItselfText + jp FarBattleTextBox +; 37683 + + +BattleCommand56: ; 37683 +; spikes + + ld hl, $c700 + ld a, [hBattleTurn] + and a + jr z, .asm_3768e ; 37689 $3 + ld hl, PlayerScreens +.asm_3768e + bit 0, [hl] + jr nz, .asm_3769d ; 37690 $b + set 0, [hl] + call $7e01 + ld hl, SpikesText + jp FarBattleTextBox +.asm_3769d + jp Function0x37354 +; 376a0 + + +BattleCommand57: ; 376a0 +; foresight + + ld a, [AttackMissed] + and a + jr nz, .asm_376bf ; 376a4 $19 + call CheckHiddenOpponent + jr nz, .asm_376bf ; 376a9 $14 + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call GetBattleVarPair + bit 3, [hl] + jr nz, .asm_376bf ; 376b2 $b + set 3, [hl] + call $7e01 + ld hl, IdentifiedText + jp FarBattleTextBox +.asm_376bf + jp Function0x37354 +; 376c2 + + +BattleCommand58: ; 376c2 +; perishsong + + ld hl, PlayerSubStatus1 + ld de, EnemySubStatus1 + bit 4, [hl] + jr z, .asm_376d1 ; 376ca $5 + ld a, [de] + bit 4, a + jr nz, .asm_376f2 ; 376cf $21 +.asm_376d1 + bit 4, [hl] + jr nz, .asm_376dc ; 376d3 $7 + set 4, [hl] + ld a, $4 + ld [PlayerPerishCount], a +.asm_376dc + ld a, [de] + bit 4, a + jr nz, .asm_376e9 ; 376df $8 + set 4, a + ld [de], a + ld a, $4 + ld [$c67f], a +.asm_376e9 + call $7e01 + ld hl, StartPerishText + jp FarBattleTextBox +.asm_376f2 + call $7e77 + jp $734e +; 376f8 + + +BattleCommand59: ; 376f8 +; startsandstorm + + ld a, [Weather] + cp WEATHER_SANDSTORM + jr z, .asm_37712 + ld a, WEATHER_SANDSTORM + ld [Weather], a + ld a, 5 + ld [WeatherCount], a + call $7e01 + ld hl, SandstormBrewedText + jp FarBattleTextBox +.asm_37712 + call $7e77 + jp $734e +; 37718 + + +BattleCommand5b: ; 37718 +; checkcurl + + ld de, $c672 + ld a, [hBattleTurn] + and a + jr z, .asm_37723 ; 3771e $3 + ld de, $c67a +.asm_37723 + ld a, BATTLE_VARS_SUBSTATUS1 + call CleanGetBattleVarPair + bit 6, a + jr z, .asm_37731 ; 3772a $5 + ld b, $4 + jp $7e8c +.asm_37731 + xor a + ld [de], a + ret +; 37734 + + +BattleCommand5c: ; 37734 +; rolloutpower + + ld a, BATTLE_VARS_STATUS + call CleanGetBattleVarPair + and $7 + ret nz + ld hl, $c672 + ld a, [hBattleTurn] + and a + jr z, .asm_37747 ; 37742 $3 + ld hl, $c67a +.asm_37747 + ld a, [hl] + and a + jr nz, .asm_37750 ; 37749 $5 + ld a, $1 + ld [$c73e], a +.asm_37750 + ld a, [AttackMissed] + and a + jr z, .asm_3775e ; 37754 $8 + ld a, BATTLE_VARS_SUBSTATUS1 + call GetBattleVarPair + res 6, [hl] + ret +.asm_3775e + inc [hl] + ld a, [hl] + ld b, a + cp $5 + jr c, .asm_3776e ; 37763 $9 + ld a, BATTLE_VARS_SUBSTATUS1 + call GetBattleVarPair + res 6, [hl] + jr .asm_37775 ; 3776c $7 +.asm_3776e + ld a, BATTLE_VARS_SUBSTATUS1 + call GetBattleVarPair + set 6, [hl] +.asm_37775 + ld a, BATTLE_VARS_SUBSTATUS2 + call CleanGetBattleVarPair + bit 0, a + jr z, .asm_3777f ; 3777c $1 + inc b +.asm_3777f + dec b + jr z, .asm_37790 ; 37780 $e + ld hl, CurDamage + 1 + sla [hl] + dec hl + rl [hl] + jr nc, .asm_3777f ; 3778a $f3 + ld a, $ff + ld [hli], a + ld [hl], a +.asm_37790 + ret +; 37791 + + +BattleCommand5d: ; 37791 +; unused + ret +; 37792 + + +BattleCommand5e: ; 37792 +; furycutter + + ld hl, $c678 + ld a, [hBattleTurn] + and a + jr z, .asm_3779d ; 37798 $3 + ld hl, $c680 +.asm_3779d + ld a, [AttackMissed] + and a + jp nz, Function0x377be + inc [hl] + ld a, [hl] + ld b, a + cp $6 + jr c, .asm_377ad ; 377a9 $2 + ld b, $5 +.asm_377ad + dec b + ret z + ld hl, CurDamage + 1 + sla [hl] + dec hl + rl [hl] + jr nc, .asm_377ad ; 377b7 $f4 + ld a, $ff + ld [hli], a + ld [hl], a + ret +; 377be + + +Function0x377be: ; 377be + push hl + + ld hl, $c678 + ld a, [hBattleTurn] + and a + jr z, .asm_377ca + ld hl, $c680 + +.asm_377ca + xor a + ld [hl], a + + pop hl + ret +; 377ce + + +BattleCommand5f: ; 377ce +; attract + ld a, [AttackMissed] + and a + jr nz, .asm_377f2 + call Function0x377f5 + jr c, .asm_377f2 + call CheckHiddenOpponent + jr nz, .asm_377f2 + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call GetBattleVarPair + bit 7, [hl] + jr nz, .asm_377f2 + + set 7, [hl] + call $7e01 + +; 'fell in love!' + ld hl, FellInLoveText + jp FarBattleTextBox + +.asm_377f2 + jp Function0x37354 +; 377f5 + + +Function0x377f5: ; 377f5 + ld a, 0 + call BattlePartyAttr + ld a, [hl] + ld [CurPartySpecies], a + + ld a, [CurBattleMon] + ld [CurPartyMon], a + xor a + ld [MonType], a + + ld a, $14 + ld hl, $4bdd + rst FarCall + jr c, .asm_37849 + + ld b, 1 + jr nz, .asm_37815 + dec b + +.asm_37815 + push bc + ld a, [TempEnemyMonSpecies] + ld [CurPartySpecies], a + ld hl, EnemyMonAtkDefDV + ld a, [EnemySubStatus5] + bit 3, a + jr z, .asm_37829 + ld hl, $c6f2 + +.asm_37829 + ld a, [hli] + ld [$d123], a + ld a, [hl] + ld [$d124], a + ld a, $3 + ld [MonType], a + ld a, $14 + ld hl, $4bdd + rst FarCall + pop bc + jr c, .asm_37849 + + ld a, 1 + jr nz, .asm_37844 + dec a + +.asm_37844 + xor b + jr z, .asm_37849 + + and a + ret + +.asm_37849 + scf + ret +; 3784b + + +BattleCommand60: ; 3784b +; checkhappiness + push bc + ld hl, BattleMonHappiness + ld a, [hBattleTurn] + and a + jr z, .asm_37857 ; 37852 $3 + ld hl, EnemyMonHappiness +.asm_37857 + xor a + ld [$ffb4], a + ld [$ffb5], a + ld a, [hl] + ld [$ffb6], a + ld a, $a + ld [$ffb7], a + call $3119 + ld a, $19 + ld [$ffb7], a + ld b, $4 + call $3124 + ld a, [$ffb6] + ld d, a + pop bc + ret +; 37874 + + +BattleCommand61: ; 37874 +; present + + ld a, [InLinkBattle] + cp $3 + jr z, .asm_3787d ; 37879 $2 + push bc + push de +.asm_3787d + call $46d2 + ld a, [InLinkBattle] + cp $3 + jr z, .asm_37889 ; 37885 $2 + pop de + pop bc +.asm_37889 + ld a, [$d265] + and a + jp z, $7e77 + ld a, [AttackMissed] + and a + jp nz, $7e77 + push bc + call FarBattleRNG + ld b, a + ld hl, .table_37907 + ld c, 0 +.asm_378a1 + ld a, [hli] + cp $ff + jr z, .asm_378b7 ; 378a4 $11 + cp b + jr nc, .asm_378ad ; 378a7 $4 + inc c + inc hl + jr .asm_378a1 ; 378ab $f4 +.asm_378ad + ld a, c + ld [$c689], a + call $7de9 + ld d, [hl] + pop bc + ret +.asm_378b7 + pop bc + ld a, $3 + ld [$c689], a + call $7e01 + call $4ffd + ld hl, $5246 + ld a, [hBattleTurn] + and a + jr z, .asm_378ce ; 378c9 $3 + ld hl, $5251 +.asm_378ce + ld a, $e + rst FarCall + jr c, .asm_378f3 ; 378d1 $20 + ld hl, $4c8e + call $7e73 + call $4ffd + ld hl, $4cef + call $7e73 + call $4ffd + ld hl, RegainedHealthText + call FarBattleTextBox + call $4ffd + call $398e + jr .asm_37904 ; 378f1 $11 +.asm_378f3 + call $4ffd + call $7ed5 + jr nc, .asm_37904 ; 378f9 $9 + call $7e77 + ld hl, RefusedGiftText + call FarBattleTextBox +.asm_37904 + jp EndMoveEffect + +.table_37907 + db $66, 40 + db $b3, 80 + db $cc, 120 + db $ff +; 3790e + + +BattleCommand63: ; 3790e +; checkfrustration + + push bc + ld hl, BattleMonHappiness + ld a, [hBattleTurn] + and a + jr z, .asm_3791a ; 37915 $3 + ld hl, EnemyMonHappiness +.asm_3791a + ld a, $ff + sub [hl] + ld [$ffb6], a + xor a + ld [$ffb4], a + ld [$ffb5], a + ld a, $a + ld [$ffb7], a + call $3119 + ld a, $19 + ld [$ffb7], a + ld b, $4 + call $3124 + ld a, [$ffb6] + ld d, a + pop bc + ret +; 37939 + + +BattleCommand64: ; 37939 +; safeguard + + ld hl, PlayerScreens + ld de, $c701 + ld a, [hBattleTurn] + and a + jr z, .asm_3794a ; 37942 $6 + ld hl, $c700 + ld de, $c705 +.asm_3794a + bit 2, [hl] + jr nz, .asm_3795c ; 3794c $e + set 2, [hl] + ld a, $5 + ld [de], a + call $7e01 + ld hl, CoveredByVeilText + jp FarBattleTextBox +.asm_3795c + call $7e77 + jp $734e +; 37962 + + +Function0x37962: ; 37962 + push hl + ld hl, $c700 + ld a, [hBattleTurn] + and a + jr z, .asm_3796e + ld hl, PlayerScreens + +.asm_3796e + bit 2, [hl] + pop hl + ret +; 37972 + + +BattleCommand65: ; 37972 + ld hl, $c700 + ld a, [hBattleTurn] + and a + jr z, .asm_3797d ; 37978 $3 + ld hl, PlayerScreens +.asm_3797d + bit 2, [hl] + ret z + ld a, $1 + ld [AttackMissed], a + call $7e80 + ld hl, SafeguardProtectText + call FarBattleTextBox + jp EndMoveEffect +; 37991 + + +BattleCommand66: ; 37991 +; getmagnitude + + push bc + call FarBattleRNG + ld b, a + ld hl, .Magnitudes +.asm_37999 + ld a, [hli] + cp b + jr nc, .asm_379a1 ; 3799b $4 + inc hl + inc hl + jr .asm_37999 ; 3799f $f8 +.asm_379a1 + ld d, [hl] + push de + inc hl + ld a, [hl] + ld [$d265], a + call $7e80 + ld hl, MagnitudeText + call FarBattleTextBox + pop de + pop bc + ret + +.Magnitudes + ; /255, BP, magnitude + db 13, 10, 4 + db 38, 30, 5 + db 89, 50, 6 + db 166, 70, 7 + db 217, 90, 8 + db 242, 110, 9 + db 255, 150, 10 +; 379c9 + + +BattleCommand67: ; 379c9 +; batonpass + + ld a, [hBattleTurn] + and a + jp nz, .Enemy + + call Function0x37ae9 + jp z, $7aab + + call $399c + call $7e01 + + ld c, 50 + call DelayFrames + + call $1d6e + + ld a, $f + ld hl, $52f7 + rst FarCall + + ld a, $f + ld hl, $5380 + rst FarCall + + call $3317 + + ld a, $f + ld hl, $6d9f + rst FarCall + + call $1c17 + call $300b + + ld hl, $c4a1 + ld bc, $040a + call ClearBox + + ld b, 1 + call $3340 + call $32f9 + call $7a67 + + ld a, $f + ld hl, $52e0 + rst FarCall + + jp c, EndMoveEffect + + ld hl, $6459 + call $7e73 + call $7ab1 + + ret + +.Enemy + ld a, [IsInBattle] + dec a + jp z, $7aab + + call $7af6 + jp z, $7aab + + call $39b0 + call $7e01 + call $7a82 + + ld a, $f + ld hl, $52e0 + rst FarCall + jp c, $52a3 + + xor a + ld [$c718], a + + ld hl, $5517 + call $7e73 + + ld hl, $557a + call $7e73 + + ld a, 1 + ld [$d265], a + + ld hl, $6cab + call $7e73 + + ld hl, $5c23 + call $7e73 + + jr Function0x37ab1 + + ld a, [InLinkBattle] + and a + ret z + + ld a, 1 + ld [$d0ec], a + + call $1d6e + + ld hl, $68e4 + call $7e73 + + call $1c17 + + xor a + ld [$d0ec], a + + ret +; 37a82 + + ld a, [InLinkBattle] + and a + ret z + + call $1d6e + ld hl, $68e4 + call $7e73 + ld a, [OTPartyCount] + add $4 + ld b, a + ld a, [$d430] + cp $4 + jr c, .asm_37aa0 + + cp b + jr c, .asm_37aa8 + +.asm_37aa0 + ld a, [CurOTMon] + add $4 + ld [$d430], a +.asm_37aa8 + jp $1c17 + call $7e77 + jp $734e + + +Function0x37ab1: ; 37ab1 + ld a, $a + call CleanGetBattleVarPair + and $7 + jr nz, .asm_37ac1 + ld a, $0 + call GetBattleVarPair + res 0, [hl] + +.asm_37ac1 + call $72e7 + ld hl, PlayerSubStatus1 + res 7, [hl] + ld hl, EnemySubStatus1 + res 7, [hl] + ld hl, PlayerSubStatus5 + ld a, $4 + call GetBattleVarPair + res 3, [hl] + res 4, [hl] + ld a, $13 + call GetBattleVarPair + ld [hl], $0 + xor a + ld [$c730], a + ld [$c731], a + ret +; 37ae9 + + +Function0x37ae9: ; 37ae9 + ld hl, PartyMon1CurHP + ld a, [PartyCount] + ld d, a + ld a, [CurBattleMon] + ld e, a + jr .asm_37b01 + + ld hl, OTPartyMon1CurHP + ld a, [OTPartyCount] + ld d, a + ld a, [CurOTMon] + ld e, a +.asm_37b01 + xor a + ld b, a + ld c, a +.asm_37b04 + ld a, c + cp d + jr z, .asm_37b1a + + cp e + jr z, .asm_37b11 + + ld a, [hli] + or b + ld b, a + ld a, [hld] + or b + ld b, a +.asm_37b11 + push bc + ld bc, $0030 + add hl, bc + pop bc + inc c + jr .asm_37b04 + +.asm_37b1a + ld a, b + and a + ret +; 37b1d + + +BattleCommand68: ; 37b1d + ld hl, $c711 + ld a, [hBattleTurn] + and a + jr z, .asm_37b28 ; 37b23 $3 + ld hl, $c710 +.asm_37b28 + ld a, [hl] + and a + ret z + ld hl, CurDamage + 1 + sla [hl] + dec hl + rl [hl] + ret nc + ld a, $ff + ld [hli], a + ld [hl], a + ret +; 37b39 + + +BattleCommand69: ; 37b39 +; clearhazards + + ld a, BATTLE_VARS_SUBSTATUS4 + call GetBattleVarPair + bit 7, [hl] + jr z, .asm_37b4a ; 37b40 $8 + res 7, [hl] + ld hl, ShedLeechSeedText + call FarBattleTextBox +.asm_37b4a + ld hl, PlayerScreens + ld de, $c730 + ld a, [hBattleTurn] + and a + jr z, .asm_37b5b ; 37b53 $6 + ld hl, $c700 + ld de, $c731 +.asm_37b5b + bit 0, [hl] + jr z, .asm_37b69 ; 37b5d $a + res 0, [hl] + ld hl, BlewSpikesText + push de + call FarBattleTextBox + pop de +.asm_37b69 + ld a, [de] + and a + ret z + xor a + ld [de], a + ld hl, ReleasedByText + jp FarBattleTextBox +; 37b74 + + +BattleCommand6a: ; 37b74 +; healmorn + ld b, MORN + jr BattleCommand6a6c +; 37b78 + +BattleCommand6b: ; 37b78 +; healday + ld b, DAY + jr BattleCommand6a6c +; 37b7c + +BattleCommand6c: ; 37b7c +; healnite + ld b, NITE + ; fallthrough +; 37b7e + +BattleCommand6a6c: ; 37b7e +; Time- and weather-sensitive heal. + + ld hl, BattleMonMaxHP + ld de, BattleMonHP + ld a, [hBattleTurn] + and a + jr z, .start + ld hl, EnemyMonMaxHP + ld de, EnemyMonHP + +.start +; Index for .Multipliers +; Default restores half max HP. + ld c, 2 + +; Don't bother healing if HP is already full. + push bc + call StringCmp + pop bc + jr z, .Full + +; Don't factor in time of day in link battles. + ld a, [InLinkBattle] + and a + jr nz, .Weather + + ld a, [TimeOfDay] + cp b + jr z, .Weather + dec c + +.Weather + ld a, [Weather] + and a + jr z, .Heal + +; x2 in sun +; /2 in rain/sandstorm + inc c + cp WEATHER_SUN + jr z, .Heal + dec c + dec c + +.Heal + ld b, 0 + ld hl, .Multipliers + add hl, bc + add hl, bc + + ld a, [hli] + ld h, [hl] + ld l, a + ld a, BANK(GetMaxHP) + rst FarCall + + call $7e01 + call $4ffd + + ld hl, $4cef + ld a, $f + rst FarCall ; callab 3ccef + + call $4ffd + call $3995 + +; 'regained health!' + ld hl, RegainedHealthText + jp FarBattleTextBox + +.Full + call $7e77 + +; 'hp is full!' + ld hl, HPIsFullText + jp FarBattleTextBox + +.Multipliers + dw GetEighthMaxHP + dw GetQuarterMaxHP + dw GetHalfMaxHP + dw GetMaxHP +; 37be8 + + +BattleCommand6d: ; 37be8 + ld a, [AttackMissed] + and a + ret nz + + ld a, $3e + ld hl, $7ced + rst FarCall ; callba 3e 7ced + ret +; 37bf4 + + +BattleCommand6e: ; 37bf4 +; startrain + ld a, WEATHER_RAIN + ld [Weather], a + ld a, 5 + ld [WeatherCount], a + call $7e01 + ld hl, DownpourText + jp FarBattleTextBox +; 37c07 + + +BattleCommand6f: ; 37c07 +; startsun + ld a, WEATHER_SUN + ld [Weather], a + ld a, 5 + ld [WeatherCount], a + call $7e01 + ld hl, SunGotBrightText + jp FarBattleTextBox +; 37c1a + + +BattleCommand95: ; 37c1a +; bellydrum + call $61c8 + ld a, [AttackMissed] + and a + jr nz, .asm_37c4f ; 37c21 $2c + ld hl, $4c9f + ld a, $f + rst FarCall + ld hl, $4cde + ld a, $f + rst FarCall + jr nc, .asm_37c4f ; 37c2f $1e + push bc + call $7e01 + pop bc + ld hl, $4c3f + ld a, $f + rst FarCall + call $3995 + ld a, $5 +.asm_37c41 + push af + call $61c8 + pop af + dec a + jr nz, .asm_37c41 ; 37c47 $f8 + ld hl, BellyDrumText + jp FarBattleTextBox +.asm_37c4f + call $7e77 + jp $734e +; 37c55 + + +BattleCommand96: ; 37c55 +; psychup + + ld hl, EnemyStatLevels + ld de, PlayerStatLevels + ld a, [hBattleTurn] + and a + jr z, .asm_37c64 ; 37c5e $4 + push hl + ld h, d + ld l, e + pop de +.asm_37c64 + push hl + ld b, $8 +.asm_37c67 + ld a, [hli] + cp $7 + jr nz, .asm_37c76 ; 37c6a $a + dec b + jr nz, .asm_37c67 ; 37c6d $f8 + pop hl + call $7e77 + jp $734e +.asm_37c76 + pop hl + ld b, $8 +.asm_37c79 + ld a, [hli] + ld [de], a + inc de + dec b + jr nz, .asm_37c79 ; 37c7d $fa + ld a, [hBattleTurn] + and a + jr nz, .asm_37c89 ; 37c82 $5 + call Function0x365d7 + jr .asm_37c8c ; 37c87 $3 +.asm_37c89 + call Function0x365fd +.asm_37c8c + call $7e01 + ld hl, CopiedStatsText + jp FarBattleTextBox +; 37c95 + + +BattleCommand9a: ; 37c95 +; mirrorcoat + + ld a, $1 + ld [AttackMissed], a + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + and a + ret z + ld b, a + ld hl, $45ec + ld a, $f + rst FarCall + ld a, b + cp $90 + ret z + call $4833 + ld a, [$d265] + and a + ret z + call Function0x36abf + ret z + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP + call CleanGetBattleVarPair + dec a + ld de, StringBuffer1 + call GetMoveData + ld a, [$d075] + and a + ret z + ld a, [$d076] + cp $14 + ret c + ld hl, CurDamage + ld a, [hli] + or [hl] + ret z + ld a, [hl] + add a + ld [hld], a + ld a, [hl] + adc a + ld [hl], a + jr nc, .asm_37ce1 ; 37cdb $4 + ld a, $ff + ld [hli], a + ld [hl], a +.asm_37ce1 + xor a + ld [AttackMissed], a + ret +; 37ce6 + + +BattleCommand9d: ; 37ce6 +; checkminimize + + ld hl, $c6fa + ld a, [hBattleTurn] + and a + jr z, .asm_37cf1 ; 37cec $3 + ld hl, $c6fe +.asm_37cf1 + ld a, [hl] + and a + ret z + ld hl, CurDamage + 1 + sla [hl] + dec hl + rl [hl] + ret nc + ld a, $ff + ld [hli], a + ld [hl], a + ret +; 37d02 + + +BattleCommand9e: ; 37d02 +; skipsuncharge + ld a, [Weather] + cp WEATHER_SUN + ret nz + ld b, $39 + jp $7e8c +; 37d0d + + +BattleCommand9b: ; 37d0d + ld hl, $c71d + ld de, $c727 + ld a, [hBattleTurn] + and a + jr z, .asm_37d1e ; 37d16 $6 + ld hl, $c71e + ld de, $c729 +.asm_37d1e + ld a, [hl] + and a + ret z + cp $1 + ret nz + ld [hl], $0 + ld a, [de] + inc de + ld [CurDamage], a + ld a, [de] + ld [CurDamage + 1], a + ld b, $9c + jp $7e8c +; 37d34 + +BattleCommand9c: ; 37d34 +; futuresight + + call Function0x34548 + jr nz, .asm_37d4b ; 37d37 $12 + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + ld b, a + ld a, BATTLE_VARS_LAST_COUNTER_MOVE + call GetBattleVarPair + ld [hl], b + ld a, BATTLE_VARS_LAST_MOVE + call GetBattleVarPair + ld [hl], b +.asm_37d4b + ld hl, $c71d + ld a, [hBattleTurn] + and a + jr z, .asm_37d56 ; 37d51 $3 + ld hl, $c71e +.asm_37d56 + ld a, [hl] + and a + jr nz, .asm_37d87 ; 37d58 $2d + ld a, $4 + ld [hl], a + call BattleCommand0a + call $7e80 + ld hl, ForesawAttackText + call FarBattleTextBox + call BattleCommand0c + ld de, $c727 + ld a, [hBattleTurn] + and a + jr z, .asm_37d77 ; 37d72 $3 + ld de, $c729 +.asm_37d77 + ld hl, CurDamage + ld a, [hl] + ld [de], a + ld [hl], $0 + inc hl + inc de + ld a, [hl] + ld [de], a + ld [hl], $0 + jp EndMoveEffect +.asm_37d87 + pop bc + call ResetDamage + call $7e77 + call $734e + jp EndMoveEffect +; 37d94 + + +BattleCommand9f: ; 37d94 +; thunderaccuracy + + ld a, BATTLE_VARS_MOVE_TYPE + call GetBattleVarPair + inc hl + ld a, [Weather] + cp WEATHER_RAIN + jr z, .asm_37da7 ; 37d9f $6 + cp WEATHER_SUN + ret nz + ld [hl], $80 + ret +.asm_37da7 + ld [hl], $ff + ret +; 37daa + + +CheckHiddenOpponent: ; 37daa + ld a, BATTLE_VARS_SUBSTATUS3_OPP + call CleanGetBattleVarPair + and $60 ; fly | dig + ret +; 37db2 + + +GetUserItem: ; 37db2 +; Return the effect of the user's item in bc, and its id at hl. + ld hl, BattleMonItem + ld a, [hBattleTurn] + and a + jr z, .go + ld hl, EnemyMonItem +.go + ld b, [hl] + jp GetItem +; 37dc1 + + +GetOpponentItem: ; 37dc1 +; Return the effect of the opponent's item in bc, and its id at hl. + ld hl, EnemyMonItem + ld a, [hBattleTurn] + and a + jr z, .go + ld hl, BattleMonItem +.go + ld b, [hl] + jp GetItem +; 37dd0 + + +GetItem: ; 37dd0 +; Return the effect of item b in bc. + ld a, b + and a + ret z + + push hl + ld hl, $67c3 ; Items + dec a + ld c, a + ld b, 0 + ld a, 7 + call AddNTimes + ld a, $1 ; BANK(Items) + call GetFarHalfword + ld b, l + ld c, h + pop hl + ret +; 37de9 + + +INCBIN "baserom.gbc", $37de9, $37e80 - $37de9 + + +BattleCommandaa: ; 37e80 +; wait +; Wait 40 frames. + ld c, 40 + jp DelayFrames +; 37e85 + + +BattleCommand38: ; 37e85 +; duped out +; Used in multi-hit moves. + ld hl, .text + jp BattleTextBox +.text + db "@" +; 37e8c + + +INCBIN "baserom.gbc", $37e8c, $37ead - $37e8c + + +GetMoveData: ; 37ead +; Get move struct a. + ld hl, Moves + ld bc, Move1 - Move0 + call AddNTimes + ld a, Bank(Moves) + jp FarCopyBytes +; 37ebb + +INCBIN "baserom.gbc", $37ebb, $37ee2 - $37ebb + + + diff --git a/main.asm b/main.asm index f9e181803..a327629cd 100644 --- a/main.asm +++ b/main.asm @@ -1126,14 +1126,34 @@ FarCopyBytesDouble: ; e9b ; 0xeba -INCBIN "baserom.gbc",$eba,$fc8 - $eba +INCBIN "baserom.gbc",$eba,$fb6 - $eba +ClearBox: ; fb6 +; Fill a c*b box at hl with blank tiles. + + ld a, " " +.y + push bc + push hl +.x + ld [hli], a + dec c + jr nz, .x + pop hl + ld bc, 20 ; screen width + add hl, bc + pop bc + dec b + jr nz, .y + ret +; fc8 + ClearTileMap: ; fc8 -; Fill the tile map with blank tiles +; Fill TileMap with blank tiles ld hl, TileMap - ld a, $7f ; blank tile - ld bc, 360 ; length of TileMap + ld a, " " + ld bc, 360 ; screen dimensions 20*18 call ByteFill ; We aren't done if the LCD is on @@ -3271,8 +3291,10 @@ GetNthString: ; 3411 ret ; 0x3420 + INCBIN "baserom.gbc",$3420,$3468 - $3420 + GetItemName: ; 3468 push hl push bc @@ -3291,9 +3313,30 @@ GetItemName: ; 3468 pop bc pop hl ret -; 0x3487 +; 3487 + + +INCBIN "baserom.gbc", $3487, $34f8 - $3487 + + +GetMoveName: ; 34f8 + push hl +; move name + ld a, $2 ; move names + ld [$cf61], a +; move id + ld a, [$d265] + ld [$cf60], a + + call GetName + ld de, StringBuffer1 + pop hl + ret +; 350c + + +INCBIN "baserom.gbc", $350c, $3856 - $350c -INCBIN "baserom.gbc",$3487,$3856 - $3487 GetBaseStats: ; 3856 push bc @@ -3483,7 +3526,26 @@ GetPartyLocation: ; 3927 jp AddNTimes ; 392d -INCBIN "baserom.gbc", $392d, $397d - $392d + +INCBIN "baserom.gbc", $392d, $395d - $392d + + +BattlePartyAttr: ; 395d +; Get attribute a from the active monster's party struct. + push bc + ld c, a + ld b, 0 + ld hl, PartyMons + add hl, bc + ld a, [CurBattleMon] + call GetPartyLocation + pop bc + ret +; 396d + + +INCBIN "baserom.gbc", $396d, $397d - $396d + ResetDamage: ; 397d xor a @@ -5666,7 +5728,15 @@ TrainerClassDVs ; 270d6 db $98, $88 ; mysticalman ; 2715c -INCBIN "baserom.gbc",$2715c,$27a2d - $2715c +INCBIN "baserom.gbc", $2715c, $271f4 - $2715c + +MoveEffectsPointers: ; 271f4 + +INCBIN "baserom.gbc", $271f4, $2732e - $271f4 + +MoveEffects: ; 2732e + +INCBIN "baserom.gbc", $2732e, $27a2d - $2732e SECTION "bankA",DATA,BANK[$A] @@ -6006,13 +6076,7 @@ INCBIN "baserom.gbc",$329ed,$333f0 - $329ed SECTION "bankD",DATA,BANK[$D] -INCBIN "baserom.gbc",$34000,$34bb1 - $34000 - -TypeMatchup: ; 34bb1 -INCLUDE "battle/type_matchup.asm" -; 34cfd - -INCBIN "baserom.gbc",$34cfd,$37ee2 - $34cfd +INCLUDE "battle/effect_commands.asm" SECTION "bankE",DATA,BANK[$E] @@ -6027,7 +6091,91 @@ INCLUDE "trainers/trainers.asm" SECTION "bankF",DATA,BANK[$F] -INCBIN "baserom.gbc",$3C000,$3d123 - $3C000 +INCBIN "baserom.gbc", $3c000, $3cc83 - $3c000 + +GetEighthMaxHP: ; 3cc83 +; output: bc + call GetQuarterMaxHP +; assumes nothing can have 1024 or more hp +; halve result + srl c +; round up + ld a, c + and a + jr nz, .end + inc c +.end + ret +; 3cc8e + + +GetQuarterMaxHP: ; 3cc8e +; output: bc + call GetMaxHP + +; quarter result + srl b + rr c + srl b + rr c + +; assumes nothing can have 1024 or more hp +; round up + ld a, c + and a + jr nz, .end + inc c +.end + ret +; 3cc9f + + +GetHalfMaxHP: ; 3cc9f +; output: bc + call GetMaxHP + +; halve reslut + srl b + rr c + +; floor = 1 + ld a, c + or b + jr nz, .end + inc c +.end + ret +; 3ccac + + +GetMaxHP: ; 3ccac +; output: bc, $d1ea-b + +; player + ld hl, BattleMonMaxHP + +; whose turn? + ld a, [hBattleTurn] + and a + jr z, .gethp + +; enemy + ld hl, EnemyMonMaxHP + +.gethp + ld a, [hli] + ld [$d1eb], a + ld b, a + + ld a, [hl] + ld [$d1ea], a + ld c, a + ret +; 3ccc2 + + +INCBIN "baserom.gbc", $3ccc2, $3d123 - $3ccc2 + ; These functions check if the current opponent is a gym leader or one of a ; few other special trainers. @@ -6894,7 +7042,14 @@ BattleStartMessage: ret ; 0x3fd26 -INCBIN "baserom.gbc",$3fd26,$3fe86 - $3fd26 + + dw $0000 ; padding + + +BattleCommandPointers: ; 3fd28 + +INCLUDE "battle/effect_command_pointers.asm" + SECTION "bank10",DATA,BANK[$10] @@ -14626,7 +14781,366 @@ INCBIN "baserom.gbc",$105688,$105930 - $105688 ; japanese mystery gift gfx INCBIN "gfx/misc/mystery_gift_jp.2bpp" -INCBIN "baserom.gbc",$105db0,$105ef6 - $105db0 + +DisplayUsedMoveText: ; 105db0 +; battle command 03 + ld hl, UsedMoveText + call BattleTextBox + jp WaitBGMap +; 105db9 + + +UsedMoveText: ; 105db9 + +; this is a stream of text and asm from 105db9 to 105ef6 + +; print actor name + text_jump _ActorNameText, BANK(_ActorNameText) + start_asm + +; ???? + ld a, [hBattleTurn] + and a + jr nz, .start + +; append used move list + ld a, [PlayerMoveAnimation] + call UpdateUsedMoves + +.start +; get address for last move + ld a, $13 ; last move + call GetBattleVarPair + ld d, h + ld e, l + +; get address for last counter move + ld a, $11 + call GetBattleVarPair + +; get move animation (id) + ld a, $c ; move animation + call CleanGetBattleVarPair + ld [$d265], a + +; check actor ???? + push hl + callba Function0x34548 + pop hl + jr nz, .grammar + +; update last move + ld a, [$d265] + ld [hl], a + ld [de], a + +.grammar + call GetMoveGrammar +; $d265 now contains MoveGrammar + + +; everything except 'instead' made redundant in localization + +; check obedience + ld a, [$c6f4] + and a + ld hl, UsedMove2Text + ret nz + +; check move grammar + ld a, [$d265] + cp $3 + ld hl, UsedMove2Text + ret c + ld hl, UsedMove1Text + ret +; 105e04 + +UsedMove1Text: ; 105e04 + text_jump _UsedMove1Text, BANK(_UsedMove1Text) + start_asm + jr Function105e10 +; 105e0b + +UsedMove2Text: ; 105e0b + text_jump _UsedMove2Text, BANK(_UsedMove2Text) + start_asm +; 105e10 + +Function105e10: ; 105e10 +; check obedience + ld a, [$c6f4] + and a + jr z, GetMoveNameText +; print "instead," + ld hl, UsedInsteadText + ret +; 105e1a + +UsedInsteadText: ; 105e1a + text_jump _UsedInsteadText, BANK(_UsedInsteadText) + start_asm +; 105e1f + +GetMoveNameText: ; 105e1f + ld hl, MoveNameText + ret +; 105e23 + +MoveNameText: ; 105e23 + text_jump _MoveNameText, BANK(_MoveNameText) + start_asm +; 105e28 + +GetUsedMoveTextEnder: ; 105e28 +; get start address + ld hl, .endusedmovetexts + +; get move id + ld a, [$d265] + +; 2-byte pointer + add a + +; seek + push bc + ld b, $0 + ld c, a + add hl, bc + pop bc + +; get pointer to usedmovetext ender + ld a, [hli] + ld h, [hl] + ld l, a + ret +; 105e39 + +.endusedmovetexts ; 105e39 + dw EndUsedMove1Text + dw EndUsedMove2Text + dw EndUsedMove3Text + dw EndUsedMove4Text + dw EndUsedMove5Text +; 105e43 + +EndUsedMove1Text: ; 105e43 + text_jump _EndUsedMove1Text, BANK(_EndUsedMove1Text) + db "@" +; 105e48 +EndUsedMove2Text: ; 105e48 + text_jump _EndUsedMove2Text, BANK(_EndUsedMove2Text) + db "@" +; 105e4d +EndUsedMove3Text: ; 105e4d + text_jump _EndUsedMove3Text, BANK(_EndUsedMove3Text) + db "@" +; 105e52 +EndUsedMove4Text: ; 105e52 + text_jump _EndUsedMove4Text, BANK(_EndUsedMove4Text) + db "@" +; 105e57 +EndUsedMove5Text: ; 105e57 + text_jump _EndUsedMove5Text, BANK(_EndUsedMove5Text) + db "@" +; 105e5c + + +GetMoveGrammar: ; 105e5c +; store move grammar type in $d265 + + push bc +; c = move id + ld a, [$d265] + ld c, a + ld b, $0 + +; read grammar table + ld hl, MoveGrammar +.loop + ld a, [hli] +; end of table? + cp $ff + jr z, .end +; match? + cp c + jr z, .end +; advance grammar type at $00 + and a + jr nz, .loop +; next grammar type + inc b + jr .loop + +.end +; $d265 now contains move grammar + ld a, b + ld [$d265], a + +; we're done + pop bc + ret +; 105e7a + +MoveGrammar: ; 105e7a +; made redundant in localization +; each move is given an identifier for what usedmovetext to use (0-4): + +; 0 + db SWORDS_DANCE + db GROWTH + db STRENGTH + db HARDEN + db MINIMIZE + db SMOKESCREEN + db WITHDRAW + db DEFENSE_CURL + db EGG_BOMB + db SMOG + db BONE_CLUB + db FLASH + db SPLASH + db ACID_ARMOR + db BONEMERANG + db REST + db SHARPEN + db SUBSTITUTE + db MIND_READER + db SNORE + db PROTECT + db SPIKES + db ENDURE + db ROLLOUT + db SWAGGER + db SLEEP_TALK + db HIDDEN_POWER + db PSYCH_UP + db EXTREMESPEED + db 0 ; end set + +; 1 + db RECOVER + db TELEPORT + db BIDE + db SELFDESTRUCT + db AMNESIA + db FLAIL + db 0 ; end set + +; 2 + db MEDITATE + db AGILITY + db MIMIC + db DOUBLE_TEAM + db BARRAGE + db TRANSFORM + db STRUGGLE + db SCARY_FACE + db 0 ; end set + +; 3 + db POUND + db SCRATCH + db VICEGRIP + db WING_ATTACK + db FLY + db BIND + db SLAM + db HORN_ATTACK + db WRAP + db THRASH + db TAIL_WHIP + db LEER + db BITE + db GROWL + db ROAR + db SING + db PECK + db ABSORB + db STRING_SHOT + db EARTHQUAKE + db FISSURE + db DIG + db TOXIC + db SCREECH + db METRONOME + db LICK + db CLAMP + db CONSTRICT + db POISON_GAS + db BUBBLE + db SLASH + db SPIDER_WEB + db NIGHTMARE + db CURSE + db FORESIGHT + db CHARM + db ATTRACT + db ROCK_SMASH + db 0 ; end set + +; all other moves = 4 + db $ff ; end +; 105ed0 + + +UpdateUsedMoves: ; 105ed0 +; append move a to PlayerUsedMoves unless it has already been used + + push bc +; start of list + ld hl, PlayerUsedMoves +; get move id + ld b, a +; loop count + ld c, NUM_MOVES + +.loop +; get move from the list + ld a, [hli] +; not used yet? + and a + jr z, .add +; already used? + cp b + jr z, .quit +; next byte + dec c + jr nz, .loop + +; if the list is full and the move hasn't already been used +; shift the list back one byte, deleting the first move used +; this can occur with struggle or a new learned move + ld hl, PlayerUsedMoves + 1 +; 1 = 2 + ld a, [hld] + ld [hli], a +; 2 = 3 + inc hl + ld a, [hld] + ld [hli], a +; 3 = 4 + inc hl + ld a, [hld] + ld [hl], a +; 4 = new move + ld a, b + ld [PlayerUsedMoves + 3], a + jr .quit + +.add +; go back to the byte we just inced from + dec hl +; add the new move + ld [hl], b + +.quit +; list updated + pop bc + ret +; 105ef6 + + HallOfFame2: ; 0x105ef6 ret diff --git a/wram.asm b/wram.asm index 2966b480c..104c8b5a1 100644 --- a/wram.asm +++ b/wram.asm @@ -604,7 +604,7 @@ PlayerDamageTaken: ; c682 EnemyDamageTaken: ; c684 ds 2 - ds 4 + ds 5 BattleScriptBuffer: ; c68a ds 40 @@ -612,7 +612,7 @@ BattleScriptBuffer: ; c68a BattleScriptBufferLoc: ; c6b2 ds 2 - ds 25 + ds 24 PlayerStatLevels: ; c6cc ; 07 neutral From d2f6b6febe31fe2c111243d97de029dd55e4a839 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 27 Mar 2013 01:52:04 -0400 Subject: [PATCH 015/112] Identify more move effect commands --- battle/effect_commands.asm | 487 ++++++++++++++++++++++++++----------- main.asm | 2 +- wram.asm | 10 +- 3 files changed, 348 insertions(+), 151 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 69d2f9084..b3106280f 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -395,9 +395,9 @@ CantMove: ; 341f0 Function0x34216: ; 34216 - call $4ffd + call SwitchTurn call CantMove - jp $4ffd + jp SwitchTurn ; 3421f @@ -1336,6 +1336,8 @@ BattleCommand05: ; 34631 BattleCommand4e: ; 346b2 +; triplekick + ld a, [$c689] ld b, a inc b @@ -1353,7 +1355,9 @@ BattleCommand4e: ; 346b2 ld a, [hl] adc d ld [hli], a - jr nc, .asm_346be ; 346c6 $f6 + +; No overflow. + jr nc, .asm_346be ld a, $ff ld [hld], a ld [hl], a @@ -1362,6 +1366,8 @@ BattleCommand4e: ; 346b2 BattleCommand4f: ; 346cd +; kickcounter + ld hl, $c689 inc [hl] ret @@ -1369,6 +1375,7 @@ BattleCommand4f: ; 346cd BattleCommand07: ; 346d2 +; stab ld a, BATTLE_VARS_MOVE_ANIM call CleanGetBattleVarPair cp STRUGGLE @@ -2634,23 +2641,28 @@ BattleCommand09: ; 34d32 BattleCommand90: ; 34ecc +; effectchance + xor a ld [$c70d], a call CheckSubstituteOpp - jr nz, .asm_34ee7 ; 34ed3 $12 + jr nz, .failed + push hl ld hl, PlayerMoveEffectChance ld a, [hBattleTurn] and a - jr z, .asm_34ee1 ; 34edc $3 + jr z, .asm_34ee1 ld hl, EnemyMoveEffectChance .asm_34ee1 + call FarBattleRNG cp [hl] pop hl ret c -.asm_34ee7 - ld a, $1 + +.failed + ld a, 1 ld [$c70d], a and a ret @@ -2658,6 +2670,7 @@ BattleCommand90: ; 34ecc BattleCommand0a: ; 34eee + ld a, BATTLE_VARS_SUBSTATUS4 call CleanGetBattleVarPair bit 4, a @@ -2838,9 +2851,12 @@ BattleCommand91_92: ; 34feb ; 34ffd +SwitchTurn: ; 34ffd BattleCommand93: ; 34ffd +; switchturn + ld a, [hBattleTurn] - xor $1 + xor 1 ld [hBattleTurn], a ret ; 35004 @@ -2851,8 +2867,10 @@ BattleCommand0c: ; 35004 call CleanGetBattleVarPair bit 4, a ret z + call $7ed5 jp c, BattleCommanda6 + xor a ld [$cfca], a ld [FXAnimIDHi], a @@ -2864,28 +2882,35 @@ BattleCommand0c: ; 35004 BattleCommand0d: ; 35023 + ld a, [AttackMissed] and a ret z + call $50e4 ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVarPair - cp $13 + + cp FLY jr z, .asm_3504f ; 35032 $1b - cp $5b + cp DIG jr z, .asm_3504f ; 35036 $17 + inc hl ld a, [hl] - cp $1d - jr z, .asm_35049 ; 3503c $b - cp $2c - jr z, .asm_35049 ; 35040 $7 - cp $4d - jr z, .asm_35049 ; 35044 $3 + + cp HEADBUTT + jr z, .asm_35049 + cp BITE + jr z, .asm_35049 + cp POISONPOWDER + jr z, .asm_35049 jp EndMoveEffect + .asm_35049 call BattleCommand0c jp EndMoveEffect + .asm_3504f ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair @@ -3098,12 +3123,12 @@ BattleCommand0f: ; 35175 BattleCommandae: ; 35197 -; player +; startloop + ld hl, $c672 ld a, [hBattleTurn] and a jr z, .asm_351a2 -; enemy ld hl, $c67a .asm_351a2 @@ -3114,6 +3139,8 @@ BattleCommandae: ; 35197 BattleCommandad: ; 351a5 +; supereffectivelooptext + ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair bit 2, a @@ -3124,6 +3151,8 @@ BattleCommandad: ; 351a5 BattleCommand10: ; 351ad +; supereffectivetext + ld a, [TypeModifier] and $7f cp 10 ; 1.0 @@ -3137,19 +3166,26 @@ BattleCommand10: ; 351ad BattleCommand11: ; 351c0 +; checkdestinybond + +; Faint the user if it fainted an opponent using Destiny Bond. + ld hl, EnemyMonHPHi ld a, [hBattleTurn] and a jr z, .asm_351cb ld hl, BattleMonHP .asm_351cb + ld a, [hli] or [hl] ret nz + ld a, BATTLE_VARS_SUBSTATUS5_OPP call CleanGetBattleVarPair bit 6, a - jr z, .asm_35231 ; 351d5 $5a + jr z, .asm_35231 + ld hl, $50da call FarBattleTextBox ld a, [hBattleTurn] @@ -3182,7 +3218,8 @@ BattleCommand11: ; 351c0 ld a, $b call $2d83 call $39c9 - call $4ffd + + call SwitchTurn xor a ld [$cfca], a ld [FXAnimIDHi], a @@ -3190,38 +3227,46 @@ BattleCommand11: ; 351c0 ld [$c689], a ld a, $c2 call $7e44 - call $4ffd + call SwitchTurn + jr .asm_3524d ; 3522f $1c + .asm_35231 ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $1d - jr z, .asm_3524a ; 35238 $10 - cp $2c - jr z, .asm_3524a ; 3523c $c - cp $4d - jr z, .asm_3524a ; 35240 $8 - cp $68 - jr z, .asm_3524a ; 35244 $4 - cp $9a - jr nz, .asm_3524d ; 35248 $3 + cp $1d ; multi-hit + jr z, .asm_3524a + cp $2c ; double-hit + jr z, .asm_3524a + cp $4d ; twineedle + jr z, .asm_3524a + cp $68 ; triple kick + jr z, .asm_3524a + cp $9a ; beat up + jr nz, .asm_3524d + .asm_3524a call BattleCommand0c + .asm_3524d jp EndMoveEffect ; 35250 BattleCommand12: ; 35250 +; buildopponentrage + jp .start .start ld a, [AttackMissed] and a ret nz - ld a, $8 + + ld a, BATTLE_VARS_SUBSTATUS4_OPP call CleanGetBattleVarPair bit 6, a ret z + ld de, $c72c ld a, [hBattleTurn] and a @@ -3232,14 +3277,17 @@ BattleCommand12: ; 35250 inc a ret z ld [de], a - call $4ffd + + call SwitchTurn ld hl, $50f3 call FarBattleTextBox - jp $4ffd + jp SwitchTurn ; 3527b BattleCommanda2: ; 3527b +; ragedamage + ld a, [CurDamage] ld h, a ld b, a @@ -3811,7 +3859,7 @@ BattleCommanda1: ; 35461 .asm_355b0 ld b, $12 - jp $7e8c + jp SkipToBattleCommand ; 355b5 @@ -3843,6 +3891,7 @@ Function0x355bd: ; 355bd BattleCommanda9: ; 355d5 +; clearmissdamage ld a, [AttackMissed] and a ret z @@ -3889,6 +3938,8 @@ Function0x355dd: ; 355dd BattleCommand62: ; 35612 +; itemmultiplier + ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair cp $7 @@ -4075,6 +4126,7 @@ TypeBoostItems: ; 35703 BattleCommand3f: ; 35726 +; constantdamage ld hl, BattleMonLevel ld a, [hBattleTurn] @@ -4085,20 +4137,20 @@ BattleCommand3f: ; 35726 .asm_35731 ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $57 + cp $57 ; by level (seismic toss, night shade) ld b, [hl] ld a, 0 jr z, .asm_3578c ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $58 + cp $58 ; variable (psywave) jr z, .asm_35758 - cp $28 + cp $28 ; half hp (super fang) jr z, .asm_3576b - cp $63 + cp $63 ; by hp (flail, reversal) jr z, .asm_35792 ld a, BATTLE_VARS_MOVE_POWER @@ -4239,6 +4291,8 @@ BattleCommand3f: ; 35726 BattleCommand40: ; 35813 +; counter + ld a, $1 ld [AttackMissed], a ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP @@ -4291,6 +4345,8 @@ BattleCommand40: ; 35813 BattleCommand41: ; 35864 +; encore + ld hl, EnemyMonMoves ld de, EnemyPerishCount ld a, [hBattleTurn] @@ -4404,6 +4460,8 @@ BattleCommand41: ; 35864 BattleCommand42: ; 35926 +; painsplit + ld a, [AttackMissed] and a jp nz, .asm_359cd @@ -4499,6 +4557,7 @@ BattleCommand42: ; 35926 BattleCommand43: ; 359d0 +; snore ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair and $7 @@ -4512,6 +4571,8 @@ BattleCommand43: ; 359d0 BattleCommand44: ; 359e6 +; conversion2 + ld a, [AttackMissed] and a jr nz, .asm_35a50 ; 359ea $64 @@ -4534,7 +4595,8 @@ BattleCommand44: ; 359e6 cp $13 jr z, .asm_35a50 ; 35a0b $43 call $7e01 - call $4ffd + + call SwitchTurn .asm_35a13 call FarBattleRNG and $1f @@ -4562,7 +4624,8 @@ BattleCommand44: ; 359e6 ld a, [$d265] cp $a jr nc, .asm_35a13 ; 35a3c $d5 - call $4ffd + call SwitchTurn + ld a, [hl] ld [$d265], a ld a, $29 @@ -4575,6 +4638,8 @@ BattleCommand44: ; 359e6 BattleCommand45: ; 35a53 +; lockon + call CheckSubstituteOpp jr nz, .asm_35a6e ; 35a56 $16 ld a, [AttackMissed] @@ -4593,6 +4658,8 @@ BattleCommand45: ; 35a53 BattleCommand46: ; 35a74 +; sketch + call Function0x372d8 ld a, [InLinkBattle] and a @@ -4692,18 +4759,28 @@ BattleCommand46: ; 35a74 BattleCommand47: ; 35b16 +; defrostopponent + +; If the opponent isn't frozen, raise Attack one stage. +; If the opponent is frozen, thaw them and raise Accuracy two stages. + call $7e01 + ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarPair - call Function0x360dd + call Defrost + +; Sharply raise accuracy ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarPair ld a, [hl] push hl push af - ld a, $a + + ld a, $a ; meditate, sharpen ld [hl], a call BattleCommand1c + pop af pop hl ld [hl], a @@ -4712,6 +4789,8 @@ BattleCommand47: ; 35b16 BattleCommand48: ; 35b33 +; sleeptalk + call Function0x372d8 ld a, [AttackMissed] and a @@ -4787,7 +4866,7 @@ BattleCommand48: ; 35b33 ret .asm_35bb3 - ld a, [$ffe4] + ld a, [hBattleTurn] and a ld a, [DisabledMove] jr z, .asm_35bbe @@ -4807,7 +4886,6 @@ BattleCommand48: ; 35b33 cp c jr z, .asm_35bd7 - cp b jr z, .asm_35bd7 @@ -4844,25 +4922,22 @@ BattleCommand48: ; 35b33 cp $91 ret z - cp $27 ret z - cp $4b ret z - cp $97 ret z - cp $9b ret z - cp $1a ret ; 35bff BattleCommand49: ; 35bff +; destinybond + ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarPair set 6, [hl] @@ -4873,6 +4948,8 @@ BattleCommand49: ; 35bff BattleCommand4a: ; 35c0f +; spite + ld a, [AttackMissed] and a jp nz, $5c91 @@ -4958,6 +5035,8 @@ BattleCommand4a: ; 35c0f BattleCommand4b: ; 35c94 +; falseswipe + ld hl, EnemyMonHPHi ld a, [hBattleTurn] and a @@ -5000,6 +5079,8 @@ BattleCommand4b: ; 35c94 BattleCommand4c: ; 35cc9 +; healbell + ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarPair res 0, [hl] @@ -5182,7 +5263,7 @@ Function0x35de0: ; 35de0 ld hl, $53ad call FarBattleTextBox ld de, $c6e0 - ld a, [$ffe4] + ld a, [hBattleTurn] and a jr z, .asm_35df1 @@ -5204,29 +5285,28 @@ Function0x35de0: ; 35de0 ld a, $8 call GetBattleVarPair res 4, [hl] + ld hl, $53d0 call FarBattleTextBox - call $4ffd + + call SwitchTurn call $65c3 ld a, $2 call CleanGetBattleVarPair and $60 call z, $7ec7 - call $4ffd - ld a, $d + call SwitchTurn + + ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarPair cp $1d jr z, .asm_35e3a - cp $2c jr z, .asm_35e3a - cp $4d jr z, .asm_35e3a - cp $68 jr z, .asm_35e3a - cp $9a jr z, .asm_35e3a @@ -5260,6 +5340,7 @@ UpdateMoveData: ; 35e40 BattleCommand14: ; 35e5c ; sleeptarget + call GetOpponentItem ld a, b cp $17 @@ -5352,6 +5433,8 @@ Function0x35ece: ; 35ece BattleCommand13: ; 35eee +; poisontarget + call CheckSubstituteOpp ret nz ld a, BATTLE_VARS_STATUS_OPP @@ -5386,6 +5469,8 @@ BattleCommand13: ; 35eee BattleCommand2f: ; 35f2c +; poison + ld hl, $5071 ld a, [TypeModifier] and $7f @@ -5606,6 +5691,8 @@ Function0x36011: ; 36011 BattleCommand17: ; 3608c +; burntarget + xor a ld [$cfca], a call CheckSubstituteOpp @@ -5613,7 +5700,7 @@ BattleCommand17: ; 3608c ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarPair and a - jp nz, Function0x360dd + jp nz, Defrost ld a, [TypeModifier] and $7f ret z @@ -5646,20 +5733,23 @@ BattleCommand17: ; 3608c ; 360dd -Function0x360dd: ; 360dd +Defrost: ; 360dd ld a, [hl] and $20 ret z + xor a ld [hl], a + ld a, [hBattleTurn] and a ld a, [CurOTMon] ld hl, OTPartyMon1Status - jr z, .asm_360f4 ; 0x360ec $6 + jr z, .ok ld hl, PartyMon1Status ld a, [CurBattleMon] -.asm_360f4 +.ok + call GetPartyLocation xor a ld [hl], a @@ -5670,6 +5760,8 @@ Function0x360dd: ; 360dd BattleCommand18: ; 36102 +; freezetarget + xor a ld [$cfca], a call CheckSubstituteOpp @@ -5722,6 +5814,8 @@ BattleCommand18: ; 36102 BattleCommand19: ; 36165 +; paralyzetarget + xor a ld [$cfca], a call CheckSubstituteOpp @@ -6193,35 +6287,43 @@ BattleCommand8d: ; 363e9 Function0x3641a: ; 3641a +; selfdestruct + push bc sla c - ld b, $0 + ld b, 0 add hl, bc ld a, c add e ld e, a - jr nc, .asm_36426 ; 0x36423 $1 + jr nc, .asm_36426 inc d .asm_36426 + pop bc ld a, [hld] - sub $1 - jr nz, .asm_3642f ; 0x3642a $3 + sub 1 + jr nz, .asm_3642f ld a, [hl] and a ret z + .asm_3642f ld a, [hBattleTurn] and a - jr z, .asm_3643f ; 0x36432 $b - call $4ffd + jr z, .asm_3643f + + call SwitchTurn call Function0x365d7 - call $4ffd - jr .asm_36448 ; 0x3643d $9 + call SwitchTurn + + jr .asm_36448 + .asm_3643f - call $4ffd + call SwitchTurn call Function0x365fd - call $4ffd + call SwitchTurn + .asm_36448 ld a, $1 and a @@ -6230,7 +6332,7 @@ Function0x3641a: ; 3641a BattleCommand8e: ; 3644c -; applystatuser +; statupfailtext ld a, [$c70e] and a ret z @@ -6250,7 +6352,7 @@ BattleCommand8e: ; 3644c BattleCommand8f: ; 3646a -; applystattarget +; statdownfailtext ld a, [$c70e] and a ret z @@ -6260,7 +6362,7 @@ BattleCommand8f: ; 3646a dec a jp z, $7349 dec a - ld hl, $5321 + ld hl, ProtectedByMistText jp z, FarBattleTextBox ld a, [$c70c] and $f @@ -6425,16 +6527,15 @@ Function0x36532: ; 36532 BattleCommandac: ; 3658f -; +; tristatuschance + call $4ecc -; get bit 4-5 -; ensure result is nonzero -; (this makes the chance of each result 1/3) +; 1/3 chance of each status .loop call FarBattleRNG swap a - and %11 + and 3 jr z, .loop ; jump dec a @@ -6442,13 +6543,14 @@ BattleCommandac: ; 3658f rst $28 ret .ptrs - dw $6165 - dw $6102 - dw $608c + dw BattleCommand19 ; paralyze + dw BattleCommand18 ; freeze + dw BattleCommand17 ; burn ; 365a7 BattleCommandaf: ; 365a7 +; curl ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVarPair set 0, [hl] @@ -6495,7 +6597,7 @@ Function0x365d7: ; 365d7 ld hl, $6d45 call $7e73 - call $4ffd + call SwitchTurn ld hl, $6c39 call $7e73 @@ -6503,7 +6605,7 @@ Function0x365d7: ; 365d7 ld hl, $6c76 call $7e73 - jp $4ffd + jp SwitchTurn ; 365fd @@ -6515,7 +6617,7 @@ Function0x365fd: ; 365fd ld a, $5 call Function0x3661d - call $4ffd + call SwitchTurn ld hl, $6c39 call $7e73 @@ -6523,7 +6625,7 @@ Function0x365fd: ; 365fd ld hl, $6c76 call $7e73 - jp $4ffd + jp SwitchTurn ; 3661d @@ -6595,6 +6697,8 @@ Function0x3661d: ; 3661d BattleCommand21: ; 36671 +; storeenergy + ld a, BATTLE_VARS_SUBSTATUS3 call CleanGetBattleVarPair bit 0, a @@ -6649,8 +6753,10 @@ BattleCommand21: ; 36671 call GetBattleVarPair ld a, $75 ld [hl], a - ld b, $22 - jp $7e8c + + ld b, $22 ; unleashenergy + jp SkipToBattleCommand + .asm_366dc ld hl, $4e6e call FarBattleTextBox @@ -6659,6 +6765,8 @@ BattleCommand21: ; 36671 BattleCommand22: ; 366e5 +; unleashenergy + ld de, $c682 ld bc, $c672 ld a, [hBattleTurn] @@ -6689,6 +6797,8 @@ BattleCommand22: ; 366e5 BattleCommand3e: ; 3671a +; checkrampage + ld de, $c672 ld a, [hBattleTurn] and a @@ -6704,10 +6814,10 @@ BattleCommand3e: ; 3671a ld [de], a jr nz, .asm_3674c ; 36730 $1a res 1, [hl] - call $4ffd + call SwitchTurn call Function0x37962 push af - call $4ffd + call SwitchTurn pop af jr nz, .asm_3674c ; 3673f $b set 7, [hl] @@ -6718,16 +6828,20 @@ BattleCommand3e: ; 3671a inc de ld [de], a .asm_3674c - ld b, $3d - jp $7e8c + ld b, $3d ; rampage + jp SkipToBattleCommand ; 36751 BattleCommand3d: ; 36751 +; rampage + +; No rampage during Sleep Talk. ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair - and $7 + and 7 ret nz + ld de, $c672 ld a, [hBattleTurn] and a @@ -6748,7 +6862,8 @@ BattleCommand3d: ; 36751 BattleCommanda0: ; 36778 -; run +; teleport + ld a, [BattleType] cp $7 ; BATTLE_SHINY jr z, .asm_367b9 @@ -6837,6 +6952,8 @@ Function0x36804: ; 36804 BattleCommand23: ; 3680f +; forceswitch + ld a, [BattleType] cp $7 jp z, $6969 @@ -7079,14 +7196,19 @@ Function0x36994: ; 36994 BattleCommand24: ; 369b6 +; endloop + +; Loop back to the command before 'critical'. + ld de, $c672 ld bc, $c682 ld a, [hBattleTurn] and a - jr z, .asm_369c7 ; 369bf $6 + jr z, .asm_369c7 ld de, $c67a ld bc, $c684 .asm_369c7 + ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair bit 2, [hl] @@ -7095,15 +7217,15 @@ BattleCommand24: ; 369b6 ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarPair ld a, [hl] - cp $4d + cp $4d ; twineedle jr z, .asm_36a3f ; 369db $62 - cp $2c + cp $2c ; multi-hit ld a, $1 jr z, .asm_36a3a ; 369e1 $57 ld a, [hl] - cp $9a + cp $9a ; beat up jr z, .asm_369fb ; 369e6 $13 - cp $68 + cp $68 ; triple kick jr nz, .asm_36a2b ; 369ea $3f .asm_369ec call FarBattleRNG @@ -7171,7 +7293,7 @@ BattleCommand24: ; 369b6 push bc ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $9a + cp $9a ; beat up jr z, .asm_36a67 ; 36a62 $3 call FarBattleTextBox .asm_36a67 @@ -7179,6 +7301,8 @@ BattleCommand24: ; 369b6 xor a ld [bc], a ret + +; Loop back to the command before 'critical'. .asm_36a6b ld a, [BattleScriptBufferLoc + 1] ld h, a @@ -7186,7 +7310,7 @@ BattleCommand24: ; 369b6 ld l, a .asm_36a73 ld a, [hld] - cp $5 + cp $5 ; critical jr nz, .asm_36a73 ; 36a76 $fb inc hl ld a, h @@ -7253,13 +7377,17 @@ Function0x36abf: ; 36abf BattleCommand4d: ; 36ac9 +; kingsrock + ld a, [AttackMissed] and a ret nz + call GetUserItem ld a, b - cp $4b + cp $4b ; king's rock ret nz + call CheckSubstituteOpp ret nz ld a, BATTLE_VARS_MOVE_EFFECT @@ -7279,6 +7407,8 @@ BattleCommand4d: ; 36ac9 BattleCommand26: ; 36af3 +; ohko + call ResetDamage ld a, [TypeModifier] and $7f @@ -7324,21 +7454,25 @@ BattleCommand26: ; 36af3 BattleCommand3a: ; 36b3a +; checkcharge + +; charged? ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair -; charged? bit 4, [hl] ret z ; go to town res 4, [hl] res 5, [hl] res 6, [hl] - ld b, $39 - jp $7e8c + ld b, $39 ; charge + jp SkipToBattleCommand ; 36b4d BattleCommand39: ; 36b4d +; charge + call $7e85 ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair @@ -7407,8 +7541,8 @@ BattleCommand39: ; 36b4d ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair cp $91 ; skull bash - ld b, $fe - jp z, $7e8c + ld b, $fe ; endturn + jp z, SkipToBattleCommand jp EndMoveEffect .text_36bdb @@ -7483,6 +7617,8 @@ BattleCommand3c: ; 36c2c BattleCommand3b: ; 36c2d +; traptarget + ld a, [AttackMissed] and a ret nz @@ -7538,6 +7674,8 @@ BattleCommand3b: ; 36c2d BattleCommand28: ; 36c7e +; mist + ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarPair bit 1, [hl] @@ -7553,6 +7691,8 @@ BattleCommand28: ; 36c7e BattleCommand29: ; 36c98 +; focusenergy + ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarPair bit 2, [hl] @@ -7568,6 +7708,8 @@ BattleCommand29: ; 36c98 BattleCommand27: ; 36cb2 +; recoil + ld hl, BattleMonMaxHP ld a, [hBattleTurn] and a @@ -7632,7 +7774,8 @@ BattleCommand27: ; 36cb2 BattleCommand2b: ; 36d1d -; battleanimation + confuse +; confusetarget + call GetOpponentItem ld a, b cp $19 @@ -7650,7 +7793,10 @@ BattleCommand2b: ; 36d1d ret nz jr Function0x36d70 + BattleCommand2a: ; 36d3b +; confuse + call GetOpponentItem ld a, b cp $19 @@ -7734,6 +7880,8 @@ Function0x36db6: ; 36db6 BattleCommand30: ; 36dc7 +; paralyze + ld a, BATTLE_VARS_STATUS_OPP call CleanGetBattleVarPair bit 6, a @@ -7841,6 +7989,8 @@ Function0x36e5b: ; 36e5b BattleCommand31: ; 36e7c +; substitute + call $7e80 ld hl, BattleMonMaxHP ld de, $c6df @@ -7920,6 +8070,7 @@ BattleCommand31: ; 36e7c ; 36f0b BattleCommand32: ; 36f0b +; rechargenextturn ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarPair set 5, [hl] @@ -7938,6 +8089,7 @@ EndRechargeOpp: ; 36f13 BattleCommand97: ; 36f1d +; rage ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarPair set 6, [hl] @@ -7946,25 +8098,27 @@ BattleCommand97: ; 36f1d BattleCommand98: ; 36f25 +; doubleflyingdamage ld a, BATTLE_VARS_SUBSTATUS3_OPP call CleanGetBattleVarPair - bit 6, a + bit 6, a ; flying ret z - jr BattleCommand9899 + jr DoubleDamage ; 36f2f BattleCommand99: ; 36f2f +; doubleundergrounddamage ld a, BATTLE_VARS_SUBSTATUS3_OPP call CleanGetBattleVarPair - bit 5, a ; recharge + bit 5, a ; underground ret z ; fallthrough ; 36f37 -BattleCommand9899: ; 36f37 +DoubleDamage: ; 36f37 ld hl, CurDamage + 1 sla [hl] dec hl @@ -7980,6 +8134,8 @@ BattleCommand9899: ; 36f37 BattleCommand33: ; 36f46 +; mimic + call Function0x372d8 call $7e80 ld a, [AttackMissed] @@ -8146,6 +8302,8 @@ BattleCommand37: ; 36fed BattleCommand1e: ; 3705c +; payday + xor a ld hl, StringBuffer1 ld [hli], a @@ -8171,6 +8329,8 @@ BattleCommand1e: ; 3705c BattleCommand1f: ; 3707f +; conversion + ld hl, BattleMonMoves ld de, BattleMonType1 ld a, [hBattleTurn] @@ -8268,6 +8428,7 @@ BattleCommand1f: ; 3707f BattleCommand20: ; 3710e ; resetstats + ld a, 7 ; neutral ld hl, PlayerStatLevels call .Fill @@ -8301,6 +8462,8 @@ BattleCommand20: ; 3710e BattleCommand2c: ; 3713e +; heal + ld de, BattleMonHP ld hl, BattleMonMaxHP ld a, [hBattleTurn] @@ -8362,10 +8525,10 @@ BattleCommand2c: ; 3713e call $7e73 .asm_371a9 call $7e01 - call $4ffd + call SwitchTurn ld hl, $4cef call $7e73 - call $4ffd + call SwitchTurn call $3995 call $39c9 ld hl, RegainedHealthText @@ -8571,6 +8734,8 @@ Function0x372d8: ; 372d8 BattleCommand2e: ; 372fc +; screen + ld hl, PlayerScreens ld bc, PlayerLightScreenCount ld a, [hBattleTurn] @@ -9044,10 +9209,10 @@ BattleCommand54: ; 37588 call $7e01 ld a, $2 call Function0x36532 - call $4ffd + call SwitchTurn call $63e9 call ResetMiss - call $4ffd + call SwitchTurn call BattleCommand70 call $63b8 call ResetMiss @@ -9276,8 +9441,10 @@ BattleCommand5b: ; 37718 call CleanGetBattleVarPair bit 6, a jr z, .asm_37731 ; 3772a $5 - ld b, $4 - jp $7e8c + + ld b, $4 ; doturn + jp SkipToBattleCommand + .asm_37731 xor a ld [de], a @@ -9491,7 +9658,7 @@ Function0x377f5: ; 377f5 BattleCommand60: ; 3784b -; checkhappiness +; happinesspower push bc ld hl, BattleMonHappiness ld a, [hBattleTurn] @@ -9566,7 +9733,7 @@ BattleCommand61: ; 37874 ld a, $3 ld [$c689], a call $7e01 - call $4ffd + call SwitchTurn ld hl, $5246 ld a, [hBattleTurn] and a @@ -9578,17 +9745,17 @@ BattleCommand61: ; 37874 jr c, .asm_378f3 ; 378d1 $20 ld hl, $4c8e call $7e73 - call $4ffd + call SwitchTurn ld hl, $4cef call $7e73 - call $4ffd + call SwitchTurn ld hl, RegainedHealthText call FarBattleTextBox - call $4ffd + call SwitchTurn call $398e jr .asm_37904 ; 378f1 $11 .asm_378f3 - call $4ffd + call SwitchTurn call $7ed5 jr nc, .asm_37904 ; 378f9 $9 call $7e77 @@ -9606,7 +9773,7 @@ BattleCommand61: ; 37874 BattleCommand63: ; 3790e -; checkfrustration +; frustrationpower push bc ld hl, BattleMonHappiness @@ -9676,6 +9843,7 @@ Function0x37962: ; 37962 BattleCommand65: ; 37972 +; checksafeguard ld hl, $c700 ld a, [hBattleTurn] and a @@ -9873,11 +10041,11 @@ BattleCommand67: ; 379c9 Function0x37ab1: ; 37ab1 - ld a, $a + ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair - and $7 + and 7 jr nz, .asm_37ac1 - ld a, $0 + ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarPair res 0, [hl] @@ -9888,13 +10056,13 @@ Function0x37ab1: ; 37ab1 ld hl, EnemySubStatus1 res 7, [hl] ld hl, PlayerSubStatus5 - ld a, $4 + ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarPair res 3, [hl] res 4, [hl] - ld a, $13 + ld a, BATTLE_VARS_LAST_MOVE call GetBattleVarPair - ld [hl], $0 + ld [hl], 0 xor a ld [$c730], a ld [$c731], a @@ -10083,13 +10251,13 @@ BattleCommand6a6c: ; 37b7e rst FarCall call $7e01 - call $4ffd + call SwitchTurn ld hl, $4cef ld a, $f rst FarCall ; callab 3ccef - call $4ffd + call SwitchTurn call $3995 ; 'regained health!' @@ -10112,13 +10280,16 @@ BattleCommand6a6c: ; 37b7e BattleCommand6d: ; 37be8 +; hiddenpower + ld a, [AttackMissed] and a ret nz ld a, $3e ld hl, $7ced - rst FarCall ; callba 3e 7ced + rst FarCall + ret ; 37bf4 @@ -10284,7 +10455,7 @@ BattleCommand9a: ; 37c95 BattleCommand9d: ; 37ce6 -; checkminimize +; doubleminimizedamage ld hl, $c6fa ld a, [hBattleTurn] @@ -10312,33 +10483,37 @@ BattleCommand9e: ; 37d02 ld a, [Weather] cp WEATHER_SUN ret nz - ld b, $39 - jp $7e8c + ld b, $39 ; charge + jp SkipToBattleCommand ; 37d0d BattleCommand9b: ; 37d0d +; checkfuturesight + ld hl, $c71d ld de, $c727 ld a, [hBattleTurn] and a - jr z, .asm_37d1e ; 37d16 $6 + jr z, .ok ld hl, $c71e ld de, $c729 -.asm_37d1e +.ok + ld a, [hl] and a ret z - cp $1 + cp 1 ret nz - ld [hl], $0 + + ld [hl], 0 ld a, [de] inc de ld [CurDamage], a ld a, [de] ld [CurDamage + 1], a - ld b, $9c - jp $7e8c + ld b, $9c ; futuresight + jp SkipToBattleCommand ; 37d34 BattleCommand9c: ; 37d34 @@ -10484,7 +10659,8 @@ BattleCommandaa: ; 37e80 BattleCommand38: ; 37e85 -; duped out +; cleartext + ; Used in multi-hit moves. ld hl, .text jp BattleTextBox @@ -10493,7 +10669,26 @@ BattleCommand38: ; 37e85 ; 37e8c -INCBIN "baserom.gbc", $37e8c, $37ead - $37e8c +SkipToBattleCommand: ; 37e8c +; Skip over commands until reaching command b. + ld a, [BattleScriptBufferLoc + 1] + ld h, a + ld a, [BattleScriptBufferLoc] + ld l, a +.asm_37e94 + ld a, [hli] + cp b + jr nz, .asm_37e94 + + ld a, h + ld [BattleScriptBufferLoc + 1], a + ld a, l + ld [BattleScriptBufferLoc], a + ret +; 37ea1 + + +INCBIN "baserom.gbc", $37ea1, $37ead - $37ea1 GetMoveData: ; 37ead diff --git a/main.asm b/main.asm index a327629cd..6a63a8a33 100644 --- a/main.asm +++ b/main.asm @@ -9551,7 +9551,7 @@ MistText: ; 0x8130b db "shrouded in MIST!", $58 ; 0x81321 -BattleText_0x81321: ; 0x81321 +ProtectedByMistText: ; 0x81321 db $0, $59, "'s", $4f db "protected by MIST.", $58 ; 0x81338 diff --git a/wram.asm b/wram.asm index 104c8b5a1..dc4a1ab19 100644 --- a/wram.asm +++ b/wram.asm @@ -524,7 +524,7 @@ PlayerSubStatus2: ; c669 ; 3 ; 2 ; 1 -; 0 +; 0 curled ds 1 PlayerSubStatus3: ; c66a ; bit @@ -540,7 +540,7 @@ PlayerSubStatus3: ; c66a PlayerSubStatus4: ; c66b ; bit ; 7 leech seed -; 6 +; 6 rage ; 5 recharge ; 4 substitute ; 3 @@ -551,7 +551,7 @@ PlayerSubStatus4: ; c66b PlayerSubStatus5: ; c66c ; bit ; 7 -; 6 +; 6 destiny bond ; 5 lock-on ; 4 ; 3 @@ -604,7 +604,9 @@ PlayerDamageTaken: ; c682 EnemyDamageTaken: ; c684 ds 2 - ds 5 + ds 4 + + ds 1 BattleScriptBuffer: ; c68a ds 40 From 62c621d5ad47cc827d6a5b0579e4875222685f75 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 27 Mar 2013 16:19:51 -0400 Subject: [PATCH 016/112] no more incbins in bank d --- battle/effect_commands.asm | 547 ++++++++++++++++++++++++------------- 1 file changed, 362 insertions(+), 185 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index b3106280f..9b11f29d4 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -184,7 +184,7 @@ CheckPlayerTurn: call CantMove call $399c ld hl, $5f48 - call $7e73 + call CallBankF ld a, $1 ld [$ffd4], a ld hl, PlayerSubStatus1 @@ -389,7 +389,7 @@ CantMove: ; 341f0 .asm_3420f res 5, [hl] res 6, [hl] - jp $7ece + jp Function0x37ece ; 34216 @@ -444,7 +444,7 @@ CheckEnemyTurn: ; 3421f call CantMove call $39b0 ld hl, $6036 - call $7e73 + call CallBankF ld a, $1 ld [$ffd4], a ld hl, EnemySubStatus1 @@ -576,7 +576,7 @@ CheckEnemyTurn: ; 3421f ld c, $1 call Function0x35d1c - call $5004 + call BattleCommand0c call CantMove jp Function0x34385 @@ -698,7 +698,7 @@ HitConfusion: ; 343a5 call z, PlayFXAnimID ld hl, $5f48 - call $7e73 + call CallBankF ld a, $1 ld [$ffd4], a @@ -706,7 +706,7 @@ HitConfusion: ; 343a5 ld c, $1 call Function0x35d7e - jp $5004 + jp BattleCommand0c ; 343db @@ -1172,13 +1172,13 @@ BattleCommand04: ; 34555 ret .asm_345e3 - call $7e80 + call BattleCommandaa ; get move effect ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair ; continuous? ld hl, .continuousmoves - ld de, $0001 ; don't skip + ld de, 1 call IsInArray ; 'has no pp left for [move]' @@ -1648,11 +1648,11 @@ BattleCommanda3: ; 34833 push hl dec a ld hl, $5afd - call $7ea1 + call GetMoveAttr and a jr z, .asm_3489b ; 0x3486e $2b inc hl - call $7ebb + call GetMoveByte ld hl, EnemyMonType1 call $47d3 ld a, [$d265] @@ -1734,12 +1734,12 @@ BattleCommanda3: ; 34833 inc de dec a ld hl, $5afd - call $7ea1 + call GetMoveAttr and a jr z, .loop inc hl - call $7ebb + call GetMoveByte ld hl, BattleMonType1 call $47d3 ld a, [$d265] @@ -1989,12 +1989,12 @@ BattleCommanda3: ; 34833 ld a, [LastEnemyCounterMove] dec a ld hl, $5afd - call $7ea1 + call GetMoveAttr and a jr z, .asm_34a77 inc hl - call $7ebb + call GetMoveByte ld hl, $d23d call $47d3 ld a, [$d265] @@ -2069,12 +2069,12 @@ BattleCommanda3: ; 34833 dec a ld hl, $5afd - call $7ea1 + call GetMoveAttr and a jr z, .asm_34ae9 inc hl - call $7ebb + call GetMoveByte ld hl, BattleMonType1 call $47d3 ld a, [$d265] @@ -2162,12 +2162,12 @@ BattleCommanda3: ; 34833 dec a ld hl, $5afd - call $7ea1 + call GetMoveAttr and a jr z, .asm_34b4a inc hl - call $7ebb + call GetMoveByte jr .asm_34b5d .asm_34b4a @@ -2702,7 +2702,7 @@ BattleCommand0a: ; 34eee ret nz .asm_34f21 - call $7ed5 + call Function0x37ed5 jr c, .asm_34f36 xor a @@ -2715,7 +2715,7 @@ BattleCommand0a: ; 34eee .asm_34f36 call $65c3 - jp $7e80 + jp BattleCommandaa .Rampage ld a, BATTLE_VARS_MOVE_EFFECT @@ -2749,7 +2749,7 @@ BattleCommandab: ; 34f57 BattleCommand0b: ; 34f60 ld a, [AttackMissed] and a - jp nz, $7e80 + jp nz, BattleCommandaa ld a, [hBattleTurn] and a @@ -2793,7 +2793,7 @@ BattleCommand0b: ; 34f60 .asm_34fad ; clear sprite - jp $7ec7 + jp Function0x37ec7 .asm_34fb0 ld a, [$c689] and $1 @@ -2817,7 +2817,7 @@ BattleCommand0b: ; 34f60 BattleCommand92: ; 34fd1 ld a, [AttackMissed] and a - jp nz, $7e80 + jp nz, BattleCommandaa xor a jr BattleCommand91_92 @@ -2827,7 +2827,7 @@ BattleCommand92: ; 34fd1 BattleCommand91: ; 34fdb ld a, [AttackMissed] and a - jp nz, $7e80 + jp nz, BattleCommandaa ld a, [hBattleTurn] and a @@ -2868,7 +2868,7 @@ BattleCommand0c: ; 35004 bit 4, a ret z - call $7ed5 + call Function0x37ed5 jp c, BattleCommanda6 xor a @@ -2916,7 +2916,7 @@ BattleCommand0d: ; 35023 call GetBattleVarPair res 5, [hl] res 6, [hl] - call $7ece + call Function0x37ece jp EndMoveEffect ; 3505e @@ -3058,7 +3058,7 @@ BattleCommand0e: ; 3505e call FarBattleTextBox ld a, $1 ld [$c689], a - call $7e36 + call Function0x37e36 ld c, $1 ld a, [hBattleTurn] and a @@ -4451,7 +4451,7 @@ BattleCommand41: ; 35864 ld de, EnemyMoveStruct call GetMoveData .asm_3591a - call $7e01 + call Function0x37e01 ld hl, $5109 jp FarBattleTextBox .asm_35923 @@ -4467,7 +4467,7 @@ BattleCommand42: ; 35926 jp nz, .asm_359cd call CheckSubstituteOpp jp nz, .asm_359cd - call $7e01 + call Function0x37e01 ld hl, $c63f ld de, EnemyMonMaxHPLo call .asm_3597d @@ -4589,12 +4589,12 @@ BattleCommand44: ; 359e6 push hl dec a ld hl, $5afe - call $7ea1 + call GetMoveAttr ld d, a pop hl cp $13 jr z, .asm_35a50 ; 35a0b $43 - call $7e01 + call Function0x37e01 call SwitchTurn .asm_35a13 @@ -4648,11 +4648,11 @@ BattleCommand45: ; 35a53 ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarPair set 5, [hl] - call $7e01 + call Function0x37e01 ld hl, $5136 jp FarBattleTextBox .asm_35a6e - call $7e77 + call Function0x37e77 jp PrintDidntAffect ; 35a74 @@ -4664,7 +4664,7 @@ BattleCommand46: ; 35a74 ld a, [InLinkBattle] and a jr z, .asm_35a83 ; 35a7b $6 - call $7e77 + call Function0x37e77 jp PrintNothingHappened .asm_35a83 call CheckSubstituteOpp @@ -4712,7 +4712,7 @@ BattleCommand46: ; 35a74 push hl dec a ld hl, $5b00 - call $7ea1 + call GetMoveAttr pop hl ld bc, $0006 add hl, bc @@ -4749,11 +4749,11 @@ BattleCommand46: ; 35a74 ld [hl], a .asm_35b04 call $34f8 - call $7e01 + call Function0x37e01 ld hl, $5143 jp FarBattleTextBox .asm_35b10 - call $7e77 + call Function0x37e77 jp PrintDidntAffect ; 35b16 @@ -4764,7 +4764,7 @@ BattleCommand47: ; 35b16 ; If the opponent isn't frozen, raise Attack one stage. ; If the opponent is frozen, thaw them and raise Accuracy two stages. - call $7e01 + call Function0x37e01 ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarPair @@ -4848,11 +4848,11 @@ BattleCommand48: ; 35b33 pop af ld [$c689], a .asm_35b9a - call $7e36 + call Function0x37e36 call UpdateMoveData jp ResetTurn .asm_35ba3 - call $7e77 + call Function0x37e77 jp $7349 .asm_35ba9 @@ -4941,7 +4941,7 @@ BattleCommand49: ; 35bff ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarPair set 6, [hl] - call $7e01 + call Function0x37e01 ld hl, $5156 jp FarBattleTextBox ; 35c0f @@ -5023,7 +5023,7 @@ BattleCommand4a: ; 35c0f ld [hl], e .asm_35c82 push de - call $7e01 + call Function0x37e01 pop de ld a, d ld [$d265], a @@ -5103,7 +5103,7 @@ BattleCommand4c: ; 35cc9 add hl, bc dec d jr nz, .asm_35ce9 ; 35cec $fb - call $7e01 + call Function0x37e01 ld hl, $51a0 call FarBattleTextBox ld a, [hBattleTurn] @@ -5294,7 +5294,7 @@ Function0x35de0: ; 35de0 ld a, $2 call CleanGetBattleVarPair and $60 - call z, $7ec7 + call z, Function0x37ec7 call SwitchTurn ld a, BATTLE_VARS_MOVE_EFFECT @@ -5370,7 +5370,7 @@ BattleCommand14: ; 35e5c jr nz, .asm_35ec6 ; 35e90 $34 call CheckSubstituteOpp jr nz, .asm_35ec6 ; 35e95 $2f - call $7e01 + call Function0x37e01 ld b, $7 ld a, [$cfc0] and a @@ -5395,7 +5395,7 @@ BattleCommand14: ; 35e5c ret .asm_35ec6 push hl - call $7e77 + call Function0x37e77 pop hl jp FarBattleTextBox ; 35ece @@ -5457,7 +5457,7 @@ BattleCommand13: ; 35eee ret nz call Function0x35ff5 ld de, $0106 - call $7e54 + call Function0x37e54 call $39c9 ld hl, $51d5 call FarBattleTextBox @@ -5539,14 +5539,14 @@ BattleCommand2f: ; 35f2c ret .asm_35fb8 push hl - call $7e77 + call Function0x37e77 pop hl jp FarBattleTextBox ; 35fc0 Function0x35fc0: ; 35fc0 - call $7e01 + call Function0x37e01 call Function0x35ff5 jp $39c9 ; 35fc9 @@ -5720,9 +5720,9 @@ BattleCommand17: ; 3608c set 4, [hl] call $398e ld hl, $6c76 - call $7e73 + call CallBankF ld de, $0105 - call $7e54 + call Function0x37e54 call $39c9 ld hl, $523c call FarBattleTextBox @@ -5792,7 +5792,7 @@ BattleCommand18: ; 36102 set 5, [hl] call $398e ld de, $0108 - call $7e54 + call Function0x37e54 call $39c9 ld hl, $525d call FarBattleTextBox @@ -5841,13 +5841,13 @@ BattleCommand19: ; 36165 set 6, [hl] call $398e ld hl, $6c39 - call $7e73 + call CallBankF ld de, $0109 - call $7e54 + call Function0x37e54 call $39c9 call PrintParalyze ld hl, $5de9 - jp $7e73 + jp CallBankF ; 361ac @@ -6027,13 +6027,13 @@ Function0x36281: ; 36281 ret nz ld a, $1 ld [bc], a - call $7ed5 + call Function0x37ed5 ret nc xor a ld [$ffd4], a - call $7e73 + call CallBankF call WaitBGMap - jp $7e80 + jp BattleCommandaa ; 362ad @@ -6337,7 +6337,7 @@ BattleCommand8e: ; 3644c and a ret z push af - call $7e80 + call BattleCommandaa pop af dec a jp z, $7349 @@ -6357,7 +6357,7 @@ BattleCommand8f: ; 3646a and a ret z push af - call $7e80 + call BattleCommandaa pop af dec a jp z, $7349 @@ -6567,7 +6567,7 @@ BattleCommanda6: ; 365af .asm_365ba xor a ld [$ffd4], a - call $7e73 + call CallBankF jp $31f6 ; 365c3 @@ -6581,7 +6581,7 @@ BattleCommanda7: ; 365c3 .asm_365ce xor a ld [$ffd4], a - call $7e73 + call CallBankF jp $31f6 ; 365d7 @@ -6595,15 +6595,15 @@ Function0x365d7: ; 365d7 call Function0x3661d ld hl, $6d45 - call $7e73 + call CallBankF call SwitchTurn ld hl, $6c39 - call $7e73 + call CallBankF ld hl, $6c76 - call $7e73 + call CallBankF jp SwitchTurn ; 365fd @@ -6620,10 +6620,10 @@ Function0x365fd: ; 365fd call SwitchTurn ld hl, $6c39 - call $7e73 + call CallBankF ld hl, $6c76 - call $7e73 + call CallBankF jp SwitchTurn ; 3661d @@ -6791,7 +6791,7 @@ BattleCommand22: ; 366e5 ld [bc], a ld a, $1 ld [$c689], a - call $7e01 + call Function0x37e01 jp EndMoveEffect ; 3671a @@ -6901,7 +6901,7 @@ BattleCommanda0: ; 36778 jr nc, .asm_367df ; 367b7 $26 .asm_367b9 - call $7e77 + call Function0x37e77 jp $734e .asm_367bf @@ -6933,7 +6933,7 @@ BattleCommanda0: ; 36778 ld [$c689], a call Function0x36804 call BattleCommand0a - call $7e36 + call Function0x37e36 ld c, $14 call DelayFrames call Function0x36804 @@ -7008,7 +7008,7 @@ BattleCommand23: ; 3680f call $39b0 ld a, $1 ld [$c689], a - call $7e01 + call Function0x37e01 ld c, $14 call DelayFrames ld hl, $c4a1 @@ -7045,7 +7045,7 @@ BattleCommand23: ; 3680f ld hl, $5544 call FarBattleTextBox ld hl, $5c23 - jp $7e73 + jp CallBankF .asm_368ca jp $6969 @@ -7101,7 +7101,7 @@ BattleCommand23: ; 3680f call $399c ld a, $1 ld [$c689], a - call $7e01 + call Function0x37e01 ld c, $14 call DelayFrames ld hl, $c535 @@ -7135,22 +7135,22 @@ BattleCommand23: ; 3680f ld a, d ld [CurPartyMon], a ld hl, $5b32 - call $7e73 + call CallBankF ld hl, $5544 call FarBattleTextBox ld hl, $5c23 - jp $7e73 + jp CallBankF .asm_36969 - call $4eee - call $7e80 - call $5004 + call BattleCommand0a + call BattleCommandaa + call BattleCommand0c jp $734e .asm_36975 push af call $6804 ld a, $1 ld [$c689], a - call $7e01 + call Function0x37e01 ld c, $14 call DelayFrames pop af @@ -7478,7 +7478,7 @@ BattleCommand39: ; 36b4d call CleanGetBattleVarPair and $7 jr z, .asm_36b65 ; 36b57 $c - call $7e80 + call BattleCommandaa call BattleCommand0c call $734e jp EndMoveEffect @@ -7495,7 +7495,7 @@ BattleCommand39: ; 36b4d ld [$cfca], a inc a ld [$c689], a - call $7e36 + call Function0x37e36 ld a, BATTLE_VARS_MOVE_ANIM call CleanGetBattleVarPair cp $13 @@ -7505,7 +7505,7 @@ BattleCommand39: ; 36b4d call BattleCommand0c jr .asm_36b99 ; 36b94 $3 .asm_36b96 - call $7ec0 + call Function0x37ec0 .asm_36b99 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair @@ -7681,11 +7681,11 @@ BattleCommand28: ; 36c7e bit 1, [hl] jr nz, .asm_36c92 ; 36c85 $b set 1, [hl] - call $7e01 + call Function0x37e01 ld hl, MistText jp FarBattleTextBox .asm_36c92 - call $7e77 + call Function0x37e77 jp $734e ; 36c98 @@ -7698,11 +7698,11 @@ BattleCommand29: ; 36c98 bit 2, [hl] jr nz, .asm_36cac ; 36c9f $b set 2, [hl] - call $7e01 + call Function0x37e01 ld hl, GettingPumpedText jp FarBattleTextBox .asm_36cac - call $7e77 + call Function0x37e77 jp $734e ; 36cb2 @@ -7804,7 +7804,7 @@ BattleCommand2a: ; 36d3b ld a, [hl] ld [$d265], a call $3468 - call $7e77 + call Function0x37e77 ld hl, ProtectedByText jp FarBattleTextBox @@ -7813,7 +7813,7 @@ BattleCommand2a: ; 36d3b call GetBattleVarPair bit 7, [hl] jr z, .asm_36d65 - call $7e77 + call Function0x37e77 ld hl, AlreadyConfusedText jp FarBattleTextBox @@ -7849,10 +7849,10 @@ Function0x36d70: ; 36d70 jr z, .asm_36d99 cp $76 jr z, .asm_36d99 - call $7e01 + call Function0x37e01 .asm_36d99 ld de, $0103 - call $7e54 + call Function0x37e54 ld hl, BecameConfusedText call FarBattleTextBox call GetOpponentItem @@ -7863,7 +7863,7 @@ Function0x36d70: ; 36d70 ret nz .asm_36db0 ld hl, $5e51 - jp $7e73 + jp CallBankF ; 36db6 Function0x36db6: ; 36db6 @@ -7896,7 +7896,7 @@ BattleCommand30: ; 36dc7 ld a, [hl] ld [$d265], a call $3468 - call $7e77 + call Function0x37e77 ld hl, ProtectedByText jp FarBattleTextBox .asm_36def @@ -7927,7 +7927,7 @@ BattleCommand30: ; 36dc7 jr nz, .asm_36e52 ; 36e1f $31 ld c, $1e call DelayFrames - call $7e01 + call Function0x37e01 ld a, $1 ld [$ffd4], a ld a, BATTLE_VARS_STATUS_OPP @@ -7935,19 +7935,19 @@ BattleCommand30: ; 36dc7 set 6, [hl] call $398e ld hl, $6c39 - call $7e73 + call CallBankF call $39d4 call PrintParalyze ld hl, $5de9 - jp $7e73 + jp CallBankF .asm_36e49 - call $7e77 + call Function0x37e77 ld hl, AlreadyParalyzedText jp FarBattleTextBox .asm_36e52 jp PrintDidntAffect2 .asm_36e55 - call $7e77 + call Function0x37e77 jp PrintDoesntAffect ; 36e5b @@ -7991,7 +7991,7 @@ Function0x36e5b: ; 36e5b BattleCommand31: ; 36e7c ; substitute - call $7e80 + call BattleCommandaa ld hl, BattleMonMaxHP ld de, $c6df ld a, [hBattleTurn] @@ -8041,7 +8041,7 @@ BattleCommand31: ; 36e7c xor a ld [hl], a ld [de], a - call $7ed5 + call Function0x37ed5 jr c, .asm_36ee8 ; 36ed5 $11 xor a ld [$cfca], a @@ -8137,7 +8137,7 @@ BattleCommand33: ; 36f46 ; mimic call Function0x372d8 - call $7e80 + call BattleCommandaa ld a, [AttackMissed] and a jr nz, .asm_36f9a ; 36f50 $48 @@ -8177,7 +8177,7 @@ BattleCommand33: ; 36f46 add hl, bc ld [hl], $5 call $34f8 - call $7e01 + call Function0x37e01 ld hl, LearnedMoveText jp FarBattleTextBox .asm_36f9a @@ -8210,21 +8210,21 @@ BattleCommand35: ; 36f9d bit 7, [hl] jr nz, .asm_36fd8 ; 36fc5 $11 set 7, [hl] - call $7e01 + call Function0x37e01 ld hl, WasSeededText jp FarBattleTextBox .asm_36fd2 - call $7e77 + call Function0x37e77 jp PrintDoesntAffect .asm_36fd8 - call $7e77 + call Function0x37e77 ld hl, EvadedText jp FarBattleTextBox ; 36fe1 BattleCommand36: ; 36fe1 - call $7e01 + call Function0x37e01 ld a, $41 ld hl, $60e5 rst FarCall @@ -8282,7 +8282,7 @@ BattleCommand37: ; 36fed swap c add c ld [de], a - call $7e01 + call Function0x37e01 ld hl, DisabledMove ld a, [hBattleTurn] and a @@ -8354,7 +8354,7 @@ BattleCommand1f: ; 3707f push bc dec a ld hl, $5afe - call $7ea1 + call GetMoveAttr ld [de], a inc de pop bc @@ -8390,7 +8390,7 @@ BattleCommand1f: ; 3707f inc hl jr .asm_370bd ; 370d1 $ea .asm_370d3 - call $7e77 + call Function0x37e77 jp $734e .asm_370d9 call FarBattleRNG @@ -8420,7 +8420,7 @@ BattleCommand1f: ; 3707f ld a, $14 ld hl, $4964 rst FarCall - call $7e01 + call Function0x37e01 ld hl, TransformedTypeText jp FarBattleTextBox ; 3710e @@ -8446,7 +8446,7 @@ BattleCommand20: ; 3710e pop af ld [hBattleTurn], a - call $7e01 + call Function0x37e01 ld hl, EliminatedStatsText jp FarBattleTextBox @@ -8490,7 +8490,7 @@ BattleCommand2c: ; 3713e push hl push de push af - call $7e80 + call BattleCommandaa ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarPair res 0, [hl] @@ -8518,16 +8518,16 @@ BattleCommand2c: ; 3713e .asm_37199 jr z, .asm_371a3 ; 37199 $8 ld hl, $4c9f - call $7e73 + call CallBankF jr .asm_371a9 ; 371a1 $6 .asm_371a3 ld hl, $4cac - call $7e73 + call CallBankF .asm_371a9 - call $7e01 + call Function0x37e01 call SwitchTurn ld hl, $4cef - call $7e73 + call CallBankF call SwitchTurn call $3995 call $39c9 @@ -8535,7 +8535,7 @@ BattleCommand2c: ; 3713e jp FarBattleTextBox .asm_371c4 - call $7e77 + call Function0x37e77 ld hl, HPIsFullText jp FarBattleTextBox ; 371cd @@ -8649,7 +8649,7 @@ BattleCommand2d: ; 371cd ld de, PlayerStatLevels ld bc, $0008 call BattleSideCopy - call $7ed5 + call Function0x37ed5 jr c, .asm_372a8 ; 37293 $13 ld a, [hBattleTurn] and a @@ -8659,10 +8659,10 @@ BattleCommand2d: ; 371cd .asm_372a0 and a jr nz, .asm_372a8 ; 372a1 $5 - call $7e36 + call Function0x37e36 jr .asm_372ae ; 372a6 $6 .asm_372a8 - call $7e80 + call BattleCommandaa call BattleCommanda6 .asm_372ae xor a @@ -8696,7 +8696,7 @@ BattleSideCopy: ; 372c6 Function0x372d2: ; 372d2 - call $7e77 + call Function0x37e77 jp $734e ; 372d8 @@ -8764,10 +8764,10 @@ BattleCommand2e: ; 372fc ld [bc], a ld hl, $54c7 .asm_37331 - call $7e01 + call Function0x37e01 jp FarBattleTextBox .asm_37337 - call $7e77 + call Function0x37e77 jp $734e ; 3733d @@ -8798,7 +8798,7 @@ PrintButItFailed: ; 37349 Function0x37354: ; 37354 - call $7e77 + call Function0x37e77 ld hl, ButItFailedText ; 'but it failed!' ld de, ItFailedText ; 'it failed!' jp Function0x35157 @@ -8813,7 +8813,7 @@ PrintDidntAffect; 37360 PrintDidntAffect2: ; 37366 - call $7e77 + call Function0x37e77 ld hl, DidntAffect1Text ; 'it didn't affect' ld de, DidntAffect2Text ; 'it didn't affect' jp Function0x35157 @@ -8853,14 +8853,14 @@ BattleCommand1a: ; 37380 ld a, $1 ld [$c689], a call BattleCommand0a - call $7e36 + call Function0x37e36 ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarPair res 7, [hl] ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarPair res 6, [hl] - call $7ed5 + call Function0x37ed5 ret nc ld a, $f ld hl, $5f58 @@ -8886,7 +8886,7 @@ BattleCommand1b: ; 373c9 call CheckUserMove jr nz, .asm_373ea ; 373dc $c .asm_373de - call $7e77 + call Function0x37e77 ld hl, MirrorMoveFailedText call FarBattleTextBox jp EndMoveEffect @@ -8912,7 +8912,7 @@ BattleCommand1b: ; 373c9 pop af ld [$c689], a .asm_37412 - call $7e80 + call BattleCommandaa jp ResetTurn ; 37418 @@ -8931,7 +8931,7 @@ BattleCommand34: ; 37418 ld [$c689], a .asm_3742b - call $7e36 + call Function0x37e36 .GetMove call FarBattleRNG @@ -9119,11 +9119,11 @@ BattleCommand51: ; 37517 bit 7, [hl] jr nz, .asm_37530 ; 37523 $b set 7, [hl] - call $7e01 + call Function0x37e01 ld hl, CantEscapeNowText jp FarBattleTextBox .asm_37530 - call $7e77 + call Function0x37e77 jp $734e ; 37536 @@ -9144,11 +9144,11 @@ BattleCommand52: ; 37536 bit 0, [hl] jr nz, .asm_3755d ; 37550 $b set 0, [hl] - call $7e01 + call Function0x37e01 ld hl, StartedNightmareText jp FarBattleTextBox .asm_3755d - call $7e77 + call Function0x37e77 jp $734e ; 37563 @@ -9206,7 +9206,7 @@ BattleCommand54: ; 37588 .asm_375af ld a, $1 ld [$c689], a - call $7e01 + call Function0x37e01 ld a, $2 call Function0x36532 call SwitchTurn @@ -9228,21 +9228,21 @@ BattleCommand54: ; 37588 bit 1, [hl] jr nz, .asm_37604 ; 375e8 $1a set 1, [hl] - call $7e01 + call Function0x37e01 ld hl, $4c9f - call $7e73 + call CallBankF ld hl, $4c3f - call $7e73 + call CallBankF call $3995 ld hl, PutACurseText jp FarBattleTextBox .asm_37604 - call $7e77 + call Function0x37e77 jp $734e .asm_3760a ld b, $8 call $648f - call $7e77 + call Function0x37e77 ld hl, WontRiseAnymoreText jp FarBattleTextBox ; 37618 @@ -9256,7 +9256,7 @@ BattleCommand55: ; 37618 ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarPair set 2, [hl] - call $7e01 + call Function0x37e01 ld hl, ProtectedItselfText jp FarBattleTextBox ; 3762c @@ -9312,7 +9312,7 @@ Function0x3762c: ; 3762c .asm_37665 xor a ld [de], a - call $7e77 + call Function0x37e77 call $734e scf ret @@ -9328,7 +9328,7 @@ BattleCommand5a: ; 3766f ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarPair set 5, [hl] ; endure - call $7e01 + call Function0x37e01 ld hl, BracedItselfText jp FarBattleTextBox ; 37683 @@ -9346,7 +9346,7 @@ BattleCommand56: ; 37683 bit 0, [hl] jr nz, .asm_3769d ; 37690 $b set 0, [hl] - call $7e01 + call Function0x37e01 ld hl, SpikesText jp FarBattleTextBox .asm_3769d @@ -9367,7 +9367,7 @@ BattleCommand57: ; 376a0 bit 3, [hl] jr nz, .asm_376bf ; 376b2 $b set 3, [hl] - call $7e01 + call Function0x37e01 ld hl, IdentifiedText jp FarBattleTextBox .asm_376bf @@ -9400,11 +9400,11 @@ BattleCommand58: ; 376c2 ld a, $4 ld [$c67f], a .asm_376e9 - call $7e01 + call Function0x37e01 ld hl, StartPerishText jp FarBattleTextBox .asm_376f2 - call $7e77 + call Function0x37e77 jp $734e ; 376f8 @@ -9419,11 +9419,11 @@ BattleCommand59: ; 376f8 ld [Weather], a ld a, 5 ld [WeatherCount], a - call $7e01 + call Function0x37e01 ld hl, SandstormBrewedText jp FarBattleTextBox .asm_37712 - call $7e77 + call Function0x37e77 jp $734e ; 37718 @@ -9586,7 +9586,7 @@ BattleCommand5f: ; 377ce jr nz, .asm_377f2 set 7, [hl] - call $7e01 + call Function0x37e01 ; 'fell in love!' ld hl, FellInLoveText @@ -9703,10 +9703,10 @@ BattleCommand61: ; 37874 .asm_37889 ld a, [$d265] and a - jp z, $7e77 + jp z, Function0x37e77 ld a, [AttackMissed] and a - jp nz, $7e77 + jp nz, Function0x37e77 push bc call FarBattleRNG ld b, a @@ -9724,7 +9724,7 @@ BattleCommand61: ; 37874 .asm_378ad ld a, c ld [$c689], a - call $7de9 + call Function0x37de9 ld d, [hl] pop bc ret @@ -9732,7 +9732,7 @@ BattleCommand61: ; 37874 pop bc ld a, $3 ld [$c689], a - call $7e01 + call Function0x37e01 call SwitchTurn ld hl, $5246 ld a, [hBattleTurn] @@ -9744,10 +9744,10 @@ BattleCommand61: ; 37874 rst FarCall jr c, .asm_378f3 ; 378d1 $20 ld hl, $4c8e - call $7e73 + call CallBankF call SwitchTurn ld hl, $4cef - call $7e73 + call CallBankF call SwitchTurn ld hl, RegainedHealthText call FarBattleTextBox @@ -9756,9 +9756,9 @@ BattleCommand61: ; 37874 jr .asm_37904 ; 378f1 $11 .asm_378f3 call SwitchTurn - call $7ed5 + call Function0x37ed5 jr nc, .asm_37904 ; 378f9 $9 - call $7e77 + call Function0x37e77 ld hl, RefusedGiftText call FarBattleTextBox .asm_37904 @@ -9818,11 +9818,11 @@ BattleCommand64: ; 37939 set 2, [hl] ld a, $5 ld [de], a - call $7e01 + call Function0x37e01 ld hl, CoveredByVeilText jp FarBattleTextBox .asm_3795c - call $7e77 + call Function0x37e77 jp $734e ; 37962 @@ -9854,7 +9854,7 @@ BattleCommand65: ; 37972 ret z ld a, $1 ld [AttackMissed], a - call $7e80 + call BattleCommandaa ld hl, SafeguardProtectText call FarBattleTextBox jp EndMoveEffect @@ -9881,7 +9881,7 @@ BattleCommand66: ; 37991 inc hl ld a, [hl] ld [$d265], a - call $7e80 + call BattleCommandaa ld hl, MagnitudeText call FarBattleTextBox pop de @@ -9911,7 +9911,7 @@ BattleCommand67: ; 379c9 jp z, $7aab call $399c - call $7e01 + call Function0x37e01 ld c, 50 call DelayFrames @@ -9951,7 +9951,7 @@ BattleCommand67: ; 379c9 jp c, EndMoveEffect ld hl, $6459 - call $7e73 + call CallBankF call $7ab1 ret @@ -9965,7 +9965,7 @@ BattleCommand67: ; 379c9 jp z, $7aab call $39b0 - call $7e01 + call Function0x37e01 call $7a82 ld a, $f @@ -9977,19 +9977,19 @@ BattleCommand67: ; 379c9 ld [$c718], a ld hl, $5517 - call $7e73 + call CallBankF ld hl, $557a - call $7e73 + call CallBankF ld a, 1 ld [$d265], a ld hl, $6cab - call $7e73 + call CallBankF ld hl, $5c23 - call $7e73 + call CallBankF jr Function0x37ab1 @@ -10003,7 +10003,7 @@ BattleCommand67: ; 379c9 call $1d6e ld hl, $68e4 - call $7e73 + call CallBankF call $1c17 @@ -10019,7 +10019,7 @@ BattleCommand67: ; 379c9 call $1d6e ld hl, $68e4 - call $7e73 + call CallBankF ld a, [OTPartyCount] add $4 ld b, a @@ -10036,7 +10036,7 @@ BattleCommand67: ; 379c9 ld [$d430], a .asm_37aa8 jp $1c17 - call $7e77 + call Function0x37e77 jp $734e @@ -10250,7 +10250,7 @@ BattleCommand6a6c: ; 37b7e ld a, BANK(GetMaxHP) rst FarCall - call $7e01 + call Function0x37e01 call SwitchTurn ld hl, $4cef @@ -10265,7 +10265,7 @@ BattleCommand6a6c: ; 37b7e jp FarBattleTextBox .Full - call $7e77 + call Function0x37e77 ; 'hp is full!' ld hl, HPIsFullText @@ -10300,7 +10300,7 @@ BattleCommand6e: ; 37bf4 ld [Weather], a ld a, 5 ld [WeatherCount], a - call $7e01 + call Function0x37e01 ld hl, DownpourText jp FarBattleTextBox ; 37c07 @@ -10312,7 +10312,7 @@ BattleCommand6f: ; 37c07 ld [Weather], a ld a, 5 ld [WeatherCount], a - call $7e01 + call Function0x37e01 ld hl, SunGotBrightText jp FarBattleTextBox ; 37c1a @@ -10332,7 +10332,7 @@ BattleCommand95: ; 37c1a rst FarCall jr nc, .asm_37c4f ; 37c2f $1e push bc - call $7e01 + call Function0x37e01 pop bc ld hl, $4c3f ld a, $f @@ -10348,7 +10348,7 @@ BattleCommand95: ; 37c1a ld hl, BellyDrumText jp FarBattleTextBox .asm_37c4f - call $7e77 + call Function0x37e77 jp $734e ; 37c55 @@ -10375,7 +10375,7 @@ BattleCommand96: ; 37c55 dec b jr nz, .asm_37c67 ; 37c6d $f8 pop hl - call $7e77 + call Function0x37e77 jp $734e .asm_37c76 pop hl @@ -10394,7 +10394,7 @@ BattleCommand96: ; 37c55 .asm_37c89 call Function0x365fd .asm_37c8c - call $7e01 + call Function0x37e01 ld hl, CopiedStatsText jp FarBattleTextBox ; 37c95 @@ -10543,7 +10543,7 @@ BattleCommand9c: ; 37d34 ld a, $4 ld [hl], a call BattleCommand0a - call $7e80 + call BattleCommandaa ld hl, ForesawAttackText call FarBattleTextBox call BattleCommand0c @@ -10566,7 +10566,7 @@ BattleCommand9c: ; 37d34 .asm_37d87 pop bc call ResetDamage - call $7e77 + call Function0x37e77 call $734e jp EndMoveEffect ; 37d94 @@ -10647,7 +10647,133 @@ GetItem: ; 37dd0 ; 37de9 -INCBIN "baserom.gbc", $37de9, $37e80 - $37de9 +Function0x37de9: ; 37de9 + push hl + push de + push bc + ld a, [$c689] + push af + call BattleCommand0a + pop af + ld [$c689], a + call Function0x37e19 + call BattleCommand0c + pop bc + pop de + pop hl + ret +; 37e01 + + +Function0x37e01: ; 37e01 + push hl + push de + push bc + ld a, [$c689] + push af + call BattleCommand0a + pop af + ld [$c689], a + call Function0x37e36 + call BattleCommand0c + pop bc + pop de + pop hl + ret +; 37e19 + + +Function0x37e19: ; 37e19 + xor a + ld [FXAnimIDHi], a + + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + and a + ret z + + ld [FXAnimIDLo], a + + ld a, [hBattleTurn] + and a + ld a, 1 + jr z, .asm_37e30 + ld a, 4 + +.asm_37e30 + ld [$cfca], a + + jp Function0x37e47 +; 37e36 + + +Function0x37e36: ; 37e36 + xor a + ld [$cfca], a + ld [FXAnimIDHi], a + + ld a, BATTLE_VARS_MOVE_ANIM + call CleanGetBattleVarPair + and a + ret z + + ld [FXAnimIDLo], a + + ; fallthrough +; 37e47 + + +Function0x37e47: ; 37e47 + push hl + push de + push bc + ld hl, $40d6 + ld a, $33 + rst FarCall ; callab SafePlayBattleAnimation + pop bc + pop de + pop hl + ret +; 37e54 + + +Function0x37e54: ; 37e54 + ld a, e + ld [FXAnimIDLo], a + ld a, d + ld [FXAnimIDHi], a + xor a + ld [$cfca], a + + push hl + push de + push bc + call SwitchTurn + + ld hl, $40d6 + ld a, $33 + rst FarCall ; callab SafePlayBattleAnimation + + call SwitchTurn + pop bc + pop de + pop hl + ret +; 37e73 + + +CallBankF: ; 37e73 + ld a, $f + rst FarCall + ret +; 37e77 + + +Function0x37e77: ; 37e77 + call BattleCommand0a + call BattleCommandaa + jp BattleCommand0c +; 37e80 BattleCommandaa: ; 37e80 @@ -10688,11 +10814,19 @@ SkipToBattleCommand: ; 37e8c ; 37ea1 -INCBIN "baserom.gbc", $37ea1, $37ead - $37ea1 +GetMoveAttr: ; 37ea1 +; Assuming hl = Moves + x, return attribute x of move a. + push bc + ld bc, Move1 - Move0 + call AddNTimes + call GetMoveByte + pop bc + ret +; 37ead GetMoveData: ; 37ead -; Get move struct a. +; Copy move struct a to de. ld hl, Moves ld bc, Move1 - Move0 call AddNTimes @@ -10700,7 +10834,50 @@ GetMoveData: ; 37ead jp FarCopyBytes ; 37ebb -INCBIN "baserom.gbc", $37ebb, $37ee2 - $37ebb + +GetMoveByte: ; 37ebb + ld a, BANK(Moves) + jp GetFarByte +; 37ec0 + + +Function0x37ec0: ; 37ec0 + ld a, $3e + ld hl, $7d54 + rst $8 + ret +; 37ec7 + + +Function0x37ec7: ; 37ec7 + ld a, $3e + ld hl, $7d71 + rst $8 + ret +; 37ece + + +Function0x37ece: ; 37ece + ld a, $3e + ld hl, $7d69 + rst $8 + ret +; 37ed5 + + +Function0x37ed5: ; 37ed5 +; Related to mobile link battles. + push hl + push de + push bc + ld a, $13 + ld hl, $6a44 + rst $8 + pop bc + pop de + pop hl + ret +; 37ee2 From b6ab385d3c02f32986e3b61d7166c62263cec6a5 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 27 Mar 2013 17:07:00 -0400 Subject: [PATCH 017/112] More battletexts --- battle/effect_commands.asm | 225 +++++++++++++++++++++++-------------- main.asm | 94 ++++++++-------- 2 files changed, 189 insertions(+), 130 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 9b11f29d4..3c02d3c40 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -1037,7 +1037,7 @@ IgnoreSleepOnly: ; 3451f ret z ; 'ignored orders…sleeping!' - ld hl, $4f7b + ld hl, IgnoredSleepingText call FarBattleTextBox call EndMoveEffect @@ -1182,10 +1182,10 @@ BattleCommand04: ; 34555 call IsInArray ; 'has no pp left for [move]' - ld hl, $4fba + ld hl, HasNoPPLeftText jr c, .print ; 'but no pp is left for the move' - ld hl, $4f99 + ld hl, NoPPLeftText .print call FarBattleTextBox ld b, $1 @@ -2425,7 +2425,7 @@ BattleCommand09: ; 34d32 call DelayFrames ; 'protecting itself!' - ld hl, BattleText_0x8167a + ld hl, ProtectingItselfText call FarBattleTextBox ld c, 40 @@ -2882,7 +2882,7 @@ BattleCommand0c: ; 35004 BattleCommand0d: ; 35023 - +; resulttext ld a, [AttackMissed] and a ret z @@ -2922,11 +2922,13 @@ BattleCommand0d: ; 35023 BattleCommand0e: ; 3505e +; checkfaint + ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair bit 5, a jr z, .asm_35072 ; 35065 $b - call $5c94 + call BattleCommand4b ld b, $0 jr nc, .asm_3508b ; 3506c $1d ld b, $1 @@ -2941,7 +2943,7 @@ BattleCommand0e: ; 3505e call FarBattleRNG cp c jr nc, .asm_3508b ; 35080 $9 - call $5c94 + call BattleCommand4b ld b, $0 jr nc, .asm_3508b ; 35087 $2 ld b, $2 @@ -2965,7 +2967,7 @@ BattleCommand0e: ; 3505e ret z dec a jr nz, .asm_350ab ; 350a3 $6 - ld hl, $4eb0 + ld hl, EnduredText jp FarBattleTextBox .asm_350ab @@ -2973,7 +2975,8 @@ BattleCommand0e: ; 3505e ld a, [hl] ld [$d265], a call $3468 - ld hl, $4e99 + + ld hl, HungOnText jp FarBattleTextBox .asm_50bb @@ -3009,23 +3012,23 @@ BattleCommand0e: ; 3505e ; 350e4 - ld hl, $5071 - ld de, $5071 + ld hl, DoesntAffectText + ld de, DoesntAffectText ld a, [TypeModifier] and $7f jr z, .asm_35110 ; 0x350ef $1f ld a, $d call CleanGetBattleVarPair cp $94 - ld hl, $54f0 - ld de, $5500 + ld hl, ButItFailedText + ld de, ItFailedText jr z, .asm_35110 ; 0x350fe $10 - ld hl, $5020 - ld de, $5033 + ld hl, AttackMissedText + ld de, AttackMissed2Text ld a, [CriticalHit] cp $ff jr nz, .asm_35110 ; 0x3510b $3 - ld hl, $5061 + ld hl, UnaffectedText .asm_35110 call Function0x35157 xor a @@ -3054,7 +3057,7 @@ BattleCommand0e: ; 3505e inc a ld [hl], a .asm_3513e - ld hl, $5046 + ld hl, CrashedText call FarBattleTextBox ld a, $1 ld [$c689], a @@ -3117,8 +3120,8 @@ BattleCommand0f: ; 35175 jp DelayFrames .ptrs - dw BattleText_0x81086 ; 'critical hit' - dw BattleText_0x81097 ; 'one-hit ko' + dw CriticalHitText ; 'critical hit' + dw OneHitKOText ; 'one-hit ko' ; 35197 @@ -3157,9 +3160,9 @@ BattleCommand10: ; 351ad and $7f cp 10 ; 1.0 ret z - ld hl, BattleText_0x810aa ; 'super-effective' + ld hl, SuperEffectiveText ; 'super-effective' jr nc, .print - ld hl, BattleText_0x810c1 ; 'not very effective' + ld hl, NotVeryEffectiveText ; 'not very effective' .print jp FarBattleTextBox ; 351c0 @@ -3186,7 +3189,7 @@ BattleCommand11: ; 351c0 bit 6, a jr z, .asm_35231 - ld hl, $50da + ld hl, TookDownWithItText call FarBattleTextBox ld a, [hBattleTurn] and a @@ -3279,7 +3282,7 @@ BattleCommand12: ; 35250 ld [de], a call SwitchTurn - ld hl, $50f3 + ld hl, RageBuildingText call FarBattleTextBox jp SwitchTurn ; 3527b @@ -4452,8 +4455,10 @@ BattleCommand41: ; 35864 call GetMoveData .asm_3591a call Function0x37e01 - ld hl, $5109 + + ld hl, GotAnEncoreText jp FarBattleTextBox + .asm_35923 jp PrintDidntAffect2 ; 35926 @@ -4495,7 +4500,8 @@ BattleCommand42: ; 35926 ld a, $5e ld hl, $4000 rst FarCall - ld hl, $511b + + ld hl, SharedPainText jp FarBattleTextBox .asm_3597d @@ -4649,8 +4655,10 @@ BattleCommand45: ; 35a53 call GetBattleVarPair set 5, [hl] call Function0x37e01 - ld hl, $5136 + + ld hl, TookAimText jp FarBattleTextBox + .asm_35a6e call Function0x37e77 jp PrintDidntAffect @@ -4750,8 +4758,10 @@ BattleCommand46: ; 35a74 .asm_35b04 call $34f8 call Function0x37e01 - ld hl, $5143 + + ld hl, SketchedText jp FarBattleTextBox + .asm_35b10 call Function0x37e77 jp PrintDidntAffect @@ -4942,7 +4952,7 @@ BattleCommand49: ; 35bff call GetBattleVarPair set 6, [hl] call Function0x37e01 - ld hl, $5156 + ld hl, DestinyBondEffectText jp FarBattleTextBox ; 35c0f @@ -5027,7 +5037,7 @@ BattleCommand4a: ; 35c0f pop de ld a, d ld [$d265], a - ld hl, $517f + ld hl, SpiteEffectText jp FarBattleTextBox .asm_35c91 jp PrintDidntAffect2 @@ -5096,16 +5106,18 @@ BattleCommand4c: ; 35cc9 ld [hl], a ld h, d ld l, e - ld bc, $0030 + ld bc, $30 ld d, $6 .asm_35ce9 ld [hl], a add hl, bc dec d - jr nz, .asm_35ce9 ; 35cec $fb + jr nz, .asm_35ce9 call Function0x37e01 - ld hl, $51a0 + + ld hl, BellChimedText call FarBattleTextBox + ld a, [hBattleTurn] and a jp z, Function0x365d7 @@ -5260,8 +5272,10 @@ Function0x35d7e: ; 35d7e Function0x35de0: ; 35de0 - ld hl, $53ad + + ld hl, SubTookDamageText call FarBattleTextBox + ld de, $c6e0 ld a, [hBattleTurn] and a @@ -5286,7 +5300,7 @@ Function0x35de0: ; 35de0 call GetBattleVarPair res 4, [hl] - ld hl, $53d0 + ld hl, SubFadedText call FarBattleTextBox call SwitchTurn @@ -5348,51 +5362,62 @@ BattleCommand14: ; 35e5c ld a, [hl] ld [$d265], a call $3468 - ld hl, $55a9 - jr .asm_35ec6 ; 35e6e $56 + ld hl, ProtectedByText + jr .asm_35ec6 + .asm_35e70 ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarPair ld d, h ld e, l ld a, [de] - and $7 - ld hl, $51c1 - jr nz, .asm_35ec6 ; 35e7d $47 + and 7 + ld hl, AlreadyAsleepText + jr nz, .asm_35ec6 + ld a, [AttackMissed] and a jp nz, PrintDidntAffect2 - ld hl, $550c + + ld hl, DidntAffect1Text call Function0x35ece - jr c, .asm_35ec6 ; 35e8c $38 + jr c, .asm_35ec6 + ld a, [de] and a - jr nz, .asm_35ec6 ; 35e90 $34 + jr nz, .asm_35ec6 + call CheckSubstituteOpp - jr nz, .asm_35ec6 ; 35e95 $2f + jr nz, .asm_35ec6 + call Function0x37e01 ld b, $7 ld a, [$cfc0] and a - jr z, .asm_35ea4 ; 35ea0 $2 + jr z, .asm_35ea4 ld b, $3 + .asm_35ea4 call FarBattleRNG and b - jr z, .asm_35ea4 ; 35ea8 $fa - cp $7 - jr z, .asm_35ea4 ; 35eac $f6 + jr z, .asm_35ea4 + cp 7 + jr z, .asm_35ea4 inc a ld [de], a call $398e call $39c9 - ld hl, $51b1 + + ld hl, FellAsleepText call FarBattleTextBox + ld a, $f ld hl, $5de9 rst FarCall + jp z, $4216 ret + .asm_35ec6 push hl call Function0x37e77 @@ -5459,8 +5484,10 @@ BattleCommand13: ; 35eee ld de, $0106 call Function0x37e54 call $39c9 - ld hl, $51d5 + + ld hl, WasPoisonedText call FarBattleTextBox + ld a, $f ld hl, $5de9 rst FarCall @@ -5471,7 +5498,7 @@ BattleCommand13: ; 35eee BattleCommand2f: ; 35f2c ; poison - ld hl, $5071 + ld hl, DoesntAffectText ld a, [TypeModifier] and $7f jp z, $5fb8 @@ -5480,7 +5507,7 @@ BattleCommand2f: ; 35f2c ld a, BATTLE_VARS_STATUS_OPP call CleanGetBattleVarPair ld b, a - ld hl, $51fa + ld hl, AlreadyPoisonedText and $8 jp nz, $5fb8 call GetOpponentItem @@ -5490,10 +5517,10 @@ BattleCommand2f: ; 35f2c ld a, [hl] ld [$d265], a call $3468 - ld hl, $55a9 + ld hl, ProtectedByText jr .asm_35fb8 ; 35f5d $59 .asm_35f5f - ld hl, $550c + ld hl, DidntAffect1Text ld a, BATTLE_VARS_STATUS_OPP call CleanGetBattleVarPair and a @@ -5522,21 +5549,26 @@ BattleCommand2f: ; 35f2c call Function0x35fc9 jr z, .asm_35fa4 ; 35f97 $b call Function0x35fc0 - ld hl, $51d5 + + ld hl, WasPoisonedText call FarBattleTextBox + jr .asm_35fb1 ; 35fa2 $d .asm_35fa4 set 0, [hl] xor a ld [de], a call Function0x35fc0 - ld hl, $51e6 + + ld hl, BadlyPoisonedText call FarBattleTextBox + .asm_35fb1 ld a, $f ld hl, $5de9 rst FarCall ret + .asm_35fb8 push hl call Function0x37e77 @@ -5594,15 +5626,17 @@ Function0x35ff5: ; 35ff5 BattleCommand15: ; 35fff +; draintarget call Function0x36011 - ld hl, $5210 + ld hl, SuckedHealthText jp FarBattleTextBox ; 36008 BattleCommand16: ; 36008 +; eatdream call Function0x36011 - ld hl, $5227 + ld hl, DreamEatenText jp FarBattleTextBox ; 36011 @@ -5724,8 +5758,10 @@ BattleCommand17: ; 3608c ld de, $0105 call Function0x37e54 call $39c9 - ld hl, $523c + + ld hl, WasBurnedText call FarBattleTextBox + ld a, $f ld hl, $5de9 rst FarCall @@ -5754,7 +5790,8 @@ Defrost: ; 360dd xor a ld [hl], a call $398e - ld hl, $524b + + ld hl, DefrostedOpponentText jp FarBattleTextBox ; 36102 @@ -5794,8 +5831,10 @@ BattleCommand18: ; 36102 ld de, $0108 call Function0x37e54 call $39c9 - ld hl, $525d + + ld hl, WasFrozenText call FarBattleTextBox + ld a, $f ld hl, $5de9 rst FarCall @@ -6346,7 +6385,7 @@ BattleCommand8e: ; 3644c ld b, a inc b call $648f - ld hl, $5272 + ld hl, WontRiseAnymoreText jp FarBattleTextBox ; 3646a @@ -6369,7 +6408,7 @@ BattleCommand8f: ; 3646a ld b, a inc b call $648f - ld hl, $528f + ld hl, WontDropAnymoreText jp FarBattleTextBox ; 3648f @@ -6714,8 +6753,10 @@ BattleCommand21: ; 36671 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair res 0, [hl] - ld hl, $4e84 + + ld hl, UnleashedEnergyText call FarBattleTextBox + ld a, BATTLE_VARS_MOVE_POWER call GetBattleVarPair ld a, $1 @@ -6758,7 +6799,7 @@ BattleCommand21: ; 36671 jp SkipToBattleCommand .asm_366dc - ld hl, $4e6e + ld hl, StoringEnergyText call FarBattleTextBox jp EndMoveEffect ; 366e5 @@ -6937,7 +6978,8 @@ BattleCommanda0: ; 36778 ld c, $14 call DelayFrames call Function0x36804 - ld hl, $52ac + + ld hl, FledFromBattleText jp FarBattleTextBox ; 36804 @@ -7042,10 +7084,13 @@ BattleCommand23: ; 3680f ld hl, $54c3 ld a, $f rst FarCall - ld hl, $5544 + + ld hl, DraggedOutText call FarBattleTextBox + ld hl, $5c23 jp CallBankF + .asm_368ca jp $6969 @@ -7136,15 +7181,19 @@ BattleCommand23: ; 3680f ld [CurPartyMon], a ld hl, $5b32 call CallBankF - ld hl, $5544 + + ld hl, DraggedOutText call FarBattleTextBox + ld hl, $5c23 jp CallBankF + .asm_36969 call BattleCommand0a call BattleCommandaa call BattleCommand0c jp $734e + .asm_36975 push af call $6804 @@ -7154,11 +7203,11 @@ BattleCommand23: ; 3680f ld c, $14 call DelayFrames pop af - ld hl, $52c1 + + ld hl, FledInFearText cp $2e jr z, .asm_36991 - - ld hl, $52d2 + ld hl, BlownAwayText .asm_36991 jp FarBattleTextBox ; 36994 @@ -7284,19 +7333,22 @@ BattleCommand24: ; 369b6 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair res 2, [hl] - ld hl, $52e5 + + ld hl, PlayerHitTimesText ld a, [hBattleTurn] and a - jr z, .asm_36a5a ; 36a55 $3 - ld hl, $52f8 + jr z, .asm_36a5a + ld hl, EnemyHitTimesText .asm_36a5a + push bc ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair cp $9a ; beat up - jr z, .asm_36a67 ; 36a62 $3 + jr z, .asm_36a67 call FarBattleTextBox .asm_36a67 + pop bc xor a ld [bc], a @@ -7477,19 +7529,23 @@ BattleCommand39: ; 36b4d ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair and $7 - jr z, .asm_36b65 ; 36b57 $c + jr z, .asm_36b65 + call BattleCommandaa call BattleCommand0c call $734e jp EndMoveEffect + .asm_36b65 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair set 4, [hl] - ld hl, $5850 + + ld hl, IgnoredOrders2Text ld a, [AlreadyDisobeyed] and a call nz, FarBattleTextBox + call BattleCommand0a xor a ld [$cfca], a @@ -8740,32 +8796,35 @@ BattleCommand2e: ; 372fc ld bc, PlayerLightScreenCount ld a, [hBattleTurn] and a - jr z, .asm_3730d ; 37305 $6 + jr z, .asm_3730d ld hl, $c700 ld bc, $c706 .asm_3730d ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair cp $23 - jr nz, .asm_37324 ; 37314 $e + jr nz, .asm_37324 bit 3, [hl] - jr nz, .asm_37337 ; 37318 $1d + jr nz, .asm_37337 set 3, [hl] ld a, $5 ld [bc], a - ld hl, $54b4 - jr .asm_37331 ; 37322 $d + ld hl, LightScreenEffectText + jr .asm_37331 + .asm_37324 bit 4, [hl] - jr nz, .asm_37337 ; 37326 $f + jr nz, .asm_37337 set 4, [hl] inc bc ld a, $5 ld [bc], a - ld hl, $54c7 + ld hl, ReflectEffectText + .asm_37331 call Function0x37e01 jp FarBattleTextBox + .asm_37337 call Function0x37e77 jp $734e diff --git a/main.asm b/main.asm index 6a63a8a33..84a270db6 100644 --- a/main.asm +++ b/main.asm @@ -9246,17 +9246,17 @@ ClampedByText: ; 0x80e59 db $5a, "!", $58 ; 0x80e6e -BattleText_0x80e6e: ; 0x80e6e +StoringEnergyText: ; 0x80e6e db $0, $5a, $4f db "is storing energy!", $58 ; 0x80e84 -BattleText_0x80e84: ; 0x80e84 +UnleashedEnergyText: ; 0x80e84 db $0, $5a, $4f db "unleashed energy!", $58 ; 0x80e99 -BattleText_0x80e99: ; 0x80e99 +HungOnText: ; 0x80e99 db $0, $59, $4f db "hung on with", $55 db "@" @@ -9264,7 +9264,7 @@ BattleText_0x80e99: ; 0x80e99 db $0, "!", $58 ; 0x80eb0 -BattleText_0x80eb0: ; 0x80eb0 +EnduredText: ; 0x80eb0 db $0, $59, $4f db "ENDURED the hit!", $58 ; 0x80ec4 @@ -9319,18 +9319,18 @@ IgnoredOrdersText: ; 0x80f66 db "orders!", $58 ; 0x80f7b -BattleText_0x80f7b: ; 0x80f7b +IgnoredSleepingText: ; 0x80f7b text_from_ram $c621 db $0, " ignored", $4f db "orders…sleeping!", $58 ; 0x80f99 -BattleText_0x80f99: ; 0x80f99 +NoPPLeftText: ; 0x80f99 db $0, "But no PP is left", $4f db "for the move!", $58 ; 0x80fba -BattleText_0x80fba: ; 0x80fba +HasNoPPLeftText: ; 0x80fba db $0, $5a, $4f db "has no PP left for", $55 db "@" @@ -9354,23 +9354,23 @@ RegainedHealthText: ; 0x8100c db "regained health!", $58 ; 0x81020 -BattleText_0x81020: ; 0x81020 +AttackMissedText: ; 0x81020 db $0, $5a, "'s", $4f db "attack missed!", $58 ; 0x81033 -BattleText_0x81033: ; 0x81033 +AttackMissed2Text: ; 0x81033 db $0, $5a, "'s", $4f db "attack missed!", $58 ; 0x81046 -BattleText_0x81046: ; 0x81046 +CrashedText: ; 0x81046 db $0, $5a, $4f db "kept going and", $55 db "crashed!", $58 ; 0x81061 -BattleText_0x81061: ; 0x81061 +UnaffectedText: ; 0x81061 db $0, $59, "'s", $4f db "unaffected!", $58 ; 0x81071 @@ -9380,51 +9380,51 @@ DoesntAffectText: ; 0x81071 db $59, "!", $58 ; 0x81086 -BattleText_0x81086: ; 0x81086 +CriticalHitText: ; 0x81086 db $0, "A critical hit!", $58 ; 0x81097 -BattleText_0x81097: ; 0x81097 +OneHitKOText: ; 0x81097 db $0, "It's a one-hit KO!", $58 ; 0x810aa -BattleText_0x810aa: ; 0x810aa +SuperEffectiveText: ; 0x810aa db $0, "It's super-", $4f db "effective!", $58 ; 0x810c1 -BattleText_0x810c1: ; 0x810c1 +NotVeryEffectiveText: ; 0x810c1 db $0, "It's not very", $4f db "effective…", $58 ; 0x810da -BattleText_0x810da: ; 0x810da +TookDownWithItText: ; 0x810da db $0, $59, $4f db "took down with it,", $55 db $5a, "!", $58 ; 0x810f3 -BattleText_0x810f3: ; 0x810f3 +RageBuildingText: ; 0x810f3 db $0, $5a, "'s", $4f db "RAGE is building!", $58 ; 0x81109 -BattleText_0x81109: ; 0x81109 +GotAnEncoreText: ; 0x81109 db $0, $59, $4f db "got an ENCORE!", $58 ; 0x8111b -BattleText_0x8111b: ; 0x8111b +SharedPainText: ; 0x8111b db $0, "The battlers", $4f db "shared pain!", $58 ; 0x81136 -BattleText_0x81136: ; 0x81136 +TookAimText: ; 0x81136 db $0, $5a, $4f db "took aim!", $58 ; 0x81143 -BattleText_0x81143: ; 0x81143 +SketchedText: ; 0x81143 db $0, $5a, $4f db "SKETCHED", $55 db "@" @@ -9432,13 +9432,13 @@ BattleText_0x81143: ; 0x81143 db $0, "!", $58 ; 0x81156 -BattleText_0x81156: ; 0x81156 +DestinyBondEffectText: ; 0x81156 db $0, $5a, "'s", $4f db "trying to take its", $55 db "opponent with it!", $58 ; 0x8117f -BattleText_0x8117f: ; 0x8117f +SpiteEffectText: ; 0x8117f db $0, $59, "'s", $4f db "@" text_from_ram $d073 @@ -9448,57 +9448,57 @@ BattleText_0x8117f: ; 0x8117f db $0, "!", $58 ; 0x811a0 -BattleText_0x811a0: ; 0x811a0 +BellChimedText: ; 0x811a0 db $0, "A bell chimed!", $4f db $58 ; 0x811b1 -BattleText_0x811b1: ; 0x811b1 +FellAsleepText: ; 0x811b1 db $0, $59, $4f db "fell asleep!", $58 ; 0x811c1 -BattleText_0x811c1: ; 0x811c1 +AlreadyAsleepText: ; 0x811c1 db $0, $59, "'s", $4f db "already asleep!", $58 ; 0x811d5 -BattleText_0x811d5: ; 0x811d5 +WasPoisonedText: ; 0x811d5 db $0, $59, $4f db "was poisoned!", $58 ; 0x811e6 -BattleText_0x811e6: ; 0x811e6 +BadlyPoisonedText: ; 0x811e6 db $0, $59, "'s", $4f db "badly poisoned!", $58 ; 0x811fa -BattleText_0x811fa: ; 0x811fa +AlreadyPoisonedText: ; 0x811fa db $0, $59, "'s", $4f db "already poisoned!", $58 ; 0x81210 -BattleText_0x81210: ; 0x81210 +SuckedHealthText: ; 0x81210 db $0, "Sucked health from", $4f db $59, "!", $58 ; 0x81227 -BattleText_0x81227: ; 0x81227 +DreamEatenText: ; 0x81227 db $0, $59, "'s", $4f db "dream was eaten!", $58 ; 0x8123c -BattleText_0x8123c: ; 0x8123c +WasBurnedText: ; 0x8123c db $0, $59, $4f db "was burned!", $58 ; 0x8124b -BattleText_0x8124b: ; 0x8124b +DefrostedOpponentText: ; 0x8124b db $0, $59, $4f db "was defrosted!", $58 ; 0x8125d -BattleText_0x8125d: ; 0x8125d +WasFrozenText: ; 0x8125d db $0, $59, $4f db "was frozen solid!", $58 ; 0x81272 @@ -9511,7 +9511,7 @@ WontRiseAnymoreText: ; 0x81272 db "rise anymore!", $58 ; 0x8128f -BattleText_0x8128f: ; 0x8128f +WontDropAnymoreText: ; 0x8128f db $0, $59, "'s", $4f db "@" text_from_ram $d086 @@ -9519,28 +9519,28 @@ BattleText_0x8128f: ; 0x8128f db "drop anymore!", $58 ; 0x812ac -BattleText_0x812ac: ; 0x812ac +FledFromBattleText: ; 0x812ac db $0, $5a, $4f db "fled from battle!", $58 ; 0x812c1 -BattleText_0x812c1: ; 0x812c1 +FledInFearText: ; 0x812c1 db $0, $59, $4f db "fled in fear!", $58 ; 0x812d2 -BattleText_0x812d2: ; 0x812d2 +BlownAwayText: ; 0x812d2 db $0, $59, $4f db "was blown away!", $58 ; 0x812e5 -BattleText_0x812e5: ; 0x812e5 +PlayerHitTimesText: ; 0x812e5 db $0, "Hit @" deciram $c682, $11 db $0, " times!", $58 ; 0x812f8 -BattleText_0x812f8: ; 0x812f8 +EnemyHitTimesText: ; 0x812f8 db $0, "Hit @" deciram $c684, $11 db $0, " times!", $58 @@ -9582,13 +9582,13 @@ TooWeakSubText: ; 0x8138d db "a SUBSTITUTE!", $58 ; 0x813ad -BattleText_0x813ad: ; 0x813ad +SubTookDamageText: ; 0x813ad db $0, "The SUBSTITUTE", $4f db "took damage for", $55 db $59, "!", $58 ; 0x813d0 -BattleText_0x813d0: ; 0x813d0 +SubFadedText: ; 0x813d0 db $0, $59, "'s", $4f db "SUBSTITUTE faded!", $58 ; 0x813e6 @@ -9645,12 +9645,12 @@ TransformedText: ; 0x81499 db $0, "!", $58 ; 0x814b4 -BattleText_0x814b4: ; 0x814b4 +LightScreenEffectText: ; 0x814b4 db $0, $5a, "'s", $4f db "SPCL.DEF rose!", $58 ; 0x814c7 -BattleText_0x814c7: ; 0x814c7 +ReflectEffectText: ; 0x814c7 db $0, $5a, "'s", $4f db "DEFENSE rose!", $58 ; 0x814d9 @@ -9683,7 +9683,7 @@ HPIsFullText: ; 0x81534 db "HP is full!", $58 ; 0x81544 -BattleText_0x81544: ; 0x81544 +DraggedOutText: ; 0x81544 db $0, $5a, $4f db "was dragged out!", $58 ; 0x81558 @@ -9752,7 +9752,7 @@ ProtectedItselfText: ; 0x81665 db "PROTECTED itself!", $58 ; 0x8167a -BattleText_0x8167a: ; 0x8167a +ProtectingItselfText: ; 0x8167a db $0, $59, "'s", $4f db "PROTECTING itself!", $57 ; 0x81691 @@ -9861,7 +9861,7 @@ RefusedGiftText: ; 0x8183b db "refused the gift!", $58 ; 0x81850 -BattleText_0x81850: ; 0x81850 +IgnoredOrders2Text: ; 0x81850 db $0, $5a, $4f db "ignored orders!", $58 ; 0x81863 From 4f8f811fe4614644929038eb1e29b49a371a09ae Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 27 Mar 2013 17:33:29 -0400 Subject: [PATCH 018/112] Moves that don't make sense are actually effect ids --- battle/effect_commands.asm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 3c02d3c40..e8676a146 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -2896,14 +2896,15 @@ BattleCommand0d: ; 35023 cp DIG jr z, .asm_3504f ; 35036 $17 +; Move effect: inc hl ld a, [hl] - cp HEADBUTT + cp $1d ; multi-hit jr z, .asm_35049 - cp BITE + cp $2c ; double-hit jr z, .asm_35049 - cp POISONPOWDER + cp $4d ; twineedle jr z, .asm_35049 jp EndMoveEffect From 1b96c1543a48d395bfaae3fe8756663ca80e72eb Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 27 Mar 2013 18:50:10 -0400 Subject: [PATCH 019/112] All local addresses in bank d have labels --- battle/effect_commands.asm | 511 ++++++++++++++++++++++--------------- wram.asm | 7 +- 2 files changed, 311 insertions(+), 207 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index e8676a146..dcc3a3d2a 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -133,7 +133,7 @@ BattleCommand01: ; 34084 ld [$c70d], a ld [$c689], a ld [AlreadyDisobeyed], a - ld [$c6fb], a + ld [AlreadyFailed], a ld [$c73e], a ld a, 10 ; 1.0 @@ -559,7 +559,7 @@ CheckEnemyTurn: ; 3421f call Function0x355dd - call $5612 + call BattleCommand62 call BattleCommand0a @@ -683,7 +683,7 @@ HitConfusion: ; 343a5 call Function0x355dd - call $5612 + call BattleCommand62 call BattleCommand0a @@ -858,7 +858,7 @@ BattleCommand02: ; 343db call HitConfusion - jp $450c + jp Function0x3450c .Nap @@ -899,7 +899,7 @@ BattleCommand02: ; 343db .Print call FarBattleTextBox - jp $450c + jp Function0x3450c .UseInstead @@ -1003,6 +1003,11 @@ BattleCommand02: ; 343db pop af ld [CurMoveNum], a + ; fallthrough +; 3450c + + +Function0x3450c: ; 3450c xor a ld [LastPlayerMove], a ld [LastEnemyCounterMove], a @@ -1544,9 +1549,14 @@ Function0x347c8: ; 347c8 ld hl, EnemyMonType1 ld a, [hBattleTurn] and a - jr z, .asm_347d3 ; 0x347ce $3 + jr z, Function0x347d3 ld hl, BattleMonType1 -.asm_347d3 + + ; fallthrough +; 347d3 + + +Function0x347d3: ; 347d3 push hl push de push bc @@ -1629,7 +1639,7 @@ BattleCommanda3: ; 34833 ; 3484e -; 3484e +Function0x3484e: ; 3484e push hl push de push bc @@ -1654,7 +1664,7 @@ BattleCommanda3: ; 34833 inc hl call GetMoveByte ld hl, EnemyMonType1 - call $47d3 + call Function0x347d3 ld a, [$d265] cp $b jr nc, .asm_34895 ; 0x3487f $14 @@ -1671,7 +1681,7 @@ BattleCommanda3: ; 34833 ld e, $2 jr .asm_3489b ; 0x34893 $6 .asm_34895 - call $4931 + call Function0x34931 pop hl jr .asm_348d7 ; 0x34899 $3c .asm_3489b @@ -1682,32 +1692,32 @@ BattleCommanda3: ; 34833 ld a, e cp $2 jr z, .asm_348d7 ; 0x348a2 $33 - call $4939 + call Function0x34939 ld a, e and a jr nz, .asm_348d7 ; 0x348a9 $2c - call $4939 + call Function0x34939 jr .asm_348d7 ; 0x348ae $27 .asm_348b0 ld a, [BattleMonType1] ld b, a ld hl, EnemyMonType1 - call $47d3 + call Function0x347d3 ld a, [$d265] cp $b jr c, .asm_348c4 ; 0x348bf $3 - call $4931 + call Function0x34931 .asm_348c4 ld a, [BattleMonType2] cp b jr z, .asm_348d7 ; 0x348c8 $d - call $47d3 + call Function0x347d3 ld a, [$d265] cp $b jr c, .asm_348d7 ; 0x348d2 $3 - call $4931 + call Function0x34931 .asm_348d7 - call $48de + call Function0x348de pop bc pop de pop hl @@ -1715,7 +1725,7 @@ BattleCommanda3: ; 34833 ; 348de -; 348de +Function0x348de: ; 348de ld de, EnemyMonMove1 ld b, 5 ld c, 0 @@ -1741,7 +1751,7 @@ BattleCommanda3: ; 34833 inc hl call GetMoveByte ld hl, BattleMonType1 - call $47d3 + call Function0x347d3 ld a, [$d265] and a jr z, .loop @@ -1768,23 +1778,29 @@ BattleCommanda3: ; 34833 ld a, c and a - jr z, .doubledown + jr z, .doubledown ; double down cp $5 - jr c, .down + jr c, Function0x34931 ; down cp $64 ret c - jr .up + jr Function0x34939 ; up .doubledown - call .down + call Function0x34931 + + ; fallthrough +; 34931 -.down + +Function0x34931: ; 34931 ld a, [$c716] dec a ld [$c716], a ret +; 34939 -.up + +Function0x34939: ; 34939 ld a, [$c716] inc a ld [$c716], a @@ -1792,10 +1808,10 @@ BattleCommanda3: ; 34833 ; 34941 -; 34941 +Function0x34941: ; 34941 xor a ld [$c717], a - call $49f4 + call Function0x349f4 ret c ld a, [EnemySubStatus1] @@ -1806,10 +1822,11 @@ BattleCommanda3: ; 34833 cp $1 jr nz, .asm_34986 - call $49f4 - call $4b77 - call $4b20 - call $4a85 + call Function0x349f4 + call Function0x34b77 + call Function0x34b20 + call Function0x34a85 + ld a, e cp $2 jr nz, .asm_34971 @@ -1820,7 +1837,7 @@ BattleCommanda3: ; 34833 ret .asm_34971 - call $49f4 + call Function0x349f4 sla c sla c ld b, $ff @@ -1836,7 +1853,7 @@ BattleCommanda3: ; 34833 ret .asm_34986 - call $484e + call Function0x3484e ld a, [$c716] cp $b ret nc @@ -1845,13 +1862,13 @@ BattleCommanda3: ; 34833 and a jr z, .asm_349d2 - call $4a2a + call Function0x34a2a ld a, [$c716] and a jr z, .asm_349d2 ld c, a - call $4aa7 + call Function0x34aa7 ld a, [$c716] cp $ff ret z @@ -1861,7 +1878,7 @@ BattleCommanda3: ; 34833 cp $2 jr z, .asm_349be - call $484e + call Function0x3484e ld a, [$c716] cp $a ret nc @@ -1873,7 +1890,7 @@ BattleCommanda3: ; 34833 .asm_349be ld c, $10 - call $484e + call Function0x3484e ld a, [$c716] cp $a jr nc, .asm_349cc @@ -1886,15 +1903,15 @@ BattleCommanda3: ; 34833 ret .asm_349d2 - call $484e + call Function0x3484e ld a, [$c716] cp $a ret nc - call $49f4 - call $4b77 - call $4b20 - call $4a85 + call Function0x349f4 + call Function0x34b77 + call Function0x34b20 + call Function0x34a85 ld a, e cp $2 @@ -1907,15 +1924,15 @@ BattleCommanda3: ; 34833 ; 349f4 -; 349f4 +Function0x349f4: ; 349f4 ld a, [OTPartyCount] - cp $2 + cp 2 jr c, .asm_34a26 ld d, a - ld e, $0 + ld e, 0 ld b, $20 - ld c, $0 + ld c, 0 ld hl, OTPartyMon1CurHP .asm_34a05 @@ -1937,7 +1954,7 @@ BattleCommanda3: ; 34833 .asm_34a16 srl b push bc - ld bc, $0030 + ld bc, $30 add hl, bc pop bc inc e @@ -1958,7 +1975,7 @@ BattleCommanda3: ; 34833 ; 34a2a -; 34a2a +Function0x34a2a: ; 34a2a ld hl, OTPartyMon1Species2 ld a, [OTPartyCount] ld b, a @@ -1996,7 +2013,7 @@ BattleCommanda3: ; 34833 inc hl call GetMoveByte ld hl, $d23d - call $47d3 + call Function0x347d3 ld a, [$d265] and a jr nz, .asm_34a77 @@ -2017,7 +2034,10 @@ BattleCommanda3: ; 34833 inc d srl c jr .asm_34a39 +; 34a85 + +Function0x34a85: ; 34a85 push bc ld a, [OTPartyCount] ld e, a @@ -2032,10 +2052,11 @@ BattleCommanda3: ; 34833 ld a, b or c ld c, a + .asm_34a98 srl b push bc - ld bc, $002f + ld bc, $2f add hl, bc pop bc dec e @@ -2046,6 +2067,12 @@ BattleCommanda3: ; 34833 and c ld c, a + + ; fallthrough +; 34aa7 + +Function0x34aa7: ; 34aa7 + ld a, $ff ld [$c716], a ld hl, OTPartyMon1Move1 @@ -2076,7 +2103,7 @@ BattleCommanda3: ; 34833 inc hl call GetMoveByte ld hl, BattleMonType1 - call $47d3 + call Function0x347d3 ld a, [$d265] cp $a jr c, .asm_34ae9 @@ -2142,7 +2169,7 @@ BattleCommanda3: ; 34833 ; 34b20 -; 34b20 +Function0x34b20: ; 34b20 push bc ld hl, OTPartySpecies ld b, $20 @@ -2173,7 +2200,7 @@ BattleCommanda3: ; 34833 .asm_34b4a ld a, [BattleMonType1] ld hl, $d23d - call $47d3 + call Function0x347d3 ld a, [$d265] cp $b jr nc, .asm_34b6d @@ -2181,7 +2208,7 @@ BattleCommanda3: ; 34833 .asm_34b5d ld hl, $d23d - call $47d3 + call Function0x347d3 ld a, [$d265] cp $b jr nc, .asm_34b6d @@ -2204,11 +2231,11 @@ BattleCommanda3: ; 34833 ; 34b77 -; 34b77 +Function0x34b77: ; 34b77 push bc ld de, OTPartySpecies ld b, $20 - ld c, $0 + ld c, 0 ld hl, OTPartyMon1CurHP .asm_34b82 @@ -2711,10 +2738,10 @@ BattleCommand0a: ; 34eee inc a ld [$c689], a ld a, $a4 - jp $7e44 + jp Function0x37e44 .asm_34f36 - call $65c3 + call BattleCommanda7 jp BattleCommandaa .Rampage @@ -2877,7 +2904,7 @@ BattleCommand0c: ; 35004 ld a, $2 ld [$c689], a ld a, $a4 - jp $7e44 + jp Function0x37e44 ; 35023 @@ -2887,7 +2914,7 @@ BattleCommand0d: ; 35023 and a ret z - call $50e4 + call Function0x350e4 ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVarPair @@ -3012,7 +3039,7 @@ BattleCommand0e: ; 3505e ; 350e4 -; 350e4 +Function0x350e4: ; 350e4 ld hl, DoesntAffectText ld de, DoesntAffectText ld a, [TypeModifier] @@ -3089,7 +3116,7 @@ BattleCommanda5: ; 35165 ld a, [TypeModifier] and $7f jp z, PrintDoesntAffect - jp $734e + jp PrintButItFailed ; 35175 @@ -3230,7 +3257,7 @@ BattleCommand11: ; 351c0 inc a ld [$c689], a ld a, $c2 - call $7e44 + call Function0x37e44 call SwitchTurn jr .asm_3524d ; 3522f $1c @@ -3431,20 +3458,22 @@ PlayerAttackDamage: ; 352e2 ld c, [hl] ld hl, $c6bc .asm_35337 - call $53c3 + call LightBallBoost jr .asm_3533f ; 3533a $3 .asm_3533c - call $53b5 + call ThickClubBoost .asm_3533f - call .asm_3534d + call Function0x3534d ld a, [BattleMonLevel] ld e, a call DittoMetalPowder ld a, 1 and a ret +; 3534d -.asm_3534d + +Function0x3534d: ; 3534d= ld a, h or b jr z, .asm_3536b ; 0x3534f $1a @@ -3471,7 +3500,7 @@ PlayerAttackDamage: ; 352e2 jr z, .asm_35376 ; 0x35370 $4 ld a, h or b - jr nz, .asm_3534d ; 0x35374 $d7 + jr nz, Function0x3534d .asm_35376 ld b, l ret @@ -3667,17 +3696,17 @@ EnemyAttackDamage: ; 353f6 ld hl, $c6c7 .asm_3544b - call $53c3 + call LightBallBoost jr .asm_35453 .asm_35450 - call $53b5 + call ThickClubBoost .asm_35453 - call $534d + call Function0x3534d ld a, [EnemyMonLevel] ld e, a - call $52b1 + call DittoMetalPowder ld a, 1 and a ret @@ -3715,7 +3744,7 @@ BattleCommanda1: ; 35461 call Function0x355bd ld a, [hli] or [hl] - jp z, $55b0 + jp z, Function0x355b0 ld a, [DefaultFlypoint] ld c, a ld a, [CurBattleMon] @@ -3727,7 +3756,7 @@ BattleCommanda1: ; 35461 .asm_354b2 ld a, [hl] and a - jp nz, $55b0 + jp nz, Function0x355b0 ld a, $1 ld [$c72d], a ld hl, BeatUpAttackText @@ -3808,7 +3837,7 @@ BattleCommanda1: ; 35461 call Function0x355bd ld a, [hli] or [hl] - jp z, $55b0 + jp z, Function0x355b0 ld a, [DefaultFlypoint] ld b, a ld a, [CurOTMon] @@ -3821,7 +3850,7 @@ BattleCommanda1: ; 35461 .asm_35560 ld a, [hl] and a - jr nz, .asm_355b0 + jr nz, Function0x355b0 ld a, $1 ld [$c72d], a @@ -3833,7 +3862,7 @@ BattleCommanda1: ; 35461 call $343b ld hl, BeatUpAttackText call FarBattleTextBox - jp $53f6 + jp EnemyAttackDamage .asm_3557d ld hl, BeatUpAttackText call FarBattleTextBox @@ -3860,9 +3889,11 @@ BattleCommanda1: ; 35461 ld a, [EnemyMovePower] ld d, a ret +; 355b0 -.asm_355b0 - ld b, $12 + +Function0x355b0: ; 355b0 + ld b, $12 ; buildopponentrage jp SkipToBattleCommand ; 355b5 @@ -3871,7 +3902,7 @@ BattleCommanda8: ; 355b5 ld a, [$c72d] and a ret nz - jp $734e + jp PrintButItFailed ; 355bd @@ -3933,7 +3964,7 @@ Function0x355dd: ; 355dd ld a, [hli] ld l, [hl] ld h, a - call $534d + call Function0x3534d ld d, $28 pop af ld e, a @@ -4279,7 +4310,7 @@ BattleCommand3f: ; 35726 call EnemyAttackDamage .asm_35800 - call $5612 + call BattleCommand62 pop hl ld [hl], 1 ret @@ -4304,13 +4335,15 @@ BattleCommand40: ; 35813 and a ret z ld b, a + ld hl, $45ec ld a, $f rst FarCall + ld a, b cp $59 ret z - call $4833 + call BattleCommanda3 ld a, [$d265] and a ret z @@ -4362,30 +4395,32 @@ BattleCommand41: ; 35864 ld a, BATTLE_VARS_LAST_MOVE_OPP call CleanGetBattleVarPair and a - jp z, $5923 - cp $a5 - jp z, $5923 - cp $e3 - jp z, $5923 - cp $77 - jp z, $5923 + jp z, Function0x35923 + cp STRUGGLE + jp z, Function0x35923 + cp ENCORE + jp z, Function0x35923 + cp MIRROR_MOVE + jp z, Function0x35923 ld b, a + .asm_3588e ld a, [hli] cp b - jr nz, .asm_3588e ; 35890 $fc + jr nz, .asm_3588e + ld bc, $0005 add hl, bc ld a, [hl] and $3f - jp z, $5923 + jp z, Function0x35923 ld a, [AttackMissed] and a - jp nz, $5923 + jp nz, Function0x35923 ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarPair bit 4, [hl] - jp nz, $5923 + jp nz, Function0x35923 set 4, [hl] call FarBattleRNG and $3 @@ -4394,10 +4429,10 @@ BattleCommand41: ; 35864 inc a ld [de], a call Function0x36abf - jr nz, .asm_3591a ; 358bb $5d + jr nz, .asm_3591a ld a, [hBattleTurn] and a - jr z, .asm_358ef ; 358c0 $2d + jr z, .asm_358ef push hl ld a, [LastPlayerMove] ld b, a @@ -4406,16 +4441,16 @@ BattleCommand41: ; 35864 .asm_358cc ld a, [hli] cp b - jr z, .asm_358dd ; 358ce $d + jr z, .asm_358dd inc c ld a, c cp $4 - jr c, .asm_358cc ; 358d4 $f6 + jr c, .asm_358cc pop hl res 4, [hl] xor a ld [de], a - jr .asm_35923 ; 358db $46 + jr Function0x35923 .asm_358dd pop hl ld a, c @@ -4425,7 +4460,7 @@ BattleCommand41: ; 35864 dec a ld de, PlayerMoveStruct call GetMoveData - jr .asm_3591a ; 358ed $2b + jr .asm_3591a .asm_358ef push hl ld a, [LastEnemyMove] @@ -4435,16 +4470,16 @@ BattleCommand41: ; 35864 .asm_358f9 ld a, [hli] cp b - jr z, .asm_3590a ; 358fb $d + jr z, .asm_3590a inc c ld a, c cp $4 - jr c, .asm_358f9 ; 35901 $f6 + jr c, .asm_358f9 pop hl res 4, [hl] xor a ld [de], a - jr .asm_35923 ; 35908 $19 + jr Function0x35923 .asm_3590a pop hl ld a, c @@ -4459,8 +4494,10 @@ BattleCommand41: ; 35864 ld hl, GotAnEncoreText jp FarBattleTextBox +; 35923 -.asm_35923 + +Function0x35923: ; 35923 jp PrintDidntAffect2 ; 35926 @@ -4470,9 +4507,9 @@ BattleCommand42: ; 35926 ld a, [AttackMissed] and a - jp nz, .asm_359cd + jp nz, Function0x359cd call CheckSubstituteOpp - jp nz, .asm_359cd + jp nz, Function0x359cd call Function0x37e01 ld hl, $c63f ld de, EnemyMonMaxHPLo @@ -4491,7 +4528,7 @@ BattleCommand42: ; 35926 ld [$d1eb], a ld a, [hl] ld [$d1ea], a - call $59ac + call Function0x359ac xor a ld [$d10a], a call ResetDamage @@ -4535,6 +4572,12 @@ BattleCommand42: ; 35926 inc de inc de inc de + + ; fallthrough +; 359ac + + +Function0x359ac: ; 359ac ld c, [hl] dec hl ld a, [$d257] @@ -4557,9 +4600,10 @@ BattleCommand42: ; 35926 ld [hli], a ld [$d1ef], a ret +; 359cd -.asm_359cd - jp $7366 +Function0x359cd: ; 359cd + jp PrintDidntAffect2 ; 359d0 @@ -4864,7 +4908,7 @@ BattleCommand48: ; 35b33 jp ResetTurn .asm_35ba3 call Function0x37e77 - jp $7349 + jp TryPrintButItFailed .asm_35ba9 push hl @@ -5305,7 +5349,7 @@ Function0x35de0: ; 35de0 call FarBattleTextBox call SwitchTurn - call $65c3 + call BattleCommanda7 ld a, $2 call CleanGetBattleVarPair and $60 @@ -5416,7 +5460,7 @@ BattleCommand14: ; 35e5c ld hl, $5de9 rst FarCall - jp z, $4216 + jp z, Function0x34216 ret .asm_35ec6 @@ -5502,15 +5546,15 @@ BattleCommand2f: ; 35f2c ld hl, DoesntAffectText ld a, [TypeModifier] and $7f - jp z, $5fb8 + jp z, .asm_35fb8 call Function0x35fe1 - jp z, $5fb8 + jp z, .asm_35fb8 ld a, BATTLE_VARS_STATUS_OPP call CleanGetBattleVarPair ld b, a ld hl, AlreadyPoisonedText and $8 - jp nz, $5fb8 + jp nz, .asm_35fb8 call GetOpponentItem ld a, b cp $14 @@ -5840,7 +5884,7 @@ BattleCommand18: ; 36102 ld hl, $5de9 rst FarCall ret nz - call $4216 + call Function0x34216 call EndRechargeOpp ld hl, $c740 ld a, [hBattleTurn] @@ -5981,7 +6025,7 @@ Function0x361ef: ; 361ef inc b ld a, $d cp b - jp c, $6270 + jp c, Function0x36270 ld a, [$c70c] and $f0 jr z, .asm_3622b ; 0x36222 $7 @@ -6036,9 +6080,15 @@ Function0x361ef: ; 361ef ret ; 3626e + Function0x3626e: ; 3626e pop hl dec [hl] + ; fallthrough +; 36270 + + +Function0x36270: ; 36270 ld a, $2 ld [$c70e], a ld a, $1 @@ -6046,12 +6096,14 @@ Function0x3626e: ; 3626e ret ; 3627b + Function0x3627b: ; 3627b ld a, $1 ld [$c70e], a ret ; 36281 + Function0x36281: ; 36281 ld bc, $c6fe ld hl, $7447 @@ -6151,7 +6203,7 @@ BattleCommand1d: ; 362e3 add hl, bc ld b, [hl] dec b - jp z, $6372 + jp z, .asm_36372 ld a, [$c70c] and $f0 jr z, .asm_36310 ; 3630a $4 @@ -6211,6 +6263,7 @@ BattleCommand1d: ; 362e3 ret .asm_36371 inc [hl] +.asm_36372 ld a, $3 ld [$c70e], a ld a, $1 @@ -6267,7 +6320,7 @@ BattleCommand8c: ; 363b8 and $f ld b, a inc b - call $648f + call GetStatName ld hl, .stat jp BattleTextBox @@ -6301,7 +6354,7 @@ BattleCommand8d: ; 363e9 and $f ld b, a inc b - call $648f + call GetStatName ld hl, .stat jp BattleTextBox @@ -6380,12 +6433,12 @@ BattleCommand8e: ; 3644c call BattleCommandaa pop af dec a - jp z, $7349 + jp z, TryPrintButItFailed ld a, [$c70c] and $f ld b, a inc b - call $648f + call GetStatName ld hl, WontRiseAnymoreText jp FarBattleTextBox ; 3646a @@ -6400,7 +6453,7 @@ BattleCommand8f: ; 3646a call BattleCommandaa pop af dec a - jp z, $7349 + jp z, TryPrintButItFailed dec a ld hl, ProtectedByMistText jp z, FarBattleTextBox @@ -6408,7 +6461,7 @@ BattleCommand8f: ; 3646a and $f ld b, a inc b - call $648f + call GetStatName ld hl, WontDropAnymoreText jp FarBattleTextBox ; 3648f @@ -6464,25 +6517,32 @@ StatLevelMulipliers: ; 364f2 BattleCommanda4: ; 36500 +; allstatsup + +; Attack call ResetMiss call BattleCommand70 - call $63b8 + call BattleCommand8c +; Defense call ResetMiss - call $61b0 - call $63b8 + call BattleCommand71 + call BattleCommand8c +; Speed call ResetMiss - call $61b4 - call $63b8 + call BattleCommand72 + call BattleCommand8c +; Special Attack call ResetMiss - call $61b8 - call $63b8 + call BattleCommand73 + call BattleCommand8c +; Special Defense call ResetMiss - call $61bc - jp $63b8 + call BattleCommand74 + jp BattleCommand8c ; 3652d @@ -6535,7 +6595,7 @@ Function0x36532: ; 36532 ld de, $c6c1 .asm_36570 - call $641a + call Function0x3641a pop hl jr z, .asm_36588 @@ -6569,7 +6629,7 @@ Function0x36532: ; 36532 BattleCommandac: ; 3658f ; tristatuschance - call $4ecc + call BattleCommand90 ; 1/3 chance of each status .loop @@ -6944,7 +7004,7 @@ BattleCommanda0: ; 36778 .asm_367b9 call Function0x37e77 - jp $734e + jp PrintButItFailed .asm_367bf ld a, [IsInBattle] @@ -6999,13 +7059,13 @@ BattleCommand23: ; 3680f ld a, [BattleType] cp $7 - jp z, $6969 + jp z, .asm_36969 cp $9 - jp z, $6969 + jp z, .asm_36969 cp $b - jp z, $6969 + jp z, .asm_36969 cp $c - jp z, $6969 + jp z, .asm_36969 ld a, [hBattleTurn] and a jp nz, .asm_368cd @@ -7032,7 +7092,7 @@ BattleCommand23: ; 3680f cp b jr nc, .asm_36855 ; 36850 $3 .asm_36852 - jp $6969 + jp .asm_36969 .asm_36855 call $399c xor a @@ -7041,9 +7101,9 @@ BattleCommand23: ; 3680f ld [$d232], a call Function0x36804 ld a, [PlayerMoveAnimation] - jp $6975 + jp .asm_36975 .asm_36869 - call $49f4 + call Function0x349f4 jr c, .asm_368ca ; 3686c $5c ld a, [$c70f] and a @@ -7093,7 +7153,7 @@ BattleCommand23: ; 3680f jp CallBankF .asm_368ca - jp $6969 + jp .asm_36969 .asm_368cd ld a, [AttackMissed] @@ -7132,7 +7192,7 @@ BattleCommand23: ; 3680f ld [$cfca], a inc a ld [$d232], a - call $6804 + call Function0x36804 ld a, [EnemyMoveAnimation] jr .asm_36975 @@ -7193,11 +7253,11 @@ BattleCommand23: ; 3680f call BattleCommand0a call BattleCommandaa call BattleCommand0c - jp $734e + jp PrintButItFailed .asm_36975 push af - call $6804 + call Function0x36804 ld a, $1 ld [$c689], a call Function0x37e01 @@ -7292,22 +7352,24 @@ BattleCommand24: ; 369b6 jr nz, .asm_36a0b ; 369fe $b ld a, [PartyCount] cp $1 - jp z, $6a1e + jp z, .asm_36a1e dec a jr .asm_36a3a ; 36a09 $2f .asm_36a0b ld a, [IsInBattle] cp $1 - jp z, $6a1e + jp z, .asm_36a1e ld a, [OTPartyCount] cp $1 - jp z, $6a1e + jp z, .asm_36a1e dec a - jr .asm_36a3a ; 36a1c $1c + jr .asm_36a3a + +.asm_36a1e ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair res 2, [hl] - call $55b5 + call BattleCommanda8 jp EndMoveEffect .asm_36a2b call FarBattleRNG @@ -7489,7 +7551,7 @@ BattleCommand26: ; 36af3 ld a, $ff .asm_36b1e ld [bc], a - call $4d32 + call BattleCommand09 ld hl, CurDamage ld a, $ff ld [hli], a @@ -7526,7 +7588,7 @@ BattleCommand3a: ; 36b3a BattleCommand39: ; 36b4d ; charge - call $7e85 + call BattleCommand38 ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair and $7 @@ -7534,7 +7596,7 @@ BattleCommand39: ; 36b4d call BattleCommandaa call BattleCommand0c - call $734e + call PrintButItFailed jp EndMoveEffect .asm_36b65 @@ -7743,7 +7805,7 @@ BattleCommand28: ; 36c7e jp FarBattleTextBox .asm_36c92 call Function0x37e77 - jp $734e + jp PrintButItFailed ; 36c98 @@ -7760,7 +7822,7 @@ BattleCommand29: ; 36c98 jp FarBattleTextBox .asm_36cac call Function0x37e77 - jp $734e + jp PrintButItFailed ; 36cb2 @@ -8105,7 +8167,7 @@ BattleCommand31: ; 36e7c ld [FXAnimIDHi], a ld [$c689], a ld a, $a4 - call $7e44 + call Function0x37e44 jr .asm_36eeb ; 36ee6 $3 .asm_36ee8 call BattleCommanda6 @@ -8238,7 +8300,7 @@ BattleCommand33: ; 36f46 ld hl, LearnedMoveText jp FarBattleTextBox .asm_36f9a - jp $7357 + jp Function0x37357 ; 36f9d @@ -8448,7 +8510,7 @@ BattleCommand1f: ; 3707f jr .asm_370bd ; 370d1 $ea .asm_370d3 call Function0x37e77 - jp $734e + jp PrintButItFailed .asm_370d9 call FarBattleRNG and $3 @@ -8621,12 +8683,12 @@ BattleCommand2d: ; 371cd call Function0x34548 jr nz, .asm_37200 ; 371f9 $5 ld a, $a4 - call $7e44 + call Function0x37e44 .asm_37200 ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarPair set 3, [hl] - call $72e7 + call Function0x372e7 ld hl, BattleMonSpecies ld de, EnemyMonSpecies ld a, [hBattleTurn] @@ -8729,7 +8791,7 @@ BattleCommand2d: ; 371cd ld [$c689], a pop af ld a, $a4 - call nz, $7e44 + call nz, Function0x37e44 ld hl, TransformedText jp FarBattleTextBox ; 372c6 @@ -8754,7 +8816,7 @@ BattleSideCopy: ; 372c6 Function0x372d2: ; 372d2 call Function0x37e77 - jp $734e + jp PrintButItFailed ; 372d8 @@ -8772,7 +8834,7 @@ Function0x372d8: ; 372d8 ; 372e7 -; 372e7 +Function0x372e7: ; 372e7 ld a, [hBattleTurn] and a jr z, .player @@ -8828,7 +8890,7 @@ BattleCommand2e: ; 372fc .asm_37337 call Function0x37e77 - jp $734e + jp PrintButItFailed ; 3733d @@ -8846,11 +8908,16 @@ PrintNothingHappened: ; 37343 ; 37349 -PrintButItFailed: ; 37349 - ld a, [$c6fb] +TryPrintButItFailed: ; 37349 + ld a, [AlreadyFailed] and a ret nz + ; fallthrough +; 3734e + + +PrintButItFailed: ; 3734e ; 'but it failed!' ld hl, ButItFailedText jp FarBattleTextBox @@ -8859,13 +8926,17 @@ PrintButItFailed: ; 37349 Function0x37354: ; 37354 call Function0x37e77 + ; fallthrough +; 37357 + +Function0x37357: ; 37357 ld hl, ButItFailedText ; 'but it failed!' ld de, ItFailedText ; 'it failed!' jp Function0x35157 ; 37360 -PrintDidntAffect; 37360 +PrintDidntAffect: ; 37360 ; 'it didn't affect' ld hl, DidntAffect1Text jp FarBattleTextBox @@ -9077,8 +9148,8 @@ ResetTurn: ; 3747b ld [hl], 1 xor a ld [AlreadyDisobeyed], a - call $402c - jp $52a3 + call DoMove + jp EndMoveEffect ; 37492 @@ -9184,7 +9255,7 @@ BattleCommand51: ; 37517 jp FarBattleTextBox .asm_37530 call Function0x37e77 - jp $734e + jp PrintButItFailed ; 37536 @@ -9209,7 +9280,7 @@ BattleCommand52: ; 37536 jp FarBattleTextBox .asm_3755d call Function0x37e77 - jp $734e + jp PrintButItFailed ; 37563 @@ -9270,14 +9341,14 @@ BattleCommand54: ; 37588 ld a, $2 call Function0x36532 call SwitchTurn - call $63e9 + call BattleCommand8d call ResetMiss call SwitchTurn call BattleCommand70 - call $63b8 + call BattleCommand8c call ResetMiss - call $61b0 - jp $63b8 + call BattleCommand71 + jp BattleCommand8c .asm_375d7 call CheckHiddenOpponent jr nz, .asm_37604 ; 375da $28 @@ -9298,10 +9369,10 @@ BattleCommand54: ; 37588 jp FarBattleTextBox .asm_37604 call Function0x37e77 - jp $734e + jp PrintButItFailed .asm_3760a ld b, $8 - call $648f + call GetStatName call Function0x37e77 ld hl, WontRiseAnymoreText jp FarBattleTextBox @@ -9330,7 +9401,7 @@ Function0x3762c: ; 3762c ld de, PlayerDamageTaken .asm_37637 - call $6abf + call Function0x36abf jr nz, .asm_37665 ld a, $3 @@ -9373,7 +9444,7 @@ Function0x3762c: ; 3762c xor a ld [de], a call Function0x37e77 - call $734e + call PrintButItFailed scf ret ; 3766f @@ -9465,7 +9536,7 @@ BattleCommand58: ; 376c2 jp FarBattleTextBox .asm_376f2 call Function0x37e77 - jp $734e + jp PrintButItFailed ; 376f8 @@ -9484,7 +9555,7 @@ BattleCommand59: ; 376f8 jp FarBattleTextBox .asm_37712 call Function0x37e77 - jp $734e + jp PrintButItFailed ; 37718 @@ -9754,7 +9825,7 @@ BattleCommand61: ; 37874 push bc push de .asm_3787d - call $46d2 + call BattleCommand07 ld a, [InLinkBattle] cp $3 jr z, .asm_37889 ; 37885 $2 @@ -9883,7 +9954,7 @@ BattleCommand64: ; 37939 jp FarBattleTextBox .asm_3795c call Function0x37e77 - jp $734e + jp PrintButItFailed ; 37962 @@ -9968,7 +10039,7 @@ BattleCommand67: ; 379c9 jp nz, .Enemy call Function0x37ae9 - jp z, $7aab + jp z, Function0x37aab call $399c call Function0x37e01 @@ -10002,7 +10073,7 @@ BattleCommand67: ; 379c9 ld b, 1 call $3340 call $32f9 - call $7a67 + call Function0x37a67 ld a, $f ld hl, $52e0 @@ -10012,26 +10083,26 @@ BattleCommand67: ; 379c9 ld hl, $6459 call CallBankF - call $7ab1 + call Function0x37ab1 ret .Enemy ld a, [IsInBattle] dec a - jp z, $7aab + jp z, Function0x37aab - call $7af6 - jp z, $7aab + call Function0x37af6 + jp z, Function0x37aab call $39b0 call Function0x37e01 - call $7a82 + call Function0x37a82 ld a, $f ld hl, $52e0 rst FarCall - jp c, $52a3 + jp c, EndMoveEffect xor a ld [$c718], a @@ -10052,7 +10123,10 @@ BattleCommand67: ; 379c9 call CallBankF jr Function0x37ab1 +; 37a67 + +Function0x37a67: ; 37a67 ld a, [InLinkBattle] and a ret z @@ -10073,6 +10147,8 @@ BattleCommand67: ; 379c9 ret ; 37a82 + +Function0x37a82; 37a82 ld a, [InLinkBattle] and a ret z @@ -10096,8 +10172,13 @@ BattleCommand67: ; 379c9 ld [$d430], a .asm_37aa8 jp $1c17 +; 37aab + + +Function0x37aab: ; 37aab call Function0x37e77 - jp $734e + jp PrintButItFailed +; 37ab1 Function0x37ab1: ; 37ab1 @@ -10110,7 +10191,7 @@ Function0x37ab1: ; 37ab1 res 0, [hl] .asm_37ac1 - call $72e7 + call Function0x372e7 ld hl, PlayerSubStatus1 res 7, [hl] ld hl, EnemySubStatus1 @@ -10136,14 +10217,21 @@ Function0x37ae9: ; 37ae9 ld d, a ld a, [CurBattleMon] ld e, a - jr .asm_37b01 + jr Function0x37b01 +; 37af6 + +Function0x37af6: ; 37af6 ld hl, OTPartyMon1CurHP ld a, [OTPartyCount] ld d, a ld a, [CurOTMon] ld e, a -.asm_37b01 + + ; fallthrough +; 37b01 + +Function0x37b01: ; 37b01 xor a ld b, a ld c, a @@ -10163,7 +10251,7 @@ Function0x37ae9: ; 37ae9 ld b, a .asm_37b11 push bc - ld bc, $0030 + ld bc, $30 add hl, bc pop bc inc c @@ -10380,17 +10468,20 @@ BattleCommand6f: ; 37c07 BattleCommand95: ; 37c1a ; bellydrum - call $61c8 + call BattleCommand77 ld a, [AttackMissed] and a - jr nz, .asm_37c4f ; 37c21 $2c + jr nz, .asm_37c4f + ld hl, $4c9f ld a, $f rst FarCall + ld hl, $4cde ld a, $f rst FarCall - jr nc, .asm_37c4f ; 37c2f $1e + jr nc, .asm_37c4f + push bc call Function0x37e01 pop bc @@ -10399,17 +10490,19 @@ BattleCommand95: ; 37c1a rst FarCall call $3995 ld a, $5 + .asm_37c41 push af - call $61c8 + call BattleCommand77 pop af dec a jr nz, .asm_37c41 ; 37c47 $f8 + ld hl, BellyDrumText jp FarBattleTextBox .asm_37c4f call Function0x37e77 - jp $734e + jp PrintButItFailed ; 37c55 @@ -10436,7 +10529,7 @@ BattleCommand96: ; 37c55 jr nz, .asm_37c67 ; 37c6d $f8 pop hl call Function0x37e77 - jp $734e + jp PrintButItFailed .asm_37c76 pop hl ld b, $8 @@ -10476,7 +10569,7 @@ BattleCommand9a: ; 37c95 ld a, b cp $90 ret z - call $4833 + call BattleCommanda3 ld a, [$d265] and a ret z @@ -10627,7 +10720,7 @@ BattleCommand9c: ; 37d34 pop bc call ResetDamage call Function0x37e77 - call $734e + call PrintButItFailed jp EndMoveEffect ; 37d94 @@ -10777,6 +10870,12 @@ Function0x37e36: ; 37e36 and a ret z + ; fallthrough +; 37e44 + + +Function0x37e44: ; 37e44 + ld [FXAnimIDLo], a ; fallthrough diff --git a/wram.asm b/wram.asm index dc4a1ab19..297a6396c 100644 --- a/wram.asm +++ b/wram.asm @@ -693,7 +693,12 @@ LastEnemyCounterMove: ; c6f8 LastPlayerCounterMove: ; c6f9 ds 1 - ds 5 + ds 1 + +AlreadyFailed: ; c6fb + ds 1 + + ds 3 PlayerScreens: ; c6ff ; bit 4: reflect From a7fbc916d47f0dd0c1e9ee2b54d0b93a848f88d3 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 27 Mar 2013 23:08:47 -0400 Subject: [PATCH 020/112] sub/status constants --- constants.asm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/constants.asm b/constants.asm index b835db3cf..395c41b65 100644 --- a/constants.asm +++ b/constants.asm @@ -3442,6 +3442,44 @@ BATTLE_VARS_LAST_MOVE EQU 19 BATTLE_VARS_LAST_MOVE_OPP EQU 20 +SUBSTATUS_IN_LOVE EQU 7 +SUBSTATUS_ENCORED EQU 6 +SUBSTATUS_ENDURE EQU 5 +SUBSTATUS_PERISH EQU 4 +SUBSTATUS_PROTECT EQU 2 +SUBSTATUS_CURSE EQU 1 +SUBSTATUS_NIGHTMARE EQU 0 + +SUBSTATUS_CURLED EQU 0 + +SUBSTATUS_CONFUSED EQU 7 +SUBSTATUS_FLYING EQU 6 +SUBSTATUS_UNDERGROUND EQU 5 +SUBSTATUS_CHARGED EQU 4 +SUBSTATUS_FLINCHED EQU 3 +SUBSTATUS_ROLLOUT EQU 1 +SUBSTATUS_BIDE EQU 0 + +SUBSTATUS_LEECH_SEED EQU 7 +SUBSTATUS_RAGE EQU 6 +SUBSTATUS_RECHARGE EQU 5 +SUBSTATUS_SUBSTITUTE EQU 4 +SUBSTATUS_FOCUS_ENERGY EQU 2 +SUBSTATUS_UNLEASH EQU 0 + +SUBSTATUS_DESTINY_BOND EQU 6 +SUBSTATUS_LOCK_ON EQU 5 + + +; status +SLP EQU 7 +PSN EQU 1 << 3 +BRN EQU 1 << 4 +FRZ EQU 1 << 5 +PAR EQU 1 << 6 + + + ; battle animations ; animations below fc are 1:1 with move constants ANIM_CONFUSED EQU $103 From 50e9c799aad6e21cd652f526264f553ae843a3df Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 28 Mar 2013 01:37:31 -0400 Subject: [PATCH 021/112] Minor formatting in main --- main.asm | 263 ++++++++++++++++++++++++------------------------------- 1 file changed, 115 insertions(+), 148 deletions(-) diff --git a/main.asm b/main.asm index 84a270db6..59128a83b 100644 --- a/main.asm +++ b/main.asm @@ -63,7 +63,7 @@ VBlank: ; 283 INCLUDE "vblank.asm" -DelayFrame: ; 0x45a +DelayFrame: ; 45a ; Wait for one frame ld a, 1 ld [VBlankOccurred], a @@ -75,25 +75,26 @@ DelayFrame: ; 0x45a and a jr nz, .halt ret -; 0x468 +; 468 -DelayFrames: ; 0x468 + +DelayFrames: ; 468 ; Wait c frames call DelayFrame dec c jr nz, DelayFrames ret -; 0x46f +; 46f + RTC: ; 46f ; update time and time-sensitive palettes ; rtc enabled? ld a, [$c2ce] - cp $0 + cp 0 ret z -; update clock call UpdateTime ; obj update on? @@ -106,8 +107,10 @@ RTC: ; 46f ret ; 485 + INCBIN "baserom.gbc",$485,$52f - $485 + IncGradGBPalTable_01: ; 52f db %11111111 ; bgp db %11111111 ; obp1 @@ -142,8 +145,10 @@ IncGradGBPalTable_01: ; 52f db %00000000 ; 547 + INCBIN "baserom.gbc",$547,$568 - $547 + DisableLCD: ; 568 ; Turn the LCD off ; Most of this is just going through the motions @@ -186,6 +191,7 @@ DisableLCD: ; 568 ret ; 58a + EnableLCD: ; 58a ld a, [rLCDC] set 7, a ; lcd enable @@ -193,10 +199,12 @@ EnableLCD: ; 58a ret ; 591 + AskTimer: ; 591 INCBIN "baserom.gbc",$591,$59c - $591 ; 59c + LatchClock: ; 59c ; latch clock counter data ld a, $0 @@ -206,6 +214,7 @@ LatchClock: ; 59c ret ; 5a7 + UpdateTime: ; 5a7 ; get rtc data call GetClock @@ -218,6 +227,7 @@ UpdateTime: ; 5a7 ret ; 5b7 + GetClock: ; 5b7 ; store clock data in hRTCDayHi-hRTCSeconds @@ -811,121 +821,62 @@ UpdatePalsIfCGB: ; c2f ld a, [hCGB] and a ret z - + + UpdateCGBPals: ; c33 ; return carry if successful ; any pals to update? ld a, [hCGBPalUpdate] and a ret z - + + ForceUpdateCGBPals: ; c37 -; save wram bank + ld a, [rSVBK] push af -; bankswitch ld a, 5 ; BANK(BGPals) ld [rSVBK], a -; get bg pal buffer + ld hl, BGPals ; 5:d080 - -; update bg pals + +; copy 8 pals to bgpd ld a, %10000000 ; auto increment, index 0 ld [rBGPI], a - ld c, rBGPD - rJOYP + ld c, rBGPD % $100 ld b, 4 ; NUM_PALS / 2 - .bgp -; copy 16 bytes (8 colors / 2 pals) to bgpd + rept $10 ld a, [hli] ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a -; done? + endr + dec b jr nz, .bgp ; hl is now 5:d0c0 OBPals -; update obj pals +; copy 8 pals to obpd ld a, %10000000 ; auto increment, index 0 ld [rOBPI], a ld c, rOBPD - rJOYP ld b, 4 ; NUM_PALS / 2 - .obp -; copy 16 bytes (8 colors / 2 pals) to obpd + rept $10 ld a, [hli] ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a - ld a, [hli] - ld [$ff00+c], a -; done? + endr + dec b jr nz, .obp -; restore wram bank pop af ld [rSVBK], a + ; clear pal update queue xor a ld [hCGBPalUpdate], a -; successfully updated palettes + scf ret ; c9f @@ -935,23 +886,22 @@ DmgToCgbBGPals: ; c9f ; exists to forego reinserting cgb-converted image data ; input: a -> bgp + ld [rBGP], a push af - -; check cgb + ld a, [hCGB] and a jr z, .end - + push hl push de push bc -; save wram bank - ld a, [$ff70] + ld a, [rSVBK] push af -; wram bank 5 + ld a, 5 - ld [$ff70], a + ld [rSVBK], a ; copy & reorder bg pal buffer ld hl, BGPals ; to @@ -959,15 +909,15 @@ DmgToCgbBGPals: ; c9f ; order ld a, [rBGP] ld b, a -; # pals - ld c, 8 ; all pals +; all pals + ld c, 8 call CopyPals ; request pal update - ld a, $1 + ld a, 1 ld [hCGBPalUpdate], a -; restore wram bank + pop af - ld [$ff70], a + ld [rSVBK], a pop bc pop de pop hl @@ -981,52 +931,51 @@ DmgToCgbObjPals: ; ccb ; exists to forego reinserting cgb-converted image data ; input: d -> obp1 -; e -> obp2 +; e -> obp2 + ld a, e ld [rOBP0], a ld a, d ld [rOBP1], a -; check cgb ld a, [hCGB] and a ret z - + push hl push de push bc -; save wram bank - ld a, [$ff70] + ld a, [rSVBK] push af -; wram bank 5 - ld a, $5 - ld [$ff70], a - + + ld a, 5 + ld [rSVBK], a + ; copy & reorder obj pal buffer - ; to - ld hl, OBPals - ; from - ld de, Unkn2Pals + ld hl, OBPals ; to + ld de, Unkn2Pals ; from ; order ld a, [rOBP0] ld b, a -; # pals - ld c, 8 ; all pals +; all pals + ld c, 8 call CopyPals ; request pal update - ld a, $1 + ld a, 1 ld [hCGBPalUpdate], a -; restore wram bank + pop af - ld [$ff70], a + ld [rSVBK], a pop bc pop de pop hl ret ; cf8 + INCBIN "baserom.gbc",$cf8,$d50 - $cf8 + CopyPals: ; d50 ; copy c palettes in order b from de to hl @@ -1079,54 +1028,67 @@ CopyPals: ; d50 ret ; d79 + INCBIN "baserom.gbc",$d79,$e8d - $d79 -; copy bc bytes from a:hl to de + FarCopyBytes: ; e8d +; copy bc bytes from a:hl to de + ld [hBuffer], a - ld a, [hROMBank] ; save old bank + ld a, [hROMBank] push af ld a, [hBuffer] rst Bankswitch + call CopyBytes + pop af rst Bankswitch ret ; 0xe9b -; copy bc*2 source bytes from a:hl to de, doubling each byte in process + FarCopyBytesDouble: ; e9b +; Copy bc bytes from a:hl to bc*2 bytes at de, +; doubling each byte in the process. + ld [hBuffer], a - ld a, [hROMBank] ; save current bank + ld a, [hROMBank] push af ld a, [hBuffer] - rst Bankswitch ; bankswitch - ld a, h ; switcheroo, de <> hl + rst Bankswitch + +; switcheroo, de <> hl + ld a, h ld h, d ld d, a ld a, l ld l, e ld e, a + inc b inc c - jr .dec ; 0xeab $4 + jr .dec + .loop ld a, [de] inc de - ld [hli], a ; write twice + ld [hli], a ld [hli], a .dec dec c jr nz, .loop dec b jr nz, .loop + pop af rst Bankswitch ret ; 0xeba -INCBIN "baserom.gbc",$eba,$fb6 - $eba +INCBIN "baserom.gbc", $eba, $fb6 - $eba ClearBox: ; fb6 @@ -1149,14 +1111,16 @@ ClearBox: ; fb6 ret ; fc8 + ClearTileMap: ; fc8 -; Fill TileMap with blank tiles +; Fill TileMap with blank tiles. + ld hl, TileMap ld a, " " ld bc, 360 ; screen dimensions 20*18 call ByteFill -; We aren't done if the LCD is on +; We aren't done if the LCD is on. ld a, [rLCDC] bit 7, a ret z @@ -1164,7 +1128,7 @@ ClearTileMap: ; fc8 ; fdb -INCBIN "baserom.gbc",$fdb,$fe8 - $fdb +INCBIN "baserom.gbc", $fdb, $fe8 - $fdb TextBox: ; fe8 @@ -1225,9 +1189,10 @@ TextBoxBorder: ; ff1 call NPlaceChar ld [hl], "┘" ret -; 0x101e +; 101e -NPlaceChar: ; 0x101e + +NPlaceChar: ; 101e ; place a row of width c of identical characters ld d,c .loop\@ @@ -1235,7 +1200,7 @@ NPlaceChar: ; 0x101e dec d jr nz,.loop\@ ret -; 0x1024 +; 1024 TextBoxPalette: ; 1024 @@ -1420,7 +1385,9 @@ CheckDict: ; 1087 jp NextChar ; 0x117b -INCBIN "baserom.gbc",$117b,$1203 - $117b + +INCBIN "baserom.gbc", $117b, $1203 - $117b + Char5D: ld a, [hBattleTurn] @@ -3143,11 +3110,11 @@ ClearPalettes: ; 3317 .cgb ; Save WRAM bank - ld a, [$ff70] + ld a, [rSVBK] push af ; WRAM bank 5 ld a, 5 - ld [$ff70], a + ld [rSVBK], a ; Fill BGPals and OBPals with $ffff (white) ld hl, BGPals ld bc, $0080 @@ -3155,7 +3122,7 @@ ClearPalettes: ; 3317 call ByteFill ; Restore WRAM bank pop af - ld [$ff70], a + ld [rSVBK], a ; Request palette update ld a, 1 ld [hCGBPalUpdate], a @@ -15316,11 +15283,11 @@ StartTitleScreen: ; 10ed67 call $6f06 ; Save WRAM bank - ld a, [$ff70] + ld a, [rSVBK] push af ; WRAM bank 5 ld a, 5 - ld [$ff70], a + ld [rSVBK], a ; Update palette colors ld hl, TitleScreenPalettes @@ -15335,17 +15302,17 @@ StartTitleScreen: ; 10ed67 ; Restore WRAM bank pop af - ld [$ff70], a + ld [rSVBK], a ; LY/SCX trickery starts here ; Save WRAM bank - ld a, [$ff70] + ld a, [rSVBK] push af ; WRAM bank 5 ld a, 5 - ld [$ff70], a + ld [rSVBK], a ; Make alternating lines come in from opposite sides @@ -15375,7 +15342,7 @@ StartTitleScreen: ; 10ed67 ; Restore WRAM bank pop af - ld [$ff70], a + ld [rSVBK], a ; Reset audio @@ -15770,10 +15737,10 @@ Function117bb6: ld [$cf63], a ret .asm_117be7 - ld a, [$ff70] + ld a, [rSVBK] push af ld a, $3 - ld [$ff70], a + ld [rSVBK], a ld a, [$cd89] and $1 jr nz, .asm_117c16 ; 0x117bf3 $21 @@ -15797,20 +15764,20 @@ Function117bb6: jr .asm_117c20 ; 0x117c14 $a .asm_117c16 pop af - ld [$ff70], a + ld [rSVBK], a ld a, $d3 ld [$c300], a jr .asm_117bd0 ; 0x117c1e $b0 .asm_117c20 pop af - ld [$ff70], a + ld [rSVBK], a ld a, $5c ld hl, $6eb9 rst FarCall - ld a, [$ff70] + ld a, [rSVBK] push af ld a, $3 - ld [$ff70], a + ld [rSVBK], a ld a, $7 call GetSRAMBank ld hl, $d002 @@ -15819,7 +15786,7 @@ Function117bb6: call CopyBytes call CloseSRAM pop af - ld [$ff70], a + ld [rSVBK], a jp Function117cdd Function117c4a: @@ -15832,10 +15799,10 @@ Function117c4a: rst FarCall ld hl, MobileStadiumSuccessText call $1057 - ld a, [$ff70] + ld a, [rSVBK] push af ld a, $5 - ld [$ff70], a + ld [rSVBK], a ld hl, $d000 ld de, $0008 ld c, $8 @@ -15851,7 +15818,7 @@ Function117c4a: jr nz, .asm_117c71 ; 0x117c7b $f4 call $04b6 pop af - ld [$ff70], a + ld [rSVBK], a ld a, $80 ld [$cf63], a ret From 57b3127497c0929105b4a5a35468b533ca4a1d09 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 28 Mar 2013 01:37:57 -0400 Subject: [PATCH 022/112] Fix parameter spacing in incbins --- main.asm | 782 +++++++++++++++++++++++++++---------------------------- 1 file changed, 391 insertions(+), 391 deletions(-) diff --git a/main.asm b/main.asm index 59128a83b..470eb7508 100644 --- a/main.asm +++ b/main.asm @@ -56,7 +56,7 @@ Start: SECTION "start",HOME[$150] -INCBIN "baserom.gbc",$150,$283 - $150 +INCBIN "baserom.gbc", $150, $283 - $150 VBlank: ; 283 @@ -108,7 +108,7 @@ RTC: ; 46f ; 485 -INCBIN "baserom.gbc",$485,$52f - $485 +INCBIN "baserom.gbc", $485, $52f - $485 IncGradGBPalTable_01: ; 52f @@ -146,7 +146,7 @@ IncGradGBPalTable_01: ; 52f ; 547 -INCBIN "baserom.gbc",$547,$568 - $547 +INCBIN "baserom.gbc", $547, $568 - $547 DisableLCD: ; 568 @@ -201,7 +201,7 @@ EnableLCD: ; 58a AskTimer: ; 591 - INCBIN "baserom.gbc",$591,$59c - $591 + INCBIN "baserom.gbc", $591, $59c - $591 ; 59c @@ -384,7 +384,7 @@ FixTime: ; 61d ret ; 658 -INCBIN "baserom.gbc",$658,$691 - $658 +INCBIN "baserom.gbc", $658, $691 - $658 SetClock: ; 691 ; set clock data from hram @@ -434,13 +434,13 @@ SetClock: ; 691 ret ; 6c4 -INCBIN "baserom.gbc",$6c4,$92e - $6c4 +INCBIN "baserom.gbc", $6c4, $92e - $6c4 INCLUDE "joypad.asm" -INCBIN "baserom.gbc",$a1b,$b40 - $a1b +INCBIN "baserom.gbc", $a1b, $b40 - $a1b FarDecompress: ; b40 ; Decompress graphics data at a:hl to de @@ -973,7 +973,7 @@ DmgToCgbObjPals: ; ccb ; cf8 -INCBIN "baserom.gbc",$cf8,$d50 - $cf8 +INCBIN "baserom.gbc", $cf8, $d50 - $cf8 CopyPals: ; d50 @@ -1029,7 +1029,7 @@ CopyPals: ; d50 ; d79 -INCBIN "baserom.gbc",$d79,$e8d - $d79 +INCBIN "baserom.gbc", $d79, $e8d - $d79 FarCopyBytes: ; e8d @@ -1458,14 +1458,14 @@ Char5DText: ; 0x1276 Char5BText: ; 0x127e db "PC@" -INCBIN "baserom.gbc",$1281,$1293 - $1281 +INCBIN "baserom.gbc", $1281, $1293 - $1281 Char56Text: ; 0x1293 db "…@" Char5AText: ; 0x1295 db "Enemy @" -INCBIN "baserom.gbc",$129c,$1356 - $129c +INCBIN "baserom.gbc", $129c, $1356 - $129c Char5F: ; 0x1356 ; ends a Pokédex entry @@ -1473,7 +1473,7 @@ Char5F: ; 0x1356 pop hl ret -INCBIN "baserom.gbc",$135a,$15d8 - $135a +INCBIN "baserom.gbc", $135a, $15d8 - $135a DMATransfer: ; 15d8 ; DMA transfer @@ -2083,7 +2083,7 @@ SafeTileAnimation: ; 17d3 ret ; 17ff -INCBIN "baserom.gbc",$17ff,$185d - $17ff +INCBIN "baserom.gbc", $17ff, $185d - $17ff GetTileType: ; 185d ; checks the properties of a tile @@ -2108,7 +2108,7 @@ GetTileType: ; 185d ret ; 1875 -INCBIN "baserom.gbc",$1875,$2063 - $1875 +INCBIN "baserom.gbc", $1875, $2063 - $1875 AskSerial: ; 2063 ; send out a handshake while serial int is off @@ -2148,7 +2148,7 @@ AskSerial: ; 2063 ret ; 208a -INCBIN "baserom.gbc",$208a,$209e - $208a +INCBIN "baserom.gbc", $208a, $209e - $208a GameTimer: ; 209e ; precautionary @@ -2278,7 +2278,7 @@ UpdateGameTimer: ; 20ad ret ; 210f -INCBIN "baserom.gbc",$210f,$261f - $210f +INCBIN "baserom.gbc", $210f, $261f - $210f PushScriptPointer: ; 261f ; used to call a script from asm @@ -2302,7 +2302,7 @@ PushScriptPointer: ; 261f ret ; 2631 -INCBIN "baserom.gbc",$2631,$26d4 - $2631 +INCBIN "baserom.gbc", $2631, $26d4 - $2631 GetScriptByte: ; 0x26d4 ; Return byte at ScriptBank:ScriptPos in a. @@ -2347,7 +2347,7 @@ ObjectEventText: db "@" ; 0x26f7 -INCBIN "baserom.gbc",$26f7,$2bed-$26f7 +INCBIN "baserom.gbc", $26f7, $2bed-$26f7 GetMapHeaderPointer: ; 0x2bed ; Prior to calling this function, you must have switched banks so that @@ -2417,7 +2417,7 @@ GetAnyMapHeaderMember: ; 0x2c0c ret ; 0x2c1c -INCBIN "baserom.gbc",$2c1c,$2c7d-$2c1c +INCBIN "baserom.gbc", $2c1c, $2c7d-$2c1c GetSecondaryMapHeaderPointer: ; 0x2c7d ; returns the current map's secondary map header pointer in hl. @@ -2431,7 +2431,7 @@ GetSecondaryMapHeaderPointer: ; 0x2c7d pop bc ret -INCBIN "baserom.gbc",$2c8a,$2caf-$2c8a +INCBIN "baserom.gbc", $2c8a, $2caf-$2c8a GetWorldMapLocation: ; 0x2caf ; given a map group/id in bc, return its location on the Pokégear map. @@ -2447,7 +2447,7 @@ GetWorldMapLocation: ; 0x2caf ret ; 0x2cbd -INCBIN "baserom.gbc",$2cbd,$2d63-$2cbd +INCBIN "baserom.gbc", $2cbd, $2d63-$2cbd FarJpHl: ; 2d63 ; Jump to a:hl. @@ -2558,7 +2558,7 @@ Predef: ; 2d83 ret ; 2dba -INCBIN "baserom.gbc",$2dba,$2e6f-$2dba +INCBIN "baserom.gbc", $2dba, $2e6f-$2dba BitTable1Func: ; 0x2e6f ld hl, $da72 @@ -2750,7 +2750,7 @@ JpHl: ; 2fec jp [hl] ; 2fed -INCBIN "baserom.gbc",$2fed,$300b-$2fed +INCBIN "baserom.gbc", $2fed, $300b-$2fed ClearSprites: ; 300b ld hl, Sprites @@ -2871,7 +2871,7 @@ GetFarHalfword: ; 0x305d ret ; 0x306b -INCBIN "baserom.gbc",$306b,$30d6-$306b +INCBIN "baserom.gbc", $306b, $30d6-$306b CopyName1: ; 30d6 ld hl, StringBuffer2 @@ -2894,7 +2894,7 @@ IsInArray: ; 30e1 ld c,a .loop\@ ld a,[hl] - cp a,$FF + cp a, $FF jr z,.NotInArray\@ cp c jr z,.InArray\@ @@ -2932,7 +2932,7 @@ AddNTimes: ; 0x30fe ret ; 0x3105 -INCBIN "baserom.gbc",$3105,$3119-$3105 +INCBIN "baserom.gbc", $3105, $3119-$3105 Multiply: ; 0x3119 ; function to do multiplication @@ -2942,7 +2942,7 @@ Multiply: ; 0x3119 ; ffb7 = multiplier ; OUTPUT ; ffb3-ffb6 = product - INCBIN "baserom.gbc",$3119,$3124 - $3119 + INCBIN "baserom.gbc", $3119, $3124 - $3119 ; 0x3124 Divide: ; 0x3124 @@ -2955,10 +2955,10 @@ Divide: ; 0x3124 ; OUTPUT ; ffb4-ffb6 = quotient ; ffb7 = remainder - INCBIN "baserom.gbc",$3124,$3136 - $3124 + INCBIN "baserom.gbc", $3124, $3136 - $3124 ; 0x3136 -INCBIN "baserom.gbc",$3136,$313d - $3136 +INCBIN "baserom.gbc", $3136, $313d - $3136 PrintLetterDelay: ; 313d ; wait some frames before printing the next letter @@ -3062,7 +3062,7 @@ CopyDataUntil: ; 318c ret ; 0x3198 -INCBIN "baserom.gbc",$3198,$31db - $3198 +INCBIN "baserom.gbc", $3198, $31db - $3198 StringCmp: ; 31db ; Compare strings, c bytes in length, at de and hl. @@ -3077,7 +3077,7 @@ StringCmp: ; 31db ret ; 0x31e4 -INCBIN "baserom.gbc",$31e4,$31f3 - $31e4 +INCBIN "baserom.gbc", $31e4, $31f3 - $31e4 WhiteBGMap: ; 31f3 call ClearPalettes @@ -3091,7 +3091,7 @@ WaitBGMap: ; 31f6 ret ; 3200 -INCBIN "baserom.gbc",$3200,$3317 - $3200 +INCBIN "baserom.gbc", $3200, $3317 - $3200 ClearPalettes: ; 3317 ; Make all palettes white @@ -3149,7 +3149,7 @@ GetSGBLayout: ; 3340 jp Predef ; 334e -INCBIN "baserom.gbc",$334e,$335f - $334e +INCBIN "baserom.gbc", $334e, $335f - $334e CountSetBits: ; 0x335f ; function to count how many bits are set in a string of bytes @@ -3177,7 +3177,7 @@ CountSetBits: ; 0x335f ret ; 0x3376 -INCBIN "baserom.gbc",$3376,$33ab - $3376 +INCBIN "baserom.gbc", $3376, $33ab - $3376 NamesPointerTable: ; 33ab dbw BANK(PokemonNames), PokemonNames @@ -3239,7 +3239,7 @@ GetName: ; 33c3 ret ; 0x3411 -INCBIN "baserom.gbc",$3411,$3411 - $3411 +INCBIN "baserom.gbc", $3411, $3411 - $3411 GetNthString: ; 3411 ; Starting at hl, this function returns the start address of the ath string. @@ -3259,7 +3259,7 @@ GetNthString: ; 3411 ; 0x3420 -INCBIN "baserom.gbc",$3420,$3468 - $3420 +INCBIN "baserom.gbc", $3420, $3468 - $3420 GetItemName: ; 3468 @@ -3367,7 +3367,7 @@ GetBaseStats: ; 3856 ret ; 389c -INCBIN "baserom.gbc",$389c,$38a2 - $389c +INCBIN "baserom.gbc", $389c, $38a2 - $389c GetNick: ; 38a2 ; get the nickname of a partymon @@ -3789,7 +3789,7 @@ StartMusic: ; 3b97 ret ; 3bbc -INCBIN "baserom.gbc",$3bbc,$3be3 - $3bbc +INCBIN "baserom.gbc", $3bbc, $3be3 - $3bbc PlayCryHeader: ; 3be3 ; Play a cry given parameters in header de @@ -3890,7 +3890,7 @@ StartSFX: ; 3c23 ret ; 3c4e -INCBIN "baserom.gbc",$3c4e,$3c55-$3c4e +INCBIN "baserom.gbc", $3c4e, $3c55-$3c4e WaitSFX: ; 3c55 ; infinite loop until sfx is done playing @@ -3919,7 +3919,7 @@ WaitSFX: ; 3c55 ret ; 3c74 -INCBIN "baserom.gbc",$3c74,$3c97-$3c74 +INCBIN "baserom.gbc", $3c74, $3c97-$3c74 MaxVolume: ; 3c97 ld a, $77 ; max @@ -3939,7 +3939,7 @@ VolumeOff: ; 3ca3 ret ; 3ca8 -INCBIN "baserom.gbc",$3ca8,$3dde - $3ca8 +INCBIN "baserom.gbc", $3ca8, $3dde - $3ca8 CheckSFX: ; 3dde ; returns carry if sfx channels are active @@ -3962,7 +3962,7 @@ CheckSFX: ; 3dde ret ; 3dfe -INCBIN "baserom.gbc",$3dfe,$3e10 - $3dfe +INCBIN "baserom.gbc", $3dfe, $3e10 - $3dfe ChannelsOff: ; 3e10 ; Quickly turn off music channels @@ -3986,12 +3986,12 @@ SFXChannelsOff: ; 3e21 ret ; 3e32 -INCBIN "baserom.gbc",$3e32,$3fb5 - $3e32 +INCBIN "baserom.gbc", $3e32, $3fb5 - $3e32 SECTION "bank1",DATA,BANK[$1] -INCBIN "baserom.gbc",$4000,$617c - $4000 +INCBIN "baserom.gbc", $4000, $617c - $4000 IntroFadePalettes: ; 0x617c db %01010100 @@ -4002,14 +4002,14 @@ IntroFadePalettes: ; 0x617c db %11100100 ; 6182 -INCBIN "baserom.gbc",$6182,$6274 - $6182 +INCBIN "baserom.gbc", $6182, $6274 - $6182 FarStartTitleScreen: ; 6274 callba StartTitleScreen ret ; 627b -INCBIN "baserom.gbc",$627b,$62bc - $627b +INCBIN "baserom.gbc", $627b, $62bc - $627b TitleScreenEntrance: ; 62bc @@ -4061,7 +4061,7 @@ TitleScreenEntrance: ; 62bc ret ; 62f6 -INCBIN "baserom.gbc",$62f6,$669f - $62f6 +INCBIN "baserom.gbc", $62f6, $669f - $62f6 CheckNickErrors: ; 669f ; error-check monster nick before use @@ -4141,7 +4141,7 @@ CheckNickErrors: ; 669f db $ff ; end ; 66de -INCBIN "baserom.gbc",$66de,$6eef - $66de +INCBIN "baserom.gbc", $66de, $6eef - $66de DrawGraphic: ; 6eef ; input: @@ -4169,12 +4169,12 @@ DrawGraphic: ; 6eef ret ; 6f07 -INCBIN "baserom.gbc",$6f07,$747b - $6f07 +INCBIN "baserom.gbc", $6f07, $747b - $6f07 SECTION "bank2",DATA,BANK[$2] -INCBIN "baserom.gbc",$8000,$854b - $8000 +INCBIN "baserom.gbc", $8000, $854b - $8000 GetPredefFn: ; 854b ; input: @@ -4292,7 +4292,7 @@ PredefPointers: ; 856b dwb $43ff, $2d ; 864c -INCBIN "baserom.gbc",$864c,$8a68 - $864c +INCBIN "baserom.gbc", $864c, $8a68 - $864c CheckShininess: ; 0x8a68 ; given a pointer to Attack/Defense DV in bc, determine if monster is shiny. @@ -4320,7 +4320,7 @@ CheckShininess: ; 0x8a68 and a ; clear carry flag ret -INCBIN "baserom.gbc",$8a88,$9a52-$8a88 +INCBIN "baserom.gbc", $8a88, $9a52-$8a88 CopyData: ; 0x9a52 ; copy bc bytes of data from hl to de @@ -4366,22 +4366,22 @@ DrawDefaultTiles: ; 0x9a64 ret ; 0x9a7a -INCBIN "baserom.gbc",$9a7a,$a51e - $9a7a +INCBIN "baserom.gbc", $9a7a, $a51e - $9a7a SGBBorder: INCBIN "gfx/misc/sgb_border.2bpp" -INCBIN "baserom.gbc",$a8be,$a8d6 - $a8be +INCBIN "baserom.gbc", $a8be, $a8d6 - $a8be PokemonPalettes: INCLUDE "gfx/pics/palette_pointers.asm" -INCBIN "baserom.gbc",$b0ae,$b0d2 - $b0ae +INCBIN "baserom.gbc", $b0ae, $b0d2 - $b0ae TrainerPalettes: INCLUDE "gfx/trainers/palette_pointers.asm" -INCBIN "baserom.gbc",$b1de,$b319 - $b1de +INCBIN "baserom.gbc", $b1de, $b319 - $b1de MornPal: ; 0xb319 INCBIN "tilesets/morn.pal" @@ -4399,185 +4399,185 @@ DarkPal: ; 0xb3d9 INCBIN "tilesets/dark.pal" ; 0xb419 -INCBIN "baserom.gbc",$b419,$b825 - $b419 +INCBIN "baserom.gbc", $b419, $b825 - $b419 SECTION "bank3",DATA,BANK[$3] -INCBIN "baserom.gbc",$c000,$29 +INCBIN "baserom.gbc", $c000, $29 SpecialsPointers: ; 0xc029 - dbw $25,$7c28 - dbw $0a,$5ce8 - dbw $0a,$5d11 - dbw $0a,$5d92 - dbw $0a,$5e66 - dbw $0a,$5e82 - dbw $0a,$5efa - dbw $0a,$5eee - dbw $0a,$5c92 - dbw $0a,$5cf1 - dbw $0a,$5cfa - dbw $0a,$5bfb - dbw $0a,$5c7b - dbw $0a,$5ec4 - dbw $0a,$5ed9 - dbw $0a,$5eaf - dbw $0a,$5f47 - dbw $03,$42f6 - dbw $03,$4309 - dbw $41,$50b9 - dbw $03,$434a - dbw $13,$59e5 - dbw $04,$7a12 - dbw $04,$7a31 - dbw $04,$75db - dbw $3e,$7b32 - dbw $3e,$7cd2 - dbw $03,$4658 - dbw $05,$559a - dbw $03,$42e7 - dbw $05,$66d6 - dbw $05,$672a - dbw $05,$6936 - dbw $0b,$4547 - dbw $05,$6218 - dbw $23,$4c04 - dbw $03,$429d - dbw $24,$4913 - dbw $03,$42c0 - dbw $03,$42cd - dbw $03,$4355 - dbw $03,$4360 - dbw $03,$4373 - dbw $03,$4380 - dbw $03,$438d - dbw $03,$43db - dbw $23,$4084 - dbw $23,$4092 - dbw $23,$40b6 - dbw $23,$4079 - dbw $23,$40ab - dbw $00,$0d91 - dbw $00,$31f3 - dbw $00,$0485 - dbw $00,$0fc8 - dbw $00,$1ad2 - dbw $00,$0e4a - dbw $03,$4230 - dbw $03,$4252 + dbw $25, $7c28 + dbw $0a, $5ce8 + dbw $0a, $5d11 + dbw $0a, $5d92 + dbw $0a, $5e66 + dbw $0a, $5e82 + dbw $0a, $5efa + dbw $0a, $5eee + dbw $0a, $5c92 + dbw $0a, $5cf1 + dbw $0a, $5cfa + dbw $0a, $5bfb + dbw $0a, $5c7b + dbw $0a, $5ec4 + dbw $0a, $5ed9 + dbw $0a, $5eaf + dbw $0a, $5f47 + dbw $03, $42f6 + dbw $03, $4309 + dbw $41, $50b9 + dbw $03, $434a + dbw $13, $59e5 + dbw $04, $7a12 + dbw $04, $7a31 + dbw $04, $75db + dbw $3e, $7b32 + dbw $3e, $7cd2 + dbw $03, $4658 + dbw $05, $559a + dbw $03, $42e7 + dbw $05, $66d6 + dbw $05, $672a + dbw $05, $6936 + dbw $0b, $4547 + dbw $05, $6218 + dbw $23, $4c04 + dbw $03, $429d + dbw $24, $4913 + dbw $03, $42c0 + dbw $03, $42cd + dbw $03, $4355 + dbw $03, $4360 + dbw $03, $4373 + dbw $03, $4380 + dbw $03, $438d + dbw $03, $43db + dbw $23, $4084 + dbw $23, $4092 + dbw $23, $40b6 + dbw $23, $4079 + dbw $23, $40ab + dbw $00, $0d91 + dbw $00, $31f3 + dbw $00, $0485 + dbw $00, $0fc8 + dbw $00, $1ad2 + dbw $00, $0e4a + dbw $03, $4230 + dbw $03, $4252 dbw BANK(WaitSFX),WaitSFX - dbw $00,$3cdf - dbw $00,$3d47 - dbw $04,$6324 - dbw $02,$4379 - dbw $03,$425a - dbw $03,$4268 - dbw $03,$4276 - dbw $03,$4284 - dbw $03,$43ef - dbw $05,$7421 - dbw $05,$7440 - dbw $04,$79a8 - dbw $03,$43fc - dbw $09,$6feb - dbw $09,$7043 - dbw $01,$7305 - dbw $01,$737e - dbw $01,$73f7 + dbw $00, $3cdf + dbw $00, $3d47 + dbw $04, $6324 + dbw $02, $4379 + dbw $03, $425a + dbw $03, $4268 + dbw $03, $4276 + dbw $03, $4284 + dbw $03, $43ef + dbw $05, $7421 + dbw $05, $7440 + dbw $04, $79a8 + dbw $03, $43fc + dbw $09, $6feb + dbw $09, $7043 + dbw $01, $7305 + dbw $01, $737e + dbw $01, $73f7 dbw BANK(SpecialCheckPokerus),SpecialCheckPokerus - dbw $09,$4b25 - dbw $09,$4b4e - dbw $09,$4ae8 - dbw $13,$587a - dbw $03,$4434 - dbw $03,$4422 - dbw $13,$59d3 - dbw $22,$4018 - dbw $03,$42b9 - dbw $03,$42da - dbw $01,$718d - dbw $01,$71ac - dbw $0a,$64ab - dbw $0a,$651f - dbw $0a,$6567 - dbw $05,$4209 - dbw $3e,$7841 + dbw $09, $4b25 + dbw $09, $4b4e + dbw $09, $4ae8 + dbw $13, $587a + dbw $03, $4434 + dbw $03, $4422 + dbw $13, $59d3 + dbw $22, $4018 + dbw $03, $42b9 + dbw $03, $42da + dbw $01, $718d + dbw $01, $71ac + dbw $0a, $64ab + dbw $0a, $651f + dbw $0a, $6567 + dbw $05, $4209 + dbw $3e, $7841 dbw BANK(SpecialSnorlaxAwake),SpecialSnorlaxAwake - dbw $01,$7413 - dbw $01,$7418 - dbw $01,$741d - dbw $03,$4472 - dbw $09,$65ee + dbw $01, $7413 + dbw $01, $7418 + dbw $01, $741d + dbw $03, $4472 + dbw $09, $65ee dbw BANK(SpecialGameboyCheck),SpecialGameboyCheck dbw BANK(SpecialTrainerHouse),SpecialTrainerHouse - dbw $05,$6dc7 + dbw $05, $6dc7 dbw BANK(SpecialRoamMons), SpecialRoamMons - dbw $03,$448f - dbw $03,$449f - dbw $03,$44ac - dbw $46,$6c3e - dbw $46,$7444 - dbw $46,$75e8 - dbw $46,$77e5 - dbw $46,$7879 - dbw $46,$7920 - dbw $46,$793b - dbw $5c,$40b0 - dbw $5c,$40ba - dbw $5c,$4114 - dbw $5c,$4215 - dbw $5c,$44e1 - dbw $5c,$421d - dbw $5c,$4b44 - dbw $46,$7a38 - dbw $5c,$4bd3 - dbw $45,$7656 - dbw $00,$0150 - dbw $40,$51f1 - dbw $40,$5220 - dbw $40,$5225 - dbw $40,$5231 - dbw $12,$525b - dbw $22,$6def - dbw $47,$41ab - dbw $5c,$4687 - dbw $22,$6e68 - dbw $5f,$5224 - dbw $5f,$52b6 - dbw $5f,$52ce - dbw $5f,$753d - dbw $40,$7612 + dbw $03, $448f + dbw $03, $449f + dbw $03, $44ac + dbw $46, $6c3e + dbw $46, $7444 + dbw $46, $75e8 + dbw $46, $77e5 + dbw $46, $7879 + dbw $46, $7920 + dbw $46, $793b + dbw $5c, $40b0 + dbw $5c, $40ba + dbw $5c, $4114 + dbw $5c, $4215 + dbw $5c, $44e1 + dbw $5c, $421d + dbw $5c, $4b44 + dbw $46, $7a38 + dbw $5c, $4bd3 + dbw $45, $7656 + dbw $00, $0150 + dbw $40, $51f1 + dbw $40, $5220 + dbw $40, $5225 + dbw $40, $5231 + dbw $12, $525b + dbw $22, $6def + dbw $47, $41ab + dbw $5c, $4687 + dbw $22, $6e68 + dbw $5f, $5224 + dbw $5f, $52b6 + dbw $5f, $52ce + dbw $5f, $753d + dbw $40, $7612 dbw BANK(SpecialHoOhChamber),SpecialHoOhChamber - dbw $40,$6142 - dbw $12,$589a - dbw $12,$5bf9 - dbw $13,$70bc - dbw $22,$6f6b - dbw $22,$6fd4 + dbw $40, $6142 + dbw $12, $589a + dbw $12, $5bf9 + dbw $13, $70bc + dbw $22, $6f6b + dbw $22, $6fd4 dbw BANK(SpecialDratini),SpecialDratini - dbw $04,$5485 + dbw $04, $5485 dbw BANK(SpecialBeastsCheck),SpecialBeastsCheck dbw BANK(SpecialMonCheck),SpecialMonCheck - dbw $03,$4225 - dbw $5c,$4bd2 - dbw $40,$766e - dbw $40,$77eb - dbw $40,$783c - dbw $41,$60a2 - dbw $05,$4168 - dbw $40,$77c2 - dbw $41,$630f - dbw $40,$7780 - dbw $40,$787b - dbw $12,$6e12 - dbw $41,$47eb - dbw $12,$6927 - dbw $24,$4a54 - dbw $24,$4a88 - dbw $03,$4224 + dbw $03, $4225 + dbw $5c, $4bd2 + dbw $40, $766e + dbw $40, $77eb + dbw $40, $783c + dbw $41, $60a2 + dbw $05, $4168 + dbw $40, $77c2 + dbw $41, $630f + dbw $40, $7780 + dbw $40, $787b + dbw $12, $6e12 + dbw $41, $47eb + dbw $12, $6927 + dbw $24, $4a54 + dbw $24, $4a88 + dbw $03, $4224 -INCBIN "baserom.gbc",$c224,$c3e2 - $c224 +INCBIN "baserom.gbc", $c224, $c3e2 - $c224 ScriptReturnCarry: ; c3e2 jr c, .carry @@ -4590,7 +4590,7 @@ ScriptReturnCarry: ; c3e2 ret ; c3ef -INCBIN "baserom.gbc",$c3ef,$c419 - $c3ef +INCBIN "baserom.gbc", $c3ef, $c419 - $c3ef SpecialCheckPokerus: ; c419 ; Check if a monster in your party has Pokerus @@ -4598,7 +4598,7 @@ SpecialCheckPokerus: ; c419 jp ScriptReturnCarry ; c422 -INCBIN "baserom.gbc",$c422,$c43d - $c422 +INCBIN "baserom.gbc", $c422, $c43d - $c422 SpecialSnorlaxAwake: ; 0xc43d ; Check if the Poké Flute channel is playing, and if the player is standing @@ -4642,14 +4642,14 @@ SpecialSnorlaxAwake: ; 0xc43d ret .ProximityCoords - db $21,$08 - db $22,$0a - db $23,$0a - db $24,$08 - db $24,$09 + db $21, $08 + db $22, $0a + db $23, $0a + db $24, $08 + db $24, $09 db $ff -INCBIN "baserom.gbc",$c472,$c478 - $c472 +INCBIN "baserom.gbc", $c472, $c478 - $c472 SpecialGameboyCheck: ; c478 ; check cgb @@ -4675,7 +4675,7 @@ SpecialGameboyCheck: ; c478 ld [ScriptVar], a ret -INCBIN "baserom.gbc",$c48f,$c4b9 - $c48f +INCBIN "baserom.gbc", $c48f, $c4b9 - $c48f SpecialTrainerHouse: ; 0xc4b9 ld a, 0 @@ -4684,10 +4684,10 @@ SpecialTrainerHouse: ; 0xc4b9 ld [ScriptVar], a jp CloseSRAM -INCBIN "baserom.gbc",$c4c7,$c5d2 - $c4c7 +INCBIN "baserom.gbc", $c4c7, $c5d2 - $c4c7 PrintNumber_PrintDigit: ; c5d2 -INCBIN "baserom.gbc",$c5d2,$c644 - $c5d2 +INCBIN "baserom.gbc", $c5d2, $c644 - $c5d2 PrintNumber_PrintLeadingZero: ; c644 ; prints a leading zero unless they are turned off in the flags @@ -4711,7 +4711,7 @@ PrintNumber_AdvancePointer: ; c64a ret ; 0xc658 -INCBIN "baserom.gbc",$c658,$c706 - $c658 +INCBIN "baserom.gbc", $c658, $c706 - $c658 GetPartyNick: ; c706 ; write CurPartyMon nickname to StringBuffer1-3 @@ -4805,7 +4805,7 @@ CheckPartyMove: ; c742 ret ; c779 -INCBIN "baserom.gbc",$c779,$c986 - $c779 +INCBIN "baserom.gbc", $c779, $c986 - $c779 UsedSurfScript: ; c986 ; print "[MON] used SURF!" @@ -4963,17 +4963,17 @@ AskSurfText: ; ca36 db "@" ; Want to SURF? ; ca3b -INCBIN "baserom.gbc",$ca3b,$fa0b - $ca3b +INCBIN "baserom.gbc", $ca3b, $fa0b - $ca3b SECTION "bank4",DATA,BANK[$4] -INCBIN "baserom.gbc",$10000,$10b16 - $10000 +INCBIN "baserom.gbc", $10000, $10b16 - $10000 PackGFX: INCBIN "gfx/misc/pack.2bpp" -INCBIN "baserom.gbc",$113d6,$1167a - $113d6 +INCBIN "baserom.gbc", $113d6, $1167a - $113d6 TechnicalMachines: ; 0x1167a db DYNAMICPUNCH @@ -5034,7 +5034,7 @@ TechnicalMachines: ; 0x1167a db WHIRLPOOL db WATERFALL -INCBIN "baserom.gbc",$116b3,$11ce7 - $116b3 +INCBIN "baserom.gbc", $116b3, $11ce7 - $116b3 NameInputLower: db "a b c d e f g h i" @@ -5063,7 +5063,7 @@ BoxNameInputUpper: db "- ? ! ♂ ♀ / . , &" db "lower DEL END " -INCBIN "baserom.gbc",$11e5d,$12976 - $11e5d +INCBIN "baserom.gbc", $11e5d, $12976 - $11e5d OpenPartyMenu: ; $12976 ld a, [PartyCount] @@ -5119,7 +5119,7 @@ OpenPartyMenu: ; $12976 ret ; 0x129d5 -INCBIN "baserom.gbc",$129d5,$12a88 - $129d5 +INCBIN "baserom.gbc", $129d5, $12a88 - $129d5 PokemonActionSubmenu ; 0x12a88 ld hl, $c5cd ; coord @@ -5168,7 +5168,7 @@ PokemonSubmenuActionPointerTable: ; 0x12ab0 ; no terminator? ; 0x12aec -INCBIN "baserom.gbc",$12aec,$12e00 - $12aec +INCBIN "baserom.gbc", $12aec, $12e00 - $12aec OpenPartyStats: ; 12e00 call $1d6e @@ -5184,7 +5184,7 @@ OpenPartyStats: ; 12e00 ret ; 0x12e1b -INCBIN "baserom.gbc",$12e1b,$13b87 - $12e1b +INCBIN "baserom.gbc", $12e1b, $13b87 - $12e1b GetSquareRoot: ; 13b87 ; Return the square root of de in b. @@ -5221,7 +5221,7 @@ root set root+1 SECTION "bank5",DATA,BANK[$5] -INCBIN "baserom.gbc",$14000,$14032 - $14000 +INCBIN "baserom.gbc", $14000, $14032 - $14000 GetTimeOfDay: ; 14032 ; get time of day based on the current hour @@ -5257,7 +5257,7 @@ TimeOfDayTable: ; 14044 db 24, $02 ; NITE ; 1404c -INCBIN "baserom.gbc",$1404c,$152ab - $1404c +INCBIN "baserom.gbc", $1404c, $152ab - $1404c BlackoutPoints: ; 0x152ab db GROUP_KRISS_HOUSE_2F, MAP_KRISS_HOUSE_2F, 3, 3 @@ -5290,7 +5290,7 @@ BlackoutPoints: ; 0x152ab db GROUP_FAST_SHIP_CABINS_SW_SSW_NW, MAP_FAST_SHIP_CABINS_SW_SSW_NW, 6, 2 db $ff, $ff, $ff, $ff -INCBIN "baserom.gbc",$1531f,$174ba - $1531f +INCBIN "baserom.gbc", $1531f, $174ba - $1531f SECTION "bank6",DATA,BANK[$6] @@ -5600,7 +5600,7 @@ INCLUDE "stats/egg_moves.asm" SECTION "bank9",DATA,BANK[$9] -INCBIN "baserom.gbc",$24000,$270c4 - $24000 +INCBIN "baserom.gbc", $24000, $270c4 - $24000 GetTrainerDVs: ; 270c4 ; get dvs based on trainer class @@ -5708,7 +5708,7 @@ INCBIN "baserom.gbc", $2732e, $27a2d - $2732e SECTION "bankA",DATA,BANK[$A] -INCBIN "baserom.gbc",$28000,$2a2a0 - $28000 +INCBIN "baserom.gbc", $28000, $2a2a0 - $28000 SpecialRoamMons: ; 2a2a0 ; initialize RoamMon structs @@ -5755,7 +5755,7 @@ SpecialRoamMons: ; 2a2a0 ret ; 2a2ce -INCBIN "baserom.gbc",$2a2ce,$2a5e9 - $2a2ce +INCBIN "baserom.gbc", $2a2ce, $2a5e9 - $2a2ce WildMons1: ; 0x2a5e9 @@ -5792,7 +5792,7 @@ INCBIN "gfx/misc/dude.lz" SECTION "bankB",DATA,BANK[$B] -INCBIN "baserom.gbc",$2C000,$2c1ef - $2C000 +INCBIN "baserom.gbc", $2C000, $2c1ef - $2C000 TrainerClassNames: ; 2c1ef db "LEADER@" @@ -5863,7 +5863,7 @@ TrainerClassNames: ; 2c1ef db "ROCKET@" db "MYSTICALMAN@" -INCBIN "baserom.gbc",$2C41a,$2ee8f - $2C41a +INCBIN "baserom.gbc", $2C41a, $2ee8f - $2C41a ; XXX this is not the start of the routine ; determine what music plays in battle @@ -5946,7 +5946,7 @@ INCBIN "baserom.gbc",$2C41a,$2ee8f - $2C41a pop hl ret -INCBIN "baserom.gbc",$2ef18,$2ef9f - $2ef18 +INCBIN "baserom.gbc", $2ef18, $2ef9f - $2ef18 SECTION "bankC",DATA,BANK[$C] @@ -6038,7 +6038,7 @@ Tileset30GFX: ; 0x326b0 INCBIN "gfx/tilesets/30.lz" ; 0x329ed -INCBIN "baserom.gbc",$329ed,$333f0 - $329ed +INCBIN "baserom.gbc", $329ed, $333f0 - $329ed SECTION "bankD",DATA,BANK[$D] @@ -6048,7 +6048,7 @@ INCLUDE "battle/effect_commands.asm" SECTION "bankE",DATA,BANK[$E] -INCBIN "baserom.gbc",$38000,$39999 - $38000 +INCBIN "baserom.gbc", $38000, $39999 - $38000 TrainerGroups: ; 0x39999 INCLUDE "trainers/trainer_pointers.asm" @@ -6197,13 +6197,13 @@ KantoGymLeaders: db BLUE db $ff -INCBIN "baserom.gbc",$3d14e,$3ddc2 - $3d14e +INCBIN "baserom.gbc", $3d14e, $3ddc2 - $3d14e ld hl, RecoveredUsingText jp $3ad5 ; 0x3ddc8 -INCBIN "baserom.gbc",$3ddc8,$3e8eb - $3ddc8 +INCBIN "baserom.gbc", $3ddc8, $3e8eb - $3ddc8 LoadEnemyMon: ; 3e8eb ; Initialize enemy monster parameters @@ -7021,7 +7021,7 @@ INCLUDE "battle/effect_command_pointers.asm" SECTION "bank10",DATA,BANK[$10] -INCBIN "baserom.gbc",$40000,$40c65-$40000 +INCBIN "baserom.gbc", $40000, $40c65-$40000 AlphabeticalPokedexOrder: ; 0x40c65 INCLUDE "stats/pokedex/order_alpha.asm" @@ -7029,12 +7029,12 @@ INCLUDE "stats/pokedex/order_alpha.asm" NewPokedexOrder: ; 0x40d60 INCLUDE "stats/pokedex/order_new.asm" -INCBIN "baserom.gbc",$40e5b,$41afb-$40e5b +INCBIN "baserom.gbc", $40e5b, $41afb-$40e5b Moves: ; 0x41afb INCLUDE "battle/moves/moves.asm" -INCBIN "baserom.gbc",$421d8,$425b1-$421d8 +INCBIN "baserom.gbc", $421d8, $425b1-$421d8 EvosAttacksPointers: ; 0x425b1 INCLUDE "stats/evos_attacks_pointers.asm" @@ -7044,22 +7044,22 @@ INCLUDE "stats/evos_attacks.asm" SECTION "bank11",DATA,BANK[$11] -INCBIN "baserom.gbc",$44000,$44378 - $44000 +INCBIN "baserom.gbc", $44000, $44378 - $44000 PokedexDataPointerTable: ; 0x44378 INCLUDE "stats/pokedex/entry_pointers.asm" -INCBIN "baserom.gbc",$4456e,$44997 - $4456e +INCBIN "baserom.gbc", $4456e, $44997 - $4456e SECTION "bank12",DATA,BANK[$12] -INCBIN "baserom.gbc",$48000,$48e9b - $48000 +INCBIN "baserom.gbc", $48000, $48e9b - $48000 PackFGFX: INCBIN "gfx/misc/pack_f.2bpp" -INCBIN "baserom.gbc",$4925b,$49962 - $4925b +INCBIN "baserom.gbc", $4925b, $49962 - $4925b SpecialCelebiGFX: INCBIN "gfx/special/celebi/leaf.2bpp" @@ -7068,7 +7068,7 @@ INCBIN "gfx/special/celebi/2.2bpp" INCBIN "gfx/special/celebi/3.2bpp" INCBIN "gfx/special/celebi/4.2bpp" -INCBIN "baserom.gbc",$49aa2,$49d24 - $49aa2 +INCBIN "baserom.gbc", $49aa2, $49d24 - $49aa2 ContinueText: ; 0x49d24 db "CONTINUE@" @@ -7165,7 +7165,7 @@ StudiumMenu: ; 0x49d9e db MOBILE_STUDIUM db $ff -INCBIN "baserom.gbc",$49da4,$4a6e8 - $49da4 +INCBIN "baserom.gbc", $49da4, $4a6e8 - $49da4 SpecialBeastsCheck: ; 0x4a6e8 ; Check if the player owns all three legendary beasts. @@ -7425,7 +7425,7 @@ UpdateOTPointer: ; 0x4a83a ret ; 0x4a843 -INCBIN "baserom.gbc",$4a843,$4ae78 - $4a843 +INCBIN "baserom.gbc", $4a843, $4ae78 - $4a843 SECTION "bank13",DATA,BANK[$13] @@ -7539,7 +7539,7 @@ Tileset20PalMap: ; 0x4caf5 INCBIN "tilesets/20_palette_map.bin" ; 0x4cb65 -INCBIN "baserom.gbc",$4cb65,$4cbd5-$4cb65 +INCBIN "baserom.gbc", $4cb65, $4cbd5-$4cb65 Tileset29PalMap: ; 0x4cbd5 INCBIN "tilesets/29_palette_map.bin" @@ -7934,7 +7934,7 @@ CheckPokerus: ; 4d860 ret ; 4d87a -INCBIN "baserom.gbc",$4d87a,$4dc8a - $4d87a +INCBIN "baserom.gbc", $4d87a, $4dc8a - $4d87a StatsScreenInit: ; 4dc8a ld hl, StatsScreenMain @@ -7997,7 +7997,7 @@ StatsScreenMain: ; 0x4dcd2 ret ; 0x4dcf7 -INCBIN "baserom.gbc",$4dcf7,$4dd2a - $4dcf7 +INCBIN "baserom.gbc", $4dcf7, $4dd2a - $4dcf7 StatsScreenPointerTable: ; 4dd2a dw $5d72 ; regular pokémon @@ -8011,7 +8011,7 @@ StatsScreenPointerTable: ; 4dd2a ; 4dd3a -INCBIN "baserom.gbc",$4dd3a,$4dda1 - $4dd3a +INCBIN "baserom.gbc", $4dd3a, $4dda1 - $4dd3a EggStatsInit: ; 4dda1 call EggStatsScreen @@ -8021,7 +8021,7 @@ EggStatsInit: ; 4dda1 ret ; 0x4ddac -INCBIN "baserom.gbc",$4ddac,$4e21e - $4ddac +INCBIN "baserom.gbc", $4ddac, $4e21e - $4ddac IDNoString: ; 4e21e db $73, "â„–.@" @@ -8030,7 +8030,7 @@ OTString: ; 4e222 db "OT/@" ; 4e226 -INCBIN "baserom.gbc",$4e226,$4e33a - $4e226 +INCBIN "baserom.gbc", $4e226, $4e33a - $4e226 EggStatsScreen: ; 4e33a xor a @@ -8107,18 +8107,18 @@ EggALotMoreTimeString: ; 0x4e46e ; 0x4e497 -INCBIN "baserom.gbc",$4e497,$4e831 - $4e497 +INCBIN "baserom.gbc", $4e497, $4e831 - $4e497 EvolutionGFX: INCBIN "gfx/evo/bubble_large.2bpp" INCBIN "gfx/evo/bubble.2bpp" -INCBIN "baserom.gbc",$4e881,$4f31c - $4e881 +INCBIN "baserom.gbc", $4e881, $4f31c - $4e881 SECTION "bank14",DATA,BANK[$14] -INCBIN "baserom.gbc",$50000,$5005f-$50000 +INCBIN "baserom.gbc", $50000, $5005f-$50000 WritePartyMenuTilemap: ; 0x5005f ld hl, Options @@ -8147,7 +8147,7 @@ WritePartyMenuTilemap: ; 0x5005f ret ; 0x50089 -INCBIN "baserom.gbc",$50089,$50457-$50089 +INCBIN "baserom.gbc", $50089, $50457-$50089 PartyMenuSelect: ; 0x50457 ; sets carry if exitted menu. @@ -8250,7 +8250,7 @@ ToWhichPKMNString: ; 0x50549 YouHaveNoPKMNString: ; 0x50556 db "You have no ", $e1, $e2, "!@" -INCBIN "baserom.gbc",$50566,$5097B-$50566 +INCBIN "baserom.gbc", $50566, $5097B-$50566 dw Normal, Fighting, Flying, Poison, Ground, Rock, Bird, Bug, Ghost, Steel dw Normal, Normal, Normal, Normal, Normal, Normal, Normal, Normal, Normal @@ -8424,7 +8424,7 @@ INCLUDE "stats/base_stats.asm" PokemonNames: INCLUDE "stats/pokemon_names.asm" -INCBIN "baserom.gbc",$53D84,$53e2e - $53D84 +INCBIN "baserom.gbc", $53D84, $53e2e - $53D84 SECTION "bank15",DATA,BANK[$15] @@ -8645,7 +8645,7 @@ INCLUDE "maps/Route12SuperRodHouse.asm" SECTION "bank20",DATA,BANK[$20] -INCBIN "baserom.gbc",$80000,$80430-$80000 +INCBIN "baserom.gbc", $80000, $80430-$80000 GetFlag2: ; 80430 ; Do action b on flag de from BitTable2 @@ -8737,7 +8737,7 @@ INCLUDE "bittable2.asm" ; 80648 -INCBIN "baserom.gbc",$80648,$80730-$80648 +INCBIN "baserom.gbc", $80648, $80730-$80648 BattleText_0x80730: ; 0x80730 db $0, $52, " picked up", $4f @@ -9844,12 +9844,12 @@ BattleText_0x8188e: ; 0x8188e db "left today!", $57 ; 0x818ac -INCBIN "baserom.gbc",$818ac,$81fe3-$818ac +INCBIN "baserom.gbc", $818ac, $81fe3-$818ac DebugColorTestGFX: INCBIN "gfx/debug/color_test.2bpp" -INCBIN "baserom.gbc",$82153,$823c8-$82153 +INCBIN "baserom.gbc", $82153, $823c8-$82153 SECTION "bank21",DATA,BANK[$21] @@ -10136,7 +10136,7 @@ INCBIN "baserom.gbc", $86455, $88000 - $86455 SECTION "bank22",DATA,BANK[$22] -INCBIN "baserom.gbc",$88000,$8832c - $88000 +INCBIN "baserom.gbc", $88000, $8832c - $88000 GetPlayerIcon: ; 8832c ; Get the player icon corresponding to gender @@ -10157,7 +10157,7 @@ GetPlayerIcon: ; 8832c ret ; 8833e -INCBIN "baserom.gbc",$8833e,$896ff - $8833e +INCBIN "baserom.gbc", $8833e, $896ff - $8833e ClearScreenArea: ; 0x896ff ; clears an area of the screen @@ -10194,7 +10194,7 @@ ClearScreenArea: ; 0x896ff ret ; 0x8971f -INCBIN "baserom.gbc",$8971f,$8addb - $8971f +INCBIN "baserom.gbc", $8971f, $8addb - $8971f SpecialHoOhChamber: ; 0x8addb ld hl, PartySpecies @@ -10209,7 +10209,7 @@ SpecialHoOhChamber: ; 0x8addb ret ; 0x8adef -INCBIN "baserom.gbc",$8adef,$8b170 - $8adef +INCBIN "baserom.gbc", $8adef, $8b170 - $8adef SpecialDratini: ; 0x8b170 ; if ScriptVar is 0 or 1, change the moveset of the last Dratini in the party. @@ -10322,12 +10322,12 @@ GetNthPartyMon: ; 0x8b1ce scf ret -INCBIN "baserom.gbc",$8b1e1,$8ba24-$8b1e1 +INCBIN "baserom.gbc", $8b1e1, $8ba24-$8b1e1 SECTION "bank23",DATA,BANK[$23] -INCBIN "baserom.gbc",$8c000,$8c011 - $8c000 +INCBIN "baserom.gbc", $8c000, $8c011 - $8c000 TimeOfDayPals: ; 8c011 ; return carry if pals are changed @@ -10437,7 +10437,7 @@ UpdateTimePals: ; 8c070 ret ; 8c079 -INCBIN "baserom.gbc",$8c079,$8c117 - $8c079 +INCBIN "baserom.gbc", $8c079, $8c117 - $8c079 GetTimePalette: ; 8c117 ; get time of day @@ -10506,7 +10506,7 @@ DmgToCgbTimePals: ; 8c14e ret ; 8c15e -INCBIN "baserom.gbc",$8c15e,$8c17c - $8c15e +INCBIN "baserom.gbc", $8c15e, $8c17c - $8c15e GetTimePalFade: ; 8c17c ; check cgb @@ -10701,7 +10701,7 @@ GetTimePalFade: ; 8c17c db %00000000 ; 8c20f -INCBIN "baserom.gbc",$8c20f,$8e9ac - $8c20f +INCBIN "baserom.gbc", $8c20f, $8e9ac - $8c20f GetSpeciesIcon: ; 8e9ac ; Load species icon into VRAM at tile a @@ -10715,7 +10715,7 @@ GetSpeciesIcon: ; 8e9ac ret ; 8e9bc -INCBIN "baserom.gbc",$8e9bc,$8e9de - $8e9bc +INCBIN "baserom.gbc", $8e9bc, $8e9de - $8e9bc GetIconGFX: ; 8e9de call GetIcon_a @@ -10785,7 +10785,7 @@ GetGFXUnlessMobile: ; 8ea3f jp $dc9 ; 8ea4a -INCBIN "baserom.gbc",$8ea4a,$8eab3 - $8ea4a +INCBIN "baserom.gbc", $8ea4a, $8eab3 - $8ea4a ReadMonMenuIcon: ; 8eab3 cp EGG @@ -11139,7 +11139,7 @@ BigmonIcon: INCBIN "gfx/icon/bigmon.2bpp" ; 0x8fe8d SECTION "bank24",DATA,BANK[$24] -INCBIN "baserom.gbc",$90000,$909F2-$90000 +INCBIN "baserom.gbc", $90000, $909F2-$90000 dw Sunday dw Monday @@ -11666,11 +11666,11 @@ INCLUDE "maps/map_headers.asm" INCLUDE "maps/second_map_headers.asm" -INCBIN "baserom.gbc",$966b0,$96cb1 - $966b0 +INCBIN "baserom.gbc", $966b0, $96cb1 - $966b0 INCLUDE "scripting.asm" -INCBIN "baserom.gbc",$97c20,$35e +INCBIN "baserom.gbc", $97c20, $35e SECTION "bank26",DATA,BANK[$26] @@ -11728,12 +11728,12 @@ INCLUDE "maps/BattleTowerOutside.asm" SECTION "bank28",DATA,BANK[$28] -INCBIN "baserom.gbc",$a0000,$a1eca - $a0000 +INCBIN "baserom.gbc", $a0000, $a1eca - $a0000 SECTION "bank29",DATA,BANK[$29] -INCBIN "baserom.gbc",$a4000,$a64ad - $a4000 +INCBIN "baserom.gbc", $a4000, $a64ad - $a4000 SECTION "bank2A",DATA,BANK[$2A] @@ -11758,7 +11758,7 @@ Route28_BlockData: ; 0xa8492 INCBIN "maps/Route28.blk" ; 0xa8546 -INCBIN "baserom.gbc",$a8546,$a8552 - $a8546 +INCBIN "baserom.gbc", $a8546, $a8552 - $a8546 CeladonCity_BlockData: ; 0xa8552 INCBIN "maps/CeladonCity.blk" @@ -11776,25 +11776,25 @@ ElmsHouse_BlockData: ; 0xa8930 INCBIN "maps/ElmsHouse.blk" ; 0xa8940 -INCBIN "baserom.gbc",$a8940,$5a +INCBIN "baserom.gbc", $a8940, $5a Route11_BlockData: ; 0xa899a INCBIN "maps/Route11.blk" ; 0xa8a4e -INCBIN "baserom.gbc",$a8a4e,$a8aa8 - $a8a4e +INCBIN "baserom.gbc", $a8a4e, $a8aa8 - $a8a4e Route15_BlockData: ; 0xa8aa8 INCBIN "maps/Route15.blk" ; 0xa8b5c -INCBIN "baserom.gbc",$a8b5c,$24 +INCBIN "baserom.gbc", $a8b5c, $24 Route19_BlockData: ; 0xa8b80 INCBIN "maps/Route19.blk" ; 0xa8c34 -INCBIN "baserom.gbc",$a8c34,$a8d9c - $a8c34 +INCBIN "baserom.gbc", $a8c34, $a8d9c - $a8c34 Route10South_BlockData: ; 0xa8d9c INCBIN "maps/Route10South.blk" @@ -11840,7 +11840,7 @@ Route24_BlockData: ; 0xa95ff INCBIN "maps/Route24.blk" ; 0xa9659 -INCBIN "baserom.gbc",$a9659,$a97c1 - $a9659 +INCBIN "baserom.gbc", $a9659, $a97c1 - $a9659 Route3_BlockData: ; 0xa97c1 INCBIN "maps/Route3.blk" @@ -11850,19 +11850,19 @@ PewterCity_BlockData: ; 0xa98cf INCBIN "maps/PewterCity.blk" ; 0xa9a37 -INCBIN "baserom.gbc",$a9a37,$a9bf9 - $a9a37 +INCBIN "baserom.gbc", $a9a37, $a9bf9 - $a9a37 Route12_BlockData: ; 0xa9bf9 INCBIN "maps/Route12.blk" ; 0xa9d07 -INCBIN "baserom.gbc",$a9d07,$168 +INCBIN "baserom.gbc", $a9d07, $168 Route20_BlockData: ; 0xa9e6f INCBIN "maps/Route20.blk" ; 0xa9f7d -INCBIN "baserom.gbc",$a9f7d,$a9ff7 - $a9f7d +INCBIN "baserom.gbc", $a9f7d, $a9ff7 - $a9f7d Route30_BlockData: ; 0xa9ff7 INCBIN "maps/Route30.blk" @@ -11892,7 +11892,7 @@ Route38_BlockData: ; 0xaa759 INCBIN "maps/Route38.blk" ; 0xaa80d -INCBIN "baserom.gbc",$aa80d,$5a +INCBIN "baserom.gbc", $aa80d, $5a OlivineVoltorbHouse_BlockData: ; 0xaa867 INCBIN "maps/OlivineVoltorbHouse.blk" @@ -11902,7 +11902,7 @@ SafariZoneFuchsiaGateBeta_BlockData: ; 0xaa877 INCBIN "maps/SafariZoneFuchsiaGateBeta.blk" ; 0xaa88b -INCBIN "baserom.gbc",$aa88b,$aaa4d - $aa88b +INCBIN "baserom.gbc", $aa88b, $aaa4d - $aa88b CinnabarIsland_BlockData: ; 0xaaa4d INCBIN "maps/CinnabarIsland.blk" @@ -11916,7 +11916,7 @@ Route8_BlockData: ; 0xaab5b INCBIN "maps/Route8.blk" ; 0xaac0f -INCBIN "baserom.gbc",$aac0f,$aac69 - $aac0f +INCBIN "baserom.gbc", $aac0f, $aac69 - $aac0f ViridianCity_BlockData: ; 0xaac69 INCBIN "maps/ViridianCity.blk" @@ -11930,13 +11930,13 @@ Route21_BlockData: ; 0xaaedf INCBIN "maps/Route21.blk" ; 0xaaf93 -INCBIN "baserom.gbc",$aaf93,$aafed - $aaf93 +INCBIN "baserom.gbc", $aaf93, $aafed - $aaf93 Route17_BlockData: ; 0xaafed INCBIN "maps/Route17.blk" ; 0xab1af -INCBIN "baserom.gbc",$ab1af,$ab209 - $ab1af +INCBIN "baserom.gbc", $ab1af, $ab209 - $ab1af Route31_BlockData: ; 0xab209 INCBIN "maps/Route31.blk" @@ -11966,13 +11966,13 @@ Route38EcruteakGate_BlockData: ; 0xab6af INCBIN "maps/Route38EcruteakGate.blk" ; 0xab6c3 -INCBIN "baserom.gbc",$ab6c3,$ab82b - $ab6c3 +INCBIN "baserom.gbc", $ab6c3, $ab82b - $ab6c3 VermilionCity_BlockData: ; 0xab82b INCBIN "maps/VermilionCity.blk" ; 0xab993 -INCBIN "baserom.gbc",$ab993,$abb55 - $ab993 +INCBIN "baserom.gbc", $ab993, $abb55 - $ab993 ElmsLab_BlockData: ; 0xabb55 INCBIN "maps/ElmsLab.blk" @@ -12005,7 +12005,7 @@ Route14_BlockData: ; 0xac000 INCBIN "maps/Route14.blk" ; 0xac0b4 -INCBIN "baserom.gbc",$ac0b4,$5a +INCBIN "baserom.gbc", $ac0b4, $5a OlivineMart_BlockData: ; 0xac10e INCBIN "maps/OlivineMart.blk" @@ -12015,19 +12015,19 @@ Route10North_BlockData: ; 0xac126 INCBIN "maps/Route10North.blk" ; 0xac180 -INCBIN "baserom.gbc",$ac180,$168 +INCBIN "baserom.gbc", $ac180, $168 OlivinePokeCenter1F_BlockData: ; 0xac2e8 INCBIN "maps/OlivinePokeCenter1F.blk" ; 0xac2fc -INCBIN "baserom.gbc",$ac2fc,$ac340 - $ac2fc +INCBIN "baserom.gbc", $ac2fc, $ac340 - $ac2fc EarlsPokemonAcademy_BlockData: ; 0xac340 INCBIN "maps/EarlsPokemonAcademy.blk" ; 0xac360 -INCBIN "baserom.gbc",$ac360,$ac3b4 - $ac360 +INCBIN "baserom.gbc", $ac360, $ac3b4 - $ac360 GoldenrodDeptStore1F_BlockData: ; 0xac3b4 INCBIN "maps/GoldenrodDeptStore1F.blk" @@ -12073,7 +12073,7 @@ CeladonMansionRoof_BlockData: ; 0xac4b4 INCBIN "maps/CeladonMansionRoof.blk" ; 0xac4c8 -INCBIN "baserom.gbc",$ac4c8,$ac4d8 - $ac4c8 +INCBIN "baserom.gbc", $ac4c8, $ac4d8 - $ac4c8 CeladonGameCorner_BlockData: ; 0xac4d8 INCBIN "maps/CeladonGameCorner.blk" @@ -12095,7 +12095,7 @@ EcruteakLugiaSpeechHouse_BlockData: ; 0xac54f INCBIN "maps/EcruteakLugiaSpeechHouse.blk" ; 0xac55f -INCBIN "baserom.gbc",$ac55f,$5a +INCBIN "baserom.gbc", $ac55f, $5a UnionCaveB1F_BlockData: ; 0xac5b9 INCBIN "maps/UnionCaveB1F.blk" @@ -12117,7 +12117,7 @@ Route6UndergroundEntrance_BlockData: ; 0xac9f1 INCBIN "maps/Route6UndergroundEntrance.blk" ; 0xaca01 -INCBIN "baserom.gbc",$aca01,$10 +INCBIN "baserom.gbc", $aca01, $10 KurtsHouse_BlockData: ; 0xaca11 INCBIN "maps/KurtsHouse.blk" @@ -12131,7 +12131,7 @@ RuinsofAlphOutside_BlockData: ; 0xaca8b INCBIN "maps/RuinsofAlphOutside.blk" ; 0xacb3f -INCBIN "baserom.gbc",$acb3f,$acb53 - $acb3f +INCBIN "baserom.gbc", $acb3f, $acb53 - $acb3f RuinsofAlphInnerChamber_BlockData: ; 0xacb53 INCBIN "maps/RuinsofAlphInnerChamber.blk" @@ -12145,19 +12145,19 @@ SproutTower1F_BlockData: ; 0xacbf3 INCBIN "maps/SproutTower1F.blk" ; 0xacc43 -INCBIN "baserom.gbc",$acc43,$acc4d - $acc43 +INCBIN "baserom.gbc", $acc43, $acc4d - $acc43 SproutTower2F_BlockData: ; 0xacc4d INCBIN "maps/SproutTower2F.blk" ; 0xacc9d -INCBIN "baserom.gbc",$acc9d,$acca7 - $acc9d +INCBIN "baserom.gbc", $acc9d, $acca7 - $acc9d SproutTower3F_BlockData: ; 0xacca7 INCBIN "maps/SproutTower3F.blk" ; 0xaccf7 -INCBIN "baserom.gbc",$accf7,$acd01 - $accf7 +INCBIN "baserom.gbc", $accf7, $acd01 - $accf7 RadioTower1F_BlockData: ; 0xacd01 INCBIN "maps/RadioTower1F.blk" @@ -12259,7 +12259,7 @@ UndergroundWarehouse_BlockData: ; 0xadf1c INCBIN "maps/UndergroundWarehouse.blk" ; 0xadf76 -INCBIN "baserom.gbc",$adf76,$19 +INCBIN "baserom.gbc", $adf76, $19 TinTower1F_BlockData: ; 0xadf8f INCBIN "maps/TinTower1F.blk" @@ -12309,7 +12309,7 @@ BurnedTowerB1F_BlockData: ; 0xae36d INCBIN "maps/BurnedTowerB1F.blk" ; 0xae3c7 -INCBIN "baserom.gbc",$ae3c7,$ae4d5 - $ae3c7 +INCBIN "baserom.gbc", $ae3c7, $ae4d5 - $ae3c7 MountMortar1FOutside_BlockData: ; 0xae4d5 INCBIN "maps/MountMortar1FOutside.blk" @@ -12391,7 +12391,7 @@ SilverCaveRoom3_BlockData: ; 0xaf399 INCBIN "maps/SilverCaveRoom3.blk" ; 0xaf44d -INCBIN "baserom.gbc",$af44d,$438 +INCBIN "baserom.gbc", $af44d, $438 MahoganyMart1F_BlockData: ; 0xaf885 INCBIN "maps/MahoganyMart1F.blk" @@ -12409,7 +12409,7 @@ TeamRocketBaseB3F_BlockData: ; 0xaf9a3 INCBIN "maps/TeamRocketBaseB3F.blk" ; 0xafa2a -INCBIN "baserom.gbc",$afa2a,$afa84 - $afa2a +INCBIN "baserom.gbc", $afa2a, $afa84 - $afa2a IndigoPlateauPokeCenter1F_BlockData: ; 0xafa84 INCBIN "maps/IndigoPlateauPokeCenter1F.blk" @@ -12455,7 +12455,7 @@ OlivineGym_BlockData: ; 0xafc7b INCBIN "maps/OlivineGym.blk" ; 0xafca3 -INCBIN "baserom.gbc",$afca3,$afcb7 - $afca3 +INCBIN "baserom.gbc", $afca3, $afcb7 - $afca3 CianwoodGym_BlockData: ; 0xafcb7 INCBIN "maps/CianwoodGym.blk" @@ -12496,7 +12496,7 @@ OlivineLighthouse6F_BlockData: ; 0xaff00 SECTION "bank2C",DATA,BANK[$2C] -INCBIN "baserom.gbc",$b0000,$b0023 - $b0000 +INCBIN "baserom.gbc", $b0000, $b0023 - $b0000 SlowpokeWellB1F_BlockData: ; 0xb0023 INCBIN "maps/SlowpokeWellB1F.blk" @@ -12554,7 +12554,7 @@ FastShipB1F_BlockData: ; 0xb0680 INCBIN "maps/FastShipB1F.blk" ; 0xb0700 -INCBIN "baserom.gbc",$b0700,$10 +INCBIN "baserom.gbc", $b0700, $10 FastShipCabins_NNW_NNE_NE_BlockData: ; 0xb0710 INCBIN "maps/FastShipCabins_NNW_NNE_NE.blk" @@ -12668,13 +12668,13 @@ CeladonGym_BlockData: ; 0xb0cb5 INCBIN "maps/CeladonGym.blk" ; 0xb0ce2 -INCBIN "baserom.gbc",$b0ce2,$b0cf6 - $b0ce2 +INCBIN "baserom.gbc", $b0ce2, $b0cf6 - $b0ce2 CeladonCafe_BlockData: ; 0xb0cf6 INCBIN "maps/CeladonCafe.blk" ; 0xb0d0e -INCBIN "baserom.gbc",$b0d0e,$18 +INCBIN "baserom.gbc", $b0d0e, $18 RockTunnel1F_BlockData: ; 0xb0d26 INCBIN "maps/RockTunnel1F.blk" @@ -12828,7 +12828,7 @@ BattleTowerOutside_BlockData: ; 0xb1a6e INCBIN "maps/BattleTowerOutside.blk" ; 0xb1afa -INCBIN "baserom.gbc",$b1afa,$28 +INCBIN "baserom.gbc", $b1afa, $28 GoldenrodDeptStoreRoof_BlockData: ; 0xb1b22 INCBIN "maps/GoldenrodDeptStoreRoof.blk" @@ -12954,7 +12954,7 @@ INCBIN "tilesets/16_collision.bin" SECTION "bank2E",DATA,BANK[$2E] -INCBIN "baserom.gbc",$B8000,$b8219 - $b8000 +INCBIN "baserom.gbc", $B8000, $b8219 - $b8000 Functionb8219: ; b8219 ; deals strictly with rockmon encounter @@ -13012,7 +13012,7 @@ GetTreeMonEncounterTable: ; b823f ret ; b825e -INCBIN "baserom.gbc",$B825E,$b82c5 - $b825e +INCBIN "baserom.gbc", $B825E, $b82c5 - $b825e WildRockMonMapTable: ; b82c5 db GROUP_CIANWOOD_CITY, MAP_CIANWOOD_CITY, $07 @@ -13194,12 +13194,12 @@ WildRockMonTable: ; b83de db $ff ; end ; b83e5 -INCBIN "baserom.gbc",$b83e5,$b9e8b - $b83e5 +INCBIN "baserom.gbc", $b83e5, $b9e8b - $b83e5 SECTION "bank2F",DATA,BANK[$2F] -INCBIN "baserom.gbc",$bc000,$bc09c - $bc000 +INCBIN "baserom.gbc", $bc000, $bc09c - $bc000 PokeCenterNurseScript: ; bc09c ; Talking to a nurse in a Pokemon Center @@ -13332,7 +13332,7 @@ PokeCenterNurseScript: ; bc09c end ; bc162 -INCBIN "baserom.gbc",$bc162,$bcea5-$bc162 +INCBIN "baserom.gbc", $bc162, $bcea5-$bc162 UnusedPhoneScript: ; 0xbcea5 3writetext BANK(UnusedPhoneText), UnusedPhoneText @@ -13388,13 +13388,13 @@ UnknownScript_0xbcee7: ; 0xbcee7 .violet ; 0xbcf15 displaylocation $7 ; sprout tower - 3call $3,$4edf + 3call $3, $4edf .azalea ; 0xbcf1b displaylocation $d ; slowpoke well - 3call $3,$4edf + 3call $3, $4edf .goldenrod ; 0xbcf21 displaylocation $11 ; radio tower - 3call $3,$4edf + 3call $3, $4edf 3writetext $6d, $411c keeptextopen 2jump UnknownScript_0xbcf37 @@ -13623,27 +13623,27 @@ ElmPhoneScript2: ; 0xbd081 specialphonecall $0000 end -INCBIN "baserom.gbc",$bd0d0,$be699-$bd0d0 +INCBIN "baserom.gbc", $bd0d0, $be699-$bd0d0 SECTION "bank30",DATA,BANK[$30] -INCBIN "baserom.gbc",$c0000,$c3fc0 - $c0000 +INCBIN "baserom.gbc", $c0000, $c3fc0 - $c0000 SECTION "bank31",DATA,BANK[$31] -INCBIN "baserom.gbc",$c4000,$c7f80 - $c4000 +INCBIN "baserom.gbc", $c4000, $c7f80 - $c4000 SECTION "bank32",DATA,BANK[$32] -INCBIN "baserom.gbc",$c8000,$cbe2b - $c8000 +INCBIN "baserom.gbc", $c8000, $cbe2b - $c8000 SECTION "bank33",DATA,BANK[$33] -INCBIN "baserom.gbc",$cc000, $cfd9e - $cc000 +INCBIN "baserom.gbc", $cc000, $cfd9e - $cc000 ; Songs iii @@ -13835,7 +13835,7 @@ INCBIN "tilesets/36_collision.bin" SECTION "bank38",DATA,BANK[$38] -INCBIN "baserom.gbc",$e0000,$e37f9 - $e0000 +INCBIN "baserom.gbc", $e0000, $e37f9 - $e0000 SECTION "bank39",DATA,BANK[$39] @@ -14143,13 +14143,13 @@ Music_BugCatchingContest: INCLUDE "audio/music/bugcatchingcontest.asm" SECTION "bank3E",DATA,BANK[$3E] FontExtra: -INCBIN "gfx/misc/font_extra.2bpp",$0,$200 +INCBIN "gfx/misc/font_extra.2bpp", $0, $200 Font: -INCBIN "gfx/misc/font.1bpp",$0,$400 +INCBIN "gfx/misc/font.1bpp", $0, $400 FontBattleExtra: -INCBIN "gfx/misc/font_battle_extra.2bpp",$0,$200 +INCBIN "gfx/misc/font_battle_extra.2bpp", $0, $200 INCBIN "baserom.gbc", $f8800, $f8ba0 - $f8800 @@ -14161,7 +14161,7 @@ INCBIN "baserom.gbc", $f8ea3, $fbbfc - $f8ea3 INCLUDE "battle/magikarp_length.asm" -INCBIN "baserom.gbc",$fbccf,$fbe91 - $fbccf +INCBIN "baserom.gbc", $fbccf, $fbe91 - $fbccf SECTION "bank3F",DATA,BANK[$3F] @@ -14268,7 +14268,7 @@ Tileset01Anim: ; 0xfc0a3 dw $0000, DoneTileAnimation ; 0xfc0d7 -INCBIN "baserom.gbc",$fc0d7,$fc12f-$fc0d7 +INCBIN "baserom.gbc", $fc0d7, $fc12f-$fc0d7 Tileset09Anim: ; 0xfc12f ; param, function @@ -14298,7 +14298,7 @@ Tileset15Anim: ; 0xfc15f dw $0000, DoneTileAnimation ; 0xfc17f -INCBIN "baserom.gbc",$fc17f,$fc1e7-$fc17f +INCBIN "baserom.gbc", $fc17f, $fc1e7-$fc17f Tileset24Anim: ; 0xfc1e7 Tileset30Anim: ; 0xfc1e7 @@ -14367,7 +14367,7 @@ Tileset23Anim: ; 0xfc27f dw $0000, DoneTileAnimation ; 0xfc2bf -INCBIN "baserom.gbc",$fc2bf,$fc2e7-$fc2bf +INCBIN "baserom.gbc", $fc2bf, $fc2e7-$fc2bf Tileset04Anim: ; 0xfc2e7 Tileset05Anim: ; 0xfc2e7 @@ -14702,7 +14702,7 @@ LoadTradesPointer: ; 0xfcdc2 ret ; 0xfcdd7 -INCBIN "baserom.gbc",$fcdd7,$fce58-$fcdd7 +INCBIN "baserom.gbc", $fcdd7, $fce58-$fcdd7 Trades: ; 0xfce58 ; byte 1: dialog @@ -14716,34 +14716,34 @@ Trades: ; 0xfce58 ; byte 31 gender ; byte 32 XXX always zero? - db 0,ABRA,MACHOP,"MUSCLE@@@@@",$37,$66,GOLD_BERRY,$54,$92,"MIKE@@@@@@@",0,0 - db 0,BELLSPROUT,ONIX,"ROCKY@@@@@@",$96,$66,BITTER_BERRY,$1e,$bf,"KYLE@@@@@@@",0,0 - db 1,KRABBY,VOLTORB,"VOLTY@@@@@@",$98,$88,PRZCUREBERRY,$05,$72,"TIM@@@@@@@@",0,0 - db 3,DRAGONAIR,DODRIO,"DORIS@@@@@@",$77,$66,SMOKE_BALL,$1b,$01,"EMY@@@@@@@@",2,0 - db 2,HAUNTER,XATU,"PAUL@@@@@@@",$96,$86,MYSTERYBERRY,$00,$3d,"CHRIS@@@@@@",0,0 - db 3,CHANSEY,AERODACTYL,"AEROY@@@@@@",$96,$66,GOLD_BERRY,$7b,$67,"KIM@@@@@@@@",0,0 - db 0,DUGTRIO,MAGNETON,"MAGGIE@@@@@",$96,$66,METAL_COAT,$a2,$c3,"FOREST@@@@@",0,0 + db 0,ABRA,MACHOP,"MUSCLE@@@@@", $37, $66,GOLD_BERRY, $54, $92,"MIKE@@@@@@@",0,0 + db 0,BELLSPROUT,ONIX,"ROCKY@@@@@@", $96, $66,BITTER_BERRY, $1e, $bf,"KYLE@@@@@@@",0,0 + db 1,KRABBY,VOLTORB,"VOLTY@@@@@@", $98, $88,PRZCUREBERRY, $05, $72,"TIM@@@@@@@@",0,0 + db 3,DRAGONAIR,DODRIO,"DORIS@@@@@@", $77, $66,SMOKE_BALL, $1b, $01,"EMY@@@@@@@@",2,0 + db 2,HAUNTER,XATU,"PAUL@@@@@@@", $96, $86,MYSTERYBERRY, $00, $3d,"CHRIS@@@@@@",0,0 + db 3,CHANSEY,AERODACTYL,"AEROY@@@@@@", $96, $66,GOLD_BERRY, $7b, $67,"KIM@@@@@@@@",0,0 + db 0,DUGTRIO,MAGNETON,"MAGGIE@@@@@", $96, $66,METAL_COAT, $a2, $c3,"FOREST@@@@@",0,0 -INCBIN "baserom.gbc",$fcf38,$fd1d2-$fcf38 +INCBIN "baserom.gbc", $fcf38, $fd1d2-$fcf38 SECTION "bank40",DATA,BANK[$40] -INCBIN "baserom.gbc",$100000,$10389d - $100000 +INCBIN "baserom.gbc", $100000, $10389d - $100000 SECTION "bank41",DATA,BANK[$41] -INCBIN "baserom.gbc",$104000,$104350 - $104000 +INCBIN "baserom.gbc", $104000, $104350 - $104000 INCBIN "gfx/ow/misc.2bpp" -INCBIN "baserom.gbc",$1045b0,$105258 - $1045b0 +INCBIN "baserom.gbc", $1045b0, $105258 - $1045b0 MysteryGiftGFX: INCBIN "gfx/misc/mystery_gift.2bpp" -INCBIN "baserom.gbc",$105688,$105930 - $105688 +INCBIN "baserom.gbc", $105688, $105930 - $105688 ; japanese mystery gift gfx INCBIN "gfx/misc/mystery_gift_jp.2bpp" @@ -15112,19 +15112,19 @@ UpdateUsedMoves: ; 105ed0 HallOfFame2: ; 0x105ef6 ret -INCBIN "baserom.gbc",$105ef7,$106078 - $105ef7 +INCBIN "baserom.gbc", $105ef7, $106078 - $105ef7 HallOfFame1: ; 0x106078 ret -INCBIN "baserom.gbc",$106079,$1060bb - $106079 +INCBIN "baserom.gbc", $106079, $1060bb - $106079 Function1060bb: ; 1060bb ; commented out ret ; 1060bc -INCBIN "baserom.gbc",$1060bc,$106dbc - $1060bc +INCBIN "baserom.gbc", $1060bc, $106dbc - $1060bc SECTION "bank42",DATA,BANK[$42] @@ -15511,7 +15511,7 @@ TitleScreenPalettes: SECTION "bank44",DATA,BANK[$44] -INCBIN "baserom.gbc",$110000,$110fad - $110000 +INCBIN "baserom.gbc", $110000, $110fad - $110000 URIPrefix: ; 0x110fad ascii "http://" @@ -15524,11 +15524,11 @@ HTTPUtilityURL: ; 0x110ffc HTTPRankingURL: ; 0x111020 ascii "gameboy.datacenter.ne.jp/cgb/ranking" -INCBIN "baserom.gbc",$111044,$113f84 - $111044 +INCBIN "baserom.gbc", $111044, $113f84 - $111044 SECTION "bank45",DATA,BANK[$45] -INCBIN "baserom.gbc",$114000,$117a7f - $114000 +INCBIN "baserom.gbc", $114000, $117a7f - $114000 ; everything from here to the end of the bank is related to the ; Mobile Stadium option from the continue/newgame menu. @@ -15854,10 +15854,10 @@ Function117c89: ret Data117cbc: ; 0x117cbc - db $40,$0c,$00,$11,$13,$00,$00,$00 + db $40, $0c, $00, $11, $13, $00, $00, $00 Data117cc4: ; 0x117cc4 - db $40,$07,$0e,$0b,$13,$00,$00,$00 ; XXX what is this + db $40, $07, $0e, $0b, $13, $00, $00, $00 ; XXX what is this YesNo117ccc: ; 0x117ccc db "ã�¯ã�„", $4e ; Yes @@ -15872,14 +15872,14 @@ MobileStadiumSuccessText: ; 0x117cd8 db "@" Function117cdd: ; 0x117cdd - ld hl,$cf63 + ld hl, $cf63 inc [hl] ret SECTION "bank46",DATA,BANK[$46] -INCBIN "baserom.gbc",$118000,$118ba5 - $118000 +INCBIN "baserom.gbc", $118000, $118ba5 - $118000 ExchangeDownloadURL: ; 0x118ba5 ascii "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/exchange/index.txt" @@ -15906,11 +15906,11 @@ IndexDownloadURL: ; 0x118ce4 db $0 -INCBIN "baserom.gbc",$118d35,$11bc9e - $118d35 +INCBIN "baserom.gbc", $118d35, $11bc9e - $118d35 SECTION "bank47",DATA,BANK[$47] -INCBIN "baserom.gbc",$11c000,$11f686 - $11c000 +INCBIN "baserom.gbc", $11c000, $11f686 - $11c000 SECTION "bank48",DATA,BANK[$48] @@ -16737,17 +16737,17 @@ INCBIN "gfx/pics/201r/back.lz" SECTION "bank5B",DATA,BANK[$5B] -INCBIN "baserom.gbc",$16c000,$16d7fe - $16c000 +INCBIN "baserom.gbc", $16c000, $16d7fe - $16c000 SECTION "bank5C",DATA,BANK[$5C] -INCBIN "baserom.gbc",$170000,$17367f - $170000 +INCBIN "baserom.gbc", $170000, $17367f - $170000 SECTION "bank5D",DATA,BANK[$5D] -INCBIN "baserom.gbc",$174000,$177561 - $174000 +INCBIN "baserom.gbc", $174000, $177561 - $174000 SECTION "bank5E",DATA,BANK[$5E] @@ -16765,17 +16765,17 @@ Music_SuicuneBattle: INCLUDE "audio/music/suicunebattle.asm" Music_BattleTowerLobby: INCLUDE "audio/music/battletowerlobby.asm" Music_MobileCenter: INCLUDE "audio/music/mobilecenter.asm" -INCBIN "baserom.gbc",$17982d, $1799ef - $17982d +INCBIN "baserom.gbc", $17982d, $1799ef - $17982d MobileAdapterGFX: INCBIN "gfx/misc/mobile_adapter.2bpp" -INCBIN "baserom.gbc",$17a68f, $17b629 - $17a68f +INCBIN "baserom.gbc", $17a68f, $17b629 - $17a68f SECTION "bank5F",DATA,BANK[$5F] -INCBIN "baserom.gbc",$17c000,$17ff6c - $17c000 +INCBIN "baserom.gbc", $17c000, $17ff6c - $17c000 SECTION "bank60",DATA,BANK[$60] @@ -17073,7 +17073,7 @@ INCLUDE "stats/pokedex/entries_2.asm" SECTION "bank6F",DATA,BANK[$6F] -INCBIN "baserom.gbc",$1bc000,$1be08d - $1bc000 +INCBIN "baserom.gbc", $1bc000, $1be08d - $1bc000 SECTION "bank70",DATA,BANK[$70] @@ -17217,13 +17217,13 @@ DudeAutoInput_DownA: ; 1de2af ; 1de2c5 -INCBIN "baserom.gbc",$1de2c5,$1de2e4 - $1de2c5 +INCBIN "baserom.gbc", $1de2c5, $1de2e4 - $1de2c5 PokegearGFX: ; 1de2e4 INCBIN "gfx/misc/pokegear.lz" ; 1de5c7 -INCBIN "baserom.gbc",$1de5c7,$1df238 - $1de5c7 +INCBIN "baserom.gbc", $1de5c7, $1df238 - $1de5c7 SECTION "bank78",DATA,BANK[$78] @@ -17253,26 +17253,26 @@ SECTION "bank7A",DATA,BANK[$7A] SECTION "bank7B",DATA,BANK[$7B] -INCBIN "baserom.gbc",$1ec000,$1ecf02 - $1ec000 +INCBIN "baserom.gbc", $1ec000, $1ecf02 - $1ec000 SECTION "bank7C",DATA,BANK[$7C] -INCBIN "baserom.gbc",$1f0000,$1f09d8 - $1f0000 +INCBIN "baserom.gbc", $1f0000, $1f09d8 - $1f0000 SECTION "bank7D",DATA,BANK[$7D] -INCBIN "baserom.gbc",$1f4000,$1f636a - $1f4000 +INCBIN "baserom.gbc", $1f4000, $1f636a - $1f4000 SECTION "bank7E",DATA,BANK[$7E] -INCBIN "baserom.gbc",$1f8000,$1fb8a8 - $1f8000 +INCBIN "baserom.gbc", $1f8000, $1fb8a8 - $1f8000 SECTION "bank7F",DATA,BANK[$7F] SECTION "stadium2",DATA[$8000-$220],BANK[$7F] -INCBIN "baserom.gbc",$1ffde0,$220 +INCBIN "baserom.gbc", $1ffde0, $220 From dc81d0cfcfa92ecfab99984ee674d0fe3e6c19cf Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 29 Mar 2013 18:54:13 -0400 Subject: [PATCH 023/112] dump move effects --- battle/moves/move_effects.asm | 2181 +++++++++++++++++++++++++++++++++ extras/crystal.py | 217 +++- main.asm | 4 +- preprocessor.py | 2 + 4 files changed, 2402 insertions(+), 2 deletions(-) create mode 100644 battle/moves/move_effects.asm diff --git a/battle/moves/move_effects.asm b/battle/moves/move_effects.asm new file mode 100644 index 000000000..a068f3e5a --- /dev/null +++ b/battle/moves/move_effects.asm @@ -0,0 +1,2181 @@ +Pound: +KarateChop: +MegaPunch: +Scratch: +Vicegrip: +Cut: +WingAttack: +Slam: +VineWhip: +MegaKick: +HornAttack: +Tackle: +WaterGun: +HydroPump: +Surf: +Peck: +DrillPeck: +Strength: +RazorLeaf: +RockThrow: +EggBomb: +Waterfall: +Crabhammer: +Slash: +Aeroblast: +Megahorn: +CrossChop: +Swift: +FaintAttack: +VitalThrow: +JumpKick: +HiJumpKick: +QuickAttack: +MachPunch: +Extremespeed: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Sing: +SleepPowder: +Hypnosis: +LovelyKiss: +Spore: + checkobedience + usedmovetext + doturn + checkhit + checksafeguard + sleeptarget + endmove + +PoisonSting: +Smog: +Sludge: +SludgeBomb: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + poisontarget + endmove + +Absorb: +MegaDrain: +LeechLife: +GigaDrain: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + draintarget + checkdestinybond + buildopponentrage + kingsrock + endmove + +FirePunch: +Ember: +Flamethrower: +FireBlast: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + burntarget + endmove + +IcePunch: +IceBeam: +Blizzard: +PowderSnow: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + freezetarget + endmove + +Thunderpunch: +BodySlam: +Thundershock: +Thunderbolt: +Lick: +ZapCannon: +Spark: +Dragonbreath: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + paralyzetarget + endmove + +Selfdestruct: +Explosion: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + selfdestruct + effect0x0b + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +DreamEater: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + eatdream + checkdestinybond + buildopponentrage + endmove + +MirrorMove: + checkobedience + usedmovetext + doturn + mirrormove + endmove + +Meditate: +Sharpen: + checkobedience + usedmovetext + doturn + attackup + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + +Harden: +Withdraw: + checkobedience + usedmovetext + doturn + defenseup + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + + checkobedience + usedmovetext + doturn + speedup + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + +Growth: + checkobedience + usedmovetext + doturn + specialattackup + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + + checkobedience + usedmovetext + doturn + specialdefenseup + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + + checkobedience + usedmovetext + doturn + accuracyup + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + +DoubleTeam: +Minimize: + checkobedience + usedmovetext + doturn + effect0x0a + evasionup + effect0x92 + effect0xa7 + effect0x0c + statmessageuser + statupfailtext + endmove + +SwordsDance: + checkobedience + usedmovetext + doturn + attackup2 + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + +Barrier: +AcidArmor: + checkobedience + usedmovetext + doturn + defenseup2 + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + +Agility: + checkobedience + usedmovetext + doturn + speedup2 + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + + checkobedience + usedmovetext + doturn + specialattackup2 + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + +Amnesia: + checkobedience + usedmovetext + doturn + specialdefenseup2 + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + + checkobedience + usedmovetext + doturn + accuracyup2 + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + + checkobedience + usedmovetext + doturn + evasionup2 + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + +Growl: + checkobedience + usedmovetext + doturn + checkhit + attackdown + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + +TailWhip: +Leer: + checkobedience + usedmovetext + doturn + checkhit + defensedown + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + +StringShot: + checkobedience + usedmovetext + doturn + checkhit + speeddown + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + + checkobedience + usedmovetext + doturn + checkhit + specialattackdown + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + + checkobedience + usedmovetext + doturn + checkhit + specialdefensedown + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + +SandAttack: +Smokescreen: +Kinesis: +Flash: + checkobedience + usedmovetext + doturn + checkhit + accuracydown + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + +SweetScent: + checkobedience + usedmovetext + doturn + checkhit + evasiondown + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + +Charm: + checkobedience + usedmovetext + doturn + checkhit + attackdown2 + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + +Screech: + checkobedience + usedmovetext + doturn + checkhit + defensedown2 + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + +CottonSpore: +ScaryFace: + checkobedience + usedmovetext + doturn + checkhit + speeddown2 + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + + checkobedience + usedmovetext + doturn + checkhit + specialattackdown2 + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + + checkobedience + usedmovetext + doturn + checkhit + specialdefensedown2 + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + + checkobedience + usedmovetext + doturn + checkhit + accuracydown2 + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + + checkobedience + usedmovetext + doturn + checkhit + evasiondown2 + effect0x0a + effect0x91 + effect0x0c + statmessagetarget + statdownfailtext + endmove + +AuroraBeam: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + attackdown + statmessagetarget + endmove + +Acid: +IronTail: +RockSmash: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + effectchance + defensedown + statmessagetarget + endmove + +Bubblebeam: +Constrict: +Bubble: +IcyWind: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + speeddown + statmessagetarget + endmove + + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + specialattackdown + statmessagetarget + endmove + +PsychicM: +Crunch: +ShadowBall: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + specialdefensedown + statmessagetarget + endmove + +MudSlap: +Octazooka: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + accuracydown + statmessagetarget + endmove + + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + evasiondown + statmessagetarget + endmove + +SteelWing: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + defenseup + statmessageuser + endmove + +MetalClaw: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + attackup + statmessageuser + endmove + +Ancientpower: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + allstatsup + endmove + +PayDay: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + payday + checkdestinybond + buildopponentrage + kingsrock + endmove + +Conversion: + checkobedience + usedmovetext + doturn + conversion + endmove + +Haze: + checkobedience + usedmovetext + doturn + resetstats + endmove + +Bide: + storeenergy + checkobedience + doturn + usedmovetext + unleashenergy + effect0xa3 + checkhit + hittarget + effect0xa5 + checkfaint + checkdestinybond + buildopponentrage + kingsrock + endmove + +Thrash: +PetalDance: +Outrage: + checkrampage + checkobedience + doturn + rampage + usedmovetext + checkhit + critical + damagecalc + itemmultiplier + stab + damagevariation + clearmissdamage + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Whirlwind: +Roar: + checkobedience + usedmovetext + doturn + checkhit + forceswitch + endmove + +Doubleslap: +CometPunch: +FuryAttack: +PinMissile: +SpikeCannon: +Barrage: +FurySwipes: +BoneRush: +DoubleKick: +Bonemerang: + checkobedience + usedmovetext + doturn + startloop + effect0x0a + checkhit + critical + damagecalc + itemmultiplier + stab + damagevariation + clearmissdamage + effect0x0b + resulttext + checkfaint + criticaltext + cleartext + supereffectivelooptext + checkdestinybond + buildopponentrage + endloop + effect0x0c + kingsrock + endmove + +Twineedle: + checkobedience + usedmovetext + doturn + startloop + effect0x0a + checkhit + effectchance + critical + damagecalc + itemmultiplier + stab + damagevariation + clearmissdamage + effect0x0b + resulttext + checkfaint + criticaltext + cleartext + supereffectivelooptext + checkdestinybond + buildopponentrage + endloop + effect0x0c + kingsrock + poisontarget + endmove + +RollingKick: +Headbutt: +Bite: +LowKick: +BoneClub: +RockSlide: +HyperFang: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + flinchtarget + endmove + +Guillotine: +HornDrill: +Fissure: + checkobedience + usedmovetext + doturn + stab + ohko + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + endmove + +TakeDown: +DoubleEdge: +Submission: +Struggle: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + recoil + checkdestinybond + buildopponentrage + kingsrock + endmove + +Mist: + checkobedience + usedmovetext + doturn + mist + endmove + +FocusEnergy: + checkobedience + usedmovetext + doturn + focusenergy + endmove + +Supersonic: +ConfuseRay: +SweetKiss: + checkobedience + usedmovetext + doturn + checkhit + checksafeguard + confuse + endmove + +Psybeam: +Confusion: +DizzyPunch: +Dynamicpunch: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + confusetarget + endmove + +Recover: +Softboiled: +Rest: +MilkDrink: + checkobedience + usedmovetext + doturn + heal + endmove + +Transform: + checkobedience + usedmovetext + doturn + transform + endmove + +LightScreen: +Reflect: + checkobedience + usedmovetext + doturn + screen + endmove + +TriAttack: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + tristatuschance + endmove + +Toxic: +Poisonpowder: +PoisonGas: + checkobedience + usedmovetext + doturn + checkhit + stab + checksafeguard + poison + endmove + +StunSpore: +ThunderWave: +Glare: + checkobedience + usedmovetext + doturn + stab + checkhit + checksafeguard + paralyze + endmove + +SkyAttack: + checkcharge + checkobedience + doturn + charge + usedmovetext + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + flinchtarget + kingsrock + endmove + +Substitute: + checkobedience + usedmovetext + doturn + substitute + endmove + +HyperBeam: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + rechargenextturn + checkdestinybond + buildopponentrage + endmove + +Rage: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + checkhit + ragedamage + damagevariation + hittarget + resulttext + rage + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Mimic: + checkobedience + usedmovetext + doturn + checkhit + mimic + endmove + +Metronome: + checkobedience + usedmovetext + doturn + metronome + endmove + +LeechSeed: + checkobedience + usedmovetext + doturn + checkhit + leechseed + endmove + +Splash: + checkobedience + usedmovetext + doturn + splash + endmove + +Disable: + checkobedience + usedmovetext + doturn + checkhit + disable + endmove + +RazorWind: + checkcharge + checkobedience + doturn + charge + usedmovetext + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Fly: +Dig: + checkcharge + checkobedience + doturn + charge + usedmovetext + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effect0x0b + effect0x0c + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Bind: +Wrap: +FireSpin: +Clamp: +Whirlpool: + checkobedience + usedmovetext + doturn + checkhit + critical + damagecalc + itemmultiplier + stab + damagevariation + clearmissdamage + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + traptarget + endmove + +SuperFang: +Sonicboom: +DragonRage: +SeismicToss: +NightShade: +Psywave: + checkobedience + usedmovetext + doturn + constantdamage + checkhit + effect0xa3 + hittarget + resulttext + checkfaint + checkdestinybond + buildopponentrage + kingsrock + endmove + +Flail: +Reversal: + checkobedience + usedmovetext + doturn + constantdamage + stab + checkhit + hittarget + resulttext + checkfaint + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Counter: + checkobedience + usedmovetext + doturn + counter + hittarget + resulttext + checkfaint + checkdestinybond + buildopponentrage + kingsrock + endmove + +Encore: + checkobedience + usedmovetext + doturn + checkhit + encore + endmove + +PainSplit: + checkobedience + usedmovetext + doturn + checkhit + painsplit + endmove + +Snore: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + snore + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + flinchtarget + kingsrock + endmove + +Conversion2: + checkobedience + usedmovetext + doturn + checkhit + conversion2 + endmove + +MindReader: +LockOn: + checkobedience + usedmovetext + doturn + checkhit + lockon + endmove + +Sketch: + checkobedience + usedmovetext + doturn + sketch + endmove + + checkobedience + usedmovetext + doturn + defrostopponent + endmove + +SleepTalk: + checkobedience + usedmovetext + doturn + sleeptalk + endmove + +DestinyBond: + checkobedience + usedmovetext + doturn + destinybond + endmove + +Spite: + checkobedience + usedmovetext + doturn + checkhit + spite + endmove + +FalseSwipe: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + falseswipe + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +HealBell: + checkobedience + usedmovetext + doturn + healbell + endmove + +TripleKick: + checkobedience + usedmovetext + doturn + startloop + effect0x0a + checkhit + critical + damagecalc + itemmultiplier + triplekick + stab + damagevariation + clearmissdamage + effect0x0b + resulttext + checkfaint + criticaltext + cleartext + supereffectivelooptext + checkdestinybond + buildopponentrage + kickcounter + endloop + effect0x0c + kingsrock + endmove + +Thief: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + thief + checkdestinybond + buildopponentrage + kingsrock + endmove + +SpiderWeb: +MeanLook: + checkobedience + usedmovetext + doturn + arenatrap + endmove + +Nightmare: + checkobedience + usedmovetext + doturn + nightmare + endmove + +FlameWheel: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + defrost + checkdestinybond + buildopponentrage + burntarget + endmove + +Curse: + checkobedience + usedmovetext + doturn + curse + endmove + +Protect: +Detect: + checkobedience + usedmovetext + doturn + protect + endmove + +Spikes: + checkobedience + usedmovetext + doturn + spikes + endmove + +Foresight: + checkobedience + usedmovetext + doturn + checkhit + foresight + endmove + +PerishSong: + checkobedience + usedmovetext + doturn + perishsong + endmove + +Sandstorm: + checkobedience + usedmovetext + doturn + startsandstorm + endmove + +Endure: + checkobedience + usedmovetext + doturn + endure + endmove + +Rollout: + checkcurl + checkobedience + doturn + usedmovetext + critical + damagecalc + itemmultiplier + stab + checkhit + rolloutpower + damagevariation + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Swagger: + checkobedience + usedmovetext + doturn + checkhit + switchturn + attackup2 + switchturn + effect0x0a + effect0x92 + effect0x0c + resulttext + switchturn + statmessageuser + switchturn + confusetarget + endmove + +FuryCutter: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + checkhit + furycutter + damagevariation + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Attract: + checkobedience + usedmovetext + doturn + checkhit + attract + endmove + +Return: + checkobedience + usedmovetext + doturn + critical + damagecalc + happinesspower + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Present: + checkobedience + usedmovetext + doturn + checkhit + critical + damagecalc + present + itemmultiplier + stab + damagevariation + clearmissdamage + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Frustration: + checkobedience + usedmovetext + doturn + critical + damagecalc + frustrationpower + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Safeguard: + checkobedience + usedmovetext + doturn + safeguard + endmove + +SacredFire: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + defrost + checkdestinybond + buildopponentrage + burntarget + endmove + +Magnitude: + checkobedience + usedmovetext + doturn + critical + damagecalc + getmagnitude + itemmultiplier + stab + damagevariation + checkhit + doubleundergrounddamage + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +BatonPass: + checkobedience + usedmovetext + doturn + batonpass + endmove + +Pursuit: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + pursuit + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +RapidSpin: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + clearhazards + checkdestinybond + buildopponentrage + kingsrock + endmove + +MorningSun: + checkobedience + usedmovetext + doturn + healmorn + endmove + +Synthesis: + checkobedience + usedmovetext + doturn + healday + endmove + +Moonlight: + checkobedience + usedmovetext + doturn + healnite + endmove + +HiddenPower: + checkobedience + usedmovetext + doturn + critical + hiddenpower + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +RainDance: + checkobedience + usedmovetext + doturn + startrain + endmove + +SunnyDay: + checkobedience + usedmovetext + doturn + startsun + endmove + + checkobedience + usedmovetext + doturn + checkhit + fakeout + hittarget + resulttext + endmove + +BellyDrum: + checkobedience + usedmovetext + doturn + bellydrum + endmove + +PsychUp: + checkobedience + usedmovetext + doturn + psychup + endmove + +MirrorCoat: + checkobedience + usedmovetext + doturn + mirrorcoat + hittarget + resulttext + checkfaint + checkdestinybond + buildopponentrage + kingsrock + endmove + +SkullBash: + checkcharge + checkobedience + doturn + charge + usedmovetext + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endturn + defenseup + statmessageuser + endmove + +Twister: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + doubleflyingdamage + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + flinchtarget + endmove + +Earthquake: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + doubleundergrounddamage + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + endmove + +FutureSight: + checkfuturesight + checkobedience + usedmovetext + doturn + damagecalc + itemmultiplier + futuresight + damagevariation + checkhit + effect0x0b + resulttext + checkfaint + checkdestinybond + buildopponentrage + endmove + +Gust: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + doubleflyingdamage + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + endmove + +Stomp: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + stab + damagevariation + doubleminimizedamage + checkhit + effectchance + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + flinchtarget + endmove + +Solarbeam: + checkcharge + checkobedience + doturn + skipsuncharge + charge + usedmovetext + critical + damagecalc + itemmultiplier + stab + damagevariation + checkhit + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + kingsrock + endmove + +Thunder: + checkobedience + usedmovetext + doturn + critical + damagecalc + itemmultiplier + thunderaccuracy + checkhit + effectchance + stab + damagevariation + hittarget + resulttext + checkfaint + criticaltext + supereffectivetext + checkdestinybond + buildopponentrage + paralyzetarget + endmove + +Teleport: + checkobedience + usedmovetext + doturn + teleport + endmove + +BeatUp: + checkobedience + usedmovetext + wait + doturn + startloop + effect0x0a + checkhit + critical + beatup + itemmultiplier + damagevariation + clearmissdamage + effect0x0b + resulttext + checkfaint + criticaltext + cleartext + supereffectivetext + checkdestinybond + buildopponentrage + endloop + effect0xa8 + effect0x0c + kingsrock + endmove + +DefenseCurl: + checkobedience + usedmovetext + doturn + defenseup + curl + effect0x0a + effect0x92 + effect0x0c + statmessageuser + statupfailtext + endmove + + + diff --git a/extras/crystal.py b/extras/crystal.py index 0fe1aa30c..3f9e164b7 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -2912,7 +2912,7 @@ music_command_enders = [0xEA, 0xEB, 0xEE, 0xFC, 0xFF,] # special case for 0xFD (if loopchannel.count = 0, break) def create_music_command_classes(debug=False): - klasses = [GivePoke] + klasses = [] for (byte, cmd) in music_commands_new.items(): cmd_name = cmd[0].replace(" ", "_") params = {"id": byte, "size": 1, "end": byte in music_command_enders, "macro_name": cmd_name} @@ -2938,6 +2938,221 @@ def create_music_command_classes(debug=False): return klasses music_classes = create_music_command_classes() + + +effect_commands = { + 0x1: ['checkturn'], + 0x2: ['checkobedience'], + 0x3: ['usedmovetext'], + 0x4: ['doturn'], + 0x5: ['critical'], + 0x6: ['damagecalc'], + 0x7: ['stab'], + 0x8: ['damagevariation'], + 0x9: ['checkhit'], + 0xa: ['effect0x0a'], + 0xb: ['effect0x0b'], + 0xc: ['effect0x0c'], + 0xd: ['resulttext'], + 0xe: ['checkfaint'], + 0xf: ['criticaltext'], + 0x10: ['supereffectivetext'], + 0x11: ['checkdestinybond'], + 0x12: ['buildopponentrage'], + 0x13: ['poisontarget'], + 0x14: ['sleeptarget'], + 0x15: ['draintarget'], + 0x16: ['eatdream'], + 0x17: ['burntarget'], + 0x18: ['freezetarget'], + 0x19: ['paralyzetarget'], + 0x1a: ['selfdestruct'], + 0x1b: ['mirrormove'], + 0x1c: ['statup'], + 0x1d: ['statdown'], + 0x1e: ['payday'], + 0x1f: ['conversion'], + 0x20: ['resetstats'], + 0x21: ['storeenergy'], + 0x22: ['unleashenergy'], + 0x23: ['forceswitch'], + 0x24: ['endloop'], + 0x25: ['flinchtarget'], + 0x26: ['ohko'], + 0x27: ['recoil'], + 0x28: ['mist'], + 0x29: ['focusenergy'], + 0x2a: ['confuse'], + 0x2b: ['confusetarget'], + 0x2c: ['heal'], + 0x2d: ['transform'], + 0x2e: ['screen'], + 0x2f: ['poison'], + 0x30: ['paralyze'], + 0x31: ['substitute'], + 0x32: ['rechargenextturn'], + 0x33: ['mimic'], + 0x34: ['metronome'], + 0x35: ['leechseed'], + 0x36: ['splash'], + 0x37: ['disable'], + 0x38: ['cleartext'], + 0x39: ['charge'], + 0x3a: ['checkcharge'], + 0x3b: ['traptarget'], + 0x3c: ['effect0x3c'], + 0x3d: ['rampage'], + 0x3e: ['checkrampage'], + 0x3f: ['constantdamage'], + 0x40: ['counter'], + 0x41: ['encore'], + 0x42: ['painsplit'], + 0x43: ['snore'], + 0x44: ['conversion2'], + 0x45: ['lockon'], + 0x46: ['sketch'], + 0x47: ['defrostopponent'], + 0x48: ['sleeptalk'], + 0x49: ['destinybond'], + 0x4a: ['spite'], + 0x4b: ['falseswipe'], + 0x4c: ['healbell'], + 0x4d: ['kingsrock'], + 0x4e: ['triplekick'], + 0x4f: ['kickcounter'], + 0x50: ['thief'], + 0x51: ['arenatrap'], + 0x52: ['nightmare'], + 0x53: ['defrost'], + 0x54: ['curse'], + 0x55: ['protect'], + 0x56: ['spikes'], + 0x57: ['foresight'], + 0x58: ['perishsong'], + 0x59: ['startsandstorm'], + 0x5a: ['endure'], + 0x5b: ['checkcurl'], + 0x5c: ['rolloutpower'], + 0x5d: ['effect0x5d'], + 0x5e: ['furycutter'], + 0x5f: ['attract'], + 0x60: ['happinesspower'], + 0x61: ['present'], + 0x62: ['itemmultiplier'], + 0x63: ['frustrationpower'], + 0x64: ['safeguard'], + 0x65: ['checksafeguard'], + 0x66: ['getmagnitude'], + 0x67: ['batonpass'], + 0x68: ['pursuit'], + 0x69: ['clearhazards'], + 0x6a: ['healmorn'], + 0x6b: ['healday'], + 0x6c: ['healnite'], + 0x6d: ['hiddenpower'], + 0x6e: ['startrain'], + 0x6f: ['startsun'], + 0x70: ['attackup'], + 0x71: ['defenseup'], + 0x72: ['speedup'], + 0x73: ['specialattackup'], + 0x74: ['specialdefenseup'], + 0x75: ['accuracyup'], + 0x76: ['evasionup'], + 0x77: ['attackup2'], + 0x78: ['defenseup2'], + 0x79: ['speedup2'], + 0x7a: ['specialattackup2'], + 0x7b: ['specialdefenseup2'], + 0x7c: ['accuracyup2'], + 0x7d: ['evasionup2'], + 0x7e: ['attackdown'], + 0x7f: ['defensedown'], + 0x80: ['speeddown'], + 0x81: ['specialattackdown'], + 0x82: ['specialdefensedown'], + 0x83: ['accuracydown'], + 0x84: ['evasiondown'], + 0x85: ['attackdown2'], + 0x86: ['defensedown2'], + 0x87: ['speeddown2'], + 0x88: ['specialattackdown2'], + 0x89: ['specialdefensedown2'], + 0x8a: ['accuracydown2'], + 0x8b: ['evasiondown2'], + 0x8c: ['statmessageuser'], + 0x8d: ['statmessagetarget'], + 0x8e: ['statupfailtext'], + 0x8f: ['statdownfailtext'], + 0x90: ['effectchance'], + 0x91: ['effect0x91'], + 0x92: ['effect0x92'], + 0x93: ['switchturn'], + 0x94: ['fakeout'], + 0x95: ['bellydrum'], + 0x96: ['psychup'], + 0x97: ['rage'], + 0x98: ['doubleflyingdamage'], + 0x99: ['doubleundergrounddamage'], + 0x9a: ['mirrorcoat'], + 0x9b: ['checkfuturesight'], + 0x9c: ['futuresight'], + 0x9d: ['doubleminimizedamage'], + 0x9e: ['skipsuncharge'], + 0x9f: ['thunderaccuracy'], + 0xa0: ['teleport'], + 0xa1: ['beatup'], + 0xa2: ['ragedamage'], + 0xa3: ['effect0xa3'], + 0xa4: ['allstatsup'], + 0xa5: ['effect0xa5'], + 0xa6: ['effect0xa6'], + 0xa7: ['effect0xa7'], + 0xa8: ['effect0xa8'], + 0xa9: ['clearmissdamage'], + 0xaa: ['wait'], + 0xab: ['hittarget'], + 0xac: ['tristatuschance'], + 0xad: ['supereffectivelooptext'], + 0xae: ['startloop'], + 0xaf: ['curl'], + 0xfe: ['endturn'], + 0xff: ['endmove'], +} + +effect_command_enders = [0xFF,] + +def create_effect_command_classes(debug=False): + klasses = [] + for (byte, cmd) in effect_commands.items(): + cmd_name = cmd[0].replace(" ", "_") + params = { + "id": byte, + "size": 1, + "end": byte in effect_command_enders, + "macro_name": cmd_name + } + params["param_types"] = {} + if len(cmd) > 1: + param_types = cmd[1:] + for (i, each) in enumerate(param_types): + thing = {"name": each[0], "class": each[1]} + params["param_types"][i] = thing + if debug: + print "each is: " + str(each) + print "thing[class] is: " + str(thing["class"]) + params["size"] += thing["class"].size + klass_name = cmd_name+"Command" + klass = classobj(klass_name, (Command,), params) + globals()[klass_name] = klass + klasses.append(klass) + # later an individual klass will be instantiated to handle something + return klasses + +effect_classes = create_effect_command_classes() + + + def generate_macros(filename="../script_macros.asm"): """generates all macros based on commands this is dumped into script_macros.asm""" diff --git a/main.asm b/main.asm index 470eb7508..7bdbd2bb9 100644 --- a/main.asm +++ b/main.asm @@ -5703,7 +5703,9 @@ INCBIN "baserom.gbc", $271f4, $2732e - $271f4 MoveEffects: ; 2732e -INCBIN "baserom.gbc", $2732e, $27a2d - $2732e +INCLUDE "battle/moves/move_effects.asm" + +INCBIN "baserom.gbc", $27a28, $27a2d - $27a28 SECTION "bankA",DATA,BANK[$A] diff --git a/preprocessor.py b/preprocessor.py index cb09fb898..c53612517 100644 --- a/preprocessor.py +++ b/preprocessor.py @@ -18,6 +18,7 @@ from extras.crystal import ( text_command_classes, movement_command_classes, music_classes, + effect_classes, ) even_more_macros = [ @@ -34,6 +35,7 @@ macros += even_more_macros macros += [each[1] for each in text_command_classes] macros += movement_command_classes macros += music_classes +macros += effect_classes # show lines before preprocessing in stdout show_original_lines = False From e21fc0fad19a4411c613d9caadfe13bc6f438d34 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 29 Mar 2013 21:50:24 -0400 Subject: [PATCH 024/112] make chars consistent with preprocessor --- extras/chars.py | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/chars.py b/extras/chars.py index 28f37cb84..159a479a7 100644 --- a/extras/chars.py +++ b/extras/chars.py @@ -98,6 +98,7 @@ chars = { 0xE9: "&", 0xEA: "é", 0xEB: "→", + 0xED: "â–¶", 0xEF: "♂", 0xF0: "Â¥", 0xF1: "×", From 6c3ec2d13d30fef17a3e636ef22052d90c61d0b5 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 30 Mar 2013 01:58:22 -0400 Subject: [PATCH 025/112] Multiply and Divide --- hram.asm | 10 +++ main.asm | 263 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 249 insertions(+), 24 deletions(-) diff --git a/hram.asm b/hram.asm index fd9ed2134..bfab6e295 100644 --- a/hram.asm +++ b/hram.asm @@ -26,6 +26,16 @@ hJoyDown EQU $ffa8 hPastLeadingZeroes EQU $ffb3 +hDividend EQU $ffb3 +hDivisor EQU $ffb7 +hQuotient EQU $ffb4 + +hMultiplicand EQU $ffb4 +hMultiplier EQU $ffb7 +hProduct EQU $ffb3 + +hMathBuffer EQU $ffb8 + hLCDStatCustom EQU $ffc6 hBGMapMode EQU $ffd4 diff --git a/main.asm b/main.asm index 7bdbd2bb9..c6c412ec6 100644 --- a/main.asm +++ b/main.asm @@ -2932,34 +2932,49 @@ AddNTimes: ; 0x30fe ret ; 0x3105 -INCBIN "baserom.gbc", $3105, $3119-$3105 -Multiply: ; 0x3119 -; function to do multiplication -; all values are big endian -; INPUT -; ffb4-ffb6 = multiplicand -; ffb7 = multiplier -; OUTPUT -; ffb3-ffb6 = product - INCBIN "baserom.gbc", $3119, $3124 - $3119 -; 0x3124 +INCBIN "baserom.gbc", $3105, $3119 - $3105 + + +Multiply: ; 3119 +; Multiply hMultiplicand (3 bytes) by hMultiplier. Result in hProduct. +; All values are big endian. + push hl + push bc + + callab _Multiply + + pop bc + pop hl + ret +; 3124 + + +Divide: ; 3124 +; Divide hDividend length b (max 4 bytes) by hDivisor. Result in hQuotient. +; All values are big endian. + push hl + push de + push bc + ld a, [hROMBank] + push af + ld a, BANK(_Divide) + rst Bankswitch + + call _Divide + + pop af + rst Bankswitch + pop bc + pop de + pop hl + ret +; 3136 -Divide: ; 0x3124 -; function to do division -; all values are big endian -; INPUT -; ffb3-ffb6 = dividend -; ffb7 = divisor -; b = number of bytes in the dividend (starting from ffb3) -; OUTPUT -; ffb4-ffb6 = quotient -; ffb7 = remainder - INCBIN "baserom.gbc", $3124, $3136 - $3124 -; 0x3136 INCBIN "baserom.gbc", $3136, $313d - $3136 + PrintLetterDelay: ; 313d ; wait some frames before printing the next letter ; the text speed setting in Options is actually a frame count @@ -4141,7 +4156,207 @@ CheckNickErrors: ; 669f db $ff ; end ; 66de -INCBIN "baserom.gbc", $66de, $6eef - $66de + +_Multiply: ; 66de + +; hMultiplier is one byte. + ld a, 8 + ld b, a + + xor a + ld [hMultiplicand - 1], a + ld [hMathBuffer + 1], a + ld [hMathBuffer + 2], a + ld [hMathBuffer + 3], a + ld [hMathBuffer + 4], a + + +.loop + ld a, [hMultiplier] + srl a + ld [hMultiplier], a + jr nc, .next + + ld a, [hMathBuffer + 4] + ld c, a + ld a, [hMultiplicand + 2] + add c + ld [hMathBuffer + 4], a + + ld a, [hMathBuffer + 3] + ld c, a + ld a, [hMultiplicand + 1] + adc c + ld [hMathBuffer + 3], a + + ld a, [hMathBuffer + 2] + ld c, a + ld a, [hMultiplicand + 0] + adc c + ld [hMathBuffer + 2], a + + ld a, [hMathBuffer + 1] + ld c, a + ld a, [hMultiplicand - 1] + adc c + ld [hMathBuffer + 1], a + +.next + dec b + jr z, .done + + +; hMultiplicand <<= 1 + + ld a, [hMultiplicand + 2] + add a + ld [hMultiplicand + 2], a + + ld a, [hMultiplicand + 1] + rla + ld [hMultiplicand + 1], a + + ld a, [hMultiplicand + 0] + rla + ld [hMultiplicand + 0], a + + ld a, [hMultiplicand - 1] + rla + ld [hMultiplicand - 1], a + + jr .loop + + +.done + ld a, [hMathBuffer + 4] + ld [hProduct + 3], a + + ld a, [hMathBuffer + 3] + ld [hProduct + 2], a + + ld a, [hMathBuffer + 2] + ld [hProduct + 1], a + + ld a, [hMathBuffer + 1] + ld [hProduct + 0], a + + ret +; 673e + + +_Divide: ; 673e + xor a + ld [hMathBuffer + 0], a + ld [hMathBuffer + 1], a + ld [hMathBuffer + 2], a + ld [hMathBuffer + 3], a + ld [hMathBuffer + 4], a + + ld a, 9 + ld e, a + +.loop + ld a, [hMathBuffer + 0] + ld c, a + ld a, [hDividend + 1] + sub c + ld d, a + + ld a, [hDivisor] + ld c, a + ld a, [hDividend + 0] + sbc c + jr c, .asm_6767 + + ld [hDividend + 0], a + + ld a, d + ld [hDividend + 1], a + + ld a, [hMathBuffer + 4] + inc a + ld [hMathBuffer + 4], a + + jr .loop + +.asm_6767 + ld a, b + cp 1 + jr z, .done + + ld a, [hMathBuffer + 4] + add a + ld [hMathBuffer + 4], a + + ld a, [hMathBuffer + 3] + rla + ld [hMathBuffer + 3], a + + ld a, [hMathBuffer + 2] + rla + ld [hMathBuffer + 2], a + + ld a, [hMathBuffer + 1] + rla + ld [hMathBuffer + 1], a + + dec e + jr nz, .asm_6798 + + ld e, 8 + ld a, [hMathBuffer + 0] + ld [hDivisor], a + xor a + ld [hMathBuffer + 0], a + + ld a, [hDividend + 1] + ld [hDividend + 0], a + + ld a, [hDividend + 2] + ld [hDividend + 1], a + + ld a, [hDividend + 3] + ld [hDividend + 2], a + +.asm_6798 + ld a, e + cp 1 + jr nz, .asm_679e + dec b + +.asm_679e + ld a, [hDivisor] + srl a + ld [hDivisor], a + + ld a, [hMathBuffer + 0] + rr a + ld [hMathBuffer + 0], a + + jr .loop + +.done + ld a, [hDividend + 1] + ld [hDivisor], a + + ld a, [hMathBuffer + 4] + ld [hDividend + 3], a + + ld a, [hMathBuffer + 3] + ld [hDividend + 2], a + + ld a, [hMathBuffer + 2] + ld [hDividend + 1], a + + ld a, [hMathBuffer + 1] + ld [hDividend + 0], a + + ret +; 67c1 + + +INCBIN "baserom.gbc", $67c1, $6eef - $67c1 + DrawGraphic: ; 6eef ; input: From b998f4594cff3e51e802a06dfed375e424730f94 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 31 Mar 2013 21:39:12 -0400 Subject: [PATCH 026/112] Move effect pointers --- battle/moves/move_effects.asm | 62 ++++++++++ battle/moves/move_effects_pointers.asm | 158 +++++++++++++++++++++++++ main.asm | 4 +- 3 files changed, 221 insertions(+), 3 deletions(-) create mode 100644 battle/moves/move_effects_pointers.asm diff --git a/battle/moves/move_effects.asm b/battle/moves/move_effects.asm index a068f3e5a..9ed9e9194 100644 --- a/battle/moves/move_effects.asm +++ b/battle/moves/move_effects.asm @@ -33,6 +33,7 @@ HiJumpKick: QuickAttack: MachPunch: Extremespeed: +NormalHit: checkobedience usedmovetext doturn @@ -57,6 +58,7 @@ SleepPowder: Hypnosis: LovelyKiss: Spore: +DoSleep: checkobedience usedmovetext doturn @@ -69,6 +71,7 @@ PoisonSting: Smog: Sludge: SludgeBomb: +PoisonHit: checkobedience usedmovetext doturn @@ -93,6 +96,7 @@ Absorb: MegaDrain: LeechLife: GigaDrain: +LeechHit: checkobedience usedmovetext doturn @@ -117,6 +121,7 @@ FirePunch: Ember: Flamethrower: FireBlast: +BurnHit: checkobedience usedmovetext doturn @@ -141,6 +146,7 @@ IcePunch: IceBeam: Blizzard: PowderSnow: +FreezeHit: checkobedience usedmovetext doturn @@ -169,6 +175,7 @@ Lick: ZapCannon: Spark: Dragonbreath: +ParalyzeHit: checkobedience usedmovetext doturn @@ -240,6 +247,7 @@ MirrorMove: Meditate: Sharpen: +AttackUp: checkobedience usedmovetext doturn @@ -253,6 +261,7 @@ Sharpen: Harden: Withdraw: +DefenseUp: checkobedience usedmovetext doturn @@ -264,6 +273,7 @@ Withdraw: statupfailtext endmove +SpeedUp: checkobedience usedmovetext doturn @@ -276,6 +286,7 @@ Withdraw: endmove Growth: +SpecialAttackUp: checkobedience usedmovetext doturn @@ -287,6 +298,7 @@ Growth: statupfailtext endmove +SpecialDefenseUp: checkobedience usedmovetext doturn @@ -298,6 +310,7 @@ Growth: statupfailtext endmove +AccuracyUp: checkobedience usedmovetext doturn @@ -311,6 +324,7 @@ Growth: DoubleTeam: Minimize: +EvasionUp: checkobedience usedmovetext doturn @@ -324,6 +338,7 @@ Minimize: endmove SwordsDance: +AttackUp2: checkobedience usedmovetext doturn @@ -337,6 +352,7 @@ SwordsDance: Barrier: AcidArmor: +DefenseUp2: checkobedience usedmovetext doturn @@ -349,6 +365,7 @@ AcidArmor: endmove Agility: +SpeedUp2: checkobedience usedmovetext doturn @@ -360,6 +377,7 @@ Agility: statupfailtext endmove +SpecialAttackUp2: checkobedience usedmovetext doturn @@ -372,6 +390,7 @@ Agility: endmove Amnesia: +SpecialDefenseUp2: checkobedience usedmovetext doturn @@ -383,6 +402,7 @@ Amnesia: statupfailtext endmove +AccuracyUp2: checkobedience usedmovetext doturn @@ -394,6 +414,7 @@ Amnesia: statupfailtext endmove +EvasionUp2: checkobedience usedmovetext doturn @@ -406,6 +427,7 @@ Amnesia: endmove Growl: +AttackDown: checkobedience usedmovetext doturn @@ -420,6 +442,7 @@ Growl: TailWhip: Leer: +DefenseDown: checkobedience usedmovetext doturn @@ -433,6 +456,7 @@ Leer: endmove StringShot: +SpeedDown: checkobedience usedmovetext doturn @@ -445,6 +469,7 @@ StringShot: statdownfailtext endmove +SpecialAttackDown: checkobedience usedmovetext doturn @@ -457,6 +482,7 @@ StringShot: statdownfailtext endmove +SpecialDefenseDown: checkobedience usedmovetext doturn @@ -473,6 +499,7 @@ SandAttack: Smokescreen: Kinesis: Flash: +AccuracyDown: checkobedience usedmovetext doturn @@ -486,6 +513,7 @@ Flash: endmove SweetScent: +EvasionDown: checkobedience usedmovetext doturn @@ -499,6 +527,7 @@ SweetScent: endmove Charm: +AttackDown2: checkobedience usedmovetext doturn @@ -512,6 +541,7 @@ Charm: endmove Screech: +DefenseDown2: checkobedience usedmovetext doturn @@ -526,6 +556,7 @@ Screech: CottonSpore: ScaryFace: +SpeedDown2: checkobedience usedmovetext doturn @@ -538,6 +569,7 @@ ScaryFace: statdownfailtext endmove +SpecialAttackDown2: checkobedience usedmovetext doturn @@ -550,6 +582,7 @@ ScaryFace: statdownfailtext endmove +SpecialDefenseDown2: checkobedience usedmovetext doturn @@ -562,6 +595,7 @@ ScaryFace: statdownfailtext endmove +AccuracyDown2: checkobedience usedmovetext doturn @@ -574,6 +608,7 @@ ScaryFace: statdownfailtext endmove +EvasionDown2: checkobedience usedmovetext doturn @@ -587,6 +622,7 @@ ScaryFace: endmove AuroraBeam: +AttackDownHit: checkobedience usedmovetext doturn @@ -611,6 +647,7 @@ AuroraBeam: Acid: IronTail: RockSmash: +DefenseDownHit: checkobedience usedmovetext doturn @@ -637,6 +674,7 @@ Bubblebeam: Constrict: Bubble: IcyWind: +SpeedDownHit: checkobedience usedmovetext doturn @@ -658,6 +696,7 @@ IcyWind: statmessagetarget endmove +SpecialAttackDownHit: checkobedience usedmovetext doturn @@ -682,6 +721,7 @@ IcyWind: PsychicM: Crunch: ShadowBall: +SpecialDefenseDownHit: checkobedience usedmovetext doturn @@ -705,6 +745,7 @@ ShadowBall: MudSlap: Octazooka: +AccuracyDownHit: checkobedience usedmovetext doturn @@ -726,6 +767,7 @@ Octazooka: statmessagetarget endmove +EvasionDownHit: checkobedience usedmovetext doturn @@ -748,6 +790,7 @@ Octazooka: endmove SteelWing: +DefenseUpHit: checkobedience usedmovetext doturn @@ -770,6 +813,7 @@ SteelWing: endmove MetalClaw: +AttackUpHit: checkobedience usedmovetext doturn @@ -792,6 +836,7 @@ MetalClaw: endmove Ancientpower: +AllUpHit: checkobedience usedmovetext doturn @@ -866,6 +911,7 @@ Bide: Thrash: PetalDance: Outrage: +Rampage: checkrampage checkobedience doturn @@ -907,6 +953,7 @@ FurySwipes: BoneRush: DoubleKick: Bonemerang: +MultiHit: checkobedience usedmovetext doturn @@ -933,6 +980,7 @@ Bonemerang: endmove Twineedle: +PoisonMultiHit: checkobedience usedmovetext doturn @@ -967,6 +1015,7 @@ LowKick: BoneClub: RockSlide: HyperFang: +FlinchHit: checkobedience usedmovetext doturn @@ -990,6 +1039,7 @@ HyperFang: Guillotine: HornDrill: Fissure: +OHKOHit: checkobedience usedmovetext doturn @@ -1008,6 +1058,7 @@ TakeDown: DoubleEdge: Submission: Struggle: +RecoilHit: checkobedience usedmovetext doturn @@ -1036,6 +1087,7 @@ Mist: endmove FocusEnergy: +CriticalUp: checkobedience usedmovetext doturn @@ -1045,6 +1097,7 @@ FocusEnergy: Supersonic: ConfuseRay: SweetKiss: +DoConfuse: checkobedience usedmovetext doturn @@ -1057,6 +1110,7 @@ Psybeam: Confusion: DizzyPunch: Dynamicpunch: +ConfuseHit: checkobedience usedmovetext doturn @@ -1081,6 +1135,7 @@ Recover: Softboiled: Rest: MilkDrink: +Heal: checkobedience usedmovetext doturn @@ -1096,6 +1151,7 @@ Transform: LightScreen: Reflect: +Screen: checkobedience usedmovetext doturn @@ -1125,6 +1181,7 @@ TriAttack: Toxic: Poisonpowder: PoisonGas: +DoPoison: checkobedience usedmovetext doturn @@ -1137,6 +1194,7 @@ PoisonGas: StunSpore: ThunderWave: Glare: +DoParalyze: checkobedience usedmovetext doturn @@ -1334,6 +1392,7 @@ DragonRage: SeismicToss: NightShade: Psywave: +StaticDamage: checkobedience usedmovetext doturn @@ -1441,6 +1500,7 @@ Sketch: sketch endmove +DefrostOpponent: checkobedience usedmovetext doturn @@ -1922,6 +1982,7 @@ SunnyDay: startsun endmove +FakeOut: checkobedience usedmovetext doturn @@ -2179,3 +2240,4 @@ DefenseCurl: + diff --git a/battle/moves/move_effects_pointers.asm b/battle/moves/move_effects_pointers.asm new file mode 100644 index 000000000..cd48c5c5a --- /dev/null +++ b/battle/moves/move_effects_pointers.asm @@ -0,0 +1,158 @@ + dw NormalHit + dw DoSleep + dw PoisonHit + dw LeechHit + dw BurnHit + dw FreezeHit + dw ParalyzeHit + dw Explosion + dw DreamEater + dw MirrorMove + dw AttackUp + dw DefenseUp + dw SpeedUp + dw SpecialAttackUp + dw SpecialDefenseUp + dw AccuracyUp + dw EvasionUp + dw NormalHit + dw AttackDown + dw DefenseDown + dw SpeedDown + dw SpecialAttackDown + dw SpecialDefenseDown + dw AccuracyDown + dw EvasionDown + dw Haze + dw Bide + dw Rampage + dw Whirlwind + dw MultiHit + dw Conversion + dw FlinchHit + dw Heal + dw DoPoison + dw PayDay + dw Screen + dw TriAttack + dw NormalHit + dw OHKOHit + dw RazorWind + dw StaticDamage + dw StaticDamage + dw Bind + dw NormalHit + dw MultiHit + dw NormalHit + dw Mist + dw CriticalUp + dw RecoilHit + dw DoConfuse + dw AttackUp2 + dw DefenseUp2 + dw SpeedUp2 + dw SpecialAttackUp2 + dw SpecialDefenseUp2 + dw AccuracyUp2 + dw EvasionUp2 + dw Transform + dw AttackDown2 + dw DefenseDown2 + dw SpeedDown2 + dw SpecialAttackDown2 + dw SpecialDefenseDown2 + dw AccuracyDown2 + dw EvasionDown2 + dw Screen + dw DoPoison + dw DoParalyze + dw AttackDownHit + dw DefenseDownHit + dw SpeedDownHit + dw SpecialAttackDownHit + dw SpecialDefenseDownHit + dw AccuracyDownHit + dw EvasionDownHit + dw SkyAttack + dw ConfuseHit + dw PoisonMultiHit + dw NormalHit + dw Substitute + dw HyperBeam + dw Rage + dw Mimic + dw Metronome + dw LeechSeed + dw Splash + dw Disable + dw StaticDamage + dw StaticDamage + dw Counter + dw Encore + dw PainSplit + dw Snore + dw Conversion2 + dw LockOn + dw Sketch + dw DefrostOpponent + dw SleepTalk + dw DestinyBond + dw Reversal + dw Spite + dw FalseSwipe + dw HealBell + dw NormalHit + dw TripleKick + dw Thief + dw MeanLook + dw Nightmare + dw FlameWheel + dw Curse + dw NormalHit + dw Protect + dw Spikes + dw Foresight + dw PerishSong + dw Sandstorm + dw Endure + dw Rollout + dw Swagger + dw FuryCutter + dw Attract + dw Return + dw Present + dw Frustration + dw Safeguard + dw SacredFire + dw Magnitude + dw BatonPass + dw Pursuit + dw RapidSpin + dw NormalHit + dw NormalHit + dw MorningSun + dw Synthesis + dw Moonlight + dw HiddenPower + dw RainDance + dw SunnyDay + dw DefenseUpHit + dw AttackUpHit + dw AllUpHit + dw FakeOut + dw BellyDrum + dw PsychUp + dw MirrorCoat + dw SkullBash + dw Twister + dw Earthquake + dw FutureSight + dw Gust + dw Stomp + dw Solarbeam + dw Thunder + dw Teleport + dw BeatUp + dw Fly + dw DefenseCurl + diff --git a/main.asm b/main.asm index c6c412ec6..106a76a2b 100644 --- a/main.asm +++ b/main.asm @@ -5913,11 +5913,9 @@ TrainerClassDVs ; 270d6 INCBIN "baserom.gbc", $2715c, $271f4 - $2715c MoveEffectsPointers: ; 271f4 - -INCBIN "baserom.gbc", $271f4, $2732e - $271f4 +INCLUDE "battle/moves/move_effects_pointers.asm" MoveEffects: ; 2732e - INCLUDE "battle/moves/move_effects.asm" INCBIN "baserom.gbc", $27a28, $27a2d - $27a28 From f36dfc36890ab95e666863d567fe3de6fd51bcb1 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 1 Apr 2013 00:53:18 -0400 Subject: [PATCH 027/112] Move-specific effect pointers --- battle/moves/move_effects_pointers.asm | 40 +++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/battle/moves/move_effects_pointers.asm b/battle/moves/move_effects_pointers.asm index cd48c5c5a..4f955444a 100644 --- a/battle/moves/move_effects_pointers.asm +++ b/battle/moves/move_effects_pointers.asm @@ -11,18 +11,18 @@ dw AttackUp dw DefenseUp dw SpeedUp - dw SpecialAttackUp + dw Growth dw SpecialDefenseUp dw AccuracyUp dw EvasionUp dw NormalHit - dw AttackDown + dw Growl dw DefenseDown - dw SpeedDown + dw StringShot dw SpecialAttackDown dw SpecialDefenseDown dw AccuracyDown - dw EvasionDown + dw SweetScent dw Haze dw Bide dw Rampage @@ -31,42 +31,42 @@ dw Conversion dw FlinchHit dw Heal - dw DoPoison + dw Toxic dw PayDay - dw Screen + dw LightScreen dw TriAttack dw NormalHit dw OHKOHit dw RazorWind - dw StaticDamage + dw SuperFang dw StaticDamage dw Bind dw NormalHit dw MultiHit dw NormalHit dw Mist - dw CriticalUp + dw FocusEnergy dw RecoilHit dw DoConfuse - dw AttackUp2 + dw SwordsDance dw DefenseUp2 - dw SpeedUp2 + dw Agility dw SpecialAttackUp2 - dw SpecialDefenseUp2 + dw Amnesia dw AccuracyUp2 dw EvasionUp2 dw Transform - dw AttackDown2 - dw DefenseDown2 + dw Charm + dw Screech dw SpeedDown2 dw SpecialAttackDown2 dw SpecialDefenseDown2 dw AccuracyDown2 dw EvasionDown2 - dw Screen + dw Reflect dw DoPoison dw DoParalyze - dw AttackDownHit + dw AuroraBeam dw DefenseDownHit dw SpeedDownHit dw SpecialAttackDownHit @@ -75,7 +75,7 @@ dw EvasionDownHit dw SkyAttack dw ConfuseHit - dw PoisonMultiHit + dw Twineedle dw NormalHit dw Substitute dw HyperBeam @@ -86,7 +86,7 @@ dw Splash dw Disable dw StaticDamage - dw StaticDamage + dw Psywave dw Counter dw Encore dw PainSplit @@ -136,9 +136,9 @@ dw HiddenPower dw RainDance dw SunnyDay - dw DefenseUpHit - dw AttackUpHit - dw AllUpHit + dw SteelWing + dw MetalClaw + dw Ancientpower dw FakeOut dw BellyDrum dw PsychUp From 112a348d6499411f951d3e1aad08067278fa30be Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 4 Apr 2013 16:15:10 -0400 Subject: [PATCH 028/112] Updated Windows install instructions Cygwin users should refer to the Linux instructions. --- INSTALL.md | 163 +++++++++--------------------------------------- pokecrystal.bat | 4 ++ 2 files changed, 33 insertions(+), 134 deletions(-) create mode 100644 pokecrystal.bat diff --git a/INSTALL.md b/INSTALL.md index da91a08fb..f9e0578c6 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,3 +1,18 @@ +Installation requires a certain Pokemon Crystal ROM: + +``` +Pokemon - Crystal Version (UE) (V1.0) [C][!].gbc +md5: 9f2922b235a5eeb78d65594e82ef5dde +``` + +Save it as `baserom.gbc` in the repository. + + +Feel free to ask us on nucleus.kafuka.org #skeetendo if something goes wrong (remember to tell where)! + +Don't know how to use IRC? Try [mibbit](http://chat.mibbit.com/?server=nucleus.kafuka.org&channel=#skeetendo) or something. + + # Linux ```bash @@ -28,149 +43,29 @@ pip install -r requirements.txt make clean && make ``` + # Windows -Follow these instructions to install `pokecrystal` on Microsoft Windows. Once -installed, you can run `make` to compile `main.asm` into a ROM. +Set up [GitHub for Windows](http://windows.github.com/) and clone this repository. -## Installing cygwin +If you haven't already, get [Python 2.7](http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi) ([64-bit](http://www.python.org/ftp/python/2.7.3/python-2.7.3.amd64.msi)). -Cygwin provides a virtual linux environment on Windows systems. Just get -`setup.exe`: http://cygwin.com/install.html +Extract the following files from the [RGBDS](https://github.com/downloads/bentley/rgbds/rgbds-0.0.1.zip) package into the repository: +`rgbasm.exe` +`rgbds.exe` +`rgbfix.exe` +`rgblink.exe` -During the install: +Install [make](http://gnuwin32.sourceforge.net/downlinks/make.php) for Windows. - 1. Keep the defaults. - - 2. It shouldn't matter which mirror you choose, but http://mirrors.kernel.org - seems to work. - - 3. Select the packages listed below. - -You'll be presented with a package selection screen. Select the following -packages (hint: there's a search box). - - 1. `python` (installed by default) - - 2. `gcc` and `gcc-core` (under devel) - - 3. `byacc` (under devel) - - 4. `make` (under devel) - - 5. `wget` (under web) - - 6. `git` (under devel) - - 7. `mercurial` (optional, if you wish to work with pokered as well) - -Let cygwin finish the install. Might take a sec while all packages are -downloading. - -## Installing other requirements - -Launch cygwin (bash). Maybe you know your way around the linux terminal. If not, a -crash course: - -```bash -# list files in current directory -ls - -# show current directory -pwd - -# change directory -cd /away/we/go -``` - -The next step is building `rgbds`, the GB assembler. Type: - -```bash -# download rgbds source code -git clone git://github.com/bentley/rgbds.git - -# compile rgbds -cd rgbds -YACC=byacc make - -# make rgbds accessible for all time -export PATH=$PATH:`pwd` -echo "export PATH=$PATH:`pwd`" >> ~/.bashrc - -# check if rgbasm is installed now -which rgbasm -``` - -If that fails (it shouldn't), you can download binaries like so: - -```bash -# download rgbds binaries -wget http://diyhpl.us/~bryan/irc/pokered/rgbds/rgbds.zip --output-document=rgbds.zip - -# unzip -unzip rgbds.zip - -# make rgbds accessible for all time -export PATH=$PATH:`pwd`/rgbds -echo "export PATH=$PATH:`pwd`/rgbds" >> ~/.bashrc - -# clean up that zip file -rm rgbds.zip -``` - -The next step is to install `unittest2`, unless you installed python2.7 -earlier: - -```bash -cd ~ -wget http://peak.telecommunity.com/dist/ez_setup.py -python ez_setup.py -easy_install unittest2 -``` - -Now you should be able to build `pokecrystal` for the first time: - -```bash -cd ~ -git clone git://github.com/kanzure/pokecrystal.git -cd pokecrystal -``` - -The final requirement is downloading a certain Pokemon Crystal ROM: - -``` -Pokemon - Crystal Version (UE) (V1.0) [C][!].gbc -md5: 9f2922b235a5eeb78d65594e82ef5dde -``` - -Save it as `C:\cygwin\home\(your username)\pokecrystal\baserom.gbc`. You can -check the md5 of a file by typing `md5sum baserom.gbc`. - -To compile the ROM from ASM source, type: - -```bash -make -``` +To compile the ROM from ASM source, run `pokecrystal.bat`. That will take between 3 and 15 seconds, depending on your computer. If you see -`cmp baserom.gbc pokecrystal.gbc` as the last line, the build was successful! -Rejoice! +`cmp baserom.gbc pokecrystal.gbc` +as the last line, the build was successful! Rejoice! -Now you may try messing around with `main.asm`, or just do whatever you wanted -to. +Now you may try messing around with `main.asm`, or just do whatever you wanted to. -To build again, you should use the following command: -```bash -make clean && make -``` +# Contributions are welcome! -Feel free to ask us on nucleus.kafuka.org #skeetendo if something goes wrong -(remember to tell where)! Don't know how to use IRC? Try -[mibbit](http://mibbit.com/) or something. - -# Contributing changes - -## Setting up a public git repo - -For those uninitiated with git-based collaboration, and who do not want to setup a server to host git repositories, use GitHub. Register on GitHub and follow [this tutorial to setup ssh keys](https://help.github.com/articles/generating-ssh-keys). Then go to [the pokecrystal repo](https://github.com/kanzure/pokecrystal) and click the giant "fork" button. This will bring you to a page with some instructions regarding `git remote` (follow these steps in your pokecrystal folder). diff --git a/pokecrystal.bat b/pokecrystal.bat new file mode 100644 index 000000000..46919f400 --- /dev/null +++ b/pokecrystal.bat @@ -0,0 +1,4 @@ +@set PATH=%PATH%;C:\Program Files (x86)\GnuWin32\bin\;C:\Python27\ +make clean +make +@pause From ad3a80cd42e04949e5f3f6d452ad69355b9221bd Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 4 Apr 2013 16:21:32 -0400 Subject: [PATCH 029/112] No more install instructions in the readme --- README.md | 47 ++++------------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index ff3ab21f6..7c2cf27db 100644 --- a/README.md +++ b/README.md @@ -4,63 +4,24 @@ This is a hand-crafted disassembly of Pokémon Crystal. The source code in this project successfully converts back into a ROM image. All source code is meticulously commented. + ## Base ROM The following ROM is required for compiling: +``` Pokemon - Crystal Version (UE) (V1.0) [C][!].gbc - md5: 9f2922b235a5eeb78d65594e82ef5dde +``` Eventually this will not be necessary. -## Installing - -Simple. - -``` bash -sudo apt-get install make gcc bison git python python-setuptools - -# unittest2 is required if using python2.6 -sudo easy_install unittest2 -sudo easy_install pip - -# download rgbds source code -git clone git://github.com/bentley/rgbds.git - -# compile rgbds -cd rgbds -make -sudo make install - -# check if rgbasm is installed now -which rgbasm - -# download pokecrystal -git clone https://github.com/kanzure/pokecrystal.git -cd pokecrystal - -pip install -r requirements.txt - -make clean && make -``` - -Also, there are [Windows installation instructions](https://github.com/kanzure/pokecrystal/blob/master/INSTALL.md). - -## Assembling - -* To assemble, first install RGBDS and put it in your path. The version of RGBDS needed is [rgbds-linux](https://github.com/bentley/rgbds/). - -* Next, copy the Pokémon ROM to this directory as "baserom.gbc". - -* Then run "make" in your shell. - -* This will output a file named "pokecrystal.gbc". ## See also * disassembly of [Pokémon Red](http://bitbucket.org/iimarckus/pokered). + ## Contributing * Hang out with us on IRC, nucleus.kafuka.org #skeetendo ([or use mibbit](http://chat.mibbit.com/?server=nucleus.kafuka.org&channel=#skeetendo)) From b6c874d4d41913e4ac9b88fd7244fb3de0da9945 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 4 Apr 2013 22:40:44 -0400 Subject: [PATCH 030/112] windows-specific make targets compiles properly on windows now --- Makefile | 13 ++++++++++--- pokecrystal.bat | 3 +-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3d917f941..6f91979dc 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .SUFFIXES: .asm .tx .o .gbc .png .2bpp .lz -TEXTFILES = text/sweethoney.tx \ +TEXTFILES = \ + text/sweethoney.tx \ text/phone/bill.tx \ text/phone/elm.tx \ text/phone/mom.tx \ @@ -10,7 +11,8 @@ TEXTFILES = text/sweethoney.tx \ text/common_3.tx \ main.tx -VERTGFX = gfx/pics/%.png \ +VERTGFX = \ + gfx/pics/%.png \ gfx/trainers/%.png HORIZGFX = $(filter-out gfx/%.png, $(VERTGFX)) @@ -24,10 +26,16 @@ HORIZGFX = $(filter-out gfx/%.png, $(VERTGFX)) # so take care to reorganize accordingly all: pokecrystal.gbc + cmp baserom.gbc $< + +win: pokecrystal.gbc + fc baserom.gbc $< clean: rm -f main.tx pokecrystal.o pokecrystal.gbc ${TEXTFILES} +winclean: + del main.tx pokecrystal.o pokecrystal.gbc .\text\sweethoney.tx .\text\phone\bill.tx .\text\phone\elm.tx .\text\phone\mom.tx .\text\phone\trainers1.tx .\text\common.tx .\text\common_2.tx .\text\common_3.tx pokecrystal.o: pokecrystal.asm constants.asm wram.asm ${TEXTFILES} rgbasm -o pokecrystal.o pokecrystal.asm @@ -38,7 +46,6 @@ pokecrystal.o: pokecrystal.asm constants.asm wram.asm ${TEXTFILES} pokecrystal.gbc: pokecrystal.o rgblink -o $@ $< rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@ - cmp baserom.gbc $@ lzs: ${VERTGFX} ${HORIZGFX} diff --git a/pokecrystal.bat b/pokecrystal.bat index 46919f400..211c33b1f 100644 --- a/pokecrystal.bat +++ b/pokecrystal.bat @@ -1,4 +1,3 @@ @set PATH=%PATH%;C:\Program Files (x86)\GnuWin32\bin\;C:\Python27\ -make clean -make +@make winclean && make win @pause From f076f14b9806a517297efe649c4ae9cf4ae2025a Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 4 Apr 2013 22:42:14 -0400 Subject: [PATCH 031/112] double-colon rules for .png overrides --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6f91979dc..ce6258cc8 100644 --- a/Makefile +++ b/Makefile @@ -58,8 +58,8 @@ front.png: tiles.png cd extras && python gfx.py png-to-lz --front $@ $(OBJECT_DIRECTORY)/tiles.2bpp tiles.png: cd extras && python gfx.py png-to-2bpp $@ -.png: ${VERTGFX} +.png:: ${VERTGFX} cd extras && python gfx.py png-to-lz --vert $@ -.png: ${HORIZGFX} +.png:: ${HORIZGFX} cd extras && python gfx.py png-to-lz $@ From 51018f0b68b8906e41a0313338bb0cda537f1c78 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 5 Apr 2013 00:25:47 -0400 Subject: [PATCH 032/112] More readme formatting --- INSTALL.md | 19 +++++++++++++------ README.md | 6 +++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index f9e0578c6..7060b5e20 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,4 +1,6 @@ -Installation requires a certain Pokemon Crystal ROM: +# Getting Started + +Compiling requires a certain Pokemon Crystal ROM: ``` Pokemon - Crystal Version (UE) (V1.0) [C][!].gbc @@ -10,10 +12,10 @@ Save it as `baserom.gbc` in the repository. Feel free to ask us on nucleus.kafuka.org #skeetendo if something goes wrong (remember to tell where)! -Don't know how to use IRC? Try [mibbit](http://chat.mibbit.com/?server=nucleus.kafuka.org&channel=#skeetendo) or something. +Don't know how to use IRC? Try [mibbit](http://chat.mibbit.com/?server=nucleus.kafuka.org&channel=#skeetendo). -# Linux +## Linux ```bash sudo apt-get install make gcc bison git python python-setuptools @@ -39,12 +41,18 @@ cd pokecrystal # install python requirements pip install -r requirements.txt +``` +To compile the ROM from ASM source: +``` make clean && make ``` +That will take between 3 and 15 seconds, depending on your computer. If you see +`cmp baserom.gbc pokecrystal.gbc` as the last line, the build was successful! Rejoice! -# Windows + +## Windows Set up [GitHub for Windows](http://windows.github.com/) and clone this repository. @@ -61,8 +69,7 @@ Install [make](http://gnuwin32.sourceforge.net/downlinks/make.php) for Windows. To compile the ROM from ASM source, run `pokecrystal.bat`. That will take between 3 and 15 seconds, depending on your computer. If you see -`cmp baserom.gbc pokecrystal.gbc` -as the last line, the build was successful! Rejoice! +`FC: no differences encountered`, the build was successful! Rejoice! Now you may try messing around with `main.asm`, or just do whatever you wanted to. diff --git a/README.md b/README.md index 7c2cf27db..f47e366ca 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,10 @@ Eventually this will not be necessary. ## Contributing -* Hang out with us on IRC, nucleus.kafuka.org #skeetendo ([or use mibbit](http://chat.mibbit.com/?server=nucleus.kafuka.org&channel=#skeetendo)) +* Hang out with us on IRC: +`nucleus.kafuka.org #skeetendo` +(or use [mibbit](http://chat.mibbit.com/?server=nucleus.kafuka.org&channel=#skeetendo)). + +* Are we missing something? Make a pull request! Contributions are welcome. * Tackle some [issues](https://github.com/kanzure/pokecrystal/issues)! From 45164c70b27126614e855c0696c36840eeb90c58 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 7 Apr 2013 00:26:32 -0400 Subject: [PATCH 033/112] BreedMon typo in wram --- wram.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wram.asm b/wram.asm index 297a6396c..a31ec0cae 100644 --- a/wram.asm +++ b/wram.asm @@ -1590,7 +1590,7 @@ BreedMon2Nick: ; df2f BreedMon2OT: ; df3a ds 11 BreedMon2Stats: -BreedMon1Species: ; df45 +BreedMon2Species: ; df45 ds 1 ds 31 From 1888e8ad6b05bbf2655665856f71c41b64822fb4 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 7 Apr 2013 00:26:50 -0400 Subject: [PATCH 034/112] this is not pokered --- .gitignore | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c9260280d..094c03a17 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,10 @@ extras/*.json # for any of the poor souls with save game files in their working directory baserom.sgm baserom.sav -pokered.sgm -pokered.sav +baserom.rtc +pokecrystal.sgm +pokecrystal.sav +pokecrystal.rtc # for vim configuration # url: http://www.vim.org/scripts/script.php?script_id=441 From 5f4fcbfba2742a04bd0dff37b8d0d5a90e56e3c3 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 8 Apr 2013 02:15:08 -0400 Subject: [PATCH 035/112] minor wram fixes --- battle/effect_commands.asm | 4 ++-- constants.asm | 1 + wram.asm | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index dcc3a3d2a..391758073 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -1976,7 +1976,7 @@ Function0x349f4: ; 349f4 Function0x34a2a: ; 34a2a - ld hl, OTPartyMon1Species2 + ld hl, OTPartyMon1 ld a, [OTPartyCount] ld b, a ld c, $20 @@ -3914,8 +3914,8 @@ Function0x355bd: ; 355bd and a ld hl, PartyMon1Species jr z, .asm_355cc + ld hl, OTPartyMon1Species - ld hl, OTPartyMon1Species2 .asm_355cc ld a, [DefaultFlypoint] add hl, bc diff --git a/constants.asm b/constants.asm index 395c41b65..5f620f34b 100644 --- a/constants.asm +++ b/constants.asm @@ -3357,6 +3357,7 @@ SPECIAL_MONCHECK EQU $0097 ; predefs PREDEF_FILLPP EQU $05 +PREDEF_ADDPARTYMON EQU $06 PREDEF_FILLSTATS EQU $0C PREDEF_FILLMOVES EQU $1B PREDEF_GETUNOWNLETTER EQU $2D diff --git a/wram.asm b/wram.asm index a31ec0cae..9ee4b00ba 100644 --- a/wram.asm +++ b/wram.asm @@ -634,7 +634,7 @@ PlayerEvaLevel: ; c6d2 ds 1 ; c6d3 ds 1 -PlayerStatLevelsEnd +PlayerStatLevelsEnd: EnemyStatLevels: ; c6d4 ; 07 neutral @@ -746,7 +746,7 @@ LastEnemyMove: ; c71c SECTION "overworldmap",BSS[$c800] OverworldMap: ; c800 ds 1300 -OverworldMapEnd +OverworldMapEnd: ds 12 @@ -1102,7 +1102,7 @@ OTPartySpecies: ; d281 ; or the routine will keep going OTPartyMon1: -OTPartyMon1Species2: ; d288 +OTPartyMon1Species: ; d288 ds 1 OTPartyMon1Item: ; d289 ds 1 @@ -1239,6 +1239,7 @@ PlayerID: ; d47b ds 2 PlayerName: ; d47d ds 11 +PlayerNameEnd: ; d478 ds 46 @@ -1430,9 +1431,8 @@ PartyCount: ; dcd7 ds 1 ; number of Pokémon in party PartySpecies: ; dcd8 ds 6 ; species of each Pokémon in party -; dcde - ds 1 ; any empty slots including the 7th must be FF - ; or the routine will keep going +PartyEnd: ; dcde + ds 1 ; legacy functions don't check PartyCount PartyMons: PartyMon1: @@ -1479,7 +1479,7 @@ PartyMon1PokerusStatus: ; dcfb ds 1 PartyMon1CaughtData: ; dcfc PartyMon1CaughtTime: ; dcfc -PartyMon1CaughtLevel ; dcfc +PartyMon1CaughtLevel: ; dcfc ds 1 PartyMon1CaughtGender: ; dcfd PartyMon1CaughtLocation: ; dcfd From 48f5e7dfb8c94144170085959e2e2dd414f20514 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 8 Apr 2013 02:23:32 -0400 Subject: [PATCH 036/112] Shuckle special --- constants.asm | 2 ++ main.asm | 85 ++++++++++++++++++++++++++++++++++++++++++-- maps/ManiasHouse.asm | 2 +- 3 files changed, 86 insertions(+), 3 deletions(-) diff --git a/constants.asm b/constants.asm index 5f620f34b..5b5c5ba50 100644 --- a/constants.asm +++ b/constants.asm @@ -3328,6 +3328,8 @@ SPECIAL_BIKESURFMUSIC EQU $003c SPECIAL_LOADFACESTEP EQU $003f +SPECIAL_GIVESHUCKLE EQU $004b + SPECIAL_SNORLAXAWAKE EQU $0060 SPECIAL_GAMEBOYCHECK EQU $0066 diff --git a/main.asm b/main.asm index 106a76a2b..8dcf49f70 100644 --- a/main.asm +++ b/main.asm @@ -4384,7 +4384,88 @@ DrawGraphic: ; 6eef ret ; 6f07 -INCBIN "baserom.gbc", $6f07, $747b - $6f07 + +INCBIN "baserom.gbc", $6f07, $7305 - $6f07 + + +SpecialGiveShuckle: ; 7305 + +; Adding to the party. + xor a + ld [MonType], a + +; Level 15 Shuckle. + ld a, SHUCKLE + ld [CurPartySpecies], a + ld a, 15 + ld [CurPartyLevel], a + + ld a, PREDEF_ADDPARTYMON + call Predef + jr nc, .NotGiven + +; Caught data. + ld b, 0 + ld a, $13 + ld hl, $5ba3 + rst $8 + +; Holding a Berry. + ld bc, PartyMon2 - PartyMon1 + ld a, [PartyCount] + dec a + push af + push bc + ld hl, PartyMon1Item + call AddNTimes + ld [hl], BERRY + pop bc + pop af + +; OT ID. + ld hl, PartyMon1ID + call AddNTimes + ld a, $2 + ld [hli], a + ld [hl], $6 + +; Nickname. + ld a, [PartyCount] + dec a + ld hl, PartyMon1Nickname + call SkipNames + ld de, .Shuckie + call CopyName2 + +; OT. + ld a, [PartyCount] + dec a + ld hl, PartyMon1OT + call SkipNames + ld de, .Mania + call CopyName2 + +; Bittable2 flag for this event. + ld hl, $dc1e + set 5, [hl] + + ld a, 1 + ld [ScriptVar], a + ret + +.NotGiven + xor a + ld [ScriptVar], a + ret + +.Mania + db "MANIA@" +.Shuckie + db "SHUCKIE@" +; 737e + + +INCBIN "baserom.gbc", $737e, $747b - $737e SECTION "bank2",DATA,BANK[$2] @@ -4697,7 +4778,7 @@ SpecialsPointers: ; 0xc029 dbw $03, $43fc dbw $09, $6feb dbw $09, $7043 - dbw $01, $7305 + dbw BANK(SpecialGiveShuckle), SpecialGiveShuckle dbw $01, $737e dbw $01, $73f7 dbw BANK(SpecialCheckPokerus),SpecialCheckPokerus diff --git a/maps/ManiasHouse.asm b/maps/ManiasHouse.asm index a3847e4fc..ce4d58b8e 100644 --- a/maps/ManiasHouse.asm +++ b/maps/ManiasHouse.asm @@ -16,7 +16,7 @@ UnknownScript_0x9d278: ; 0x9d278 2writetext UnknownText_0x9d303 yesorno iffalse UnknownScript_0x9d2b6 - special $004b + special SPECIAL_GIVESHUCKLE iffalse UnknownScript_0x9d2b0 2writetext UnknownText_0x9d3ed keeptextopen From cc12b765d97b185829e27ba3e669526bb663105c Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 8 Apr 2013 13:15:04 -0400 Subject: [PATCH 037/112] fix special constant spacing --- constants.asm | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/constants.asm b/constants.asm index 5b5c5ba50..cfa27c28e 100644 --- a/constants.asm +++ b/constants.asm @@ -3321,40 +3321,40 @@ NOTE_16 EQU $0f ; specials NUM_SPECIALS EQU $a8 -SPECIAL_UPDATESPRITETILES EQU $0038 +SPECIAL_UPDATESPRITETILES EQU $0038 -SPECIAL_WAITSFX EQU $003b -SPECIAL_BIKESURFMUSIC EQU $003c +SPECIAL_WAITSFX EQU $003b +SPECIAL_BIKESURFMUSIC EQU $003c -SPECIAL_LOADFACESTEP EQU $003f +SPECIAL_LOADFACESTEP EQU $003f SPECIAL_GIVESHUCKLE EQU $004b -SPECIAL_SNORLAXAWAKE EQU $0060 +SPECIAL_SNORLAXAWAKE EQU $0060 -SPECIAL_GAMEBOYCHECK EQU $0066 -SPECIAL_TRAINERHOUSE EQU $0067 +SPECIAL_GAMEBOYCHECK EQU $0066 +SPECIAL_TRAINERHOUSE EQU $0067 -SPECIAL_RUSTLETREE EQU $006a +SPECIAL_RUSTLETREE EQU $006a -SPECIAL_ODDEGG EQU $007d +SPECIAL_ODDEGG EQU $007d -SPECIAL_MOVETUTOR EQU $0083 -SPECIAL_OMANYTECHAMBER EQU $0084 +SPECIAL_MOVETUTOR EQU $0083 +SPECIAL_OMANYTECHAMBER EQU $0084 -SPECIAL_RUINCHAMBERWALL EQU $0087 +SPECIAL_RUINCHAMBERWALL EQU $0087 -SPECIAL_HOOHCHAMBER EQU $008d +SPECIAL_HOOHCHAMBER EQU $008d -SPECIAL_CELEBI EQU $008f +SPECIAL_CELEBI EQU $008f -SPECIAL_AFTERCELEBI EQU $0090 -SPECIAL_POKESEER EQU $0091 +SPECIAL_AFTERCELEBI EQU $0090 +SPECIAL_POKESEER EQU $0091 -SPECIAL_DRATINI EQU $0094 +SPECIAL_DRATINI EQU $0094 -SPECIAL_BEASTSCHECK EQU $0096 -SPECIAL_MONCHECK EQU $0097 +SPECIAL_BEASTSCHECK EQU $0096 +SPECIAL_MONCHECK EQU $0097 ; predefs From 474606ace72dc44565dfbd58e5e286a8456a9157 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 12 Apr 2013 17:21:22 -0400 Subject: [PATCH 038/112] TempMon struct --- wram.asm | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/wram.asm b/wram.asm index 9ee4b00ba..468bb41b6 100644 --- a/wram.asm +++ b/wram.asm @@ -912,7 +912,76 @@ CurPartyMon: ; d109 ; 0-5 ds 1 - ds 55 + ds 4 + +TempMon: +TempMonSpecies: ; d10e + ds 1 +TempMonItem: ; d10f + ds 1 +TempMonMoves: ; d110 +TempMonMove1: ; d110 + ds 1 +TempMonMove2: ; d111 + ds 1 +TempMonMove3: ; d112 + ds 1 +TempMonMove4: ; d113 + ds 1 +TempMonID: ; d114 + ds 2 +TempMonExp: ; d116 + ds 3 +TempMonHPExp: ; d119 + ds 2 +TempMonAtkExp: ; d11b + ds 2 +TempMonDefExp: ; d11d + ds 2 +TempMonSpdExp: ; d11f + ds 2 +TempMonSpclExp: ; d121 + ds 2 +TempMonDVs: ; d123 +; hp = %1000 for each dv + ds 1 ; atk/def + ds 1 ; spd/spc +TempMonPP: ; d125 + ds 4 +TempMonHappiness: ; d129 + ds 1 +TempMonPokerusStatus: ; d12a + ds 1 +TempMonCaughtData: ; d12b +TempMonCaughtTime: ; d12b +TempMonCaughtLevel: ; d12b + ds 1 +TempMonCaughtGender: ; d12c +TempMonCaughtLocation: ; d12c + ds 1 +TempMonLevel: ; d12d + ds 1 +TempMonStatus: ; d12e + ds 1 +; d12f + ds 1 +TempMonCurHP: ; d130 + ds 2 +TempMonMaxHP: ; d132 + ds 2 +TempMonAtk: ; d134 + ds 2 +TempMonDef: ; d136 + ds 2 +TempMonSpd: ; d138 + ds 2 +TempMonSpclAtk: ; d13a + ds 2 +TempMonSpclDef: ; d13c + ds 2 +TempMonEnd: ; d13e + + ds 3 PartyMenuActionText ; d141 ds 1 From d6f6df0feba7c9eb535b336b67a73b15d900a234 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 12 Apr 2013 17:21:31 -0400 Subject: [PATCH 039/112] evolution minimum happiness constant --- constants.asm | 1 + 1 file changed, 1 insertion(+) diff --git a/constants.asm b/constants.asm index cfa27c28e..f77f6c4ec 100644 --- a/constants.asm +++ b/constants.asm @@ -2337,6 +2337,7 @@ EVOLVE_HAPPINESS EQU 4 EVOLVE_STAT EQU 5 ; happiness evolution triggers +HAPPINESS_TO_EVOLVE EQU 220 TR_ANYTIME EQU 1 TR_MORNDAY EQU 2 TR_NITE EQU 3 From 736275ae0a136c90417442ce7a042aa6f8fa7bbb Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 12 Apr 2013 17:23:39 -0400 Subject: [PATCH 040/112] pokedex entries got caught in the map header move --- main.asm | 6 ++++++ maps/HallOfFame.asm | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/main.asm b/main.asm index 8dcf49f70..b0c50b978 100644 --- a/main.asm +++ b/main.asm @@ -17087,6 +17087,12 @@ INCLUDE "maps/LancesRoom.asm" INCLUDE "maps/HallOfFame.asm" +; Pokedex entries I +; 001-064 + +INCLUDE "stats/pokedex/entries_1.asm" + + SECTION "bank61",DATA,BANK[$61] ; Map Scripts XIV diff --git a/maps/HallOfFame.asm b/maps/HallOfFame.asm index 26d531e0e..591963f1a 100644 --- a/maps/HallOfFame.asm +++ b/maps/HallOfFame.asm @@ -123,10 +123,6 @@ HallOfFame_MapEventHeader: ; 0x181678 ; 0x181695 -; Pokedex entries I -; 001-064 - -INCLUDE "stats/pokedex/entries_1.asm" From be3687bb550fcc414e0dc5493888bd8c37979819 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 19 Apr 2013 03:48:07 -0400 Subject: [PATCH 041/112] party flags for evolution checking --- wram.asm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wram.asm b/wram.asm index 468bb41b6..52b89a465 100644 --- a/wram.asm +++ b/wram.asm @@ -1015,7 +1015,10 @@ TileSetPalettes: ; d1e6 ; bank 3f ds 2 - ds 2 +EvolvableFlags: ; d1e8 + ds 1 + + ds 1 Buffer1: MagikarpLength: ; d1ea From f125f14e98d1d3c6e0abbc2f4bf966d8ce563298 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 19 Apr 2013 03:50:13 -0400 Subject: [PATCH 042/112] various battle wram + fixes --- wram.asm | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/wram.asm b/wram.asm index 52b89a465..b29a027fd 100644 --- a/wram.asm +++ b/wram.asm @@ -493,7 +493,7 @@ TypeModifier: ; c665 ; 10: normal ; <10: not very effective -; bit 7 is used for something else +; bit 7: stab ds 1 CriticalHit: ; c666 @@ -576,32 +576,37 @@ EnemySubStatus5: ; c671 ; see PlayerSubStatus5 ds 1 +PlayerRolloutCount: ; c672 ds 1 - PlayerConfuseCount: ; c673 ds 1 - ds 1 - PlayerDisableCount: ; c675 ds 1 PlayerEncoreCount: ; c676 ds 1 PlayerPerishCount: ; c677 ds 1 - - ds 5 - -EnemyEncoreCount: ; c67e +PlayerFuryCutterCount: ; c678 ds 1 -EnemyPerishCount: ; c67f ds 1 - ds 2 +EnemyRolloutCount: ; c67a + ds 1 +EnemyConfuseCount: ; c67b + ds 1 + ds 1 +EnemyEncoreCount: ; c67d + ds 1 +EnemyPerishCount: ; c67e + ds 1 + ds 1 +EnemyFuryCutterCount: ; c680 + ds 1 -PlayerDamageTaken: ; c682 +PlayerDamageTaken: ; c681 ds 2 -EnemyDamageTaken: ; c684 +EnemyDamageTaken: ; c683 ds 2 ds 4 From 7503f9074c9bac623ac436798c4acdae1a0e48b8 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 19 Apr 2013 03:50:45 -0400 Subject: [PATCH 043/112] effect command cleanup -weather and badge type boosts --- battle/effect_commands.asm | 175 ++++++++++++++++++------------- main.asm | 209 ++++++++++++++++++++++++++++++++++++- 2 files changed, 313 insertions(+), 71 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 391758073..726dc0371 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -376,7 +376,7 @@ CantMove: ; 341f0 and $ec ld [hl], a - call Function0x377be + call ResetFuryCutterCount ld a, BATTLE_VARS_MOVE_ANIM call CleanGetBattleVarPair @@ -1394,9 +1394,10 @@ BattleCommand07: ; 346d2 ld a, [hli] ld d, a ld e, [hl] + ld a, [hBattleTurn] and a - jr z, .asm_346f7 + jr z, .go ld hl, EnemyMonType1 ld a, [hli] @@ -1407,7 +1408,7 @@ BattleCommand07: ; 346d2 ld d, a ld e, [hl] -.asm_346f7 +.go ld a, BATTLE_VARS_MOVE_TYPE call GetBattleVarPair ld [$d265], a @@ -1415,69 +1416,77 @@ BattleCommand07: ; 346d2 push hl push de push bc - ld a, $3e - ld hl, $7da4 - rst FarCall + callba DoWeatherModifiers pop bc pop de pop hl push de push bc - ld a, $3e - ld hl, $7e24 - rst FarCall + callba DoBadgeTypeBoosts pop bc pop de ld a, [$d265] cp b - jr z, .asm_34720 + jr z, .stab cp c - jr z, .asm_34720 + jr z, .stab + jr .asm_3473a -.asm_34720 +.stab ld hl, CurDamage + 1 ld a, [hld] ld h, [hl] ld l, a + ld b, h ld c, l srl b rr c add hl, bc + ld a, h ld [CurDamage], a ld a, l ld [CurDamage + 1], a + ld hl, TypeModifier set 7, [hl] + .asm_3473a ld a, BATTLE_VARS_MOVE_TYPE call CleanGetBattleVarPair ld b, a ld hl, TypeMatchup + .asm_34743 ld a, [hli] + cp $ff - jr z, .asm_347b7 ; 34746 $6f + jr z, .end + +; foresight cp $fe - jr nz, .asm_34757 ; 3474a $b + jr nz, .asm_34757 ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair bit 3, a - jr nz, .asm_347b7 ; 34753 $62 - jr .asm_34743 ; 34755 $ec + jr nz, .end + + jr .asm_34743 + .asm_34757 cp b - jr nz, .asm_347b3 ; 34758 $59 + jr nz, .asm_347b3 ld a, [hl] cp d - jr z, .asm_34763 ; 3475c $5 + jr z, .asm_34763 cp e - jr z, .asm_34763 ; 3475f $2 - jr .asm_347b3 ; 34761 $50 + jr z, .asm_34763 + jr .asm_347b3 + .asm_34763 push hl push bc @@ -1487,7 +1496,7 @@ BattleCommand07: ; 346d2 ld b, a ld a, [hl] and a - jr nz, .asm_34775 ; 3476e $5 + jr nz, .asm_34775 inc a ld [AttackMissed], a xor a @@ -1495,14 +1504,18 @@ BattleCommand07: ; 346d2 ld [$ffb7], a add b ld [TypeModifier], a + xor a ld [$ffb4], a + ld hl, CurDamage ld a, [hli] ld [$ffb5], a ld a, [hld] ld [$ffb6], a + call $3119 + ld a, [$ffb4] ld b, a ld a, [$ffb5] @@ -1510,7 +1523,8 @@ BattleCommand07: ; 346d2 ld b, a ld a, [$ffb6] or b - jr z, .asm_347ab ; 34794 $15 + jr z, .asm_347ab + ld a, $a ld [$ffb7], a ld b, $4 @@ -1519,9 +1533,11 @@ BattleCommand07: ; 346d2 ld b, a ld a, [$ffb6] or b - jr nz, .asm_347ab ; 347a5 $4 + jr nz, .asm_347ab + ld a, $1 ld [$ffb6], a + .asm_347ab ld a, [$ffb5] ld [hli], a @@ -1529,11 +1545,13 @@ BattleCommand07: ; 346d2 ld [hl], a pop bc pop hl + .asm_347b3 inc hl inc hl - jr .asm_34743 ; 347b5 $8c -.asm_347b7 + jr .asm_34743 + +.end call Function0x347c8 ld a, [$d265] ld b, a @@ -2780,10 +2798,10 @@ BattleCommand0b: ; 34f60 ld a, [hBattleTurn] and a - ld de, $c672 + ld de, PlayerRolloutCount ld a, 1 jr z, .asm_34f76 - ld de, $c67a + ld de, EnemyRolloutCount ld a, 4 .asm_34f76 @@ -3156,11 +3174,11 @@ BattleCommand0f: ; 35175 BattleCommandae: ; 35197 ; startloop - ld hl, $c672 + ld hl, PlayerRolloutCount ld a, [hBattleTurn] and a jr z, .asm_351a2 - ld hl, $c67a + ld hl, EnemyRolloutCount .asm_351a2 xor a @@ -3473,7 +3491,7 @@ PlayerAttackDamage: ; 352e2 ; 3534d -Function0x3534d: ; 3534d= +Function0x3534d: ; 3534d ld a, h or b jr z, .asm_3536b ; 0x3534f $1a @@ -3726,12 +3744,12 @@ BattleCommanda1: ; 35461 ld c, $14 call DelayFrames xor a - ld [$c672], a + ld [PlayerRolloutCount], a ld [DefaultFlypoint], a ld [$c72d], a jr .asm_3548d ; 35480 $b .asm_35482 - ld a, [$c672] + ld a, [PlayerRolloutCount] ld b, a ld a, [PartyCount] sub b @@ -3791,13 +3809,13 @@ BattleCommanda1: ; 35461 jr nz, .asm_35502 xor a - ld [$c67a], a + ld [EnemyRolloutCount], a ld [DefaultFlypoint], a ld [$c72d], a jr .asm_3550d .asm_35502 - ld a, [$c67a] + ld a, [EnemyRolloutCount] ld b, a ld a, [OTPartyCount] sub b @@ -6803,11 +6821,11 @@ BattleCommand21: ; 36671 call CleanGetBattleVarPair bit 0, a ret z - ld hl, $c672 + ld hl, PlayerRolloutCount ld a, [hBattleTurn] and a jr z, .asm_36684 ; 3667f $3 - ld hl, $c67a + ld hl, EnemyRolloutCount .asm_36684 dec [hl] jr nz, .asm_366dc ; 36685 $55 @@ -6870,12 +6888,12 @@ BattleCommand22: ; 366e5 ; unleashenergy ld de, $c682 - ld bc, $c672 + ld bc, PlayerRolloutCount ld a, [hBattleTurn] and a jr z, .asm_366f6 ; 366ee $6 ld de, $c684 - ld bc, $c67a + ld bc, EnemyRolloutCount .asm_366f6 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair @@ -6901,11 +6919,11 @@ BattleCommand22: ; 366e5 BattleCommand3e: ; 3671a ; checkrampage - ld de, $c672 + ld de, PlayerRolloutCount ld a, [hBattleTurn] and a jr z, .asm_36725 ; 36720 $3 - ld de, $c67a + ld de, EnemyRolloutCount .asm_36725 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair @@ -6944,11 +6962,11 @@ BattleCommand3d: ; 36751 and 7 ret nz - ld de, $c672 + ld de, PlayerRolloutCount ld a, [hBattleTurn] and a jr z, .asm_36764 ; 3675f $3 - ld de, $c67a + ld de, EnemyRolloutCount .asm_36764 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair @@ -6957,7 +6975,7 @@ BattleCommand3d: ; 36751 and $1 inc a ld [de], a - ld a, $1 + ld a, 1 ld [$c73e], a ret ; 36778 @@ -7310,12 +7328,12 @@ BattleCommand24: ; 369b6 ; Loop back to the command before 'critical'. - ld de, $c672 + ld de, PlayerRolloutCount ld bc, $c682 ld a, [hBattleTurn] and a jr z, .asm_369c7 - ld de, $c67a + ld de, EnemyRolloutCount ld bc, $c684 .asm_369c7 @@ -9562,11 +9580,11 @@ BattleCommand59: ; 376f8 BattleCommand5b: ; 37718 ; checkcurl - ld de, $c672 + ld de, PlayerRolloutCount ld a, [hBattleTurn] and a jr z, .asm_37723 ; 3771e $3 - ld de, $c67a + ld de, EnemyRolloutCount .asm_37723 ld a, BATTLE_VARS_SUBSTATUS1 call CleanGetBattleVarPair @@ -9588,28 +9606,33 @@ BattleCommand5c: ; 37734 ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair - and $7 + and 7 ret nz - ld hl, $c672 + + ld hl, PlayerRolloutCount ld a, [hBattleTurn] and a - jr z, .asm_37747 ; 37742 $3 - ld hl, $c67a + jr z, .asm_37747 + ld hl, EnemyRolloutCount + .asm_37747 ld a, [hl] and a - jr nz, .asm_37750 ; 37749 $5 - ld a, $1 + jr nz, .asm_37750 + ld a, 1 ld [$c73e], a + .asm_37750 ld a, [AttackMissed] and a - jr z, .asm_3775e ; 37754 $8 + jr z, .hit + ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarPair res 6, [hl] ret -.asm_3775e + +.hit inc [hl] ld a, [hl] ld b, a @@ -9619,10 +9642,12 @@ BattleCommand5c: ; 37734 call GetBattleVarPair res 6, [hl] jr .asm_37775 ; 3776c $7 + .asm_3776e ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarPair set 6, [hl] + .asm_37775 ld a, BATTLE_VARS_SUBSTATUS2 call CleanGetBattleVarPair @@ -9654,29 +9679,38 @@ BattleCommand5d: ; 37791 BattleCommand5e: ; 37792 ; furycutter - ld hl, $c678 + ld hl, PlayerFuryCutterCount ld a, [hBattleTurn] and a - jr z, .asm_3779d ; 37798 $3 - ld hl, $c680 -.asm_3779d + jr z, .go + ld hl, EnemyFuryCutterCount + +.go ld a, [AttackMissed] and a - jp nz, Function0x377be + jp nz, ResetFuryCutterCount + inc [hl] + +; Damage capped at 5 turns' worth (16x). ld a, [hl] ld b, a - cp $6 - jr c, .asm_377ad ; 377a9 $2 - ld b, $5 -.asm_377ad + cp 6 + jr c, .checkdouble + ld b, 5 + +.checkdouble dec b ret z + +; Double the damage ld hl, CurDamage + 1 sla [hl] dec hl rl [hl] - jr nc, .asm_377ad ; 377b7 $f4 + jr nc, .checkdouble + +; No overflow ld a, $ff ld [hli], a ld [hl], a @@ -9684,16 +9718,17 @@ BattleCommand5e: ; 37792 ; 377be -Function0x377be: ; 377be +ResetFuryCutterCount: ; 377be + push hl - ld hl, $c678 + ld hl, PlayerFuryCutterCount ld a, [hBattleTurn] and a - jr z, .asm_377ca - ld hl, $c680 + jr z, .reset + ld hl, EnemyFuryCutterCount -.asm_377ca +.reset xor a ld [hl], a diff --git a/main.asm b/main.asm index b0c50b978..40be7f96a 100644 --- a/main.asm +++ b/main.asm @@ -14457,7 +14457,214 @@ INCBIN "baserom.gbc", $f8ea3, $fbbfc - $f8ea3 INCLUDE "battle/magikarp_length.asm" -INCBIN "baserom.gbc", $fbccf, $fbe91 - $fbccf +INCBIN "baserom.gbc", $fbccf, $fbda4 - $fbccf + + +DoWeatherModifiers: ; fbda4 + + ld de, .WeatherTypeModifiers + ld a, [Weather] + ld b, a + ld a, [$d265] ; move type + ld c, a + +.CheckWeatherType + ld a, [de] + inc de + cp $ff + jr z, .asm_fbdc0 + + cp b + jr nz, .NextWeatherType + + ld a, [de] + cp c + jr z, .ApplyModifier + +.NextWeatherType + inc de + inc de + jr .CheckWeatherType + + +.asm_fbdc0 + ld de, .WeatherMoveModifiers + + ld a, BATTLE_VARS_MOVE_EFFECT + call CleanGetBattleVarPair + ld c, a + +.CheckWeatherMove + ld a, [de] + inc de + cp $ff + jr z, .done + + cp b + jr nz, .NextWeatherMove + + ld a, [de] + cp c + jr z, .ApplyModifier + +.NextWeatherMove + inc de + inc de + jr .CheckWeatherMove + +.ApplyModifier + xor a + ld [$ffb4], a + ld hl, CurDamage + ld a, [hli] + ld [$ffb5], a + ld a, [hl] + ld [$ffb6], a + + inc de + ld a, [de] + ld [$ffb7], a + + call Multiply + + ld a, 10 + ld [$ffb7], a + ld b, $4 + call Divide + + ld a, [$ffb4] + and a + ld bc, $ffff + jr nz, .Update + + ld a, [$ffb5] + ld b, a + ld a, [$ffb6] + ld c, a + or b + jr nz, .Update + + ld bc, 1 + +.Update + ld a, b + ld [CurDamage], a + ld a, c + ld [CurDamage + 1], a + +.done + ret + +.WeatherTypeModifiers + db WEATHER_RAIN, WATER, 15 + db WEATHER_RAIN, FIRE, 05 + db WEATHER_SUN, FIRE, 15 + db WEATHER_SUN, WATER, 05 + db $ff + +.WeatherMoveModifiers + db WEATHER_RAIN, $97, 05 ; Solarbeam + db $ff +; fbe24 + + +DoBadgeTypeBoosts: ; fbe24 + ld a, [InLinkBattle] + and a + ret nz + + ld a, [$cfc0] + and a + ret nz + + ld a, [hBattleTurn] + and a + ret nz + + push de + push bc + + ld hl, .BadgeTypes + + ld a, [KantoBadges] + ld b, a + ld a, [JohtoBadges] + ld c, a + +.CheckBadge + ld a, [hl] + cp $ff + jr z, .done + + srl b + rr c + jr nc, .NextBadge + + ld a, [$d265] ; move type + cp [hl] + jr z, .ApplyBoost + +.NextBadge + inc hl + jr .CheckBadge + +.ApplyBoost + ld a, [CurDamage] + ld h, a + ld d, a + ld a, [CurDamage + 1] + ld l, a + ld e, a + + srl d + rr e + srl d + rr e + srl d + rr e + + ld a, e + or d + jr nz, .asm_fbe6f + ld e, 1 + +.asm_fbe6f + add hl, de + jr nc, .Update + + ld hl, $ffff + +.Update + ld a, h + ld [CurDamage], a + ld a, l + ld [$d257], a + +.done + pop bc + pop de + ret + +.BadgeTypes + db FLYING ; zephyrbadge + db BUG ; hivebadge + db NORMAL ; plainbadge + db GHOST ; fogbadge + db STEEL ; mineralbadge + db FIGHTING ; stormbadge + db ICE ; glacierbadge + db DRAGON ; risingbadge + + db ROCK ; boulderbadge + db WATER ; cascadebadge + db ELECTRIC ; thunderbadge + db GRASS ; rainbowbadge + db POISON ; soulbadge + db PSYCHIC ; marshbadge + db FIRE ; volcanobadge + db GROUND ; earthbadge + db $ff +; fbe91 SECTION "bank3F",DATA,BANK[$3F] From 8f55647441707de49e472d9f75a3939967d172ad Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 20 Apr 2013 02:29:39 -0400 Subject: [PATCH 044/112] Clarify species-item boost functions --- battle/effect_commands.asm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 726dc0371..88be8a7c1 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -3580,8 +3580,10 @@ GetDamageStats: ; 3537e ThickClubBoost: ; 353b5 +; Return in hl the stat value at hl. + ; If the attacking monster is Cubone or Marowak and -; it's holding a Thick Club, double stat value hl. +; it's holding a Thick Club, double it. push bc push de ld b, CUBONE @@ -3595,8 +3597,10 @@ ThickClubBoost: ; 353b5 LightBallBoost: ; 353c3 +; Return in hl the stat value at hl. + ; If the attacking monster is Pikachu and it's -; holding a Light Ball, double stat value hl. +; holding a Light Ball, double it. push bc push de ld b, PIKACHU @@ -3610,8 +3614,10 @@ LightBallBoost: ; 353c3 SpeciesItemBoost: ; 353d1 +; Return in hl the stat value at hl. + ; If the attacking monster is species b or c and -; it's holding item d, double stat value hl. +; it's holding item d, double it. ld a, [hli] ld l, [hl] @@ -3998,7 +4004,7 @@ BattleCommand62: ; 35612 cp $7 jr nz, .asm_35620 ; 35619 $5 srl c - jr nz, .asm_35620 ; 3561d $1 + jr nz, .asm_35620 ; $3561d $1 inc c .asm_35620 cp $1d From 494f4c13fe2a45d0569bde2fc06e1bdf3fbfc857 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 20 Apr 2013 02:53:08 -0400 Subject: [PATCH 045/112] damagecalc is actually damagestats; itemmultiplier is actually damagecalc --- battle/effect_commands.asm | 283 +++++++++++++++++++++++----------- battle/moves/move_effects.asm | 120 +++++++------- extras/crystal.py | 4 +- 3 files changed, 256 insertions(+), 151 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 88be8a7c1..0b38c25d0 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -3416,7 +3416,7 @@ DittoMetalPowder: ; 352b1 BattleCommand06: ; 352dc -; damagecalc +; damagestats ld a, [hBattleTurn] and a @@ -3427,64 +3427,87 @@ BattleCommand06: ; 352dc PlayerAttackDamage: ; 352e2 +; Return move power d, player level e, enemy defense c and player attack b. call ResetDamage + ld hl, PlayerMovePower ld a, [hli] and a ld d, a ret z + ld a, [hl] - cp $14 - jr nc, .asm_35315 ; 352ef $24 + cp FIRE + jr nc, .special + + +; Physical ld hl, EnemyMonDef ld a, [hli] ld b, a ld c, [hl] + +; Reflect ld a, [$c700] bit 4, a - jr z, .asm_35302 ; 352fc $4 + jr z, .physicalcrit sla c rl b -.asm_35302 + +.physicalcrit ld hl, BattleMonAtk call GetDamageStatsCritical - jr c, .asm_3533c ; 35308 $32 + jr c, .thickclub + ld hl, $c6c3 ld a, [hli] ld b, a ld c, [hl] ld hl, $c6b6 - jr .asm_3533c ; 35313 $27 -.asm_35315 + jr .thickclub + + +.special ld hl, EnemyMonSpclDef ld a, [hli] ld b, a ld c, [hl] + +; Light Screen ld a, [$c700] bit 3, a - jr z, .asm_35326 ; 35320 $4 + jr z, .specialcrit sla c rl b -.asm_35326 + +.specialcrit ld hl, BattleMonSpclAtk call GetDamageStatsCritical - jr c, .asm_35337 ; 3532c $9 + jr c, .lightball + ld hl, $c6c9 ld a, [hli] ld b, a ld c, [hl] ld hl, $c6bc -.asm_35337 + +.lightball +; Note: Returns player special attack at hl in hl. call LightBallBoost - jr .asm_3533f ; 3533a $3 -.asm_3533c + jr .done + +.thickclub +; Note: Returns player attack at hl in hl. call ThickClubBoost -.asm_3533f + +.done call Function0x3534d + ld a, [BattleMonLevel] ld e, a call DittoMetalPowder + ld a, 1 and a ret @@ -3492,34 +3515,44 @@ PlayerAttackDamage: ; 352e2 Function0x3534d: ; 3534d +; Truncate 16-bit values hl and bc to 8-bit values b and c respectively. +; b = hl, c = bc + ld a, h or b - jr z, .asm_3536b ; 0x3534f $1a + jr z, .asm_3536b + srl b rr c srl b rr c + ld a, c or b - jr nz, .asm_3535e ; 0x3535b $1 + jr nz, .asm_3535e inc c + .asm_3535e srl h rr l srl h rr l + ld a, l or h - jr nz, .asm_3536b ; 0x35368 $1 + jr nz, .asm_3536b inc l + .asm_3536b ld a, [InLinkBattle] - cp $3 - jr z, .asm_35376 ; 0x35370 $4 + cp 3 + jr z, .done + ld a, h or b jr nz, Function0x3534d -.asm_35376 + +.done ld b, l ret ; 35378 @@ -3679,21 +3712,21 @@ EnemyAttackDamage: ; 353f6 ; Reflect ld a, [PlayerScreens] bit 4, a - jr z, .asm_35416 + jr z, .physicalcrit sla c rl b -.asm_35416 +.physicalcrit ld hl, EnemyMonAtk call GetDamageStatsCritical - jr c, .asm_35450 + jr c, .thickclub ld hl, $c6b8 ld a, [hli] ld b, a ld c, [hl] ld hl, $c6c1 - jr .asm_35450 + jr .thickclub .Special @@ -3705,32 +3738,34 @@ EnemyAttackDamage: ; 353f6 ; Light Screen ld a, [PlayerScreens] bit 3, a - jr z, .asm_3543a + jr z, .specialcrit sla c rl b -.asm_3543a +.specialcrit ld hl, EnemyMonSpclAtk call GetDamageStatsCritical - jr c, .asm_3544b + jr c, .lightball ld hl, $c6be ld a, [hli] ld b, a ld c, [hl] ld hl, $c6c7 -.asm_3544b +.lightball call LightBallBoost - jr .asm_35453 + jr .done -.asm_35450 +.thickclub call ThickClubBoost -.asm_35453 +.done call Function0x3534d + ld a, [EnemyMonLevel] ld e, a call DittoMetalPowder + ld a, 1 and a ret @@ -3997,167 +4032,237 @@ Function0x355dd: ; 355dd BattleCommand62: ; 35612 -; itemmultiplier +; damagecalc + +; Return a damage value for move power d, player level e, enemy defense c and player attack b. + +; Return 1 if successful, else 0. ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $7 - jr nz, .asm_35620 ; 35619 $5 + +; Selfdestruct and Explosion halve defense. + cp $7 ; selfdestruct / explosion + jr nz, .asm_35620 + srl c - jr nz, .asm_35620 ; $3561d $1 + jr nz, .asm_35620 inc c + .asm_35620 - cp $1d - jr z, .asm_3562b ; 35622 $7 - cp $1e - jr z, .asm_3562b ; 35626 $3 + +; Variable-hit moves and Conversion can have a power of 0. + cp $1d ; multihit + jr z, .asm_3562b + + cp $1e ; conversion + jr z, .asm_3562b + +; No damage if move power is 0. ld a, d and a ret z + .asm_3562b +; Minimum defense value is 1. ld a, c and a - jr nz, .asm_35631 ; 3562d $2 - ld c, $1 + jr nz, .asm_35631 + ld c, 1 .asm_35631 + + xor a - ld hl, $ffb3 + ld hl, hDividend ld [hli], a ld [hli], a ld [hl], a + +; Level * 2 ld a, e add a - jr nc, .asm_3563e ; 3563a $2 + jr nc, .asm_3563e ld [hl], $1 .asm_3563e inc hl ld [hli], a - ld a, $5 + +; / 5 + ld a, 5 ld [hld], a push bc ld b, $4 - call $3124 + call Divide pop bc + +; + 2 inc [hl] inc [hl] + +; * bp inc hl ld [hl], d - call $3119 + call Multiply + +; * Attack ld [hl], b - call $3119 + call Multiply + +; / Defense ld [hl], c ld b, $4 - call $3124 - ld [hl], $32 + call Divide + +; / 50 + ld [hl], 50 ld b, $4 - call $3124 + call Divide + + +; Item boosts call GetUserItem + ld a, b and a - jr z, .asm_3568f ; 35667 $26 + jr z, .DoneItem + ld hl, TypeBoostItems -.asm_3566c + +.NextItem ld a, [hli] cp $ff - jr z, .asm_3568f ; 3566f $1e + jr z, .DoneItem + +; Item effect cp b ld a, [hli] - jr nz, .asm_3566c ; 35673 $f7 + jr nz, .NextItem + +; Type ld b, a ld a, BATTLE_VARS_MOVE_TYPE call CleanGetBattleVarPair cp b - jr nz, .asm_3568f ; 3567c $11 + jr nz, .DoneItem + +; * 100 + item effect amount ld a, c - add $64 - ld [$ffb7], a - call $3119 - ld a, $64 - ld [$ffb7], a - ld b, $4 - call $3124 -.asm_3568f - call Function0x356eb + add 100 + ld [hMultiplier], a + call Multiply + +; / 100 + ld a, 100 + ld [hDivisor], a + ld b, 4 + call Divide +.DoneItem + +; Critical hits + call .CriticalMultiplier + + +; Update CurDamage (capped at 997). ld hl, CurDamage ld b, [hl] ld a, [$ffb6] add b ld [$ffb6], a - jr nc, .asm_356a5 ; 3569b $8 + jr nc, .asm_356a5 + ld a, [$ffb5] inc a ld [$ffb5], a and a - jr z, .asm_356d9 ; 356a3 $34 + jr z, .Cap + .asm_356a5 ld a, [$ffb3] ld b, a ld a, [$ffb4] or a - jr nz, .asm_356d9 ; 356ab $2c + jr nz, .Cap + ld a, [$ffb5] - cp $3 - jr c, .asm_356bd ; 356b1 $a - cp $4 - jr nc, .asm_356d9 ; 356b5 $22 + cp 998 / $100 + jr c, .asm_356bd + + cp 998 / $100 + 1 + jr nc, .Cap + ld a, [$ffb6] - cp $e6 - jr nc, .asm_356d9 ; 356bb $1c + cp 998 % $100 + jr nc, .Cap + .asm_356bd inc hl + ld a, [$ffb6] ld b, [hl] add b ld [hld], a + ld a, [$ffb5] ld b, [hl] adc b ld [hl], a - jr c, .asm_356d9 ; 356c8 $f + jr c, .Cap + ld a, [hl] - cp $3 - jr c, .asm_356df ; 356cd $10 - cp $4 - jr nc, .asm_356d9 ; 356d1 $6 + cp 998 / $100 + jr c, .asm_356df + + cp 998 / $100 + 1 + jr nc, .Cap + inc hl ld a, [hld] - cp $e6 - jr c, .asm_356df ; 356d7 $6 -.asm_356d9 - ld a, $3 + cp 998 % $100 + jr c, .asm_356df + +.Cap + ld a, 997 / $100 ld [hli], a - ld a, $e5 + ld a, 997 % $100 ld [hld], a + + .asm_356df +; Minimum neutral damage is 2 (bringing the cap to 999). inc hl ld a, [hl] - add $2 + add 2 ld [hld], a - jr nc, .asm_356e7 ; 356e4 $1 + jr nc, .asm_356e7 inc [hl] .asm_356e7 - ld a, $1 + + ld a, 1 and a ret -; 356eb -Function0x356eb: ; 356eb +.CriticalMultiplier ld a, [CriticalHit] and a ret z +; x2 ld a, [$ffb6] add a ld [$ffb6], a + ld a, [$ffb5] rl a ld [$ffb5], a + +; Cap at $ffff. ret nc ld a, $ff ld [$ffb5], a ld [$ffb6], a + ret ; 35703 diff --git a/battle/moves/move_effects.asm b/battle/moves/move_effects.asm index 9ed9e9194..a17a9a7d5 100644 --- a/battle/moves/move_effects.asm +++ b/battle/moves/move_effects.asm @@ -38,8 +38,8 @@ NormalHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -76,8 +76,8 @@ PoisonHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -101,8 +101,8 @@ LeechHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -126,8 +126,8 @@ BurnHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -151,8 +151,8 @@ FreezeHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -180,8 +180,8 @@ ParalyzeHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -202,8 +202,8 @@ Explosion: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -223,8 +223,8 @@ DreamEater: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -627,8 +627,8 @@ AttackDownHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -652,8 +652,8 @@ DefenseDownHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -679,8 +679,8 @@ SpeedDownHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -701,8 +701,8 @@ SpecialAttackDownHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -726,8 +726,8 @@ SpecialDefenseDownHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -750,8 +750,8 @@ AccuracyDownHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -772,8 +772,8 @@ EvasionDownHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -795,8 +795,8 @@ DefenseUpHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -818,8 +818,8 @@ AttackUpHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -841,8 +841,8 @@ AllUpHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -862,8 +862,8 @@ PayDay: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -919,8 +919,8 @@ Rampage: usedmovetext checkhit critical + damagestats damagecalc - itemmultiplier stab damagevariation clearmissdamage @@ -961,8 +961,8 @@ MultiHit: effect0x0a checkhit critical + damagestats damagecalc - itemmultiplier stab damagevariation clearmissdamage @@ -989,8 +989,8 @@ PoisonMultiHit: checkhit effectchance critical + damagestats damagecalc - itemmultiplier stab damagevariation clearmissdamage @@ -1020,8 +1020,8 @@ FlinchHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1063,8 +1063,8 @@ RecoilHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1115,8 +1115,8 @@ ConfuseHit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1163,8 +1163,8 @@ TriAttack: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1211,8 +1211,8 @@ SkyAttack: charge usedmovetext critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1240,8 +1240,8 @@ HyperBeam: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1260,8 +1260,8 @@ Rage: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab checkhit ragedamage @@ -1322,8 +1322,8 @@ RazorWind: charge usedmovetext critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1345,8 +1345,8 @@ Dig: charge usedmovetext critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1371,8 +1371,8 @@ Whirlpool: doturn checkhit critical + damagestats damagecalc - itemmultiplier stab damagevariation clearmissdamage @@ -1458,8 +1458,8 @@ Snore: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1534,8 +1534,8 @@ FalseSwipe: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation falseswipe @@ -1565,8 +1565,8 @@ TripleKick: effect0x0a checkhit critical + damagestats damagecalc - itemmultiplier triplekick stab damagevariation @@ -1590,8 +1590,8 @@ Thief: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1627,8 +1627,8 @@ FlameWheel: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1701,8 +1701,8 @@ Rollout: doturn usedmovetext critical + damagestats damagecalc - itemmultiplier stab checkhit rolloutpower @@ -1740,8 +1740,8 @@ FuryCutter: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab checkhit furycutter @@ -1769,9 +1769,9 @@ Return: usedmovetext doturn critical - damagecalc + damagestats happinesspower - itemmultiplier + damagecalc stab damagevariation checkhit @@ -1791,9 +1791,9 @@ Present: doturn checkhit critical - damagecalc + damagestats present - itemmultiplier + damagecalc stab damagevariation clearmissdamage @@ -1811,9 +1811,9 @@ Frustration: usedmovetext doturn critical - damagecalc + damagestats frustrationpower - itemmultiplier + damagecalc stab damagevariation checkhit @@ -1839,8 +1839,8 @@ SacredFire: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1861,9 +1861,9 @@ Magnitude: usedmovetext doturn critical - damagecalc + damagestats getmagnitude - itemmultiplier + damagecalc stab damagevariation checkhit @@ -1890,8 +1890,8 @@ Pursuit: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation pursuit @@ -1911,8 +1911,8 @@ RapidSpin: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -1954,7 +1954,7 @@ HiddenPower: doturn critical hiddenpower - itemmultiplier + damagecalc stab damagevariation checkhit @@ -2026,8 +2026,8 @@ SkullBash: charge usedmovetext critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -2049,8 +2049,8 @@ Twister: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation doubleflyingdamage @@ -2071,8 +2071,8 @@ Earthquake: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation doubleundergrounddamage @@ -2092,8 +2092,8 @@ FutureSight: checkobedience usedmovetext doturn + damagestats damagecalc - itemmultiplier futuresight damagevariation checkhit @@ -2109,8 +2109,8 @@ Gust: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation doubleflyingdamage @@ -2129,8 +2129,8 @@ Stomp: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier stab damagevariation doubleminimizedamage @@ -2154,8 +2154,8 @@ Solarbeam: charge usedmovetext critical + damagestats damagecalc - itemmultiplier stab damagevariation checkhit @@ -2174,8 +2174,8 @@ Thunder: usedmovetext doturn critical + damagestats damagecalc - itemmultiplier thunderaccuracy checkhit effectchance @@ -2208,7 +2208,7 @@ BeatUp: checkhit critical beatup - itemmultiplier + damagecalc damagevariation clearmissdamage effect0x0b diff --git a/extras/crystal.py b/extras/crystal.py index 3f9e164b7..764f42a1e 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -2946,7 +2946,7 @@ effect_commands = { 0x3: ['usedmovetext'], 0x4: ['doturn'], 0x5: ['critical'], - 0x6: ['damagecalc'], + 0x6: ['damagestats'], 0x7: ['stab'], 0x8: ['damagevariation'], 0x9: ['checkhit'], @@ -3038,7 +3038,7 @@ effect_commands = { 0x5f: ['attract'], 0x60: ['happinesspower'], 0x61: ['present'], - 0x62: ['itemmultiplier'], + 0x62: ['damagecalc'], 0x63: ['frustrationpower'], 0x64: ['safeguard'], 0x65: ['checksafeguard'], From 984b47f3e7f6e0358b56293f09ada473ba0f32f8 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 20 Apr 2013 02:57:11 -0400 Subject: [PATCH 046/112] Enemy screens --- battle/effect_commands.asm | 18 +++++++++--------- wram.asm | 9 +++++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 0b38c25d0..ccd3c3748 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -3449,7 +3449,7 @@ PlayerAttackDamage: ; 352e2 ld c, [hl] ; Reflect - ld a, [$c700] + ld a, [EnemyScreens] bit 4, a jr z, .physicalcrit sla c @@ -3475,7 +3475,7 @@ PlayerAttackDamage: ; 352e2 ld c, [hl] ; Light Screen - ld a, [$c700] + ld a, [EnemyScreens] bit 3, a jr z, .specialcrit sla c @@ -4003,7 +4003,7 @@ Function0x355dd: ; 355dd jr z, .asm_355f7 ld hl, EnemyMonDef - ld de, $c700 + ld de, EnemyScreens ld a, [EnemyMonLevel] .asm_355f7 push af @@ -8989,7 +8989,7 @@ BattleCommand2e: ; 372fc ld a, [hBattleTurn] and a jr z, .asm_3730d - ld hl, $c700 + ld hl, EnemyScreens ld bc, $c706 .asm_3730d ld a, BATTLE_VARS_MOVE_EFFECT @@ -9597,7 +9597,7 @@ BattleCommand5a: ; 3766f BattleCommand56: ; 37683 ; spikes - ld hl, $c700 + ld hl, EnemyScreens ld a, [hBattleTurn] and a jr z, .asm_3768e ; 37689 $3 @@ -10087,7 +10087,7 @@ BattleCommand64: ; 37939 ld a, [hBattleTurn] and a jr z, .asm_3794a ; 37942 $6 - ld hl, $c700 + ld hl, EnemyScreens ld de, $c705 .asm_3794a bit 2, [hl] @@ -10106,7 +10106,7 @@ BattleCommand64: ; 37939 Function0x37962: ; 37962 push hl - ld hl, $c700 + ld hl, EnemyScreens ld a, [hBattleTurn] and a jr z, .asm_3796e @@ -10121,7 +10121,7 @@ Function0x37962: ; 37962 BattleCommand65: ; 37972 ; checksafeguard - ld hl, $c700 + ld hl, EnemyScreens ld a, [hBattleTurn] and a jr z, .asm_3797d ; 37978 $3 @@ -10448,7 +10448,7 @@ BattleCommand69: ; 37b39 ld a, [hBattleTurn] and a jr z, .asm_37b5b ; 37b53 $6 - ld hl, $c700 + ld hl, EnemyScreens ld de, $c731 .asm_37b5b bit 0, [hl] diff --git a/wram.asm b/wram.asm index b29a027fd..c0938cca3 100644 --- a/wram.asm +++ b/wram.asm @@ -709,8 +709,13 @@ PlayerScreens: ; c6ff ; bit 4: reflect ; bit 3: light screen ds 1 - - ds 2 + +EnemyScreens: ; c700 +; bit 4: reflect +; bit 3: light screen + ds 1 + + ds 1 PlayerLightScreenCount: ; c702 ds 1 From af990910eabcd57c6697dd1c68c705d64add2f43 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 25 Apr 2013 03:53:34 -0400 Subject: [PATCH 047/112] move effect constants --- constants.asm | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) diff --git a/constants.asm b/constants.asm index f77f6c4ec..b764c8585 100644 --- a/constants.asm +++ b/constants.asm @@ -3484,6 +3484,167 @@ PAR EQU 1 << 6 +; move effects +EFFECT_NORMAL_HIT EQU $00 +EFFECT_SLEEP EQU $01 +EFFECT_POISON_HIT EQU $02 +EFFECT_LEECH_HIT EQU $03 +EFFECT_BURN_HIT EQU $04 +EFFECT_FREEZE_HIT EQU $05 +EFFECT_PARALYZE_HIT EQU $06 +EFFECT_EXPLOSION EQU $07 +EFFECT_DREAM_EATER EQU $08 +EFFECT_MIRROR_MOVE EQU $09 +EFFECT_ATTACK_UP EQU $0a +EFFECT_DEFENSE_UP EQU $0b +EFFECT_SPEED_UP EQU $0c +EFFECT_SP_ATTACK_UP EQU $0d +EFFECT_SP_DEFENSE_UP EQU $0e +EFFECT_ACCURACY_UP EQU $0f +EFFECT_EVASION_UP EQU $10 +EFFECT_ALWAYS_HIT EQU $11 +EFFECT_ATTACK_DOWN EQU $12 +EFFECT_DEFENSE_DOWN EQU $13 +EFFECT_SPEED_DOWN EQU $14 +EFFECT_SP_ATTACK_DOWN EQU $15 +EFFECT_SP_DEFENSE_DOWN EQU $16 +EFFECT_ACCURACY_DOWN EQU $17 +EFFECT_EVASION_DOWN EQU $18 +EFFECT_HAZE EQU $19 +EFFECT_BIDE EQU $1a +EFFECT_RAMPAGE EQU $1b +EFFECT_WHIRLWIND EQU $1c +EFFECT_MULTI_HIT EQU $1d +EFFECT_CONVERSION EQU $1e +EFFECT_FLINCH_HIT EQU $1f +EFFECT_HEAL EQU $20 +EFFECT_TOXIC EQU $21 +EFFECT_PAY_DAY EQU $22 +EFFECT_LIGHT_SCREEN EQU $23 +EFFECT_TRI_ATTACK EQU $24 +; unused EQU $25 +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_DOUBLE_HIT EQU $2c +EFFECT_JUMP_KICK EQU $2d +EFFECT_MIST EQU $2e +EFFECT_FOCUS_ENERGY EQU $2f +EFFECT_RECOIL_HIT EQU $30 +EFFECT_CONFUSE EQU $31 +EFFECT_ATTACK_UP_2 EQU $32 +EFFECT_DEFENSE_UP_2 EQU $33 +EFFECT_SPEED_UP_2 EQU $34 +EFFECT_SP_ATTACK_UP_2 EQU $35 +EFFECT_SP_DEFENSE_UP_2 EQU $36 +EFFECT_ACCURACY_UP_2 EQU $37 +EFFECT_EVASION_UP_2 EQU $38 +EFFECT_TRANSFORM EQU $39 +EFFECT_ATTACK_DOWN_2 EQU $3a +EFFECT_DEFENSE_DOWN_2 EQU $3b +EFFECT_SPEED_DOWN_2 EQU $3c +EFFECT_SP_ATTACK_DOWN_2 EQU $3d +EFFECT_SP_DEFENSE_DOWN_2 EQU $3e +EFFECT_ACCURACY_DOWN_2 EQU $3f +EFFECT_EVASION_DOWN_2 EQU $40 +EFFECT_REFLECT EQU $41 +EFFECT_POISON EQU $42 +EFFECT_PARALYZE EQU $43 +EFFECT_ATTACK_DOWN_HIT EQU $44 +EFFECT_DEFENSE_DOWN_HIT EQU $45 +EFFECT_SPEED_DOWN_HIT EQU $46 +EFFECT_SP_ATTACK_DOWN_HIT EQU $47 +EFFECT_SP_DEFENSE_DOWN_HIT EQU $48 +EFFECT_ACCURACY_DOWN_HIT EQU $49 +EFFECT_EVASION_DOWN_HIT EQU $4a +EFFECT_SKY_ATTACK EQU $4b +EFFECT_CONFUSE_HIT EQU $4c +EFFECT_TWINEEDLE EQU $4d +; unused EQU $4e +EFFECT_SUBSTITUTE EQU $4f +EFFECT_HYPER_BEAM EQU $50 +EFFECT_RAGE EQU $51 +EFFECT_MIMIC EQU $52 +EFFECT_METRONOME EQU $53 +EFFECT_LEECH_SEED EQU $54 +EFFECT_SPLASH EQU $55 +EFFECT_DISABLE EQU $56 +EFFECT_LEVEL_DAMAGE EQU $57 +EFFECT_PSYWAVE EQU $58 +EFFECT_COUNTER EQU $59 +EFFECT_ENCORE EQU $5a +EFFECT_PAIN_SPLIT EQU $5b +EFFECT_SNORE EQU $5c +EFFECT_CONVERSION2 EQU $5d +EFFECT_LOCK_ON EQU $5e +EFFECT_SKETCH EQU $5f +EFFECT_DEFROST_OPPONENT EQU $60 +EFFECT_SLEEP_TALK EQU $61 +EFFECT_DESTINY_BOND EQU $62 +EFFECT_REVERSAL EQU $63 +EFFECT_SPITE EQU $64 +EFFECT_FALSE_SWIPE EQU $65 +EFFECT_HEAL_BELL EQU $66 +EFFECT_PRIORITY_HIT EQU $67 +EFFECT_TRIPLE_KICK EQU $68 +EFFECT_THIEF EQU $69 +EFFECT_MEAN_LOOK EQU $6a +EFFECT_NIGHTMARE EQU $6b +EFFECT_FLAME_WHEEL EQU $6c +EFFECT_CURSE EQU $6d +; unused EQU $6e +EFFECT_PROTECT EQU $6f +EFFECT_SPIKES EQU $70 +EFFECT_FORESIGHT EQU $71 +EFFECT_PERISH_SONG EQU $72 +EFFECT_SANDSTORM EQU $73 +EFFECT_ENDURE EQU $74 +EFFECT_ROLLOUT EQU $75 +EFFECT_SWAGGER EQU $76 +EFFECT_FURY_CUTTER EQU $77 +EFFECT_ATTRACT EQU $78 +EFFECT_RETURN EQU $79 +EFFECT_PRESENT EQU $7a +EFFECT_FRUSTRATION EQU $7b +EFFECT_SAFEGUARD EQU $7c +EFFECT_SACRED_FIRE EQU $7d +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_MORNING_SUN EQU $84 +EFFECT_SYNTHESIS EQU $85 +EFFECT_MOONLIGHT EQU $86 +EFFECT_HIDDEN_POWER EQU $87 +EFFECT_RAIN_DANCE EQU $88 +EFFECT_SUNNY_DAY EQU $89 +EFFECT_STEEL_WING EQU $8a +EFFECT_METAL_CLAW EQU $8b +EFFECT_ANCIENTPOWER EQU $8c +EFFECT_FAKE_OUT EQU $8d +EFFECT_BELLY_DRUM EQU $8e +EFFECT_PSYCH_UP EQU $8f +EFFECT_MIRROR_COAT EQU $90 +EFFECT_SKULL_BASH EQU $91 +EFFECT_TWISTER EQU $92 +EFFECT_EARTHQUAKE EQU $93 +EFFECT_FUTURE_SIGHT EQU $94 +EFFECT_GUST EQU $95 +EFFECT_STOMP EQU $96 +EFFECT_SOLARBEAM EQU $97 +EFFECT_THUNDER EQU $98 +EFFECT_TELEPORT EQU $99 +EFFECT_BEAT_UP EQU $9a +EFFECT_FLY EQU $9b +EFFECT_DEFENSE_CURL EQU $9c + + + ; battle animations ; animations below fc are 1:1 with move constants ANIM_CONFUSED EQU $103 From 0844e3ee5948376c948a5a536bbf65fa92bb2af8 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 25 Apr 2013 04:26:37 -0400 Subject: [PATCH 048/112] implement move effect constants --- battle/effect_commands.asm | 16 +- battle/moves/moves.asm | 507 +++++++++++++++++++------------------ 2 files changed, 262 insertions(+), 261 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index ccd3c3748..2b9ac4eab 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -2808,15 +2808,15 @@ BattleCommand0b: ; 34f60 ld [$cfca], a ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $1d ; multihit + cp EFFECT_MULTI_HIT jr z, .asm_34fb0 - cp $1e ; conversion + cp EFFECT_CONVERSION jr z, .asm_34fb0 - cp $2c ; double kick / bonemerang + cp EFFECT_DOUBLE_HIT jr z, .asm_34fb0 - cp $4d ; twineedle + cp EFFECT_TWINEEDLE jr z, .asm_34fb0 - cp $68 ; triple kick + cp EFFECT_TRIPLE_KICK jr z, .asm_34f96 xor a ld [$c689], a @@ -4042,7 +4042,7 @@ BattleCommand62: ; 35612 call CleanGetBattleVarPair ; Selfdestruct and Explosion halve defense. - cp $7 ; selfdestruct / explosion + cp EFFECT_EXPLOSION jr nz, .asm_35620 srl c @@ -4052,10 +4052,10 @@ BattleCommand62: ; 35612 .asm_35620 ; Variable-hit moves and Conversion can have a power of 0. - cp $1d ; multihit + cp EFFECT_MULTI_HIT jr z, .asm_3562b - cp $1e ; conversion + cp EFFECT_CONVERSION jr z, .asm_3562b ; No damage if move power is 0. diff --git a/battle/moves/moves.asm b/battle/moves/moves.asm index c2b72d2c9..d218f7634 100644 --- a/battle/moves/moves.asm +++ b/battle/moves/moves.asm @@ -1,257 +1,258 @@ ; Characteristics of each move ; animation, effect, power, type, accuracy, PP, effect chance -Move0: - db POUND, $00, 40, NORMAL, $ff, 35, $00 -Move1: - db KARATE_CHOP, $00, 50, FIGHTING, $ff, 25, $00 - db DOUBLESLAP, $1d, 15, NORMAL, $d8, 10, $00 - db COMET_PUNCH, $1d, 18, NORMAL, $d8, 15, $00 - db MEGA_PUNCH, $00, 80, NORMAL, $d8, 20, $00 - db PAY_DAY, $22, 40, NORMAL, $ff, 20, $00 - db FIRE_PUNCH, $04, 75, FIRE, $ff, 15, $19 - db ICE_PUNCH, $05, 75, ICE, $ff, 15, $19 - db THUNDERPUNCH, $06, 75, ELECTRIC, $ff, 15, $19 - db SCRATCH, $00, 40, NORMAL, $ff, 35, $00 - db VICEGRIP, $00, 55, NORMAL, $ff, 30, $00 - db GUILLOTINE, $26, 0, NORMAL, $4c, 5, $00 - db RAZOR_WIND, $27, 80, NORMAL, $bf, 10, $00 - db SWORDS_DANCE, $32, 0, NORMAL, $ff, 30, $00 - db CUT, $00, 50, NORMAL, $f2, 30, $00 - db GUST, $95, 40, FLYING, $ff, 35, $00 - db WING_ATTACK, $00, 60, FLYING, $ff, 35, $00 - db WHIRLWIND, $1c, 0, NORMAL, $ff, 20, $00 - db FLY, $9b, 70, FLYING, $f2, 15, $00 - db BIND, $2a, 15, NORMAL, $bf, 20, $00 - db SLAM, $00, 80, NORMAL, $bf, 20, $00 - db VINE_WHIP, $00, 35, GRASS, $ff, 10, $00 - db STOMP, $96, 65, NORMAL, $ff, 20, $4c - db DOUBLE_KICK, $2c, 30, FIGHTING, $ff, 30, $00 - db MEGA_KICK, $00, 120, NORMAL, $bf, 5, $00 - db JUMP_KICK, $2d, 70, FIGHTING, $f2, 25, $00 - db ROLLING_KICK, $1f, 60, FIGHTING, $d8, 15, $4c - db SAND_ATTACK, $17, 0, GROUND, $ff, 15, $00 - db HEADBUTT, $1f, 70, NORMAL, $ff, 15, $4c - db HORN_ATTACK, $00, 65, NORMAL, $ff, 25, $00 - db FURY_ATTACK, $1d, 15, NORMAL, $d8, 20, $00 - db HORN_DRILL, $26, 1, NORMAL, $4c, 5, $00 - db TACKLE, $00, 35, NORMAL, $f2, 35, $00 - db BODY_SLAM, $06, 85, NORMAL, $ff, 15, $4c - db WRAP, $2a, 15, NORMAL, $d8, 20, $00 - db TAKE_DOWN, $30, 90, NORMAL, $d8, 20, $00 - db THRASH, $1b, 90, NORMAL, $ff, 20, $00 - db DOUBLE_EDGE, $30, 120, NORMAL, $ff, 15, $00 - db TAIL_WHIP, $13, 0, NORMAL, $ff, 30, $00 - db POISON_STING, $02, 15, POISON, $ff, 35, $4c - db TWINEEDLE, $4d, 25, BUG, $ff, 20, $33 - db PIN_MISSILE, $1d, 14, BUG, $d8, 20, $00 - db LEER, $13, 0, NORMAL, $ff, 30, $00 - db BITE, $1f, 60, DARK, $ff, 25, $4c - db GROWL, $12, 0, NORMAL, $ff, 40, $00 - db ROAR, $1c, 0, NORMAL, $ff, 20, $00 - db SING, $01, 0, NORMAL, $8c, 15, $00 - db SUPERSONIC, $31, 0, NORMAL, $8c, 20, $00 - db SONICBOOM, $29, 20, NORMAL, $e5, 20, $00 - db DISABLE, $56, 0, NORMAL, $8c, 20, $00 - db ACID, $45, 40, POISON, $ff, 30, $19 - db EMBER, $04, 40, FIRE, $ff, 25, $19 - db FLAMETHROWER, $04, 95, FIRE, $ff, 15, $19 - db MIST, $2e, 0, ICE, $ff, 30, $00 - db WATER_GUN, $00, 40, WATER, $ff, 25, $00 - db HYDRO_PUMP, $00, 120, WATER, $cc, 5, $00 - db SURF, $00, 95, WATER, $ff, 15, $00 - db ICE_BEAM, $05, 95, ICE, $ff, 10, $19 - db BLIZZARD, $05, 120, ICE, $b2, 5, $19 - db PSYBEAM, $4c, 65, PSYCHIC, $ff, 20, $19 - db BUBBLEBEAM, $46, 65, WATER, $ff, 20, $19 - db AURORA_BEAM, $44, 65, ICE, $ff, 20, $19 - db HYPER_BEAM, $50, 150, NORMAL, $e5, 5, $00 - db PECK, $00, 35, FLYING, $ff, 35, $00 - db DRILL_PECK, $00, 80, FLYING, $ff, 20, $00 - db SUBMISSION, $30, 80, FIGHTING, $cc, 25, $00 - db LOW_KICK, $1f, 50, FIGHTING, $e5, 20, $4c - db COUNTER, $59, 1, FIGHTING, $ff, 20, $00 - db SEISMIC_TOSS, $57, 1, FIGHTING, $ff, 20, $00 - db STRENGTH, $00, 80, NORMAL, $ff, 15, $00 - db ABSORB, $03, 20, GRASS, $ff, 20, $00 - db MEGA_DRAIN, $03, 40, GRASS, $ff, 10, $00 - db LEECH_SEED, $54, 0, GRASS, $e5, 10, $00 - db GROWTH, $0d, 0, NORMAL, $ff, 40, $00 - db RAZOR_LEAF, $00, 55, GRASS, $f2, 25, $00 - db SOLARBEAM, $97, 120, GRASS, $ff, 10, $00 - db POISONPOWDER, $42, 0, POISON, $bf, 35, $00 - db STUN_SPORE, $43, 0, GRASS, $bf, 30, $00 - db SLEEP_POWDER, $01, 0, GRASS, $bf, 15, $00 - db PETAL_DANCE, $1b, 70, GRASS, $ff, 20, $00 - db STRING_SHOT, $14, 0, BUG, $f2, 40, $00 - db DRAGON_RAGE, $29, 40, DRAGON, $ff, 10, $00 - db FIRE_SPIN, $2a, 15, FIRE, $b2, 15, $00 - db THUNDERSHOCK, $06, 40, ELECTRIC, $ff, 30, $19 - db THUNDERBOLT, $06, 95, ELECTRIC, $ff, 15, $19 - db THUNDER_WAVE, $43, 0, ELECTRIC, $ff, 20, $00 - db THUNDER, $98, 120, ELECTRIC, $b2, 10, $4c - db ROCK_THROW, $00, 50, ROCK, $e5, 15, $00 - db EARTHQUAKE, $93, 100, GROUND, $ff, 10, $00 - db FISSURE, $26, 1, GROUND, $4c, 5, $00 - db DIG, $9b, 60, GROUND, $ff, 10, $00 - db TOXIC, $21, 0, POISON, $d8, 10, $00 - db CONFUSION, $4c, 50, PSYCHIC, $ff, 25, $19 - db PSYCHIC_M, $48, 90, PSYCHIC, $ff, 10, $19 - db HYPNOSIS, $01, 0, PSYCHIC, $99, 20, $00 - db MEDITATE, $0a, 0, PSYCHIC, $ff, 40, $00 - db AGILITY, $34, 0, PSYCHIC, $ff, 30, $00 - db QUICK_ATTACK, $67, 40, NORMAL, $ff, 30, $00 - db RAGE, $51, 20, NORMAL, $ff, 20, $00 - db TELEPORT, $99, 0, PSYCHIC, $ff, 20, $00 - db NIGHT_SHADE, $57, 1, GHOST, $ff, 15, $00 - db MIMIC, $52, 0, NORMAL, $ff, 10, $00 - db SCREECH, $3b, 0, NORMAL, $d8, 40, $00 - db DOUBLE_TEAM, $10, 0, NORMAL, $ff, 15, $00 - db RECOVER, $20, 0, NORMAL, $ff, 20, $00 - db HARDEN, $0b, 0, NORMAL, $ff, 30, $00 - db MINIMIZE, $10, 0, NORMAL, $ff, 20, $00 - db SMOKESCREEN, $17, 0, NORMAL, $ff, 20, $00 - db CONFUSE_RAY, $31, 0, GHOST, $ff, 10, $00 - db WITHDRAW, $0b, 0, WATER, $ff, 40, $00 - db DEFENSE_CURL, $9c, 0, NORMAL, $ff, 40, $00 - db BARRIER, $33, 0, PSYCHIC, $ff, 30, $00 - db LIGHT_SCREEN, $23, 0, PSYCHIC, $ff, 30, $00 - db HAZE, $19, 0, ICE, $ff, 30, $00 - db REFLECT, $41, 0, PSYCHIC, $ff, 20, $00 - db FOCUS_ENERGY, $2f, 0, NORMAL, $ff, 30, $00 - db BIDE, $1a, 0, NORMAL, $ff, 10, $00 - db METRONOME, $53, 0, NORMAL, $ff, 10, $00 - db MIRROR_MOVE, $09, 0, FLYING, $ff, 20, $00 - db SELFDESTRUCT, $07, 200, NORMAL, $ff, 5, $00 - db EGG_BOMB, $00, 100, NORMAL, $bf, 10, $00 - db LICK, $06, 20, GHOST, $ff, 30, $4c - db SMOG, $02, 20, POISON, $b2, 20, $66 - db SLUDGE, $02, 65, POISON, $ff, 20, $4c - db BONE_CLUB, $1f, 65, GROUND, $d8, 20, $19 - db FIRE_BLAST, $04, 120, FIRE, $d8, 5, $19 - db WATERFALL, $00, 80, WATER, $ff, 15, $00 - db CLAMP, $2a, 35, WATER, $bf, 10, $00 - db SWIFT, $11, 60, NORMAL, $ff, 20, $00 - db SKULL_BASH, $91, 100, NORMAL, $ff, 15, $00 - db SPIKE_CANNON, $1d, 20, NORMAL, $ff, 15, $00 - db CONSTRICT, $46, 10, NORMAL, $ff, 35, $19 - db AMNESIA, $36, 0, PSYCHIC, $ff, 20, $00 - db KINESIS, $17, 0, PSYCHIC, $cc, 15, $00 - db SOFTBOILED, $20, 0, NORMAL, $ff, 10, $00 - db HI_JUMP_KICK, $2d, 85, FIGHTING, $e5, 20, $00 - db GLARE, $43, 0, NORMAL, $bf, 30, $00 - db DREAM_EATER, $08, 100, PSYCHIC, $ff, 15, $00 - db POISON_GAS, $42, 0, POISON, $8c, 40, $00 - db BARRAGE, $1d, 15, NORMAL, $d8, 20, $00 - db LEECH_LIFE, $03, 20, BUG, $ff, 15, $00 - db LOVELY_KISS, $01, 0, NORMAL, $bf, 10, $00 - db SKY_ATTACK, $4b, 140, FLYING, $e5, 5, $00 - db TRANSFORM, $39, 0, NORMAL, $ff, 10, $00 - db BUBBLE, $46, 20, WATER, $ff, 30, $19 - db DIZZY_PUNCH, $4c, 70, NORMAL, $ff, 10, $33 - db SPORE, $01, 0, GRASS, $ff, 15, $00 - db FLASH, $17, 0, NORMAL, $b2, 20, $00 - db PSYWAVE, $58, 1, PSYCHIC, $cc, 15, $00 - db SPLASH, $55, 0, NORMAL, $ff, 40, $00 - db ACID_ARMOR, $33, 0, POISON, $ff, 40, $00 - db CRABHAMMER, $00, 90, WATER, $d8, 10, $00 - db EXPLOSION, $07, 250, NORMAL, $ff, 5, $00 - db FURY_SWIPES, $1d, 18, NORMAL, $cc, 15, $00 - db BONEMERANG, $2c, 50, GROUND, $e5, 10, $00 - db REST, $20, 0, PSYCHIC, $ff, 10, $00 - db ROCK_SLIDE, $1f, 75, ROCK, $e5, 10, $4c - db HYPER_FANG, $1f, 80, NORMAL, $e5, 15, $19 - db SHARPEN, $0a, 0, NORMAL, $ff, 30, $00 - db CONVERSION, $1e, 0, NORMAL, $ff, 30, $00 - db TRI_ATTACK, $24, 80, NORMAL, $ff, 10, $33 - db SUPER_FANG, $28, 1, NORMAL, $e5, 10, $00 - db SLASH, $00, 70, NORMAL, $ff, 20, $00 - db SUBSTITUTE, $4f, 0, NORMAL, $ff, 10, $00 - db STRUGGLE, $30, 50, NORMAL, $ff, 1, $00 - db SKETCH, $5f, 0, NORMAL, $ff, 1, $00 - db TRIPLE_KICK, $68, 10, FIGHTING, $e5, 10, $00 - db THIEF, $69, 40, DARK, $ff, 10, $ff - db SPIDER_WEB, $6a, 0, BUG, $ff, 10, $00 - db MIND_READER, $5e, 0, NORMAL, $ff, 5, $00 - db NIGHTMARE, $6b, 0, GHOST, $ff, 15, $00 - db FLAME_WHEEL, $6c, 60, FIRE, $ff, 25, $19 - db SNORE, $5c, 40, NORMAL, $ff, 15, $4c - db CURSE, $6d, 0, CURSE_T, $ff, 10, $00 - db FLAIL, $63, 1, NORMAL, $ff, 15, $00 - db CONVERSION2, $5d, 0, NORMAL, $ff, 30, $00 - db AEROBLAST, $00, 100, FLYING, $f2, 5, $00 - db COTTON_SPORE, $3c, 0, GRASS, $d8, 40, $00 - db REVERSAL, $63, 1, FIGHTING, $ff, 15, $00 - db SPITE, $64, 0, GHOST, $ff, 10, $00 - db POWDER_SNOW, $05, 40, ICE, $ff, 25, $19 - db PROTECT, $6f, 0, NORMAL, $ff, 10, $00 - db MACH_PUNCH, $67, 40, FIGHTING, $ff, 30, $00 - db SCARY_FACE, $3c, 0, NORMAL, $e5, 10, $00 - db FAINT_ATTACK, $11, 60, DARK, $ff, 20, $00 - db SWEET_KISS, $31, 0, NORMAL, $bf, 10, $00 - db BELLY_DRUM, $8e, 0, NORMAL, $ff, 10, $00 - db SLUDGE_BOMB, $02, 90, POISON, $ff, 10, $4c - db MUD_SLAP, $49, 20, GROUND, $ff, 10, $ff - db OCTAZOOKA, $49, 65, WATER, $d8, 10, $7f - db SPIKES, $70, 0, GROUND, $ff, 20, $00 - db ZAP_CANNON, $06, 100, ELECTRIC, $7f, 5, $ff - db FORESIGHT, $71, 0, NORMAL, $ff, 40, $00 - db DESTINY_BOND, $62, 0, GHOST, $ff, 5, $00 - db PERISH_SONG, $72, 0, NORMAL, $ff, 5, $00 - db ICY_WIND, $46, 55, ICE, $f2, 15, $ff - db DETECT, $6f, 0, FIGHTING, $ff, 5, $00 - db BONE_RUSH, $1d, 25, GROUND, $cc, 10, $00 - db LOCK_ON, $5e, 0, NORMAL, $ff, 5, $00 - db OUTRAGE, $1b, 90, DRAGON, $ff, 15, $00 - db SANDSTORM, $73, 0, ROCK, $ff, 10, $00 - db GIGA_DRAIN, $03, 60, GRASS, $ff, 5, $00 - db ENDURE, $74, 0, NORMAL, $ff, 10, $00 - db CHARM, $3a, 0, NORMAL, $ff, 20, $00 - db ROLLOUT, $75, 30, ROCK, $e5, 20, $00 - db FALSE_SWIPE, $65, 40, NORMAL, $ff, 40, $00 - db SWAGGER, $76, 0, NORMAL, $e5, 15, $ff - db MILK_DRINK, $20, 0, NORMAL, $ff, 10, $00 - db SPARK, $06, 65, ELECTRIC, $ff, 20, $4c - db FURY_CUTTER, $77, 10, BUG, $f2, 20, $00 - db STEEL_WING, $8a, 70, STEEL, $e5, 25, $19 - db MEAN_LOOK, $6a, 0, NORMAL, $ff, 5, $00 - db ATTRACT, $78, 0, NORMAL, $ff, 15, $00 - db SLEEP_TALK, $61, 0, NORMAL, $ff, 10, $00 - db HEAL_BELL, $66, 0, NORMAL, $ff, 5, $00 - db RETURN, $79, 1, NORMAL, $ff, 20, $00 - db PRESENT, $7a, 1, NORMAL, $e5, 15, $00 - db FRUSTRATION, $7b, 1, NORMAL, $ff, 20, $00 - db SAFEGUARD, $7c, 0, NORMAL, $ff, 25, $00 - db PAIN_SPLIT, $5b, 0, NORMAL, $ff, 20, $00 - db SACRED_FIRE, $7d, 100, FIRE, $f2, 5, $7f - db MAGNITUDE, $7e, 1, GROUND, $ff, 30, $00 - db DYNAMICPUNCH, $4c, 100, FIGHTING, $7f, 5, $ff - db MEGAHORN, $00, 120, BUG, $d8, 10, $00 - db DRAGONBREATH, $06, 60, DRAGON, $ff, 20, $4c - db BATON_PASS, $7f, 0, NORMAL, $ff, 40, $00 - db ENCORE, $5a, 0, NORMAL, $ff, 5, $00 - db PURSUIT, $80, 40, DARK, $ff, 20, $00 - db RAPID_SPIN, $81, 20, NORMAL, $ff, 40, $00 - db SWEET_SCENT, $18, 0, NORMAL, $ff, 20, $00 - db IRON_TAIL, $45, 100, STEEL, $bf, 15, $4c - db METAL_CLAW, $8b, 50, STEEL, $f2, 35, $19 - db VITAL_THROW, $11, 70, FIGHTING, $ff, 10, $00 - db MORNING_SUN, $84, 0, NORMAL, $ff, 5, $00 - db SYNTHESIS, $85, 0, GRASS, $ff, 5, $00 - db MOONLIGHT, $86, 0, NORMAL, $ff, 5, $00 - db HIDDEN_POWER, $87, 1, NORMAL, $ff, 15, $00 - db CROSS_CHOP, $00, 100, FIGHTING, $cc, 5, $00 - db TWISTER, $92, 40, DRAGON, $ff, 20, $33 - db RAIN_DANCE, $88, 0, WATER, $e5, 5, $00 - db SUNNY_DAY, $89, 0, FIRE, $e5, 5, $00 - db CRUNCH, $48, 80, DARK, $ff, 15, $33 - db MIRROR_COAT, $90, 1, PSYCHIC, $ff, 20, $00 - db PSYCH_UP, $8f, 0, NORMAL, $ff, 10, $00 - db EXTREMESPEED, $67, 80, NORMAL, $ff, 5, $00 - db ANCIENTPOWER, $8c, 60, ROCK, $ff, 5, $19 - db SHADOW_BALL, $48, 80, GHOST, $ff, 15, $33 - db FUTURE_SIGHT, $94, 80, PSYCHIC, $e5, 15, $00 - db ROCK_SMASH, $45, 20, FIGHTING, $ff, 15, $7f - db WHIRLPOOL, $2a, 15, WATER, $b2, 15, $00 - db BEAT_UP, $9a, 10, DARK, $ff, 10, $00 + +Move0: + db POUND, EFFECT_NORMAL_HIT, 40, NORMAL, $ff, 35, $00 +Move1: + db KARATE_CHOP, EFFECT_NORMAL_HIT, 50, FIGHTING, $ff, 25, $00 + db DOUBLESLAP, EFFECT_MULTI_HIT, 15, NORMAL, $d8, 10, $00 + db COMET_PUNCH, EFFECT_MULTI_HIT, 18, NORMAL, $d8, 15, $00 + db MEGA_PUNCH, EFFECT_NORMAL_HIT, 80, NORMAL, $d8, 20, $00 + db PAY_DAY, EFFECT_PAY_DAY, 40, NORMAL, $ff, 20, $00 + db FIRE_PUNCH, EFFECT_BURN_HIT, 75, FIRE, $ff, 15, $19 + db ICE_PUNCH, EFFECT_FREEZE_HIT, 75, ICE, $ff, 15, $19 + db THUNDERPUNCH, EFFECT_PARALYZE_HIT, 75, ELECTRIC, $ff, 15, $19 + db SCRATCH, EFFECT_NORMAL_HIT, 40, NORMAL, $ff, 35, $00 + db VICEGRIP, EFFECT_NORMAL_HIT, 55, NORMAL, $ff, 30, $00 + db GUILLOTINE, EFFECT_OHKO, 0, NORMAL, $4c, 5, $00 + db RAZOR_WIND, EFFECT_RAZOR_WIND, 80, NORMAL, $bf, 10, $00 + db SWORDS_DANCE, EFFECT_ATTACK_UP_2, 0, NORMAL, $ff, 30, $00 + db CUT, EFFECT_NORMAL_HIT, 50, NORMAL, $f2, 30, $00 + db GUST, EFFECT_GUST, 40, FLYING, $ff, 35, $00 + db WING_ATTACK, EFFECT_NORMAL_HIT, 60, FLYING, $ff, 35, $00 + db WHIRLWIND, EFFECT_WHIRLWIND, 0, NORMAL, $ff, 20, $00 + db FLY, EFFECT_FLY, 70, FLYING, $f2, 15, $00 + db BIND, EFFECT_BIND, 15, NORMAL, $bf, 20, $00 + db SLAM, EFFECT_NORMAL_HIT, 80, NORMAL, $bf, 20, $00 + db VINE_WHIP, EFFECT_NORMAL_HIT, 35, GRASS, $ff, 10, $00 + db STOMP, EFFECT_STOMP, 65, NORMAL, $ff, 20, $4c + db DOUBLE_KICK, EFFECT_DOUBLE_HIT, 30, FIGHTING, $ff, 30, $00 + db MEGA_KICK, EFFECT_NORMAL_HIT, 120, NORMAL, $bf, 5, $00 + db JUMP_KICK, EFFECT_JUMP_KICK, 70, FIGHTING, $f2, 25, $00 + db ROLLING_KICK, EFFECT_FLINCH_HIT, 60, FIGHTING, $d8, 15, $4c + db SAND_ATTACK, EFFECT_ACCURACY_DOWN, 0, GROUND, $ff, 15, $00 + db HEADBUTT, EFFECT_FLINCH_HIT, 70, NORMAL, $ff, 15, $4c + db HORN_ATTACK, EFFECT_NORMAL_HIT, 65, NORMAL, $ff, 25, $00 + db FURY_ATTACK, EFFECT_MULTI_HIT, 15, NORMAL, $d8, 20, $00 + db HORN_DRILL, EFFECT_OHKO, 1, NORMAL, $4c, 5, $00 + db TACKLE, EFFECT_NORMAL_HIT, 35, NORMAL, $f2, 35, $00 + db BODY_SLAM, EFFECT_PARALYZE_HIT, 85, NORMAL, $ff, 15, $4c + db WRAP, EFFECT_BIND, 15, NORMAL, $d8, 20, $00 + db TAKE_DOWN, EFFECT_RECOIL_HIT, 90, NORMAL, $d8, 20, $00 + db THRASH, EFFECT_RAMPAGE, 90, NORMAL, $ff, 20, $00 + db DOUBLE_EDGE, EFFECT_RECOIL_HIT, 120, NORMAL, $ff, 15, $00 + db TAIL_WHIP, EFFECT_DEFENSE_DOWN, 0, NORMAL, $ff, 30, $00 + db POISON_STING, EFFECT_POISON_HIT, 15, POISON, $ff, 35, $4c + db TWINEEDLE, EFFECT_TWINEEDLE, 25, BUG, $ff, 20, $33 + db PIN_MISSILE, EFFECT_MULTI_HIT, 14, BUG, $d8, 20, $00 + db LEER, EFFECT_DEFENSE_DOWN, 0, NORMAL, $ff, 30, $00 + db BITE, EFFECT_FLINCH_HIT, 60, DARK, $ff, 25, $4c + db GROWL, EFFECT_ATTACK_DOWN, 0, NORMAL, $ff, 40, $00 + db ROAR, EFFECT_WHIRLWIND, 0, NORMAL, $ff, 20, $00 + db SING, EFFECT_SLEEP, 0, NORMAL, $8c, 15, $00 + db SUPERSONIC, EFFECT_CONFUSE, 0, NORMAL, $8c, 20, $00 + db SONICBOOM, EFFECT_STATIC_DAMAGE, 20, NORMAL, $e5, 20, $00 + db DISABLE, EFFECT_DISABLE, 0, NORMAL, $8c, 20, $00 + db ACID, EFFECT_DEFENSE_DOWN_HIT, 40, POISON, $ff, 30, $19 + db EMBER, EFFECT_BURN_HIT, 40, FIRE, $ff, 25, $19 + db FLAMETHROWER, EFFECT_BURN_HIT, 95, FIRE, $ff, 15, $19 + db MIST, EFFECT_MIST, 0, ICE, $ff, 30, $00 + db WATER_GUN, EFFECT_NORMAL_HIT, 40, WATER, $ff, 25, $00 + db HYDRO_PUMP, EFFECT_NORMAL_HIT, 120, WATER, $cc, 5, $00 + db SURF, EFFECT_NORMAL_HIT, 95, WATER, $ff, 15, $00 + db ICE_BEAM, EFFECT_FREEZE_HIT, 95, ICE, $ff, 10, $19 + db BLIZZARD, EFFECT_FREEZE_HIT, 120, ICE, $b2, 5, $19 + db PSYBEAM, EFFECT_CONFUSE_HIT, 65, PSYCHIC, $ff, 20, $19 + db BUBBLEBEAM, EFFECT_SPEED_DOWN_HIT, 65, WATER, $ff, 20, $19 + db AURORA_BEAM, EFFECT_ATTACK_DOWN_HIT, 65, ICE, $ff, 20, $19 + db HYPER_BEAM, EFFECT_HYPER_BEAM, 150, NORMAL, $e5, 5, $00 + db PECK, EFFECT_NORMAL_HIT, 35, FLYING, $ff, 35, $00 + db DRILL_PECK, EFFECT_NORMAL_HIT, 80, FLYING, $ff, 20, $00 + db SUBMISSION, EFFECT_RECOIL_HIT, 80, FIGHTING, $cc, 25, $00 + db LOW_KICK, EFFECT_FLINCH_HIT, 50, FIGHTING, $e5, 20, $4c + db COUNTER, EFFECT_COUNTER, 1, FIGHTING, $ff, 20, $00 + db SEISMIC_TOSS, EFFECT_LEVEL_DAMAGE, 1, FIGHTING, $ff, 20, $00 + db STRENGTH, EFFECT_NORMAL_HIT, 80, NORMAL, $ff, 15, $00 + db ABSORB, EFFECT_LEECH_HIT, 20, GRASS, $ff, 20, $00 + db MEGA_DRAIN, EFFECT_LEECH_HIT, 40, GRASS, $ff, 10, $00 + db LEECH_SEED, EFFECT_LEECH_SEED, 0, GRASS, $e5, 10, $00 + db GROWTH, EFFECT_SP_ATTACK_UP, 0, NORMAL, $ff, 40, $00 + db RAZOR_LEAF, EFFECT_NORMAL_HIT, 55, GRASS, $f2, 25, $00 + db SOLARBEAM, EFFECT_SOLARBEAM, 120, GRASS, $ff, 10, $00 + db POISONPOWDER, EFFECT_POISON, 0, POISON, $bf, 35, $00 + db STUN_SPORE, EFFECT_PARALYZE, 0, GRASS, $bf, 30, $00 + db SLEEP_POWDER, EFFECT_SLEEP, 0, GRASS, $bf, 15, $00 + db PETAL_DANCE, EFFECT_RAMPAGE, 70, GRASS, $ff, 20, $00 + db STRING_SHOT, EFFECT_SPEED_DOWN, 0, BUG, $f2, 40, $00 + db DRAGON_RAGE, EFFECT_STATIC_DAMAGE, 40, DRAGON, $ff, 10, $00 + db FIRE_SPIN, EFFECT_BIND, 15, FIRE, $b2, 15, $00 + db THUNDERSHOCK, EFFECT_PARALYZE_HIT, 40, ELECTRIC, $ff, 30, $19 + db THUNDERBOLT, EFFECT_PARALYZE_HIT, 95, ELECTRIC, $ff, 15, $19 + db THUNDER_WAVE, EFFECT_PARALYZE, 0, ELECTRIC, $ff, 20, $00 + db THUNDER, EFFECT_THUNDER, 120, ELECTRIC, $b2, 10, $4c + db ROCK_THROW, EFFECT_NORMAL_HIT, 50, ROCK, $e5, 15, $00 + db EARTHQUAKE, EFFECT_EARTHQUAKE, 100, GROUND, $ff, 10, $00 + db FISSURE, EFFECT_OHKO, 1, GROUND, $4c, 5, $00 + db DIG, EFFECT_FLY, 60, GROUND, $ff, 10, $00 + db TOXIC, EFFECT_TOXIC, 0, POISON, $d8, 10, $00 + db CONFUSION, EFFECT_CONFUSE_HIT, 50, PSYCHIC, $ff, 25, $19 + db PSYCHIC_M, EFFECT_SP_DEFENSE_DOWN_HIT, 90, PSYCHIC, $ff, 10, $19 + db HYPNOSIS, EFFECT_SLEEP, 0, PSYCHIC, $99, 20, $00 + db MEDITATE, EFFECT_ATTACK_UP, 0, PSYCHIC, $ff, 40, $00 + db AGILITY, EFFECT_SPEED_UP_2, 0, PSYCHIC, $ff, 30, $00 + db QUICK_ATTACK, EFFECT_PRIORITY_HIT, 40, NORMAL, $ff, 30, $00 + db RAGE, EFFECT_RAGE, 20, NORMAL, $ff, 20, $00 + db TELEPORT, EFFECT_TELEPORT, 0, PSYCHIC, $ff, 20, $00 + db NIGHT_SHADE, EFFECT_LEVEL_DAMAGE, 1, GHOST, $ff, 15, $00 + db MIMIC, EFFECT_MIMIC, 0, NORMAL, $ff, 10, $00 + db SCREECH, EFFECT_DEFENSE_DOWN_2, 0, NORMAL, $d8, 40, $00 + db DOUBLE_TEAM, EFFECT_EVASION_UP, 0, NORMAL, $ff, 15, $00 + db RECOVER, EFFECT_HEAL, 0, NORMAL, $ff, 20, $00 + db HARDEN, EFFECT_DEFENSE_UP, 0, NORMAL, $ff, 30, $00 + db MINIMIZE, EFFECT_EVASION_UP, 0, NORMAL, $ff, 20, $00 + db SMOKESCREEN, EFFECT_ACCURACY_DOWN, 0, NORMAL, $ff, 20, $00 + db CONFUSE_RAY, EFFECT_CONFUSE, 0, GHOST, $ff, 10, $00 + db WITHDRAW, EFFECT_DEFENSE_UP, 0, WATER, $ff, 40, $00 + db DEFENSE_CURL, EFFECT_DEFENSE_CURL, 0, NORMAL, $ff, 40, $00 + db BARRIER, EFFECT_DEFENSE_UP_2, 0, PSYCHIC, $ff, 30, $00 + db LIGHT_SCREEN, EFFECT_LIGHT_SCREEN, 0, PSYCHIC, $ff, 30, $00 + db HAZE, EFFECT_HAZE, 0, ICE, $ff, 30, $00 + db REFLECT, EFFECT_REFLECT, 0, PSYCHIC, $ff, 20, $00 + db FOCUS_ENERGY, EFFECT_FOCUS_ENERGY, 0, NORMAL, $ff, 30, $00 + db BIDE, EFFECT_BIDE, 0, NORMAL, $ff, 10, $00 + db METRONOME, EFFECT_METRONOME, 0, NORMAL, $ff, 10, $00 + db MIRROR_MOVE, EFFECT_MIRROR_MOVE, 0, FLYING, $ff, 20, $00 + db SELFDESTRUCT, EFFECT_EXPLOSION, 200, NORMAL, $ff, 5, $00 + db EGG_BOMB, EFFECT_NORMAL_HIT, 100, NORMAL, $bf, 10, $00 + db LICK, EFFECT_PARALYZE_HIT, 20, GHOST, $ff, 30, $4c + db SMOG, EFFECT_POISON_HIT, 20, POISON, $b2, 20, $66 + db SLUDGE, EFFECT_POISON_HIT, 65, POISON, $ff, 20, $4c + db BONE_CLUB, EFFECT_FLINCH_HIT, 65, GROUND, $d8, 20, $19 + db FIRE_BLAST, EFFECT_BURN_HIT, 120, FIRE, $d8, 5, $19 + db WATERFALL, EFFECT_NORMAL_HIT, 80, WATER, $ff, 15, $00 + db CLAMP, EFFECT_BIND, 35, WATER, $bf, 10, $00 + db SWIFT, EFFECT_ALWAYS_HIT, 60, NORMAL, $ff, 20, $00 + db SKULL_BASH, EFFECT_SKULL_BASH, 100, NORMAL, $ff, 15, $00 + db SPIKE_CANNON, EFFECT_MULTI_HIT, 20, NORMAL, $ff, 15, $00 + db CONSTRICT, EFFECT_SPEED_DOWN_HIT, 10, NORMAL, $ff, 35, $19 + db AMNESIA, EFFECT_SP_DEFENSE_UP_2, 0, PSYCHIC, $ff, 20, $00 + db KINESIS, EFFECT_ACCURACY_DOWN, 0, PSYCHIC, $cc, 15, $00 + db SOFTBOILED, EFFECT_HEAL, 0, NORMAL, $ff, 10, $00 + db HI_JUMP_KICK, EFFECT_JUMP_KICK, 85, FIGHTING, $e5, 20, $00 + db GLARE, EFFECT_PARALYZE, 0, NORMAL, $bf, 30, $00 + db DREAM_EATER, EFFECT_DREAM_EATER, 100, PSYCHIC, $ff, 15, $00 + db POISON_GAS, EFFECT_POISON, 0, POISON, $8c, 40, $00 + db BARRAGE, EFFECT_MULTI_HIT, 15, NORMAL, $d8, 20, $00 + db LEECH_LIFE, EFFECT_LEECH_HIT, 20, BUG, $ff, 15, $00 + db LOVELY_KISS, EFFECT_SLEEP, 0, NORMAL, $bf, 10, $00 + db SKY_ATTACK, EFFECT_SKY_ATTACK, 140, FLYING, $e5, 5, $00 + db TRANSFORM, EFFECT_TRANSFORM, 0, NORMAL, $ff, 10, $00 + db BUBBLE, EFFECT_SPEED_DOWN_HIT, 20, WATER, $ff, 30, $19 + db DIZZY_PUNCH, EFFECT_CONFUSE_HIT, 70, NORMAL, $ff, 10, $33 + db SPORE, EFFECT_SLEEP, 0, GRASS, $ff, 15, $00 + db FLASH, EFFECT_ACCURACY_DOWN, 0, NORMAL, $b2, 20, $00 + db PSYWAVE, EFFECT_PSYWAVE, 1, PSYCHIC, $cc, 15, $00 + db SPLASH, EFFECT_SPLASH, 0, NORMAL, $ff, 40, $00 + db ACID_ARMOR, EFFECT_DEFENSE_UP_2, 0, POISON, $ff, 40, $00 + db CRABHAMMER, EFFECT_NORMAL_HIT, 90, WATER, $d8, 10, $00 + db EXPLOSION, EFFECT_EXPLOSION, 250, NORMAL, $ff, 5, $00 + db FURY_SWIPES, EFFECT_MULTI_HIT, 18, NORMAL, $cc, 15, $00 + db BONEMERANG, EFFECT_DOUBLE_HIT, 50, GROUND, $e5, 10, $00 + db REST, EFFECT_HEAL, 0, PSYCHIC, $ff, 10, $00 + db ROCK_SLIDE, EFFECT_FLINCH_HIT, 75, ROCK, $e5, 10, $4c + db HYPER_FANG, EFFECT_FLINCH_HIT, 80, NORMAL, $e5, 15, $19 + db SHARPEN, EFFECT_ATTACK_UP, 0, NORMAL, $ff, 30, $00 + db CONVERSION, EFFECT_CONVERSION, 0, NORMAL, $ff, 30, $00 + db TRI_ATTACK, EFFECT_TRI_ATTACK, 80, NORMAL, $ff, 10, $33 + db SUPER_FANG, EFFECT_SUPER_FANG, 1, NORMAL, $e5, 10, $00 + db SLASH, EFFECT_NORMAL_HIT, 70, NORMAL, $ff, 20, $00 + db SUBSTITUTE, EFFECT_SUBSTITUTE, 0, NORMAL, $ff, 10, $00 + db STRUGGLE, EFFECT_RECOIL_HIT, 50, NORMAL, $ff, 1, $00 + db SKETCH, EFFECT_SKETCH, 0, NORMAL, $ff, 1, $00 + db TRIPLE_KICK, EFFECT_TRIPLE_KICK, 10, FIGHTING, $e5, 10, $00 + db THIEF, EFFECT_THIEF, 40, DARK, $ff, 10, $ff + db SPIDER_WEB, EFFECT_MEAN_LOOK, 0, BUG, $ff, 10, $00 + db MIND_READER, EFFECT_LOCK_ON, 0, NORMAL, $ff, 5, $00 + db NIGHTMARE, EFFECT_NIGHTMARE, 0, GHOST, $ff, 15, $00 + db FLAME_WHEEL, EFFECT_FLAME_WHEEL, 60, FIRE, $ff, 25, $19 + db SNORE, EFFECT_SNORE, 40, NORMAL, $ff, 15, $4c + db CURSE, EFFECT_CURSE, 0, CURSE_T, $ff, 10, $00 + db FLAIL, EFFECT_REVERSAL, 1, NORMAL, $ff, 15, $00 + db CONVERSION2, EFFECT_CONVERSION2, 0, NORMAL, $ff, 30, $00 + db AEROBLAST, EFFECT_NORMAL_HIT, 100, FLYING, $f2, 5, $00 + db COTTON_SPORE, EFFECT_SPEED_DOWN_2, 0, GRASS, $d8, 40, $00 + db REVERSAL, EFFECT_REVERSAL, 1, FIGHTING, $ff, 15, $00 + db SPITE, EFFECT_SPITE, 0, GHOST, $ff, 10, $00 + db POWDER_SNOW, EFFECT_FREEZE_HIT, 40, ICE, $ff, 25, $19 + db PROTECT, EFFECT_PROTECT, 0, NORMAL, $ff, 10, $00 + db MACH_PUNCH, EFFECT_PRIORITY_HIT, 40, FIGHTING, $ff, 30, $00 + db SCARY_FACE, EFFECT_SPEED_DOWN_2, 0, NORMAL, $e5, 10, $00 + db FAINT_ATTACK, EFFECT_ALWAYS_HIT, 60, DARK, $ff, 20, $00 + db SWEET_KISS, EFFECT_CONFUSE, 0, NORMAL, $bf, 10, $00 + db BELLY_DRUM, EFFECT_BELLY_DRUM, 0, NORMAL, $ff, 10, $00 + db SLUDGE_BOMB, EFFECT_POISON_HIT, 90, POISON, $ff, 10, $4c + db MUD_SLAP, EFFECT_ACCURACY_DOWN_HIT, 20, GROUND, $ff, 10, $ff + db OCTAZOOKA, EFFECT_ACCURACY_DOWN_HIT, 65, WATER, $d8, 10, $7f + db SPIKES, EFFECT_SPIKES, 0, GROUND, $ff, 20, $00 + db ZAP_CANNON, EFFECT_PARALYZE_HIT, 100, ELECTRIC, $7f, 5, $ff + db FORESIGHT, EFFECT_FORESIGHT, 0, NORMAL, $ff, 40, $00 + db DESTINY_BOND, EFFECT_DESTINY_BOND, 0, GHOST, $ff, 5, $00 + db PERISH_SONG, EFFECT_PERISH_SONG, 0, NORMAL, $ff, 5, $00 + db ICY_WIND, EFFECT_SPEED_DOWN_HIT, 55, ICE, $f2, 15, $ff + db DETECT, EFFECT_PROTECT, 0, FIGHTING, $ff, 5, $00 + db BONE_RUSH, EFFECT_MULTI_HIT, 25, GROUND, $cc, 10, $00 + db LOCK_ON, EFFECT_LOCK_ON, 0, NORMAL, $ff, 5, $00 + db OUTRAGE, EFFECT_RAMPAGE, 90, DRAGON, $ff, 15, $00 + db SANDSTORM, EFFECT_SANDSTORM, 0, ROCK, $ff, 10, $00 + db GIGA_DRAIN, EFFECT_LEECH_HIT, 60, GRASS, $ff, 5, $00 + db ENDURE, EFFECT_ENDURE, 0, NORMAL, $ff, 10, $00 + db CHARM, EFFECT_ATTACK_DOWN_2, 0, NORMAL, $ff, 20, $00 + db ROLLOUT, EFFECT_ROLLOUT, 30, ROCK, $e5, 20, $00 + db FALSE_SWIPE, EFFECT_FALSE_SWIPE, 40, NORMAL, $ff, 40, $00 + db SWAGGER, EFFECT_SWAGGER, 0, NORMAL, $e5, 15, $ff + db MILK_DRINK, EFFECT_HEAL, 0, NORMAL, $ff, 10, $00 + db SPARK, EFFECT_PARALYZE_HIT, 65, ELECTRIC, $ff, 20, $4c + db FURY_CUTTER, EFFECT_FURY_CUTTER, 10, BUG, $f2, 20, $00 + db STEEL_WING, EFFECT_STEEL_WING, 70, STEEL, $e5, 25, $19 + db MEAN_LOOK, EFFECT_MEAN_LOOK, 0, NORMAL, $ff, 5, $00 + db ATTRACT, EFFECT_ATTRACT, 0, NORMAL, $ff, 15, $00 + db SLEEP_TALK, EFFECT_SLEEP_TALK, 0, NORMAL, $ff, 10, $00 + db HEAL_BELL, EFFECT_HEAL_BELL, 0, NORMAL, $ff, 5, $00 + db RETURN, EFFECT_RETURN, 1, NORMAL, $ff, 20, $00 + db PRESENT, EFFECT_PRESENT, 1, NORMAL, $e5, 15, $00 + db FRUSTRATION, EFFECT_FRUSTRATION, 1, NORMAL, $ff, 20, $00 + db SAFEGUARD, EFFECT_SAFEGUARD, 0, NORMAL, $ff, 25, $00 + db PAIN_SPLIT, EFFECT_PAIN_SPLIT, 0, NORMAL, $ff, 20, $00 + db SACRED_FIRE, EFFECT_SACRED_FIRE, 100, FIRE, $f2, 5, $7f + db MAGNITUDE, EFFECT_MAGNITUDE, 1, GROUND, $ff, 30, $00 + db DYNAMICPUNCH, EFFECT_CONFUSE_HIT, 100, FIGHTING, $7f, 5, $ff + db MEGAHORN, EFFECT_NORMAL_HIT, 120, BUG, $d8, 10, $00 + db DRAGONBREATH, EFFECT_PARALYZE_HIT, 60, DRAGON, $ff, 20, $4c + db BATON_PASS, EFFECT_BATON_PASS, 0, NORMAL, $ff, 40, $00 + db ENCORE, EFFECT_ENCORE, 0, NORMAL, $ff, 5, $00 + db PURSUIT, EFFECT_PURSUIT, 40, DARK, $ff, 20, $00 + db RAPID_SPIN, EFFECT_RAPID_SPIN, 20, NORMAL, $ff, 40, $00 + db SWEET_SCENT, EFFECT_EVASION_DOWN, 0, NORMAL, $ff, 20, $00 + db IRON_TAIL, EFFECT_DEFENSE_DOWN_HIT, 100, STEEL, $bf, 15, $4c + db METAL_CLAW, EFFECT_METAL_CLAW, 50, STEEL, $f2, 35, $19 + db VITAL_THROW, EFFECT_ALWAYS_HIT, 70, FIGHTING, $ff, 10, $00 + db MORNING_SUN, EFFECT_MORNING_SUN, 0, NORMAL, $ff, 5, $00 + db SYNTHESIS, EFFECT_SYNTHESIS, 0, GRASS, $ff, 5, $00 + db MOONLIGHT, EFFECT_MOONLIGHT, 0, NORMAL, $ff, 5, $00 + db HIDDEN_POWER, EFFECT_HIDDEN_POWER, 1, NORMAL, $ff, 15, $00 + db CROSS_CHOP, EFFECT_NORMAL_HIT, 100, FIGHTING, $cc, 5, $00 + db TWISTER, EFFECT_TWISTER, 40, DRAGON, $ff, 20, $33 + db RAIN_DANCE, EFFECT_RAIN_DANCE, 0, WATER, $e5, 5, $00 + db SUNNY_DAY, EFFECT_SUNNY_DAY, 0, FIRE, $e5, 5, $00 + db CRUNCH, EFFECT_SP_DEFENSE_DOWN_HIT, 80, DARK, $ff, 15, $33 + db MIRROR_COAT, EFFECT_MIRROR_COAT, 1, PSYCHIC, $ff, 20, $00 + db PSYCH_UP, EFFECT_PSYCH_UP, 0, NORMAL, $ff, 10, $00 + db EXTREMESPEED, EFFECT_PRIORITY_HIT, 80, NORMAL, $ff, 5, $00 + db ANCIENTPOWER, EFFECT_ANCIENTPOWER, 60, ROCK, $ff, 5, $19 + db SHADOW_BALL, EFFECT_SP_DEFENSE_DOWN_HIT, 80, GHOST, $ff, 15, $33 + db FUTURE_SIGHT, EFFECT_FUTURE_SIGHT, 80, PSYCHIC, $e5, 15, $00 + db ROCK_SMASH, EFFECT_DEFENSE_DOWN_HIT, 20, FIGHTING, $ff, 15, $7f + db WHIRLPOOL, EFFECT_BIND, 15, WATER, $b2, 15, $00 + db BEAT_UP, EFFECT_BEAT_UP, 10, DARK, $ff, 10, $00 From c0918f94fdd3ad5fbe90310f00cc5da40bbab14c Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 25 Apr 2013 13:21:49 -0400 Subject: [PATCH 049/112] there is no Move0 --- battle/effect_commands.asm | 4 ++-- battle/moves/moves.asm | 4 ++-- main.asm | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 2b9ac4eab..cceeac39f 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -11122,7 +11122,7 @@ SkipToBattleCommand: ; 37e8c GetMoveAttr: ; 37ea1 ; Assuming hl = Moves + x, return attribute x of move a. push bc - ld bc, Move1 - Move0 + ld bc, Move2 - Move1 call AddNTimes call GetMoveByte pop bc @@ -11133,7 +11133,7 @@ GetMoveAttr: ; 37ea1 GetMoveData: ; 37ead ; Copy move struct a to de. ld hl, Moves - ld bc, Move1 - Move0 + ld bc, Move2 - Move1 call AddNTimes ld a, Bank(Moves) jp FarCopyBytes diff --git a/battle/moves/moves.asm b/battle/moves/moves.asm index d218f7634..ee30cd1e7 100644 --- a/battle/moves/moves.asm +++ b/battle/moves/moves.asm @@ -2,9 +2,9 @@ ; animation, effect, power, type, accuracy, PP, effect chance -Move0: - db POUND, EFFECT_NORMAL_HIT, 40, NORMAL, $ff, 35, $00 Move1: + db POUND, EFFECT_NORMAL_HIT, 40, NORMAL, $ff, 35, $00 +Move2: db KARATE_CHOP, EFFECT_NORMAL_HIT, 50, FIGHTING, $ff, 25, $00 db DOUBLESLAP, EFFECT_MULTI_HIT, 15, NORMAL, $d8, 10, $00 db COMET_PUNCH, EFFECT_MULTI_HIT, 18, NORMAL, $d8, 15, $00 diff --git a/main.asm b/main.asm index 40be7f96a..362a49923 100644 --- a/main.asm +++ b/main.asm @@ -10560,8 +10560,8 @@ SpecialDratini: ; 0x8b170 ; get the PP of the new move dec a - ld hl, Moves + 5 - ld bc, Move1 - Move0 + ld hl, Moves + PlayerMovePP - PlayerMoveStruct + ld bc, Move2 - Move1 call AddNTimes ld a, BANK(Moves) call GetFarByte From ec1f8e1f94b3aae0c47b982ec12d094497c3d306 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 25 Apr 2013 15:44:40 -0400 Subject: [PATCH 050/112] dump and include beta maps --- main.asm | 192 +++++++++++++++---- maps/BetaAlphRuinUnsolvedPuzzleRoom.blk | 1 + maps/BetaAzaleaTown.blk | 10 + maps/BetaBlackthornCity.blk | 1 + maps/BetaBlank.blk | 1 + maps/BetaCave.blk | 8 + maps/BetaCave2.blk | 5 + maps/BetaCaveTestMap.blk | 18 ++ maps/BetaCeladonMansion.blk | 1 + maps/BetaCherrygroveCity.blk | 9 + maps/BetaCianwoodCity.blk | 1 + maps/BetaCinnabarIslandPokemonLabHallway.blk | 2 + maps/BetaCinnabarIslandPokemonLabRoom1.blk | 2 + maps/BetaCinnabarIslandPokemonLabRoom2.blk | 1 + maps/BetaCinnabarIslandPokemonLabRoom3.blk | 1 + maps/BetaElevator.blk | 1 + maps/BetaEmptyHouse.blk | 15 ++ maps/BetaGoldenrodCity.blk | 10 + maps/BetaHerosHouse.blk | 1 + maps/BetaHouse.blk | 1 + maps/BetaHouse2.blk | 1 + maps/BetaIlexForest.blk | 1 + maps/BetaLakeOfRage.blk | 1 + maps/BetaMahoganyTown.blk | 1 + maps/BetaNewBarkTown.blk | 1 + maps/BetaOlivineCity.blk | 4 + maps/BetaPewterMuseumOfScience1F.blk | 2 + maps/BetaPewterMuseumOfScience2F.blk | 1 + maps/BetaPokecenterMainHouse.blk | 1 + maps/BetaPokecenterTradeStation.blk | 1 + maps/BetaRocketHideout1.blk | 5 + maps/BetaRocketHideout2.blk | 4 + maps/BetaRocketHideout3.blk | 5 + maps/BetaRoute23EarlyVersion.blk | 7 + maps/BetaSproutTower1.blk | 3 + maps/BetaSproutTower2.blk | 9 + maps/BetaSproutTower3.blk | 7 + maps/BetaSproutTower5.blk | 9 + maps/BetaSproutTower6.blk | 4 + maps/BetaSproutTower7.blk | 8 + maps/BetaSproutTower8.blk | 5 + maps/BetaSproutTower9.blk | 1 + maps/BetaSproutTowerCutOut1.blk | 1 + maps/BetaSproutTowerCutOut2.blk | 1 + maps/BetaSproutTowerCutOut3.blk | 1 + maps/BetaSsAquaInsideCutOut.blk | 1 + maps/BetaTeakCity.blk | 1 + maps/BetaUnknown.blk | 1 + maps/BetaVioletCity.blk | 7 + 49 files changed, 338 insertions(+), 37 deletions(-) create mode 100644 maps/BetaAlphRuinUnsolvedPuzzleRoom.blk create mode 100644 maps/BetaAzaleaTown.blk create mode 100644 maps/BetaBlackthornCity.blk create mode 100644 maps/BetaBlank.blk create mode 100644 maps/BetaCave.blk create mode 100644 maps/BetaCave2.blk create mode 100644 maps/BetaCaveTestMap.blk create mode 100644 maps/BetaCeladonMansion.blk create mode 100644 maps/BetaCherrygroveCity.blk create mode 100644 maps/BetaCianwoodCity.blk create mode 100644 maps/BetaCinnabarIslandPokemonLabHallway.blk create mode 100644 maps/BetaCinnabarIslandPokemonLabRoom1.blk create mode 100644 maps/BetaCinnabarIslandPokemonLabRoom2.blk create mode 100644 maps/BetaCinnabarIslandPokemonLabRoom3.blk create mode 100644 maps/BetaElevator.blk create mode 100644 maps/BetaEmptyHouse.blk create mode 100644 maps/BetaGoldenrodCity.blk create mode 100644 maps/BetaHerosHouse.blk create mode 100644 maps/BetaHouse.blk create mode 100644 maps/BetaHouse2.blk create mode 100644 maps/BetaIlexForest.blk create mode 100644 maps/BetaLakeOfRage.blk create mode 100644 maps/BetaMahoganyTown.blk create mode 100644 maps/BetaNewBarkTown.blk create mode 100644 maps/BetaOlivineCity.blk create mode 100644 maps/BetaPewterMuseumOfScience1F.blk create mode 100644 maps/BetaPewterMuseumOfScience2F.blk create mode 100644 maps/BetaPokecenterMainHouse.blk create mode 100644 maps/BetaPokecenterTradeStation.blk create mode 100644 maps/BetaRocketHideout1.blk create mode 100644 maps/BetaRocketHideout2.blk create mode 100644 maps/BetaRocketHideout3.blk create mode 100644 maps/BetaRoute23EarlyVersion.blk create mode 100644 maps/BetaSproutTower1.blk create mode 100644 maps/BetaSproutTower2.blk create mode 100644 maps/BetaSproutTower3.blk create mode 100644 maps/BetaSproutTower5.blk create mode 100644 maps/BetaSproutTower6.blk create mode 100644 maps/BetaSproutTower7.blk create mode 100644 maps/BetaSproutTower8.blk create mode 100644 maps/BetaSproutTower9.blk create mode 100644 maps/BetaSproutTowerCutOut1.blk create mode 100644 maps/BetaSproutTowerCutOut2.blk create mode 100644 maps/BetaSproutTowerCutOut3.blk create mode 100644 maps/BetaSsAquaInsideCutOut.blk create mode 100644 maps/BetaTeakCity.blk create mode 100644 maps/BetaUnknown.blk create mode 100644 maps/BetaVioletCity.blk diff --git a/main.asm b/main.asm index 362a49923..c8689634f 100644 --- a/main.asm +++ b/main.asm @@ -12054,7 +12054,9 @@ Route28_BlockData: ; 0xa8492 INCBIN "maps/Route28.blk" ; 0xa8546 -INCBIN "baserom.gbc", $a8546, $a8552 - $a8546 +BetaHerosHouse_BlockData: ; 0xa8546 + INCBIN "maps/BetaHerosHouse.blk" +; 0xa8552 CeladonCity_BlockData: ; 0xa8552 INCBIN "maps/CeladonCity.blk" @@ -12072,25 +12074,33 @@ ElmsHouse_BlockData: ; 0xa8930 INCBIN "maps/ElmsHouse.blk" ; 0xa8940 -INCBIN "baserom.gbc", $a8940, $5a +BetaSproutTower1_BlockData: ; 0xa8940 + INCBIN "maps/BetaSproutTower1.blk" +; 0xa899a Route11_BlockData: ; 0xa899a INCBIN "maps/Route11.blk" ; 0xa8a4e -INCBIN "baserom.gbc", $a8a4e, $a8aa8 - $a8a4e +BetaSproutTower5_BlockData: ; 0xa8a4e + INCBIN "maps/BetaSproutTower5.blk" +; 0xa8aa8 Route15_BlockData: ; 0xa8aa8 INCBIN "maps/Route15.blk" ; 0xa8b5c -INCBIN "baserom.gbc", $a8b5c, $24 +BetaSproutTower9_BlockData: ; 0xa8b5c + INCBIN "maps/BetaSproutTower9.blk" +; 0xa8b80 Route19_BlockData: ; 0xa8b80 INCBIN "maps/Route19.blk" ; 0xa8c34 -INCBIN "baserom.gbc", $a8c34, $a8d9c - $a8c34 +BetaBlackthornCity_BlockData: ; 0xa8c34 + INCBIN "maps/BetaBlackthornCity.blk" +; 0xa8d9c Route10South_BlockData: ; 0xa8d9c INCBIN "maps/Route10South.blk" @@ -12136,7 +12146,9 @@ Route24_BlockData: ; 0xa95ff INCBIN "maps/Route24.blk" ; 0xa9659 -INCBIN "baserom.gbc", $a9659, $a97c1 - $a9659 +BetaVioletCity_BlockData: ; 0xa9659 + INCBIN "maps/BetaVioletCity.blk" +; 0xa97c1 Route3_BlockData: ; 0xa97c1 INCBIN "maps/Route3.blk" @@ -12146,19 +12158,33 @@ PewterCity_BlockData: ; 0xa98cf INCBIN "maps/PewterCity.blk" ; 0xa9a37 -INCBIN "baserom.gbc", $a9a37, $a9bf9 - $a9a37 +BetaIlexForest_BlockData: ; 0xa9a37 + INCBIN "maps/BetaIlexForest.blk" +; 0xa9b9f + +BetaSproutTower2_BlockData: ; 0xa9b9f + INCBIN "maps/BetaSproutTower2.blk" +; 0xa9bf9 Route12_BlockData: ; 0xa9bf9 INCBIN "maps/Route12.blk" ; 0xa9d07 -INCBIN "baserom.gbc", $a9d07, $168 +BetaGoldenrodCity_BlockData: ; 0xa9d07 + INCBIN "maps/BetaGoldenrodCity.blk" +; 0xa9e6f Route20_BlockData: ; 0xa9e6f INCBIN "maps/Route20.blk" ; 0xa9f7d -INCBIN "baserom.gbc", $a9f7d, $a9ff7 - $a9f7d +BetaSproutTower6_BlockData: ; 0xa9f7d + INCBIN "maps/BetaSproutTower6.blk" +; 0xa9fd7 + +BetaPokecenterMainHouse_BlockData: ; 0xa9fd7 + INCBIN "maps/BetaPokecenterMainHouse.blk" +; 0xa9ff7 Route30_BlockData: ; 0xa9ff7 INCBIN "maps/Route30.blk" @@ -12188,7 +12214,9 @@ Route38_BlockData: ; 0xaa759 INCBIN "maps/Route38.blk" ; 0xaa80d -INCBIN "baserom.gbc", $aa80d, $5a +BetaCianwoodCity_BlockData: ; 0xaa80d + INCBIN "maps/BetaCianwoodCity.blk" +; 0xaa867 OlivineVoltorbHouse_BlockData: ; 0xaa867 INCBIN "maps/OlivineVoltorbHouse.blk" @@ -12198,7 +12226,13 @@ SafariZoneFuchsiaGateBeta_BlockData: ; 0xaa877 INCBIN "maps/SafariZoneFuchsiaGateBeta.blk" ; 0xaa88b -INCBIN "baserom.gbc", $aa88b, $aaa4d - $aa88b +BetaTeakCity_BlockData: ; 0xaa88b + INCBIN "maps/BetaTeakCity.blk" +; 0xaa9f3 + +BetaCherrygroveCity_BlockData: ; 0xaa9f3 + INCBIN "maps/BetaCherrygroveCity.blk" +; 0xaaa4d CinnabarIsland_BlockData: ; 0xaaa4d INCBIN "maps/CinnabarIsland.blk" @@ -12212,7 +12246,9 @@ Route8_BlockData: ; 0xaab5b INCBIN "maps/Route8.blk" ; 0xaac0f -INCBIN "baserom.gbc", $aac0f, $aac69 - $aac0f +BetaSproutTower3_BlockData: ; 0xaac0f + INCBIN "maps/BetaSproutTower3.blk" +; 0xaac69 ViridianCity_BlockData: ; 0xaac69 INCBIN "maps/ViridianCity.blk" @@ -12226,13 +12262,17 @@ Route21_BlockData: ; 0xaaedf INCBIN "maps/Route21.blk" ; 0xaaf93 -INCBIN "baserom.gbc", $aaf93, $aafed - $aaf93 +BetaSproutTower7_BlockData: ; 0xaaf93 + INCBIN "maps/BetaSproutTower7.blk" +; 0xaafed Route17_BlockData: ; 0xaafed INCBIN "maps/Route17.blk" ; 0xab1af -INCBIN "baserom.gbc", $ab1af, $ab209 - $ab1af +BetaMahoganyTown_BlockData: ; 0xab1af + INCBIN "maps/BetaMahoganyTown.blk" +; 0xab209 Route31_BlockData: ; 0xab209 INCBIN "maps/Route31.blk" @@ -12262,13 +12302,21 @@ Route38EcruteakGate_BlockData: ; 0xab6af INCBIN "maps/Route38EcruteakGate.blk" ; 0xab6c3 -INCBIN "baserom.gbc", $ab6c3, $ab82b - $ab6c3 +BetaAzaleaTown_BlockData: ; 0xab6c3 + INCBIN "maps/BetaAzaleaTown.blk" +; 0xab82b VermilionCity_BlockData: ; 0xab82b INCBIN "maps/VermilionCity.blk" ; 0xab993 -INCBIN "baserom.gbc", $ab993, $abb55 - $ab993 +BetaOlivineCity_BlockData: ; 0xab993 + INCBIN "maps/BetaOlivineCity.blk" +; 0xabafb + +BetaNewBarkTown_BlockData: ; 0xabafb + INCBIN "maps/BetaNewBarkTown.blk" +; 0xabb55 ElmsLab_BlockData: ; 0xabb55 INCBIN "maps/ElmsLab.blk" @@ -12301,7 +12349,9 @@ Route14_BlockData: ; 0xac000 INCBIN "maps/Route14.blk" ; 0xac0b4 -INCBIN "baserom.gbc", $ac0b4, $5a +BetaSproutTower8_BlockData: ; 0xac0b4 + INCBIN "maps/BetaSproutTower8.blk" +; 0xac10e OlivineMart_BlockData: ; 0xac10e INCBIN "maps/OlivineMart.blk" @@ -12311,19 +12361,41 @@ Route10North_BlockData: ; 0xac126 INCBIN "maps/Route10North.blk" ; 0xac180 -INCBIN "baserom.gbc", $ac180, $168 +BetaLakeOfRage_BlockData: ; 0xac180 + INCBIN "maps/BetaLakeOfRage.blk" +; 0xac2e8 OlivinePokeCenter1F_BlockData: ; 0xac2e8 INCBIN "maps/OlivinePokeCenter1F.blk" ; 0xac2fc -INCBIN "baserom.gbc", $ac2fc, $ac340 - $ac2fc +BetaPewterMuseumOfScience1F_BlockData: ; 0xac2fc + INCBIN "maps/BetaPewterMuseumOfScience1F.blk" +; 0xac324 + +BetaPewterMuseumOfScience2F_BlockData: ; 0xac324 + INCBIN "maps/BetaPewterMuseumOfScience2F.blk" +; 0xac340 EarlsPokemonAcademy_BlockData: ; 0xac340 INCBIN "maps/EarlsPokemonAcademy.blk" ; 0xac360 -INCBIN "baserom.gbc", $ac360, $ac3b4 - $ac360 +BetaCinnabarIslandPokemonLabHallway_BlockData: ; 0xac360 + INCBIN "maps/BetaCinnabarIslandPokemonLabHallway.blk" +; 0xac384 + +BetaCinnabarIslandPokemonLabRoom1_BlockData: ; 0xac384 + INCBIN "maps/BetaCinnabarIslandPokemonLabRoom1.blk" +; 0xac394 + +BetaCinnabarIslandPokemonLabRoom2_BlockData: ; 0xac394 + INCBIN "maps/BetaCinnabarIslandPokemonLabRoom2.blk" +; 0xac3a4 + +BetaCinnabarIslandPokemonLabRoom3_BlockData: ; 0xac3a4 + INCBIN "maps/BetaCinnabarIslandPokemonLabRoom3.blk" +; 0xac3b4 GoldenrodDeptStore1F_BlockData: ; 0xac3b4 INCBIN "maps/GoldenrodDeptStore1F.blk" @@ -12369,7 +12441,9 @@ CeladonMansionRoof_BlockData: ; 0xac4b4 INCBIN "maps/CeladonMansionRoof.blk" ; 0xac4c8 -INCBIN "baserom.gbc", $ac4c8, $ac4d8 - $ac4c8 +BetaHouse_BlockData: ; 0xac4c8 + INCBIN "maps/BetaHouse.blk" +; 0xac4d8 CeladonGameCorner_BlockData: ; 0xac4d8 INCBIN "maps/CeladonGameCorner.blk" @@ -12391,7 +12465,9 @@ EcruteakLugiaSpeechHouse_BlockData: ; 0xac54f INCBIN "maps/EcruteakLugiaSpeechHouse.blk" ; 0xac55f -INCBIN "baserom.gbc", $ac55f, $5a +BetaCave_BlockData: ; 0xac55f + INCBIN "maps/BetaCave.blk" +; 0xac5b9 UnionCaveB1F_BlockData: ; 0xac5b9 INCBIN "maps/UnionCaveB1F.blk" @@ -12413,7 +12489,9 @@ Route6UndergroundEntrance_BlockData: ; 0xac9f1 INCBIN "maps/Route6UndergroundEntrance.blk" ; 0xaca01 -INCBIN "baserom.gbc", $aca01, $10 +BetaPokecenterTradeStation_BlockData: ; 0xaca01 + INCBIN "maps/BetaPokecenterTradeStation.blk" +; 0xaca11 KurtsHouse_BlockData: ; 0xaca11 INCBIN "maps/KurtsHouse.blk" @@ -12427,7 +12505,9 @@ RuinsofAlphOutside_BlockData: ; 0xaca8b INCBIN "maps/RuinsofAlphOutside.blk" ; 0xacb3f -INCBIN "baserom.gbc", $acb3f, $acb53 - $acb3f +BetaAlphRuinUnsolvedPuzzleRoom_BlockData: ; 0xacb3f + INCBIN "maps/BetaAlphRuinUnsolvedPuzzleRoom.blk" +; 0xacb53 RuinsofAlphInnerChamber_BlockData: ; 0xacb53 INCBIN "maps/RuinsofAlphInnerChamber.blk" @@ -12441,19 +12521,25 @@ SproutTower1F_BlockData: ; 0xacbf3 INCBIN "maps/SproutTower1F.blk" ; 0xacc43 -INCBIN "baserom.gbc", $acc43, $acc4d - $acc43 +BetaSproutTowerCutOut1_BlockData: ; 0xacc43 + INCBIN "maps/BetaSproutTowerCutOut1.blk" +; 0xacc4d SproutTower2F_BlockData: ; 0xacc4d INCBIN "maps/SproutTower2F.blk" ; 0xacc9d -INCBIN "baserom.gbc", $acc9d, $acca7 - $acc9d +BetaSproutTowerCutOut2_BlockData: ; 0xacc9d + INCBIN "maps/BetaSproutTowerCutOut2.blk" +; 0xacca7 SproutTower3F_BlockData: ; 0xacca7 INCBIN "maps/SproutTower3F.blk" ; 0xaccf7 -INCBIN "baserom.gbc", $accf7, $acd01 - $accf7 +BetaSproutTowerCutOut3_BlockData: ; 0xaccf7 + INCBIN "maps/BetaSproutTowerCutOut3.blk" +; 0xacd01 RadioTower1F_BlockData: ; 0xacd01 INCBIN "maps/RadioTower1F.blk" @@ -12555,7 +12641,9 @@ UndergroundWarehouse_BlockData: ; 0xadf1c INCBIN "maps/UndergroundWarehouse.blk" ; 0xadf76 -INCBIN "baserom.gbc", $adf76, $19 +BetaElevator_BlockData: ; 0xadf76 + INCBIN "maps/BetaElevator.blk" +; 0xadf8f TinTower1F_BlockData: ; 0xadf8f INCBIN "maps/TinTower1F.blk" @@ -12605,7 +12693,9 @@ BurnedTowerB1F_BlockData: ; 0xae36d INCBIN "maps/BurnedTowerB1F.blk" ; 0xae3c7 -INCBIN "baserom.gbc", $ae3c7, $ae4d5 - $ae3c7 +BetaCaveTestMap_BlockData: ; 0xae3c7 + INCBIN "maps/BetaCaveTestMap.blk" +; 0xae4d5 MountMortar1FOutside_BlockData: ; 0xae4d5 INCBIN "maps/MountMortar1FOutside.blk" @@ -12687,7 +12777,21 @@ SilverCaveRoom3_BlockData: ; 0xaf399 INCBIN "maps/SilverCaveRoom3.blk" ; 0xaf44d -INCBIN "baserom.gbc", $af44d, $438 +BetaRocketHideout1_BlockData: ; 0xaf44d + INCBIN "maps/BetaRocketHideout1.blk" +; 0xaf55b + +BetaRocketHideout2_BlockData: ; 0xaf55b + INCBIN "maps/BetaRocketHideout2.blk" +; 0xaf669 + +BetaEmptyHouse_BlockData: ; 0xaf669 + INCBIN "maps/BetaEmptyHouse.blk" +; 0xaf777 + +BetaRocketHideout3_BlockData: ; 0xaf777 + INCBIN "maps/BetaRocketHideout3.blk" +; 0xaf885 MahoganyMart1F_BlockData: ; 0xaf885 INCBIN "maps/MahoganyMart1F.blk" @@ -12705,7 +12809,9 @@ TeamRocketBaseB3F_BlockData: ; 0xaf9a3 INCBIN "maps/TeamRocketBaseB3F.blk" ; 0xafa2a -INCBIN "baserom.gbc", $afa2a, $afa84 - $afa2a +BetaRoute23EarlyVersion_BlockData: ; 0xafa2a + INCBIN "maps/BetaRoute23EarlyVersion.blk" +; 0xafa84 IndigoPlateauPokeCenter1F_BlockData: ; 0xafa84 INCBIN "maps/IndigoPlateauPokeCenter1F.blk" @@ -12751,7 +12857,9 @@ OlivineGym_BlockData: ; 0xafc7b INCBIN "maps/OlivineGym.blk" ; 0xafca3 -INCBIN "baserom.gbc", $afca3, $afcb7 - $afca3 +BetaUnknown_BlockData: ; 0xafca3 + INCBIN "maps/BetaUnknown.blk" +; 0xafcb7 CianwoodGym_BlockData: ; 0xafcb7 INCBIN "maps/CianwoodGym.blk" @@ -12792,7 +12900,9 @@ OlivineLighthouse6F_BlockData: ; 0xaff00 SECTION "bank2C",DATA,BANK[$2C] -INCBIN "baserom.gbc", $b0000, $b0023 - $b0000 +BetaCave2_BlockData: ; 0xb0000 + INCBIN "maps/BetaCave2.blk" +; 0xb0023 SlowpokeWellB1F_BlockData: ; 0xb0023 INCBIN "maps/SlowpokeWellB1F.blk" @@ -12850,7 +12960,9 @@ FastShipB1F_BlockData: ; 0xb0680 INCBIN "maps/FastShipB1F.blk" ; 0xb0700 -INCBIN "baserom.gbc", $b0700, $10 +BetaSsAquaInsideCutOut_BlockData: ; 0xb0700 + INCBIN "maps/BetaSsAquaInsideCutOut.blk" +; 0xb0710 FastShipCabins_NNW_NNE_NE_BlockData: ; 0xb0710 INCBIN "maps/FastShipCabins_NNW_NNE_NE.blk" @@ -12964,13 +13076,17 @@ CeladonGym_BlockData: ; 0xb0cb5 INCBIN "maps/CeladonGym.blk" ; 0xb0ce2 -INCBIN "baserom.gbc", $b0ce2, $b0cf6 - $b0ce2 +BetaHouse2_BlockData: ; 0xb0ce2 + INCBIN "maps/BetaHouse2.blk" +; 0xb0cf6 CeladonCafe_BlockData: ; 0xb0cf6 INCBIN "maps/CeladonCafe.blk" ; 0xb0d0e -INCBIN "baserom.gbc", $b0d0e, $18 +BetaCeladonMansion_BlockData: ; 0xb0d0e + INCBIN "maps/BetaCeladonMansion.blk" +; 0xb0d26 RockTunnel1F_BlockData: ; 0xb0d26 INCBIN "maps/RockTunnel1F.blk" @@ -13124,7 +13240,9 @@ BattleTowerOutside_BlockData: ; 0xb1a6e INCBIN "maps/BattleTowerOutside.blk" ; 0xb1afa -INCBIN "baserom.gbc", $b1afa, $28 +BetaBlank_BlockData: ; 0xb1afa + INCBIN "maps/BetaBlank.blk" +; 0xb1b22 GoldenrodDeptStoreRoof_BlockData: ; 0xb1b22 INCBIN "maps/GoldenrodDeptStoreRoof.blk" diff --git a/maps/BetaAlphRuinUnsolvedPuzzleRoom.blk b/maps/BetaAlphRuinUnsolvedPuzzleRoom.blk new file mode 100644 index 000000000..a3aa06bd6 --- /dev/null +++ b/maps/BetaAlphRuinUnsolvedPuzzleRoom.blk @@ -0,0 +1 @@ + ,+ \ No newline at end of file diff --git a/maps/BetaAzaleaTown.blk b/maps/BetaAzaleaTown.blk new file mode 100644 index 000000000..8faa18369 --- /dev/null +++ b/maps/BetaAzaleaTown.blk @@ -0,0 +1,10 @@ +aaaaaaaaFDaaaaaaaaaaaaaaaaaFDaaaaaaaaaaaaaaaaaFHIIaaaaaaBaaaFaaaaaaFaFaaaHJGFee>aacaaaFaaaadeefaaaaFGbaaaaaaaaFDaaaaaaaFaaDaU +aaaaaaaHIY +aaaaaaa~zU +aaaaaaa5Y +aaaaa@AAAA5z +vvvUaaaaaaaaaaa552955zvvvvvvvvvv +aa55551111111111111 + +a555555555555555552 +a \ No newline at end of file diff --git a/maps/BetaBlackthornCity.blk b/maps/BetaBlackthornCity.blk new file mode 100644 index 000000000..c6fc4f210 --- /dev/null +++ b/maps/BetaBlackthornCity.blk @@ -0,0 +1 @@ +hqqqqqqqqqqqqqqqqqqqhqorrrrrrrrrnqqqqqqqhqiaKeWaKeWahqqqqqqqhqieKaWWWaeWhqorrnqqhqiaWWKWeaWehqi !hqqhqiKWWeeaWWahqi$%hqqhqieKeaWWeeehqi$%hqqhqiaKaWeeWaahqi$%hqqlrmKeWWaWeWahqi()hqqKaWKaWaeWlrmtuhqqWWWWWWKaWWWWWWhqqhqqlrrG \ No newline at end of file diff --git a/maps/BetaBlank.blk b/maps/BetaBlank.blk new file mode 100644 index 000000000..e53405655 --- /dev/null +++ b/maps/BetaBlank.blk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/maps/BetaCave.blk b/maps/BetaCave.blk new file mode 100644 index 000000000..b103c2532 --- /dev/null +++ b/maps/BetaCave.blk @@ -0,0 +1,8 @@ +  + + + + + + +  \ No newline at end of file diff --git a/maps/BetaCave2.blk b/maps/BetaCave2.blk new file mode 100644 index 000000000..a2722d010 --- /dev/null +++ b/maps/BetaCave2.blk @@ -0,0 +1,5 @@ +  +(+ +)* + +   \ No newline at end of file diff --git a/maps/BetaCaveTestMap.blk b/maps/BetaCaveTestMap.blk new file mode 100644 index 000000000..eba6c84c8 --- /dev/null +++ b/maps/BetaCaveTestMap.blk @@ -0,0 +1,18 @@ +   +;<  ; 6< + + 589: + + + + +  5  + +    + + 5   + +    +  + 5 6 +    \ No newline at end of file diff --git a/maps/BetaCeladonMansion.blk b/maps/BetaCeladonMansion.blk new file mode 100644 index 000000000..8d3e219df --- /dev/null +++ b/maps/BetaCeladonMansion.blk @@ -0,0 +1 @@ +? +,/ \ No newline at end of file diff --git a/maps/BetaCherrygroveCity.blk b/maps/BetaCherrygroveCity.blk new file mode 100644 index 000000000..440952f6f --- /dev/null +++ b/maps/BetaCherrygroveCity.blk @@ -0,0 +1,9 @@ + +aaaaaaaa + +a6 +a6YEa6Y,-6YG./a52vUa551 + +aaaaa5555 + +aaaa \ No newline at end of file diff --git a/maps/BetaCianwoodCity.blk b/maps/BetaCianwoodCity.blk new file mode 100644 index 000000000..d946e1de7 --- /dev/null +++ b/maps/BetaCianwoodCity.blk @@ -0,0 +1 @@ +aaaaXaaTyaaX5ETy5Tv455aTvvyfaXYaaXYEaaeaaa \ No newline at end of file diff --git a/maps/BetaCinnabarIslandPokemonLabHallway.blk b/maps/BetaCinnabarIslandPokemonLabHallway.blk new file mode 100644 index 000000000..7a6502a26 --- /dev/null +++ b/maps/BetaCinnabarIslandPokemonLabHallway.blk @@ -0,0 +1,2 @@ +  +  \ No newline at end of file diff --git a/maps/BetaCinnabarIslandPokemonLabRoom1.blk b/maps/BetaCinnabarIslandPokemonLabRoom1.blk new file mode 100644 index 000000000..ef77b6561 --- /dev/null +++ b/maps/BetaCinnabarIslandPokemonLabRoom1.blk @@ -0,0 +1,2 @@ +  +  \ No newline at end of file diff --git a/maps/BetaCinnabarIslandPokemonLabRoom2.blk b/maps/BetaCinnabarIslandPokemonLabRoom2.blk new file mode 100644 index 000000000..822db175b --- /dev/null +++ b/maps/BetaCinnabarIslandPokemonLabRoom2.blk @@ -0,0 +1 @@ +  \ No newline at end of file diff --git a/maps/BetaCinnabarIslandPokemonLabRoom3.blk b/maps/BetaCinnabarIslandPokemonLabRoom3.blk new file mode 100644 index 000000000..d9a64a5da --- /dev/null +++ b/maps/BetaCinnabarIslandPokemonLabRoom3.blk @@ -0,0 +1 @@ +   \ No newline at end of file diff --git a/maps/BetaElevator.blk b/maps/BetaElevator.blk new file mode 100644 index 000000000..32fb22697 --- /dev/null +++ b/maps/BetaElevator.blk @@ -0,0 +1 @@ +&$$$%$$$$$$$$$$$$$$$$$$ \ No newline at end of file diff --git a/maps/BetaEmptyHouse.blk b/maps/BetaEmptyHouse.blk new file mode 100644 index 000000000..dcec62794 --- /dev/null +++ b/maps/BetaEmptyHouse.blk @@ -0,0 +1,15 @@ +  +   +  + + + +   +  +   +   +   + + % + +   \ No newline at end of file diff --git a/maps/BetaGoldenrodCity.blk b/maps/BetaGoldenrodCity.blk new file mode 100644 index 000000000..1a156122d --- /dev/null +++ b/maps/BetaGoldenrodCity.blk @@ -0,0 +1,10 @@ + + + +FD + +JHU !Y$#Y"HEzv%&IIIIIIIIJII55)* @-.EAAAAAAAAAA FIHIJEEvvU55YY@AEYDFYHFzU5 + +B @55 + +F~D \ No newline at end of file diff --git a/maps/BetaHerosHouse.blk b/maps/BetaHerosHouse.blk new file mode 100644 index 000000000..b5b53b4bd --- /dev/null +++ b/maps/BetaHerosHouse.blk @@ -0,0 +1 @@ + ! " \ No newline at end of file diff --git a/maps/BetaHouse.blk b/maps/BetaHouse.blk new file mode 100644 index 000000000..187a3cd32 --- /dev/null +++ b/maps/BetaHouse.blk @@ -0,0 +1 @@ +*+,*-.12/0/ \ No newline at end of file diff --git a/maps/BetaHouse2.blk b/maps/BetaHouse2.blk new file mode 100644 index 000000000..993ea3a8d --- /dev/null +++ b/maps/BetaHouse2.blk @@ -0,0 +1 @@ +?',9..',9 \ No newline at end of file diff --git a/maps/BetaIlexForest.blk b/maps/BetaIlexForest.blk new file mode 100644 index 000000000..3cde14007 --- /dev/null +++ b/maps/BetaIlexForest.blk @@ -0,0 +1 @@ +hqqqqqihqqqqqilrrsm \ No newline at end of file diff --git a/maps/BetaLakeOfRage.blk b/maps/BetaLakeOfRage.blk new file mode 100644 index 000000000..d1d63a0d4 --- /dev/null +++ b/maps/BetaLakeOfRage.blk @@ -0,0 +1 @@ +\^af\a\^afG^f\\f>^fTU^abfd?fdTvyY>dG\fd\X55Ya^d?f^Tvy55Y<d`f\\Ty555Y`f]\?\aX555Y\\^?Tvvy555Y^<fTvy555555Y^bd\bf^X5555555Ydf\ffTy5555555Y\b\af\fX55555Ya^d<d\daX555Yfd\\G`f^^\>e\adfa \ No newline at end of file diff --git a/maps/BetaMahoganyTown.blk b/maps/BetaMahoganyTown.blk new file mode 100644 index 000000000..6b4c62e10 --- /dev/null +++ b/maps/BetaMahoganyTown.blk @@ -0,0 +1 @@ +`N=`RZW,-G./WEZWWG? \ No newline at end of file diff --git a/maps/BetaNewBarkTown.blk b/maps/BetaNewBarkTown.blk new file mode 100644 index 000000000..395c91f1b --- /dev/null +++ b/maps/BetaNewBarkTown.blk @@ -0,0 +1 @@ +^]?II~IDGaaHTvEX5@~~{XDGGXHIIIIIIIaXvvvvvvvvv1 \ No newline at end of file diff --git a/maps/BetaOlivineCity.blk b/maps/BetaOlivineCity.blk new file mode 100644 index 000000000..749f05a5c --- /dev/null +++ b/maps/BetaOlivineCity.blk @@ -0,0 +1,4 @@ +FDIJHIIIFDFZFDFDFFZFFZFFDFFZFAABFZFFDF|}FTvvvvvvvvvUDF|}FXYX55YDF|}FXYX55YHIIIJ|}FXYX556vvv + +JXYX5545552 +Xzvvvvy55255552vvvy555 555550555552995555~5555:5555 \ No newline at end of file diff --git a/maps/BetaPewterMuseumOfScience1F.blk b/maps/BetaPewterMuseumOfScience1F.blk new file mode 100644 index 000000000..1eec02a37 --- /dev/null +++ b/maps/BetaPewterMuseumOfScience1F.blk @@ -0,0 +1,2 @@ + +  ! &! & \ No newline at end of file diff --git a/maps/BetaPewterMuseumOfScience2F.blk b/maps/BetaPewterMuseumOfScience2F.blk new file mode 100644 index 000000000..ac5622246 --- /dev/null +++ b/maps/BetaPewterMuseumOfScience2F.blk @@ -0,0 +1 @@ +012! \ No newline at end of file diff --git a/maps/BetaPokecenterMainHouse.blk b/maps/BetaPokecenterMainHouse.blk new file mode 100644 index 000000000..261350738 --- /dev/null +++ b/maps/BetaPokecenterMainHouse.blk @@ -0,0 +1 @@ +  ' \ No newline at end of file diff --git a/maps/BetaPokecenterTradeStation.blk b/maps/BetaPokecenterTradeStation.blk new file mode 100644 index 000000000..555abfa07 --- /dev/null +++ b/maps/BetaPokecenterTradeStation.blk @@ -0,0 +1 @@ +' \ No newline at end of file diff --git a/maps/BetaRocketHideout1.blk b/maps/BetaRocketHideout1.blk new file mode 100644 index 000000000..988208073 --- /dev/null +++ b/maps/BetaRocketHideout1.blk @@ -0,0 +1,5 @@ + + :?  > "! 89  *> *   89 :?:? )  ;?;? )  ? :)   ><) >>    )89      >>   8: ::?   ?< <>:) 5//////>89<)  +,/////- >>>> 1 8899///= + 5///->:?  1 = + >? ? ,/////-,////- \ No newline at end of file diff --git a/maps/BetaRoute23EarlyVersion.blk b/maps/BetaRoute23EarlyVersion.blk new file mode 100644 index 000000000..a62533dd4 --- /dev/null +++ b/maps/BetaRoute23EarlyVersion.blk @@ -0,0 +1,7 @@ + + ! + +ohi +omhi!nm7:~nm'nm'nm'nm'nm'nm'nm'nm +^ +noo !hihi \ No newline at end of file diff --git a/maps/BetaSproutTower1.blk b/maps/BetaSproutTower1.blk new file mode 100644 index 000000000..6c0b2ea41 --- /dev/null +++ b/maps/BetaSproutTower1.blk @@ -0,0 +1,3 @@ +      +   +    \ No newline at end of file diff --git a/maps/BetaSproutTower2.blk b/maps/BetaSproutTower2.blk new file mode 100644 index 000000000..a13cec16b --- /dev/null +++ b/maps/BetaSproutTower2.blk @@ -0,0 +1,9 @@ +  +  +   +  +   +   +   +  + \ No newline at end of file diff --git a/maps/BetaSproutTower3.blk b/maps/BetaSproutTower3.blk new file mode 100644 index 000000000..846bb9016 --- /dev/null +++ b/maps/BetaSproutTower3.blk @@ -0,0 +1,7 @@ +  +    +  +    +  +   + \ No newline at end of file diff --git a/maps/BetaSproutTower5.blk b/maps/BetaSproutTower5.blk new file mode 100644 index 000000000..baaeaa926 --- /dev/null +++ b/maps/BetaSproutTower5.blk @@ -0,0 +1,9 @@ +  +  +  +  +  +     +  + +         \ No newline at end of file diff --git a/maps/BetaSproutTower6.blk b/maps/BetaSproutTower6.blk new file mode 100644 index 000000000..ea9395657 --- /dev/null +++ b/maps/BetaSproutTower6.blk @@ -0,0 +1,4 @@ +  +              +   +   \ No newline at end of file diff --git a/maps/BetaSproutTower7.blk b/maps/BetaSproutTower7.blk new file mode 100644 index 000000000..bfa5da286 --- /dev/null +++ b/maps/BetaSproutTower7.blk @@ -0,0 +1,8 @@ +  + +   +  +      +    +   +  \ No newline at end of file diff --git a/maps/BetaSproutTower8.blk b/maps/BetaSproutTower8.blk new file mode 100644 index 000000000..254c0c565 --- /dev/null +++ b/maps/BetaSproutTower8.blk @@ -0,0 +1,5 @@ +   +     +   +     +     \ No newline at end of file diff --git a/maps/BetaSproutTower9.blk b/maps/BetaSproutTower9.blk new file mode 100644 index 000000000..f5737b226 --- /dev/null +++ b/maps/BetaSproutTower9.blk @@ -0,0 +1 @@ +     \ No newline at end of file diff --git a/maps/BetaSproutTowerCutOut1.blk b/maps/BetaSproutTowerCutOut1.blk new file mode 100644 index 000000000..21808bb71 --- /dev/null +++ b/maps/BetaSproutTowerCutOut1.blk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/maps/BetaSproutTowerCutOut2.blk b/maps/BetaSproutTowerCutOut2.blk new file mode 100644 index 000000000..21808bb71 --- /dev/null +++ b/maps/BetaSproutTowerCutOut2.blk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/maps/BetaSproutTowerCutOut3.blk b/maps/BetaSproutTowerCutOut3.blk new file mode 100644 index 000000000..21808bb71 --- /dev/null +++ b/maps/BetaSproutTowerCutOut3.blk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/maps/BetaSsAquaInsideCutOut.blk b/maps/BetaSsAquaInsideCutOut.blk new file mode 100644 index 000000000..b385b0198 --- /dev/null +++ b/maps/BetaSsAquaInsideCutOut.blk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/maps/BetaTeakCity.blk b/maps/BetaTeakCity.blk new file mode 100644 index 000000000..ce448c2ef --- /dev/null +++ b/maps/BetaTeakCity.blk @@ -0,0 +1 @@ +?eeeeeeeeeeeb !bb$%b>$%`&;',-&'`$%`*"+#/*+aE$%dg,-b()#/tuWZWVWVWVWZ@AABGTU !FXY$%&'XYa$%*+VVZVVVVVVZaa()EatuIIJ~{@AAAAA HII \ No newline at end of file diff --git a/maps/BetaUnknown.blk b/maps/BetaUnknown.blk new file mode 100644 index 000000000..c3063adc7 --- /dev/null +++ b/maps/BetaUnknown.blk @@ -0,0 +1 @@ +( \ No newline at end of file diff --git a/maps/BetaVioletCity.blk b/maps/BetaVioletCity.blk new file mode 100644 index 000000000..963dbb2ed --- /dev/null +++ b/maps/BetaVioletCity.blk @@ -0,0 +1,7 @@ +??&;'TU&;'b?*"+XY*"+?=G^bXYTU]]]]]]]]]]]]]XYXYXYb`b !`GbD$%F` +&;' +bD()F`G*"+ +eeebDtuF` + +AEA +bpk`bsm`=]E`G`G?e`b`?eeeeeeeeeef`b \ No newline at end of file From ff96e5590a93a6a0ba3863f8e00aaa4463917e39 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 26 Apr 2013 18:16:13 -0400 Subject: [PATCH 051/112] type printing functions --- main.asm | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 4 deletions(-) diff --git a/main.asm b/main.asm index c8689634f..8f7c441b0 100644 --- a/main.asm +++ b/main.asm @@ -8546,11 +8546,93 @@ ToWhichPKMNString: ; 0x50549 YouHaveNoPKMNString: ; 0x50556 db "You have no ", $e1, $e2, "!@" -INCBIN "baserom.gbc", $50566, $5097B-$50566 -dw Normal, Fighting, Flying, Poison, Ground, Rock, Bird, Bug, Ghost, Steel -dw Normal, Normal, Normal, Normal, Normal, Normal, Normal, Normal, Normal -dw UnknownType, Fire, Water, Grass, Electric, Psychic, Ice, Dragon, Dark +INCBIN "baserom.gbc", $50566, $5093a - $50566 + + +PrintMoveType: ; 5093a +; Print the type of move b at hl. + + push hl + ld a, b + dec a + ld bc, Move2 - Move1 + ld hl, Moves + call AddNTimes + ld de, StringBuffer1 + ld a, BANK(Moves) + call FarCopyBytes + ld a, [StringBuffer1 + PlayerMoveType - PlayerMoveStruct] + pop hl + + ld b, a +; 50953 + +PrintType: ; 50953 +; Print type b at hl. + ld a, b + + push hl + add a + ld hl, TypeNames + ld e, a + ld d, 0 + add hl, de + ld a, [hli] + ld e, a + ld d, [hl] + pop hl + + jp PlaceString +; 50964 + + +LoadTypeName: ; 50964 +; Copy the name of type $d265 to StringBuffer1. + ld a, [$d265] + ld hl, TypeNames + ld e, a + ld d, 0 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ld de, StringBuffer1 + ld bc, $000d + jp CopyBytes +; 5097b + + +TypeNames: ; 5097b + dw Normal + dw Fighting + dw Flying + dw Poison + dw Ground + dw Rock + dw Bird + dw Bug + dw Ghost + dw Steel + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw UnknownType + dw Fire + dw Water + dw Grass + dw Electric + dw Psychic + dw Ice + dw Dragon + dw Dark Normal: db "NORMAL@" @@ -8590,6 +8672,8 @@ Dragon: db "DRAGON@" Dark: db "DARK@" +; 50a28 + INCBIN "baserom.gbc", $50a28, $50bdd - $50a28 From 6f6988e3d116b3d663235736ba9d9300cd3d4777 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 27 Apr 2013 17:12:23 -0400 Subject: [PATCH 052/112] more effect constants --- battle/effect_commands.asm | 134 ++++++++++++++++++++----------------- main.asm | 2 +- wram.asm | 9 ++- 3 files changed, 82 insertions(+), 63 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index cceeac39f..c6b0c1c7a 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -1193,20 +1193,20 @@ BattleCommand04: ; 34555 ld hl, NoPPLeftText .print call FarBattleTextBox - ld b, $1 + ld b, 1 ret ; 34602 .continuousmoves ; 34602 - db $27 ; RAZOR_WIND - db $4b ; SKY_ATTACK - db $91 ; SKULL_BASH - db $97 ; SOLARBEAM - db $9b ; FLY, DIG - db $75 ; ROLLOUT - db $1a ; BIDE - db $1b ; THRASH, PETAL_DANCE, OUTRAGE - db $ff ; end + db EFFECT_RAZOR_WIND + db EFFECT_SKY_ATTACK + db EFFECT_SKULL_BASH + db EFFECT_SOLARBEAM + db EFFECT_FLY + db EFFECT_ROLLOUT + db EFFECT_BIDE + db EFFECT_RAMPAGE + db $ff ; 3460b Function0x3460b: ; 3460b @@ -2728,15 +2728,15 @@ BattleCommand0a: ; 34eee ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $27 ; razor wind + cp EFFECT_RAZOR_WIND jr z, .asm_34f21 - cp $4b ; sky attack + cp EFFECT_SKY_ATTACK jr z, .asm_34f21 - cp $91 ; skull bash + cp EFFECT_SKULL_BASH jr z, .asm_34f21 - cp $97 ; solarbeam + cp EFFECT_SOLARBEAM jr z, .asm_34f21 - cp $9b ; fly / dig + cp EFFECT_FLY jr z, .asm_34f21 .asm_34f18 @@ -2765,9 +2765,9 @@ BattleCommand0a: ; 34eee .Rampage ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $75 ; rollout + cp EFFECT_ROLLOUT jr z, .asm_34f4d - cp $1b ; rampage + cp EFFECT_RAMPAGE jr z, .asm_34f4d ld a, 1 @@ -2945,11 +2945,11 @@ BattleCommand0d: ; 35023 inc hl ld a, [hl] - cp $1d ; multi-hit + cp EFFECT_MULTI_HIT jr z, .asm_35049 - cp $2c ; double-hit + cp EFFECT_DOUBLE_HIT jr z, .asm_35049 - cp $4d ; twineedle + cp EFFECT_TWINEEDLE jr z, .asm_35049 jp EndMoveEffect @@ -3224,8 +3224,8 @@ BattleCommand11: ; 351c0 and a jr z, .asm_351cb ld hl, BattleMonHP -.asm_351cb +.asm_351cb ld a, [hli] or [hl] ret nz @@ -3237,15 +3237,17 @@ BattleCommand11: ; 351c0 ld hl, TookDownWithItText call FarBattleTextBox + ld a, [hBattleTurn] and a - ld hl, EnemyMonMaxHPLo - ld bc, $c4ca - ld a, $0 - jr nz, .asm_351f2 ; 351e8 $8 - ld hl, $c63f - ld bc, $c55e - ld a, $1 + ld hl, EnemyMonMaxHP + 1 + bccoord 2, 2 ; hp bar + ld a, 0 + jr nz, .asm_351f2 + ld hl, BattleMonMaxHP + 1 + bccoord 10, 9 ; hp bar + ld a, 1 + .asm_351f2 ld [$d10a], a ld a, [hld] @@ -3283,15 +3285,15 @@ BattleCommand11: ; 351c0 .asm_35231 ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $1d ; multi-hit + cp EFFECT_MULTI_HIT jr z, .asm_3524a - cp $2c ; double-hit + cp EFFECT_DOUBLE_HIT jr z, .asm_3524a - cp $4d ; twineedle + cp EFFECT_TWINEEDLE jr z, .asm_3524a - cp $68 ; triple kick + cp EFFECT_TRIPLE_KICK jr z, .asm_3524a - cp $9a ; beat up + cp EFFECT_BEAT_UP jr nz, .asm_3524d .asm_3524a @@ -7456,34 +7458,34 @@ BattleCommand24: ; 369b6 ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarPair ld a, [hl] - cp $4d ; twineedle - jr z, .asm_36a3f ; 369db $62 - cp $2c ; multi-hit + cp EFFECT_TWINEEDLE + jr z, .asm_36a3f + cp EFFECT_DOUBLE_HIT ld a, $1 - jr z, .asm_36a3a ; 369e1 $57 + jr z, .asm_36a3a ld a, [hl] - cp $9a ; beat up - jr z, .asm_369fb ; 369e6 $13 - cp $68 ; triple kick - jr nz, .asm_36a2b ; 369ea $3f + cp EFFECT_BEAT_UP + jr z, .asm_369fb + cp EFFECT_TRIPLE_KICK + jr nz, .asm_36a2b .asm_369ec call FarBattleRNG and $3 - jr z, .asm_369ec ; 369f1 $f9 + jr z, .asm_369ec dec a - jr nz, .asm_36a3a ; 369f4 $44 + jr nz, .asm_36a3a ld a, $1 ld [bc], a - jr .asm_36a48 ; 369f9 $4d + jr .asm_36a48 .asm_369fb ld a, [hBattleTurn] and a - jr nz, .asm_36a0b ; 369fe $b + jr nz, .asm_36a0b ld a, [PartyCount] cp $1 jp z, .asm_36a1e dec a - jr .asm_36a3a ; 36a09 $2f + jr .asm_36a3a .asm_36a0b ld a, [IsInBattle] cp $1 @@ -7536,7 +7538,7 @@ BattleCommand24: ; 369b6 push bc ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $9a ; beat up + cp EFFECT_BEAT_UP jr z, .asm_36a67 call FarBattleTextBox .asm_36a67 @@ -7788,7 +7790,7 @@ BattleCommand39: ; 36b4d ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $91 ; skull bash + cp EFFECT_SKULL_BASH ld b, $fe ; endturn jp z, SkipToBattleCommand jp EndMoveEffect @@ -8077,32 +8079,37 @@ BattleCommand2a: ; 36d3b Function0x36d70: ; 36d70 - ld bc, $c67b + ld bc, EnemyConfuseCount ld a, [hBattleTurn] and a - jr z, .asm_36d7b ; 36d76 $3 + jr z, .asm_36d7b ld bc, PlayerConfuseCount + .asm_36d7b set 7, [hl] call FarBattleRNG - and $3 + and 3 inc a inc a ld [bc], a + ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $4c + cp EFFECT_CONFUSE_HIT jr z, .asm_36d99 - cp $5c + cp EFFECT_SNORE jr z, .asm_36d99 - cp $76 + cp EFFECT_SWAGGER jr z, .asm_36d99 call Function0x37e01 + .asm_36d99 ld de, $0103 call Function0x37e54 + ld hl, BecameConfusedText call FarBattleTextBox + call GetOpponentItem ld a, b cp $f @@ -8117,11 +8124,11 @@ Function0x36d70: ; 36d70 Function0x36db6: ; 36db6 ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $4c + cp EFFECT_CONFUSE_HIT ret z - cp $5c + cp EFFECT_SNORE ret z - cp $76 + cp EFFECT_SWAGGER ret z jp PrintDidntAffect2 ; 36dc7 @@ -8990,12 +8997,14 @@ BattleCommand2e: ; 372fc and a jr z, .asm_3730d ld hl, EnemyScreens - ld bc, $c706 + ld bc, EnemyLightScreenCount + .asm_3730d ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $23 - jr nz, .asm_37324 + cp EFFECT_LIGHT_SCREEN + jr nz, .Reflect + bit 3, [hl] jr nz, .asm_37337 set 3, [hl] @@ -9004,11 +9013,14 @@ BattleCommand2e: ; 372fc ld hl, LightScreenEffectText jr .asm_37331 -.asm_37324 +.Reflect bit 4, [hl] jr nz, .asm_37337 set 4, [hl] + +; LightScreenCount -> ReflectCount inc bc + ld a, $5 ld [bc], a ld hl, ReflectEffectText diff --git a/main.asm b/main.asm index 8f7c441b0..a2c1f9460 100644 --- a/main.asm +++ b/main.asm @@ -14765,7 +14765,7 @@ DoWeatherModifiers: ; fbda4 db $ff .WeatherMoveModifiers - db WEATHER_RAIN, $97, 05 ; Solarbeam + db WEATHER_RAIN, EFFECT_SOLARBEAM, 05 db $ff ; fbe24 diff --git a/wram.asm b/wram.asm index c0938cca3..cbe51a7b4 100644 --- a/wram.asm +++ b/wram.asm @@ -722,7 +722,14 @@ PlayerLightScreenCount: ; c702 PlayerReflectCount: ; c703 ds 1 - ds 6 + ds 2 + +EnemyLightScreenCount: ; c706 + ds 1 +EnemyReflectCount: ; c707 + ds 1 + + ds 2 Weather: ; c70a ; 00 normal From c80b2e376e06e860e1b577cfbefad9438f7c8e79 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 29 Apr 2013 13:45:41 -0400 Subject: [PATCH 053/112] getname functions --- constants.asm | 3 + main.asm | 331 ++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 273 insertions(+), 61 deletions(-) diff --git a/constants.asm b/constants.asm index b764c8585..5dfa28715 100644 --- a/constants.asm +++ b/constants.asm @@ -1689,6 +1689,9 @@ HM_05 EQU $F7 HM_06 EQU $F8 HM_07 EQU $F9 +NUM_TMS EQU HM_01 - TM_01 - 2 + + ; days of the week SUNDAY EQU $00 MONDAY EQU $01 diff --git a/main.asm b/main.asm index a2c1f9460..549d7427d 100644 --- a/main.asm +++ b/main.asm @@ -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 @@ -3192,8 +3192,10 @@ CountSetBits: ; 0x335f ret ; 0x3376 + INCBIN "baserom.gbc", $3376, $33ab - $3376 + NamesPointerTable: ; 33ab dbw BANK(PokemonNames), PokemonNames dbw BANK(MoveNames), MoveNames @@ -3203,6 +3205,8 @@ NamesPointerTable: ; 33ab dbw $00, $d3a8 dbw BANK(TrainerClassNames), TrainerClassNames dbw $04, $4b52 +; 33c3 + GetName: ; 33c3 ld a, [hROMBank] @@ -3211,8 +3215,9 @@ GetName: ; 33c3 push bc push de ld a, [$cf61] - cp $1 - jr nz, .asm_33e1 ; 0x33ce $11 + cp 1 ; Pokemon names + jr nz, .asm_33e1 + ld a, [$cf60] ld [$d265], a call $343b @@ -3220,28 +3225,32 @@ GetName: ; 33c3 add hl, de ld e, l ld d, h - jr .asm_3403 ; 0x33df $22 + jr .done + .asm_33e1 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 +3261,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 +3274,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 -INCBIN "baserom.gbc", $3420, $3468 - $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 + + +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 @@ -4408,7 +4590,7 @@ SpecialGiveShuckle: ; 7305 ld b, 0 ld a, $13 ld hl, $5ba3 - rst $8 + rst FarCall ; Holding a Berry. ld bc, PartyMon2 - PartyMon1 @@ -5259,7 +5441,34 @@ 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 + + +INCBIN "baserom.gbc", $d417, $fa0b - $d417 SECTION "bank4",DATA,BANK[$4] @@ -5373,26 +5582,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 +5632,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 @@ -8255,7 +8464,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 @@ -8373,7 +8582,7 @@ EggStatsScreen: ; 4e33a call $3786 ld a, $41 ld hl, $402d - rst $8 + rst FarCall call $6497 ld a, [$d129] cp $6 @@ -9214,7 +9423,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 +9431,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 +9447,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 +9600,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 +9617,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 +9668,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 +9747,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 +9762,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 +9770,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 +9816,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 +9840,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 +9984,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 +9997,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 +10153,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 +10170,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 +10184,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 +10197,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 +10264,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 +10275,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 +10407,7 @@ ForesawAttackText: ; 0x81817 ; 0x8182d BeatUpAttackText: ; 0x8182d - text_from_ram $d073 + text_from_ram StringBuffer1 db $0, "'s", $4f db "attack!", $57 ; 0x8183b @@ -10487,7 +10696,7 @@ HallOfFame3: ; 0x8640e ld a, $5 ld hl, $4da0 - rst $8 + rst FarCall ld hl, $d95e ld a, [hl] cp $c8 @@ -10496,11 +10705,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 +10717,7 @@ HallOfFame3: ; 0x8640e ld b, a ld a, $42 ld hl, $5847 - rst $8 + rst FarCall ret ; 0x86455 From 652d26bb053dc9974c0d8fbbe88d7258f5815757 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 29 Apr 2013 14:04:25 -0400 Subject: [PATCH 054/112] base stat labels + GetCurNick --- main.asm | 38 +++++++++++++++++--------------------- wram.asm | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 22 deletions(-) diff --git a/main.asm b/main.asm index 549d7427d..82397a1fa 100644 --- a/main.asm +++ b/main.asm @@ -3506,11 +3506,8 @@ GetBaseStats: ; 3856 push bc push de push hl - -; Save bank ld a, [hROMBank] push af -; Bankswitch ld a, BANK(BaseStats) rst Bankswitch @@ -3534,12 +3531,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 @@ -3554,42 +3551,41 @@ GetBaseStats: ; 3856 ld a, [CurSpecies] ld [CurBaseStats], a -; Restore bank pop af rst Bankswitch - pop hl pop de pop bc ret ; 389c -INCBIN "baserom.gbc", $389c, $38a2 - $389c + +GetCurNick; 389c + ld a, [CurPartyMon] + ld hl, PartyMonNicknames GetNick: ; 38a2 -; get the nickname of a partymon -; write nick to StringBuffer1 - -; input: a = which mon (0-5) +; 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 @@ -6775,16 +6771,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 diff --git a/wram.asm b/wram.asm index cbe51a7b4..7419a674f 100644 --- a/wram.asm +++ b/wram.asm @@ -1166,11 +1166,52 @@ UnownLetter: ; d234 ds 1 CurBaseStats: ; d236 - ds 32 +BaseDexNo: ; d236 + ds 1 +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 + ds 2 +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 @@ -1620,6 +1661,7 @@ PartyMon5OT: ; de2b PartyMon6OT: ; de36 ds 11 +PartyMonNicknames: PartyMon1Nickname: ; de41 ds 11 PartyMon2Nickname: ; de4c From f2185cd0e4ef38a84fd8b49104843b8e84f37aba Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 29 Apr 2013 15:08:13 -0400 Subject: [PATCH 055/112] BaseStats is now BaseData --- battle/effect_commands.asm | 8 +- main.asm | 32 +-- stats/base_stats.asm | 506 ++++++++++++++++++------------------- wram.asm | 3 +- 4 files changed, 275 insertions(+), 274 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index c6b0c1c7a..0e77dd2ad 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -2020,7 +2020,7 @@ Function0x34a2a: ; 34a2a ld a, [hl] ld [CurSpecies], a - call GetBaseStats + call GetBaseData ld a, [LastEnemyCounterMove] dec a ld hl, $5afd @@ -2200,7 +2200,7 @@ Function0x34b20: ; 34b20 push hl ld [CurSpecies], a - call GetBaseStats + call GetBaseData ld a, [LastEnemyCounterMove] and a jr z, .asm_34b4a @@ -3929,7 +3929,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 +3937,7 @@ BattleCommanda1: ; 35461 call Function0x355bd ld a, [hl] ld [CurSpecies], a - call GetBaseStats + call GetBaseData ld a, [$d238] pop bc ld b, a diff --git a/main.asm b/main.asm index 82397a1fa..74fbc0734 100644 --- a/main.asm +++ b/main.asm @@ -3502,27 +3502,27 @@ GetMoveName: ; 34f8 INCBIN "baserom.gbc", $350c, $3856 - $350c -GetBaseStats: ; 3856 +GetBaseData: ; 3856 push bc push de push hl ld a, [hROMBank] push af - 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 @@ -3549,7 +3549,7 @@ GetBaseStats: ; 3856 .end ; Replace Pokedex # with species ld a, [CurSpecies] - ld [CurBaseStats], a + ld [CurBaseData], a pop af rst Bankswitch @@ -6734,8 +6734,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: @@ -6754,7 +6754,7 @@ 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 @@ -8963,12 +8963,12 @@ GetGender: ; 50bdd push bc ld a, [CurPartySpecies] dec a - ld hl, BaseStats + 13 ; BASE_GENDER - ld bc, BaseStats1 - BaseStats + ld hl, BaseData + 13 ; BASE_GENDER + ld bc, BaseData1 - BaseData call AddNTimes pop bc - ld a, BANK(BaseStats) + ld a, BANK(BaseData) call GetFarByte @@ -9003,7 +9003,7 @@ GetGender: ; 50bdd INCBIN "baserom.gbc", $50c50, $51424 - $50c50 -BaseStats: +BaseData: INCLUDE "stats/base_stats.asm" PokemonNames: 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 diff --git a/wram.asm b/wram.asm index 7419a674f..bbda401ac 100644 --- a/wram.asm +++ b/wram.asm @@ -1165,9 +1165,10 @@ UnownLetter: ; d234 ds 1 -CurBaseStats: ; d236 +CurBaseData: ; d236 BaseDexNo: ; d236 ds 1 +BaseStats: ; d237 BaseHP: ; d237 ds 1 BaseAttack: ; d238 From 620d5c09c70d85a07bc9c55875db971ac3cd7097 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 29 Apr 2013 15:42:31 -0400 Subject: [PATCH 056/112] More labels in LoadEnemyMon --- constants.asm | 1 + main.asm | 34 +++++++++++++++++----------------- wram.asm | 22 ++++++++++++++++------ 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/constants.asm b/constants.asm index 5dfa28715..437ad3c1a 100644 --- a/constants.asm +++ b/constants.asm @@ -2339,6 +2339,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 diff --git a/main.asm b/main.asm index 74fbc0734..12ae6c6b3 100644 --- a/main.asm +++ b/main.asm @@ -3549,7 +3549,7 @@ GetBaseData: ; 3856 .end ; Replace Pokedex # with species ld a, [CurSpecies] - ld [CurBaseData], a + ld [BaseDexNo], a pop af rst Bankswitch @@ -6716,7 +6716,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 @@ -6760,7 +6760,7 @@ LoadEnemyMon: ; 3e8eb ; 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 @@ -6795,7 +6795,7 @@ LoadEnemyMon: ; 3e8eb jr z, .InitDVs ; ???? - ld a, [$c671] + ld a, [EnemySubStatus5] bit 3, a jr z, .InitDVs @@ -6982,7 +6982,7 @@ LoadEnemyMon: ; 3e8eb .Happiness ; Set happiness - ld a, 70 ; BASE_HAPPINESS + ld a, BASE_HAPPINESS ld [EnemyMonHappiness], a ; Set level ld a, [CurPartyLevel] @@ -7077,8 +7077,8 @@ LoadEnemyMon: ; 3e8eb .Moves ; ???? - ld hl, $d23d - ld de, $d224 + ld hl, BaseType1 + ld de, EnemyMonType1 ld a, [hli] ld [de], a inc de @@ -7137,24 +7137,24 @@ 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 @@ -8963,7 +8963,7 @@ GetGender: ; 50bdd push bc ld a, [CurPartySpecies] dec a - ld hl, BaseData + 13 ; BASE_GENDER + ld hl, BaseData + BaseGender - CurBaseData ld bc, BaseData1 - BaseData call AddNTimes pop bc diff --git a/wram.asm b/wram.asm index bbda401ac..955ebab21 100644 --- a/wram.asm +++ b/wram.asm @@ -1043,17 +1043,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 @@ -1121,8 +1120,16 @@ EnemyMonType1: ; d224 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 @@ -1182,7 +1189,10 @@ BaseSpecialAttack: ; d23b BaseSpecialDefense: ; d23c ds 1 BaseType: ; d23d - ds 2 +BaseType1: ; d23d + ds 1 +BaseType2: ; d23e + ds 1 BaseCatchRate: ; d23f ds 1 BaseExp: ; d240 From 94cdb091c9dc09da8efab21c0676471b0d38d96a Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 29 Apr 2013 16:32:05 -0400 Subject: [PATCH 057/112] i have a clue what most of this does --- constants.asm | 1 + main.asm | 111 ++++++++++++++++++++++++++++++-------------------- wram.asm | 2 + 3 files changed, 69 insertions(+), 45 deletions(-) diff --git a/constants.asm b/constants.asm index 437ad3c1a..b3e3955c4 100644 --- a/constants.asm +++ b/constants.asm @@ -3363,6 +3363,7 @@ SPECIAL_MONCHECK EQU $0097 ; predefs +PREDEF_FLAG EQU $03 PREDEF_FILLPP EQU $05 PREDEF_ADDPARTYMON EQU $06 PREDEF_FILLSTATS EQU $0C diff --git a/main.asm b/main.asm index 12ae6c6b3..409d45baf 100644 --- a/main.asm +++ b/main.asm @@ -3220,7 +3220,7 @@ GetName: ; 33c3 ld a, [$cf60] ld [$d265], a - call $343b + call GetPokemonName ld hl, $000b add hl, de ld e, l @@ -7155,34 +7155,36 @@ LoadEnemyMon: ; 3e8eb 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 @@ -7430,85 +7432,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, $5e + 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 @@ -9359,7 +9380,7 @@ WildPokemonAppearedText2: ; 0x80793 db "appeared!", $58 ; 0x807a9 -BattleText_0x807a9: ; 0x807a9 +WantsToBattleText: ; 0x807a9 db $0, $3f, $4f db "wants to battle!", $58 ; 0x807bd diff --git a/wram.asm b/wram.asm index 955ebab21..713b16393 100644 --- a/wram.asm +++ b/wram.asm @@ -1104,6 +1104,7 @@ EnemyMonMaxHPHi: ; d218 EnemyMonMaxHPLo: ; d219 ds 1 +EnemyMonStats: EnemyMonAtk: ; d21a ds 2 EnemyMonDef: ; d21c @@ -1114,6 +1115,7 @@ EnemyMonSpclAtk: ; d220 ds 2 EnemyMonSpclDef: ; d222 ds 2 +EnemyMonStatsEnd EnemyMonType1: ; d224 ds 1 From e8fb1bc632bfaa57c64dfa81b3869d2c7a2b9541 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 29 Apr 2013 16:46:32 -0400 Subject: [PATCH 058/112] finish PlayBattleMusic --- main.asm | 80 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 24 deletions(-) diff --git a/main.asm b/main.asm index 409d45baf..8608f55ec 100644 --- a/main.asm +++ b/main.asm @@ -6364,88 +6364,120 @@ 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 + INCBIN "baserom.gbc", $2ef18, $2ef9f - $2ef18 From ef946c51add1330a3b4aa19a86628e2dc5ace011 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 29 Apr 2013 19:24:16 -0400 Subject: [PATCH 059/112] more bank b fns ClearBattleRAM and FillBox (predef $13) --- main.asm | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 2 deletions(-) diff --git a/main.asm b/main.asm index 8608f55ec..eed5ca1b1 100644 --- a/main.asm +++ b/main.asm @@ -4708,7 +4708,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 @@ -6479,7 +6479,118 @@ PlayBattleMusic: ; 2ee6c ; 2ef18 -INCBIN "baserom.gbc", $2ef18, $2ef9f - $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 + SECTION "bankC",DATA,BANK[$C] From 3f07cd95f7459e4e0515a60d34b47b91db2d2117 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 29 Apr 2013 21:19:42 -0400 Subject: [PATCH 060/112] GetItemAttr and related fns --- main.asm | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- wram.asm | 7 +++- 2 files changed, 113 insertions(+), 4 deletions(-) diff --git a/main.asm b/main.asm index eed5ca1b1..4c9f7be64 100644 --- a/main.asm +++ b/main.asm @@ -5451,20 +5451,124 @@ GetTMHMNumber: ; d407 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 -INCBIN "baserom.gbc", $d417, $fa0b - $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, $67c1 ; Items + 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, $1 ; BANK(Items) + 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] diff --git a/wram.asm b/wram.asm index 713b16393..de76fe74f 100644 --- a/wram.asm +++ b/wram.asm @@ -918,7 +918,12 @@ VramState: ; d0ed ; flickers when climbing waterfall ds 1 - ds 26 + ds 24 + +CurItem: ; d106 + ds 1 + + ds 1 CurPartySpecies: ; d108 ds 1 From 6b960f3e15d25d3ec1ceec386c0f5e40a27c7c92 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 30 Apr 2013 01:59:09 -0400 Subject: [PATCH 061/112] item attribute constants --- constants.asm | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/constants.asm b/constants.asm index b3e3955c4..67e2145b2 100644 --- a/constants.asm +++ b/constants.asm @@ -1691,6 +1691,55 @@ 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 From 45343b07c7658040fda01f8eb2b7eb93f1efcda6 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 30 Apr 2013 02:01:54 -0400 Subject: [PATCH 062/112] dump item attributes --- battle/effect_commands.asm | 6 +- items/item_attributes.asm | 2053 ++++++++++++++++++++++++++++++++++++ main.asm | 11 +- 3 files changed, 2064 insertions(+), 6 deletions(-) create mode 100644 items/item_attributes.asm diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 0e77dd2ad..68cb86dde 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -10943,13 +10943,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/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 + + diff --git a/main.asm b/main.asm index 4c9f7be64..01f42b655 100644 --- a/main.asm +++ b/main.asm @@ -4533,7 +4533,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 @@ -5539,7 +5544,7 @@ GetItemAttr: ; d460 push hl push bc - ld hl, $67c1 ; Items + ld hl, ItemAttributes ld c, a ld b, 0 add hl, bc @@ -5552,7 +5557,7 @@ GetItemAttr: ; d460 ld c, a ld a, 7 call AddNTimes - ld a, $1 ; BANK(Items) + ld a, BANK(ItemAttributes) call GetFarByte pop bc From 9fc8d527f727dedfb8dd718cfea9e29d7b26775d Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 30 Apr 2013 20:27:13 -0400 Subject: [PATCH 063/112] Fix PointerLabelToScriptPointer class used the current address instead of the parsed address --- extras/crystal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/crystal.py b/extras/crystal.py index 764f42a1e..c7b09397e 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -1471,7 +1471,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) From 40876d28003153736712ba237c1c2e8b19f65791 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 30 Apr 2013 22:32:03 -0400 Subject: [PATCH 064/112] remove incbins in IcePathB1F --- maps/IcePathB1F.asm | 71 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) 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 From 590d000d2448a8787ede882481a81118417b1418 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 30 Apr 2013 23:05:52 -0400 Subject: [PATCH 065/112] remove incbins in BlackthornGym2F --- maps/BlackthornGym2F.asm | 52 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) 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 From 9004b6a3d75e6bc5278a78f51e710c70c77a39a1 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 30 Apr 2013 23:10:21 -0400 Subject: [PATCH 066/112] remove incbins in KrissHouse2F --- maps/KrissHouse2F.asm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From c1acb04707861d1a19a04858e3fced90f77a464c Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 01:00:32 -0400 Subject: [PATCH 067/112] remove incbins in GoldenrodCity --- maps/GoldenrodCity.asm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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 From ae7b176ac8fded9a5f4cdd1ab631843914cf0ebb Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 01:54:24 -0400 Subject: [PATCH 068/112] elevator floor constants --- constants.asm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/constants.asm b/constants.asm index 67e2145b2..49afe6f24 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 From 1678e022582b24d282bcf47a984d455b01e9cf74 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 02:00:21 -0400 Subject: [PATCH 069/112] remove incbins in GoldenrodDeptStoreElevator --- maps/GoldenrodDeptStoreElevator.asm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 From fc0b5601afbe9a54b12b3c09622eafbfd6708082 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 02:07:06 -0400 Subject: [PATCH 070/112] remove incbins in CeladonDeptStoreElevator --- maps/CeladonDeptStoreElevator.asm | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) 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 From 3ce221ae093315b4c2c53659594ec051b0a07b73 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 02:24:05 -0400 Subject: [PATCH 071/112] remove incbins in CeladonDeptStore6F --- maps/CeladonDeptStore6F.asm | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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 From f98359fd1be818a1646fca4fe9ed35557ce0227b Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 02:28:11 -0400 Subject: [PATCH 072/112] remove incbins in GoldenrodGameCorner --- maps/GoldenrodGameCorner.asm | 44 +++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) 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 From a6b034dc4137681a6ecb30427e554d82bf04cc56 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 02:32:25 -0400 Subject: [PATCH 073/112] remove incbins in DragonShrine --- maps/DragonShrine.asm | 96 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 6 deletions(-) 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 From 4307a2bb45c690278a32a63753797baeed5dc34d Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 02:53:33 -0400 Subject: [PATCH 074/112] remove incbins in CeladonGameCornerPrizeRoom --- maps/CeladonGameCornerPrizeRoom.asm | 44 +++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-) 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 From 8a316097e1af4efff688c569c43e4d61596e8edb Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 03:36:25 -0400 Subject: [PATCH 075/112] remove incbins in DragonsDenB1F --- maps/DragonsDenB1F.asm | 46 +++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) 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 From 8218520bef41ed793afad8a34a9e3896f5241a3d Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 05:22:24 -0400 Subject: [PATCH 076/112] remove incbins in EarlsPokemonAcademy --- maps/EarlsPokemonAcademy.asm | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) 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 From eb971e37ad0d19246818ee67a586b397f2534caf Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 05:27:54 -0400 Subject: [PATCH 077/112] remove incbins in GoldenrodDeptStore6F --- maps/GoldenrodDeptStore6F.asm | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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 From 92863b3446fce6fd1ee46574177d816aac428f89 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 06:16:39 -0400 Subject: [PATCH 078/112] remove incbins in GoldenrodPokeComCenter2FMobile --- maps/GoldenrodPokeComCenter2FMobile.asm | 39 ++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) 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 From d4fe2c9953027e1d459bbe4b4fe4c5131c10aa1a Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 13:29:45 -0400 Subject: [PATCH 079/112] remove incbins in BattleTower --- maps/BattleTower1F.asm | 24 +++++++++++++++++++----- maps/BattleTowerBattleRoom.asm | 8 +++++++- maps/BattleTowerHallway.asm | 18 ++++++++++++++++-- 3 files changed, 42 insertions(+), 8 deletions(-) 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 From e46e8a3023661880333a2781cbd4611d436da405 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 13:52:44 -0400 Subject: [PATCH 080/112] fix parsing errors in RuinsofAlphOutside --- maps/RuinsofAlphOutside.asm | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) 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 From 2acb46f6b58156ee3380a6203070ef2096db4b84 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 1 May 2013 23:18:38 -0400 Subject: [PATCH 081/112] downward triangle character 0xee --- extras/chars.py | 1 + preprocessor.py | 1 + 2 files changed, 2 insertions(+) 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/preprocessor.py b/preprocessor.py index c53612517..48906da5e 100644 --- a/preprocessor.py +++ b/preprocessor.py @@ -287,6 +287,7 @@ chars = { "é": 0xEA, "→": 0xEB, "â–¶": 0xED, +"â–¼": 0xEE, "♂": 0xEF, "Â¥": 0xF0, "×": 0xF1, From d2bf30db60f1d88e98be3bab1adac3e2006d81ab Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 2 May 2013 19:48:04 -0400 Subject: [PATCH 082/112] sfx constants --- constants.asm | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 213 insertions(+) diff --git a/constants.asm b/constants.asm index 49afe6f24..dea980b2d 100644 --- a/constants.asm +++ b/constants.asm @@ -3325,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 From 16507d3989df908ef9f3187c3e5d2c2a0840ef64 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 2 May 2013 19:59:03 -0400 Subject: [PATCH 083/112] fix sfx pointer comments --- audio/sfx_pointers.asm | 415 +++++++++++++++++++++-------------------- 1 file changed, 208 insertions(+), 207 deletions(-) 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 + From 10604fe8b3dfbc876df1bf6872ee8db37f712b1d Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 2 May 2013 20:27:39 -0400 Subject: [PATCH 084/112] sfx constants in the wild --- main.asm | 17 ++++++++++------- scripting.asm | 14 +++++++------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/main.asm b/main.asm index 01f42b655..b127d8902 100644 --- a/main.asm +++ b/main.asm @@ -7690,7 +7690,7 @@ BattleStartMessage ; 3fc8b dec a jr z, .asm_3fcaa - ld de, $5e + ld de, SFX_SHINE call StartSFX call WaitSFX @@ -8853,10 +8853,11 @@ EggStatsScreen: ; 4e33a ld hl, $402d 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 @@ -8947,13 +8948,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 @@ -16558,7 +16561,7 @@ StartTitleScreen: ; 10ed67 ; Play starting sound effect call SFXChannelsOff - ld de, $0065 + ld de, SFX_TITLE_SCREEN_ENTRANCE call StartSFX ret diff --git a/scripting.asm b/scripting.asm index b029b7865..f2eb1a891 100644 --- a/scripting.asm +++ b/scripting.asm @@ -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 @@ -877,7 +877,7 @@ Script_playsound: ; 0x971b7 Script_waitbutton: ; 0x971c3 ; script command 0x86 - call $3c55 + call WaitSFX ret ; 0x971c7 From b921c130e82959e5e06d5f1e619438c5e6dbb1e9 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 2 May 2013 21:55:03 -0400 Subject: [PATCH 085/112] Clean up and add a couple functions in bank 0 Mostly related to sound --- main.asm | 225 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 162 insertions(+), 63 deletions(-) diff --git a/main.asm b/main.asm index b127d8902..06a23c62e 100644 --- a/main.asm +++ b/main.asm @@ -3920,60 +3920,122 @@ 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 -LoadMusicByte: ; 3b86 -; load music data into CurMusicByte -; input: -; a: bank -; de: address - ld [hROMBank], a - ld [$2000], a ; bankswitch - ld a, [de] - ld [CurMusicByte], a - ld a, $3a ; manual bank restore - ld [hROMBank], a - ld [$2000], a ; bankswitch - ret -; 3b97 -StartMusic: ; 3b97 -; input: -; e = song number +CleanSoundRestart: ; 3b4e + 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(SoundRestart) ld [hROMBank], a - ld [$2000], a ; bankswitch - ld a, e ; song number + ld [$2000], a + + call SoundRestart + + pop af + ld [hROMBank], a + ld [$2000], 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 [$2000], a + + call UpdateSound + + pop af + ld [hROMBank], a + ld [$2000], a + + pop af + pop bc + pop de + pop hl + ret +; 3b86 + + +LoadMusicByte: ; 3b86 +; CurMusicByte = [a:de] + + ld [hROMBank], a + ld [$2000], a + + ld a, [de] + ld [CurMusicByte], a + ld a, $3a ; manual bank restore + + ld [hROMBank], a + ld [$2000], a + ret +; 3b97 + + +StartMusic: ; 3b97 +; Play music de. + + push hl + push de + push bc + push af + + ld a, [hROMBank] + push af + ld a, BANK(LoadMusic) ; and BANK(SoundRestart) + ld [hROMBank], a + ld [$2000], 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 [hROMBank], a ld [$2000], a pop af pop bc @@ -3982,25 +4044,58 @@ StartMusic: ; 3b97 ret ; 3bbc -INCBIN "baserom.gbc", $3bbc, $3be3 - $3bbc -PlayCryHeader: ; 3be3 -; Play a cry given parameters in header de - +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 [$2000], a + + push de + ld de, MUSIC_NONE + call LoadMusic + call DelayFrame + pop de + call LoadMusic + + pop af + ld [hROMBank], a + ld [$2000], 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 - + ; Each header is 6 bytes long: ld hl, CryHeaders add hl, de @@ -4009,33 +4104,27 @@ 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 + call PlayCry - -; Restore bank + pop af ld [hROMBank], a ld [$2000], a @@ -4049,31 +4138,35 @@ 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 a, e ld [CurSFX], a call LoadSFX + pop af - ld [hROMBank], a ; restore bank + ld [hROMBank], a ld [$2000], a ; bankswitch .quit pop af @@ -4083,31 +4176,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 From 6386d76cbdcc308924a09b6c3588c256cea1868c Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 2 May 2013 22:13:30 -0400 Subject: [PATCH 086/112] MBC3 constants --- gbhw.asm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gbhw.asm b/gbhw.asm index de87d304a..3193994d8 100644 --- a/gbhw.asm +++ b/gbhw.asm @@ -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) From 993eecdc4a931dde7c5c487fba5d79f548866030 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 2 May 2013 22:38:12 -0400 Subject: [PATCH 087/112] MBC constants in the wild --- main.asm | 94 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/main.asm b/main.asm index 06a23c62e..f28fc4054 100644 --- a/main.asm +++ b/main.asm @@ -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 @@ -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 @@ -3950,13 +3950,13 @@ CleanSoundRestart: ; 3b4e push af ld a, BANK(SoundRestart) ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a call SoundRestart pop af ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a pop af pop bc @@ -3977,13 +3977,13 @@ CleanUpdateSound: ; 3b6a push af ld a, BANK(UpdateSound) ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a call UpdateSound pop af ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a pop af pop bc @@ -3997,14 +3997,14 @@ LoadMusicByte: ; 3b86 ; CurMusicByte = [a:de] ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a ld a, [de] ld [CurMusicByte], a ld a, $3a ; manual bank restore ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a ret ; 3b97 @@ -4021,7 +4021,7 @@ StartMusic: ; 3b97 push af ld a, BANK(LoadMusic) ; and BANK(SoundRestart) ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a ld a, e and a @@ -4036,7 +4036,7 @@ StartMusic: ; 3b97 .end pop af ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a pop af pop bc pop de @@ -4057,7 +4057,7 @@ StartMusic2: ; 3bbc push af ld a, BANK(LoadMusic) ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a push de ld de, MUSIC_NONE @@ -4068,7 +4068,7 @@ StartMusic2: ; 3bbc pop af ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a pop af pop bc @@ -4094,7 +4094,7 @@ PlayCryHeader: ; 3be3 ; 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 @@ -4121,13 +4121,13 @@ PlayCryHeader: ; 3be3 ld a, BANK(PlayCry) ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a call PlayCry pop af ld [hROMBank], a - ld [$2000], a + ld [MBC3RomBank], a pop af pop bc @@ -4159,7 +4159,7 @@ StartSFX: ; 3c23 push af ld a, BANK(LoadSFX) ld [hROMBank], a - ld [$2000], a ; bankswitch + ld [MBC3RomBank], a ; bankswitch ld a, e ld [CurSFX], a @@ -4167,7 +4167,7 @@ StartSFX: ; 3c23 pop af ld [hROMBank], a - ld [$2000], a ; bankswitch + ld [MBC3RomBank], a ; bankswitch .quit pop af pop bc From ec3f279d53fba86e759eb0baa02b03e5303da95a Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 2 May 2013 22:45:34 -0400 Subject: [PATCH 088/112] SimpleMultiply and SimpleDivide --- main.asm | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/main.asm b/main.asm index f28fc4054..0edd2649d 100644 --- a/main.asm +++ b/main.asm @@ -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 @@ -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 From 417a73d61a046641ab9a3d7c405f41bddfa1966f Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 00:09:54 -0400 Subject: [PATCH 089/112] More bank 0 functions --- main.asm | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 125 insertions(+), 11 deletions(-) diff --git a/main.asm b/main.asm index 0edd2649d..94bdb78bb 100644 --- a/main.asm +++ b/main.asm @@ -2999,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 @@ -3119,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 @@ -3191,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 @@ -3220,7 +3273,56 @@ CountSetBits: ; 0x335f ; 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 @@ -3228,14 +3330,15 @@ NamesPointerTable: ; 33ab 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 @@ -3243,7 +3346,7 @@ GetName: ; 33c3 push de ld a, [$cf61] cp 1 ; Pokemon names - jr nz, .asm_33e1 + jr nz, .NotPokeName ld a, [$cf60] ld [$d265], a @@ -3254,7 +3357,7 @@ GetName: ; 33c3 ld d, h jr .done -.asm_33e1 +.NotPokeName ld a, [$cf61] dec a ld e, a @@ -3718,7 +3821,7 @@ INCBIN "baserom.gbc", $392d, $395d - $392d 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 @@ -3731,7 +3834,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 @@ -8936,7 +9050,7 @@ EggStatsScreen: ; 4e33a xor a ld [hBGMapMode], a ld hl, $cda1 - call $334e ; SetHPPal + call SetHPPal ld b, $3 call GetSGBLayout call $5f8f From 0cbea9b553f0abf44b0bf1b28b96429b36a0bac2 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 00:22:28 -0400 Subject: [PATCH 090/112] bank 0 battle functions --- battle/effect_commands.asm | 78 +++++++++++++++++++------------------- main.asm | 67 +++++++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 40 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 68cb86dde..d4e283177 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 @@ -3268,7 +3268,7 @@ BattleCommand11: ; 351c0 ld l, c ld a, $b call $2d83 - call $39c9 + call RefreshBattleHuds call SwitchTurn xor a @@ -5385,7 +5385,7 @@ Function0x35d1c: ; 35d1c ld a, $b call Predef .asm_35d7b - jp $39c9 + jp RefreshBattleHuds ; 35d7e @@ -5443,7 +5443,7 @@ Function0x35d7e: ; 35d7e ld a, $b call Predef .asm_35ddd - jp $39c9 + jp RefreshBattleHuds ; 35de0 @@ -5503,7 +5503,7 @@ Function0x35de0: ; 35de0 xor a ld [hl], a .asm_35e3a - call $39c9 + call RefreshBattleHuds .asm_35e3d jp ResetDamage ; 35e40 @@ -5581,8 +5581,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 +5659,7 @@ BattleCommand13: ; 35eee call Function0x35ff5 ld de, $0106 call Function0x37e54 - call $39c9 + call RefreshBattleHuds ld hl, WasPoisonedText call FarBattleTextBox @@ -5756,7 +5756,7 @@ BattleCommand2f: ; 35f2c Function0x35fc0: ; 35fc0 call Function0x37e01 call Function0x35ff5 - jp $39c9 + jp RefreshBattleHuds ; 35fc9 @@ -5797,7 +5797,7 @@ Function0x35ff5: ; 35ff5 ld a, $b call $39e7 set 3, [hl] - jp $398e + jp UpdateOpponentInParty ; 35fff @@ -5895,8 +5895,8 @@ Function0x36011: ; 36011 ld [$d10a], a ld a, $b call Predef - call $39c9 - jp $399c + call RefreshBattleHuds + jp UpdateBattleMonInParty ; 3608c @@ -5928,12 +5928,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 +5965,7 @@ Defrost: ; 360dd call GetPartyLocation xor a ld [hl], a - call $398e + call UpdateOpponentInParty ld hl, DefrostedOpponentText jp FarBattleTextBox @@ -6003,10 +6003,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 +6054,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 @@ -7158,7 +7158,7 @@ BattleCommanda0: ; 36778 cp b jr nc, .asm_367df ; 367dd $0 .asm_367df - call $399c + call UpdateBattleMonInParty xor a ld [$cfca], a inc a @@ -7225,7 +7225,7 @@ BattleCommand23: ; 3680f .asm_36852 jp .asm_36969 .asm_36855 - call $399c + call UpdateBattleMonInParty xor a ld [$cfca], a inc a @@ -7239,7 +7239,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 +7318,7 @@ BattleCommand23: ; 3680f jr .asm_36969 .asm_368f5 - call $399c + call UpdateBattleMonInParty xor a ld [$cfca], a inc a @@ -7335,7 +7335,7 @@ BattleCommand23: ; 3680f cp $1 jr z, .asm_368ca - call $399c + call UpdateBattleMonInParty ld a, $1 ld [$c689], a call Function0x37e01 @@ -8017,7 +8017,7 @@ BattleCommand27: ; 36cb2 ld [$d10a], a ld a, $b call $2d83 - call $39c9 + call RefreshBattleHuds ld hl, RecoilText jp FarBattleTextBox ; 36d1d @@ -8188,10 +8188,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 +8310,7 @@ BattleCommand31: ; 36e7c .asm_36eeb ld hl, MadeSubstituteText call FarBattleTextBox - jp $39c9 + jp RefreshBattleHuds .asm_36ef4 call Function0x34548 call nz, BattleCommand0c @@ -8784,8 +8784,8 @@ BattleCommand2c: ; 3713e ld hl, $4cef call CallBankF call SwitchTurn - call $3995 - call $39c9 + call UpdateUserInParty + call RefreshBattleHuds ld hl, RegainedHealthText jp FarBattleTextBox @@ -9141,7 +9141,7 @@ BattleCommand1a: ; 37380 ld hl, $6043 rst FarCall call $31f6 - jp $39c9 + jp RefreshBattleHuds ; 373c9 @@ -9444,7 +9444,7 @@ BattleCommand53: ; 37563 call $3945 res 5, [hl] .asm_3757f - call $39c9 + call RefreshBattleHuds ld hl, WasDefrostedText jp FarBattleTextBox ; 37588 @@ -9505,7 +9505,7 @@ BattleCommand54: ; 37588 call CallBankF ld hl, $4c3f call CallBankF - call $3995 + call UpdateUserInParty ld hl, PutACurseText jp FarBattleTextBox .asm_37604 @@ -10041,7 +10041,7 @@ BattleCommand61: ; 37874 ld hl, RegainedHealthText call FarBattleTextBox call SwitchTurn - call $398e + call UpdateOpponentInParty jr .asm_37904 ; 378f1 $11 .asm_378f3 call SwitchTurn @@ -10199,7 +10199,7 @@ BattleCommand67: ; 379c9 call Function0x37ae9 jp z, Function0x37aab - call $399c + call UpdateBattleMonInParty call Function0x37e01 ld c, 50 @@ -10253,7 +10253,7 @@ BattleCommand67: ; 379c9 call Function0x37af6 jp z, Function0x37aab - call $39b0 + call UpdateEnemyMonInParty call Function0x37e01 call Function0x37a82 @@ -10564,7 +10564,7 @@ BattleCommand6a6c: ; 37b7e rst FarCall ; callab 3ccef call SwitchTurn - call $3995 + call UpdateUserInParty ; 'regained health!' ld hl, RegainedHealthText @@ -10646,7 +10646,7 @@ BattleCommand95: ; 37c1a ld hl, $4c3f ld a, $f rst FarCall - call $3995 + call UpdateUserInParty ld a, $5 .asm_37c41 diff --git a/main.asm b/main.asm index 94bdb78bb..6ff248df1 100644 --- a/main.asm +++ b/main.asm @@ -3867,7 +3867,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. From adeb0ac47c9ee3876d1ce0b526d7e6a6e7170ce2 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 00:35:36 -0400 Subject: [PATCH 091/112] easier-to-use status constants --- constants.asm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/constants.asm b/constants.asm index dea980b2d..7f390e832 100644 --- a/constants.asm +++ b/constants.asm @@ -3763,11 +3763,12 @@ SUBSTATUS_LOCK_ON EQU 5 ; 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 From 2b00d49065e01e35bc6ead2fadc2ce7972ed77d0 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 01:29:57 -0400 Subject: [PATCH 092/112] move effect cleanup --- battle/effect_commands.asm | 191 +++++++++++++++++++------------------ constants.asm | 3 + wram.asm | 29 +++--- 3 files changed, 117 insertions(+), 106 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index d4e283177..a3d8d0523 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -496,7 +496,7 @@ CheckEnemyTurn: ; 3421f .CheckDisabled - ld hl, EnemyEncoreCount + ld hl, EnemyDisableCount ld a, [hl] and a jr z, .CheckConfused @@ -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 @@ -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] @@ -3267,7 +3268,7 @@ BattleCommand11: ; 351c0 ld h, b ld l, c ld a, $b - call $2d83 + call Predef call RefreshBattleHuds call SwitchTurn @@ -4516,7 +4517,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 +4650,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 +4666,7 @@ BattleCommand42: ; 35926 call ResetDamage ld hl, $c4ca ld a, $b - call $2d83 + call Predef ld a, $5e ld hl, $4000 rst FarCall @@ -4811,7 +4812,7 @@ BattleCommand44: ; 359e6 ld a, [hl] ld [$d265], a ld a, $29 - call $2d83 + call Predef ld hl, $5452 jp FarBattleTextBox .asm_35a50 @@ -5472,7 +5473,7 @@ Function0x35de0: ; 35de0 jr nc, .asm_35e3d .asm_35dff - ld a, $8 + ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVarPair res 4, [hl] @@ -5481,23 +5482,23 @@ 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 @@ -5537,7 +5538,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 @@ -5692,7 +5693,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 @@ -5761,17 +5762,17 @@ Function0x35fc0: ; 35fc0 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,23 +5781,23 @@ 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] + ld a, BATTLE_VARS_STATUS_OPP + call GetBattleVarPair + set PSN, [hl] jp UpdateOpponentInParty ; 35fff @@ -6418,27 +6419,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 +6938,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 +6952,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 +6969,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 @@ -8016,7 +8018,7 @@ BattleCommand27: ; 36cb2 .asm_36d0c ld [$d10a], a ld a, $b - call $2d83 + call Predef call RefreshBattleHuds ld hl, RecoilText jp FarBattleTextBox @@ -8053,7 +8055,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 +8152,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 @@ -8493,7 +8495,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 @@ -8976,7 +8978,7 @@ Function0x372e7: ; 372e7 jr z, .player xor a - ld [EnemyEncoreCount], a + ld [EnemyDisableCount], a ld [EnemyEncoredMove], a ret @@ -9360,7 +9362,7 @@ BattleCommand50: ; 37492 ld [hl], a ld [de], a .asm_374f8 - call $3468 + call GetItemName ld hl, StoleText jp FarBattleTextBox @@ -9539,8 +9541,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 +9598,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 +9614,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 +9636,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 +9657,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 +9711,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 diff --git a/constants.asm b/constants.asm index 7f390e832..2fe1f6ee5 100644 --- a/constants.asm +++ b/constants.asm @@ -3737,6 +3737,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 @@ -3756,10 +3757,12 @@ 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_DESTINY_BOND EQU 6 SUBSTATUS_LOCK_ON EQU 5 +SUBSTATUS_TOXIC EQU 0 ; status diff --git a/wram.asm b/wram.asm index de76fe74f..28ed0d0d0 100644 --- a/wram.asm +++ b/wram.asm @@ -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,7 +545,7 @@ PlayerSubStatus4: ; c66b ; 4 substitute ; 3 ; 2 focus energy -; 1 +; 1 mist ; 0 bide: unleashed energy ds 1 PlayerSubStatus5: ; c66c @@ -557,7 +557,7 @@ PlayerSubStatus5: ; c66c ; 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 @@ -706,13 +708,14 @@ AlreadyFailed: ; c6fb ds 3 PlayerScreens: ; c6ff -; bit 4: reflect -; bit 3: light screen +; bit +; 4 reflect +; 3 light screen +; 0 spikes ds 1 EnemyScreens: ; c700 -; bit 4: reflect -; bit 3: light screen +; see PlayerScreens ds 1 ds 1 From 9b68493758aa62b761e6aa819303f30054cef605 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 02:42:25 -0400 Subject: [PATCH 093/112] arena trap substatus --- constants.asm | 1 + wram.asm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/constants.asm b/constants.asm index 2fe1f6ee5..512fb9abc 100644 --- a/constants.asm +++ b/constants.asm @@ -3760,6 +3760,7 @@ 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 diff --git a/wram.asm b/wram.asm index 28ed0d0d0..293d8d086 100644 --- a/wram.asm +++ b/wram.asm @@ -550,7 +550,7 @@ PlayerSubStatus4: ; c66b ds 1 PlayerSubStatus5: ; c66c ; bit -; 7 +; 7 cant run ; 6 destiny bond ; 5 lock-on ; 4 From f3d0f2f1a4316e8793acc59a7fd3bc851a39355a Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 02:43:04 -0400 Subject: [PATCH 094/112] user/opponent party attribute functions --- main.asm | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/main.asm b/main.asm index 6ff248df1..5fdece4fb 100644 --- a/main.asm +++ b/main.asm @@ -3817,7 +3817,33 @@ 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 From d077fae081127bcf7bd9b58f37771519587f5f9c Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 02:43:44 -0400 Subject: [PATCH 095/112] more move effect cleanup --- battle/effect_commands.asm | 222 +++++++++++++++++++------------------ 1 file changed, 113 insertions(+), 109 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index a3d8d0523..78a03a899 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -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 @@ -2023,7 +2023,7 @@ Function0x34a2a: ; 34a2a 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 @@ -2206,7 +2206,7 @@ Function0x34b20: ; 34b20 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 @@ -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 @@ -3064,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 @@ -3080,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 @@ -3118,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 @@ -3233,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 @@ -3316,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 @@ -4271,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 @@ -4304,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 @@ -4383,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] @@ -4411,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] @@ -4447,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 @@ -4743,7 +4744,7 @@ BattleCommand43: ; 359d0 ; snore ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair - and $7 + and SLP ret nz call ResetDamage ld a, $1 @@ -4771,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 @@ -4824,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 @@ -4853,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 @@ -4874,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 @@ -4888,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 @@ -4896,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 @@ -4933,7 +4934,7 @@ BattleCommand46: ; 35a74 add hl, de ld [hl], a .asm_35b04 - call $34f8 + call GetMoveName call Function0x37e01 ld hl, SketchedText @@ -5139,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] @@ -5171,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 @@ -5188,7 +5189,7 @@ BattleCommand4a: ; 35c0f ld [hl], a push af ld a, $17 - call $3951 + call OpponentPartyAttr ld d, b pop af pop bc @@ -7100,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 @@ -7169,7 +7171,7 @@ BattleCommanda0: ; 36778 call Function0x36804 call BattleCommand0a call Function0x37e36 - ld c, $14 + ld c, 20 call DelayFrames call Function0x36804 @@ -7191,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 @@ -7455,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 @@ -7521,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 @@ -8433,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 @@ -8550,7 +8554,7 @@ BattleCommand37: ; 36fed call CleanGetBattleVarPair ld [hl], a ld [$d265], a - call $34f8 + call GetMoveName ld hl, WasDisabledText jp FarBattleTextBox .asm_37059 @@ -8610,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 @@ -9176,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 @@ -9443,7 +9447,7 @@ BattleCommand53: ; 37563 jr z, .asm_3757f ; 37576 $7 .asm_37578 ld a, $20 - call $3945 + call UserPartyAttr res 5, [hl] .asm_3757f call RefreshBattleHuds @@ -9967,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 @@ -10084,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 From 99fb8bcc635599e69429a1545488ef05e3bcc382 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 14:27:24 -0400 Subject: [PATCH 096/112] scripting: ScriptJump --- scripting.asm | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripting.asm b/scripting.asm index f2eb1a891..bd321487d 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 @@ -681,7 +681,7 @@ Script_describedecoration: ; 0x970df rst $8 ld h, d ld l, e - jp $759d + jp ScriptJump ; 0x970ee Script_fruittree: ; 0x970ee @@ -693,7 +693,7 @@ Script_fruittree: ; 0x970ee ld [$d03e], a ld b, $11 ld hl, $4000 - jp $759d + 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 @@ -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 From c539a96f7817fc234d600be2a98c9bc7ac3f3d6a Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 15:40:45 -0400 Subject: [PATCH 097/112] fruit trees --- main.asm | 201 +++++++++++++++++++++++++++++++++++++++++++++++++- scripting.asm | 6 +- wram.asm | 13 +++- 3 files changed, 214 insertions(+), 6 deletions(-) diff --git a/main.asm b/main.asm index 5fdece4fb..51ef6bf71 100644 --- a/main.asm +++ b/main.asm @@ -8149,11 +8149,179 @@ 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 + + +INCBIN "baserom.gbc", $440ce, $44378 - $440ce + PokedexDataPointerTable: ; 0x44378 INCLUDE "stats/pokedex/entry_pointers.asm" + INCBIN "baserom.gbc", $4456e, $44997 - $4456e @@ -18596,7 +18764,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/scripting.asm b/scripting.asm index bd321487d..2875781f0 100644 --- a/scripting.asm +++ b/scripting.asm @@ -690,9 +690,9 @@ Script_fruittree: ; 0x970ee ; tree_id (SingleByteParam) call GetScriptByte - ld [$d03e], a - ld b, $11 - ld hl, $4000 + ld [CurFruitTree], a + ld b, BANK(FruitTreeScript) + ld hl, FruitTreeScript jp ScriptJump ; 0x970fc diff --git a/wram.asm b/wram.asm index 293d8d086..5da646c47 100644 --- a/wram.asm +++ b/wram.asm @@ -896,7 +896,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 @@ -1544,6 +1551,10 @@ Box13Name: ; dbe1 Box14Name: ; dbea ds 9 +SECTION "fruittrees", BSS[$dc27] +FruitTreeFlags: ; dc27 + ds 1 + SECTION "steps", BSS[$dc73] StepCount: ; dc73 ds 1 From 8b1afa22651ebd548295dbe1c363bc8ab3ac5788 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 21:04:34 -0400 Subject: [PATCH 098/112] Fix a wram mislabel (EnemyDisabledMove) --- battle/effect_commands.asm | 10 +++++----- wram.asm | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 78a03a899..39f6b6a6a 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -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 @@ -4990,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 @@ -5059,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 @@ -8983,7 +8983,7 @@ Function0x372e7: ; 372e7 xor a ld [EnemyDisableCount], a - ld [EnemyEncoredMove], a + ld [EnemyDisabledMove], a ret .player diff --git a/wram.asm b/wram.asm index 5da646c47..69e089ef5 100644 --- a/wram.asm +++ b/wram.asm @@ -690,7 +690,7 @@ AlreadyDisobeyed: ; c6f4 DisabledMove: ; c6f5 ds 1 -EnemyEncoredMove: ; c6f6 +EnemyDisabledMove: ; c6f6 ds 1 ds 1 @@ -1082,6 +1082,7 @@ EnemyMonMove3: ; d20a ds 1 EnemyMonMove4: ; d20b ds 1 +EnemyMonMovesEnd EnemyMonDVs: EnemyMonAtkDefDV: ; d20c From 5f832feeb22d08fc1ead2b41f8b03ef51e7f917d Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 4 May 2013 02:11:55 -0400 Subject: [PATCH 099/112] unused move effect constants are apparently used by the ai --- constants.asm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/constants.asm b/constants.asm index 512fb9abc..bb030bcdc 100644 --- a/constants.asm +++ b/constants.asm @@ -3814,13 +3814,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 @@ -3855,7 +3855,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 @@ -3887,7 +3887,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 @@ -3907,8 +3907,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 From f104cf1269afed1cf479e86f134b8f0647115382 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 4 May 2013 02:13:44 -0400 Subject: [PATCH 100/112] flag constants --- constants.asm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/constants.asm b/constants.asm index bb030bcdc..5fc98c585 100644 --- a/constants.asm +++ b/constants.asm @@ -3653,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 From 6b12741537a1423281fa2921655f52fab6df5733 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 4 May 2013 02:14:02 -0400 Subject: [PATCH 101/112] additional trainer class id in wram this one seems more persistent than OtherTrainerID --- wram.asm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wram.asm b/wram.asm index 69e089ef5..ed6f0d87c 100644 --- a/wram.asm +++ b/wram.asm @@ -1183,7 +1183,10 @@ OtherTrainerID: ; d231 ; (Joey, Mikey, Albert, etc.) ds 1 - ds 2 + ds 1 + +TrainerClass: ; d233 + ds 1 UnownLetter: ; d234 ds 1 From ef6e77a5c3cd059fd0c75c8588d1bc2bbf95aa38 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 4 May 2013 02:47:52 -0400 Subject: [PATCH 102/112] AI move scoring --- main.asm | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 211 insertions(+), 1 deletion(-) diff --git a/main.asm b/main.asm index 51ef6bf71..32e65cfdb 100644 --- a/main.asm +++ b/main.asm @@ -8315,7 +8315,217 @@ NothingHereText: ; 440c9 ; 440ce -INCBIN "baserom.gbc", $440ce, $44378 - $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, $e ; bank + 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 $4591 + dw $45e0 + dw $4635 + dw $46a2 + dw $46be + dw $5315 + dw $5369 + dw $5418 + dw $5453 + dw $54a9 + dw $5502 + dw $5502 + dw $5502 + dw $5502 + dw $5502 + dw $5502 +; 441cf + + +INCBIN "baserom.gbc", $441cf, $44378 - $441cf PokedexDataPointerTable: ; 0x44378 From d3ec3bbacab7f87a3fd21c190675c984edbb0e87 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 5 May 2013 18:28:22 -0400 Subject: [PATCH 103/112] ai scoring dump --- main.asm | 807 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 790 insertions(+), 17 deletions(-) diff --git a/main.asm b/main.asm index 32e65cfdb..1d740e1f1 100644 --- a/main.asm +++ b/main.asm @@ -7132,7 +7132,780 @@ INCLUDE "battle/effect_commands.asm" SECTION "bankE",DATA,BANK[$E] -INCBIN "baserom.gbc", $38000, $39999 - $38000 +INCBIN "baserom.gbc", $38000, $38591 - $38000 + + +Function_0x38591: ; 38591 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_38599 + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + 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, .asm_385d6 + + ld a, [EnemyMoveEffect] + push hl + push de + push bc + ld hl, .table_385db + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr nc, .asm_38599 + + ld a, [BattleMonStatus] + and a + jr nz, .asm_385d6 + + ld a, [PlayerScreens] + bit 2, a + jr z, .asm_38599 + +.asm_385d6 + call $5503 + + jr .asm_38599 +; 385db + +.table_385db + db EFFECT_SLEEP + db EFFECT_TOXIC + db EFFECT_POISON + db EFFECT_PARALYZE + db $ff +; 385e0 + + + +Function_0x385e0: ; 385e0 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.next + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + ld a, [EnemyMoveEffect] + + cp EFFECT_ATTACK_UP + jr c, .next + cp EFFECT_EVASION_UP + 1 + jr c, .statup + +; cp EFFECT_ATTACK_DOWN - 1 + jr z, .next + cp EFFECT_EVASION_DOWN + 1 + jr c, .statdown + + cp EFFECT_ATTACK_UP_2 + jr c, .next + cp EFFECT_EVASION_UP_2 + 1 + jr c, .statup + +; cp EFFECT_ATTACK_DOWN_2 - 1 + jr z, .next + cp EFFECT_EVASION_DOWN_2 + 1 + jr c, .statdown + + jr .next + +.statup + ld a, [EnemyTurnsTaken] + and a + jr nz, .asm_3862a + + jr .asm_38621 + +.statdown + ld a, [PlayerTurnsTaken] + and a + jr nz, .asm_3862a + +.asm_38621 + call $5527 + + jr c, .next + + dec [hl] + dec [hl] + jr .next + +.asm_3862a + call RNG + + cp $1e + jr c, .next + + inc [hl] + inc [hl] + jr .next +; 38635 + + + +Function_0x38635: ; 38635 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_3863d + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + push hl + push bc + push de + ld a, 1 + ld [hBattleTurn], a + ld hl, $47c8 + ld a, $d + rst FarCall + + pop de + pop bc + pop hl + ld a, [$d265] + and a + jr z, .asm_3869d + + cp $a + jr z, .asm_3863d + + jr c, .asm_3866c + + ld a, [EnemyMovePower] + and a + jr z, .asm_3863d + + dec [hl] + jr .asm_3863d + +.asm_3866c + push hl + push de + push bc + ld a, [EnemyMoveType] + ld d, a + ld hl, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld c, 0 +.asm_3867a + dec b + jr z, .asm_38693 + + ld a, [hli] + and a + jr z, .asm_38693 + + call $5508 + + ld a, [EnemyMoveType] + cp d + jr z, .asm_3867a + + ld a, [EnemyMovePower] + and a + jr nz, .asm_38692 + + jr .asm_3867a + +.asm_38692 + ld c, a +.asm_38693 + ld a, c + pop bc + pop de + pop hl + and a + jr z, .asm_3863d + + inc [hl] + jr .asm_3863d + +.asm_3869d + call $5503 + + jr .asm_3863d +; 386a2 + + + +Function_0x386a2: ; 386a2 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_386aa + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + ld a, [EnemyMovePower] + and a + jr nz, .asm_386aa + + inc [hl] + inc [hl] + jr .asm_386aa +; 386be + + + +Function_0x386be: ; 386be + ld hl, Buffer1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_386c6 + dec b + ret z + + ld a, [de] + inc de + and a + ret z + + push de + push bc + push hl + call $5508 + + ld a, [EnemyMoveEffect] + ld hl, .table_386f2 + ld de, 3 + call IsInArray + + inc hl + jr nc, .asm_386ec + + ld a, [hli] + ld e, a + ld d, [hl] + pop hl + push hl + ld bc, .asm_386ec + push bc + push de + ret + +.asm_386ec + pop hl + pop bc + pop de + inc hl + jr .asm_386c6 +; 386f2 + +.table_386f2 ; 386f2 + dbw EFFECT_SLEEP, $47e3 + dbw EFFECT_LEECH_HIT, $47f7 + dbw EFFECT_EXPLOSION, $48a6 + dbw EFFECT_DREAM_EATER, $48ca + dbw EFFECT_MIRROR_MOVE, $495b + dbw EFFECT_EVASION_UP, $48d4 + dbw EFFECT_ALWAYS_HIT, $4947 + dbw EFFECT_ACCURACY_DOWN, $4985 + dbw EFFECT_HAZE, $49f5 + dbw EFFECT_BIDE, $4a1e + dbw EFFECT_WHIRLWIND, $4a2a + dbw EFFECT_HEAL, $4a3a + dbw EFFECT_TOXIC, $4a4e + dbw EFFECT_LIGHT_SCREEN, $4a54 + dbw EFFECT_OHKO, $4a60 + dbw EFFECT_RAZOR_WIND, $4a9c + dbw EFFECT_SUPER_FANG, $4b20 + dbw EFFECT_BIND, $4a71 + dbw EFFECT_UNUSED_2B, $4a9c + dbw EFFECT_CONFUSE, $4adb + dbw EFFECT_SP_DEFENSE_UP_2, $4aed + dbw EFFECT_REFLECT, $4a54 + dbw EFFECT_PARALYZE, $4b26 + dbw EFFECT_SPEED_DOWN_HIT, $4b40 + dbw EFFECT_SUBSTITUTE, $4b5c + dbw EFFECT_HYPER_BEAM, $4b63 + dbw EFFECT_RAGE, $4b7f + dbw EFFECT_MIMIC, $4ba8 + dbw EFFECT_LEECH_SEED, $4a4e + dbw EFFECT_DISABLE, $4dd1 + dbw EFFECT_COUNTER, $4bf1 + dbw EFFECT_ENCORE, $4c3b + dbw EFFECT_PAIN_SPLIT, $4ca4 + dbw EFFECT_SNORE, $4cba + dbw EFFECT_CONVERSION2, $4d98 + dbw EFFECT_LOCK_ON, $481d + dbw EFFECT_DEFROST_OPPONENT, $4ccb + dbw EFFECT_SLEEP_TALK, $4cba + dbw EFFECT_DESTINY_BOND, $4d19 + dbw EFFECT_REVERSAL, $4d19 + dbw EFFECT_SPITE, $4cd5 + dbw EFFECT_HEAL_BELL, $4d1f + dbw EFFECT_PRIORITY_HIT, $4d5a + dbw EFFECT_THIEF, $4d93 + dbw EFFECT_MEAN_LOOK, $4dfb + dbw EFFECT_NIGHTMARE, $4e4a + dbw EFFECT_FLAME_WHEEL, $4e50 + dbw EFFECT_CURSE, $4e5c + dbw EFFECT_PROTECT, $4ed2 + dbw EFFECT_FORESIGHT, $4f1d + dbw EFFECT_PERISH_SONG, $4f4a + dbw EFFECT_SANDSTORM, $4f7a + dbw EFFECT_ENDURE, $4fac + dbw EFFECT_ROLLOUT, $4fef + dbw EFFECT_SWAGGER, $5026 + dbw EFFECT_FURY_CUTTER, $4fdb + dbw EFFECT_ATTRACT, $5026 + dbw EFFECT_SAFEGUARD, $503a + dbw EFFECT_MAGNITUDE, $5044 + dbw EFFECT_BATON_PASS, $5062 + dbw EFFECT_PURSUIT, $5072 + dbw EFFECT_RAPID_SPIN, $5084 + dbw EFFECT_MORNING_SUN, $4a3a + dbw EFFECT_SYNTHESIS, $4a3a + dbw EFFECT_MOONLIGHT, $4a3a + dbw EFFECT_HIDDEN_POWER, $509e + dbw EFFECT_RAIN_DANCE, $50cb + dbw EFFECT_SUNNY_DAY, $50f3 + dbw EFFECT_BELLY_DRUM, $513d + dbw EFFECT_PSYCH_UP, $5152 + dbw EFFECT_MIRROR_COAT, $518b + dbw EFFECT_SKULL_BASH, $4d19 + dbw EFFECT_TWISTER, $51d5 + dbw EFFECT_EARTHQUAKE, $5044 + dbw EFFECT_FUTURE_SIGHT, $51f3 + dbw EFFECT_GUST, $51d5 + dbw EFFECT_STOMP, $5200 + dbw EFFECT_SOLARBEAM, $520b + dbw EFFECT_THUNDER, $5225 + dbw EFFECT_FLY, $4b12 + db $ff +; 387e3 + + +INCBIN "baserom.gbc", $387e3, $39315 - $387e3 + + +Function_0x39315: ; 39315 + call $5281 + ret c + + call $5298 + jr nc, .asm_39322 + + call $5527 + ret c + +.asm_39322 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_3932a + 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, .table_39348 + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr nc, .asm_3932a + + inc [hl] + jr .asm_3932a + +.asm_39347 + ret + +.table_39348 + 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 + + + +Function_0x39369: ; 39369 + ld hl, EnemyMonMoves + ld bc, 0 + ld de, 0 +.asm_39372 + inc b + ld a, b + cp EnemyMonMovesEnd - EnemyMonMoves + 1 + jr z, .asm_393a8 + + ld a, [hli] + and a + jr z, .asm_393a8 + + push hl + push de + push bc + call $5508 + + ld a, [EnemyMovePower] + and a + jr z, .asm_393a3 + + call $53e7 + + pop bc + pop de + pop hl + ld a, [CurDamage + 1] + cp e + ld a, [CurDamage] + sbc d + jr c, .asm_39372 + + ld a, [CurDamage + 1] + ld e, a + ld a, [CurDamage] + ld d, a + ld c, b + jr .asm_39372 + +.asm_393a3 + pop bc + pop de + pop hl + jr .asm_39372 + +.asm_393a8 + ld a, c + and a + jr z, .asm_393e1 + + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, $0 +.asm_393b4 + inc b + ld a, b + cp EnemyMonMovesEnd - EnemyMonMoves + 1 + jr z, .asm_393e1 + + cp c + ld a, [de] + inc de + inc hl + jr z, .asm_393b4 + + call $5508 + + ld a, [EnemyMovePower] + cp $2 + jr c, .asm_393b4 + + push hl + push de + push bc + ld a, [EnemyMoveEffect] + ld hl, $53e2 + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr c, .asm_393b4 + + inc [hl] + jr .asm_393b4 + +.asm_393e1 + ret + +; 393e2 + + +INCBIN "baserom.gbc", $393e2, $39418 - $393e2 + + +Function_0x39418: ; 39418 + 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, .table_39446 + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr nc, .asm_39425 + + call RNG + cp $e6 + ret nc + + inc [hl] + jr .asm_39425 + +.table_39446 + 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 + + + +Function_0x39453: ; 39453 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_3945b + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + ld a, [EnemyMoveEffect] + cp EFFECT_TOXIC + jr z, .asm_39480 + cp EFFECT_POISON + jr z, .asm_39480 + cp EFFECT_SLEEP + jr z, .asm_3948e + cp EFFECT_PARALYZE + jr z, .asm_3948e + + ld a, [EnemyMovePower] + and a + jr z, .asm_3945b + + jr .asm_3948e + +.asm_39480 + ld a, [BattleMonType1] + cp POISON + jr z, .asm_394a4 + ld a, [BattleMonType2] + cp POISON + jr z, .asm_394a4 + +.asm_3948e + push hl + push bc + push de + + ld a, 1 + ld [hBattleTurn], a + + ld hl, $47c8 + ld a, $d + rst FarCall + + pop de + pop bc + pop hl + + ld a, [$d265] + and a + jr nz, .asm_3945b + +.asm_394a4 + call $5503 + jr .asm_3945b +; 394a9 + + + +Function_0x394a9: ; 394a9 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_394b1 + inc hl + dec c + ret z + + ld a, [de] + inc de + and a + ret z + + push de + push bc + push hl + call $5508 + + ld a, [EnemyMovePower] + and a + jr z, .asm_394fa + + ld a, [EnemyMoveEffect] + ld de, 1 + ld hl, .table_394ff + call IsInArray + jr nc, .asm_394de + + call $5251 + jr c, .asm_394fa + + call RNG + cp $c8 + jr c, .asm_394fa + +.asm_394de + call $53e7 + + 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, .asm_394fa + + pop hl + dec [hl] + dec [hl] + dec [hl] + dec [hl] + dec [hl] + push hl +.asm_394fa + pop hl + pop bc + pop de + jr .asm_394b1 + +.table_394ff + db EFFECT_EXPLOSION + db EFFECT_OHKO + db $ff +; 39502 + + + +Function_0x39502: ; 39502 + ret +; 39503 + + +INCBIN "baserom.gbc", $39503, $39999 - $39503 + TrainerGroups: ; 0x39999 INCLUDE "trainers/trainer_pointers.asm" @@ -8506,22 +9279,22 @@ AIChooseMove: ; 440ce AIScoringPointers: ; 441af - dw $4591 - dw $45e0 - dw $4635 - dw $46a2 - dw $46be - dw $5315 - dw $5369 - dw $5418 - dw $5453 - dw $54a9 - dw $5502 - dw $5502 - dw $5502 - dw $5502 - dw $5502 - dw $5502 + dw Function_0x38591 + dw Function_0x385e0 + dw Function_0x38635 + dw Function_0x386a2 + dw Function_0x386be + dw Function_0x39315 + dw Function_0x39369 + dw Function_0x39418 + dw Function_0x39453 + dw Function_0x394a9 + dw Function_0x39502 + dw Function_0x39502 + dw Function_0x39502 + dw Function_0x39502 + dw Function_0x39502 + dw Function_0x39502 ; 441cf From c82216441a68d5598a213a27ed63ee12866057b4 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 5 May 2013 19:52:07 -0400 Subject: [PATCH 104/112] ai scoring part 2 --- main.asm | 2527 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 2446 insertions(+), 81 deletions(-) diff --git a/main.asm b/main.asm index 1d740e1f1..51c98f510 100644 --- a/main.asm +++ b/main.asm @@ -7442,91 +7442,2456 @@ Function_0x386be: ; 386be ; 386f2 .table_386f2 ; 386f2 - dbw EFFECT_SLEEP, $47e3 - dbw EFFECT_LEECH_HIT, $47f7 - dbw EFFECT_EXPLOSION, $48a6 - dbw EFFECT_DREAM_EATER, $48ca - dbw EFFECT_MIRROR_MOVE, $495b - dbw EFFECT_EVASION_UP, $48d4 - dbw EFFECT_ALWAYS_HIT, $4947 - dbw EFFECT_ACCURACY_DOWN, $4985 - dbw EFFECT_HAZE, $49f5 - dbw EFFECT_BIDE, $4a1e - dbw EFFECT_WHIRLWIND, $4a2a - dbw EFFECT_HEAL, $4a3a - dbw EFFECT_TOXIC, $4a4e - dbw EFFECT_LIGHT_SCREEN, $4a54 - dbw EFFECT_OHKO, $4a60 - dbw EFFECT_RAZOR_WIND, $4a9c - dbw EFFECT_SUPER_FANG, $4b20 - dbw EFFECT_BIND, $4a71 - dbw EFFECT_UNUSED_2B, $4a9c - dbw EFFECT_CONFUSE, $4adb - dbw EFFECT_SP_DEFENSE_UP_2, $4aed - dbw EFFECT_REFLECT, $4a54 - dbw EFFECT_PARALYZE, $4b26 - dbw EFFECT_SPEED_DOWN_HIT, $4b40 - dbw EFFECT_SUBSTITUTE, $4b5c - dbw EFFECT_HYPER_BEAM, $4b63 - dbw EFFECT_RAGE, $4b7f - dbw EFFECT_MIMIC, $4ba8 - dbw EFFECT_LEECH_SEED, $4a4e - dbw EFFECT_DISABLE, $4dd1 - dbw EFFECT_COUNTER, $4bf1 - dbw EFFECT_ENCORE, $4c3b - dbw EFFECT_PAIN_SPLIT, $4ca4 - dbw EFFECT_SNORE, $4cba - dbw EFFECT_CONVERSION2, $4d98 - dbw EFFECT_LOCK_ON, $481d - dbw EFFECT_DEFROST_OPPONENT, $4ccb - dbw EFFECT_SLEEP_TALK, $4cba - dbw EFFECT_DESTINY_BOND, $4d19 - dbw EFFECT_REVERSAL, $4d19 - dbw EFFECT_SPITE, $4cd5 - dbw EFFECT_HEAL_BELL, $4d1f - dbw EFFECT_PRIORITY_HIT, $4d5a - dbw EFFECT_THIEF, $4d93 - dbw EFFECT_MEAN_LOOK, $4dfb - dbw EFFECT_NIGHTMARE, $4e4a - dbw EFFECT_FLAME_WHEEL, $4e50 - dbw EFFECT_CURSE, $4e5c - dbw EFFECT_PROTECT, $4ed2 - dbw EFFECT_FORESIGHT, $4f1d - dbw EFFECT_PERISH_SONG, $4f4a - dbw EFFECT_SANDSTORM, $4f7a - dbw EFFECT_ENDURE, $4fac - dbw EFFECT_ROLLOUT, $4fef - dbw EFFECT_SWAGGER, $5026 - dbw EFFECT_FURY_CUTTER, $4fdb - dbw EFFECT_ATTRACT, $5026 - dbw EFFECT_SAFEGUARD, $503a - dbw EFFECT_MAGNITUDE, $5044 - dbw EFFECT_BATON_PASS, $5062 - dbw EFFECT_PURSUIT, $5072 - dbw EFFECT_RAPID_SPIN, $5084 - dbw EFFECT_MORNING_SUN, $4a3a - dbw EFFECT_SYNTHESIS, $4a3a - dbw EFFECT_MOONLIGHT, $4a3a - dbw EFFECT_HIDDEN_POWER, $509e - dbw EFFECT_RAIN_DANCE, $50cb - dbw EFFECT_SUNNY_DAY, $50f3 - dbw EFFECT_BELLY_DRUM, $513d - dbw EFFECT_PSYCH_UP, $5152 - dbw EFFECT_MIRROR_COAT, $518b - dbw EFFECT_SKULL_BASH, $4d19 - dbw EFFECT_TWISTER, $51d5 - dbw EFFECT_EARTHQUAKE, $5044 - dbw EFFECT_FUTURE_SIGHT, $51f3 - dbw EFFECT_GUST, $51d5 - dbw EFFECT_STOMP, $5200 - dbw EFFECT_SOLARBEAM, $520b - dbw EFFECT_THUNDER, $5225 - dbw EFFECT_FLY, $4b12 + 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 -INCBIN "baserom.gbc", $387e3, $39315 - $387e3 +AIScoring_Sleep: ; 387e3 + ld b, $8 + call $52ca + + jr c, .asm_387f0 + + ld b, $6b + call $52ca + + ret nc + +.asm_387f0 + call $5527 + + ret c + dec [hl] + dec [hl] + ret +; 387f7 + + +AIScoring_LeechHit: ; 387f7 + push hl + ld a, $1 + ld [hBattleTurn], a + ld hl, $47c8 + ld a, $d + rst FarCall + + pop hl + ld a, [$d265] + cp $a + jr c, .asm_38815 + + ret z + call $5251 + + ret c + call $5521 + + 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 $5298 + + jr nc, .asm_38877 + + call $5281 + + jr c, .asm_38834 + + call $5233 + + 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, EnemyMonMove1 + ld c, $5 + +.asm_3884f + dec c + jr z, .asm_38877 + + ld a, [hli] + and a + jr z, .asm_38877 + + call $5508 + + 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 $5527 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38882 + push hl + ld hl, $d1e9 + ld de, EnemyMonMove1 + ld c, $5 + +.asm_3888b + inc hl + dec c + jr z, .asm_388a2 + + ld a, [de] + and a + jr z, .asm_388a2 + + inc de + call $5508 + + ld a, [EnemyMoveAccuracy] + cp $b4 + jr nc, .asm_3888b + + dec [hl] + dec [hl] + jr .asm_3888b + + +.asm_388a2 + pop hl + jp $5503 + +; 388a6 + + +AIScoring_Explosion: ; 388a6 + push hl + ld a, $d + ld hl, $49f4 + rst FarCall + + pop hl + jr nc, .asm_388b7 + + push hl + call $4e2e + + pop hl + jr nz, .asm_388c6 + + +.asm_388b7 + call $5281 + + jr c, .asm_388c6 + + call $5298 + + ret nc + call RNG + + cp $14 + 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, $5503 + + call $5251 + + 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 $5298 + + jr nc, .asm_3890f + + call RNG + + cp $a + jr c, .asm_388ef + + call $5281 + + jr nc, .asm_3890a + + call $5521 + + jr c, .asm_388ef + + jr .asm_38911 + + +.asm_3890a + call $5527 + + 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 $5527 + + 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 $5521 + + ret c + dec [hl] + dec [hl] + ret +; 3895b + + +AIScoring_MirrorMove: ; 3895b + ld a, [LastEnemyCounterMove] + and a + jr nz, .asm_38968 + + call $5233 + + ret nc + jp $5503 + + +.asm_38968 + push hl + ld hl, $5301 + ld de, $0001 + call IsInArray + + pop hl + ret nc + call $5527 + + ret c + dec [hl] + call $5233 + + ret nc + call RNG + + cp $19 + ret c + dec [hl] + ret +; 38985 + + +AIScoring_AccuracyDown: ; 38985 + call $5246 + + jr nc, .asm_389a0 + + call $5281 + + 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 $52b3 + + jr nc, .asm_389bd + + call RNG + + cp $a + jr c, .asm_3899d + + call $526e + + jr nc, .asm_389b8 + + call $5521 + + jr c, .asm_3899d + + jr .asm_389bf + + +.asm_389b8 + call $5527 + + 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 $5527 + + 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 $5251 + + ret c + call RNG + + cp $19 + ret c + inc [hl] + ret +; 38a2a + + +AIScoring_Whirlwind: ; 38a2a + push hl + ld hl, $484e + ld a, $d + rst FarCall + + ld a, [$c716] + cp $a + pop hl + ret c + inc [hl] + ret +; 38a3a + + +AIScoring_Heal: +AIScoring_MorningSun: +AIScoring_Synthesis: +AIScoring_Moonlight: ; 38a3a + call $5298 + + jr nc, .asm_38a45 + + call $5281 + + 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 $526e + + ret c + inc [hl] + ret +; 38a54 + + +AIScoring_LightScreen: +AIScoring_Reflect: ; 38a54 + call $5251 + + 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, $5503 + + call $526e + + ret c + inc [hl] + ret +; 38a71 + + +AIScoring_Bind: ; 38a71 + ld a, [$c730] + and a + jr nz, .asm_38a8b + + ld a, [PlayerSubStatus5] + bit 0, a + jr nz, .asm_38a91 + + ld a, [PlayerSubStatus1] + and $c9 + jr nz, .asm_38a91 + + ld a, [PlayerTurnsTaken] + and a + jr z, .asm_38a91 + + +.asm_38a8b + call $5527 + + ret c + inc [hl] + ret + +.asm_38a91 + call $5298 + + ret nc + call $5527 + + ret c + dec [hl] + dec [hl] + ret +; 38a9c + + +AIScoring_RazorWind: +AIScoring_Unused2B: ; 38a9c + ld a, [EnemySubStatus1] + bit 4, 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 $5508 + + ld a, [EnemyMoveEffect] + cp $6f + jr z, .asm_38ad5 + + dec c + jr nz, .asm_38ab0 + + +.asm_38ac1 + pop hl + ld a, [EnemySubStatus3] + bit 7, a + jr nz, .asm_38acd + + call $5281 + + 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 $526e + + ret c + call RNG + + cp $19 + jr c, .asm_38ae7 + + inc [hl] + +.asm_38ae7 + call $52b3 + + ret c + inc [hl] + ret +; 38aed + + +AIScoring_SpDefenseUp2: ; 38aed + call $5281 + + jr nc, .asm_38b10 + + ld a, [EnemySDefLevel] + cp $b + jr nc, .asm_38b10 + + cp $9 + ret nc + ld a, [BattleMonType1] + cp $14 + jr nc, .asm_38b09 + + ld a, [BattleMonType2] + cp $14 + ret c + +.asm_38b09 + call $5521 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38b10 + inc [hl] + ret +; 38b12 + + +AIScoring_Fly: ; 38b12 + ld a, [PlayerSubStatus3] + and $60 + ret z + call $5233 + + ret nc + dec [hl] + dec [hl] + dec [hl] + ret +; 38b20 + + +AIScoring_SuperFang: ; 38b20 + call $52b3 + + ret c + inc [hl] + ret +; 38b26 + + +AIScoring_Paralyze: ; 38b26 + call $52b3 + + jr nc, .asm_38b3a + + call $5233 + + ret c + call $5298 + + ret nc + call $5521 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38b3a + call $5527 + + ret c + inc [hl] + ret +; 38b40 + + +AIScoring_SpeedDownHit: ; 38b40 + ld a, [EnemyMoveAnimation] + cp $c4 + ret nz + call $5298 + + ret nc + ld a, [PlayerTurnsTaken] + and a + ret nz + call $5233 + + ret c + call RNG + + cp $1e + ret c + dec [hl] + dec [hl] + ret +; 38b5c + + +AIScoring_Substitute: ; 38b5c + call $5281 + + ret c + jp $5503 + +; 38b63 + + +AIScoring_HyperBeam: ; 38b63 + call $5281 + + jr c, .asm_38b72 + + call $5298 + + ret c + call $5527 + + ret c + dec [hl] + ret + +.asm_38b72 + call RNG + + cp $28 + ret c + inc [hl] + call $5527 + + ret c + inc [hl] + ret +; 38b7f + + +AIScoring_Rage: ; 38b7f + ld a, [EnemySubStatus4] + bit 6, a + jr z, .asm_38b9b + + call $5527 + + 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 $5281 + + jr nc, .asm_38ba6 + + call $5521 + + ret nc + dec [hl] + ret + +.asm_38ba6 + inc [hl] + ret +; 38ba8 + + +AIScoring_Mimic: ; 38ba8 + ld a, [LastEnemyCounterMove] + and a + jr z, .asm_38be9 + + call $5281 + + jr nc, .asm_38bef + + push hl + ld a, [LastEnemyCounterMove] + call $5508 + + 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 $5527 + + jr c, .asm_38bd4 + + dec [hl] + +.asm_38bd4 + ld a, [LastEnemyCounterMove] + push hl + ld hl, $5301 + ld de, $0001 + call IsInArray + + pop hl + ret nc + call $5527 + + ret c + dec [hl] + ret + +.asm_38be9 + call $5233 + + jp c, $5503 + + +.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 $5508 + + 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 $5508 + + 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 $5233 + + jr nc, .asm_38c81 + + ld a, [LastPlayerMove] + and a + jp z, $5503 + + call $5508 + + 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, $4c85 + ld de, $0001 + 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 +; 38c85 + + + +INCBIN "baserom.gbc", $38c85, $38ca4 - $38c85 + + + +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 $5233 + + jp c, $5503 + + call $5527 + + ret c + inc [hl] + ret + +.asm_38ce7 + push hl + ld b, a + ld c, $4 + ld hl, BattleMonMove1 + ld de, BattleMonPPMove1 + +.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 + + + +INCBIN "baserom.gbc", $38d16, $38d19 - $38d16 + + + +AIScoring_DestinyBond: +AIScoring_Reversal: +AIScoring_SkullBash: ; 38d19 + call $5298 + + 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 $5527 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38d52 + ld a, [EnemyMonStatus] + and a + ret nz + jp $5503 + +; 38d5a + + +AIScoring_PriorityHit: ; 38d5a + call $5233 + + ret c + ld a, [PlayerSubStatus3] + and $60 + jp nz, $5503 + + 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, $5afe + ld bc, $0007 + call AddNTimes + + ld a, $10 + 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 $5527 + + ret c + dec [hl] + ret + +.asm_38dc9 + call RNG + + cp $19 + ret c + inc [hl] + ret +; 38dd1 + + +AIScoring_Disable: ; 38dd1 + call $5233 + + jr nc, .asm_38df3 + + push hl + ld a, [LastEnemyCounterMove] + ld hl, $5301 + ld de, $0001 + call IsInArray + + pop hl + jr nc, .asm_38dee + + call RNG + + cp $64 + ret c + dec [hl] + ret + +.asm_38dee + ld a, [EnemyMovePower] + and a + ret nz + +.asm_38df3 + call RNG + + cp $14 + ret c + inc [hl] + ret +; 38dfb + + +AIScoring_MeanLook: ; 38dfb + call $5281 + + jr nc, .asm_38e24 + + push hl + call $4e2e + + pop hl + jp z, $5503 + + ld a, [EnemySubStatus5] + bit 0, a + jr nz, .asm_38e26 + + ld a, [PlayerSubStatus1] + and $c9 + jr nz, .asm_38e26 + + push hl + ld hl, $484e + ld a, $d + rst FarCall + + ld a, [$c716] + cp $b + pop hl + ret nc + +.asm_38e24 + inc [hl] + ret + +.asm_38e26 + call $5521 + + ret c + dec [hl] + dec [hl] + dec [hl] + ret +; 38e2e + + + +INCBIN "baserom.gbc", $38e2e, $38e4a - $38e2e + + + +AIScoring_Nightmare: ; 38e4a + call $5527 + + ret c + dec [hl] + ret +; 38e50 + + +AIScoring_FlameWheel: ; 38e50 + ld a, [EnemyMonStatus] + bit 5, a + ret z + dec [hl] + dec [hl] + dec [hl] + dec [hl] + dec [hl] + ret +; 38e5c + + +AIScoring_Curse: ; 38e5c + ld a, [EnemyMonType1] + cp $8 + jr z, .asm_38e95 + + ld a, [EnemyMonType2] + cp $8 + jr z, .asm_38e95 + + call $5281 + + jr nc, .asm_38e93 + + ld a, [EnemyAtkLevel] + cp $b + jr nc, .asm_38e93 + + cp $9 + ret nc + ld a, [BattleMonType1] + cp $8 + jr z, .asm_38e92 + + cp $14 + ret nc + ld a, [BattleMonType2] + cp $14 + ret nc + call $5521 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38e90 + inc [hl] + inc [hl] + +.asm_38e92 + inc [hl] + +.asm_38e93 + inc [hl] + ret + +.asm_38e95 + ld a, [PlayerSubStatus1] + bit 1, a + jp nz, $5503 + + push hl + ld a, $d + ld hl, $49f4 + rst FarCall + + pop hl + jr nc, .asm_38eb0 + + push hl + call $4e2e + + pop hl + jr nz, .asm_38e90 + + jr .asm_38eb7 + + +.asm_38eb0 + push hl + call $4e2e + + pop hl + jr z, .asm_38ecb + + +.asm_38eb7 + call $5298 + + jp nc, $4e90 + + call $5281 + + jr nc, .asm_38e92 + + call $5251 + + ret nc + ld a, [PlayerTurnsTaken] + and a + ret nz + +.asm_38ecb + call $5527 + + ret c + dec [hl] + dec [hl] + ret +; 38ed2 + + +AIScoring_Protect: ; 38ed2 + ld a, [$c681] + and a + jr nz, .asm_38f13 + + ld a, [PlayerSubStatus5] + bit 5, a + jr nz, .asm_38f14 + + ld a, [PlayerFuryCutterCount] + cp $3 + jr nc, .asm_38f0d + + ld a, [PlayerSubStatus3] + bit 4, a + jr nz, .asm_38f0d + + ld a, [PlayerSubStatus5] + bit 0, a + jr nz, .asm_38f0d + + ld a, [PlayerSubStatus4] + bit 7, a + jr nz, .asm_38f0d + + ld a, [PlayerSubStatus1] + bit 1, a + jr nz, .asm_38f0d + + bit 6, a + jr z, .asm_38f14 + + ld a, [PlayerRolloutCount] + cp $3 + jr c, .asm_38f14 + + +.asm_38f0d + call $5521 + + ret c + dec [hl] + ret + +.asm_38f13 + inc [hl] + +.asm_38f14 + call RNG + + cp $14 + 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 $8 + jr z, .asm_38f41 + + ld a, [BattleMonType2] + cp $8 + jr z, .asm_38f41 + + call RNG + + cp $14 + ret c + inc [hl] + ret + +.asm_38f41 + call RNG + + cp $64 + ret c + dec [hl] + dec [hl] + ret +; 38f4a + + +AIScoring_PerishSong: ; 38f4a + push hl + ld hl, $49f4 + ld a, $d + rst FarCall + + pop hl + jr c, .asm_38f75 + + ld a, [PlayerSubStatus5] + bit 7, a + jr nz, .asm_38f6f + + push hl + ld hl, $484e + ld a, $d + rst FarCall + + ld a, [$c716] + cp $a + pop hl + ret c + call $5527 + + ret c + inc [hl] + ret + +.asm_38f6f + call $5527 + + 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, $4fa8 + ld de, $0001 + call IsInArray + + pop hl + jr c, .asm_38fa5 + + ld a, [BattleMonType2] + push hl + ld hl, $4fa8 + ld de, $0001 + call IsInArray + + pop hl + jr c, .asm_38fa5 + + call $526e + + jr nc, .asm_38fa6 + + call $5527 + + ret c + dec [hl] + ret + +.asm_38fa5 + inc [hl] + +.asm_38fa6 + inc [hl] + ret +; 38fa8 + + + +INCBIN "baserom.gbc", $38fa8, $38fac - $38fa8 + + + +AIScoring_Endure: ; 38fac + ld a, [$c681] + and a + jr nz, .asm_38fd8 + + call $5251 + + jr c, .asm_38fd8 + + call $5298 + + jr c, .asm_38fd9 + + ld b, $63 + call $52ca + + jr nc, .asm_38fcb + + call $5521 + + ret c + dec [hl] + dec [hl] + dec [hl] + ret + +.asm_38fcb + ld a, [EnemySubStatus5] + bit 5, a + ret z + call $5527 + + 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, AIScoring_Rollout + + dec [hl] + cp $2 + jr c, AIScoring_Rollout + + dec [hl] + dec [hl] + cp $3 + jr c, AIScoring_Rollout + + dec [hl] + dec [hl] + dec [hl] + + ; fallthrough +; 38fef + + +AIScoring_Rollout: ; 38fef + ld a, [EnemySubStatus1] + bit 7, a + jr nz, .asm_39020 + + ld a, [EnemySubStatus3] + bit 7, a + jr nz, .asm_39020 + + ld a, [EnemyMonStatus] + bit 6, a + jr nz, .asm_39020 + + call $5298 + + 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 $c8 + ret nc + dec [hl] + dec [hl] + ret + +.asm_39020 + call $5521 + + ret c + inc [hl] + ret +; 39026 + + +AIScoring_Swagger: +AIScoring_Attract: ; 39026 + ld a, [PlayerTurnsTaken] + and a + jr z, .asm_39032 + + call $5521 + + ret c + inc [hl] + ret + +.asm_39032 + call RNG + + cp $c8 + ret nc + dec [hl] + ret +; 3903a + + +AIScoring_Safeguard: ; 3903a + call $526e + + ret c + call $5521 + + ret c + inc [hl] + ret +; 39044 + + +AIScoring_Magnitude: +AIScoring_Earthquake: ; 39044 + ld a, [LastEnemyCounterMove] + cp $5b + ret nz + ld a, [PlayerSubStatus3] + bit 5, a + jr z, .asm_39058 + + call $5233 + + ret nc + dec [hl] + dec [hl] + ret + +.asm_39058 + call $5233 + + ret c + call $5527 + + ret c + dec [hl] + ret +; 39062 + + +AIScoring_BatonPass: ; 39062 + push hl + ld hl, $484e + ld a, $d + rst FarCall + + ld a, [$c716] + cp $a + pop hl + ret c + inc [hl] + ret +; 39072 + + +AIScoring_Pursuit: ; 39072 + call $52b3 + + jr nc, .asm_3907d + + call $5521 + + ret c + inc [hl] + ret + +.asm_3907d + call $5527 + + ret c + dec [hl] + dec [hl] + ret +; 39084 + + +AIScoring_RapidSpin: ; 39084 + ld a, [$c731] + and a + jr nz, .asm_39097 + + ld a, [EnemySubStatus4] + bit 7, a + jr nz, .asm_39097 + + ld a, [EnemyScreens] + bit 0, a + ret z + +.asm_39097 + call $5521 + + 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 + + ld hl, $47c8 + ld a, $d + rst FarCall + + 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 $15 + jr z, Function_0x3911e + + cp $14 + jr z, Function_0x39122 + + ld a, [BattleMonType2] + cp $15 + jr z, Function_0x3911e + + cp $14 + jr z, Function_0x39122 + + push hl + ld hl, $50e7 + jr Function_0x3910d +; 390e7 + + + +INCBIN "baserom.gbc", $390e7, $390f3 - $390e7 + + + +AIScoring_SunnyDay: ; 390f3 + ld a, [BattleMonType1] + cp $14 + jr z, Function_0x3911e + + cp $15 + jr z, Function_0x39122 + + ld a, [BattleMonType2] + cp $14 + jr z, Function_0x3911e + + cp $15 + jr z, Function_0x39122 + + push hl + ld hl, $5134 + + ; fallthrough +; 3910d + + +Function_0x3910d: ; 3910d + call $52e6 + + pop hl + jr nc, Function_0x3911e + + call $526e + + jr nc, Function_0x3911e + + call $5527 + + ret c + dec [hl] + ret + +Function_0x3911e: ; 3911e + inc [hl] + inc [hl] + inc [hl] + ret + +Function_0x39122: ; 39122 + call $526e + + ret nc + ld a, [PlayerTurnsTaken] + and a + jr z, .asm_39131 + + ld a, [EnemyTurnsTaken] + and a + ret nz + +.asm_39131 + dec [hl] + dec [hl] + ret +; 39134 + + + +INCBIN "baserom.gbc", $39134, $3913d - $39134 + + + +AIScoring_BellyDrum: ; 3913d + ld a, [EnemyAtkLevel] + cp $a + jr nc, .asm_3914d + + call $5251 + + ret c + inc [hl] + call $5281 + + 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 $5521 + + 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 $5508 + + ld a, [EnemyMovePower] + and a + jr z, .asm_391a8 + + ld a, [EnemyMoveType] + cp $14 + 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 $5508 + + ld a, [EnemyMovePower] + and a + jr z, .asm_391d2 + + ld a, [EnemyMoveType] + cp $14 + jr c, .asm_391d2 + + +.asm_391ca + call RNG + + cp $64 + jr c, .asm_391d2 + + dec [hl] + +.asm_391d2 + ret + +.asm_391d3 + inc [hl] + ret +; 391d5 + + +AIScoring_Twister: +AIScoring_Gust: ; 391d5 + ld a, [LastEnemyCounterMove] + cp $13 + ret nz + ld a, [PlayerSubStatus3] + bit 6, a + jr z, .asm_391e9 + + call $5233 + + ret nc + dec [hl] + dec [hl] + ret + +.asm_391e9 + call $5233 + + ret c + call $5527 + + ret c + dec [hl] + ret +; 391f3 + + +AIScoring_FutureSight: ; 391f3 + call $5233 + + ret nc + ld a, [PlayerSubStatus3] + and $60 + ret z + dec [hl] + dec [hl] + ret +; 39200 + + +AIScoring_Stomp: ; 39200 + ld a, [$c6fe] + and a + ret z + call $5521 + + ret c + dec [hl] + ret +; 3920b + + +AIScoring_Solarbeam: ; 3920b + ld a, [Weather] + cp $2 + jr z, .asm_3921e + + cp $1 + ret nz + call RNG + + cp $19 + ret c + inc [hl] + inc [hl] + ret + +.asm_3921e + call $5521 + + ret c + dec [hl] + dec [hl] + ret +; 39225 + + +AIScoring_Thunder: ; 39225 + ld a, [Weather] + cp $2 + ret nz + call RNG + + cp $19 + ret c + inc [hl] + ret +; 39233 + + + +INCBIN "baserom.gbc", $39233, $39315 - $39233 + Function_0x39315: ; 39315 From 3beab7dd925fc9a25670acde6076cd146a3f9a2c Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 5 May 2013 19:56:17 -0400 Subject: [PATCH 105/112] move ai scoring out of main.asm --- battle/ai/scoring.asm | 3136 ++++++++++++++++++++++++++++++++++++++++ main.asm | 3139 +---------------------------------------- 2 files changed, 3139 insertions(+), 3136 deletions(-) create mode 100644 battle/ai/scoring.asm diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm new file mode 100644 index 000000000..e020c5b28 --- /dev/null +++ b/battle/ai/scoring.asm @@ -0,0 +1,3136 @@ +Function_0x38591: ; 38591 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_38599 + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + 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, .asm_385d6 + + ld a, [EnemyMoveEffect] + push hl + push de + push bc + ld hl, .table_385db + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr nc, .asm_38599 + + ld a, [BattleMonStatus] + and a + jr nz, .asm_385d6 + + ld a, [PlayerScreens] + bit 2, a + jr z, .asm_38599 + +.asm_385d6 + call $5503 + + jr .asm_38599 +; 385db + +.table_385db + db EFFECT_SLEEP + db EFFECT_TOXIC + db EFFECT_POISON + db EFFECT_PARALYZE + db $ff +; 385e0 + + + +Function_0x385e0: ; 385e0 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.next + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + ld a, [EnemyMoveEffect] + + cp EFFECT_ATTACK_UP + jr c, .next + cp EFFECT_EVASION_UP + 1 + jr c, .statup + +; cp EFFECT_ATTACK_DOWN - 1 + jr z, .next + cp EFFECT_EVASION_DOWN + 1 + jr c, .statdown + + cp EFFECT_ATTACK_UP_2 + jr c, .next + cp EFFECT_EVASION_UP_2 + 1 + jr c, .statup + +; cp EFFECT_ATTACK_DOWN_2 - 1 + jr z, .next + cp EFFECT_EVASION_DOWN_2 + 1 + jr c, .statdown + + jr .next + +.statup + ld a, [EnemyTurnsTaken] + and a + jr nz, .asm_3862a + + jr .asm_38621 + +.statdown + ld a, [PlayerTurnsTaken] + and a + jr nz, .asm_3862a + +.asm_38621 + call $5527 + + jr c, .next + + dec [hl] + dec [hl] + jr .next + +.asm_3862a + call RNG + + cp $1e + jr c, .next + + inc [hl] + inc [hl] + jr .next +; 38635 + + + +Function_0x38635: ; 38635 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_3863d + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + push hl + push bc + push de + ld a, 1 + ld [hBattleTurn], a + ld hl, $47c8 + ld a, $d + rst FarCall + + pop de + pop bc + pop hl + ld a, [$d265] + and a + jr z, .asm_3869d + + cp $a + jr z, .asm_3863d + + jr c, .asm_3866c + + ld a, [EnemyMovePower] + and a + jr z, .asm_3863d + + dec [hl] + jr .asm_3863d + +.asm_3866c + push hl + push de + push bc + ld a, [EnemyMoveType] + ld d, a + ld hl, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld c, 0 +.asm_3867a + dec b + jr z, .asm_38693 + + ld a, [hli] + and a + jr z, .asm_38693 + + call $5508 + + ld a, [EnemyMoveType] + cp d + jr z, .asm_3867a + + ld a, [EnemyMovePower] + and a + jr nz, .asm_38692 + + jr .asm_3867a + +.asm_38692 + ld c, a +.asm_38693 + ld a, c + pop bc + pop de + pop hl + and a + jr z, .asm_3863d + + inc [hl] + jr .asm_3863d + +.asm_3869d + call $5503 + + jr .asm_3863d +; 386a2 + + + +Function_0x386a2: ; 386a2 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_386aa + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + ld a, [EnemyMovePower] + and a + jr nz, .asm_386aa + + inc [hl] + inc [hl] + jr .asm_386aa +; 386be + + + +Function_0x386be: ; 386be + ld hl, Buffer1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_386c6 + dec b + ret z + + ld a, [de] + inc de + and a + ret z + + push de + push bc + push hl + call $5508 + + ld a, [EnemyMoveEffect] + ld hl, .table_386f2 + ld de, 3 + call IsInArray + + inc hl + jr nc, .asm_386ec + + ld a, [hli] + ld e, a + ld d, [hl] + pop hl + push hl + ld bc, .asm_386ec + push bc + push de + ret + +.asm_386ec + pop hl + pop bc + pop de + inc hl + jr .asm_386c6 +; 386f2 + +.table_386f2 ; 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, $8 + call $52ca + + jr c, .asm_387f0 + + ld b, $6b + call $52ca + + ret nc + +.asm_387f0 + call $5527 + + ret c + dec [hl] + dec [hl] + ret +; 387f7 + + +AIScoring_LeechHit: ; 387f7 + push hl + ld a, $1 + ld [hBattleTurn], a + ld hl, $47c8 + ld a, $d + rst FarCall + + pop hl + ld a, [$d265] + cp $a + jr c, .asm_38815 + + ret z + call $5251 + + ret c + call $5521 + + 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 $5298 + + jr nc, .asm_38877 + + call $5281 + + jr c, .asm_38834 + + call $5233 + + 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, EnemyMonMove1 + ld c, $5 + +.asm_3884f + dec c + jr z, .asm_38877 + + ld a, [hli] + and a + jr z, .asm_38877 + + call $5508 + + 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 $5527 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38882 + push hl + ld hl, $d1e9 + ld de, EnemyMonMove1 + ld c, $5 + +.asm_3888b + inc hl + dec c + jr z, .asm_388a2 + + ld a, [de] + and a + jr z, .asm_388a2 + + inc de + call $5508 + + ld a, [EnemyMoveAccuracy] + cp $b4 + jr nc, .asm_3888b + + dec [hl] + dec [hl] + jr .asm_3888b + + +.asm_388a2 + pop hl + jp $5503 + +; 388a6 + + +AIScoring_Explosion: ; 388a6 + push hl + ld a, $d + ld hl, $49f4 + rst FarCall + + pop hl + jr nc, .asm_388b7 + + push hl + call $4e2e + + pop hl + jr nz, .asm_388c6 + + +.asm_388b7 + call $5281 + + jr c, .asm_388c6 + + call $5298 + + ret nc + call RNG + + cp $14 + 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, $5503 + + call $5251 + + 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 $5298 + + jr nc, .asm_3890f + + call RNG + + cp $a + jr c, .asm_388ef + + call $5281 + + jr nc, .asm_3890a + + call $5521 + + jr c, .asm_388ef + + jr .asm_38911 + + +.asm_3890a + call $5527 + + 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 $5527 + + 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 $5521 + + ret c + dec [hl] + dec [hl] + ret +; 3895b + + +AIScoring_MirrorMove: ; 3895b + ld a, [LastEnemyCounterMove] + and a + jr nz, .asm_38968 + + call $5233 + + ret nc + jp $5503 + + +.asm_38968 + push hl + ld hl, $5301 + ld de, $0001 + call IsInArray + + pop hl + ret nc + call $5527 + + ret c + dec [hl] + call $5233 + + ret nc + call RNG + + cp $19 + ret c + dec [hl] + ret +; 38985 + + +AIScoring_AccuracyDown: ; 38985 + call $5246 + + jr nc, .asm_389a0 + + call $5281 + + 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 $52b3 + + jr nc, .asm_389bd + + call RNG + + cp $a + jr c, .asm_3899d + + call $526e + + jr nc, .asm_389b8 + + call $5521 + + jr c, .asm_3899d + + jr .asm_389bf + + +.asm_389b8 + call $5527 + + 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 $5527 + + 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 $5251 + + ret c + call RNG + + cp $19 + ret c + inc [hl] + ret +; 38a2a + + +AIScoring_Whirlwind: ; 38a2a + push hl + ld hl, $484e + ld a, $d + rst FarCall + + ld a, [$c716] + cp $a + pop hl + ret c + inc [hl] + ret +; 38a3a + + +AIScoring_Heal: +AIScoring_MorningSun: +AIScoring_Synthesis: +AIScoring_Moonlight: ; 38a3a + call $5298 + + jr nc, .asm_38a45 + + call $5281 + + 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 $526e + + ret c + inc [hl] + ret +; 38a54 + + +AIScoring_LightScreen: +AIScoring_Reflect: ; 38a54 + call $5251 + + 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, $5503 + + call $526e + + ret c + inc [hl] + ret +; 38a71 + + +AIScoring_Bind: ; 38a71 + ld a, [$c730] + and a + jr nz, .asm_38a8b + + ld a, [PlayerSubStatus5] + bit 0, a + jr nz, .asm_38a91 + + ld a, [PlayerSubStatus1] + and $c9 + jr nz, .asm_38a91 + + ld a, [PlayerTurnsTaken] + and a + jr z, .asm_38a91 + + +.asm_38a8b + call $5527 + + ret c + inc [hl] + ret + +.asm_38a91 + call $5298 + + ret nc + call $5527 + + ret c + dec [hl] + dec [hl] + ret +; 38a9c + + +AIScoring_RazorWind: +AIScoring_Unused2B: ; 38a9c + ld a, [EnemySubStatus1] + bit 4, 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 $5508 + + ld a, [EnemyMoveEffect] + cp $6f + jr z, .asm_38ad5 + + dec c + jr nz, .asm_38ab0 + + +.asm_38ac1 + pop hl + ld a, [EnemySubStatus3] + bit 7, a + jr nz, .asm_38acd + + call $5281 + + 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 $526e + + ret c + call RNG + + cp $19 + jr c, .asm_38ae7 + + inc [hl] + +.asm_38ae7 + call $52b3 + + ret c + inc [hl] + ret +; 38aed + + +AIScoring_SpDefenseUp2: ; 38aed + call $5281 + + jr nc, .asm_38b10 + + ld a, [EnemySDefLevel] + cp $b + jr nc, .asm_38b10 + + cp $9 + ret nc + ld a, [BattleMonType1] + cp $14 + jr nc, .asm_38b09 + + ld a, [BattleMonType2] + cp $14 + ret c + +.asm_38b09 + call $5521 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38b10 + inc [hl] + ret +; 38b12 + + +AIScoring_Fly: ; 38b12 + ld a, [PlayerSubStatus3] + and $60 + ret z + call $5233 + + ret nc + dec [hl] + dec [hl] + dec [hl] + ret +; 38b20 + + +AIScoring_SuperFang: ; 38b20 + call $52b3 + + ret c + inc [hl] + ret +; 38b26 + + +AIScoring_Paralyze: ; 38b26 + call $52b3 + + jr nc, .asm_38b3a + + call $5233 + + ret c + call $5298 + + ret nc + call $5521 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38b3a + call $5527 + + ret c + inc [hl] + ret +; 38b40 + + +AIScoring_SpeedDownHit: ; 38b40 + ld a, [EnemyMoveAnimation] + cp $c4 + ret nz + call $5298 + + ret nc + ld a, [PlayerTurnsTaken] + and a + ret nz + call $5233 + + ret c + call RNG + + cp $1e + ret c + dec [hl] + dec [hl] + ret +; 38b5c + + +AIScoring_Substitute: ; 38b5c + call $5281 + + ret c + jp $5503 + +; 38b63 + + +AIScoring_HyperBeam: ; 38b63 + call $5281 + + jr c, .asm_38b72 + + call $5298 + + ret c + call $5527 + + ret c + dec [hl] + ret + +.asm_38b72 + call RNG + + cp $28 + ret c + inc [hl] + call $5527 + + ret c + inc [hl] + ret +; 38b7f + + +AIScoring_Rage: ; 38b7f + ld a, [EnemySubStatus4] + bit 6, a + jr z, .asm_38b9b + + call $5527 + + 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 $5281 + + jr nc, .asm_38ba6 + + call $5521 + + ret nc + dec [hl] + ret + +.asm_38ba6 + inc [hl] + ret +; 38ba8 + + +AIScoring_Mimic: ; 38ba8 + ld a, [LastEnemyCounterMove] + and a + jr z, .asm_38be9 + + call $5281 + + jr nc, .asm_38bef + + push hl + ld a, [LastEnemyCounterMove] + call $5508 + + 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 $5527 + + jr c, .asm_38bd4 + + dec [hl] + +.asm_38bd4 + ld a, [LastEnemyCounterMove] + push hl + ld hl, $5301 + ld de, $0001 + call IsInArray + + pop hl + ret nc + call $5527 + + ret c + dec [hl] + ret + +.asm_38be9 + call $5233 + + jp c, $5503 + + +.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 $5508 + + 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 $5508 + + 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 $5233 + + jr nc, .asm_38c81 + + ld a, [LastPlayerMove] + and a + jp z, $5503 + + call $5508 + + 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, $4c85 + ld de, $0001 + 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 +; 38c85 + + + +INCBIN "baserom.gbc", $38c85, $38ca4 - $38c85 + + + +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 $5233 + + jp c, $5503 + + call $5527 + + ret c + inc [hl] + ret + +.asm_38ce7 + push hl + ld b, a + ld c, $4 + ld hl, BattleMonMove1 + ld de, BattleMonPPMove1 + +.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 + + + +INCBIN "baserom.gbc", $38d16, $38d19 - $38d16 + + + +AIScoring_DestinyBond: +AIScoring_Reversal: +AIScoring_SkullBash: ; 38d19 + call $5298 + + 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 $5527 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38d52 + ld a, [EnemyMonStatus] + and a + ret nz + jp $5503 + +; 38d5a + + +AIScoring_PriorityHit: ; 38d5a + call $5233 + + ret c + ld a, [PlayerSubStatus3] + and $60 + jp nz, $5503 + + 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, $5afe + ld bc, $0007 + call AddNTimes + + ld a, $10 + 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 $5527 + + ret c + dec [hl] + ret + +.asm_38dc9 + call RNG + + cp $19 + ret c + inc [hl] + ret +; 38dd1 + + +AIScoring_Disable: ; 38dd1 + call $5233 + + jr nc, .asm_38df3 + + push hl + ld a, [LastEnemyCounterMove] + ld hl, $5301 + ld de, $0001 + call IsInArray + + pop hl + jr nc, .asm_38dee + + call RNG + + cp $64 + ret c + dec [hl] + ret + +.asm_38dee + ld a, [EnemyMovePower] + and a + ret nz + +.asm_38df3 + call RNG + + cp $14 + ret c + inc [hl] + ret +; 38dfb + + +AIScoring_MeanLook: ; 38dfb + call $5281 + + jr nc, .asm_38e24 + + push hl + call $4e2e + + pop hl + jp z, $5503 + + ld a, [EnemySubStatus5] + bit 0, a + jr nz, .asm_38e26 + + ld a, [PlayerSubStatus1] + and $c9 + jr nz, .asm_38e26 + + push hl + ld hl, $484e + ld a, $d + rst FarCall + + ld a, [$c716] + cp $b + pop hl + ret nc + +.asm_38e24 + inc [hl] + ret + +.asm_38e26 + call $5521 + + ret c + dec [hl] + dec [hl] + dec [hl] + ret +; 38e2e + + + +INCBIN "baserom.gbc", $38e2e, $38e4a - $38e2e + + + +AIScoring_Nightmare: ; 38e4a + call $5527 + + ret c + dec [hl] + ret +; 38e50 + + +AIScoring_FlameWheel: ; 38e50 + ld a, [EnemyMonStatus] + bit 5, a + ret z + dec [hl] + dec [hl] + dec [hl] + dec [hl] + dec [hl] + ret +; 38e5c + + +AIScoring_Curse: ; 38e5c + ld a, [EnemyMonType1] + cp $8 + jr z, .asm_38e95 + + ld a, [EnemyMonType2] + cp $8 + jr z, .asm_38e95 + + call $5281 + + jr nc, .asm_38e93 + + ld a, [EnemyAtkLevel] + cp $b + jr nc, .asm_38e93 + + cp $9 + ret nc + ld a, [BattleMonType1] + cp $8 + jr z, .asm_38e92 + + cp $14 + ret nc + ld a, [BattleMonType2] + cp $14 + ret nc + call $5521 + + ret c + dec [hl] + dec [hl] + ret + +.asm_38e90 + inc [hl] + inc [hl] + +.asm_38e92 + inc [hl] + +.asm_38e93 + inc [hl] + ret + +.asm_38e95 + ld a, [PlayerSubStatus1] + bit 1, a + jp nz, $5503 + + push hl + ld a, $d + ld hl, $49f4 + rst FarCall + + pop hl + jr nc, .asm_38eb0 + + push hl + call $4e2e + + pop hl + jr nz, .asm_38e90 + + jr .asm_38eb7 + + +.asm_38eb0 + push hl + call $4e2e + + pop hl + jr z, .asm_38ecb + + +.asm_38eb7 + call $5298 + + jp nc, $4e90 + + call $5281 + + jr nc, .asm_38e92 + + call $5251 + + ret nc + ld a, [PlayerTurnsTaken] + and a + ret nz + +.asm_38ecb + call $5527 + + ret c + dec [hl] + dec [hl] + ret +; 38ed2 + + +AIScoring_Protect: ; 38ed2 + ld a, [$c681] + and a + jr nz, .asm_38f13 + + ld a, [PlayerSubStatus5] + bit 5, a + jr nz, .asm_38f14 + + ld a, [PlayerFuryCutterCount] + cp $3 + jr nc, .asm_38f0d + + ld a, [PlayerSubStatus3] + bit 4, a + jr nz, .asm_38f0d + + ld a, [PlayerSubStatus5] + bit 0, a + jr nz, .asm_38f0d + + ld a, [PlayerSubStatus4] + bit 7, a + jr nz, .asm_38f0d + + ld a, [PlayerSubStatus1] + bit 1, a + jr nz, .asm_38f0d + + bit 6, a + jr z, .asm_38f14 + + ld a, [PlayerRolloutCount] + cp $3 + jr c, .asm_38f14 + + +.asm_38f0d + call $5521 + + ret c + dec [hl] + ret + +.asm_38f13 + inc [hl] + +.asm_38f14 + call RNG + + cp $14 + 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 $8 + jr z, .asm_38f41 + + ld a, [BattleMonType2] + cp $8 + jr z, .asm_38f41 + + call RNG + + cp $14 + ret c + inc [hl] + ret + +.asm_38f41 + call RNG + + cp $64 + ret c + dec [hl] + dec [hl] + ret +; 38f4a + + +AIScoring_PerishSong: ; 38f4a + push hl + ld hl, $49f4 + ld a, $d + rst FarCall + + pop hl + jr c, .asm_38f75 + + ld a, [PlayerSubStatus5] + bit 7, a + jr nz, .asm_38f6f + + push hl + ld hl, $484e + ld a, $d + rst FarCall + + ld a, [$c716] + cp $a + pop hl + ret c + call $5527 + + ret c + inc [hl] + ret + +.asm_38f6f + call $5527 + + 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, $4fa8 + ld de, $0001 + call IsInArray + + pop hl + jr c, .asm_38fa5 + + ld a, [BattleMonType2] + push hl + ld hl, $4fa8 + ld de, $0001 + call IsInArray + + pop hl + jr c, .asm_38fa5 + + call $526e + + jr nc, .asm_38fa6 + + call $5527 + + ret c + dec [hl] + ret + +.asm_38fa5 + inc [hl] + +.asm_38fa6 + inc [hl] + ret +; 38fa8 + + + +INCBIN "baserom.gbc", $38fa8, $38fac - $38fa8 + + + +AIScoring_Endure: ; 38fac + ld a, [$c681] + and a + jr nz, .asm_38fd8 + + call $5251 + + jr c, .asm_38fd8 + + call $5298 + + jr c, .asm_38fd9 + + ld b, $63 + call $52ca + + jr nc, .asm_38fcb + + call $5521 + + ret c + dec [hl] + dec [hl] + dec [hl] + ret + +.asm_38fcb + ld a, [EnemySubStatus5] + bit 5, a + ret z + call $5527 + + 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, AIScoring_Rollout + + dec [hl] + cp $2 + jr c, AIScoring_Rollout + + dec [hl] + dec [hl] + cp $3 + jr c, AIScoring_Rollout + + dec [hl] + dec [hl] + dec [hl] + + ; fallthrough +; 38fef + + +AIScoring_Rollout: ; 38fef + ld a, [EnemySubStatus1] + bit 7, a + jr nz, .asm_39020 + + ld a, [EnemySubStatus3] + bit 7, a + jr nz, .asm_39020 + + ld a, [EnemyMonStatus] + bit 6, a + jr nz, .asm_39020 + + call $5298 + + 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 $c8 + ret nc + dec [hl] + dec [hl] + ret + +.asm_39020 + call $5521 + + ret c + inc [hl] + ret +; 39026 + + +AIScoring_Swagger: +AIScoring_Attract: ; 39026 + ld a, [PlayerTurnsTaken] + and a + jr z, .asm_39032 + + call $5521 + + ret c + inc [hl] + ret + +.asm_39032 + call RNG + + cp $c8 + ret nc + dec [hl] + ret +; 3903a + + +AIScoring_Safeguard: ; 3903a + call $526e + + ret c + call $5521 + + ret c + inc [hl] + ret +; 39044 + + +AIScoring_Magnitude: +AIScoring_Earthquake: ; 39044 + ld a, [LastEnemyCounterMove] + cp $5b + ret nz + ld a, [PlayerSubStatus3] + bit 5, a + jr z, .asm_39058 + + call $5233 + + ret nc + dec [hl] + dec [hl] + ret + +.asm_39058 + call $5233 + + ret c + call $5527 + + ret c + dec [hl] + ret +; 39062 + + +AIScoring_BatonPass: ; 39062 + push hl + ld hl, $484e + ld a, $d + rst FarCall + + ld a, [$c716] + cp $a + pop hl + ret c + inc [hl] + ret +; 39072 + + +AIScoring_Pursuit: ; 39072 + call $52b3 + + jr nc, .asm_3907d + + call $5521 + + ret c + inc [hl] + ret + +.asm_3907d + call $5527 + + ret c + dec [hl] + dec [hl] + ret +; 39084 + + +AIScoring_RapidSpin: ; 39084 + ld a, [$c731] + and a + jr nz, .asm_39097 + + ld a, [EnemySubStatus4] + bit 7, a + jr nz, .asm_39097 + + ld a, [EnemyScreens] + bit 0, a + ret z + +.asm_39097 + call $5521 + + 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 + + ld hl, $47c8 + ld a, $d + rst FarCall + + 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 $15 + jr z, Function_0x3911e + + cp $14 + jr z, Function_0x39122 + + ld a, [BattleMonType2] + cp $15 + jr z, Function_0x3911e + + cp $14 + jr z, Function_0x39122 + + push hl + ld hl, $50e7 + jr Function_0x3910d +; 390e7 + + + +INCBIN "baserom.gbc", $390e7, $390f3 - $390e7 + + + +AIScoring_SunnyDay: ; 390f3 + ld a, [BattleMonType1] + cp $14 + jr z, Function_0x3911e + + cp $15 + jr z, Function_0x39122 + + ld a, [BattleMonType2] + cp $14 + jr z, Function_0x3911e + + cp $15 + jr z, Function_0x39122 + + push hl + ld hl, $5134 + + ; fallthrough +; 3910d + + +Function_0x3910d: ; 3910d + call $52e6 + + pop hl + jr nc, Function_0x3911e + + call $526e + + jr nc, Function_0x3911e + + call $5527 + + ret c + dec [hl] + ret + +Function_0x3911e: ; 3911e + inc [hl] + inc [hl] + inc [hl] + ret + +Function_0x39122: ; 39122 + call $526e + + ret nc + ld a, [PlayerTurnsTaken] + and a + jr z, .asm_39131 + + ld a, [EnemyTurnsTaken] + and a + ret nz + +.asm_39131 + dec [hl] + dec [hl] + ret +; 39134 + + + +INCBIN "baserom.gbc", $39134, $3913d - $39134 + + + +AIScoring_BellyDrum: ; 3913d + ld a, [EnemyAtkLevel] + cp $a + jr nc, .asm_3914d + + call $5251 + + ret c + inc [hl] + call $5281 + + 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 $5521 + + 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 $5508 + + ld a, [EnemyMovePower] + and a + jr z, .asm_391a8 + + ld a, [EnemyMoveType] + cp $14 + 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 $5508 + + ld a, [EnemyMovePower] + and a + jr z, .asm_391d2 + + ld a, [EnemyMoveType] + cp $14 + jr c, .asm_391d2 + + +.asm_391ca + call RNG + + cp $64 + jr c, .asm_391d2 + + dec [hl] + +.asm_391d2 + ret + +.asm_391d3 + inc [hl] + ret +; 391d5 + + +AIScoring_Twister: +AIScoring_Gust: ; 391d5 + ld a, [LastEnemyCounterMove] + cp $13 + ret nz + ld a, [PlayerSubStatus3] + bit 6, a + jr z, .asm_391e9 + + call $5233 + + ret nc + dec [hl] + dec [hl] + ret + +.asm_391e9 + call $5233 + + ret c + call $5527 + + ret c + dec [hl] + ret +; 391f3 + + +AIScoring_FutureSight: ; 391f3 + call $5233 + + ret nc + ld a, [PlayerSubStatus3] + and $60 + ret z + dec [hl] + dec [hl] + ret +; 39200 + + +AIScoring_Stomp: ; 39200 + ld a, [$c6fe] + and a + ret z + call $5521 + + ret c + dec [hl] + ret +; 3920b + + +AIScoring_Solarbeam: ; 3920b + ld a, [Weather] + cp $2 + jr z, .asm_3921e + + cp $1 + ret nz + call RNG + + cp $19 + ret c + inc [hl] + inc [hl] + ret + +.asm_3921e + call $5521 + + ret c + dec [hl] + dec [hl] + ret +; 39225 + + +AIScoring_Thunder: ; 39225 + ld a, [Weather] + cp $2 + ret nz + call RNG + + cp $19 + ret c + inc [hl] + ret +; 39233 + + + +INCBIN "baserom.gbc", $39233, $39315 - $39233 + + + +Function_0x39315: ; 39315 + call $5281 + ret c + + call $5298 + jr nc, .asm_39322 + + call $5527 + ret c + +.asm_39322 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_3932a + 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, .table_39348 + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr nc, .asm_3932a + + inc [hl] + jr .asm_3932a + +.asm_39347 + ret + +.table_39348 + 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 + + + +Function_0x39369: ; 39369 + ld hl, EnemyMonMoves + ld bc, 0 + ld de, 0 +.asm_39372 + inc b + ld a, b + cp EnemyMonMovesEnd - EnemyMonMoves + 1 + jr z, .asm_393a8 + + ld a, [hli] + and a + jr z, .asm_393a8 + + push hl + push de + push bc + call $5508 + + ld a, [EnemyMovePower] + and a + jr z, .asm_393a3 + + call $53e7 + + pop bc + pop de + pop hl + ld a, [CurDamage + 1] + cp e + ld a, [CurDamage] + sbc d + jr c, .asm_39372 + + ld a, [CurDamage + 1] + ld e, a + ld a, [CurDamage] + ld d, a + ld c, b + jr .asm_39372 + +.asm_393a3 + pop bc + pop de + pop hl + jr .asm_39372 + +.asm_393a8 + ld a, c + and a + jr z, .asm_393e1 + + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, $0 +.asm_393b4 + inc b + ld a, b + cp EnemyMonMovesEnd - EnemyMonMoves + 1 + jr z, .asm_393e1 + + cp c + ld a, [de] + inc de + inc hl + jr z, .asm_393b4 + + call $5508 + + ld a, [EnemyMovePower] + cp $2 + jr c, .asm_393b4 + + push hl + push de + push bc + ld a, [EnemyMoveEffect] + ld hl, $53e2 + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr c, .asm_393b4 + + inc [hl] + jr .asm_393b4 + +.asm_393e1 + ret + +; 393e2 + + +INCBIN "baserom.gbc", $393e2, $39418 - $393e2 + + +Function_0x39418: ; 39418 + 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, .table_39446 + ld de, 1 + call IsInArray + + pop bc + pop de + pop hl + jr nc, .asm_39425 + + call RNG + cp $e6 + ret nc + + inc [hl] + jr .asm_39425 + +.table_39446 + 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 + + + +Function_0x39453: ; 39453 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_3945b + dec b + ret z + + inc hl + ld a, [de] + and a + ret z + + inc de + call $5508 + + ld a, [EnemyMoveEffect] + cp EFFECT_TOXIC + jr z, .asm_39480 + cp EFFECT_POISON + jr z, .asm_39480 + cp EFFECT_SLEEP + jr z, .asm_3948e + cp EFFECT_PARALYZE + jr z, .asm_3948e + + ld a, [EnemyMovePower] + and a + jr z, .asm_3945b + + jr .asm_3948e + +.asm_39480 + ld a, [BattleMonType1] + cp POISON + jr z, .asm_394a4 + ld a, [BattleMonType2] + cp POISON + jr z, .asm_394a4 + +.asm_3948e + push hl + push bc + push de + + ld a, 1 + ld [hBattleTurn], a + + ld hl, $47c8 + ld a, $d + rst FarCall + + pop de + pop bc + pop hl + + ld a, [$d265] + and a + jr nz, .asm_3945b + +.asm_394a4 + call $5503 + jr .asm_3945b +; 394a9 + + + +Function_0x394a9: ; 394a9 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 +.asm_394b1 + inc hl + dec c + ret z + + ld a, [de] + inc de + and a + ret z + + push de + push bc + push hl + call $5508 + + ld a, [EnemyMovePower] + and a + jr z, .asm_394fa + + ld a, [EnemyMoveEffect] + ld de, 1 + ld hl, .table_394ff + call IsInArray + jr nc, .asm_394de + + call $5251 + jr c, .asm_394fa + + call RNG + cp $c8 + jr c, .asm_394fa + +.asm_394de + call $53e7 + + 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, .asm_394fa + + pop hl + dec [hl] + dec [hl] + dec [hl] + dec [hl] + dec [hl] + push hl +.asm_394fa + pop hl + pop bc + pop de + jr .asm_394b1 + +.table_394ff + db EFFECT_EXPLOSION + db EFFECT_OHKO + db $ff +; 39502 + + + +Function_0x39502: ; 39502 + ret +; 39503 + + +INCBIN "baserom.gbc", $39503, $39999 - $39503 + diff --git a/main.asm b/main.asm index 51c98f510..f246de4f0 100644 --- a/main.asm +++ b/main.asm @@ -7135,3141 +7135,8 @@ SECTION "bankE",DATA,BANK[$E] INCBIN "baserom.gbc", $38000, $38591 - $38000 -Function_0x38591: ; 38591 - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_38599 - dec b - ret z - - inc hl - ld a, [de] - and a - ret z - - inc de - call $5508 - - 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, .asm_385d6 - - ld a, [EnemyMoveEffect] - push hl - push de - push bc - ld hl, .table_385db - ld de, 1 - call IsInArray - - pop bc - pop de - pop hl - jr nc, .asm_38599 - - ld a, [BattleMonStatus] - and a - jr nz, .asm_385d6 - - ld a, [PlayerScreens] - bit 2, a - jr z, .asm_38599 - -.asm_385d6 - call $5503 - - jr .asm_38599 -; 385db - -.table_385db - db EFFECT_SLEEP - db EFFECT_TOXIC - db EFFECT_POISON - db EFFECT_PARALYZE - db $ff -; 385e0 - - - -Function_0x385e0: ; 385e0 - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.next - dec b - ret z - - inc hl - ld a, [de] - and a - ret z - - inc de - call $5508 - - ld a, [EnemyMoveEffect] - - cp EFFECT_ATTACK_UP - jr c, .next - cp EFFECT_EVASION_UP + 1 - jr c, .statup - -; cp EFFECT_ATTACK_DOWN - 1 - jr z, .next - cp EFFECT_EVASION_DOWN + 1 - jr c, .statdown - - cp EFFECT_ATTACK_UP_2 - jr c, .next - cp EFFECT_EVASION_UP_2 + 1 - jr c, .statup - -; cp EFFECT_ATTACK_DOWN_2 - 1 - jr z, .next - cp EFFECT_EVASION_DOWN_2 + 1 - jr c, .statdown - - jr .next - -.statup - ld a, [EnemyTurnsTaken] - and a - jr nz, .asm_3862a - - jr .asm_38621 - -.statdown - ld a, [PlayerTurnsTaken] - and a - jr nz, .asm_3862a - -.asm_38621 - call $5527 - - jr c, .next - - dec [hl] - dec [hl] - jr .next - -.asm_3862a - call RNG - - cp $1e - jr c, .next - - inc [hl] - inc [hl] - jr .next -; 38635 - - - -Function_0x38635: ; 38635 - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_3863d - dec b - ret z - - inc hl - ld a, [de] - and a - ret z - - inc de - call $5508 - - push hl - push bc - push de - ld a, 1 - ld [hBattleTurn], a - ld hl, $47c8 - ld a, $d - rst FarCall - - pop de - pop bc - pop hl - ld a, [$d265] - and a - jr z, .asm_3869d - - cp $a - jr z, .asm_3863d - - jr c, .asm_3866c - - ld a, [EnemyMovePower] - and a - jr z, .asm_3863d - - dec [hl] - jr .asm_3863d - -.asm_3866c - push hl - push de - push bc - ld a, [EnemyMoveType] - ld d, a - ld hl, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 - ld c, 0 -.asm_3867a - dec b - jr z, .asm_38693 - - ld a, [hli] - and a - jr z, .asm_38693 - - call $5508 - - ld a, [EnemyMoveType] - cp d - jr z, .asm_3867a - - ld a, [EnemyMovePower] - and a - jr nz, .asm_38692 - - jr .asm_3867a - -.asm_38692 - ld c, a -.asm_38693 - ld a, c - pop bc - pop de - pop hl - and a - jr z, .asm_3863d - - inc [hl] - jr .asm_3863d - -.asm_3869d - call $5503 - - jr .asm_3863d -; 386a2 - - - -Function_0x386a2: ; 386a2 - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_386aa - dec b - ret z - - inc hl - ld a, [de] - and a - ret z - - inc de - call $5508 - - ld a, [EnemyMovePower] - and a - jr nz, .asm_386aa - - inc [hl] - inc [hl] - jr .asm_386aa -; 386be - - - -Function_0x386be: ; 386be - ld hl, Buffer1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_386c6 - dec b - ret z - - ld a, [de] - inc de - and a - ret z - - push de - push bc - push hl - call $5508 - - ld a, [EnemyMoveEffect] - ld hl, .table_386f2 - ld de, 3 - call IsInArray - - inc hl - jr nc, .asm_386ec - - ld a, [hli] - ld e, a - ld d, [hl] - pop hl - push hl - ld bc, .asm_386ec - push bc - push de - ret - -.asm_386ec - pop hl - pop bc - pop de - inc hl - jr .asm_386c6 -; 386f2 - -.table_386f2 ; 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, $8 - call $52ca - - jr c, .asm_387f0 - - ld b, $6b - call $52ca - - ret nc - -.asm_387f0 - call $5527 - - ret c - dec [hl] - dec [hl] - ret -; 387f7 - - -AIScoring_LeechHit: ; 387f7 - push hl - ld a, $1 - ld [hBattleTurn], a - ld hl, $47c8 - ld a, $d - rst FarCall - - pop hl - ld a, [$d265] - cp $a - jr c, .asm_38815 - - ret z - call $5251 - - ret c - call $5521 - - 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 $5298 - - jr nc, .asm_38877 - - call $5281 - - jr c, .asm_38834 - - call $5233 - - 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, EnemyMonMove1 - ld c, $5 - -.asm_3884f - dec c - jr z, .asm_38877 - - ld a, [hli] - and a - jr z, .asm_38877 - - call $5508 - - 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 $5527 - - ret c - dec [hl] - dec [hl] - ret - -.asm_38882 - push hl - ld hl, $d1e9 - ld de, EnemyMonMove1 - ld c, $5 - -.asm_3888b - inc hl - dec c - jr z, .asm_388a2 - - ld a, [de] - and a - jr z, .asm_388a2 - - inc de - call $5508 - - ld a, [EnemyMoveAccuracy] - cp $b4 - jr nc, .asm_3888b - - dec [hl] - dec [hl] - jr .asm_3888b - - -.asm_388a2 - pop hl - jp $5503 - -; 388a6 - - -AIScoring_Explosion: ; 388a6 - push hl - ld a, $d - ld hl, $49f4 - rst FarCall - - pop hl - jr nc, .asm_388b7 - - push hl - call $4e2e - - pop hl - jr nz, .asm_388c6 - - -.asm_388b7 - call $5281 - - jr c, .asm_388c6 - - call $5298 - - ret nc - call RNG - - cp $14 - 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, $5503 - - call $5251 - - 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 $5298 - - jr nc, .asm_3890f - - call RNG - - cp $a - jr c, .asm_388ef - - call $5281 - - jr nc, .asm_3890a - - call $5521 - - jr c, .asm_388ef - - jr .asm_38911 - - -.asm_3890a - call $5527 - - 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 $5527 - - 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 $5521 - - ret c - dec [hl] - dec [hl] - ret -; 3895b - - -AIScoring_MirrorMove: ; 3895b - ld a, [LastEnemyCounterMove] - and a - jr nz, .asm_38968 - - call $5233 - - ret nc - jp $5503 - - -.asm_38968 - push hl - ld hl, $5301 - ld de, $0001 - call IsInArray - - pop hl - ret nc - call $5527 - - ret c - dec [hl] - call $5233 - - ret nc - call RNG - - cp $19 - ret c - dec [hl] - ret -; 38985 - - -AIScoring_AccuracyDown: ; 38985 - call $5246 - - jr nc, .asm_389a0 - - call $5281 - - 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 $52b3 - - jr nc, .asm_389bd - - call RNG - - cp $a - jr c, .asm_3899d - - call $526e - - jr nc, .asm_389b8 - - call $5521 - - jr c, .asm_3899d - - jr .asm_389bf - - -.asm_389b8 - call $5527 - - 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 $5527 - - 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 $5251 - - ret c - call RNG - - cp $19 - ret c - inc [hl] - ret -; 38a2a - - -AIScoring_Whirlwind: ; 38a2a - push hl - ld hl, $484e - ld a, $d - rst FarCall - - ld a, [$c716] - cp $a - pop hl - ret c - inc [hl] - ret -; 38a3a - - -AIScoring_Heal: -AIScoring_MorningSun: -AIScoring_Synthesis: -AIScoring_Moonlight: ; 38a3a - call $5298 - - jr nc, .asm_38a45 - - call $5281 - - 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 $526e - - ret c - inc [hl] - ret -; 38a54 - - -AIScoring_LightScreen: -AIScoring_Reflect: ; 38a54 - call $5251 - - 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, $5503 - - call $526e - - ret c - inc [hl] - ret -; 38a71 - - -AIScoring_Bind: ; 38a71 - ld a, [$c730] - and a - jr nz, .asm_38a8b - - ld a, [PlayerSubStatus5] - bit 0, a - jr nz, .asm_38a91 - - ld a, [PlayerSubStatus1] - and $c9 - jr nz, .asm_38a91 - - ld a, [PlayerTurnsTaken] - and a - jr z, .asm_38a91 - - -.asm_38a8b - call $5527 - - ret c - inc [hl] - ret - -.asm_38a91 - call $5298 - - ret nc - call $5527 - - ret c - dec [hl] - dec [hl] - ret -; 38a9c - - -AIScoring_RazorWind: -AIScoring_Unused2B: ; 38a9c - ld a, [EnemySubStatus1] - bit 4, 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 $5508 - - ld a, [EnemyMoveEffect] - cp $6f - jr z, .asm_38ad5 - - dec c - jr nz, .asm_38ab0 - - -.asm_38ac1 - pop hl - ld a, [EnemySubStatus3] - bit 7, a - jr nz, .asm_38acd - - call $5281 - - 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 $526e - - ret c - call RNG - - cp $19 - jr c, .asm_38ae7 - - inc [hl] - -.asm_38ae7 - call $52b3 - - ret c - inc [hl] - ret -; 38aed - - -AIScoring_SpDefenseUp2: ; 38aed - call $5281 - - jr nc, .asm_38b10 - - ld a, [EnemySDefLevel] - cp $b - jr nc, .asm_38b10 - - cp $9 - ret nc - ld a, [BattleMonType1] - cp $14 - jr nc, .asm_38b09 - - ld a, [BattleMonType2] - cp $14 - ret c - -.asm_38b09 - call $5521 - - ret c - dec [hl] - dec [hl] - ret - -.asm_38b10 - inc [hl] - ret -; 38b12 - - -AIScoring_Fly: ; 38b12 - ld a, [PlayerSubStatus3] - and $60 - ret z - call $5233 - - ret nc - dec [hl] - dec [hl] - dec [hl] - ret -; 38b20 - - -AIScoring_SuperFang: ; 38b20 - call $52b3 - - ret c - inc [hl] - ret -; 38b26 - - -AIScoring_Paralyze: ; 38b26 - call $52b3 - - jr nc, .asm_38b3a - - call $5233 - - ret c - call $5298 - - ret nc - call $5521 - - ret c - dec [hl] - dec [hl] - ret - -.asm_38b3a - call $5527 - - ret c - inc [hl] - ret -; 38b40 - - -AIScoring_SpeedDownHit: ; 38b40 - ld a, [EnemyMoveAnimation] - cp $c4 - ret nz - call $5298 - - ret nc - ld a, [PlayerTurnsTaken] - and a - ret nz - call $5233 - - ret c - call RNG - - cp $1e - ret c - dec [hl] - dec [hl] - ret -; 38b5c - - -AIScoring_Substitute: ; 38b5c - call $5281 - - ret c - jp $5503 - -; 38b63 - - -AIScoring_HyperBeam: ; 38b63 - call $5281 - - jr c, .asm_38b72 - - call $5298 - - ret c - call $5527 - - ret c - dec [hl] - ret - -.asm_38b72 - call RNG - - cp $28 - ret c - inc [hl] - call $5527 - - ret c - inc [hl] - ret -; 38b7f - - -AIScoring_Rage: ; 38b7f - ld a, [EnemySubStatus4] - bit 6, a - jr z, .asm_38b9b - - call $5527 - - 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 $5281 - - jr nc, .asm_38ba6 - - call $5521 - - ret nc - dec [hl] - ret - -.asm_38ba6 - inc [hl] - ret -; 38ba8 - - -AIScoring_Mimic: ; 38ba8 - ld a, [LastEnemyCounterMove] - and a - jr z, .asm_38be9 - - call $5281 - - jr nc, .asm_38bef - - push hl - ld a, [LastEnemyCounterMove] - call $5508 - - 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 $5527 - - jr c, .asm_38bd4 - - dec [hl] - -.asm_38bd4 - ld a, [LastEnemyCounterMove] - push hl - ld hl, $5301 - ld de, $0001 - call IsInArray - - pop hl - ret nc - call $5527 - - ret c - dec [hl] - ret - -.asm_38be9 - call $5233 - - jp c, $5503 - - -.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 $5508 - - 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 $5508 - - 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 $5233 - - jr nc, .asm_38c81 - - ld a, [LastPlayerMove] - and a - jp z, $5503 - - call $5508 - - 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, $4c85 - ld de, $0001 - 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 -; 38c85 - - - -INCBIN "baserom.gbc", $38c85, $38ca4 - $38c85 - - - -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 $5233 - - jp c, $5503 - - call $5527 - - ret c - inc [hl] - ret - -.asm_38ce7 - push hl - ld b, a - ld c, $4 - ld hl, BattleMonMove1 - ld de, BattleMonPPMove1 - -.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 - - - -INCBIN "baserom.gbc", $38d16, $38d19 - $38d16 - - - -AIScoring_DestinyBond: -AIScoring_Reversal: -AIScoring_SkullBash: ; 38d19 - call $5298 - - 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 $5527 - - ret c - dec [hl] - dec [hl] - ret - -.asm_38d52 - ld a, [EnemyMonStatus] - and a - ret nz - jp $5503 - -; 38d5a - - -AIScoring_PriorityHit: ; 38d5a - call $5233 - - ret c - ld a, [PlayerSubStatus3] - and $60 - jp nz, $5503 - - 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, $5afe - ld bc, $0007 - call AddNTimes - - ld a, $10 - 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 $5527 - - ret c - dec [hl] - ret - -.asm_38dc9 - call RNG - - cp $19 - ret c - inc [hl] - ret -; 38dd1 - - -AIScoring_Disable: ; 38dd1 - call $5233 - - jr nc, .asm_38df3 - - push hl - ld a, [LastEnemyCounterMove] - ld hl, $5301 - ld de, $0001 - call IsInArray - - pop hl - jr nc, .asm_38dee - - call RNG - - cp $64 - ret c - dec [hl] - ret - -.asm_38dee - ld a, [EnemyMovePower] - and a - ret nz - -.asm_38df3 - call RNG - - cp $14 - ret c - inc [hl] - ret -; 38dfb - - -AIScoring_MeanLook: ; 38dfb - call $5281 - - jr nc, .asm_38e24 - - push hl - call $4e2e - - pop hl - jp z, $5503 - - ld a, [EnemySubStatus5] - bit 0, a - jr nz, .asm_38e26 - - ld a, [PlayerSubStatus1] - and $c9 - jr nz, .asm_38e26 - - push hl - ld hl, $484e - ld a, $d - rst FarCall - - ld a, [$c716] - cp $b - pop hl - ret nc - -.asm_38e24 - inc [hl] - ret - -.asm_38e26 - call $5521 - - ret c - dec [hl] - dec [hl] - dec [hl] - ret -; 38e2e - - - -INCBIN "baserom.gbc", $38e2e, $38e4a - $38e2e - - - -AIScoring_Nightmare: ; 38e4a - call $5527 - - ret c - dec [hl] - ret -; 38e50 - - -AIScoring_FlameWheel: ; 38e50 - ld a, [EnemyMonStatus] - bit 5, a - ret z - dec [hl] - dec [hl] - dec [hl] - dec [hl] - dec [hl] - ret -; 38e5c - - -AIScoring_Curse: ; 38e5c - ld a, [EnemyMonType1] - cp $8 - jr z, .asm_38e95 - - ld a, [EnemyMonType2] - cp $8 - jr z, .asm_38e95 - - call $5281 - - jr nc, .asm_38e93 - - ld a, [EnemyAtkLevel] - cp $b - jr nc, .asm_38e93 - - cp $9 - ret nc - ld a, [BattleMonType1] - cp $8 - jr z, .asm_38e92 - - cp $14 - ret nc - ld a, [BattleMonType2] - cp $14 - ret nc - call $5521 - - ret c - dec [hl] - dec [hl] - ret - -.asm_38e90 - inc [hl] - inc [hl] - -.asm_38e92 - inc [hl] - -.asm_38e93 - inc [hl] - ret - -.asm_38e95 - ld a, [PlayerSubStatus1] - bit 1, a - jp nz, $5503 - - push hl - ld a, $d - ld hl, $49f4 - rst FarCall - - pop hl - jr nc, .asm_38eb0 - - push hl - call $4e2e - - pop hl - jr nz, .asm_38e90 - - jr .asm_38eb7 - - -.asm_38eb0 - push hl - call $4e2e - - pop hl - jr z, .asm_38ecb - - -.asm_38eb7 - call $5298 - - jp nc, $4e90 - - call $5281 - - jr nc, .asm_38e92 - - call $5251 - - ret nc - ld a, [PlayerTurnsTaken] - and a - ret nz - -.asm_38ecb - call $5527 - - ret c - dec [hl] - dec [hl] - ret -; 38ed2 - - -AIScoring_Protect: ; 38ed2 - ld a, [$c681] - and a - jr nz, .asm_38f13 - - ld a, [PlayerSubStatus5] - bit 5, a - jr nz, .asm_38f14 - - ld a, [PlayerFuryCutterCount] - cp $3 - jr nc, .asm_38f0d - - ld a, [PlayerSubStatus3] - bit 4, a - jr nz, .asm_38f0d - - ld a, [PlayerSubStatus5] - bit 0, a - jr nz, .asm_38f0d - - ld a, [PlayerSubStatus4] - bit 7, a - jr nz, .asm_38f0d - - ld a, [PlayerSubStatus1] - bit 1, a - jr nz, .asm_38f0d - - bit 6, a - jr z, .asm_38f14 - - ld a, [PlayerRolloutCount] - cp $3 - jr c, .asm_38f14 - - -.asm_38f0d - call $5521 - - ret c - dec [hl] - ret - -.asm_38f13 - inc [hl] - -.asm_38f14 - call RNG - - cp $14 - 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 $8 - jr z, .asm_38f41 - - ld a, [BattleMonType2] - cp $8 - jr z, .asm_38f41 - - call RNG - - cp $14 - ret c - inc [hl] - ret - -.asm_38f41 - call RNG - - cp $64 - ret c - dec [hl] - dec [hl] - ret -; 38f4a - - -AIScoring_PerishSong: ; 38f4a - push hl - ld hl, $49f4 - ld a, $d - rst FarCall - - pop hl - jr c, .asm_38f75 - - ld a, [PlayerSubStatus5] - bit 7, a - jr nz, .asm_38f6f - - push hl - ld hl, $484e - ld a, $d - rst FarCall - - ld a, [$c716] - cp $a - pop hl - ret c - call $5527 - - ret c - inc [hl] - ret - -.asm_38f6f - call $5527 - - 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, $4fa8 - ld de, $0001 - call IsInArray - - pop hl - jr c, .asm_38fa5 - - ld a, [BattleMonType2] - push hl - ld hl, $4fa8 - ld de, $0001 - call IsInArray - - pop hl - jr c, .asm_38fa5 - - call $526e - - jr nc, .asm_38fa6 - - call $5527 - - ret c - dec [hl] - ret - -.asm_38fa5 - inc [hl] - -.asm_38fa6 - inc [hl] - ret -; 38fa8 - - - -INCBIN "baserom.gbc", $38fa8, $38fac - $38fa8 - - - -AIScoring_Endure: ; 38fac - ld a, [$c681] - and a - jr nz, .asm_38fd8 - - call $5251 - - jr c, .asm_38fd8 - - call $5298 - - jr c, .asm_38fd9 - - ld b, $63 - call $52ca - - jr nc, .asm_38fcb - - call $5521 - - ret c - dec [hl] - dec [hl] - dec [hl] - ret - -.asm_38fcb - ld a, [EnemySubStatus5] - bit 5, a - ret z - call $5527 - - 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, AIScoring_Rollout - - dec [hl] - cp $2 - jr c, AIScoring_Rollout - - dec [hl] - dec [hl] - cp $3 - jr c, AIScoring_Rollout - - dec [hl] - dec [hl] - dec [hl] - - ; fallthrough -; 38fef - - -AIScoring_Rollout: ; 38fef - ld a, [EnemySubStatus1] - bit 7, a - jr nz, .asm_39020 - - ld a, [EnemySubStatus3] - bit 7, a - jr nz, .asm_39020 - - ld a, [EnemyMonStatus] - bit 6, a - jr nz, .asm_39020 - - call $5298 - - 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 $c8 - ret nc - dec [hl] - dec [hl] - ret - -.asm_39020 - call $5521 - - ret c - inc [hl] - ret -; 39026 - - -AIScoring_Swagger: -AIScoring_Attract: ; 39026 - ld a, [PlayerTurnsTaken] - and a - jr z, .asm_39032 - - call $5521 - - ret c - inc [hl] - ret - -.asm_39032 - call RNG - - cp $c8 - ret nc - dec [hl] - ret -; 3903a - - -AIScoring_Safeguard: ; 3903a - call $526e - - ret c - call $5521 - - ret c - inc [hl] - ret -; 39044 - - -AIScoring_Magnitude: -AIScoring_Earthquake: ; 39044 - ld a, [LastEnemyCounterMove] - cp $5b - ret nz - ld a, [PlayerSubStatus3] - bit 5, a - jr z, .asm_39058 - - call $5233 - - ret nc - dec [hl] - dec [hl] - ret - -.asm_39058 - call $5233 - - ret c - call $5527 - - ret c - dec [hl] - ret -; 39062 - - -AIScoring_BatonPass: ; 39062 - push hl - ld hl, $484e - ld a, $d - rst FarCall - - ld a, [$c716] - cp $a - pop hl - ret c - inc [hl] - ret -; 39072 - - -AIScoring_Pursuit: ; 39072 - call $52b3 - - jr nc, .asm_3907d - - call $5521 - - ret c - inc [hl] - ret - -.asm_3907d - call $5527 - - ret c - dec [hl] - dec [hl] - ret -; 39084 - - -AIScoring_RapidSpin: ; 39084 - ld a, [$c731] - and a - jr nz, .asm_39097 - - ld a, [EnemySubStatus4] - bit 7, a - jr nz, .asm_39097 - - ld a, [EnemyScreens] - bit 0, a - ret z - -.asm_39097 - call $5521 - - 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 - - ld hl, $47c8 - ld a, $d - rst FarCall - - 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 $15 - jr z, Function_0x3911e - - cp $14 - jr z, Function_0x39122 - - ld a, [BattleMonType2] - cp $15 - jr z, Function_0x3911e - - cp $14 - jr z, Function_0x39122 - - push hl - ld hl, $50e7 - jr Function_0x3910d -; 390e7 - - - -INCBIN "baserom.gbc", $390e7, $390f3 - $390e7 - - - -AIScoring_SunnyDay: ; 390f3 - ld a, [BattleMonType1] - cp $14 - jr z, Function_0x3911e - - cp $15 - jr z, Function_0x39122 - - ld a, [BattleMonType2] - cp $14 - jr z, Function_0x3911e - - cp $15 - jr z, Function_0x39122 - - push hl - ld hl, $5134 - - ; fallthrough -; 3910d - - -Function_0x3910d: ; 3910d - call $52e6 - - pop hl - jr nc, Function_0x3911e - - call $526e - - jr nc, Function_0x3911e - - call $5527 - - ret c - dec [hl] - ret - -Function_0x3911e: ; 3911e - inc [hl] - inc [hl] - inc [hl] - ret - -Function_0x39122: ; 39122 - call $526e - - ret nc - ld a, [PlayerTurnsTaken] - and a - jr z, .asm_39131 - - ld a, [EnemyTurnsTaken] - and a - ret nz - -.asm_39131 - dec [hl] - dec [hl] - ret -; 39134 - - - -INCBIN "baserom.gbc", $39134, $3913d - $39134 - - - -AIScoring_BellyDrum: ; 3913d - ld a, [EnemyAtkLevel] - cp $a - jr nc, .asm_3914d - - call $5251 - - ret c - inc [hl] - call $5281 - - 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 $5521 - - 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 $5508 - - ld a, [EnemyMovePower] - and a - jr z, .asm_391a8 - - ld a, [EnemyMoveType] - cp $14 - 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 $5508 - - ld a, [EnemyMovePower] - and a - jr z, .asm_391d2 - - ld a, [EnemyMoveType] - cp $14 - jr c, .asm_391d2 - - -.asm_391ca - call RNG - - cp $64 - jr c, .asm_391d2 - - dec [hl] - -.asm_391d2 - ret - -.asm_391d3 - inc [hl] - ret -; 391d5 - - -AIScoring_Twister: -AIScoring_Gust: ; 391d5 - ld a, [LastEnemyCounterMove] - cp $13 - ret nz - ld a, [PlayerSubStatus3] - bit 6, a - jr z, .asm_391e9 - - call $5233 - - ret nc - dec [hl] - dec [hl] - ret - -.asm_391e9 - call $5233 - - ret c - call $5527 - - ret c - dec [hl] - ret -; 391f3 - - -AIScoring_FutureSight: ; 391f3 - call $5233 - - ret nc - ld a, [PlayerSubStatus3] - and $60 - ret z - dec [hl] - dec [hl] - ret -; 39200 - - -AIScoring_Stomp: ; 39200 - ld a, [$c6fe] - and a - ret z - call $5521 - - ret c - dec [hl] - ret -; 3920b - - -AIScoring_Solarbeam: ; 3920b - ld a, [Weather] - cp $2 - jr z, .asm_3921e - - cp $1 - ret nz - call RNG - - cp $19 - ret c - inc [hl] - inc [hl] - ret - -.asm_3921e - call $5521 - - ret c - dec [hl] - dec [hl] - ret -; 39225 - - -AIScoring_Thunder: ; 39225 - ld a, [Weather] - cp $2 - ret nz - call RNG - - cp $19 - ret c - inc [hl] - ret -; 39233 - - - -INCBIN "baserom.gbc", $39233, $39315 - $39233 - - - -Function_0x39315: ; 39315 - call $5281 - ret c - - call $5298 - jr nc, .asm_39322 - - call $5527 - ret c - -.asm_39322 - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_3932a - 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, .table_39348 - ld de, 1 - call IsInArray - - pop bc - pop de - pop hl - jr nc, .asm_3932a - - inc [hl] - jr .asm_3932a - -.asm_39347 - ret - -.table_39348 - 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 - - - -Function_0x39369: ; 39369 - ld hl, EnemyMonMoves - ld bc, 0 - ld de, 0 -.asm_39372 - inc b - ld a, b - cp EnemyMonMovesEnd - EnemyMonMoves + 1 - jr z, .asm_393a8 - - ld a, [hli] - and a - jr z, .asm_393a8 - - push hl - push de - push bc - call $5508 - - ld a, [EnemyMovePower] - and a - jr z, .asm_393a3 - - call $53e7 - - pop bc - pop de - pop hl - ld a, [CurDamage + 1] - cp e - ld a, [CurDamage] - sbc d - jr c, .asm_39372 - - ld a, [CurDamage + 1] - ld e, a - ld a, [CurDamage] - ld d, a - ld c, b - jr .asm_39372 - -.asm_393a3 - pop bc - pop de - pop hl - jr .asm_39372 - -.asm_393a8 - ld a, c - and a - jr z, .asm_393e1 - - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, $0 -.asm_393b4 - inc b - ld a, b - cp EnemyMonMovesEnd - EnemyMonMoves + 1 - jr z, .asm_393e1 - - cp c - ld a, [de] - inc de - inc hl - jr z, .asm_393b4 - - call $5508 - - ld a, [EnemyMovePower] - cp $2 - jr c, .asm_393b4 - - push hl - push de - push bc - ld a, [EnemyMoveEffect] - ld hl, $53e2 - ld de, 1 - call IsInArray - - pop bc - pop de - pop hl - jr c, .asm_393b4 - - inc [hl] - jr .asm_393b4 - -.asm_393e1 - ret - -; 393e2 - - -INCBIN "baserom.gbc", $393e2, $39418 - $393e2 - - -Function_0x39418: ; 39418 - 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, .table_39446 - ld de, 1 - call IsInArray - - pop bc - pop de - pop hl - jr nc, .asm_39425 - - call RNG - cp $e6 - ret nc - - inc [hl] - jr .asm_39425 - -.table_39446 - 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 - - - -Function_0x39453: ; 39453 - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_3945b - dec b - ret z - - inc hl - ld a, [de] - and a - ret z - - inc de - call $5508 - - ld a, [EnemyMoveEffect] - cp EFFECT_TOXIC - jr z, .asm_39480 - cp EFFECT_POISON - jr z, .asm_39480 - cp EFFECT_SLEEP - jr z, .asm_3948e - cp EFFECT_PARALYZE - jr z, .asm_3948e - - ld a, [EnemyMovePower] - and a - jr z, .asm_3945b - - jr .asm_3948e - -.asm_39480 - ld a, [BattleMonType1] - cp POISON - jr z, .asm_394a4 - ld a, [BattleMonType2] - cp POISON - jr z, .asm_394a4 - -.asm_3948e - push hl - push bc - push de - - ld a, 1 - ld [hBattleTurn], a - - ld hl, $47c8 - ld a, $d - rst FarCall - - pop de - pop bc - pop hl - - ld a, [$d265] - and a - jr nz, .asm_3945b - -.asm_394a4 - call $5503 - jr .asm_3945b -; 394a9 - - - -Function_0x394a9: ; 394a9 - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_394b1 - inc hl - dec c - ret z - - ld a, [de] - inc de - and a - ret z - - push de - push bc - push hl - call $5508 - - ld a, [EnemyMovePower] - and a - jr z, .asm_394fa - - ld a, [EnemyMoveEffect] - ld de, 1 - ld hl, .table_394ff - call IsInArray - jr nc, .asm_394de - - call $5251 - jr c, .asm_394fa - - call RNG - cp $c8 - jr c, .asm_394fa - -.asm_394de - call $53e7 - - 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, .asm_394fa - - pop hl - dec [hl] - dec [hl] - dec [hl] - dec [hl] - dec [hl] - push hl -.asm_394fa - pop hl - pop bc - pop de - jr .asm_394b1 - -.table_394ff - db EFFECT_EXPLOSION - db EFFECT_OHKO - db $ff -; 39502 - - - -Function_0x39502: ; 39502 - ret -; 39503 - - -INCBIN "baserom.gbc", $39503, $39999 - $39503 +AIScoring: ; 38591 +INCLUDE "battle/ai/scoring.asm" TrainerGroups: ; 0x39999 @@ -11569,7 +8436,7 @@ AIChooseMove: ; 440ce ld a, [hli] ld h, [hl] ld l, a - ld a, $e ; bank + ld a, BANK(AIScoring) call FarJpHl jr .CheckLayer From 9f5396eff6bd7b8cded83cc450ea7ded8b6c0f9f Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 6 May 2013 02:39:01 -0400 Subject: [PATCH 106/112] clean up ai scoring --- battle/ai/scoring.asm | 959 +++++++++++++++++++++++++++--------------- main.asm | 3 + 2 files changed, 627 insertions(+), 335 deletions(-) diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index e020c5b28..b65557bed 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -12,7 +12,7 @@ Function_0x38591: ; 38591 ret z inc de - call $5508 + call Function_0x39508 ld a, [EnemyMoveEffect] ld c, a @@ -50,7 +50,7 @@ Function_0x38591: ; 38591 jr z, .asm_38599 .asm_385d6 - call $5503 + call Function_0x39503 jr .asm_38599 ; 385db @@ -79,7 +79,7 @@ Function_0x385e0: ; 385e0 ret z inc de - call $5508 + call Function_0x39508 ld a, [EnemyMoveEffect] @@ -118,7 +118,7 @@ Function_0x385e0: ; 385e0 jr nz, .asm_3862a .asm_38621 - call $5527 + call Function_0x39527 jr c, .next @@ -153,7 +153,7 @@ Function_0x38635: ; 38635 ret z inc de - call $5508 + call Function_0x39508 push hl push bc @@ -200,7 +200,7 @@ Function_0x38635: ; 38635 and a jr z, .asm_38693 - call $5508 + call Function_0x39508 ld a, [EnemyMoveType] cp d @@ -226,7 +226,7 @@ Function_0x38635: ; 38635 jr .asm_3863d .asm_3869d - call $5503 + call Function_0x39503 jr .asm_3863d ; 386a2 @@ -247,7 +247,7 @@ Function_0x386a2: ; 386a2 ret z inc de - call $5508 + call Function_0x39508 ld a, [EnemyMovePower] and a @@ -276,7 +276,7 @@ Function_0x386be: ; 386be push de push bc push hl - call $5508 + call Function_0x39508 ld a, [EnemyMoveEffect] ld hl, .table_386f2 @@ -391,17 +391,17 @@ Function_0x386be: ; 386be AIScoring_Sleep: ; 387e3 ld b, $8 - call $52ca + call Function_0x392ca jr c, .asm_387f0 ld b, $6b - call $52ca + call Function_0x392ca ret nc .asm_387f0 - call $5527 + call Function_0x39527 ret c dec [hl] @@ -424,10 +424,10 @@ AIScoring_LeechHit: ; 387f7 jr c, .asm_38815 ret z - call $5251 + call Function_0x39251 ret c - call $5521 + call Function_0x39521 ret c dec [hl] @@ -449,15 +449,15 @@ AIScoring_LockOn: ; 3881d jr nz, .asm_38882 push hl - call $5298 + call Function_0x39298 jr nc, .asm_38877 - call $5281 + call Function_0x39281 jr c, .asm_38834 - call $5233 + call Function_0x39233 jr nc, .asm_38877 @@ -477,8 +477,8 @@ AIScoring_LockOn: ; 3881d cp $7 jr c, .asm_38875 - ld hl, EnemyMonMove1 - ld c, $5 + ld hl, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 .asm_3884f dec c @@ -488,7 +488,7 @@ AIScoring_LockOn: ; 3881d and a jr z, .asm_38877 - call $5508 + call Function_0x39508 ld a, [EnemyMoveAccuracy] cp $b4 @@ -520,7 +520,7 @@ AIScoring_LockOn: ; 3881d .asm_3887a pop hl - call $5527 + call Function_0x39527 ret c dec [hl] @@ -529,9 +529,9 @@ AIScoring_LockOn: ; 3881d .asm_38882 push hl - ld hl, $d1e9 - ld de, EnemyMonMove1 - ld c, $5 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 .asm_3888b inc hl @@ -543,7 +543,7 @@ AIScoring_LockOn: ; 3881d jr z, .asm_388a2 inc de - call $5508 + call Function_0x39508 ld a, [EnemyMoveAccuracy] cp $b4 @@ -556,7 +556,7 @@ AIScoring_LockOn: ; 3881d .asm_388a2 pop hl - jp $5503 + jp Function_0x39503 ; 388a6 @@ -571,18 +571,18 @@ AIScoring_Explosion: ; 388a6 jr nc, .asm_388b7 push hl - call $4e2e + call Function_0x38e2e pop hl jr nz, .asm_388c6 .asm_388b7 - call $5281 + call Function_0x39281 jr c, .asm_388c6 - call $5298 + call Function_0x39298 ret nc call RNG @@ -613,9 +613,9 @@ AIScoring_DreamEater: ; 388ca AIScoring_EvasionUp: ; 388d4 ld a, [EnemyEvaLevel] cp $d - jp nc, $5503 + jp nc, Function_0x39503 - call $5251 + call Function_0x39251 jr nc, .asm_388f2 @@ -635,7 +635,7 @@ AIScoring_EvasionUp: ; 388d4 ret .asm_388f2 - call $5298 + call Function_0x39298 jr nc, .asm_3890f @@ -644,11 +644,11 @@ AIScoring_EvasionUp: ; 388d4 cp $a jr c, .asm_388ef - call $5281 + call Function_0x39281 jr nc, .asm_3890a - call $5521 + call Function_0x39521 jr c, .asm_388ef @@ -656,7 +656,7 @@ AIScoring_EvasionUp: ; 388d4 .asm_3890a - call $5527 + call Function_0x39527 jr c, .asm_38911 @@ -695,7 +695,6 @@ AIScoring_EvasionUp: ; 388d4 .asm_38938 call RNG - cp $50 ret c dec [hl] @@ -703,7 +702,7 @@ AIScoring_EvasionUp: ; 388d4 ret .asm_38941 - call $5527 + call Function_0x39527 ret c dec [hl] @@ -721,7 +720,7 @@ AIScoring_AlwaysHit: ; 38947 ret c .asm_38954 - call $5521 + call Function_0x39521 ret c dec [hl] @@ -735,25 +734,25 @@ AIScoring_MirrorMove: ; 3895b and a jr nz, .asm_38968 - call $5233 + call Function_0x39233 ret nc - jp $5503 + jp Function_0x39503 .asm_38968 push hl - ld hl, $5301 - ld de, $0001 + ld hl, Table_0x39301 + ld de, 1 call IsInArray pop hl ret nc - call $5527 + call Function_0x39527 ret c dec [hl] - call $5233 + call Function_0x39233 ret nc call RNG @@ -766,11 +765,11 @@ AIScoring_MirrorMove: ; 3895b AIScoring_AccuracyDown: ; 38985 - call $5246 + call Function_0x39246 jr nc, .asm_389a0 - call $5281 + call Function_0x39281 jr nc, .asm_389a0 @@ -790,7 +789,7 @@ AIScoring_AccuracyDown: ; 38985 ret .asm_389a0 - call $52b3 + call Function_0x392b3 jr nc, .asm_389bd @@ -799,11 +798,11 @@ AIScoring_AccuracyDown: ; 38985 cp $a jr c, .asm_3899d - call $526e + call Function_0x3926e jr nc, .asm_389b8 - call $5521 + call Function_0x39521 jr c, .asm_3899d @@ -811,7 +810,7 @@ AIScoring_AccuracyDown: ; 38985 .asm_389b8 - call $5527 + call Function_0x39527 jr c, .asm_389bf @@ -850,7 +849,6 @@ AIScoring_AccuracyDown: ; 38985 .asm_389e6 call RNG - cp $50 ret c dec [hl] @@ -858,7 +856,7 @@ AIScoring_AccuracyDown: ; 38985 ret .asm_389ef - call $5527 + call Function_0x39527 ret c dec [hl] @@ -870,35 +868,28 @@ 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] @@ -912,11 +903,9 @@ AIScoring_Haze: ; 389f5 AIScoring_Bide: ; 38a1e - call $5251 - + call Function_0x39251 ret c call RNG - cp $19 ret c inc [hl] @@ -929,7 +918,6 @@ AIScoring_Whirlwind: ; 38a2a ld hl, $484e ld a, $d rst FarCall - ld a, [$c716] cp $a pop hl @@ -943,19 +931,15 @@ AIScoring_Heal: AIScoring_MorningSun: AIScoring_Synthesis: AIScoring_Moonlight: ; 38a3a - call $5298 - + call Function_0x39298 jr nc, .asm_38a45 - - call $5281 - + call Function_0x39281 ret nc inc [hl] ret .asm_38a45 call RNG - cp $19 ret c dec [hl] @@ -966,8 +950,7 @@ AIScoring_Moonlight: ; 38a3a AIScoring_Toxic: AIScoring_LeechSeed: ; 38a4e - call $526e - + call Function_0x3926e ret c inc [hl] ret @@ -976,11 +959,9 @@ AIScoring_LeechSeed: ; 38a4e AIScoring_LightScreen: AIScoring_Reflect: ; 38a54 - call $5251 - + call Function_0x39251 ret c call RNG - cp $14 ret c inc [hl] @@ -993,10 +974,8 @@ AIScoring_Ohko: ; 38a60 ld b, a ld a, [EnemyMonLevel] cp b - jp c, $5503 - - call $526e - + jp c, Function_0x39503 + call Function_0x3926e ret c inc [hl] ret @@ -1009,31 +988,27 @@ AIScoring_Bind: ; 38a71 jr nz, .asm_38a8b ld a, [PlayerSubStatus5] - bit 0, a + bit SUBSTATUS_TOXIC, a jr nz, .asm_38a91 ld a, [PlayerSubStatus1] - and $c9 + and 1< Date: Mon, 6 May 2013 11:41:12 -0400 Subject: [PATCH 107/112] residual status constants --- constants.asm | 6 ++++++ wram.asm | 1 + 2 files changed, 7 insertions(+) diff --git a/constants.asm b/constants.asm index 5fc98c585..cd461b3b9 100644 --- a/constants.asm +++ b/constants.asm @@ -3772,6 +3772,12 @@ 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 ; 7 turns diff --git a/wram.asm b/wram.asm index ed6f0d87c..5b59e0a7d 100644 --- a/wram.asm +++ b/wram.asm @@ -711,6 +711,7 @@ PlayerScreens: ; c6ff ; bit ; 4 reflect ; 3 light screen +; 2 safeguard ; 0 spikes ds 1 From 585904055596ed24899b5c87ba91b91fb9cb592f Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 6 May 2013 14:33:19 -0400 Subject: [PATCH 108/112] more thorough ai commenting --- battle/ai/scoring.asm | 495 +++++++++++++++++++++--------------------- main.asm | 32 +-- 2 files changed, 267 insertions(+), 260 deletions(-) diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index b65557bed..66aa1bbd1 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -1,8 +1,10 @@ -Function_0x38591: ; 38591 +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 -.asm_38599 +.checkmove dec b ret z @@ -12,7 +14,7 @@ Function_0x38591: ; 38591 ret z inc de - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMoveEffect] ld c, a @@ -26,36 +28,35 @@ Function_0x38591: ; 38591 pop bc pop de pop hl - jr nz, .asm_385d6 + jr nz, .discourage ld a, [EnemyMoveEffect] push hl push de push bc - ld hl, .table_385db + ld hl, .statusonlyeffects ld de, 1 call IsInArray pop bc pop de pop hl - jr nc, .asm_38599 + jr nc, .checkmove ld a, [BattleMonStatus] and a - jr nz, .asm_385d6 + jr nz, .discourage ld a, [PlayerScreens] - bit 2, a - jr z, .asm_38599 + bit SCREENS_SAFEGUARD, a + jr z, .checkmove -.asm_385d6 - call Function_0x39503 - - jr .asm_38599 +.discourage + call AIDiscourageMove + jr .checkmove ; 385db -.table_385db +.statusonlyeffects db EFFECT_SLEEP db EFFECT_TOXIC db EFFECT_POISON @@ -65,11 +66,13 @@ Function_0x38591: ; 38591 -Function_0x385e0: ; 385e0 +AIScoring_RedStatMods: ; 385e0 +; Use stat-modifying moves on turn 1. + ld hl, Buffer1 - 1 ld de, EnemyMonMoves ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.next +.checkmove dec b ret z @@ -79,71 +82,70 @@ Function_0x385e0: ; 385e0 ret z inc de - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMoveEffect] cp EFFECT_ATTACK_UP - jr c, .next + jr c, .checkmove cp EFFECT_EVASION_UP + 1 jr c, .statup ; cp EFFECT_ATTACK_DOWN - 1 - jr z, .next + jr z, .checkmove cp EFFECT_EVASION_DOWN + 1 jr c, .statdown cp EFFECT_ATTACK_UP_2 - jr c, .next + jr c, .checkmove cp EFFECT_EVASION_UP_2 + 1 jr c, .statup ; cp EFFECT_ATTACK_DOWN_2 - 1 - jr z, .next + jr z, .checkmove cp EFFECT_EVASION_DOWN_2 + 1 jr c, .statdown - jr .next + jr .checkmove .statup ld a, [EnemyTurnsTaken] and a - jr nz, .asm_3862a + jr nz, .discourage - jr .asm_38621 + jr .encourage .statdown ld a, [PlayerTurnsTaken] and a - jr nz, .asm_3862a + jr nz, .discourage -.asm_38621 +.encourage call Function_0x39527 - - jr c, .next + jr c, .checkmove dec [hl] dec [hl] - jr .next + jr .checkmove -.asm_3862a +.discourage call RNG - - cp $1e - jr c, .next - + cp 30 + jr c, .checkmove inc [hl] inc [hl] - jr .next + jr .checkmove ; 38635 -Function_0x38635: ; 38635 +AIScoring_RedSuperEffective: ; 38635 +; Use super-effective moves. + ld hl, Buffer1 - 1 ld de, EnemyMonMoves ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_3863d +.checkmove dec b ret z @@ -153,37 +155,35 @@ Function_0x38635: ; 38635 ret z inc de - call Function_0x39508 + call AIGetEnemyMove push hl push bc push de ld a, 1 ld [hBattleTurn], a - ld hl, $47c8 - ld a, $d - rst FarCall - + callab Function0x347c8 pop de pop bc pop hl + ld a, [$d265] and a - jr z, .asm_3869d - - cp $a - jr z, .asm_3863d - - jr c, .asm_3866c + jr z, .immune + cp 10 ; 1.0 + jr z, .checkmove + jr c, .noteffective +; effective ld a, [EnemyMovePower] and a - jr z, .asm_3863d - + jr z, .checkmove dec [hl] - jr .asm_3863d + jr .checkmove -.asm_3866c +.noteffective +; Discourage this move if there are any moves +; that do damage of a different type. push hl push de push bc @@ -192,7 +192,7 @@ Function_0x38635: ; 38635 ld hl, EnemyMonMoves ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 ld c, 0 -.asm_3867a +.checkmove2 dec b jr z, .asm_38693 @@ -200,17 +200,14 @@ Function_0x38635: ; 38635 and a jr z, .asm_38693 - call Function_0x39508 - + call AIGetEnemyMove ld a, [EnemyMoveType] cp d - jr z, .asm_3867a - + jr z, .checkmove2 ld a, [EnemyMovePower] and a jr nz, .asm_38692 - - jr .asm_3867a + jr .checkmove2 .asm_38692 ld c, a @@ -220,24 +217,24 @@ Function_0x38635: ; 38635 pop de pop hl and a - jr z, .asm_3863d - + jr z, .checkmove inc [hl] - jr .asm_3863d + jr .checkmove -.asm_3869d - call Function_0x39503 - - jr .asm_3863d +.immune + call AIDiscourageMove + jr .checkmove ; 386a2 -Function_0x386a2: ; 386a2 +AIScoring_Offensive: ; 386a2 +; Discourage non-damaging moves. + ld hl, Buffer1 - 1 ld de, EnemyMonMoves ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_386aa +.checkmove dec b ret z @@ -247,24 +244,26 @@ Function_0x386a2: ; 386a2 ret z inc de - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMovePower] and a - jr nz, .asm_386aa + jr nz, .checkmove inc [hl] inc [hl] - jr .asm_386aa + jr .checkmove ; 386be -Function_0x386be: ; 386be +AIScoring_Smart: ; 386be +; Context-specific scoring. + ld hl, Buffer1 ld de, EnemyMonMoves ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_386c6 +.checkmove dec b ret z @@ -276,7 +275,7 @@ Function_0x386be: ; 386be push de push bc push hl - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMoveEffect] ld hl, .table_386f2 @@ -284,27 +283,29 @@ Function_0x386be: ; 386be call IsInArray inc hl - jr nc, .asm_386ec + jr nc, .nextmove ld a, [hli] ld e, a ld d, [hl] + pop hl push hl - ld bc, .asm_386ec + + ld bc, .nextmove push bc + push de ret -.asm_386ec +.nextmove pop hl pop bc pop de inc hl - jr .asm_386c6 -; 386f2 + jr .checkmove -.table_386f2 ; 386f2 +.table_386f2 dbw EFFECT_SLEEP, AIScoring_Sleep dbw EFFECT_LEECH_HIT, AIScoring_LeechHit dbw EFFECT_EXPLOSION, AIScoring_Explosion @@ -424,7 +425,7 @@ AIScoring_LeechHit: ; 387f7 jr c, .asm_38815 ret z - call Function_0x39251 + call AICheckEnemyMaxHP ret c call Function_0x39521 @@ -449,11 +450,11 @@ AIScoring_LockOn: ; 3881d jr nz, .asm_38882 push hl - call Function_0x39298 + call AICheckEnemyQuarterHP jr nc, .asm_38877 - call Function_0x39281 + call AICheckEnemyHalfHP jr c, .asm_38834 @@ -488,7 +489,7 @@ AIScoring_LockOn: ; 3881d and a jr z, .asm_38877 - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMoveAccuracy] cp $b4 @@ -543,7 +544,7 @@ AIScoring_LockOn: ; 3881d jr z, .asm_388a2 inc de - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMoveAccuracy] cp $b4 @@ -556,7 +557,7 @@ AIScoring_LockOn: ; 3881d .asm_388a2 pop hl - jp Function_0x39503 + jp AIDiscourageMove ; 388a6 @@ -578,11 +579,11 @@ AIScoring_Explosion: ; 388a6 .asm_388b7 - call Function_0x39281 + call AICheckEnemyHalfHP jr c, .asm_388c6 - call Function_0x39298 + call AICheckEnemyQuarterHP ret nc call RNG @@ -613,9 +614,9 @@ AIScoring_DreamEater: ; 388ca AIScoring_EvasionUp: ; 388d4 ld a, [EnemyEvaLevel] cp $d - jp nc, Function_0x39503 + jp nc, AIDiscourageMove - call Function_0x39251 + call AICheckEnemyMaxHP jr nc, .asm_388f2 @@ -635,7 +636,7 @@ AIScoring_EvasionUp: ; 388d4 ret .asm_388f2 - call Function_0x39298 + call AICheckEnemyQuarterHP jr nc, .asm_3890f @@ -644,7 +645,7 @@ AIScoring_EvasionUp: ; 388d4 cp $a jr c, .asm_388ef - call Function_0x39281 + call AICheckEnemyHalfHP jr nc, .asm_3890a @@ -737,7 +738,7 @@ AIScoring_MirrorMove: ; 3895b call Function_0x39233 ret nc - jp Function_0x39503 + jp AIDiscourageMove .asm_38968 @@ -765,11 +766,11 @@ AIScoring_MirrorMove: ; 3895b AIScoring_AccuracyDown: ; 38985 - call Function_0x39246 + call AICheckPlayerMaxHP jr nc, .asm_389a0 - call Function_0x39281 + call AICheckEnemyHalfHP jr nc, .asm_389a0 @@ -789,7 +790,7 @@ AIScoring_AccuracyDown: ; 38985 ret .asm_389a0 - call Function_0x392b3 + call AICheckPlayerQuarterHP jr nc, .asm_389bd @@ -798,7 +799,7 @@ AIScoring_AccuracyDown: ; 38985 cp $a jr c, .asm_3899d - call Function_0x3926e + call AICheckPlayerHalfHP jr nc, .asm_389b8 @@ -903,7 +904,7 @@ AIScoring_Haze: ; 389f5 AIScoring_Bide: ; 38a1e - call Function_0x39251 + call AICheckEnemyMaxHP ret c call RNG cp $19 @@ -931,9 +932,9 @@ AIScoring_Heal: AIScoring_MorningSun: AIScoring_Synthesis: AIScoring_Moonlight: ; 38a3a - call Function_0x39298 + call AICheckEnemyQuarterHP jr nc, .asm_38a45 - call Function_0x39281 + call AICheckEnemyHalfHP ret nc inc [hl] ret @@ -950,7 +951,7 @@ AIScoring_Moonlight: ; 38a3a AIScoring_Toxic: AIScoring_LeechSeed: ; 38a4e - call Function_0x3926e + call AICheckPlayerHalfHP ret c inc [hl] ret @@ -959,7 +960,7 @@ AIScoring_LeechSeed: ; 38a4e AIScoring_LightScreen: AIScoring_Reflect: ; 38a54 - call Function_0x39251 + call AICheckEnemyMaxHP ret c call RNG cp $14 @@ -974,8 +975,8 @@ AIScoring_Ohko: ; 38a60 ld b, a ld a, [EnemyMonLevel] cp b - jp c, Function_0x39503 - call Function_0x3926e + jp c, AIDiscourageMove + call AICheckPlayerHalfHP ret c inc [hl] ret @@ -1006,7 +1007,7 @@ AIScoring_Bind: ; 38a71 ret .asm_38a91 - call Function_0x39298 + call AICheckEnemyQuarterHP ret nc call Function_0x39527 ret c @@ -1036,7 +1037,7 @@ AIScoring_Unused2B: ; 38a9c and a jr z, .asm_38ac1 - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMoveEffect] cp EFFECT_PROTECT @@ -1050,7 +1051,7 @@ AIScoring_Unused2B: ; 38a9c bit SUBSTATUS_CONFUSED, a jr nz, .asm_38acd - call Function_0x39281 + call AICheckEnemyHalfHP ret c .asm_38acd @@ -1072,14 +1073,14 @@ AIScoring_Unused2B: ; 38a9c AIScoring_Confuse: ; 38adb - call Function_0x3926e + call AICheckPlayerHalfHP ret c call RNG cp $19 jr c, .asm_38ae7 inc [hl] .asm_38ae7 - call Function_0x392b3 + call AICheckPlayerQuarterHP ret c inc [hl] ret @@ -1087,7 +1088,7 @@ AIScoring_Confuse: ; 38adb AIScoring_SpDefenseUp2: ; 38aed - call Function_0x39281 + call AICheckEnemyHalfHP jr nc, .asm_38b10 ld a, [EnemySDefLevel] @@ -1130,7 +1131,7 @@ AIScoring_Fly: ; 38b12 AIScoring_SuperFang: ; 38b20 - call Function_0x392b3 + call AICheckPlayerQuarterHP ret c inc [hl] ret @@ -1138,11 +1139,11 @@ AIScoring_SuperFang: ; 38b20 AIScoring_Paralyze: ; 38b26 - call Function_0x392b3 + call AICheckPlayerQuarterHP jr nc, .asm_38b3a call Function_0x39233 ret c - call Function_0x39298 + call AICheckEnemyQuarterHP ret nc call Function_0x39521 ret c @@ -1162,7 +1163,7 @@ AIScoring_SpeedDownHit: ; 38b40 ld a, [EnemyMoveAnimation] cp $c4 ret nz - call Function_0x39298 + call AICheckEnemyQuarterHP ret nc ld a, [PlayerTurnsTaken] and a @@ -1179,16 +1180,16 @@ AIScoring_SpeedDownHit: ; 38b40 AIScoring_Substitute: ; 38b5c - call Function_0x39281 + call AICheckEnemyHalfHP ret c - jp Function_0x39503 + jp AIDiscourageMove ; 38b63 AIScoring_HyperBeam: ; 38b63 - call Function_0x39281 + call AICheckEnemyHalfHP jr c, .asm_38b72 - call Function_0x39298 + call AICheckEnemyQuarterHP ret c call Function_0x39527 ret c @@ -1229,7 +1230,7 @@ AIScoring_Rage: ; 38b7f ret .asm_38b9b - call Function_0x39281 + call AICheckEnemyHalfHP jr nc, .asm_38ba6 call Function_0x39521 @@ -1248,12 +1249,12 @@ AIScoring_Mimic: ; 38ba8 and a jr z, .asm_38be9 - call Function_0x39281 + call AICheckEnemyHalfHP jr nc, .asm_38bef push hl ld a, [LastEnemyCounterMove] - call Function_0x39508 + call AIGetEnemyMove ld a, $1 ld [hBattleTurn], a @@ -1288,7 +1289,7 @@ AIScoring_Mimic: ; 38ba8 .asm_38be9 call Function_0x39233 - jp c, Function_0x39503 + jp c, AIDiscourageMove .asm_38bef inc [hl] @@ -1307,7 +1308,7 @@ AIScoring_Counter: ; 38bf1 and a jr z, .asm_38c0e - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMovePower] and a @@ -1335,7 +1336,7 @@ AIScoring_Counter: ; 38bf1 and a jr z, .asm_38c38 - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMovePower] and a @@ -1368,9 +1369,9 @@ AIScoring_Encore: ; 38c3b ld a, [LastPlayerMove] and a - jp z, Function_0x39503 + jp z, AIDiscourageMove - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMovePower] and a @@ -1506,7 +1507,7 @@ AIScoring_Spite: ; 38cd5 jr nz, .asm_38ce7 call Function_0x39233 - jp c, Function_0x39503 + jp c, AIDiscourageMove call Function_0x39527 ret c @@ -1559,14 +1560,14 @@ AIScoring_Spite: ; 38cd5 Function_0x38d16; 38d16 - jp Function_0x39503 + jp AIDiscourageMove ; 38d19 AIScoring_DestinyBond: AIScoring_Reversal: AIScoring_SkullBash: ; 38d19 - call Function_0x39298 + call AICheckEnemyQuarterHP ret nc inc [hl] ret @@ -1625,7 +1626,7 @@ AIScoring_HealBell: ; 38d1f ld a, [EnemyMonStatus] and a ret nz - jp Function_0x39503 + jp AIDiscourageMove ; 38d5a @@ -1636,7 +1637,7 @@ AIScoring_PriorityHit: ; 38d5a ret c ld a, [PlayerSubStatus3] and $60 - jp nz, Function_0x39503 + jp nz, AIDiscourageMove ld a, $1 ld [hBattleTurn], a @@ -1759,7 +1760,7 @@ AIScoring_Disable: ; 38dd1 AIScoring_MeanLook: ; 38dfb - call Function_0x39281 + call AICheckEnemyHalfHP jr nc, .asm_38e24 @@ -1767,7 +1768,7 @@ AIScoring_MeanLook: ; 38dfb call Function_0x38e2e pop hl - jp z, Function_0x39503 + jp z, AIDiscourageMove ld a, [EnemySubStatus5] bit 0, a @@ -1860,7 +1861,7 @@ AIScoring_Curse: ; 38e5c cp $8 jr z, .asm_38e95 - call Function_0x39281 + call AICheckEnemyHalfHP jr nc, .asm_38e93 @@ -1900,7 +1901,7 @@ AIScoring_Curse: ; 38e5c .asm_38e95 ld a, [PlayerSubStatus1] bit 1, a - jp nz, Function_0x39503 + jp nz, AIDiscourageMove push hl ld a, $d @@ -1928,15 +1929,15 @@ AIScoring_Curse: ; 38e5c .asm_38eb7 - call Function_0x39298 + call AICheckEnemyQuarterHP jp nc, .asm_38e90 - call Function_0x39281 + call AICheckEnemyHalfHP jr nc, .asm_38e92 - call Function_0x39251 + call AICheckEnemyMaxHP ret nc ld a, [PlayerTurnsTaken] @@ -2106,7 +2107,7 @@ AIScoring_Sandstorm: ; 38f7a pop hl jr c, .asm_38fa5 - call Function_0x3926e + call AICheckPlayerHalfHP jr nc, .asm_38fa6 call Function_0x39527 @@ -2135,11 +2136,11 @@ AIScoring_Endure: ; 38fac and a jr nz, .asm_38fd8 - call Function_0x39251 + call AICheckEnemyMaxHP jr c, .asm_38fd8 - call Function_0x39298 + call AICheckEnemyQuarterHP jr c, .asm_38fd9 @@ -2211,7 +2212,7 @@ AIScoring_Rollout: ; 38fef bit 6, a jr nz, .asm_39020 - call Function_0x39298 + call AICheckEnemyQuarterHP jr nc, .asm_39020 @@ -2263,7 +2264,7 @@ AIScoring_Attract: ; 39026 AIScoring_Safeguard: ; 3903a - call Function_0x3926e + call AICheckPlayerHalfHP ret c call Function_0x39521 @@ -2318,7 +2319,7 @@ AIScoring_BatonPass: ; 39062 AIScoring_Pursuit: ; 39072 - call Function_0x392b3 + call AICheckPlayerQuarterHP jr nc, .asm_3907d @@ -2460,7 +2461,7 @@ Function_0x3910d: ; 3910d pop hl jr nc, Function_0x3911e - call Function_0x3926e + call AICheckPlayerHalfHP jr nc, Function_0x3911e call Function_0x39527 @@ -2476,7 +2477,7 @@ Function_0x3911e: ; 3911e ret Function_0x39122: ; 39122 - call Function_0x3926e + call AICheckPlayerHalfHP ret nc ld a, [PlayerTurnsTaken] @@ -2512,11 +2513,11 @@ AIScoring_BellyDrum: ; 3913d cp $a jr nc, .asm_3914d - call Function_0x39251 + call AICheckEnemyMaxHP ret c inc [hl] - call Function_0x39281 + call AICheckEnemyHalfHP ret c @@ -2589,7 +2590,7 @@ AIScoring_MirrorCoat: ; 3918b and a jr z, .asm_391a8 - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMovePower] and a @@ -2617,7 +2618,7 @@ AIScoring_MirrorCoat: ; 3918b and a jr z, .asm_391d2 - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMovePower] and a @@ -2753,17 +2754,17 @@ Function_0x39233: ; 39233 ; 39246 -Function_0x39246: ; 39246 +AICheckPlayerMaxHP: ; 39246 push hl push de push bc ld de, BattleMonHP ld hl, BattleMonMaxHP - jr Function_0x3925a + jr AICheckMaxHP ; 39251 -Function_0x39251: ; 39251 +AICheckEnemyMaxHP: ; 39251 push hl push de push bc @@ -2773,7 +2774,8 @@ Function_0x39251: ; 39251 ; 3925a -Function_0x3925a: ; 3925a +AICheckMaxHP: ; 3925a +; Return carry if hp at de matches max hp at hl. ld a, [de] inc de cp [hl] @@ -2799,7 +2801,7 @@ Function_0x3925a: ; 3925a ; 3926e -Function_0x3926e: ; 3926e +AICheckPlayerHalfHP: ; 3926e push hl ld hl, BattleMonHP ld b, [hl] @@ -2818,7 +2820,7 @@ Function_0x3926e: ; 3926e ; 39281 -Function_0x39281: ; 39281 +AICheckEnemyHalfHP: ; 39281 push hl push de push bc @@ -2841,7 +2843,7 @@ Function_0x39281: ; 39281 ; 39298 -Function_0x39298: ; 39298 +AICheckEnemyQuarterHP: ; 39298 push hl push de push bc @@ -2866,7 +2868,7 @@ Function_0x39298: ; 39298 ; 392b3 -Function_0x392b3: ; 392b3 +AICheckPlayerQuarterHP: ; 392b3 push hl ld hl, BattleMonHP ld b, [hl] @@ -2897,7 +2899,7 @@ Function_0x392ca: ; 392ca and a jr z, .asm_392e0 - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMoveEffect] cp b @@ -2975,11 +2977,13 @@ Table_0x39301: ; 39301 ; 39315 -Function_0x39315: ; 39315 - call Function_0x39281 +AIScoring_Opportunist: ; 39315 +; Don't use stall moves when the player's HP is low. + + call AICheckEnemyHalfHP ret c - call Function_0x39298 + call AICheckEnemyQuarterHP jr nc, .asm_39322 call Function_0x39527 @@ -2989,7 +2993,7 @@ Function_0x39315: ; 39315 ld hl, Buffer1 - 1 ld de, EnemyMonMoves ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_3932a +.checkmove inc hl dec c jr z, .asm_39347 @@ -3002,22 +3006,22 @@ Function_0x39315: ; 39315 push hl push de push bc - ld hl, .table_39348 + ld hl, .stallmoves ld de, 1 call IsInArray pop bc pop de pop hl - jr nc, .asm_3932a + jr nc, .checkmove inc [hl] - jr .asm_3932a + jr .checkmove .asm_39347 ret -.table_39348 +.stallmoves db SWORDS_DANCE db TAIL_WHIP db LEER @@ -3055,101 +3059,101 @@ Function_0x39315: ; 39315 -Function_0x39369: ; 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 -.asm_39372 +.checkmove inc b ld a, b cp EnemyMonMovesEnd - EnemyMonMoves + 1 - jr z, .asm_393a8 + jr z, .gotstrongestmove ld a, [hli] and a - jr z, .asm_393a8 + jr z, .gotstrongestmove push hl push de push bc - call Function_0x39508 - + call AIGetEnemyMove ld a, [EnemyMovePower] and a - jr z, .asm_393a3 - - call Function_0x393e7 - + jr z, .nodamage + call AIDamageCalc pop bc pop de pop hl + ld a, [CurDamage + 1] cp e ld a, [CurDamage] sbc d - jr c, .asm_39372 + jr c, .checkmove ld a, [CurDamage + 1] ld e, a ld a, [CurDamage] ld d, a ld c, b - jr .asm_39372 + jr .checkmove -.asm_393a3 +.nodamage pop bc pop de pop hl - jr .asm_39372 + jr .checkmove -.asm_393a8 +.gotstrongestmove +; Nothing we can do if no attacks did damage. ld a, c and a - jr z, .asm_393e1 + jr z, .done +; Discourage moves that do less damage unless they're reckless too. ld hl, Buffer1 - 1 ld de, EnemyMonMoves ld b, 0 -.asm_393b4 +.checkmove2 inc b ld a, b cp EnemyMonMovesEnd - EnemyMonMoves + 1 - jr z, .asm_393e1 + jr z, .done cp c ld a, [de] inc de inc hl - jr z, .asm_393b4 + jr z, .checkmove2 - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMovePower] - cp $2 - jr c, .asm_393b4 + cp 2 + jr c, .checkmove2 push hl push de push bc ld a, [EnemyMoveEffect] - ld hl, Table_0x393e2 + ld hl, .aggressivemoves ld de, 1 call IsInArray pop bc pop de pop hl - jr c, .asm_393b4 + jr c, .checkmove2 inc [hl] - jr .asm_393b4 + jr .checkmove2 -.asm_393e1 +.done ret -; 393e2 - - -Table_0x393e2: ; 393e2 +.aggressivemoves db EFFECT_EXPLOSION db EFFECT_RAMPAGE db EFFECT_MULTI_HIT @@ -3158,7 +3162,7 @@ Table_0x393e2: ; 393e2 ; 393e7 -Function_0x393e7: ; 393e7 +AIDamageCalc: ; 393e7 ld a, 1 ld [hBattleTurn], a ld a, [EnemyMoveEffect] @@ -3184,7 +3188,9 @@ Function_0x393e7: ; 393e7 ; 39418 -Function_0x39418: ; 39418 +AIScoring_Cautious: ; 39418 +; Don't use moves with residual effects after turn 1. + ld a, [EnemyTurnsTaken] and a ret z @@ -3205,7 +3211,7 @@ Function_0x39418: ; 39418 push hl push de push bc - ld hl, .table_39446 + ld hl, .residualmoves ld de, 1 call IsInArray @@ -3215,13 +3221,13 @@ Function_0x39418: ; 39418 jr nc, .asm_39425 call RNG - cp $e6 + cp 230 ret nc inc [hl] jr .asm_39425 -.table_39446 +.residualmoves db MIST db LEECH_SEED db POISONPOWDER @@ -3239,11 +3245,13 @@ Function_0x39418: ; 39418 -Function_0x39453: ; 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 -.asm_3945b +.checkmove dec b ret z @@ -3253,64 +3261,61 @@ Function_0x39453: ; 39453 ret z inc de - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMoveEffect] cp EFFECT_TOXIC - jr z, .asm_39480 + jr z, .poisonimmunity cp EFFECT_POISON - jr z, .asm_39480 + jr z, .poisonimmunity cp EFFECT_SLEEP - jr z, .asm_3948e + jr z, .typeimmunity cp EFFECT_PARALYZE - jr z, .asm_3948e + jr z, .typeimmunity ld a, [EnemyMovePower] and a - jr z, .asm_3945b + jr z, .checkmove - jr .asm_3948e + jr .typeimmunity -.asm_39480 +.poisonimmunity ld a, [BattleMonType1] cp POISON - jr z, .asm_394a4 + jr z, .immune ld a, [BattleMonType2] cp POISON - jr z, .asm_394a4 + jr z, .immune -.asm_3948e +.typeimmunity push hl push bc push de - ld a, 1 ld [hBattleTurn], a - - ld hl, $47c8 - ld a, $d - rst FarCall - + callab Function0x347c8 pop de pop bc pop hl ld a, [$d265] and a - jr nz, .asm_3945b + jr nz, .checkmove -.asm_394a4 - call Function_0x39503 - jr .asm_3945b +.immune + call AIDiscourageMove + jr .checkmove ; 394a9 -Function_0x394a9: ; 394a9 +AIScoring_Risky: ; 394a9 +; Use any move that will KO the opponent. + ld hl, Buffer1 - 1 ld de, EnemyMonMoves ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 -.asm_394b1 +.checkmove inc hl dec c ret z @@ -3323,27 +3328,28 @@ Function_0x394a9: ; 394a9 push de push bc push hl - call Function_0x39508 + call AIGetEnemyMove ld a, [EnemyMovePower] and a - jr z, .asm_394fa + jr z, .nextmove +; Don't use risky moves at max hp. ld a, [EnemyMoveEffect] ld de, 1 - ld hl, .table_394ff + ld hl, .riskymoves call IsInArray - jr nc, .asm_394de + jr nc, .checkko - call Function_0x39251 - jr c, .asm_394fa + call AICheckEnemyMaxHP + jr c, .nextmove call RNG - cp $c8 - jr c, .asm_394fa + cp 200 ; 1/5 + jr c, .nextmove -.asm_394de - call Function_0x393e7 +.checkko + call AIDamageCalc ld a, [CurDamage + 1] ld e, a @@ -3353,7 +3359,7 @@ Function_0x394a9: ; 394a9 cp e ld a, [BattleMonHP] sbc d - jr nc, .asm_394fa + jr nc, .nextmove pop hl dec [hl] @@ -3362,13 +3368,14 @@ Function_0x394a9: ; 394a9 dec [hl] dec [hl] push hl -.asm_394fa + +.nextmove pop hl pop bc pop de - jr .asm_394b1 + jr .checkmove -.table_394ff +.riskymoves db EFFECT_EXPLOSION db EFFECT_OHKO db $ff @@ -3376,12 +3383,12 @@ Function_0x394a9: ; 394a9 -Function_0x39502: ; 39502 +AIScoring_None: ; 39502 ret ; 39503 -Function_0x39503: ; 39503 +AIDiscourageMove: ; 39503 ld a, [hl] add 10 ld [hl], a @@ -3389,7 +3396,7 @@ Function_0x39503: ; 39503 ; 39508 -Function_0x39508: ; 39508 +AIGetEnemyMove: ; 39508 push hl push de push bc diff --git a/main.asm b/main.asm index 800ba875e..89f7ed0a5 100644 --- a/main.asm +++ b/main.asm @@ -8514,22 +8514,22 @@ AIChooseMove: ; 440ce AIScoringPointers: ; 441af - dw Function_0x38591 - dw Function_0x385e0 - dw Function_0x38635 - dw Function_0x386a2 - dw Function_0x386be - dw Function_0x39315 - dw Function_0x39369 - dw Function_0x39418 - dw Function_0x39453 - dw Function_0x394a9 - dw Function_0x39502 - dw Function_0x39502 - dw Function_0x39502 - dw Function_0x39502 - dw Function_0x39502 - dw Function_0x39502 + 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 From 573db5b1b451a901404627696c685c10ab35085b Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 6 May 2013 20:51:07 -0400 Subject: [PATCH 109/112] more ai cleanup --- battle/ai/scoring.asm | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index 66aa1bbd1..a509db6f6 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -458,7 +458,7 @@ AIScoring_LockOn: ; 3881d jr c, .asm_38834 - call Function_0x39233 + call AICompareSpeed jr nc, .asm_38877 @@ -735,7 +735,7 @@ AIScoring_MirrorMove: ; 3895b and a jr nz, .asm_38968 - call Function_0x39233 + call AICompareSpeed ret nc jp AIDiscourageMove @@ -753,7 +753,7 @@ AIScoring_MirrorMove: ; 3895b ret c dec [hl] - call Function_0x39233 + call AICompareSpeed ret nc call RNG @@ -1121,7 +1121,7 @@ AIScoring_Fly: ; 38b12 ld a, [PlayerSubStatus3] and 1< Date: Tue, 7 May 2013 00:58:35 -0400 Subject: [PATCH 110/112] even more ai cleanup --- battle/ai/scoring.asm | 320 +++++++++++++++++------------------------- 1 file changed, 125 insertions(+), 195 deletions(-) diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index a509db6f6..b48e04bc6 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -391,19 +391,16 @@ AIScoring_Smart: ; 386be AIScoring_Sleep: ; 387e3 - ld b, $8 - call Function_0x392ca - + ld b, EFFECT_DREAM_EATER + call AIHasMove jr c, .asm_387f0 - ld b, $6b - call Function_0x392ca - + ld b, EFFECT_NIGHTMARE + call AIHasMove ret nc .asm_387f0 call Function_0x39527 - ret c dec [hl] dec [hl] @@ -413,15 +410,13 @@ AIScoring_Sleep: ; 387e3 AIScoring_LeechHit: ; 387f7 push hl - ld a, $1 + ld a, 1 ld [hBattleTurn], a - ld hl, $47c8 - ld a, $d - rst FarCall - + callab Function0x347c8 pop hl + ld a, [$d265] - cp $a + cp 10 ; 1.0 jr c, .asm_38815 ret z @@ -564,31 +559,24 @@ AIScoring_LockOn: ; 3881d AIScoring_Explosion: ; 388a6 push hl - ld a, $d - ld hl, $49f4 - rst FarCall - + callba Function0x349f4 pop hl jr nc, .asm_388b7 push hl - call Function_0x38e2e - + call AICheckLastPlayerMon pop hl jr nz, .asm_388c6 - .asm_388b7 call AICheckEnemyHalfHP - jr c, .asm_388c6 call AICheckEnemyQuarterHP - ret nc - call RNG - cp $14 + call RNG + cp 20 ret c .asm_388c6 @@ -916,9 +904,7 @@ AIScoring_Bide: ; 38a1e AIScoring_Whirlwind: ; 38a2a push hl - ld hl, $484e - ld a, $d - rst FarCall + callab Function0x3484e ld a, [$c716] cp $a pop hl @@ -1171,7 +1157,7 @@ AIScoring_SpeedDownHit: ; 38b40 call AICompareSpeed ret c call RNG - cp $1e + cp 30 ret c dec [hl] dec [hl] @@ -1198,7 +1184,7 @@ AIScoring_HyperBeam: ; 38b63 .asm_38b72 call RNG - cp $28 + cp 40 ret c inc [hl] call Function_0x39527 @@ -1725,7 +1711,6 @@ AIScoring_Conversion2: ; 38d98 AIScoring_Disable: ; 38dd1 call AICompareSpeed - jr nc, .asm_38df3 push hl @@ -1738,8 +1723,7 @@ AIScoring_Disable: ; 38dd1 jr nc, .asm_38dee call RNG - - cp $64 + cp 100 ret c dec [hl] ret @@ -1751,8 +1735,7 @@ AIScoring_Disable: ; 38dd1 .asm_38df3 call RNG - - cp $14 + cp 20 ret c inc [hl] ret @@ -1761,28 +1744,23 @@ AIScoring_Disable: ; 38dd1 AIScoring_MeanLook: ; 38dfb call AICheckEnemyHalfHP - jr nc, .asm_38e24 push hl - call Function_0x38e2e - + call AICheckLastPlayerMon pop hl jp z, AIDiscourageMove ld a, [EnemySubStatus5] - bit 0, a + bit SUBSTATUS_TOXIC, a jr nz, .asm_38e26 ld a, [PlayerSubStatus1] - and $c9 + and 1< Date: Tue, 7 May 2013 00:58:53 -0400 Subject: [PATCH 111/112] disable automatic line ending correction on windows, carriage returns were being inserted into binary files, causing compiling errors --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes 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 From 2aa20af120bb8571079ffd7d097f54626ef808b4 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 7 May 2013 01:33:13 -0400 Subject: [PATCH 112/112] correct line ending handling --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 3971c045e..63c2cad28 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ # No monkey business with line endings -* text=false +* -text