mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-19 08:15:24 +01:00
* implement illusion ability with unit test and localizations * try removing whitespace change on unnecessary files * nit corrections * nit update src/field/pokemon.ts Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com> * nit update src/phases.ts Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * illusion test correction * unexpected error correction * refactor property pokemon.illusion to pokemon.battleData.illusion * nit * nit * update unit test up-to-date * add docs * merge up to date * bugfix * bugfix * merge up to date * refactor field illusion out of battleData * fix nit * fix nit * Zoroark change illusion after lastPokemon update * Zoroark change illusion after lastPokemon update * refactor bug fix * bugfix * bug fix on tests * Update src/field/pokemon.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * use GetFailedText * remove useless import * add condition 'no illusion' into transform move * wild Zoroark creates an illusion according to the current biome * wild Zoroark creates an illusion according to the current biome * delete console.log() * add doc * Update src/field/pokemon.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * fix tests * update locales submodule * update Illusion interface * bug fix * bug fix * bugfix * rename some params for future implementations * Zoroark keep illusion between battles * Zoroark keep illusion between battles * delete draft * merge up-to-date * bugfix * merge * merge * implement canApplyPresummon method * Update test/abilities/illusion.test.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update test/abilities/illusion.test.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update test/abilities/illusion.test.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * nit * review corrections * nit * type hints affected by enemy illusion * type hints affected by enemy illusionin fight-ui-handler * nit * rename some parameters back in useIllusion * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * refactor battleData.illusion as summonData.illusion and delete oncePerBattleClause * add comments * illusion will break before evolution * Update src/field/pokemon.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * bug fix * g * get submodule back * get submodule back * bug fix to save illusion status * add pokemon.getPokeball() * Update src/field/pokemon.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com> Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
import type { InputFieldConfig } from "./form-modal-ui-handler";
|
|
import { FormModalUiHandler } from "./form-modal-ui-handler";
|
|
import type { ModalConfig } from "./modal-ui-handler";
|
|
import i18next from "i18next";
|
|
import type { PlayerPokemon } from "#app/field/pokemon";
|
|
|
|
export default class RenameFormUiHandler extends FormModalUiHandler {
|
|
getModalTitle(_config?: ModalConfig): string {
|
|
return i18next.t("menu:renamePokemon");
|
|
}
|
|
|
|
getWidth(_config?: ModalConfig): number {
|
|
return 160;
|
|
}
|
|
|
|
getMargin(_config?: ModalConfig): [number, number, number, number] {
|
|
return [0, 0, 48, 0];
|
|
}
|
|
|
|
getButtonLabels(_config?: ModalConfig): string[] {
|
|
return [i18next.t("menu:rename"), i18next.t("menu:cancel")];
|
|
}
|
|
|
|
getReadableErrorMessage(error: string): string {
|
|
const colonIndex = error?.indexOf(":");
|
|
if (colonIndex > 0) {
|
|
error = error.slice(0, colonIndex);
|
|
}
|
|
|
|
return super.getReadableErrorMessage(error);
|
|
}
|
|
|
|
override getInputFieldConfigs(): InputFieldConfig[] {
|
|
return [{ label: i18next.t("menu:nickname") }];
|
|
}
|
|
|
|
show(args: any[]): boolean {
|
|
if (super.show(args)) {
|
|
const config = args[0] as ModalConfig;
|
|
if (args[1] && typeof (args[1] as PlayerPokemon).getNameToRender === "function") {
|
|
this.inputs[0].text = (args[1] as PlayerPokemon).getNameToRender(false);
|
|
} else {
|
|
this.inputs[0].text = args[1];
|
|
}
|
|
this.submitAction = _ => {
|
|
this.sanitizeInputs();
|
|
const sanitizedName = btoa(unescape(encodeURIComponent(this.inputs[0].text)));
|
|
config.buttonActions[0](sanitizedName);
|
|
return true;
|
|
};
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|