* Converted internally to eightbittr@0.8.0 - the monorepo * Well, it compiles now * Wow, it runs now, amaze - using post-walkthrough version * Can walk around Pallet Town, but can't interact * Basically almost TypeScript happy * Collisions are back to working (weirdly) again * Registered missing Frames section * Moved from Travis to CircleCI * Arbitrary README.md change for CircleCI * v0.8.0-beta1 * Remove old TSLint things * Fixed package command references * Copied over external settings, including prettier * Update lockfile * Corrected parserOptions.project, disabled a few rules * Fixed remaining lint complaints * Added husky hooks and .github via hydration, and some formatting fixes * Added rule overrides back * v0.8.0 stable dependencies
2.8 KiB
Battles
Battles in FullScreenPokemon are driven by the Battles component and run by 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(FSP.storage.names.pokemonInParty);.
// 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: "RATTATA".split(""),
}),
],
},
player: {
actors: FSP.itemsHolder.getItem(FSP.storage.names.pokemonInParty),
leader: {
nickname: FSP.itemsHolder.getItem(FSP.storage.names.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.
// 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({
level: 50,
title: "CHARIZARD".split(""),
}),
],
leader: {
nickname: FSP.itemsHolder.getItem(FSP.storage.names.name),
title: "Player".split(""),
},
},
},
});
Modifying actors
Each actor has a statistics object with an { current: number, normal: number } describing one of the actor's statistics.
You can change an actor's statistic by directly modifying those objects via FSP.battleMover's current battleInfo.
// Changes the player's current actor to have 9001 attack
FSP.battleMover.getBattleInfo().teams.player.actors[0].statistics.attack.current = 9001;