<commit_before>## Battles

Battles in FullScreenPokemon are driven by the [`Battles`](../src/components/Battles.ts) component and run by [BattleMovr](https://github.com/FullScreenShenanigans/FullScreenPokemon).
BattleMovr provides for keeping track of two teams of actors; `Battles` adds FullScreenPokemon-specific logic such as visualizing the battles.

### Simulating battles

Battles are generally started with `FSP.battles.startBattle`.
Its settings object requires a `teams` member that contains a descriptor for the `player` and `opponent`.

Each team descriptor requires an `actors` array of created Pokemon.
Those are most easily made with `FSP.equations.createPokemon`.

Team descriptors can optionally also take a `leader` object that indicate the team is a trainer rather than a wild Pokemon.


```javascript
// Starts a battle with a wild level 50 Mew in the player's party
FSP.battles.startBattle({
    teams: {
        opponent: {
            actors: [
                FSP.equations.createPokemon({
                    level: 50,
                    title: "MEW".split("")
                })
            ]
        },
        player: {
            actors: FSP.itemsHolder.getItem("PokemonInParty"),
            leader: {
                nickname: FSP.itemsHolder.getItem("name"),
                title: "Player".split("")
            }
        }
    }
});
```

```javascript
// Starts a battle against a bug catcher
FSP.battles.startBattle({
    teams: {
        opponent: {
            actors: [
                FSP.equations.createPokemon({
                    level: 7,
                    title: "METAPOD".split("")
                }),
                FSP.equations.createPokemon({
                    level: 7,
                    title: "METAPOD".split("")
                })
            ],
            leader: {
                nickname: "Bug Catcher".split(""),
                title: "BugCatcher".split("")
            }
        },
        player: {
            actors: [
                FSP.equations.createPokemon({<commit_msg>Clarified Battles.md a little bit<commit_after>## Battles

Battles in FullScreenPokemon are driven by the [`Battles`](../src/components/Battles.ts) component and run by [BattleMovr](https://github.com/FullScreenShenanigans/BattleMovr).
BattleMovr provides for keeping track of two teams of actors; `Battles` adds FullScreenPokemon-specific logic such as visualizing the battles.

### Simulating battles

Battles are generally started with `FSP.battles.startBattle`.
Its settings object requires a `teams` member that contains a descriptor for the `player` and `opponent`.

Each team descriptor requires an `actors` array of created Pokemon.
Those are most easily made with `FSP.equations.createPokemon`.

You can retrieve the Pokemon in the player's party with `FSP.itemsHolder.getItem("PokemonInParty");`.

```javascript
// Starts a battle with a wild level 50 Mew in the player's party
FSP.battles.startBattle({
    teams: {
        opponent: {
            actors: [
                FSP.equations.createPokemon({
                    level: 50,
                    title: "MEW".split("")
                })
            ]
        },
        player: {
            actors: FSP.itemsHolder.getItem("PokemonInParty"),
            leader: {
                nickname: FSP.itemsHolder.getItem("name"),
                title: "Player".split("")
            }
        }
    }
});
```

Team descriptors can optionally also take a `leader` object that indicate the team is a trainer rather than a wild Pokemon.

```javascript
// Starts a battle against a bug catcher
FSP.battles.startBattle({
    teams: {
        opponent: {
            actors: [
                FSP.equations.createPokemon({
                    level: 7,
                    title: "METAPOD".split("")
                }),
                FSP.equations.createPokemon({
                    level: 7,
                    title: "METAPOD".split("")
                })
            ],
            leader: {
                nickname: "Bug Catcher".split(""),
                title: "BugCatcher".split("")
            }
        },
        player: {
            actors: [
                FSP.equations.createPokemon({
{'fraction_non_alphanumeric': 0.10291676547308513, 'fraction_numerical': 0.0028456248517903723, 'mean_word_length': 1.8693877551020408, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4068906', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1144, 'n_words': 330}