# Context Research Notes

These notes are the compact source-memory packet for this course. Fresh agents should read this file before planning, previewing, generating, or regenerating course work.

## Research Scope
- Source count: 2198
- Chunk count: 50348
- Summary: Reviewed 50348 extracted context chunk(s) for '# Learning Prompt I want to learn the technical architecture of a data-driven creature-collector RPG, using Pokemon FireRed as the primar...'. Strong recurring terms include pokemon, showdown, learnsets, mods, pokefirered, src, moves, species. Prioritize modules pokemon-showdown/data, pokefirered/src, pokemon-showdown/server, pokemon-showdown/test. Use high-signal sources such as pokemon-showdown/data/learnsets.ts, pokemon-showdown/data/mods/gen9dlc1/learnsets.ts, pokemon-showdown/data/mods/gen9predlc/learnsets.ts, pokemon-showdown/data/mods/gen8dlc1/learnsets.ts throughout the syllabus, lectures, labs, and assessments, citing source paths and chunk IDs from the research packet.

## Operating Requirements
- Fresh agents should read context_research.md before planning or generation.
- Course plans should use the listed source modules as recurring examples.
- Lectures should cite listed source paths and chunk IDs whenever relevant.
- Provider prompts must use compact research packets instead of full raw sources.

## AI Research Synthesis

## 1. Source-grounded course thesis

Teach FireRed as a stack of cooperating state machines plus data tables: callback/task shell, overworld/map runtime, script/progression VM, creature/party model, battle engine, inventory/UI, and save persistence. FireRed must be the main authority; Pokemon Showdown is only a secondary comparison for battle data modeling and deterministic battle tests.

A strong course arc should repeatedly trace “data table -> runtime globals -> callback/task/script -> player-visible behavior,” using FireRed chunks first.

## 2. Modules and examples to reuse repeatedly

- Runtime shell: `pokefirered/src/main.c` `chunk_b35676322b169f85` for `AgbMain`, `chunk_6cfd90f6d0136799` for `SetMainCallback2`; `pokefirered/src/task.c` `chunk_cb0bb91a147bfb59` for `CreateTask`, `chunk_3ffebc0341225936` for `RunTasks`.

- Overworld/maps: `pokefirered/src/overworld.c` `chunk_7ca71901368c46f7` for `CB2_Overworld`, `chunk_f00e575dedd069ed` for map data load, `chunk_9b2a7fa129935fc9` for warp destination, `chunk_7ea6afd1253d6817` for `LoadMapFromWarp`; `pokefirered/src/fieldmap.c` `chunk_642df7a31e75f54c`, `chunk_eeb0180842f7ece9`, `chunk_77ef7f3f8bff9777`; map data: `pokefirered/data/maps/PalletTown/map.json` `chunk_05643f6bfaa3b9bf`, `chunk_d9230295268d174e`, `chunk_78fe219f3e95e77c`.

- Input/events/scripts: `pokefirered/src/field_control_avatar.c` `chunk_636f753078bf545a`, `chunk_79332c416dfb6ac9`, `chunk_4488cb84aee4d6dd`; `pokefirered/src/script.c` `chunk_1be14bbdaf5c3400`, `chunk_03258f0288d89251`, `chunk_d424688149aa3bcb`; `pokefirered/src/scrcmd.c` `chunk_c2a54fb6031b5886`, `chunk_14e32f1ccb059ddb`, `chunk_7609d397203c8536`, `chunk_807732cfca4f56de`; flags/vars: `pokefirered/src/event_data.c` `chunk_a13cdbcb283dbf3b`, `chunk_bff5bbc2efc3008f`, `chunk_b8160166cd1a306b`.

- Creature model: `pokefirered/include/pokemon.h` `chunk_55fc8220f5b93cdc`, `chunk_8e98575ccadc6d51`, `chunk_2cc1cd9d6bfc7136`, `chunk_9b5ff7d0cd9f4c67`; `pokefirered/src/data/pokemon/species_info.h` `chunk_99a58307a160a13c`, `chunk_2e759c52d0f4129a`; `pokefirered/src/pokemon.c` `chunk_af8613c6e25be253`, `chunk_4573760bdda53819`, `chunk_f56e3a6588d98715`, `chunk_c089f03b70501fda`, `chunk_9c96aedd5b8237e6`.

- Battle system: `pokefirered/src/battle_setup.c` `chunk_0e0ab33ad5402d71`, `chunk_db24b720e895b599`, `chunk_a8e4b22a367933e7`; `pokefirered/src/battle_main.c` `chunk_2017de6d7013d2b7`, `chunk_568e3366056a9ce4`, `chunk_a15739d3170f73c1`, `chunk_1c5a1226d8d9afb7`, `chunk_46361bdbd92dae37`; `pokefirered/src/battle_script_commands.c` `chunk_9779e386ddb42cb0`, `chunk_c405e26d69cb40ac`, `chunk_98989865d85f275c`; AI: `pokefirered/src/battle_ai_script_commands.c` `chunk_0a05fcecbd58029f`, `chunk_34a415cc38858fdc`.

- Inventory/save: `pokefirered/src/item.c` `chunk_1b104a09a7f41ad7`, `chunk_296b886a4f0b7cc8`, `chunk_352eff45b08b4413`; `pokefirered/src/item_use.c` `chunk_7e88bbaddbab5bb9`, `chunk_8f5c0eba4013eb8a`, `chunk_ce2671932ba5ff71`; `pokefirered/src/load_save.c` `chunk_0755fbe98f753bb7`, `chunk_3efebaad2e0f31e0`, `chunk_d615017937c86ab6`; `pokefirered/src/save.c` `chunk_ab80cd8f4fa87d77`, `chunk_852fbc242f85cc74`, `chunk_9900b8674c89af66`.

- Showdown secondary examples: `pokemon-showdown/data/moves.ts` `chunk_012eada95ff7aa5f`, `chunk_c6f042becf151fe4`; `pokemon-showdown/data/abilities.ts` `chunk_da22cf969179258c`, `chunk_d827ca710967a7a5`; deterministic tests: `pokemon-showdown/test/TESTS.md` `chunk_134ac9f75b9d6477`, `pokemon-showdown/test/common.js` `chunk_979fde4c3177ea4f`, `pokemon-showdown/test/assert.js` `chunk_26026d44764fa919`, `chunk_f2ab14d37f397660`.

## 3. Required citation behavior for lectures

Every lecture claim about implementation must cite `source path + chunk_id`. Do not cite only a path.

Use FireRed citations first. Showdown citations must be labeled as secondary comparison, especially for data-driven move/ability hooks and testing.

If a lecture names a function, struct, global, or data table, cite the chunk containing that symbol, not a nearby module summary.

Do not cite `scripts.inc`, `text.inc`, `battle_scripts_1.s`, `battle_scripts_2.s`, or `map_events.s` as packet evidence unless they are re-ingested with chunk IDs; they exist in raw context but are missing from the extracted manifest.

## 4. Fresh-agent reading notes

Start with runtime control: `main.c`, `task.c`, then `overworld.c`. Next read map/input/script flow: `fieldmap.c`, `field_control_avatar.c`, `script.c`, `scrcmd.c`, `event_data.c`.

Then teach creature data before battle: `pokemon.h`, `species_info.h`, `pokemon.c`, level-up/evolution tables. Battle lectures should start with `battle_setup.c`, then `battle_main.c`, then `battle_script_commands.c`, then AI/data tables.

Inventory and save should be late-course integration modules: item data/use functions, party menu interactions, save blocks, save-sector load/write flow.

Suggested module order: architecture shell, overworld/maps, scripts/progression, creature model, battle setup/turns/scripts/AI, inventory/party/UI, save/load, then Showdown comparison/testing lab.

## 5. Gaps to avoid overclaiming

The packet’s deterministic summary overweights Showdown learnsets because those files are huge. Do not let `pokemon-showdown/data/learnsets.ts` replace FireRed as the primary architecture source.

Modern Showdown data is not FireRed Gen 3 behavior. Use it for modeling patterns, not factual FireRed mechanics.

Some important script assembly/data files lack chunk IDs in this packet. Treat missing chunks as a research gap, not evidence.

FireRed decomp names and comments are reverse-engineered source context. Cite exact chunks and avoid claiming original author intent unless the code directly supports it.

## AI Module Notes

### pokemon-showdown/data

## 1. What this module teaches well

`pokemon-showdown/data` is useful as a secondary battle-data module, not as the main architecture source for a FireRed-style RPG.

It teaches:

- Data-driven battle mechanics: abilities are declarative objects with hooks like `onStart`, `onModifyMove`, `onResidual`, `onDamagingHit`, and priority fields.
- How battle data and battle engine code communicate through shared objects: `pokemon`, `move`, `target`, `source`, `effectState`, `this.dex`, and `this.boost`.
- Ability metadata modeling: names, numeric IDs, flags, ratings, and comments that classify mechanical usefulness.
- Runtime event hooks: examples include damage-triggered boosts, residual damage, trapping, move mutation, form change, immunity checks, and base-power modification.
- Good comparison material against FireRed’s harder-to-read C systems, especially for teaching “mechanic as data plus callbacks.”

## 2. Best citable source paths and chunk IDs

- `pokemon-showdown/data/abilities.ts`, `chunk_da22cf969179258c`  
  Best citation for ability metadata and rating taxonomy. Use when explaining that Showdown stores not only mechanics but also structured evaluative metadata like `rating`, `num`, and documented usefulness categories.

- `pokemon-showdown/data/abilities.ts`, `chunk_d5bdb17c16d6f1a4`  
  Best citation for ability hooks that mutate battle behavior: `Stamina` boosting Defense on damage, `Stance Change` modifying form based on move choice, and `Stalwart` touching target-tracking behavior.

- `pokemon-showdown/data/abilities.ts`, `chunk_07722ae02858cfc1`  
  Best citation for abilities querying battle state: `Anticipation` scans opposing moves and type effectiveness; `Arena Trap` uses adjacency and grounded checks to trap foes.

- `pokemon-showdown/data/abilities.ts`, `chunk_b4a38d21b0114ee8`  
  Best citation for residual-phase and priority-based mechanics: `Bad Dreams` damages sleeping foes during residual processing; `Aura Break` and `Battery` show base-power hooks and priority fields.

- `pokemon-showdown/data/abilities.ts`, `chunk_6372bce3e311c10b`  
  Best citation for data/engine split. `Dancer` is noted as implemented in `runMove` in `scripts.js`, while `Dark Aura` uses ability hooks and `chainModify`.

- `pokemon-showdown/data/abilities.ts`, `chunk_8a03d04894b7e127`  
  Best citation for complex state-changing abilities: `Imposter` transforms into a target; `Infiltrator` mutates move behavior; `Innards Out` reacts to damaging hits.

Also named by the packet but not chunk-citable here:

- `pokemon-showdown/data/FORMES.md`
- `pokemon-showdown/data/aliases.ts`

These should be retrieved before building lectures around formes or aliases, because this packet names them but does not provide chunk IDs or excerpts.

## 3. Lecture and lab ideas grounded in the sources

- Lecture: “Ability as data plus event hooks”  
  Use `abilities.ts` chunks `chunk_d5bdb17c16d6f1a4`, `chunk_b4a38d21b0114ee8`, and `chunk_8a03d04894b7e127` to show how a battle engine calls mechanic-specific hooks instead of hardcoding every ability in one switch.

- Lecture: “Battle runtime phases through ability hooks”  
  Build a phase map: battle start, move modification, targeting, damage hit, residual effects, trapping, base-power modification. Cite `chunk_07722ae02858cfc1`, `chunk_b4a38d21b0114ee8`, and `chunk_6372bce3e311c10b`.

- Lab: “Implement three Showdown-style abilities in a tiny battle simulator”  
  Implement `Stamina`, `Bad Dreams`, and `Infiltrator` as data objects with callbacks. Students practice passing `pokemon`, `move`, `target`, and `battle` context into hooks.

- Lab: “Compare Showdown hooks to FireRed battle code”  
  Have students map Showdown’s `onDamagingHit`, `onResidual`, and `onModifyMove` concepts onto FireRed’s battle script/effect flow. Showdown clarifies the mechanic shape; FireRed remains the source of truth for the complete game architecture.

- Lecture: “Data tables are not just stats”  
  Use `chunk_da22cf969179258c` to show metadata such as `rating`, `num`, `flags`, and comments. Connect this to FireRed’s creature, move, item, and ability tables.

## 4. Coverage risks or missing context

- This packet is battle-mechanics-heavy. It does not cover overworld, maps, NPC movement, scripting, inventory, save/load, party UI, field moves, story flags, or map events.

- The available chunks only cite `pokemon-showdown/data/abilities.ts`. The packet says to anchor in `FORMES.md` and `aliases.ts`, but no chunk IDs are provided for those files, so they are not yet safe as cited evidence.

- Showdown is not a complete RPG architecture reference. It is best used to explain data-driven battle modeling, while FireRed must remain the primary source for full-game systems.

- Some mechanics explicitly depend on engine code outside this module, such as `Dancer` being implemented in `runMove` in `scripts.js` per `chunk_6372bce3e311c10b`. A course lesson should avoid implying `data/abilities.ts` alone fully implements battle behavior.

### pokefirered/src

## 1. What this module teaches well

- **Battle AI as a small script VM**, especially command-pointer control flow via `sAIScriptPtr`.
- **Party-aware AI decisions**: AI commands inspect `gEnemyParty` or `gPlayerParty`, iterate `PARTY_SIZE`, and query per-mon fields with `GetMonData`.
- **Concrete FireRed data access patterns**: `MON_DATA_SPECIES`, `MON_DATA_HP`, and status fields show how battle logic reads structured Pokemon data without directly poking struct internals.
- **Source-level bug discussion**: the packet includes a commented warning that `Cmd_if_status_not_in_party` is “bugged” and unused, useful for teaching how reverse-engineered projects preserve implementation quirks.

## 2. Best citable source paths and chunk IDs

- `pokefirered/src/battle_ai_script_commands.c` — `chunk_34a415cc38858fdc`
  - Best for: battle AI command dispatch, party scanning, status predicates, `sAIScriptPtr` branching, `gEnemyParty` / `gPlayerParty`, `GetMonData`, `PARTY_SIZE`.
  - Citable claim: FireRed’s battle AI can inspect party members by selecting a party, iterating slots, reading species / HP / status, and changing the AI script pointer when a condition matches.

Named by packet but **not citable yet without chunk IDs/excerpts**:

- `pokefirered/src/AgbRfu_LinkManager.c`
- `pokefirered/src/agb_flash.c`
- `pokefirered/src/agb_flash_1m.c`

These are likely useful for link communication and cartridge flash save architecture, but this packet does not provide chunk IDs for source-backed claims.

## 3. Lecture and lab ideas grounded in the sources

- **Lecture: “Battle AI Commands Are Scripted Predicates”**
  - Anchor: `pokefirered/src/battle_ai_script_commands.c`, `chunk_34a415cc38858fdc`.
  - Teach how an AI command reads operands from `sAIScriptPtr`, checks party data, and either jumps with `T1_READ_PTR` or advances the script pointer.

- **Lab: Rebuild `if_status_in_party` as pseudocode**
  - Students write a minimal clone function:
    ```c
    for each mon in selected_party:
        if species exists and hp > 0 and status == target:
            jump(ai_script_ptr + operand_offset)
        else:
            continue
    advance_script_pointer()
    ```
  - Goal: connect AI scripting to party structs and condition-based branching.

- **Lab: Analyze the unused bug**
  - Anchor: `Cmd_if_status_not_in_party`, `chunk_34a415cc38858fdc`.
  - Ask students to explain why “doesnt return properly” could matter in a bytecode/script-command interpreter.

- **Lecture candidate requiring more chunks: Save and hardware persistence**
  - Paths to pull next: `pokefirered/src/agb_flash.c`, `pokefirered/src/agb_flash_1m.c`.
  - Use only after adding chunk IDs.

- **Lecture candidate requiring more chunks: Link/RFU communication**
  - Path to pull next: `pokefirered/src/AgbRfu_LinkManager.c`.
  - Good fit for multiplayer/link-trade architecture, but not supported by this packet alone.

## 4. Coverage risks or missing context

- The packet is **too narrow for the full course goal**. It only provides one concrete citable chunk, and that chunk is battle-AI-specific.
- It does not cover the requested high-level systems: overworld, map loading, movement, scripts, flags, inventory, menus, save/load, party management, or battle core.
- The deterministic notes emphasize RFU and flash files, but no chunk IDs are supplied for them, so they cannot yet support cited lessons.
- Need additional packets from likely core files such as overworld, field control, script engine, battle main, pokemon data, item/menu systems, save, party menu, and map/object-event code.

### pokemon-showdown/server

## 1. What this module teaches well

- **Online service wrapper around Pokemon battle/community systems**, not FireRed-style game architecture. Use it as a secondary module for “what changes when a Pokemon system becomes a networked server.”
- **Server deployment and runtime entry points**: `pokemon-showdown/server/README.md` shows Node.js setup, running the server, ports, localhost testing, and admin setup. Good for operational architecture.
- **Moderation/chat infrastructure**: `pokemon-showdown/server/artemis/README.md` and `server/artemis/index.ts` are useful for teaching a concrete server-side subsystem: message classification via local or remote classifiers.
- **Subsystem lifecycle management**: `server/artemis/index.ts` cleanly exposes `start(processCount)` and `destroy()`, showing how server components can be booted and torn down through shared process configuration.

## 2. Best citable source paths and chunk IDs

- `pokemon-showdown/server/README.md`
  - `chunk_869e24c85f3e72ff`: server purpose, Node.js requirement, setup overview, default port context.
  - `chunk_1ba53f1706d86463`: concrete run commands: `node pokemon-showdown`, optional port, localhost testing, server URL behavior.
  - `chunk_81ec0b3536856edb`: admin account setup via `config/usergroups.csv`.

- `pokemon-showdown/server/artemis/README.md`
  - `chunk_6530d2131c5f90dc`: Artemis described as Pokemon Showdown’s moderation AI, with local and remote classifier versions; remote uses Perspective API, local uses `detoxify`.

- `pokemon-showdown/server/artemis/index.ts`
  - `chunk_ce9a83e8ec0288ac`: exports `LocalClassifier` and `RemoteClassifier`; defines `start(processCount)` and `destroy()` lifecycle functions.

## 3. Lecture and lab ideas grounded in the sources

- **Lecture: FireRed runtime vs Showdown server runtime**
  - Use `server/README.md` chunks `chunk_869e24c85f3e72ff` and `chunk_1ba53f1706d86463`.
  - Contrast FireRed’s local cartridge/game loop with Showdown’s Node.js server, ports, browser client, and hosted connection model.

- **Lecture: Server subsystem lifecycle**
  - Use `server/artemis/index.ts` `chunk_ce9a83e8ec0288ac`.
  - Teach how a server module exposes a small lifecycle API: import dependencies, export subsystem classes, `start()` workers, `destroy()` workers.

- **Lab: Build a minimal moderation classifier facade**
  - Ground in `server/artemis/README.md` `chunk_6530d2131c5f90dc` and `index.ts` `chunk_ce9a83e8ec0288ac`.
  - Students implement `LocalClassifier`, `RemoteClassifier`, `start(processCount)`, and `destroy()` stubs, then route fake chat messages through them.

- **Lab: Deployment checklist for a Pokemon-style online simulator**
  - Use `server/README.md` chunks `chunk_869e24c85f3e72ff`, `chunk_1ba53f1706d86463`, and `chunk_81ec0b3536856edb`.
  - Students document runtime requirements, launch command, port, localhost URL, and admin bootstrap.

## 4. Coverage risks or missing context

- This module is **not a good primary source for FireRed architecture**. It does not cover maps, overworld movement, NPC events, flags, save blocks, party storage, inventory, or cartridge-era engine callbacks.
- It should stay **secondary**, mainly for online battle/chat/server concerns.
- The packet’s top terms include `chat`, `user`, `room`, and `plugins`, but the provided citable anchors mostly cover setup and Artemis. To teach those systems rigorously, add chunks from actual Showdown files for rooms, users, chat commands, sockets, and battle rooms.
- Artemis is useful technically, but moderation AI can distract from the course goal unless framed narrowly as “server-side message processing pipeline.”

### pokemon-showdown/test

## 1. What this module teaches well

`pokemon-showdown/test` is best used as a secondary course module for **deterministic battle-mechanics testing**, not as the primary architecture map for a complete FireRed-style RPG.

It teaches:

- How Showdown creates reproducible battle scenarios with small team arrays, `common.createBattle`, `battle.makeChoices`, fixed seeds, and `forceRandomChance` controls: `pokemon-showdown/test/TESTS.md` `chunk_134ac9f75b9d6477`, `chunk_e8da8b9a442469fd`; `pokemon-showdown/test/common.js` `chunk_979fde4c3177ea4f`.
- How to express mechanics as assertions over runtime battle state: HP, species, stat stages, ability, held item, fainting, trapping, invalid choices, damage bounds: `pokemon-showdown/test/assert.js` `chunk_26026d44764fa919`, `chunk_ea7e3df4601ff158`, `chunk_f2ab14d37f397660`, `chunk_33aea2a43af6dfeb`.
- How to keep tests narrow, readable, and RNG-independent, which is directly useful when teaching battle formulas and edge cases: `pokemon-showdown/test/TESTS.md` `chunk_e8da8b9a442469fd`.
- How a battle simulator test harness wraps larger systems: Dex/mod selection, format construction, custom rules, team injection, deterministic RNG, debug logs, and replay export: `pokemon-showdown/test/common.js` `chunk_1e16e6558a224d95`, `chunk_30588dc3c8a398c4`, `chunk_6700195ee54c8f6d`.

## 2. Best citable source paths and chunk IDs

- `pokemon-showdown/test/TESTS.md`
  - `chunk_7e60ba399924a1b3`: Mocha workflow, running tests, `.only`, `mocha -g`, boilerplate using `assert`, `common`, `battle`, and `afterEach battle.destroy`.
  - `chunk_134ac9f75b9d6477`: `common.createBattle`, game types, `forceRandomChance`, fixed seeds, custom rules, example tests.
  - `chunk_e8da8b9a442469fd`: `battle.makeChoices`, damage bounds, stat-stage assertion, and preferred style: specific, readable, RNG-independent.
  - `chunk_9992fed339a2d23d`: common assertions, `battle.getDebugLog()`, and `common.saveReplay(battle)` debugging workflow.
  - `chunk_0cf55302ea1ba6b7`: replay output can be viewed in a browser.

- `pokemon-showdown/test/assert.js`
  - `chunk_4a11812ac63cc351`: custom assert extensions on Node `assert.strict`; `bounded`, `atLeast`, `atMost`.
  - `chunk_26026d44764fa919`: `legalTeam`, `species`, `fainted`, `fullHP`.
  - `chunk_ea7e3df4601ff158`: `hasAbility`, `holdsItem`, `trapped`, `cantMove`.
  - `chunk_f2ab14d37f397660`: invalid targeting/undo assertions, `statStage`, start of HP-change assertions.
  - `chunk_33aea2a43af6dfeb`: `hurtsBy`, `constant`, `sets`.
  - `chunk_678d13b54325f1bf`: async assertion helpers and deprecated assert APIs.
  - `chunk_4226d432af4257aa`: `assert.false` wrapper for inverse assertions.

- `pokemon-showdown/test/common.js`
  - `chunk_1e16e6558a224d95`: `TestTools`, `Dex.mod`, `gen()`, default deterministic seed.
  - `chunk_30588dc3c8a398c4`: format construction from game type and custom rules.
  - `chunk_979fde4c3177ea4f`: `createBattle`, battle options, `forceRandomChance`, seed, `strictChoices`.
  - `chunk_6700195ee54c8f6d`: team arrays assigned to player slots, `new Sim.Battle`, `saveReplay`.
  - `chunk_931d53c7d1a7dc87`: cached base/gen9 test tool aliases.

## 3. Lecture and lab ideas grounded in the sources

- **Lecture: Battle Mechanics as Executable Specifications**
  - Use `TESTS.md` `chunk_134ac9f75b9d6477` and `chunk_e8da8b9a442469fd`.
  - Show how a move/ability/item interaction becomes a tiny deterministic scenario: team setup, one or two choices, assert HP/stat/status outcomes.
  - Connect to FireRed by saying: FireRed implements mechanics in C tables/functions; Showdown tests show how to isolate expected behavior.

- **Lab: Build a Minimal Battle Regression Test**
  - Students create a Showdown test with `common.createBattle`, two teams, `battle.makeChoices`, and assertions.
  - Require use of `forceRandomChance` or deterministic moves to avoid flaky tests.
  - Cite `common.js` `chunk_979fde4c3177ea4f` and `TESTS.md` `chunk_e8da8b9a442469fd`.

- **Lecture: Assertion Vocabulary for RPG Combat State**
  - Use `assert.js` chunks `chunk_26026d44764fa919`, `chunk_ea7e3df4601ff158`, `chunk_f2ab14d37f397660`, `chunk_33aea2a43af6dfeb`.
  - Teach what state matters in a creature battle: HP, max HP, species, ability, item, stat boosts, legal choices, damage ranges.
  - Then map those concepts back to FireRed party structs, battle mons, move tables, and status fields in later FireRed modules.

- **Lab: Debug a Battle Through Logs and Replay**
  - Use `TESTS.md` `chunk_9992fed339a2d23d` and `common.js` `chunk_6700195ee54c8f6d`.
  - Students inspect `battle.getDebugLog()` and save a replay to understand turn order, events, and hidden state.

- **Lecture: Test Harness Architecture**
  - Use `common.js` `chunk_1e16e6558a224d95`, `chunk_30588dc3c8a398c4`, `chunk_979fde4c3177ea4f`.
  - Explain the harness stack: `TestTools` -> Dex/mod/format -> battle options -> seeded `Sim.Battle` -> team/player slots.

## 4. Coverage risks or missing context

- This module does **not** teach the complete Pokemon-style RPG architecture. It has no overworld, maps, NPCs, event scripts, flags, warps, save/load, party menu, inventory, rendering, audio, or GBA callback loop.
- It should not replace FireRed as the course spine. Use it only for battle-mechanics testing and data-driven simulator comparison.
- The cited chunks mostly cover the **test harness**, not Showdown’s actual battle engine. Pair with `pokemon-showdown/sim/battle.ts`, `sim/pokemon.ts`, `sim/side.ts`, `data/moves.ts`, and `data/pokedex.ts` if Showdown internals are needed.
- Showdown defaults here are modern/base or Gen 9 oriented unless a mod/gen is selected: `common.js` `chunk_1e16e6558a224d95`, `chunk_30588dc3c8a398c4`. FireRed is Gen 3-era behavior, so lectures must explicitly separate “FireRed source truth” from “Showdown testing reference.”
- The packet does not include representative real test files beyond `TESTS.md`, `assert.js`, and `common.js`; avoid claiming broad coverage of all moves, abilities, or species tests unless those files are separately chunked and reviewed.

### pokefirered/data

## 1. What this module teaches well

- Data-driven overworld content: map identity, layout reference, music, weather, map type, movement permissions, battle scene, object events, warps, coordinate triggers, and background events are declared in JSON, not hardcoded.
- Separation of map layout from map behavior: `map.json` points to `LAYOUT_*`, while `layouts.json` maps that layout to dimensions, tilesets, border data, and blockdata.
- Event taxonomy for an overworld engine: object events for NPCs, warp events for exits, coord events for step triggers, and bg events for tile interactions.
- Good small case study: `BattleColosseum_2P` vs `BattleColosseum_4P` shows how similar rooms vary mostly by data: object count, warp count, trigger count, and script labels.

## 2. Best citable source paths and chunk IDs

- `pokefirered/data/layouts/layouts.json`  
  - `chunk_76c0c20446e9e415`: `LAYOUT_BATTLE_COLOSSEUM_2P`, 14x9 layout, `gTileset_Building`, `gTileset_CableClub`, `border.bin`, `map.bin`.
  - `chunk_4a91aa64203b6d9a`: `LAYOUT_BATTLE_COLOSSEUM_4P`, same 14x9 shape and Cable Club tileset pattern.

- `pokefirered/data/maps/BattleColosseum_2P/map.json`  
  - `chunk_919152bd3bfceb95`: map header fields, indoor/no-running/no-cycling flags, link battle scene, receptionist object event, dynamic warp setup.
  - `chunk_237e353ea279eb27`: two coordinate triggers using `VAR_TEMP_0` and player spot scripts.

- `pokefirered/data/maps/BattleColosseum_4P/map.json`  
  - `chunk_f18829d873bc1246`: map header fields, no object events, four dynamic warps.
  - `chunk_30cd3fd6e624b8c6`: four coordinate triggers for 4-player positions.

- Supporting: `pokefirered/data/maps/map_groups.json`  
  - `chunk_f22eb0b9c9a5d2a4`: `gMapGroup_Link` contains `BattleColosseum_2P`, `TradeCenter`, `RecordCorner`, `BattleColosseum_4P`, `UnionRoom`.

## 3. Lecture and lab ideas grounded in the sources

- Lecture: “Anatomy of a FireRed map record.” Use `BattleColosseum_2P/map.json` chunks `chunk_919152bd3bfceb95` and `chunk_237e353ea279eb27` to walk through map metadata, objects, warps, coord triggers, elevation, and script labels.
- Lecture: “Layout data vs gameplay data.” Compare `map.json` layout references with `layouts.json` chunks `chunk_76c0c20446e9e415` and `chunk_4a91aa64203b6d9a`.
- Lab: Build a minimal map loader that reads a layout registry plus one map JSON, then prints spawn objects, warps, step triggers, and allowed movement modes.
- Lab: Diff 2P vs 4P Colosseum data. Students should identify that 4P removes the attendant, adds four warp exits, and uses four player spot triggers.
- Lab: Create a tiny clone schema with `layout`, `object_events`, `warp_events`, `coord_events`, `elevation`, and `script` fields, then implement trigger lookup for “player steps on tile.”

## 4. Coverage risks or missing context

- This packet is excellent for data structure, but weak for runtime flow. It does not show the C code that loads map headers, interprets elevation, dispatches scripts, resolves dynamic warps, or updates object movement.
- Script labels such as `BattleColosseum_2P_EventScript_PlayerSpot0` are referenced here but not explained by these chunks. Pair with script sources such as `data/scripts/cable_club.inc` and the script engine.
- Collision, metatile behavior, camera, input handling, callbacks, save variables, and object event movement need companion modules from `src/overworld.c`, `src/field_control_avatar.c`, `src/event_object_movement.c`, `src/script.c`, and map/header generation code.
- Do not let this module stand alone as “the overworld system.” Treat it as the data layer feeding the overworld, event, warp, and scripting systems.

### pokefirered/include

## 1. What this module teaches well
- The `include` layer teaches FireRed’s system contracts: include guards, `#define` constants, `extern` globals, structs, callback prototypes, and cross-module dependencies.
- `pokefirered/include/battle.h` is the strongest architecture map: battler identity/actions, trainer party data, per-battler state, shared battle resources, battle scripting state, sprite/link buffers, and global turn variables. Cite `chunk_4079f42fde2b4370`, `chunk_a8a612bb3994f875`, `chunk_4e3097f639b05787`, `chunk_403d30271e2270d6`, `chunk_825c6c75270bc90c`, `chunk_f5cd027bf13ab47d`, `chunk_8367bbcb71bfc88d`.
- `pokefirered/include/bag.h` is a clean small interface for menu/window services around the bag: text printing, window open/close/show/hide, yes/no menus, money display. Cite `chunk_8f2c0bdfc3224a33`.
- `pokefirered/include/AgbRfu_LinkManager.h` teaches a real event/state-machine subsystem: RFU modes, callback message IDs, timer structs, `LINK_MANAGER` state, global `lman`, and public API calls. Cite `chunk_8df030184c481b3b`, `chunk_b75d95e146826302`, `chunk_fc7074757ec1be96`, `chunk_f549b5be90786ef0`, `chunk_b970b6c513c1cf10`.

## 2. Best citable source paths and chunk IDs
| Source path | Chunk IDs | Best use |
|---|---|---|
| `pokefirered/include/bag.h` | `chunk_8f2c0bdfc3224a33` | Minimal UI contract: bag windows, text, yes/no menus, money display. |
| `pokefirered/include/battle.h` | `chunk_4079f42fde2b4370`, `chunk_a8a612bb3994f875` | Battler position macros, battle action constants, move targeting flags. |
| `pokefirered/include/battle.h` | `chunk_4e3097f639b05787`, `chunk_403d30271e2270d6` | Trainer party structs, trainer table contract, `gTrainers`. |
| `pokefirered/include/battle.h` | `chunk_a08e84ff1272f826`, `chunk_33e8e15fef45281d`, `chunk_d81ee04fd031e92e` | Disable/protect/special status, side timers, wish/future sight, AI thinking state. |
| `pokefirered/include/battle.h` | `chunk_825c6c75270bc90c`, `chunk_40ecbb5d4f2bc902`, `chunk_e15159fcd3d41a2b`, `chunk_da840401b463494c`, `chunk_f5cd027bf13ab47d` | `BattleResources`, `BattleResults`, large `BattleStruct`, dynamic move type helpers. |
| `pokefirered/include/battle.h` | `chunk_8367bbcb71bfc88d`, `chunk_f10fdaef23f753cd`, `chunk_b4f085c32725f246`, `chunk_032be4d989842195` | `BattleScripting`, sprite data, link buffers, major global battle variables. |
| `pokefirered/include/AgbRfu_LinkManager.h` | `chunk_8df030184c481b3b`, `chunk_5306829b0ff56041` | RFU mode constants, parent/child switching, error codes. |
| `pokefirered/include/AgbRfu_LinkManager.h` | `chunk_b75d95e146826302`, `chunk_418da567cb185931`, `chunk_b69e7fc882cfc1ab`, `chunk_83ca46c6a397cebb` | Link manager callback message taxonomy. |
| `pokefirered/include/AgbRfu_LinkManager.h` | `chunk_fc7074757ec1be96`, `chunk_28d7df13cd2eb99a`, `chunk_c317fdf869f6d36b`, `chunk_f549b5be90786ef0`, `chunk_b970b6c513c1cf10` | Link state constants, init parameters, VBlank timers, `LINK_MANAGER`, public RFU APIs. |

## 3. Lecture and lab ideas grounded in the sources
- Lecture: “Headers as the top-down map.” Compare `bag.h` as a small UI façade with `battle.h` as a large subsystem contract and `AgbRfu_LinkManager.h` as a state machine boundary.
- Lab: Build a battle data map from `battle.h`: categorize every declaration into identity, trainer data, turn action, status/timer, script state, result tracking, rendering, link, or global flow variable.
- Lab: Implement a minimal clone of `struct Trainer` plus trainer-party flags using `battle.h` chunks `chunk_4e3097f639b05787` and `chunk_403d30271e2270d6`.
- Lab: Model a mini battle turn using `B_ACTION_*`, `gChosenActionByBattler`, `gActionsByTurnOrder`, `gCurrentMove`, and `gBattlescriptCurrInstr` from `battle.h`.
- Lab: Recreate a small RFU-style state machine using `LMAN_STATE_*`, callback messages, `VBL_TIMER`, and a simplified `LINK_MANAGER`.
- Lab: Stub a bag window API matching `bag.h`, then require students to find the implementation later in `src` to connect header contracts to concrete code.

## 4. Coverage risks or missing context
- This module is mostly declarations, not execution. It should not be used alone to teach runtime flow; pair it later with `src/battle_main.c`, `src/battle_script_commands.c`, `src/battle_util.c`, `src/bag.c`, and `src/AgbRfu_LinkManager.c`.
- The packet is battle/link/UI-heavy. It does not cover overworld map loading, object events, scripting, save/load, party storage, item data, Pokémon species data, or map scripts.
- `battle.h` exposes many globals, but not ownership, allocation, initialization order, or callback scheduling. Those require implementation chunks.
- RFU link material is valuable but optional for the learner’s main goal; keep it as multiplayer/transport architecture, not the center of the course.
- Avoid claiming exact gameplay control flow from headers alone. Treat these chunks as interface contracts and use implementation files for “what calls what.”

### pokemon-showdown/sim

## 1. What this module teaches well

- Data-driven battle modeling: `Dex` as the lookup layer for moves, species, items, abilities, natures, stats, and generation mods. Best anchors: `pokemon-showdown/sim/DEX.md` `chunk_922688d7428150d1`, `chunk_5fbe60392b5eedf9`, `chunk_74ee605430e5596f`.
- Nonstandard-data filtering: CAP, past/future species, unobtainables, placeholders, Z/Max move edge cases. Use this to teach why “all data” is not the same as “legal in this game.” Anchors: `pokemon-showdown/sim/NONSTANDARD.md` `chunk_800f1eafbea0ed7c`, `chunk_cd9e594377b303e0`, `chunk_e5f6cf3bbf6a71a1`, `chunk_f91e0c0d82e68cab`.
- Battle runtime architecture: request states, player choices, turn commit, action queue, move execution, damage/effect phases. Good implementation anchors: `pokemon-showdown/sim/battle.ts` `chunk_3b063b1b44a6d638`, `chunk_217e3b008aad8ecd`, `chunk_889e310105810281`, `chunk_c63eeedcc9a5b475`; `pokemon-showdown/sim/battle-actions.ts` `chunk_95a7524b39636e24`, `chunk_654080547a70a44a`, `chunk_a62dd77a10e8203f`.
- Team legality and battle inputs: `TeamValidator`, set validation, packed/JSON/export team formats. Anchors: `pokemon-showdown/sim/team-validator.ts` `chunk_9ff127a12b71412d`, `chunk_3cddb04ef5845c5a`, `chunk_c0f0165a64c015de`; `pokemon-showdown/sim/TEAMS.md` `chunk_02280e6484d53df4`.
- Simulator API shape: stream input/output and protocol messages. Anchors: `pokemon-showdown/sim/README.md` `chunk_110c4ed1a6eac238`; `pokemon-showdown/sim/SIMULATOR.md` `chunk_f429a69263a5b0fc`; `pokemon-showdown/sim/battle-stream.ts` `chunk_ced1577d9e2d59ac`.

## 2. Best citable source paths and chunk IDs

- `pokemon-showdown/sim/README.md` `chunk_110c4ed1a6eac238`: Node package overview; points to battle simulation, teams, and Dex docs.
- `pokemon-showdown/sim/DEX.md` `chunk_922688d7428150d1`: `Dex` purpose and basic move lookup.
- `pokemon-showdown/sim/DEX.md` `chunk_5fbe60392b5eedf9`: `Dex.mod()` for generation-specific mechanics/data.
- `pokemon-showdown/sim/DEX.md` `chunk_74ee605430e5596f`: `moves/species/abilities/items.get()` and `.all()` APIs.
- `pokemon-showdown/sim/NONSTANDARD.md` `chunk_800f1eafbea0ed7c`: warning that `.all()` includes nonstandard data and must be filtered.
- `pokemon-showdown/sim/battle.ts` `chunk_3b063b1b44a6d638`: `Battle` class and request-state model.
- `pokemon-showdown/sim/battle.ts` `chunk_f35156857e46caca`: constructor wires format, `Dex.forFormat`, generation, rule table, scripts.
- `pokemon-showdown/sim/battle.ts` `chunk_889e310105810281`: `choose()` and `commitChoices()` control flow.
- `pokemon-showdown/sim/battle-queue.ts` `chunk_f572d84e556bce5e`: battle action queue and action resolution.
- `pokemon-showdown/sim/battle-actions.ts` `chunk_95a7524b39636e24`: `runMove()` responsibilities.
- `pokemon-showdown/sim/battle-actions.ts` `chunk_654080547a70a44a`: damage/effect sequence.
- `pokemon-showdown/sim/pokemon.ts` `chunk_5f4ddd9eef19393c`: `Pokemon` runtime object and move slots.
- `pokemon-showdown/sim/side.ts` `chunk_938f061508023bac`: `Side` state: team, active Pokémon, request data.
- `pokemon-showdown/sim/state.ts` `chunk_4f0c09a50b6eccf0`: battle serialization/deserialization helper.

## 3. Lecture and lab ideas grounded in the sources

- Lecture: “Dex as a data facade.” Compare FireRed static tables to Showdown `Dex`; use `DEX.md` chunks `chunk_922688d7428150d1`, `chunk_5fbe60392b5eedf9`, `chunk_74ee605430e5596f`.
- Lab: write a small script that loads Gen 3 moves with `Dex.mod('gen3')`, prints base power/category/accuracy, then filters nonstandard moves using `isNonstandard`. Cite `DEX.md` plus `NONSTANDARD.md` `chunk_800f1eafbea0ed7c`.
- Lecture: “Turn loop anatomy.” Trace request state -> side choice -> commit -> action queue -> `runAction`. Cite `battle.ts` `chunk_3b063b1b44a6d638`, `chunk_217e3b008aad8ecd`, `chunk_889e310105810281`, `battle-queue.ts` `chunk_f572d84e556bce5e`.
- Lab: run a minimal `BattleStream` battle and inspect emitted protocol lines. Cite `SIMULATOR.md` `chunk_f429a69263a5b0fc` and `battle-stream.ts` `chunk_ced1577d9e2d59ac`.
- Lecture: “Move execution pipeline.” Walk `runMove()` into accuracy, damage, spread damage, hit effects, self drops, secondaries. Cite `battle-actions.ts` `chunk_95a7524b39636e24`, `chunk_654080547a70a44a`, `chunk_a62dd77a10e8203f`.
- Lab: implement a tiny clone battle step with `Pokemon`, `MoveData`, queue ordering, and deterministic damage. Use `pokemon.ts` `chunk_5f4ddd9eef19393c`, `dex-moves.ts` `chunk_dc7d84e94a3b2aaf`, `battle-queue.ts` `chunk_f572d84e556bce5e`.

## 4. Coverage risks or missing context

- This module is battle-sim focused. It does not teach FireRed’s overworld, map loading, object events, NPC movement, scripts, warps, flags, save blocks, menus, bag, party UI, or asset pipeline.
- Showdown is TypeScript/server simulation; FireRed is C/GBA engine code. Use Showdown mainly for battle mechanics and data modeling, not whole-game architecture.
- `Dex` includes modern and nonstandard data by default; course material must explicitly teach filtering, or students will confuse “exists in Showdown data” with “exists/legal in FireRed.”
- Pair this module with FireRed battle files and data tables when teaching Gen 3 specifics; otherwise learners may absorb newer mechanics like Z-Moves, Max Moves, CAP, NatDex, and modern legality rules that do not apply to FireRed.

### pokefirered/tools

## 1. What this module teaches well

- Build-time tooling for a data-driven RPG: FireRed does not just “load data”; tools convert source assets/data into C/ASM/header artifacts before runtime.
- `bin2c` is a clean, small example of asset embedding: read a binary file, interpret bytes as 1/2/4-byte values, then emit a typed C array.
- `jsonproc` shows FireRed’s JSON-to-generated-code path: JSON input plus an Inja template becomes generated output, with custom callbacks for string cleanup, arithmetic, variables, and headers.
- Good recurring module for “content pipeline” lessons, especially before runtime modules like overworld maps, items, wild encounters, region map, graphics, and audio.
- It teaches determinism and reproducibility: standalone tool Makefiles, explicit compiler flags, generated-file headers, fatal build errors, and vendored dependencies.

## 2. Best citable source paths and chunk IDs

| Source | Chunk IDs | Best use |
|---|---:|---|
| `pokefirered/build_tools.sh` | `chunk_1a4a3316f8593aaf` | Shows the tools directory as a suite: `bin2c`, `gbagfx`, `mapjson`, `jsonproc`, etc. |
| `pokefirered/Makefile` | `chunk_30eb2e53e9597446` | Shows generated targets and inclusion of rule files such as `json_data_rules.mk`, `map_data_rules.mk`, graphics/audio rules. |
| `pokefirered/tools/bin2c/LICENSE` | `chunk_75a70e01903e13d2` | License/sidebar source only. |
| `pokefirered/tools/bin2c/Makefile` | `chunk_d2912b550dd7020f` | Small standalone C11 tool build: `bin2c.c` -> `bin2c`. |
| `pokefirered/tools/bin2c/bin2c.c` | `chunk_e9da40ef795d48ed`, `chunk_2dcfb44051473eb9`, `chunk_65c57aad256d0c13`, `chunk_082e66138fa0fb45`, `chunk_838bf0f5d271873c` | Main `bin2c` implementation: fatal errors, whole-file read, little-endian extraction, CLI options, generated C array output. |
| `pokefirered/tools/jsonproc/Makefile` | `chunk_503edd8af85c1550` | C++17 build and vendored headers: `inja.hpp`, `nlohmann/json.hpp`. |
| `pokefirered/tools/jsonproc/jsonproc.cpp` | `chunk_dd905c2bfaba76d6`, `chunk_fc2aea317b4867eb`, `chunk_8ff706613290bd94`, `chunk_a18acad2d3659114` | JSON + template generator, custom Inja callbacks, string cleanup, output writing, exception handling. |
| `pokefirered/tools/jsonproc/jsonproc.h` | `chunk_2513bcbd95999608` | Shared `FATAL_ERROR` macro pattern for tool failures. |
| `pokefirered/tools/jsonproc/nlohmann/json.hpp` | `chunk_9ea1764d565e4b6b` | Vendored JSON dependency/version/license boundary; do not teach internals deeply. |

## 3. Lecture and lab ideas grounded in the sources

- Lecture: “Build-time data pipeline vs runtime systems.” Use `build_tools.sh` and `Makefile` to show where tools sit before C compilation: source data/assets -> tool -> generated C/header/binary artifact -> game code.
- Lab: Rebuild a tiny `bin2c`. Match FireRed behavior: `INPUT_FILE VAR_NAME`, `-size 1/2/4`, `-col`, `-pad`, `-signed`, `-static`, decimal/hex output. Cite `bin2c.c` chunks above.
- Lecture: “Data-driven does not mean runtime JSON.” Show `jsonproc`: JSON is consumed at build time, producing static generated source that runtime systems include.
- Lab: Make a mini creature table generator. Input `creatures.json`, template a C array, add callbacks similar to `contains`, `subtract`, `cleanString`, and emit a generated-file warning.
- Lab: Failure modes in content pipelines. Compare `FATAL_ERROR` in `bin2c.c` and `jsonproc.h/jsonproc.cpp`: bad file paths, invalid `-size`, malformed JSON/template errors.
- Short sidebar: dependency hygiene. Use `bin2c/LICENSE` and `nlohmann/json.hpp` to discuss vendored tools/libraries without turning the course into third-party library archaeology.

## 4. Coverage risks or missing context

- This module is build tooling, not gameplay runtime. It will not teach overworld callbacks, battle state, save blocks, menus, party data, scripts, or NPC movement by itself.
- `bin2c` is generic. To connect it to FireRed assets, the course needs adjacent packets for graphics/audio rule files and runtime consumers.
- `jsonproc` shows the generator, but not enough of the actual schemas/templates. Next source packets should include `json_data_rules.mk`, JSON inputs, template `.json.txt` files, and generated headers for items, wild encounters, region maps, and heal locations.
- The packet underrepresents other important tools in `pokefirered/tools`: `mapjson`, `gbagfx`, `preproc`, `scaninc`, `mid2agb`, `wav2agb`, etc. Use `build_tools.sh` as a map, then request focused packets for each.
- Avoid spending much time on `nlohmann/json.hpp` or `inja.hpp` internals. Treat them as dependencies supporting FireRed’s generator layer.

## Source Modules
### pokemon-showdown/data
- Chunk count: 27350
- Top terms: pokemon, showdown, learnsets, mods, moves, protect, level, substitute, random, toxic, rest, l25
- Notes: Use pokemon-showdown/data as a recurring course module around pokemon, showdown, learnsets, mods, moves, protect. Anchor lectures in pokemon-showdown/data/FORMES.md, pokemon-showdown/data/abilities.ts, pokemon-showdown/data/aliases.ts and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/data/text/moves.ts (chunk chunk_92a6298340525a85): Chunk chunk_92a6298340525a85 from pokemon-showdown/data/text/moves.ts supports discussion of move, turn, power, equal, effect.
  - pokemon-showdown/data/abilities.ts (chunk chunk_d5bdb17c16d6f1a4): Chunk chunk_d5bdb17c16d6f1a4 from pokemon-showdown/data/abilities.ts supports discussion of move, target, name, attacker, flags.
  - pokemon-showdown/data/mods/biomechmons/scripts.ts (chunk chunk_1434b1000eb1576c): Chunk chunk_1434b1000eb1576c from pokemon-showdown/data/mods/biomechmons/scripts.ts supports discussion of item, battle, newdata, itemstring, map.
  - pokemon-showdown/data/mods/gen2stadium2/scripts.ts (chunk chunk_3480e574205d5d0f): Chunk chunk_3480e574205d5d0f from pokemon-showdown/data/mods/gen2stadium2/scripts.ts supports discussion of move, damage, basepower, category, target.

### pokefirered/src
- Chunk count: 13169
- Top terms: pokefirered, src, void, battle, pokemon, species, case, break, u16, move, item, sprite
- Notes: Use pokefirered/src as a recurring course module around pokefirered, src, void, battle, pokemon, species. Anchor lectures in pokefirered/src/AgbRfu_LinkManager.c, pokefirered/src/agb_flash.c, pokefirered/src/agb_flash_1m.c and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokefirered/src/learn_move.c (chunk chunk_af3598df6f092723): Chunk chunk_af3598df6f092723 from pokefirered/src/learn_move.c supports discussion of menu, state, moverelearnerstatemachine, move, battle.
  - pokefirered/src/learn_move.c (chunk chunk_e820ee15ae8caa6d): Chunk chunk_e820ee15ae8caa6d from pokefirered/src/learn_move.c supports discussion of state, menu, move, print, moverelearnerstatemachine.
  - pokefirered/src/battle_ai_script_commands.c (chunk chunk_34a415cc38858fdc): Chunk chunk_34a415cc38858fdc from pokefirered/src/battle_ai_script_commands.c supports discussion of party, status, saiscriptptr, species, statustocompareto.
  - pokefirered/src/battle_setup.c (chunk chunk_494d132a59422c85): Chunk chunk_494d132a59422c85 from pokefirered/src/battle_setup.c supports discussion of constants, battle, transition, load, event.

### pokemon-showdown/server
- Chunk count: 2506
- Top terms: pokemon, showdown, server, chat, user, room, plugins, name, target, throw, errormessage, length
- Notes: Use pokemon-showdown/server as a recurring course module around pokemon, showdown, server, chat, user, room. Anchor lectures in pokemon-showdown/server/README.md, pokemon-showdown/server/artemis/README.md, pokemon-showdown/server/artemis/index.ts and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/server/chat-plugins/trivia/trivia.ts (chunk chunk_567a83f903ad2f8b): Chunk chunk_567a83f903ad2f8b from pokemon-showdown/server/chat-plugins/trivia/trivia.ts supports discussion of room, finalists, trivia, user, target.
  - pokemon-showdown/server/room-battle.ts (chunk chunk_a3762e8c293737e8): Chunk chunk_a3762e8c293737e8 from pokemon-showdown/server/room-battle.ts supports discussion of room, winnerid, p1score, battle, rated.
  - pokemon-showdown/server/artemis/README.md (chunk chunk_6530d2131c5f90dc): Chunk chunk_6530d2131c5f90dc from pokemon-showdown/server/artemis/README.md supports discussion of artemis, local, version, uses, server.
  - pokemon-showdown/server/chat-plugins/auction.ts (chunk chunk_682b043ce4ff096c): Chunk chunk_682b043ce4ff096c from pokemon-showdown/server/chat-plugins/auction.ts supports discussion of team, teams, chat, name, errormessage.

### pokemon-showdown/test
- Chunk count: 1444
- Top terms: assert, pokemon, moves, battle, species, showdown, test, makechoices, move, ability, common, active
- Notes: Use pokemon-showdown/test as a recurring course module around assert, pokemon, moves, battle, species, showdown. Anchor lectures in pokemon-showdown/test/TESTS.md, pokemon-showdown/test/assert.js, pokemon-showdown/test/common.js and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/test/server/room-battle.js (chunk chunk_dc2afc68f00876af): Chunk chunk_dc2afc68f00876af from pokemon-showdown/test/server/room-battle.js supports discussion of seed, stream2, battle, rated, player.
  - pokemon-showdown/test/sim/abilities/cursedbody.js (chunk chunk_e4f18f9dee41b382): Chunk chunk_e4f18f9dee41b382 from pokemon-showdown/test/sim/abilities/cursedbody.js supports discussion of battle, moves, assert, common, sleeptalk.
  - pokemon-showdown/test/sim/abilities/stancechange.js (chunk chunk_20c33ec5b759dba1): Chunk chunk_20c33ec5b759dba1 from pokemon-showdown/test/sim/abilities/stancechange.js supports discussion of battle, assert, common, stancechange, require.
  - pokemon-showdown/test/sim/choice-parser.js (chunk chunk_b1b54876095d9231): Chunk chunk_b1b54876095d9231 from pokemon-showdown/test/sim/choice-parser.js supports discussion of battle, switchchoice, passchoice, assert, throws.

### pokefirered/data
- Chunk count: 1457
- Top terms: map, pokefirered, elevation, maps, json, trainer, movement, event, range, script, eventscript, flag
- Notes: Use pokefirered/data as a recurring course module around map, pokefirered, elevation, maps, json, trainer. Anchor lectures in pokefirered/data/layouts/layouts.json, pokefirered/data/maps/BattleColosseum_2P/map.json, pokefirered/data/maps/BattleColosseum_4P/map.json and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokefirered/data/maps/CinnabarIsland_PokemonLab_Entrance/map.json (chunk chunk_c2f64efb11d31344): Chunk chunk_c2f64efb11d31344 from pokefirered/data/maps/CinnabarIsland_PokemonLab_Entrance/map.json supports discussion of map, entrance, cinnabar, island, movement.
  - pokefirered/data/maps/FourIsland_PokemonDayCare/map.json (chunk chunk_d1f6fb7252355521): Chunk chunk_d1f6fb7252355521 from pokefirered/data/maps/FourIsland_PokemonDayCare/map.json supports discussion of map, four, island, events, movement.
  - pokefirered/data/maps/MtEmber_RubyPath_B4F/map.json (chunk chunk_5ddae5349b23e0c9): Chunk chunk_5ddae5349b23e0c9 from pokefirered/data/maps/MtEmber_RubyPath_B4F/map.json supports discussion of map, b4f, ember, ruby, events.
  - pokefirered/data/maps/MtMoon_1F/map.json (chunk chunk_5f6e29c6d48dea34): Chunk chunk_5f6e29c6d48dea34 from pokefirered/data/maps/MtMoon_1F/map.json supports discussion of map, dest, warp, elevation, movement.

### pokefirered/include
- Chunk count: 1333
- Top terms: pokefirered, define, constants, extern, guard, void, u32, u16, ifndef, battle, endif, graphics
- Notes: Use pokefirered/include as a recurring course module around pokefirered, define, constants, extern, guard, void. Anchor lectures in pokefirered/include/AgbRfu_LinkManager.h, pokefirered/include/bag.h, pokefirered/include/battle.h and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokefirered/include/constants/pokemon.h (chunk chunk_c484915fbe764dc2): Chunk chunk_c484915fbe764dc2 from pokefirered/include/constants/pokemon.h supports discussion of define, stat, mon, num, stats.
  - pokefirered/include/constants/flags.h (chunk chunk_9effb1395583ab3d): Chunk chunk_9effb1395583ab3d from pokefirered/include/constants/flags.h supports discussion of temp, flags, define, start, flag.
  - pokefirered/include/battle.h (chunk chunk_a8a612bb3994f875): Chunk chunk_a8a612bb3994f875 from pokefirered/include/battle.h supports discussion of define, action, battler, move, safari.
  - pokefirered/include/constants/party_menu.h (chunk chunk_c3a7645bd3638d0c): Chunk chunk_c3a7645bd3638d0c from pokefirered/include/constants/party_menu.h supports discussion of define, partybox, desc, able, selectwindow.

### pokemon-showdown/sim
- Chunk count: 699
- Top terms: pokemon, showdown, sim, battle, dex, move, target, name, gen, number, species, source
- Notes: Use pokemon-showdown/sim as a recurring course module around pokemon, showdown, sim, battle, dex, move. Anchor lectures in pokemon-showdown/sim/DEX.md, pokemon-showdown/sim/NONSTANDARD.md, pokemon-showdown/sim/README.md and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/sim/pokemon.ts (chunk chunk_51465b55980f00ae): Chunk chunk_51465b55980f00ae from pokemon-showdown/sim/pokemon.ts supports discussion of maxhp, status, pokemon, source, effect.
  - pokemon-showdown/sim/battle-actions.ts (chunk chunk_d0a4b599baa8740f): Chunk chunk_d0a4b599baa8740f from pokemon-showdown/sim/battle-actions.ts supports discussion of battle, movedata, target, heal, damage.
  - pokemon-showdown/sim/battle-stream.ts (chunk chunk_3747ec035d73ad9d): Chunk chunk_3747ec035d73ad9d from pokemon-showdown/sim/battle-stream.ts supports discussion of pokemon, player, battle, add, status.
  - pokemon-showdown/sim/battle.ts (chunk chunk_6b1f5f24270e88ff): Chunk chunk_6b1f5f24270e88ff from pokemon-showdown/sim/battle.ts supports discussion of target, effect, source, drain, amount.

### pokefirered/tools
- Chunk count: 1276
- Top terms: pokefirered, tools, json, jsonproc, nlohmann, std, hpp, value, char, size, error, cpp
- Notes: Use pokefirered/tools as a recurring course module around pokefirered, tools, json, jsonproc, nlohmann, std. Anchor lectures in pokefirered/tools/bin2c/LICENSE, pokefirered/tools/bin2c/Makefile, pokefirered/tools/bin2c/bin2c.c and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokefirered/tools/gbafix/COPYING (chunk chunk_033c6797b17e8ba8): Chunk chunk_033c6797b17e8ba8 from pokefirered/tools/gbafix/COPYING supports discussion of program, terms, free, software, warranty.
  - pokefirered/tools/gbafix/COPYING (chunk chunk_a4d2e63dfa8f0f87): Chunk chunk_a4d2e63dfa8f0f87 from pokefirered/tools/gbafix/COPYING supports discussion of work, major, component, code, system.
  - pokefirered/tools/mapjson/mapjson.cpp (chunk chunk_cfac13dbc1731f2c): Chunk chunk_cfac13dbc1731f2c from pokefirered/tools/mapjson/mapjson.cpp supports discussion of map, byte, json, items, text.
  - pokefirered/tools/mapjson/mapjson.cpp (chunk chunk_e162e49e1009b425): Chunk chunk_e162e49e1009b425 from pokefirered/tools/mapjson/mapjson.cpp supports discussion of map, json, text, byte, allow.

### pokemon-showdown/lib
- Chunk count: 141
- Top terms: pokemon, showdown, lib, promise, streams, error, options, void, throw, resolve, process, export
- Notes: Use pokemon-showdown/lib as a recurring course module around pokemon, showdown, lib, promise, streams, error. Anchor lectures in pokemon-showdown/lib/DASHYCODE.md, pokemon-showdown/lib/STREAMS.md, pokemon-showdown/lib/crashlogger.ts and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/lib/STREAMS.md (chunk chunk_81dafc16b183098d): Chunk chunk_81dafc16b183098d from pokemon-showdown/lib/STREAMS.md supports discussion of streams, readstream, writestream, like, buffer.
  - pokemon-showdown/lib/STREAMS.md (chunk chunk_5eac2d2ec6c96eeb): Chunk chunk_5eac2d2ec6c96eeb from pokemon-showdown/lib/STREAMS.md supports discussion of readstream, next, push, buffer, abc.
  - pokemon-showdown/lib/sql.ts (chunk chunk_2043f243cf22ade2): Chunk chunk_2043f243cf22ade2 from pokemon-showdown/lib/sql.ts supports discussion of query, database, case, statements, state.
  - pokemon-showdown/lib/sql.ts (chunk chunk_6b53067d12a09fbb): Chunk chunk_6b53067d12a09fbb from pokemon-showdown/lib/sql.ts supports discussion of query, name, statement, database, primarykeyname.

### pokemon-showdown/tools
- Chunk count: 62
- Top terms: pokemon, showdown, tools, import, format, modlog, importer, converter, log, dex, slice, process
- Notes: Use pokemon-showdown/tools as a recurring course module around pokemon, showdown, tools, import, format, modlog. Anchor lectures in pokemon-showdown/tools/build-utils.js, pokemon-showdown/tools/modlog/convert, pokemon-showdown/tools/modlog/converter.ts and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/tools/simulate/README.md (chunk chunk_9b4d95755bc301c3): Chunk chunk_9b4d95755bc301c3 from pokemon-showdown/tools/simulate/README.md supports discussion of battles, each, games, runs, harness.
  - pokemon-showdown/tools/set-import/sets/README.md (chunk chunk_919529a316fcd039): Chunk chunk_919529a316fcd039 from pokemon-showdown/tools/set-import/sets/README.md supports discussion of sets, smogon, com, showdown, https.
  - pokemon-showdown/tools/simulate/README.md (chunk chunk_56668353a75a7bb3): Chunk chunk_56668353a75a7bb3 from pokemon-showdown/tools/simulate/README.md supports discussion of format, battle, run, random, battles.
  - pokemon-showdown/tools/modlog/converter.ts (chunk chunk_55d97ce11adaa67b): Chunk chunk_55d97ce11adaa67b from pokemon-showdown/tools/modlog/converter.ts supports discussion of entries, modlog, files, global, roomid.

### pokemon-showdown/CONTRIBUTING.md
- Chunk count: 16
- Top terms: pokemon, showdown, contributing, code, but, what, your, user, bad, pull, request, they
- Notes: Use pokemon-showdown/CONTRIBUTING.md as a recurring course module around pokemon, showdown, contributing, code, but, what. Anchor lectures in pokemon-showdown/CONTRIBUTING.md and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/CONTRIBUTING.md (chunk chunk_f5b4e7890ba3ca03): Chunk chunk_f5b4e7890ba3ca03 from pokemon-showdown/CONTRIBUTING.md supports discussion of mit, design, your, code, licensed.
  - pokemon-showdown/CONTRIBUTING.md (chunk chunk_4e31de5b9caed27a): Chunk chunk_4e31de5b9caed27a from pokemon-showdown/CONTRIBUTING.md supports discussion of click, button, what, user, buttons.
  - pokemon-showdown/CONTRIBUTING.md (chunk chunk_caa5d19c6f0b0462): Chunk chunk_caa5d19c6f0b0462 from pokemon-showdown/CONTRIBUTING.md supports discussion of button, user, important, what, look.
  - pokemon-showdown/CONTRIBUTING.md (chunk chunk_0882b0cafd472ffc): Chunk chunk_0882b0cafd472ffc from pokemon-showdown/CONTRIBUTING.md supports discussion of code, strings, move, meant, displayed.

### pokemon-showdown/databases
- Chunk count: 20
- Top terms: pokemon, showdown, databases, sql, create, table, text, index, key, migrations, userid, roomid
- Notes: Use pokemon-showdown/databases as a recurring course module around pokemon, showdown, databases, sql, create, table. Anchor lectures in pokemon-showdown/databases/migrations/chat-plugins/v2.sql, pokemon-showdown/databases/migrations/chat-plugins/v3.sql, pokemon-showdown/databases/migrations/chat-plugins/v4.sql and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/databases/migrations/chat-plugins/v5.sql (chunk chunk_07fabd9e7c3f5954): Chunk chunk_07fabd9e7c3f5954 from pokemon-showdown/databases/migrations/chat-plugins/v5.sql supports discussion of stats, perspective, timestamp, create, text.
  - pokemon-showdown/databases/migrations/chat-plugins/v6.sql (chunk chunk_9ca74d670b4179cf): Chunk chunk_9ca74d670b4179cf from pokemon-showdown/databases/migrations/chat-plugins/v6.sql supports discussion of text, number, create, perspective, flags.
  - pokemon-showdown/databases/migrations/storedbattles/v2.sql (chunk chunk_cd6eda315cac4455): Chunk chunk_cd6eda315cac4455 from pokemon-showdown/databases/migrations/storedbattles/v2.sql supports discussion of timer, stored, battles, table, adds.
  - pokemon-showdown/databases/schemas/stored-battles.sql (chunk chunk_e0bf5aa74d7abaf0): Chunk chunk_e0bf5aa74d7abaf0 from pokemon-showdown/databases/schemas/stored-battles.sql supports discussion of text, stored, battles, pokemon, showdown.

### pokefirered/INSTALL.md
- Chunk count: 25
- Top terms: pokefirered, install, summary, details, note, store, following, bash, devkitarm, command, windows, folder
- Notes: Use pokefirered/INSTALL.md as a recurring course module around pokefirered, install, summary, details, note, store. Anchor lectures in pokefirered/INSTALL.md and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokefirered/INSTALL.md (chunk chunk_7d8e35d8986b9c48): Chunk chunk_7d8e35d8986b9c48 from pokefirered/INSTALL.md supports discussion of windows, wsl1, instructions, wsl2, these.
  - pokefirered/INSTALL.md (chunk chunk_2f3a9061cb6ebd42): Chunk chunk_2f3a9061cb6ebd42 from pokefirered/INSTALL.md supports discussion of cygwin, download, package, setup, pokefirered.
  - pokefirered/INSTALL.md (chunk chunk_4c4d4b04c665db1e): Chunk chunk_4c4d4b04c665db1e from pokefirered/INSTALL.md supports discussion of wsl, will, ubuntu, right, password.
  - pokefirered/INSTALL.md (chunk chunk_98869fa7140b8b87): Chunk chunk_98869fa7140b8b87 from pokefirered/INSTALL.md supports discussion of msys2, devkitpro, libpng, install, user.

### pokemon-showdown/PROTOCOL.md
- Chunk count: 15
- Top terms: showdown, pokemon, protocol, user, name, battle, will, message, json, format, room, chat
- Notes: Use pokemon-showdown/PROTOCOL.md as a recurring course module around showdown, pokemon, protocol, user, name, battle. Anchor lectures in pokemon-showdown/PROTOCOL.md and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/PROTOCOL.md (chunk chunk_9b32cd219b4956c8): Chunk chunk_9b32cd219b4956c8 from pokemon-showdown/PROTOCOL.md supports discussion of message, room, user, html, title.
  - pokemon-showdown/PROTOCOL.md (chunk chunk_81494173a34120fb): Chunk chunk_81494173a34120fb from pokemon-showdown/PROTOCOL.md supports discussion of format, games, teams, searching, search.
  - pokemon-showdown/PROTOCOL.md (chunk chunk_9fd6de9392a11913): Chunk chunk_9fd6de9392a11913 from pokemon-showdown/PROTOCOL.md supports discussion of some, dude, moderator, battle, message.
  - pokemon-showdown/PROTOCOL.md (chunk chunk_32deef5e76dd0967): Chunk chunk_32deef5e76dd0967 from pokemon-showdown/PROTOCOL.md supports discussion of username, challstr, your, request, https.

### pokemon-showdown/old-simulator-doc.txt
- Chunk count: 10
- Top terms: pokemon, fired, showdown, old, effect, move, examples, side, target, ability, simulator, event
- Notes: Use pokemon-showdown/old-simulator-doc.txt as a recurring course module around pokemon, fired, showdown, old, effect, move. Anchor lectures in pokemon-showdown/old-simulator-doc.txt and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokemon-showdown/old-simulator-doc.txt (chunk chunk_2f5f6ee7ffd0f1fb): Chunk chunk_2f5f6ee7ffd0f1fb from pokemon-showdown/old-simulator-doc.txt supports discussion of associated, pokemon, side, effect, residual.
  - pokemon-showdown/old-simulator-doc.txt (chunk chunk_b071f57fdbcb7615): Chunk chunk_b071f57fdbcb7615 from pokemon-showdown/old-simulator-doc.txt supports discussion of pokemon, stats, ability, move, examples.
  - pokemon-showdown/old-simulator-doc.txt (chunk chunk_8162d4de8fa933ed): Chunk chunk_8162d4de8fa933ed from pokemon-showdown/old-simulator-doc.txt supports discussion of source, move, target, effect, pokemon.
  - pokemon-showdown/old-simulator-doc.txt (chunk chunk_0aae80b99404c10b): Chunk chunk_0aae80b99404c10b from pokemon-showdown/old-simulator-doc.txt supports discussion of basepower, move, technician, pokemon, base.

### pokefirered/charmap.txt
- Chunk count: 18
- Top terms: pokefirered, charmap, txt, mus, right, trainer, gym, intro, leader, ball, contest, left
- Notes: Use pokefirered/charmap.txt as a recurring course module around pokefirered, charmap, txt, mus, right, trainer. Anchor lectures in pokefirered/charmap.txt and cite exact chunk IDs when making source-backed claims.
- Representative chunks:
  - pokefirered/charmap.txt (chunk chunk_cbb050c152958b6f): Chunk chunk_cbb050c152958b6f from pokefirered/charmap.txt supports discussion of name, link, player, prefix, mon1.
  - pokefirered/charmap.txt (chunk chunk_4acf0148f7d5d259): Chunk chunk_4acf0148f7d5d259 from pokefirered/charmap.txt supports discussion of dynamic, white, light, green, colors.
  - pokefirered/charmap.txt (chunk chunk_748a5cd80d28f54b): Chunk chunk_748a5cd80d28f54b from pokefirered/charmap.txt supports discussion of mus, encounter, slots, rocket, gym.
  - pokefirered/charmap.txt (chunk chunk_352279749692e782): Chunk chunk_352279749692e782 from pokefirered/charmap.txt supports discussion of evil, good, version, team, magma.


## Key Sources
- pokemon-showdown/data/learnsets.ts: pokemon-showdown/data/learnsets.ts is a high-signal source for pokemon, showdown, learnsets, l20, l25. Representative evidence: "}, {generation: 8, level: 1, moves: ['tailglow', 'watergun'], pokeball: 'pokeball', source: "gen8bdsp"}, {generation: 8, level: 50, moves: ["waterpulse", "zenheadbutt", "moonbl...
- pokemon-showdown/data/mods/gen9dlc1/learnsets.ts: pokemon-showdown/data/mods/gen9dlc1/learnsets.ts is a high-signal source for pokemon, showdown, mods, gen9dlc1, learnsets. Representative evidence: weatherball: ["8M", "5S3"], workup: ["8M", "7M"], worryseed: ["8L30", "7T", "7L31", "6T", "6L31", "5T", "5L31", "4T", "4L31"], }, eventData: [ {generation: 3, level: 70, moves:...
- pokemon-showdown/data/mods/gen9predlc/learnsets.ts: pokemon-showdown/data/mods/gen9predlc/learnsets.ts is a high-signal source for pokemon, showdown, mods, gen9predlc, learnsets. Representative evidence: "7M", "7V", "6M", "5M", "4M", "3T"], sweetscent: ["8L24", "7L21", "7V", "6L21", "5L21", "4L21", "3L25", "3S0"], swordsdance: ["8M", "7M", "7V", "6M", "5M", "4M", "3T"], synthesi...
- pokemon-showdown/data/mods/gen8dlc1/learnsets.ts: pokemon-showdown/data/mods/gen8dlc1/learnsets.ts is a high-signal source for pokemon, showdown, mods, gen8dlc1, learnsets. Representative evidence: down: ["7L1", "6L1"], toxic: ["7M", "6M"], waterpulse: ["7T", "7L21", "6T", "6L21"], weatherball: ["7L40", "6L40"], willowisp: ["7M", "6M"], }, eventData: [ {generation: 6, leve...
- pokemon-showdown/data/mods/gen7sm/learnsets.ts: pokemon-showdown/data/mods/gen7sm/learnsets.ts is a high-signal source for pokemon, showdown, mods, gen7sm, learnsets. Representative evidence: down: ["7M", "6M", "5M"], snore: ["6T", "5T", "4T", "3T"], stealthrock: ["6T", "5T", "4M"], stoneedge: ["7M", "6M", "5M", "4M"], submission: ["7V"], substitute: ["7M", "7V", "6M...
- pokemon-showdown/data/mods/gen6xy/learnsets.ts: pokemon-showdown/data/mods/gen6xy/learnsets.ts is a high-signal source for pokemon, showdown, mods, gen6xy, learnsets. Representative evidence: turn: ["6M"], waterfall: ["6M"], waterpledge: ["6T"], waterpulse: ["6L14"], watersport: ["6E"], }, }, frogadier: { inherit: true, learnset: { acrobatics: ["6M"], aerialace: ["6M...
- pokemon-showdown/data/mods/gen5bw1/learnsets.ts: pokemon-showdown/data/mods/gen5bw1/learnsets.ts is a high-signal source for pokemon, showdown, mods, gen5bw1, learnsets. Representative evidence: turn: ["5M", "4M", "3M"], rockslide: ["5M", "4M", "3T"], rocksmash: ["5M", "4M", "3M"], rocktomb: ["5M", "4M", "3M"], round: ["5M"], sandattack: ["5L21", "4L21", "3L21"], scratc...
- pokemon-showdown/data/random-battles/gen9/draft-factory-matchups.json: pokemon-showdown/data/random-battles/gen9/draft-factory-matchups.json is a high-signal source for pokemon, showdown, random, battles, tera. Representative evidence: { "matchups": [ ["Rotom-Wash||Leftovers|Levitate|ThunderWave,VoltSwitch,HydroPump,Protect|Bold|168,,252,20,68,||,0,,,,|||,,,,,Electric]Clodsire||BlackSludge|WaterAbsorb|StealthR...
- pokemon-showdown/data/mods/gen4pt/learnsets.ts: pokemon-showdown/data/mods/gen4pt/learnsets.ts is a high-signal source for pokemon, showdown, mods, gen4pt, learnsets. Representative evidence: tile: { inherit: true, learnset: { absorb: ["4L1", "3L1"], aerialace: ["4M", "3M"], agility: ["4L35", "3L35"], attract: ["4M", "3M"], bodyslam: ["3T"], brickbreak: ["4M", "3M"],...
- pokemon-showdown/data/moves.ts: pokemon-showdown/data/moves.ts is a high-signal source for pokemon, target, name, basepower, showdown. Representative evidence: djacentFoes", type: "Dark", }, filletaway: { num: 868, accuracy: true, basePower: 0, category: "Status", name: "Fillet Away", pp: 10, priority: 0, flags: { snatch: 1 }, onTry(so...
- pokemon-showdown/data/text/moves.ts: pokemon-showdown/data/text/moves.ts is a high-signal source for desc, user, pokemon, target, move. Representative evidence: equal to 1/6 of its maximum HP, rounded down, at the end of each turn during effect, including the last turn.", shortDesc: "Base move affects power. Foes: -1/6 HP, 4 turns.", st...
- pokefirered/src/data/wild_encounters.json: pokefirered/src/data/wild_encounters.json is a high-signal source for pokefirered, src, wild, encounters, json. Representative evidence: evel": 44, "max_level": 44, "species": "SPECIES_MAROWAK" }, { "min_level": 44, "max_level": 44, "species": "SPECIES_MACHOKE" }, { "min_level": 46, "max_level": 46, "species": "S...
- pokemon-showdown/data/pokedex.ts: pokemon-showdown/data/pokedex.ts is a high-signal source for color, spa, basestats, abilities, spd. Representative evidence: ities: { 0: "Shields Down" }, heightm: 0.3, weightkg: 40, color: "Brown", eggGroups: ["Mineral"], requiredAbility: "Shields Down", battleOnly: "Minior", }, komala: { num: 775, n...
- pokemon-showdown/data/mods/gen8bdsp/learnsets.ts: pokemon-showdown/data/mods/gen8bdsp/learnsets.ts is a high-signal source for pokemon, showdown, mods, gen8bdsp, learnsets. Representative evidence: /* eslint-disable max-len */ export const Learnsets: import('../../../sim/dex-species').ModdedLearnsetDataTable = { bulbasaur: { learnset: { amnesia: ["8E"], attract: ["8M"], bu...
- pokemon-showdown/data/random-battles/gen7/factory-sets.json: pokemon-showdown/data/random-battles/gen7/factory-sets.json is a high-signal source for species, item, ability, evs, nature. Representative evidence: neak"], ["Play Rough"], ["Shadow Claw"]] }] }, "moltres": { "flags": {}, "sets": [{ "species": "Moltres", "item": ["Leftovers"], "ability": ["Pressure"], "evs": {"hp": 208, "def...
- pokefirered/src/data/pokemon/tmhm_learnsets.h: pokefirered/src/data/pokemon/tmhm_learnsets.h is a high-signal source for tmhm, pokefirered, src, pokemon, learnsets. Representative evidence: #define TMHM_LEARNSET(moves) {(u32)(moves), ((u64)(moves) >> 32)} #define TMHM(tmhm) ((u64)1 << (ITEM_##tmhm - ITEM_TM01_FOCUS_PUNCH)) // This table determines which TMs and HMs...
- pokemon-showdown/data/random-battles/gen6/factory-sets.json: pokemon-showdown/data/random-battles/gen6/factory-sets.json is a high-signal source for nature, moves, atk, spa, spd. Representative evidence: "nature": "Bold", "moves": [["Synthesis"], ["Aromatherapy"], ["Calm Mind"], ["Moonblast"]] } ] }, "flygon": { "flags": {}, "sets": [ { "species": "Flygon", "item": "Choice Scarf...
- pokefirered/src/battle_script_commands.c: pokefirered/src/battle_script_commands.c is a high-signal source for pokefirered, src, battle, script, commands. Representative evidence: attleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED)) #define LEVEL_UP_BANNER_START 416 #define LEVEL_UP_BANNER_END 512 #define TAG_LVLUP_BANNER_MON_ICON 55130 static bool8 I...
- pokefirered/src/data/trainers.h: pokefirered/src/data/trainers.h is a high-signal source for trainer, check, item, script, move. Representative evidence: _MOVE, .party = NO_ITEM_DEFAULT_MOVES(sParty_BoarderM), }, [TRAINER_BOARDER_F] = { .trainerClass = TRAINER_CLASS_BOARDER, .encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,...
- pokemon-showdown/data/mods/gen9legends/learnsets.ts: pokemon-showdown/data/mods/gen9legends/learnsets.ts is a high-signal source for pokemon, showdown, learnsets, mods, gen9legends. Representative evidence: /* eslint-disable max-len */ export const Learnsets: import('../../../sim/dex-species').ModdedLearnsetDataTable = { bulbasaur: { learnset: { acidspray: ["9M"], amnesia: ["9L40"]...
- pokemon-showdown/data/mods/gen9ssb/moves.ts: pokemon-showdown/data/mods/gen9ssb/moves.ts is a high-signal source for pokemon, showdown, target, mods, gen9ssb. Representative evidence: & this.runEvent('StallMove', source); } else { this.add('-anim', source, 'Recover', source); } }, volatileStatus: 'protect', onModifyMove(move, pokemon) { if (pokemon.species.na...
- pokefirered/src/event_object_movement.c: pokefirered/src/event_object_movement.c is a high-signal source for event, movement, pokefirered, src, objectevent. Representative evidence: #include "global.h" #include "gflib.h" #include "event_data.h" #include "event_object_movement.h" #include "field_camera.h" #include "field_control_avatar.h" #include "field_eff...
- pokemon-showdown/data/random-battles/gen9/sets.json: pokemon-showdown/data/random-battles/gen9/sets.json is a high-signal source for sets, role, movepool, abilities, teratypes. Representative evidence: "sets": [ { "role": "Fast Attacker", "movepool": ["Brave Bird", "Bulk Up", "Close Combat", "Knock Off", "U-turn"], "abilities": ["Defiant"], "teraTypes": ["Dark", "Fighting", "S...
- pokemon-showdown/data/random-battles/gen9ffa/sets.json: pokemon-showdown/data/random-battles/gen9ffa/sets.json is a high-signal source for teratypes, role, movepool, abilities, sets. Representative evidence: "teraTypes": ["Fairy", "Steel"] } ] }, "flygon": { "level": 84, "sets": [ { "role": "Setup Sweeper", "movepool": ["Dragon Claw", "Dragon Dance", "Earthquake", "Protect"], "abili...

## Idea Chunks
### pokemon-showdown/data/text/moves.ts (chunk chunk_92a6298340525a85)
- Terms: move, turn, power, equal, effect, turns, max, pokemon, each, base, holding, they
- Summary: Chunk chunk_92a6298340525a85 from pokemon-showdown/data/text/moves.ts supports discussion of move, turn, power, equal, effect.
- Excerpt: equal to 1/6 of its maximum HP, rounded down, at the end of each turn during effect, including the last turn.", shortDesc: "Base move affects power. Foes: -1/6 HP, 4 turns.", start: " [PARTY] got caught in the vortex of water!", damage: " [POKEMON] is hurt by G-Max Cannonade’s vortex!", }, gmaxcentiferno: { name: "G-Max Centiferno", desc: "Power is equal to the base move's Max Move power. If this move is successful, each Pokemon on the opposing side is prevented from switching for four or five turns (seven turns if the user is holding Grip Claw), even if they have a substitute. Causes damage equal to 1/8 of their maximum HP (1/6 if the user is holding Binding Band), rounded down, at the end of each turn during effect. They can still switch out if they are holding Shed Shell or use Baton Pass, Flip Turn, Parting Shot, Teleport, U-turn, or Volt Switch. The effect ends for a target if it...

### pokemon-showdown/data/abilities.ts (chunk chunk_d5bdb17c16d6f1a4)
- Terms: move, target, name, attacker, flags, rating, num, source, aegislash, targetforme, stamina, ondamaginghit
- Summary: Chunk chunk_d5bdb17c16d6f1a4 from pokemon-showdown/data/abilities.ts supports discussion of move, target, name, attacker, flags.
- Excerpt: e) { // most of the implementation is in Battle#getTarget move.tracksTarget = move.target !== 'scripted'; }, flags: {}, name: "Stalwart", rating: 0, num: 242, }, stamina: { onDamagingHit(damage, target, source, effect) { this.boost({ def: 1 }); }, flags: {}, name: "Stamina", rating: 4, num: 192, }, stancechange: { onModifyMovePriority: 1, onModifyMove(move, attacker, defender) { if (attacker.species.baseSpecies !== 'Aegislash' || attacker.transformed) return; if (move.category === 'Status' && move.id !== 'kingsshield') return; const targetForme = (move.id === 'kingsshield' ? 'Aegislash' : 'Aegislash-Blade'); if (attacker.species.name !== targetForme) attacker.formeChange(targetForme); }, flags: { failroleplay: 1, noreceiver: 1, noentrain: 1, notrace: 1, failskillswap: 1, cantsuppress: 1 }, name: "Stance Change", rating: 4, num: 176, }, static: { onDamagingHit(damage, target, source, m...

### pokemon-showdown/data/mods/biomechmons/scripts.ts (chunk chunk_1434b1000eb1576c)
- Terms: item, battle, newdata, itemstring, map, thing, dex, items, name, ability, exists, scrambled
- Summary: Chunk chunk_1434b1000eb1576c from pokemon-showdown/data/mods/biomechmons/scripts.ts supports discussion of item, battle, newdata, itemstring, map.
- Excerpt: ring }[]).map(e => e.thing), ...(this.m.scrambled.items as { thing: string }[]).map(e => e.thing), ...(this.m.scrambled.moves as { thing: string }[]).map(e => e.thing), this.ability, ...this.moveSlots.map(e => e.move), this.item, ].map(this.battle.toID)); let isBMMItem = false; let isOldBMMItem = false; if (!this.hp || !this.isActive) return false; if (typeof item === 'string') { if (!item.length || this.battle.dex.items.get(item).exists) { item = this.battle.dex.items.get(item); } else { const itemString = item; let newData = this.battle.dex.abilities.get(itemString) as Ability | Move; if (!newData.exists) { newData = this.battle.dex.moves.get(itemString); } else { if ((newData as Ability).flags['failskillswap']) return false; } item = { id: newData.id || itemString, name: newData.name || itemString, effectType: "Item", toString() { return newData.name || itemString; }, } as Item; }...

### pokemon-showdown/data/mods/gen2stadium2/scripts.ts (chunk chunk_3480e574205d5d0f)
- Terms: move, damage, basepower, category, target, level, number, ohko, damagecallback, battle, source, pokemon
- Summary: Chunk chunk_3480e574205d5d0f from pokemon-showdown/data/mods/gen2stadium2/scripts.ts supports discussion of move, damage, basepower, category, target.
- Excerpt: move === 'string') { move = this.dex.getActiveMove(move); } else if (typeof move === 'number') { move = { basePower: move, type: '???', category: 'Physical', willCrit: false, flags: {}, } as unknown as ActiveMove; } // Let's test for immunities. if (!target.runImmunity(move, true)) { return false; } // Is it an OHKO move? if (move.ohko) { return target.maxhp; } // We edit the damage through move's damage callback if (move.damageCallback) { return move.damageCallback.call(this.battle, source, target); } // We take damage from damage=level moves if (move.damage === 'level') { return source.level; } // If there's a fix move damage, we run it if (move.damage) { return move.damage; } // We check the category and typing to calculate later on the damage move.category = this.battle.getCategory(move); // '???' is typeless damage: used for Struggle and Confusion etc if (!move.type) move.type =...

### pokemon-showdown/data/moves.ts (chunk chunk_d4dc7d8b20aa96e6)
- Terms: pokemon, basepower, source, num, accuracy, category, name, priority, flags, maxhp, target, move
- Summary: Chunk chunk_d4dc7d8b20aa96e6 from pokemon-showdown/data/moves.ts supports discussion of pokemon, basepower, source, num, accuracy.
- Excerpt: djacentFoes", type: "Dark", }, filletaway: { num: 868, accuracy: true, basePower: 0, category: "Status", name: "Fillet Away", pp: 10, priority: 0, flags: { snatch: 1 }, onTry(source) { if (source.hp <= source.maxhp / 2 || source.maxhp === 1) return false; }, onTryHit(pokemon, target, move) { if (!this.boost(move.boosts!)) return null; delete move.boosts; }, onHit(pokemon) { this.directDamage(pokemon.maxhp / 2); }, boosts: { atk: 2, spa: 2, spe: 2, }, target: "self", type: "Normal", }, finalgambit: { num: 515, accuracy: 100, basePower: 0, damageCallback(pokemon) { const damage = pokemon.hp; pokemon.faint(); return damage; }, selfdestruct: "ifHit", category: "Special", name: "Final Gambit", pp: 5, priority: 0, flags: { protect: 1, metronome: 1, noparentalbond: 1 }, target: "normal", type: "Fighting", zMove: { basePower: 180 }, contestType: "Tough", }, fireblast: { num: 126, accuracy: 85...

### pokemon-showdown/data/mods/gen1/README.md (chunk chunk_21fe92e0a0e0853f)
- Terms: pokemon, implemented, move, turn, showdown, mods, gen1, readme, duration, todo, glitches, couple
- Summary: Chunk chunk_21fe92e0a0e0853f from pokemon-showdown/data/mods/gen1/README.md supports discussion of pokemon, implemented, move, turn, showdown.
- Excerpt: e for its duration. TODO. Glitches not implemented ------------------------------ There are a couple of divisions by zero in the original game in the cartridge. Those have not been implemented. If a Pokemon has its sleep or freeze status healed by Haze, it will not be able to move on that turn (skip turn glitch). This also applies to a frozen Pokemon that has just been thawed by a fire type move.

### pokefirered/src/learn_move.c (chunk chunk_af3598df6f092723)
- Terms: menu, state, moverelearnerstatemachine, move, battle, mode, print, prompt, constants, creates, listen, buttons
- Summary: Chunk chunk_af3598df6f092723 from pokefirered/src/learn_move.c supports discussion of menu, state, moverelearnerstatemachine, move, battle.
- Excerpt: #include "global.h" #include "gflib.h" #include "script.h" #include "task.h" #include "data.h" #include "trig.h" #include "field_fadetransition.h" #include "overworld.h" #include "new_menu_helpers.h" #include "menu.h" #include "list_menu.h" #include "event_data.h" #include "text_window.h" #include "pokemon_summary_screen.h" #include "graphics.h" #include "strings.h" #include "constants/songs.h" #include "constants/moves.h" /* * Move relearner state machine * ------------------------ * * CB2_MoveRelearner_Init * - Creates listMenuScrollPos to listen to right/left buttons. * - Creates listMenuScrollRow to listen to up/down buttons. * MoveRelearnerStateMachine: MENU_STATE_FADE_TO_BLACK * MoveRelearnerStateMachine: MENU_STATE_WAIT_FOR_FADE * - Go to MENU_STATE_IDLE_BATTLE_MODE * * MoveRelearnerStateMachine: MENU_STATE_SETUP_BATTLE_MODE * MoveRelearnerStateMachine: MENU_STATE_IDLE_BATTLE_M...

### pokefirered/src/learn_move.c (chunk chunk_e820ee15ae8caa6d)
- Terms: state, menu, move, print, moverelearnerstatemachine, learn, player, prompt, confirm, trying, stop, teaching
- Summary: Chunk chunk_e820ee15ae8caa6d from pokefirered/src/learn_move.c supports discussion of state, menu, move, print, moverelearnerstatemachine.
- Excerpt: _STATE_TEACH_MOVE_CONFIRM * - Wait for the player to confirm. * - If cancelled, go to MENU_STATE_SETUP_BATTLE_MODE. * - If confirmed and the pokemon had an empty move slot, set VAR_0x8004 to TRUE and go to * MENU_STATE_PRINT_TEXT_THEN_FANFARE. * - If confirmed and the pokemon doesn't have an empty move slot, go to * MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT. * * MoveRelearnerStateMachine: MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT * MoveRelearnerStateMachine: MENU_STATE_WAIT_FOR_TRYING_TO_LEARN * MoveRelearnerStateMachine: MENU_STATE_CONFIRM_DELETE_OLD_MOVE * - If the player confirms, go to MENU_STATE_PRINT_WHICH_MOVE_PROMPT. * - If the player cancels, go to MENU_STATE_PRINT_STOP_TEACHING * * MoveRelearnerStateMachine: MENU_STATE_PRINT_STOP_TEACHING * MoveRelearnerStateMachine: MENU_STATE_WAIT_FOR_STOP_TEACHING * MoveRelearnerStateMachine: MENU_STATE_CONFIRM_STOP_TEACHING * - If the player...

### pokemon-showdown/data/mods/gen4/items.ts (chunk chunk_ef574f63c118f2f6)
- Terms: move, source, inherit, user, pokemon, basepower, damage, target, lifeorb, species, name, items
- Summary: Chunk chunk_ef574f63c118f2f6 from pokemon-showdown/data/mods/gen4/items.ts supports discussion of move, source, inherit, user, pokemon.
- Excerpt: turn basePower; }, onModifyDamagePhase2(damage, source, target, move) { if (!move.flags['futuremove']) return damage * 1.3; }, condition: { duration: 1, onAfterMoveSecondarySelf(source, target, move) { if (move && move.effectType === 'Move' && source?.volatiles['lifeorb']) { this.damage(source.baseMaxhp / 10, source, source, this.dex.items.get('lifeorb')); source.removeVolatile('lifeorb'); } }, }, }, lightball: { inherit: true, onModifyAtk: undefined, // no inherit onModifySpA: undefined, // no inherit onBasePower(basePower, pokemon) { if (pokemon.species.name === 'Pikachu') { return this.chainModify(2); } }, }, loveball: { inherit: true, isNonstandard: null, }, luckypunch: { inherit: true, onModifyCritRatio(critRatio, user) { if (user.species.name === 'Chansey') { return critRatio + 2; } }, }, lureball: { inherit: true, isNonstandard: null, }, lustrousorb: { inherit: true, onBasePowe...

### pokemon-showdown/data/mods/gen9ssb/moves.ts (chunk chunk_f99c7de3b95d7f40)
- Terms: pokemon, source, move, name, heal, status, user, add, anim, volatilestatus, species, clodsire
- Summary: Chunk chunk_f99c7de3b95d7f40 from pokemon-showdown/data/mods/gen9ssb/moves.ts supports discussion of pokemon, source, move, name, heal.
- Excerpt: & this.runEvent('StallMove', source); } else { this.add('-anim', source, 'Recover', source); } }, volatileStatus: 'protect', onModifyMove(move, pokemon) { if (pokemon.species.name === 'Clodsire') { move.flags['heal'] = 1; move.heal = [1, 2]; delete move.volatileStatus; } }, onHit(pokemon) { if (pokemon.species.name === 'Quagsire') { pokemon.addVolatile('stall'); changeSet(this, pokemon, ssbSets['A Quag To The Past-Clodsire'], true); } else { changeSet(this, pokemon, ssbSets['A Quag To The Past'], true); } }, target: "self", type: "Ground", }, // Archas aurarain: { accuracy: true, basePower: 0, category: "Status", shortDesc: "Cures team status, all heal 75% max HP.", desc: "Z-Move that requires Lilligantium Z. Every Pokemon in the user's party is cured of its non-volatile status condition. With the exception of the user, every Pokemon in the user's party heals for 1/2 of their maximum...

### pokemon-showdown/data/mods/gen9ssb/moves.ts (chunk chunk_f562e1983e9fdeff)
- Terms: pokemon, target, add, rise, move, above, gravity, end, anim, source, volatiles, showdown
- Summary: Chunk chunk_f562e1983e9fdeff from pokemon-showdown/data/mods/gen9ssb/moves.ts supports discussion of pokemon, target, add, rise, move.
- Excerpt: th of their maximum HP at the end of each turn as long as it remains active. If the user uses Baton Pass, the replacement will gain the effects.", name: "Rise Above", gen: 9, pp: 5, priority: 0, flags: {}, onTryMove() { this.attrLastMove('[still]'); }, onPrepareHit(pokemon) { this.add('-anim', pokemon, 'Magnet Rise', pokemon); this.add('-anim', pokemon, 'Quiver Dance', pokemon); }, volatileStatus: 'riseabove', onTry(source, target, move) { if (target.volatiles['smackdown'] || target.volatiles['ingrain']) return false; // Additional Gravity check for Z-move variant if (this.field.getPseudoWeather('Gravity')) { this.add('cant', source, 'move: Gravity', move); return null; } }, condition: { duration: 5, onStart(target) { this.add('-start', target, 'Rise Above'); }, onImmunity(type) { if (type === 'Ground') return false; }, onResidualOrder: 6, onResidual(pokemon) { this.heal(pokemon.baseM...

### pokemon-showdown/data/mods/gen9ssb/moves.ts (chunk chunk_b62432a8edf466f6)
- Terms: move, source, target, add, delete, alting, pokemon, shiny, special, flags, stallingmove, sidecondition
- Summary: Chunk chunk_b62432a8edf466f6 from pokemon-showdown/data/mods/gen9ssb/moves.ts supports discussion of move, source, target, add, delete.
- Excerpt: rotected from most attacks made by other Pokemon this turn. If the user is shiny, this move instead becomes a 69 Base Power ???-type special attack.", pp: 5, priority: 0, flags: { snatch: 1 }, stallingMove: true, sideCondition: 'alting', onTryMove() { this.attrLastMove('[still]'); }, onPrepareHit(target, source) { this.add('-anim', source, 'Memento', target); this.add(`l|${getName((source.illusion || source).name).split('|')[1]}`); this.add(`j|FakePart`); }, onModifyMove(move, source, target) { move.type = "???"; if (source.set?.shiny) { move.accuracy = 100; move.basePower = 69; move.category = "Special"; move.flags = { protect: 1, bypasssub: 1 }; move.target = "normal"; delete move.selfSwitch; delete move.stallingMove; delete move.sideCondition; delete move.condition; // Note: Taunt will disable all forms of Alting, including the damaging one. // This is intentional. } }, condition:...

### pokemon-showdown/data/text/moves.ts (chunk chunk_a56be55f29a44c6e)
- Terms: target, user, first, desc, shortdesc, level, pokemon, moves, moving, move, damage, name
- Summary: Chunk chunk_a56be55f29a44c6e from pokemon-showdown/data/text/moves.ts supports discussion of target, user, first, desc, shortdesc.
- Excerpt: the user is prevented from moving, the effect ends. This move can prevent the target from moving even if it has type immunity, but will not deal damage.", shortDesc: "Prevents the target from moving for 2-5 turns.", }, start: " [POKEMON] became trapped in the fiery vortex!", move: "#wrap", // gen 1 only }, firstimpression: { name: "First Impression", desc: "Fails unless it is the user's first turn on the field.", shortDesc: "Nearly always goes first. First turn out only.", champions: { desc: "This move cannot be selected unless it is the user's first turn on the field.", }, }, fishiousrend: { name: "Fishious Rend", desc: "Power doubles if the user moves before the target.", shortDesc: "Power doubles if user moves before the target.", }, fissure: { name: "Fissure", desc: "Deals damage to the target equal to the target's maximum HP. Ignores accuracy and evasiveness modifiers. This attac...

### pokemon-showdown/data/text/moves.ts (chunk chunk_1620277751dc01f4)
- Terms: user, turn, desc, effect, move, breed, pokemon, end, target, attacks, side, redirected
- Summary: Chunk chunk_1620277751dc01f4 from pokemon-showdown/data/text/moves.ts supports discussion of user, turn, desc, effect, move.
- Excerpt: the turn used.", gen6: { desc: "Until the end of the turn, all single-target attacks from the opposing side are redirected to the user if they are in range. Such attacks are redirected to the user before they can be reflected by Magic Coat or the Magic Bounce Ability, or drawn in by the Lightning Rod or Storm Drain Abilities. Fails if it is not a Double or Triple Battle. This effect is ignored while the user is under the effect of Sky Drop.", }, start: "#followme", startFromZEffect: "#followme", }, ragingbull: { name: "Raging Bull", desc: "If this attack does not miss, the effects of Reflect, Light Screen, and Aurora Veil end for the target's side of the field before damage is calculated. If the user's current form is a Paldean Tauros, this move's type changes to match. Fighting type for Combat Breed, Fire type for Blaze Breed, and Water type for Aqua Breed.", shortDesc: "Destroys scr...

### pokemon-showdown/data/text/moves.ts (chunk chunk_f6087b9b7a835878)
- Terms: target, pokemon, steel, water, each, turn, effect, shortdesc, accuracy, damage, desc, name
- Summary: Chunk chunk_f6087b9b7a835878 from pokemon-showdown/data/text/moves.ts supports discussion of target, pokemon, steel, water, each.
- Excerpt: c: "Causes damage to the target equal to 1/8 of its maximum HP (1/4 if the target is Steel or Water type), rounded down, at the end of each turn during effect. This effect ends when the target is no longer active.", shortDesc: "Deals 1/8 max HP each turn; 1/4 on Steel, Water.", champions: { desc: "Causes damage to the target equal to 1/16 of its maximum HP (1/8 if the target is Steel or Water type), rounded down, at the end of each turn during effect. This effect ends when the target is no longer active.", shortDesc: "Deals 1/16 max HP each turn; 1/8 on Steel, Water.", }, start: " [POKEMON] is being salt cured!", damage: " [POKEMON] is hurt by Salt Cure!", }, sandattack: { name: "Sand Attack", desc: "Lowers the target's accuracy by 1 stage.", shortDesc: "Lowers the target's accuracy by 1.", }, sandsearstorm: { name: "Sandsear Storm", desc: "Has a 20% chance to burn the target. If the...

### pokemon-showdown/data/text/moves.ts (chunk chunk_fc2ef225adc5c170)
- Terms: substitute, damage, user, pokemon, recoil, target, takes, take, moves, move, hits, desc
- Summary: Chunk chunk_fc2ef225adc5c170 from pokemon-showdown/data/text/moves.ts supports discussion of substitute, damage, user, pokemon, recoil.
- Excerpt: HP. If this move hits a substitute, the recoil damage is always 1 HP.", }, gen1: { desc: "If the target lost HP, the user takes recoil damage equal to 1/4 the HP lost by the target, rounded down, but not less than 1 HP. If this move breaks the target's substitute, the user does not take any recoil damage.", }, }, substitute: { name: "Substitute", desc: "The user takes 1/4 of its maximum HP, rounded down, and puts it into a substitute to take its place in battle. The substitute is removed once enough damage is inflicted on it, if the user switches out or faints, or if any Pokemon uses Tidy Up. Baton Pass can be used to transfer the substitute to an ally, and the substitute will keep its remaining HP. Until the substitute is broken, it receives damage from all attacks made by other Pokemon and shields the user from status effects and stat stage changes caused by other Pokemon. Sound-bas...

### pokemon-showdown/data/text/moves.ts (chunk chunk_4d4c4af3510a87fc)
- Terms: target, move, user, turns, pokemon, effect, turn, but, moving, uses, desc, two
- Summary: Chunk chunk_4d4c4af3510a87fc from pokemon-showdown/data/text/moves.ts supports discussion of target, move, user, turns, pokemon.
- Excerpt: the target uses Rapid Spin or Substitute successfully. This effect is not stackable or reset by using this or another binding move.", }, gen1: { desc: "The user spends two to five turns using this move. Has a 3/8 chance to last two or three turns, and a 1/8 chance to last four or five turns. The damage calculated for the first turn is used for every other turn. The user cannot select a move and the target cannot execute a move during the effect, but both may switch out. If the user switches out, the target remains unable to execute a move during that turn. If the target switches out, the user uses this move again automatically, and if it had 0 PP at the time, it becomes 63. If the user or the target switch out, or the user is prevented from moving, the effect ends. This move can prevent the target from moving even if it has type immunity, but will not deal damage.", shortDesc: "Preven...

### pokemon-showdown/sim/pokemon.ts (chunk chunk_51465b55980f00ae)
- Terms: maxhp, status, pokemon, source, effect, battle, silent, returns, number, trunc, isnan, sourceeffect
- Summary: Chunk chunk_51465b55980f00ae from pokemon-showdown/sim/pokemon.ts supports discussion of maxhp, status, pokemon, source, effect.
- Excerpt: urceEffect?.name || moveSlot.move; } } } /** Returns the amount of damage actually healed */ heal(d: number, source: Pokemon | null = null, effect: Effect | null = null) { if (!this.hp) return false; d = this.battle.trunc(d); if (isNaN(d)) return false; if (d <= 0) return false; if (this.hp >= this.maxhp) return false; this.hp += d; if (this.hp > this.maxhp) { d -= this.hp - this.maxhp; this.hp = this.maxhp; } return d; } /** Sets HP, returns delta */ sethp(d: number) { if (!this.hp) return 0; d = this.battle.trunc(d); if (isNaN(d)) return; if (d < 1) d = 1; d -= this.hp; this.hp += d; if (this.hp > this.maxhp) { d -= this.hp - this.maxhp; this.hp = this.maxhp; } return d; } trySetStatus(status: string | Condition, source: Pokemon | null = null, sourceEffect: Effect | null = null) { return this.setStatus(this.status || status, source, sourceEffect); } /** Unlike clearStatus, gives cur...

### pokefirered/src/battle_ai_script_commands.c (chunk chunk_34a415cc38858fdc)
- Terms: party, status, saiscriptptr, species, statustocompareto, partyptr, getmondata, mon, read, doesnt, unused, void
- Summary: Chunk chunk_34a415cc38858fdc from pokefirered/src/battle_ai_script_commands.c supports discussion of party, status, saiscriptptr, species, statustocompareto.
- Excerpt: && status == statusToCompareTo) { sAIScriptPtr = T1_READ_PTR(sAIScriptPtr + 6); return; } } sAIScriptPtr += 10; } // bugged, doesnt return properly. also unused static void Cmd_if_status_not_in_party(void) { struct Pokemon *party; struct Pokemon *partyPtr; int i; u32 statusToCompareTo; //u8 battlerId switch (sAIScriptPtr[1]) { case 1: party = partyPtr = gEnemyParty; break; default: party = partyPtr = gPlayerParty; break; } statusToCompareTo = T1_READ_32(sAIScriptPtr + 2); for (i = 0; i < PARTY_SIZE; i++) { u16 species = GetMonData(&party[i], MON_DATA_SPECIES); u16 hp = GetMonData(&party[i], MON_DATA_HP); u32 status = GetMonData(&party[i], MON_DATA_STATUS); // everytime the status is found, the AI's logic jumps further and further past its intended destination. this results in a broken AI macro and is probably why it is unused. if (species != SPECIES_NONE && species != SPECIES_EGG && h...

### pokefirered/src/battle_setup.c (chunk chunk_494d132a59422c85)
- Terms: constants, battle, transition, load, event, field, trainer, param, val, bit, pokemon, setup
- Summary: Chunk chunk_494d132a59422c85 from pokefirered/src/battle_setup.c supports discussion of constants, battle, transition, load, event.
- Excerpt: #include "global.h" #include "task.h" #include "help_system.h" #include "overworld.h" #include "item.h" #include "sound.h" #include "pokemon.h" #include "load_save.h" #include "safari_zone.h" #include "quest_log.h" #include "script.h" #include "script_pokemon_util.h" #include "strings.h" #include "string_util.h" #include "event_data.h" #include "event_object_movement.h" #include "metatile_behavior.h" #include "event_scripts.h" #include "fldeff.h" #include "fieldmap.h" #include "field_control_avatar.h" #include "field_player_avatar.h" #include "field_screen_effect.h" #include "field_message_box.h" #include "vs_seeker.h" #include "battle.h" #include "battle_transition.h" #include "battle_controllers.h" #include "constants/battle_setup.h" #include "constants/event_objects.h" #include "constants/items.h" #include "constants/maps.h" #include "constants/songs.h" #include "constants/pokemon....

### pokefirered/src/battle_util.c (chunk chunk_9335e5727aa0657d)
- Terms: battle, move, constants, util, moves, sound, ret, pokemon, weather, anim, script, commands
- Summary: Chunk chunk_9335e5727aa0657d from pokefirered/src/battle_util.c supports discussion of battle, move, constants, util, moves.
- Excerpt: #include "global.h" #include "item.h" #include "text.h" #include "util.h" #include "link.h" #include "berry.h" #include "random.h" #include "pokemon.h" #include "string_util.h" #include "field_weather.h" #include "event_data.h" #include "battle.h" #include "battle_anim.h" #include "battle_scripts.h" #include "battle_message.h" #include "constants/battle_anim.h" #include "battle_controllers.h" #include "battle_ai_script_commands.h" #include "constants/battle.h" #include "constants/moves.h" #include "constants/items.h" #include "constants/weather.h" #include "constants/abilities.h" #include "constants/pokemon.h" #include "constants/hold_effects.h" #include "constants/battle_move_effects.h" #include "constants/battle_script_commands.h" #define SOUND_MOVES_END 0xFFFF static const u16 sSoundMovesTable[] = { MOVE_GROWL, MOVE_ROAR, MOVE_SING, MOVE_SUPERSONIC, MOVE_SCREECH, MOVE_SNORE, MOVE_U...

### pokefirered/src/daycare.c (chunk chunk_119931105f546346)
- Terms: constants, menu, unused, daycare, system, day, care, cb2, pokefirered, src, global, gflib
- Summary: Chunk chunk_119931105f546346 from pokefirered/src/daycare.c supports discussion of constants, menu, unused, daycare, system.
- Excerpt: #include "global.h" #include "gflib.h" #include "data.h" #include "battle.h" #include "constants/items.h" #include "mail_data.h" #include "pokemon_storage_system.h" #include "event_data.h" #include "random.h" #include "constants/moves.h" #include "menu.h" #include "new_menu_helpers.h" #include "script.h" #include "strings.h" #include "party_menu.h" #include "list_menu.h" #include "overworld.h" #include "pokedex.h" #include "decompress.h" #include "constants/songs.h" #include "text_window.h" #include "trig.h" #include "m4a.h" #include "graphics.h" #include "scanline_effect.h" #include "naming_screen.h" #include "help_system.h" #include "field_fadetransition.h" #include "trade.h" #include "constants/daycare.h" #include "constants/region_map_sections.h" // Combination of RSE's Day-Care (re-used on Four Island), FRLG's Day-Care, and egg_hatch.c extern const struct Evolution gEvolutionTabl...

### pokefirered/src/pokemon_summary_screen.c (chunk chunk_e8e17a42bbf17d46)
- Terms: constants, pokemon, menu, battle, summary, screen, system, helpers, party, region, map, curindex
- Summary: Chunk chunk_e8e17a42bbf17d46 from pokefirered/src/pokemon_summary_screen.c supports discussion of constants, pokemon, menu, battle, summary.
- Excerpt: #include "global.h" #include "gflib.h" #include "pokemon.h" #include "pokemon_summary_screen.h" #include "help_system.h" #include "task.h" #include "menu_helpers.h" #include "link.h" #include "overworld.h" #include "constants/songs.h" #include "strings.h" #include "new_menu_helpers.h" #include "menu.h" #include "constants/items.h" #include "data.h" #include "item.h" #include "constants/party_menu.h" #include "trade.h" #include "battle_main.h" #include "scanline_effect.h" #include "constants/moves.h" #include "dynamic_placeholder_text_util.h" #include "constants/region_map_sections.h" #include "region_map.h" #include "field_specials.h" #include "party_menu.h" #include "constants/battle.h" #include "event_data.h" #include "trainer_pokemon_sprites.h" #include "battle_anim.h" #include "pokeball.h" #include "pokemon_icon.h" #include "battle_interface.h" #include "mon_markings.h" #include "...

### pokemon-showdown/data/abilities.ts (chunk chunk_da22cf969179258c)
- Terms: ability, abilities, useful, adaptability, move, user, minimal, effect, effective, flags, name, rating
- Summary: Chunk chunk_da22cf969179258c from pokemon-showdown/data/abilities.ts supports discussion of ability, abilities, useful, adaptability, move.
- Excerpt: /* Ratings and how they work: -1: Detrimental An ability that severely harms the user. ex. Defeatist, Slow Start 0: Useless An ability with no overall benefit in a singles battle. ex. Color Change, Plus 1: Ineffective An ability that has minimal effect or is only useful in niche situations. ex. Light Metal, Suction Cups 2: Useful An ability that can be generally useful. ex. Flame Body, Overcoat 3: Effective An ability with a strong effect on the user or foe. ex. Chlorophyll, Sturdy 4: Very useful One of the more popular abilities. It requires minimal support to be effective. ex. Adaptability, Magic Bounce 5: Essential The sort of ability that defines metagames. ex. Imposter, Shadow Tag */ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { noability: { isNonstandard: "Past", flags: {}, name: "No Ability", rating: 0.1, num: 0, }, adaptability: { onModifySTAB(sta...

### pokemon-showdown/data/abilities.ts (chunk chunk_07722ae02858cfc1)
- Terms: pokemon, move, target, source, movetype, dex, anticipation, flags, name, rating, num, isadjacent
- Summary: Chunk chunk_07722ae02858cfc1 from pokemon-showdown/data/abilities.ts supports discussion of pokemon, move, target, source, movetype.
- Excerpt: y === 'Status') continue; const moveType = move.id === 'hiddenpower' ? target.hpType : move.type; if ( this.dex.getImmunity(moveType, pokemon) && this.dex.getEffectiveness(moveType, pokemon) > 0 || move.ohko ) { this.add('-ability', pokemon, 'Anticipation'); return; } } } }, flags: {}, name: "Anticipation", rating: 0.5, num: 107, }, arenatrap: { onFoeTrapPokemon(pokemon) { if (!pokemon.isAdjacent(this.effectState.target)) return; if (pokemon.isGrounded()) { pokemon.tryTrap(true); } }, onFoeMaybeTrapPokemon(pokemon, source) { if (!source) source = this.effectState.target; if (!source || !pokemon.isAdjacent(source)) return; if (pokemon.isGrounded(!pokemon.knownType)) { // Negate immunity if the type is unknown pokemon.maybeTrapped = true; } }, flags: {}, name: "Arena Trap", rating: 5, num: 71, }, armortail: { onFoeTryMove(target, source, move) { const targetAllExceptions = ['perishsong'...

### pokemon-showdown/data/abilities.ts (chunk chunk_b4a38d21b0114ee8)
- Terms: target, pokemon, move, flags, name, rating, num, battery, category, status, breakable, attacker
- Summary: Chunk chunk_b4a38d21b0114ee8 from pokemon-showdown/data/abilities.ts supports discussion of target, pokemon, move, flags, name.
- Excerpt: || move.category === 'Status') return; move.hasAuraBreak = true; }, flags: { breakable: 1 }, name: "Aura Break", rating: 1, num: 188, }, baddreams: { onResidualOrder: 28, onResidualSubOrder: 2, onResidual(pokemon) { if (!pokemon.hp) return; for (const target of pokemon.foes()) { if (target.status === 'slp' || target.hasAbility('comatose')) { this.damage(target.baseMaxhp / 8, target, pokemon); } } }, flags: {}, name: "Bad Dreams", rating: 1.5, num: 123, }, ballfetch: { flags: {}, name: "Ball Fetch", rating: 0, num: 237, }, battery: { onAllyBasePowerPriority: 22, onAllyBasePower(basePower, attacker, defender, move) { if (attacker !== this.effectState.target && move.category === 'Special') { this.debug('Battery boost'); return this.chainModify([5325, 4096]); } }, flags: {}, name: "Battery", rating: 0, num: 217, }, battlearmor: { onCriticalHit: false, flags: { breakable: 1 }, name: "Battl...

### pokemon-showdown/data/abilities.ts (chunk chunk_6372bce3e311c10b)
- Terms: move, pokemon, target, dark, flags, name, rating, num, aura, source, aurabooster, dancer
- Summary: Chunk chunk_6372bce3e311c10b from pokemon-showdown/data/abilities.ts supports discussion of move, pokemon, target, dark, flags.
- Excerpt: }, dancer: { flags: {}, name: "Dancer", // implemented in runMove in scripts.js rating: 1.5, num: 216, }, darkaura: { onStart(pokemon) { if (this.suppressingAbility(pokemon)) return; this.add('-ability', pokemon, 'Dark Aura'); }, onAnyBasePowerPriority: 20, onAnyBasePower(basePower, source, target, move) { if (target === source || move.category === 'Status' || move.type !== 'Dark') return; if (!move.auraBooster?.hasAbility('Dark Aura')) move.auraBooster = this.effectState.target; if (move.auraBooster !== this.effectState.target) return; return this.chainModify([move.hasAuraBreak ? 3072 : 5448, 4096]); }, flags: {}, name: "Dark Aura", rating: 3, num: 186, }, dauntlessshield: { onStart(pokemon) { if (pokemon.shieldBoost) return; pokemon.shieldBoost = true; this.boost({ def: 1 }, pokemon); }, flags: {}, name: "Dauntless Shield", rating: 3.5, num: 235, }, dazzling: { onFoeTryMove(target,...

### pokemon-showdown/data/abilities.ts (chunk chunk_8a03d04894b7e127)
- Terms: target, pokemon, move, name, damage, side, foe, flags, rating, num, source, boost
- Summary: Chunk chunk_8a03d04894b7e127 from pokemon-showdown/data/abilities.ts supports discussion of target, pokemon, move, name, damage.
- Excerpt: across in doubles/triples // (also copies across in multibattle and diagonally in free-for-all, // but side.foe already takes care of those) const target = pokemon.side.foe.active[pokemon.side.foe.active.length - 1 - pokemon.position]; if (target) { pokemon.transformInto(target, this.dex.abilities.get('imposter')); } }, flags: { failroleplay: 1, noreceiver: 1, noentrain: 1, notrace: 1 }, name: "Imposter", rating: 5, num: 150, }, infiltrator: { onModifyMove(move) { move.infiltrates = true; }, flags: {}, name: "Infiltrator", rating: 2.5, num: 151, }, innardsout: { onDamagingHitOrder: 1, onDamagingHit(damage, target, source, move) { if (!target.hp) { if (!move.smartTarget) damage += Number(move.totalDamage); this.damage(target.getUndynamaxedHP(damage), source, target); } }, flags: {}, name: "Innards Out", rating: 4, num: 215, }, innerfocus: { onTryAddVolatile(status, pokemon) { if (statu...

### pokemon-showdown/data/abilities.ts (chunk chunk_3700d8fff512067b)
- Terms: pokemon, source, youritem, hittargets, move, status, continue, setitem, item, add, ability, magician
- Summary: Chunk chunk_3700d8fff512067b from pokemon-showdown/data/abilities.ts supports discussion of pokemon, source, youritem, hittargets, move.
- Excerpt: move.id === 'fling' || move.category === 'Status') return; const hitTargets = move.hitTargets; this.speedSort(hitTargets); for (const pokemon of hitTargets) { if (pokemon !== source) { const yourItem = pokemon.takeItem(source); if (!yourItem) continue; if (!source.setItem(yourItem)) { pokemon.item = yourItem.id; // bypass setItem so we don't break choicelock or anything continue; } this.add('-item', source, yourItem, '[from] ability: Magician', `[of] ${pokemon}`); return; } } }, flags: {}, name: "Magician", rating: 1, num: 170, }, magmaarmor: { onUpdate(pokemon) { if (pokemon.status === 'frz') { this.add('-activate', pokemon, 'ability: Magma Armor'); pokemon.cureStatus(); } }, onImmunity(type, pokemon) { if (type === 'frz') return false; }, flags: { breakable: 1 }, name: "Magma Armor", rating: 0.5, num: 40, }, magnetpull: { onFoeTrapPokemon(pokemon) { if (pokemon.hasType('Steel') && p...

### pokemon-showdown/data/abilities.ts (chunk chunk_0b002eb192c19846)
- Terms: pokemon, boost, statplus, boostid, target, boosts, negativeboost, source, flags, name, rating, num
- Summary: Chunk chunk_0b002eb192c19846 from pokemon-showdown/data/abilities.ts supports discussion of pokemon, boost, statplus, boostid, target.
- Excerpt: : BoostID; for (b in boost) { if (boost[b]! < 0) { if (target.boosts[b] === -6) continue; const negativeBoost: SparseBoostsTable = {}; negativeBoost[b] = boost[b]; delete boost[b]; if (source.hp) { this.add('-ability', target, 'Mirror Armor'); this.boost(negativeBoost, source, target, null, true); } } } }, flags: { breakable: 1 }, name: "Mirror Armor", rating: 2, num: 240, }, mistysurge: { onStart(source) { this.field.setTerrain('mistyterrain'); }, flags: {}, name: "Misty Surge", rating: 3.5, num: 228, }, moldbreaker: { onStart(pokemon) { this.add('-ability', pokemon, 'Mold Breaker'); }, onModifyMove(move) { move.ignoreAbility = true; }, flags: {}, name: "Mold Breaker", rating: 3, num: 104, }, moody: { onResidualOrder: 28, onResidualSubOrder: 2, onResidual(pokemon) { let stats: BoostID[] = []; const boost: SparseBoostsTable = {}; let statPlus: BoostID; for (statPlus in pokemon.boosts)...

### pokemon-showdown/data/items.ts (chunk chunk_c35f59fe90e98533)
- Terms: move, target, gen, source, num, name, spritenum, basepower, flags, normal, fire, hitsub
- Summary: Chunk chunk_c35f59fe90e98533 from pokemon-showdown/data/items.ts supports discussion of move, target, gen, source, num.
- Excerpt: === 'Status' || move.flags['pledgecombo']) return; if (move.type === 'Normal' && source.useItem()) { source.addVolatile('gem'); } }, num: 564, gen: 5, }, normaliumz: { name: "Normalium Z", spritenum: 631, onTakeItem: false, zMove: true, zMoveType: "Normal", num: 776, gen: 7, isNonstandard: "Past", }, occaberry: { name: "Occa Berry", spritenum: 311, isBerry: true, naturalGift: { basePower: 80, type: "Fire", }, onSourceModifyDamage(damage, source, target, move) { if (move.type === 'Fire' && target.getMoveHitData(move).typeMod > 0) { const hitSub = target.volatiles['substitute'] && !move.flags['bypasssub'] && !(move.infiltrates && this.gen >= 6); if (hitSub) return; if (target.eatItem()) { this.debug('-50% reduction'); this.add('-enditem', target, this.effect, '[weaken]'); return this.chainModify(0.5); } } }, onEat() { }, num: 184, gen: 4, }, oddincense: { name: "Odd Incense", spritenum:...

### pokemon-showdown/data/items.ts (chunk chunk_fc79fb1e7c255904)
- Terms: source, target, move, num, gen, pokemon, name, spritenum, hitsub, eatitem, oneat, damage
- Summary: Chunk chunk_fc79fb1e7c255904 from pokemon-showdown/data/items.ts supports discussion of source, target, move, num, gen.
- Excerpt: a(move).typeMod > 0) { const hitSub = target.volatiles['substitute'] && !move.flags['bypasssub'] && !(move.infiltrates && this.gen >= 6); if (hitSub) return; if (target.eatItem()) { this.debug('-50% reduction'); this.add('-enditem', target, this.effect, '[weaken]'); return this.chainModify(0.5); } } }, onEat() { }, num: 686, gen: 6, }, rowapberry: { name: "Rowap Berry", spritenum: 420, isBerry: true, naturalGift: { basePower: 100, type: "Dark", }, onDamagingHit(damage, target, source, move) { if (move.category === 'Special' && source.hp && source.isActive && !source.hasAbility('magicguard')) { if (target.eatItem()) { this.damage(source.baseMaxhp / (target.hasAbility('ripen') ? 4 : 8), source, target); } } }, onEat() { }, num: 212, gen: 4, }, rustedshield: { name: "Rusted Shield", spritenum: 699, onTakeItem(item, pokemon, source) { if ((source && source.baseSpecies.num === 889) || poke...
