Merge branch 'pagefaultgames:main' into Gen-4-de-local

This commit is contained in:
Dario Krause 2024-04-30 20:30:18 +02:00 committed by GitHub
commit a9ad510dd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 164 additions and 59 deletions

1
.gitignore vendored
View File

@ -33,5 +33,6 @@ public/images/pokemon/icons/input/output/*
public/images/character/*/ public/images/character/*/
src/data/battle-anim-raw-data*.ts src/data/battle-anim-raw-data*.ts
src/data/battle-anim-data.ts src/data/battle-anim-data.ts
src/overrides.ts
coverage coverage

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "pokemon-rogue-battle", "name": "pokemon-rogue-battle",
"version": "1.0.1", "version": "1.0.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pokemon-rogue-battle", "name": "pokemon-rogue-battle",
"version": "1.0.1", "version": "1.0.3",
"dependencies": { "dependencies": {
"@material/material-color-utilities": "^0.2.7", "@material/material-color-utilities": "^0.2.7",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",

View File

@ -60,25 +60,10 @@ import { SceneBase } from './scene-base';
import CandyBar from './ui/candy-bar'; import CandyBar from './ui/candy-bar';
import { Variant, variantData } from './data/variant'; import { Variant, variantData } from './data/variant';
import { Localizable } from './plugins/i18n'; import { Localizable } from './plugins/i18n';
import { STARTING_WAVE_OVERRIDE, OPP_SPECIES_OVERRIDE, SEED_OVERRIDE, STARTING_BIOME_OVERRIDE } from './overrides';
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
export const SEED_OVERRIDE = '';
export const STARTER_SPECIES_OVERRIDE = 0;
export const STARTER_FORM_OVERRIDE = 0;
export const STARTING_LEVEL_OVERRIDE = 0;
export const STARTING_WAVE_OVERRIDE = 0;
export const STARTING_BIOME_OVERRIDE = Biome.TOWN;
export const STARTING_MONEY_OVERRIDE = 0;
export const ABILITY_OVERRIDE = Abilities.NONE;
export const MOVE_OVERRIDE = Moves.NONE;
export const OPP_SPECIES_OVERRIDE = 0;
export const OPP_ABILITY_OVERRIDE = Abilities.NONE;
export const OPP_MOVE_OVERRIDE = Moves.NONE;
export const OPP_SHINY_OVERRIDE = false;
export const OPP_VARIANT_OVERRIDE = 0;
const DEBUG_RNG = false; const DEBUG_RNG = false;
export const startingWave = STARTING_WAVE_OVERRIDE || 1; export const startingWave = STARTING_WAVE_OVERRIDE || 1;

View File

@ -976,16 +976,19 @@ export class FieldMoveTypePowerBoostAbAttr extends FieldMovePowerBoostAbAttr {
export class BattleStatMultiplierAbAttr extends AbAttr { export class BattleStatMultiplierAbAttr extends AbAttr {
private battleStat: BattleStat; private battleStat: BattleStat;
private multiplier: number; private multiplier: number;
private condition: PokemonAttackCondition;
constructor(battleStat: BattleStat, multiplier: number) { constructor(battleStat: BattleStat, multiplier: number, condition?: PokemonAttackCondition) {
super(false); super(false);
this.battleStat = battleStat; this.battleStat = battleStat;
this.multiplier = multiplier; this.multiplier = multiplier;
this.condition = condition;
} }
applyBattleStat(pokemon: Pokemon, passive: boolean, battleStat: BattleStat, statValue: Utils.NumberHolder, args: any[]): boolean | Promise<boolean> { applyBattleStat(pokemon: Pokemon, passive: boolean, battleStat: BattleStat, statValue: Utils.NumberHolder, args: any[]): boolean | Promise<boolean> {
if (battleStat === this.battleStat) { const move = (args[0] as Move);
if (battleStat === this.battleStat && (!this.condition || this.condition(pokemon, null, move))) {
statValue.value *= this.multiplier; statValue.value *= this.multiplier;
return true; return true;
} }
@ -1402,6 +1405,7 @@ export class TraceAbAttr extends PostSummonAbAttr {
const targets = pokemon.getOpponents(); const targets = pokemon.getOpponents();
if (!targets.length) if (!targets.length)
return false; return false;
let target: Pokemon; let target: Pokemon;
if (targets.length > 1) if (targets.length > 1)
pokemon.scene.executeWithSeedOffset(() => target = Utils.randSeedItem(targets), pokemon.scene.currentBattle.waveIndex); pokemon.scene.executeWithSeedOffset(() => target = Utils.randSeedItem(targets), pokemon.scene.currentBattle.waveIndex);
@ -1427,6 +1431,9 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean { applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
const targets = pokemon.getOpponents(); const targets = pokemon.getOpponents();
if (!targets.length)
return false;
let target: Pokemon; let target: Pokemon;
if (targets.length > 1) if (targets.length > 1)
pokemon.scene.executeWithSeedOffset(() => target = Utils.randSeedItem(targets), pokemon.scene.currentBattle.waveIndex); pokemon.scene.executeWithSeedOffset(() => target = Utils.randSeedItem(targets), pokemon.scene.currentBattle.waveIndex);
@ -2642,8 +2649,8 @@ export function initAbilities() {
new Ability(Abilities.TRUANT, 3) new Ability(Abilities.TRUANT, 3)
.attr(PostSummonAddBattlerTagAbAttr, BattlerTagType.TRUANT, 1, false), .attr(PostSummonAddBattlerTagAbAttr, BattlerTagType.TRUANT, 1, false),
new Ability(Abilities.HUSTLE, 3) new Ability(Abilities.HUSTLE, 3)
.attr(BattleStatMultiplierAbAttr, BattleStat.ATK, 1.5) .attr(BattleStatMultiplierAbAttr, BattleStat.ATK, 1.5, (user, target, move) => move.category == MoveCategory.PHYSICAL)
.attr(BattleStatMultiplierAbAttr, BattleStat.ACC, 0.8), .attr(BattleStatMultiplierAbAttr, BattleStat.ACC, 0.8, (user, target, move) => move.category == MoveCategory.PHYSICAL),
new Ability(Abilities.CUTE_CHARM, 3) new Ability(Abilities.CUTE_CHARM, 3)
.attr(PostDefendContactApplyTagChanceAbAttr, 30, BattlerTagType.INFATUATED), .attr(PostDefendContactApplyTagChanceAbAttr, 30, BattlerTagType.INFATUATED),
new Ability(Abilities.PLUS, 3) new Ability(Abilities.PLUS, 3)

View File

@ -1,10 +1,10 @@
import { Arena } from "../field/arena"; import { Arena } from "../field/arena";
import { Type } from "./type"; import { Type } from "./type";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { MoveCategory, StatChangeAttr, allMoves } from "./move"; import { MoveCategory, allMoves } from "./move";
import { getPokemonMessage } from "../messages"; import { getPokemonMessage } from "../messages";
import Pokemon, { HitResult, PokemonMove } from "../field/pokemon"; import Pokemon, { HitResult, PokemonMove } from "../field/pokemon";
import { MoveEffectPhase, StatChangePhase } from "../phases"; import { MoveEffectPhase, PokemonHealPhase, StatChangePhase} from "../phases";
import { StatusEffect } from "./status-effect"; import { StatusEffect } from "./status-effect";
import { BattlerIndex } from "../battle"; import { BattlerIndex } from "../battle";
import { Moves } from "./enums/moves"; import { Moves } from "./enums/moves";
@ -146,6 +146,31 @@ class AuroraVeilTag extends WeakenMoveScreenTag {
} }
} }
class WishTag extends ArenaTag {
private battlerIndex: BattlerIndex;
private triggerMessage: string;
private healHp: number;
constructor(turnCount: integer, sourceId: integer, side: ArenaTagSide) {
super(ArenaTagType.WISH, turnCount, Moves.WISH, sourceId, side);
}
onAdd(arena: Arena): void {
const user = arena.scene.getPokemonById(this.sourceId);
this.battlerIndex = user.getBattlerIndex();
this.triggerMessage = getPokemonMessage(user, '\'s wish\ncame true!');
this.healHp = Math.max(Math.floor(user.getMaxHp() / 2), 1);
}
onRemove(arena: Arena): void {
const target = arena.scene.getField()[this.battlerIndex];
if (target?.isActive(true)) {
arena.scene.queueMessage(this.triggerMessage);
arena.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(), this.healHp, null, true, false));
}
}
}
export class WeakenMoveTypeTag extends ArenaTag { export class WeakenMoveTypeTag extends ArenaTag {
private weakenedType: Type; private weakenedType: Type;
@ -472,6 +497,8 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMov
case ArenaTagType.FUTURE_SIGHT: case ArenaTagType.FUTURE_SIGHT:
case ArenaTagType.DOOM_DESIRE: case ArenaTagType.DOOM_DESIRE:
return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex); return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex);
case ArenaTagType.WISH:
return new WishTag(turnCount, sourceId, side);
case ArenaTagType.STEALTH_ROCK: case ArenaTagType.STEALTH_ROCK:
return new StealthRockTag(sourceId, side); return new StealthRockTag(sourceId, side);
case ArenaTagType.STICKY_WEB: case ArenaTagType.STICKY_WEB:

View File

@ -8,6 +8,7 @@ export enum ArenaTagType {
MIST = "MIST", MIST = "MIST",
FUTURE_SIGHT = "FUTURE_SIGHT", FUTURE_SIGHT = "FUTURE_SIGHT",
DOOM_DESIRE = "DOOM_DESIRE", DOOM_DESIRE = "DOOM_DESIRE",
WISH = "WISH",
STEALTH_ROCK = "STEALTH_ROCK", STEALTH_ROCK = "STEALTH_ROCK",
STICKY_WEB = "STICKY_WEB", STICKY_WEB = "STICKY_WEB",
TRICK_ROOM = "TRICK_ROOM", TRICK_ROOM = "TRICK_ROOM",

View File

@ -3099,11 +3099,23 @@ export class RandomMovesetMoveAttr extends OverrideMoveEffectAttr {
const moveTargets = getMoveTargets(user, move.moveId); const moveTargets = getMoveTargets(user, move.moveId);
if (!moveTargets.targets.length) if (!moveTargets.targets.length)
return false; return false;
const targets = moveTargets.multiple || moveTargets.targets.length === 1 let selectTargets: BattlerIndex[];
? moveTargets.targets switch (true) {
: moveTargets.targets.indexOf(target.getBattlerIndex()) > -1 case (moveTargets.multiple || moveTargets.targets.length === 1): {
? [ target.getBattlerIndex() ] selectTargets = moveTargets.targets;
: [ moveTargets.targets[user.randSeedInt(moveTargets.targets.length)] ]; break;
}
case (moveTargets.targets.indexOf(target.getBattlerIndex()) > -1): {
selectTargets = [ target.getBattlerIndex() ];
break;
}
default: {
moveTargets.targets.splice(moveTargets.targets.indexOf(user.getAlly().getBattlerIndex()));
selectTargets = [ moveTargets.targets[user.randSeedInt(moveTargets.targets.length)] ];
break;
}
}
const targets = selectTargets;
user.getMoveQueue().push({ move: move.moveId, targets: targets, ignorePP: true }); user.getMoveQueue().push({ move: move.moveId, targets: targets, ignorePP: true });
user.scene.unshiftPhase(new MovePhase(user.scene, user, targets, moveset[moveIndex], true)); user.scene.unshiftPhase(new MovePhase(user.scene, user, targets, moveset[moveIndex], true));
return true; return true;
@ -4481,8 +4493,8 @@ export function initMoves() {
.attr(AbilityCopyAttr), .attr(AbilityCopyAttr),
new SelfStatusMove(Moves.WISH, Type.NORMAL, -1, 10, -1, 0, 3) new SelfStatusMove(Moves.WISH, Type.NORMAL, -1, 10, -1, 0, 3)
.triageMove() .triageMove()
.unimplemented(), .attr(AddArenaTagAttr, ArenaTagType.WISH, 2, true),
new SelfStatusMove(Moves.ASSIST, Type.NORMAL, -1, 20, -1, 0, 3) new SelfStatusMove(Moves.ASSIST, Type.NORMAL, -1, 20, -1, 0, 3)
.attr(RandomMovesetMoveAttr, true) .attr(RandomMovesetMoveAttr, true)
.ignoresVirtual(), .ignoresVirtual(),
new SelfStatusMove(Moves.INGRAIN, Type.GRASS, -1, 20, -1, 0, 3) new SelfStatusMove(Moves.INGRAIN, Type.GRASS, -1, 20, -1, 0, 3)

View File

@ -18,8 +18,7 @@ import { TimeOfDay } from "../data/enums/time-of-day";
import { Terrain, TerrainType } from "../data/terrain"; import { Terrain, TerrainType } from "../data/terrain";
import { PostTerrainChangeAbAttr, PostWeatherChangeAbAttr, applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs } from "../data/ability"; import { PostTerrainChangeAbAttr, PostWeatherChangeAbAttr, applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs } from "../data/ability";
import Pokemon from "./pokemon"; import Pokemon from "./pokemon";
import { WEATHER_OVERRIDE } from '../overrides';
const WEATHER_OVERRIDE = WeatherType.NONE;
export class Arena { export class Arena {
public scene: BattleScene; public scene: BattleScene;

View File

@ -1,5 +1,5 @@
import Phaser from 'phaser'; import Phaser from 'phaser';
import BattleScene, { ABILITY_OVERRIDE, AnySound, MOVE_OVERRIDE, OPP_ABILITY_OVERRIDE, OPP_MOVE_OVERRIDE, OPP_SHINY_OVERRIDE, OPP_VARIANT_OVERRIDE } from '../battle-scene'; import BattleScene, { AnySound } from '../battle-scene';
import { Variant, VariantSet, variantColorCache } from '#app/data/variant'; import { Variant, VariantSet, variantColorCache } from '#app/data/variant';
import { variantData } from '#app/data/variant'; import { variantData } from '#app/data/variant';
import BattleInfo, { PlayerBattleInfo, EnemyBattleInfo } from '../ui/battle-info'; import BattleInfo, { PlayerBattleInfo, EnemyBattleInfo } from '../ui/battle-info';
@ -43,6 +43,7 @@ import { Nature, getNatureStatMultiplier } from '../data/nature';
import { SpeciesFormChange, SpeciesFormChangeActiveTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangePostMoveTrigger, SpeciesFormChangeStatusEffectTrigger } from '../data/pokemon-forms'; import { SpeciesFormChange, SpeciesFormChangeActiveTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangePostMoveTrigger, SpeciesFormChangeStatusEffectTrigger } from '../data/pokemon-forms';
import { TerrainType } from '../data/terrain'; import { TerrainType } from '../data/terrain';
import { TrainerSlot } from '../data/trainer-config'; import { TrainerSlot } from '../data/trainer-config';
import { ABILITY_OVERRIDE, MOVE_OVERRIDE, OPP_ABILITY_OVERRIDE, OPP_MOVE_OVERRIDE, OPP_SHINY_OVERRIDE, OPP_VARIANT_OVERRIDE } from '../overrides';
export enum FieldPosition { export enum FieldPosition {
CENTER, CENTER,
@ -657,7 +658,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
getHpRatio(precise: boolean = false): number { getHpRatio(precise: boolean = false): number {
return precise return precise
? this.hp / this.getMaxHp() ? this.hp / this.getMaxHp()
: ((this.hp / this.getMaxHp()) * 100) / 100; : Math.round((this.hp / this.getMaxHp()) * 100) / 100;
} }
generateGender(): void { generateGender(): void {

View File

@ -1,10 +1,11 @@
import { fixedBattles } from "./battle"; import { fixedBattles } from "./battle";
import BattleScene, { STARTING_BIOME_OVERRIDE, STARTING_LEVEL_OVERRIDE, STARTING_MONEY_OVERRIDE } from "./battle-scene"; import BattleScene from "./battle-scene";
import { Biome } from "./data/enums/biome"; import { Biome } from "./data/enums/biome";
import { Species } from "./data/enums/species"; import { Species } from "./data/enums/species";
import PokemonSpecies, { allSpecies } from "./data/pokemon-species"; import PokemonSpecies, { allSpecies } from "./data/pokemon-species";
import { Arena } from "./field/arena"; import { Arena } from "./field/arena";
import * as Utils from "./utils"; import * as Utils from "./utils";
import { STARTING_BIOME_OVERRIDE, STARTING_LEVEL_OVERRIDE, STARTING_MONEY_OVERRIDE } from './overrides';
export enum GameModes { export enum GameModes {
CLASSIC, CLASSIC,

View File

@ -59,4 +59,9 @@ export const menu: SimpleTranslationEntries = {
"escapeVerbSwitch": "auswechseln", "escapeVerbSwitch": "auswechseln",
"escapeVerbFlee": "flucht", "escapeVerbFlee": "flucht",
"notDisabled": "{{moveName}} ist\nnicht mehr deaktiviert!", "notDisabled": "{{moveName}} ist\nnicht mehr deaktiviert!",
"rankings": "Rankings",
"dailyRankings": "Daily Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
} as const; } as const;

View File

@ -78,4 +78,9 @@ export const menu: SimpleTranslationEntries = {
"skipItemQuestion": "Are you sure you want to skip taking an item?", "skipItemQuestion": "Are you sure you want to skip taking an item?",
"eggHatching": "Oh?", "eggHatching": "Oh?",
"ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?", "ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?",
"rankings": "Rankings",
"dailyRankings": "Daily Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
} as const; } as const;

View File

@ -61,5 +61,10 @@ export const menu: SimpleTranslationEntries = {
"notDisabled": "¡El movimiento {{moveName}}\nya no está anulado!", "notDisabled": "¡El movimiento {{moveName}}\nya no está anulado!",
"skipItemQuestion": "¿Estás seguro de que no quieres coger un objeto?", "skipItemQuestion": "¿Estás seguro de que no quieres coger un objeto?",
"eggHatching": "¿Y esto?", "eggHatching": "¿Y esto?",
"ivScannerUseQuestion": "¿Quieres usar el Escáner de IVs en {{pokemonName}}?" "ivScannerUseQuestion": "¿Quieres usar el Escáner de IVs en {{pokemonName}}?",
"rankings": "Rankings",
"dailyRankings": "Daily Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
} as const; } as const;

View File

@ -73,4 +73,9 @@ export const menu: SimpleTranslationEntries = {
"skipItemQuestion": "Êtes-vous sûr·e de ne pas vouloir prendre dobjet ?", "skipItemQuestion": "Êtes-vous sûr·e de ne pas vouloir prendre dobjet ?",
"eggHatching": "Oh ?", "eggHatching": "Oh ?",
"ivScannerUseQuestion": "Utiliser le Scanner dIV sur {{pokemonName}} ?", "ivScannerUseQuestion": "Utiliser le Scanner dIV sur {{pokemonName}} ?",
"rankings": "Rankings",
"dailyRankings": "Daily Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
} as const; } as const;

View File

@ -6,5 +6,10 @@ export const menu: SimpleTranslationEntries = {
"newGame": "Nuova Partita", "newGame": "Nuova Partita",
"loadGame": "Carica Partita", "loadGame": "Carica Partita",
"dailyRun": "Corsa Giornaliera (Beta)", "dailyRun": "Corsa Giornaliera (Beta)",
"selectGameMode": "Seleziona una modalità di gioco." "selectGameMode": "Seleziona una modalità di gioco.",
"rankings": "Rankings",
"dailyRankings": "Daily Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
} as const; } as const;

23
src/overrides.ts Normal file
View File

@ -0,0 +1,23 @@
import { Species } from './data/enums/species';
import { Abilities } from "./data/enums/abilities";
import { Biome } from "./data/enums/biome";
import { Moves } from "./data/enums/moves";
import { WeatherType } from "./data/weather";
export const SEED_OVERRIDE = '';
export const STARTER_SPECIES_OVERRIDE = 0;
export const STARTER_FORM_OVERRIDE = 0;
export const STARTING_LEVEL_OVERRIDE = 0;
export const STARTING_WAVE_OVERRIDE = 0;
export const STARTING_BIOME_OVERRIDE = Biome.TOWN;
export const STARTING_MONEY_OVERRIDE = 0;
export const WEATHER_OVERRIDE = WeatherType.NONE;
export const ABILITY_OVERRIDE = Abilities.NONE;
export const MOVE_OVERRIDE = Moves.NONE;
export const OPP_SPECIES_OVERRIDE = 0;
export const OPP_ABILITY_OVERRIDE = Abilities.NONE;
export const OPP_MOVE_OVERRIDE = Moves.NONE;
export const OPP_SHINY_OVERRIDE = false;
export const OPP_VARIANT_OVERRIDE = 0;

View File

@ -1,4 +1,4 @@
import BattleScene, { STARTER_FORM_OVERRIDE, STARTER_SPECIES_OVERRIDE, bypassLogin, startingWave } from "./battle-scene"; import BattleScene, { bypassLogin, startingWave } from "./battle-scene";
import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult, FieldPosition, HitResult, TurnMove } from "./field/pokemon"; import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult, FieldPosition, HitResult, TurnMove } from "./field/pokemon";
import * as Utils from './utils'; import * as Utils from './utils';
import { Moves } from "./data/enums/moves"; import { Moves } from "./data/enums/moves";
@ -57,6 +57,7 @@ import { fetchDailyRunSeed, getDailyRunStarters } from "./data/daily-run";
import { GameModes, gameModes } from "./game-mode"; import { GameModes, gameModes } from "./game-mode";
import { getPokemonSpecies, speciesStarters } from "./data/pokemon-species"; import { getPokemonSpecies, speciesStarters } from "./data/pokemon-species";
import i18next from './plugins/i18n'; import i18next from './plugins/i18n';
import { STARTER_FORM_OVERRIDE, STARTER_SPECIES_OVERRIDE } from './overrides';
export class LoginPhase extends Phase { export class LoginPhase extends Phase {
private showText: boolean; private showText: boolean;
@ -2547,7 +2548,7 @@ export class MoveEffectPhase extends PokemonPhase {
: 3 / (3 + Math.min(targetEvasionLevel.value - userAccuracyLevel.value, 6)); : 3 / (3 + Math.min(targetEvasionLevel.value - userAccuracyLevel.value, 6));
} }
applyBattleStatMultiplierAbAttrs(BattleStatMultiplierAbAttr, user, BattleStat.ACC, accuracyMultiplier); applyBattleStatMultiplierAbAttrs(BattleStatMultiplierAbAttr, user, BattleStat.ACC, accuracyMultiplier, this.move.getMove());
const evasionMultiplier = new Utils.NumberHolder(1); const evasionMultiplier = new Utils.NumberHolder(1);
applyBattleStatMultiplierAbAttrs(BattleStatMultiplierAbAttr, this.getTarget(), BattleStat.EVA, evasionMultiplier); applyBattleStatMultiplierAbAttrs(BattleStatMultiplierAbAttr, this.getTarget(), BattleStat.EVA, evasionMultiplier);

View File

@ -2,6 +2,7 @@ import BattleScene from "../battle-scene";
import { TextStyle, addTextObject } from "./text"; import { TextStyle, addTextObject } from "./text";
import { WindowVariant, addWindow } from "./ui-theme"; import { WindowVariant, addWindow } from "./ui-theme";
import * as Utils from "../utils"; import * as Utils from "../utils";
import i18next from "i18next";
interface RankingEntry { interface RankingEntry {
rank: integer, rank: integer,
@ -39,7 +40,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
const titleWindow = addWindow(this.scene, 0, 0, 114, 18, false, false, null, null, WindowVariant.THIN); const titleWindow = addWindow(this.scene, 0, 0, 114, 18, false, false, null, null, WindowVariant.THIN);
this.add(titleWindow); this.add(titleWindow);
this.titleLabel = addTextObject(this.scene, titleWindow.displayWidth / 2, titleWindow.displayHeight / 2, 'Daily Rankings', TextStyle.WINDOW, { fontSize: '64px' }); this.titleLabel = addTextObject(this.scene, titleWindow.displayWidth / 2, titleWindow.displayHeight / 2, i18next.t('menu:dailyRankings'), TextStyle.WINDOW, { fontSize: '64px' });
this.titleLabel.setOrigin(0.5, 0.5); this.titleLabel.setOrigin(0.5, 0.5);
this.add(this.titleLabel); this.add(this.titleLabel);
@ -141,7 +142,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
update(category: ScoreboardCategory = this.category, page: integer = this.page) { update(category: ScoreboardCategory = this.category, page: integer = this.page) {
this.rankingsContainer.removeAll(true); this.rankingsContainer.removeAll(true);
this.loadingLabel.setText('Loading…'); this.loadingLabel.setText(i18next.t('menu:loading'));
this.loadingLabel.setVisible(true); this.loadingLabel.setVisible(true);
if (category !== this.category) if (category !== this.category)
@ -155,7 +156,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
.then(jsonResponse => { .then(jsonResponse => {
this.page = page; this.page = page;
this.category = category; this.category = category;
this.titleLabel.setText(`${Utils.toReadableString(ScoreboardCategory[category])} Rankings`); this.titleLabel.setText(`${Utils.toReadableString(ScoreboardCategory[category])} ${i18next.t("menu:rankings")}`);
this.prevPageButton.setAlpha(page > 1 ? 1 : 0.5); this.prevPageButton.setAlpha(page > 1 ? 1 : 0.5);
this.nextPageButton.setAlpha(page < this.pageCount ? 1 : 0.5); this.nextPageButton.setAlpha(page < this.pageCount ? 1 : 0.5);
this.pageNumberLabel.setText(page.toString()); this.pageNumberLabel.setText(page.toString());
@ -163,7 +164,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
this.loadingLabel.setVisible(false); this.loadingLabel.setVisible(false);
this.updateRankings(jsonResponse); this.updateRankings(jsonResponse);
} else } else
this.loadingLabel.setText('No Rankings'); this.loadingLabel.setText(i18next.t('menu:noRankings'));
}); });
}); });
} }

View File

@ -383,6 +383,7 @@ export default class PartyUiHandler extends MessageUiHandler {
} }
const slotCount = this.partySlots.length; const slotCount = this.partySlots.length;
const battlerCount = this.scene.currentBattle.getBattlerCount();
switch (button) { switch (button) {
case Button.UP: case Button.UP:
@ -392,14 +393,20 @@ export default class PartyUiHandler extends MessageUiHandler {
success = this.setCursor(this.cursor < 6 ? this.cursor < slotCount - 1 ? this.cursor + 1 : 6 : 0); success = this.setCursor(this.cursor < 6 ? this.cursor < slotCount - 1 ? this.cursor + 1 : 6 : 0);
break; break;
case Button.LEFT: case Button.LEFT:
if (this.cursor >= this.scene.currentBattle.getBattlerCount() && this.cursor < 6) if (this.cursor >= battlerCount && this.cursor <= 6)
success = this.setCursor(0); success = this.setCursor(0);
break; break;
case Button.RIGHT: case Button.RIGHT:
const battlerCount = this.scene.currentBattle.getBattlerCount(); if (slotCount === battlerCount){
if (slotCount > battlerCount && this.cursor < battlerCount) success = this.setCursor(6);
success = this.setCursor(this.lastCursor < 6 ? this.lastCursor || battlerCount : battlerCount);
break; break;
} else if (battlerCount >= 2 && slotCount > battlerCount && this.getCursor() === 0 && this.lastCursor === 1){
success = this.setCursor(2);
break;
} else if (slotCount > battlerCount && this.cursor < battlerCount){
success = this.setCursor(this.lastCursor < 6 ? this.lastCursor || battlerCount : battlerCount);
break;
}
} }
} }

View File

@ -364,9 +364,16 @@ export default class SummaryUiHandler extends UiHandler {
case Button.LEFT: case Button.LEFT:
this.moveSelect = false; this.moveSelect = false;
this.setCursor(Page.STATS); this.setCursor(Page.STATS);
this.hideMoveEffect(); if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE){
success = true; this.hideMoveEffect();
break; this.destroyBlinkCursor();
success = true;
break;
} else {
this.hideMoveSelect();
success = true;
break;
}
} }
} }
} else { } else {
@ -426,11 +433,9 @@ export default class SummaryUiHandler extends UiHandler {
} }
setCursor(cursor: integer, overrideChanged: boolean = false): boolean { setCursor(cursor: integer, overrideChanged: boolean = false): boolean {
let changed: boolean; let changed: boolean = overrideChanged || this.moveCursor !== cursor;
if (this.moveSelect) { if (this.moveSelect) {
changed = overrideChanged || this.moveCursor !== cursor;
if (changed) {
this.moveCursor = cursor; this.moveCursor = cursor;
const selectedMove = this.getSelectedMove(); const selectedMove = this.getSelectedMove();
@ -462,7 +467,6 @@ export default class SummaryUiHandler extends UiHandler {
y: `-=${14.83 * (moveDescriptionLineCount - 3)}` y: `-=${14.83 * (moveDescriptionLineCount - 3)}`
}); });
} }
}
if (!this.moveCursorObj) { if (!this.moveCursorObj) {
this.moveCursorObj = this.scene.add.sprite(-2, 0, 'summary_moves_cursor', 'highlight'); this.moveCursorObj = this.scene.add.sprite(-2, 0, 'summary_moves_cursor', 'highlight');
@ -527,6 +531,11 @@ export default class SummaryUiHandler extends UiHandler {
this.setCursor(0, true); this.setCursor(0, true);
this.showMoveEffect(); this.showMoveEffect();
} }
else if (this.cursor===Page.MOVES) {
this.moveCursorObj = null;
this.showMoveSelect();
this.showMoveEffect();
}
} }
else else
this.summaryPageTransitionContainer.x -= 214; this.summaryPageTransitionContainer.x -= 214;
@ -871,6 +880,12 @@ export default class SummaryUiHandler extends UiHandler {
this.moveSelect = false; this.moveSelect = false;
this.extraMoveRowContainer.setVisible(false); this.extraMoveRowContainer.setVisible(false);
this.moveDescriptionText.setText(''); this.moveDescriptionText.setText('');
this.destroyBlinkCursor();
this.hideMoveEffect();
}
destroyBlinkCursor(){
if (this.moveCursorBlinkTimer) { if (this.moveCursorBlinkTimer) {
this.moveCursorBlinkTimer.destroy(); this.moveCursorBlinkTimer.destroy();
this.moveCursorBlinkTimer = null; this.moveCursorBlinkTimer = null;
@ -883,8 +898,6 @@ export default class SummaryUiHandler extends UiHandler {
this.selectedMoveCursorObj.destroy(); this.selectedMoveCursorObj.destroy();
this.selectedMoveCursorObj = null; this.selectedMoveCursorObj = null;
} }
this.hideMoveEffect();
} }
showMoveEffect(instant?: boolean) { showMoveEffect(instant?: boolean) {

View File

@ -5,6 +5,7 @@ import { Mode } from "./ui";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { TextStyle, addTextObject } from "./text"; import { TextStyle, addTextObject } from "./text";
import { battleCountSplashMessage, splashMessages } from "../data/splash-messages"; import { battleCountSplashMessage, splashMessages } from "../data/splash-messages";
import i18next from "i18next";
export default class TitleUiHandler extends OptionSelectUiHandler { export default class TitleUiHandler extends OptionSelectUiHandler {
private titleContainer: Phaser.GameObjects.Container; private titleContainer: Phaser.GameObjects.Container;
@ -37,7 +38,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
this.titleContainer.add(this.dailyRunScoreboard); this.titleContainer.add(this.dailyRunScoreboard);
this.playerCountLabel = addTextObject(this.scene, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - 90, '? Players Online', TextStyle.MESSAGE, { fontSize: '54px' }); this.playerCountLabel = addTextObject(this.scene, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - 90, `? ${i18next.t("menu:playersOnline")}`, TextStyle.MESSAGE, { fontSize: '54px' });
this.playerCountLabel.setOrigin(1, 0); this.playerCountLabel.setOrigin(1, 0);
this.titleContainer.add(this.playerCountLabel); this.titleContainer.add(this.playerCountLabel);
@ -61,7 +62,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
Utils.apiFetch(`game/titlestats`) Utils.apiFetch(`game/titlestats`)
.then(request => request.json()) .then(request => request.json())
.then(stats => { .then(stats => {
this.playerCountLabel.setText(`${stats.playerCount} Players Online`); this.playerCountLabel.setText(`${stats.playerCount} ${i18next.t("menu:playersOnline")}`);
if (this.splashMessage === battleCountSplashMessage) if (this.splashMessage === battleCountSplashMessage)
this.splashMessageText.setText(battleCountSplashMessage.replace('{COUNT}', stats.battleCount.toLocaleString('en-US'))); this.splashMessageText.setText(battleCountSplashMessage.replace('{COUNT}', stats.battleCount.toLocaleString('en-US')));
}); });