pull/283/head^2
Flashfyre 2024-04-24 21:24:47 -04:00
commit 095667c7c9
7 changed files with 4241 additions and 363 deletions

View File

@ -21,6 +21,7 @@ import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesF
import AbilityBar from './ui/ability-bar'; import AbilityBar from './ui/ability-bar';
import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, IncrementMovePriorityAbAttr, applyAbAttrs, initAbilities } from './data/ability'; import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, IncrementMovePriorityAbAttr, applyAbAttrs, initAbilities } from './data/ability';
import { Abilities } from "./data/enums/abilities"; import { Abilities } from "./data/enums/abilities";
import { allAbilities } from "./data/ability";
import Battle, { BattleType, FixedBattleConfig, fixedBattles } from './battle'; import Battle, { BattleType, FixedBattleConfig, fixedBattles } from './battle';
import { GameMode, GameModes, gameModes } from './game-mode'; import { GameMode, GameModes, gameModes } from './game-mode';
import FieldSpritePipeline from './pipelines/field-sprite'; import FieldSpritePipeline from './pipelines/field-sprite';
@ -808,6 +809,7 @@ export default class BattleScene extends SceneBase {
const localizable: Localizable[] = [ const localizable: Localizable[] = [
...allSpecies, ...allSpecies,
...allMoves, ...allMoves,
...allAbilities,
...Utils.getEnumValues(ModifierPoolType).map(mpt => getModifierPoolForType(mpt)).map(mp => Object.values(mp).flat().map(mt => mt.modifierType).filter(mt => 'localize' in mt).map(lpb => lpb as unknown as Localizable)).flat() ...Utils.getEnumValues(ModifierPoolType).map(mpt => getModifierPoolForType(mpt)).map(mp => Object.values(mp).flat().map(mt => mt.modifierType).filter(mt => 'localize' in mt).map(lpb => lpb as unknown as Localizable)).flat()
]; ];
for (let item of localizable) for (let item of localizable)

File diff suppressed because it is too large Load Diff

1244
src/locales/en/ability.ts Normal file

File diff suppressed because it is too large Load Diff

1244
src/locales/es/ability.ts Normal file

File diff suppressed because it is too large Load Diff

1244
src/locales/fr/ability.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,10 @@ import { move as enMove } from '../locales/en/move';
import { move as esMove } from '../locales/es/move'; import { move as esMove } from '../locales/es/move';
import { move as frMove } from '../locales/fr/move'; import { move as frMove } from '../locales/fr/move';
import { ability as enAbility } from '../locales/en/ability';
import { ability as esAbility } from '../locales/es/ability';
import { ability as frAbility } from '../locales/fr/ability';
import { pokeball as enPokeball } from '../locales/en/pokeball'; import { pokeball as enPokeball } from '../locales/en/pokeball';
import { pokeball as esPokeball } from '../locales/es/pokeball'; import { pokeball as esPokeball } from '../locales/es/pokeball';
import { pokeball as frPokeball } from '../locales/fr/pokeball'; import { pokeball as frPokeball } from '../locales/fr/pokeball';
@ -39,6 +43,15 @@ export interface MoveTranslationEntries {
[key: string]: MoveTranslationEntry [key: string]: MoveTranslationEntry
} }
export interface AbilityTranslationEntry {
name: string,
description: string
}
export interface AbilityTranslationEntries {
[key: string]: AbilityTranslationEntry
}
export interface Localizable { export interface Localizable {
localize(): void; localize(): void;
} }
@ -74,6 +87,7 @@ export function initI18n(): void {
en: { en: {
menu: enMenu, menu: enMenu,
move: enMove, move: enMove,
ability: enAbility,
pokeball: enPokeball, pokeball: enPokeball,
pokemon: enPokemon, pokemon: enPokemon,
pokemonStat: enPokemonStat, pokemonStat: enPokemonStat,
@ -82,6 +96,7 @@ export function initI18n(): void {
es: { es: {
menu: esMenu, menu: esMenu,
move: esMove, move: esMove,
ability: esAbility,
pokeball: esPokeball, pokeball: esPokeball,
pokemon: esPokemon, pokemon: esPokemon,
pokemonStat: esPokemonStat, pokemonStat: esPokemonStat,
@ -90,6 +105,7 @@ export function initI18n(): void {
fr: { fr: {
menu: frMenu, menu: frMenu,
move: frMove, move: frMove,
ability: frAbility,
pokeball: frPokeball, pokeball: frPokeball,
pokemon: frPokemon, pokemon: frPokemon,
pokemonStat: frPokemonStat, pokemonStat: frPokemonStat,
@ -109,6 +125,7 @@ declare module 'i18next' {
resources: { resources: {
menu: typeof enMenu; menu: typeof enMenu;
move: typeof enMove; move: typeof enMove;
ability: typeof enAbility;
pokeball: typeof enPokeball; pokeball: typeof enPokeball;
pokemon: typeof enPokemon; pokemon: typeof enPokemon;
pokemonStat: typeof enPokemonStat; pokemonStat: typeof enPokemonStat;

View File

@ -6,12 +6,14 @@ import { Mode } from "./ui";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { CommandPhase } from "../phases"; import { CommandPhase } from "../phases";
import { MoveCategory } from "#app/data/move.js";
export default class FightUiHandler extends UiHandler { export default class FightUiHandler extends UiHandler {
private movesContainer: Phaser.GameObjects.Container; private movesContainer: Phaser.GameObjects.Container;
private typeIcon: Phaser.GameObjects.Sprite; private typeIcon: Phaser.GameObjects.Sprite;
private ppText: Phaser.GameObjects.Text; private ppText: Phaser.GameObjects.Text;
private cursorObj: Phaser.GameObjects.Image; private cursorObj: Phaser.GameObjects.Image;
private moveCategoryIcon: Phaser.GameObjects.Sprite;
protected fieldIndex: integer = 0; protected fieldIndex: integer = 0;
protected cursor2: integer = 0; protected cursor2: integer = 0;
@ -26,10 +28,15 @@ export default class FightUiHandler extends UiHandler {
this.movesContainer = this.scene.add.container(18, -38.7); this.movesContainer = this.scene.add.container(18, -38.7);
ui.add(this.movesContainer); ui.add(this.movesContainer);
this.typeIcon = this.scene.add.sprite((this.scene.game.canvas.width / 6) - 33, -31, 'types', 'unknown'); this.typeIcon = this.scene.add.sprite((this.scene.game.canvas.width / 6) - 41, -31, 'types', 'unknown');
this.typeIcon.setVisible(false); this.typeIcon.setVisible(false);
ui.add(this.typeIcon); ui.add(this.typeIcon);
this.moveCategoryIcon = this.scene.add.sprite((this.scene.game.canvas.width / 6) - 19, -31, 'categories', 'physical');
this.moveCategoryIcon.setVisible(false);
ui.add(this.moveCategoryIcon);
this.ppText = addTextObject(this.scene, (this.scene.game.canvas.width / 6) - 18, -15.5, ' / ', TextStyle.WINDOW); this.ppText = addTextObject(this.scene, (this.scene.game.canvas.width / 6) - 18, -15.5, ' / ', TextStyle.WINDOW);
this.ppText.setOrigin(1, 0.5); this.ppText.setOrigin(1, 0.5);
this.ppText.setVisible(false); this.ppText.setVisible(false);
@ -120,16 +127,19 @@ export default class FightUiHandler extends UiHandler {
if (hasMove) { if (hasMove) {
const pokemonMove = moveset[cursor]; const pokemonMove = moveset[cursor];
this.typeIcon.setTexture('types', Type[pokemonMove.getMove().type].toLowerCase()); this.typeIcon.setTexture('types', Type[pokemonMove.getMove().type].toLowerCase()).setScale(0.65);
this.moveCategoryIcon.setTexture('categories', MoveCategory[pokemonMove.getMove().category].toLowerCase()).setScale(0.8);
const maxPP = pokemonMove.getMovePp(); const maxPP = pokemonMove.getMovePp();
const pp = maxPP - pokemonMove.ppUsed; const pp = maxPP - pokemonMove.ppUsed;
this.ppText.setText(`${Utils.padInt(pp, 2, ' ')}/${Utils.padInt(maxPP, 2, ' ')}`); this.ppText.setText(`${Utils.padInt(pp, 2, ' ')}/${Utils.padInt(maxPP, 2, ' ')}`);
} }
this.typeIcon.setVisible(hasMove); this.typeIcon.setVisible(hasMove);
this.ppText.setVisible(hasMove); this.ppText.setVisible(hasMove);
this.moveCategoryIcon.setVisible(hasMove);
this.cursorObj.setPosition(13 + (cursor % 2 === 1 ? 100 : 0), -31 + (cursor >= 2 ? 15 : 0)); this.cursorObj.setPosition(13 + (cursor % 2 === 1 ? 100 : 0), -31 + (cursor >= 2 ? 15 : 0));
@ -151,6 +161,7 @@ export default class FightUiHandler extends UiHandler {
this.clearMoves(); this.clearMoves();
this.typeIcon.setVisible(false); this.typeIcon.setVisible(false);
this.ppText.setVisible(false); this.ppText.setVisible(false);
this.moveCategoryIcon.setVisible(false);
this.eraseCursor(); this.eraseCursor();
} }