pokerogue/src/loading-scene.ts

498 lines
16 KiB
TypeScript
Raw Normal View History

[Feature] [Same species Egg] Egg class rewrite to enable fully parameterized eggs to generate same species eggs + Egg overrides (#1833) * Create variant-tiers enum * Added variant tier override property to the egg class * Added hasVariants function to pokemon species * Implement variant override logic to egg hatching phase * Delete src/enums/variant-tiers * Create variant-tiers enum * Added egg shiny and variant overrides * fixed egg comment in overrides.ts * Added override logic to egg hatch phase * Added species pool filter logic when global override is set * Added global egg tier override logic * Added global egg tier override * Added global gacha pull count override logic * Added global gacha pull count override * Renamed egg hatch override * Renamed egg hatch override * Added gacha pull without voucher global override * Renamed free gacha pull global override * Added free gacha pull override logic * Gacha pull count override name fix * Bugfix * restored defaults + savegame bugfix * eggOptions added to parameterize eggs. Added option to buy eggs of the same species. * Small Bugfix for same species egg generation * Removed translation from translator * Improved the isManaphyEgg() check * Fixed manaphy egg hatch wave count * Added comments to IEggOptions * Added eggOptions for hidden ability and rare egg move override * Merge Fix: Update egg-hatch-phase.ts * Fixed manaphy rates back to 1/256 like in PR #2182 * Renamed override, same species egg unlocks after passive is bought. Added code as comment for custom shiny, HA and rare egg move rates. * Merge fix. Moved enums. * quick fix for the commented out code * Fixed that you can't buy an egg over the 99 egg limit * Fix that you can't buy eternatus * Use already existing randSeedShuffle instead of my own function * Eternatus buyable again. Changed overrides to be able to set common tier/variants. Moved getGuaranteedEggTierFromPullCount(). * Changed eggOption gachaType to sourceType. Replaced eggOption overrideRareEggMove with eggMoveIndex to exatly specify an egg move. Moved egg move unlock logic into the egg class. Simplified shiny calculation. Added same species egg type descriptor. Moved custom rates for same species egg code into egg.ts. * Added 19 unit tests for eggs * Changed unit test description * Added higher rates for same species eggs * Adjusted same species egg cost for 1-3 cost starters and HA rates * Added legacy egg loading unit test. Fixed gachaType legacy value loaded from DB and legacy tier loading * Legacy egg loading from server DB fixed
2024-06-22 01:19:56 +01:00
import { GachaType } from "./enums/gacha-types";
import { trainerConfigs } from "./data/trainer-config";
import { getBiomeHasProps } from "./field/arena";
2024-04-14 20:47:00 +01:00
import CacheBustedLoaderPlugin from "./plugins/cache-busted-loader-plugin";
import { SceneBase } from "./scene-base";
import { WindowVariant, getWindowVariantSuffix } from "./ui/ui-theme";
2024-04-16 15:59:15 +01:00
import { isMobile } from "./touch-controls";
import * as Utils from "./utils";
import { initI18n } from "./plugins/i18n";
import {initPokemonPrevolutions} from "#app/data/pokemon-evolutions";
import {initBiomes} from "#app/data/biomes";
import {initEggMoves} from "#app/data/egg-moves";
import {initPokemonForms} from "#app/data/pokemon-forms";
import {initSpecies} from "#app/data/pokemon-species";
import {initMoves} from "#app/data/move";
import {initAbilities} from "#app/data/ability";
[Testing] Flexible Testing Wrapper for Phaser-Based Battle-Scenes (#1908) * refactor executed code while importing and initializing all of these in loading-scene * reset to main * fix server url * added rule no-trailing-spaces * made progress * test somme data from a session save is working * trying to launch a battle * added fetch wrapper to load data locally * trying to mockAllSettled * pushPhase & shiftPhase * check integrity of exported session * set toke + loggedInUser in tests * progress on starting new battle * tring to test phase but it's async * mocking fetch * working mock fetch * need to handle pile of data * attempt to use real phaser classes * reorder overrides * refactored to use some real classes from phaser * removed useless things * started to work on some container mock * finished the mockContainer time to add some logic * some more mock containers * removed addMethods since there is the mock classes now * commented issues * attempt to create mockTextureManager * fix tests * mockSprite & mockText * yes but not really * yes but not really * fix tutorial callback * reached mode title * added achievement tests * fix test achievements with current state of mock * correct sequence loading for BattleScene with mockLoader ! * deep dive into next step * working wait until starter selection screen * added newGame method into wrapper * expect to save_slot * trying to manage pokemon sprite for getAll without success yet * added test for egg output * fixed egg test for June * fix tests + locate next issue to fix * we are in battle baby * added new game in one-line * export is working but export only what's in the fetch * fix start game as guest * refactored how we start a battle + cleanup * overrided mewtwo but issue with currentBattle * refactor: rename InitAchievements to initAchievements * added missing mock method * override level and pokemon forms working as intended * bringToTop Obj * remove launch battle in achivement test * fix getIndex when same pokemon * can run all tests * first attack, faint, and shop modifiers, MockClock * on method for container * added doAttack one-liner * one-line export data * removed throw error * feat: Make `scenes` property of `GameWrapper` class public The `scenes` property of the `GameWrapper` class was changed from private to public. This change allows external access to the `scenes` map, which is used to store Phaser scenes. This modification was made to enable easier manipulation and interaction with the scenes in the game. * correction * removed CanvasRenderer * added a param to remove console.log and added a param to preven scene create call * fix encounter wave 30 when it's a trainer * test double-battle * test fight without KO * test double fight no ko * fix crashing texture + added Text wrapper to log fight * fix tests on boss - trainer - rival * chore: Refactor BattleScene initialization and add new phases Refactor the BattleScene initialization code to remove unnecessary delay and improve performance. Also, add new phases for the title and unavailable states to enhance the game experience. * rework of Game tests * skipFn is working * added onNextPrompt and restore Og Start * better newGame * added skipFN in remove * not yet working test but updated interceptors * do attack work but not on PostSummonPhase phase when there is mention of silcoon and wurmple * error located, it's just a double fight, i was not there yet * single OHKO & double no OHKO * added expirationFn into next prompt * all tests are passing * working test on non damaging move from opponent * cleaned a bit * removed phaser initialisation on every tests * renamed test file * added load system data * added some ability support * added onKill & onSummon abilities test * removed useless test + cleanup * removed useless test + cleanup * fixed tests after merge main * added itemHeld endTurn trigger test (toxic orb) * added runFrom..To * added mustRun to assert currentPhase * added no-miss move to test things * cleaner restore mock * fix test * fix moxie test + game speed * improve test speed * added onOurself and onOpponent mvoe test * added onDamage test for tackle * removed timeout in intervals to run tests faster * cleanup * added never crit override + separate file per test + remove randomness in randBattleSeedInt * move folders * better org * renamed itemHeld folder to items * fix deploy.yml * cleanup * simplified the gameManager start battle and allow single pokemon in party * remove the need of mode development * added input handler to test inputs + remove time from phaser into inputController * added keyboard support * added fakeMobile support * added details * removed a console.log + added logUp * move test to folder * fixed canvas issue * added starter select tests * added some more test on starter-select * added battle-order tests * added battle-order tests * fixing Phaser RNG * ordering stats for better reading * fix tests for main * adapt battle-order test to be more readable * fix merge * fix some errors and silent all errors from gameWrapper since it's not possible to avoid them * fix mocks to manage childs & stuffs * added some docs * fix achievement test * removed an unused file * separate misc tests to clean battle.test file * added a basic french lokalization test * added i18n where it needs to be used only * revers extracted method * removed unused method * removed handler fetch since we do not test anything server related * fix test with handlers removed * added intrepid sword test * fix enum exp party --------- Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt>
2024-06-07 23:33:45 +01:00
import {initAchievements} from "#app/system/achv";
import {initTrainerTypeDialogue} from "#app/data/dialogue";
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
import { initChallenges } from "./data/challenge";
import i18next from "i18next";
2024-05-27 18:47:15 +01:00
import { initStatsKeys } from "./ui/game-stats-ui-handler";
2024-06-08 04:50:07 +01:00
import { initVouchers } from "./system/voucher";
import { Biome } from "#enums/biome";
import { TrainerType } from "#enums/trainer-type";
import {initMysteryEncounterDialogue} from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue";
import {initMysteryEncounters} from "#app/data/mystery-encounters/mystery-encounters";
export class LoadingScene extends SceneBase {
readonly LOAD_EVENTS = Phaser.Loader.Events;
constructor() {
super("loading");
2024-04-14 20:47:00 +01:00
Phaser.Plugins.PluginCache.register("Loader", CacheBustedLoaderPlugin, "load");
initI18n();
}
preload() {
Utils.localPing();
this.load["manifest"] = this.game["manifest"];
this.loadImage("loading_bg", "arenas");
this.loadImage("logo", "");
2024-06-14 17:42:37 +01:00
this.loadImage("pride-update", "events");
// Load menu images
this.loadAtlas("bg", "ui");
this.loadAtlas("prompt", "ui");
this.loadImage("candy", "ui");
this.loadImage("candy_overlay", "ui");
this.loadImage("cursor", "ui");
this.loadImage("cursor_reverse", "ui");
for (const wv of Utils.getEnumValues(WindowVariant)) {
for (let w = 1; w <= 5; w++) {
this.loadImage(`window_${w}${getWindowVariantSuffix(wv)}`, "ui/windows");
}
}
this.loadAtlas("namebox", "ui");
this.loadImage("pbinfo_player", "ui");
this.loadImage("pbinfo_player_stats", "ui");
this.loadImage("pbinfo_player_mini", "ui");
this.loadImage("pbinfo_player_mini_stats", "ui");
this.loadAtlas("pbinfo_player_type", "ui");
this.loadAtlas("pbinfo_player_type1", "ui");
this.loadAtlas("pbinfo_player_type2", "ui");
this.loadImage("pbinfo_enemy_mini", "ui");
this.loadImage("pbinfo_enemy_mini_stats", "ui");
this.loadImage("pbinfo_enemy_boss", "ui");
this.loadImage("pbinfo_enemy_boss_stats", "ui");
this.loadAtlas("pbinfo_enemy_type", "ui");
this.loadAtlas("pbinfo_enemy_type1", "ui");
this.loadAtlas("pbinfo_enemy_type2", "ui");
this.loadAtlas("pbinfo_stat", "ui");
this.loadAtlas("pbinfo_stat_numbers", "ui");
this.loadImage("overlay_lv", "ui");
this.loadAtlas("numbers", "ui");
this.loadAtlas("numbers_red", "ui");
this.loadAtlas("overlay_hp", "ui");
this.loadAtlas("overlay_hp_boss", "ui");
this.loadImage("overlay_exp", "ui");
this.loadImage("icon_owned", "ui");
this.loadImage("ability_bar_left", "ui");
this.loadImage("bgm_bar", "ui");
this.loadImage("party_exp_bar", "ui");
this.loadImage("achv_bar", "ui");
this.loadImage("achv_bar_2", "ui");
this.loadImage("achv_bar_3", "ui");
this.loadImage("achv_bar_4", "ui");
this.loadImage("achv_bar_5", "ui");
this.loadImage("shiny_star", "ui", "shiny.png");
this.loadImage("shiny_star_1", "ui", "shiny_1.png");
this.loadImage("shiny_star_2", "ui", "shiny_2.png");
this.loadImage("shiny_star_small", "ui", "shiny_small.png");
this.loadImage("shiny_star_small_1", "ui", "shiny_small_1.png");
this.loadImage("shiny_star_small_2", "ui", "shiny_small_2.png");
this.loadAtlas("shiny_icons", "ui");
this.loadImage("ha_capsule", "ui", "ha_capsule.png");
this.loadImage("champion_ribbon", "ui", "champion_ribbon.png");
this.loadImage("icon_spliced", "ui");
this.loadImage("icon_tera", "ui");
this.loadImage("type_tera", "ui");
this.loadAtlas("type_bgs", "ui");
this.loadImage("dawn_icon_fg", "ui");
this.loadImage("dawn_icon_mg", "ui");
this.loadImage("dawn_icon_bg", "ui");
this.loadImage("day_icon_fg", "ui");
this.loadImage("day_icon_mg", "ui");
this.loadImage("day_icon_bg", "ui");
this.loadImage("dusk_icon_fg", "ui");
this.loadImage("dusk_icon_mg", "ui");
this.loadImage("dusk_icon_bg", "ui");
this.loadImage("night_icon_fg", "ui");
this.loadImage("night_icon_mg", "ui");
this.loadImage("night_icon_bg", "ui");
this.loadImage("pb_tray_overlay_player", "ui");
this.loadImage("pb_tray_overlay_enemy", "ui");
this.loadAtlas("pb_tray_ball", "ui");
this.loadImage("party_bg", "ui");
this.loadImage("party_bg_double", "ui");
this.loadAtlas("party_slot_main", "ui");
this.loadAtlas("party_slot", "ui");
this.loadImage("party_slot_overlay_lv", "ui");
this.loadImage("party_slot_hp_bar", "ui");
this.loadAtlas("party_slot_hp_overlay", "ui");
this.loadAtlas("party_pb", "ui");
this.loadAtlas("party_cancel", "ui");
this.loadImage("summary_bg", "ui");
this.loadImage("summary_overlay_shiny", "ui");
this.loadImage("summary_profile", "ui");
this.loadImage("summary_profile_prompt_z", "ui"); // The pixel Z button prompt
this.loadImage("summary_profile_prompt_a", "ui"); // The pixel A button prompt
this.loadImage("summary_profile_ability", "ui"); // Pixel text 'ABILITY'
this.loadImage("summary_profile_passive", "ui"); // Pixel text 'PASSIVE'
this.loadImage("summary_status", "ui");
this.loadImage("summary_stats", "ui");
this.loadImage("summary_stats_overlay_exp", "ui");
this.loadImage("summary_moves", "ui");
this.loadImage("summary_moves_effect", "ui");
this.loadImage("summary_moves_overlay_row", "ui");
this.loadImage("summary_moves_overlay_pp", "ui");
this.loadAtlas("summary_moves_cursor", "ui");
for (let t = 1; t <= 3; t++) {
this.loadImage(`summary_tabs_${t}`, "ui");
}
this.loadImage("starter_select_bg", "ui");
this.loadImage("select_cursor", "ui");
this.loadImage("select_cursor_highlight", "ui");
this.loadImage("select_cursor_highlight_thick", "ui");
this.loadImage("select_cursor_pokerus", "ui");
this.loadImage("select_gen_cursor", "ui");
this.loadImage("select_gen_cursor_highlight", "ui");
this.loadImage("saving_icon", "ui");
this.loadImage("default_bg", "arenas");
// Load arena images
Utils.getEnumValues(Biome).map(bt => {
const btKey = Biome[bt].toLowerCase();
const isBaseAnimated = btKey === "end";
const baseAKey = `${btKey}_a`;
const baseBKey = `${btKey}_b`;
this.loadImage(`${btKey}_bg`, "arenas");
if (!isBaseAnimated) {
this.loadImage(baseAKey, "arenas");
} else {
this.loadAtlas(baseAKey, "arenas");
}
if (!isBaseAnimated) {
this.loadImage(baseBKey, "arenas");
} else {
this.loadAtlas(baseBKey, "arenas");
}
if (getBiomeHasProps(bt)) {
for (let p = 1; p <= 3; p++) {
const isPropAnimated = p === 3 && [ "power_plant", "end" ].find(b => b === btKey);
const propKey = `${btKey}_b_${p}`;
if (!isPropAnimated) {
this.loadImage(propKey, "arenas");
} else {
this.loadAtlas(propKey, "arenas");
}
}
}
});
// Load bitmap fonts
this.load.bitmapFont("item-count", "fonts/item-count.png", "fonts/item-count.xml");
// Load trainer images
this.loadAtlas("trainer_m_back", "trainer");
this.loadAtlas("trainer_m_back_pb", "trainer");
this.loadAtlas("trainer_f_back", "trainer");
this.loadAtlas("trainer_f_back_pb", "trainer");
Utils.getEnumValues(TrainerType).map(tt => {
const config = trainerConfigs[tt];
this.loadAtlas(config.getSpriteKey(), "trainer");
if (config.doubleOnly || config.hasDouble) {
this.loadAtlas(config.getSpriteKey(true), "trainer");
}
});
// Load character sprites
this.loadAtlas("c_rival_m", "character", "rival_m");
this.loadAtlas("c_rival_f", "character", "rival_f");
// Load pokemon-related images
this.loadImage("pkmn__back__sub", "pokemon/back", "sub.png");
this.loadImage("pkmn__sub", "pokemon", "sub.png");
this.loadAtlas("battle_stats", "effects");
this.loadAtlas("shiny", "effects");
this.loadAtlas("shiny_2", "effects");
this.loadAtlas("shiny_3", "effects");
this.loadImage("tera", "effects");
this.loadAtlas("pb_particles", "effects");
this.loadImage("evo_sparkle", "effects");
this.loadAtlas("tera_sparkle", "effects");
this.load.video("evo_bg", "images/effects/evo_bg.mp4", true);
this.loadAtlas("pb", "");
this.loadAtlas("items", "");
this.loadAtlas("types", "");
// Get current lang and load the types atlas for it. English will only load types while all other languages will load types and types_<lang>
const lang = i18next.resolvedLanguage;
if (lang !== "en") {
if (Utils.verifyLang(lang)) {
this.loadAtlas(`types_${lang}`, "");
} else {
// Fallback to English
this.loadAtlas("types", "");
}
} else {
this.loadAtlas("types", "");
}
this.loadAtlas("statuses", "");
this.loadAtlas("categories", "");
2024-05-24 00:45:04 +01:00
this.loadAtlas("egg", "egg");
this.loadAtlas("egg_crack", "egg");
this.loadAtlas("egg_icons", "egg");
this.loadAtlas("egg_shard", "egg");
this.loadAtlas("egg_lightrays", "egg");
Utils.getEnumKeys(GachaType).forEach(gt => {
const key = gt.toLowerCase();
this.loadImage(`gacha_${key}`, "egg");
this.loadAtlas(`gacha_underlay_${key}`, "egg");
});
this.loadImage("gacha_glass", "egg");
this.loadImage("gacha_eggs", "egg");
this.loadAtlas("gacha_hatch", "egg");
this.loadImage("gacha_knob", "egg");
this.loadImage("egg_list_bg", "ui");
this.loadImage("end_m", "cg");
this.loadImage("end_f", "cg");
2024-05-17 02:41:38 +01:00
2024-04-19 03:52:26 +01:00
for (let i = 0; i < 10; i++) {
this.loadAtlas(`pokemon_icons_${i}`, "");
if (i) {
this.loadAtlas(`pokemon_icons_${i}v`, "");
}
2024-04-19 03:52:26 +01:00
}
this.loadAtlas("dualshock", "inputs");
this.loadAtlas("xbox", "inputs");
this.loadAtlas("keyboard", "inputs");
this.loadSe("select");
this.loadSe("menu_open");
this.loadSe("hit");
this.loadSe("hit_strong");
this.loadSe("hit_weak");
this.loadSe("stat_up");
this.loadSe("stat_down");
this.loadSe("faint");
this.loadSe("flee");
this.loadSe("low_hp");
this.loadSe("exp");
this.loadSe("level_up");
this.loadSe("sparkle");
this.loadSe("restore");
this.loadSe("shine");
this.loadSe("shing");
this.loadSe("charge");
this.loadSe("beam");
this.loadSe("upgrade");
this.loadSe("buy");
this.loadSe("achv");
this.loadSe("error");
this.loadSe("pb_rel");
this.loadSe("pb_throw");
this.loadSe("pb_bounce_1");
this.loadSe("pb_bounce_2");
this.loadSe("pb_move");
this.loadSe("pb_catch");
this.loadSe("pb_lock");
this.loadSe("pb_tray_enter");
this.loadSe("pb_tray_ball");
this.loadSe("pb_tray_empty");
this.loadSe("egg_crack");
this.loadSe("egg_hatch");
this.loadSe("gacha_dial");
this.loadSe("gacha_running");
this.loadSe("gacha_dispense");
this.loadSe("PRSFX- Transform", "battle_anims");
this.loadBgm("menu");
this.loadBgm("level_up_fanfare", "bw/level_up_fanfare.mp3");
this.loadBgm("item_fanfare", "bw/item_fanfare.mp3");
this.loadBgm("minor_fanfare", "bw/minor_fanfare.mp3");
this.loadBgm("heal", "bw/heal.mp3");
this.loadBgm("victory_trainer", "bw/victory_trainer.mp3");
2024-06-25 04:51:13 +01:00
this.loadBgm("victory_team_plasma", "bw/victory_team_plasma.mp3");
this.loadBgm("victory_gym", "bw/victory_gym.mp3");
this.loadBgm("victory_champion", "bw/victory_champion.mp3");
this.loadBgm("evolution", "bw/evolution.mp3");
this.loadBgm("evolution_fanfare", "bw/evolution_fanfare.mp3");
this.load.plugin("rextexteditplugin", "https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexteditplugin.min.js", true);
this.loadLoadingScreen();
2024-06-08 04:50:07 +01:00
initVouchers();
[Testing] Flexible Testing Wrapper for Phaser-Based Battle-Scenes (#1908) * refactor executed code while importing and initializing all of these in loading-scene * reset to main * fix server url * added rule no-trailing-spaces * made progress * test somme data from a session save is working * trying to launch a battle * added fetch wrapper to load data locally * trying to mockAllSettled * pushPhase & shiftPhase * check integrity of exported session * set toke + loggedInUser in tests * progress on starting new battle * tring to test phase but it's async * mocking fetch * working mock fetch * need to handle pile of data * attempt to use real phaser classes * reorder overrides * refactored to use some real classes from phaser * removed useless things * started to work on some container mock * finished the mockContainer time to add some logic * some more mock containers * removed addMethods since there is the mock classes now * commented issues * attempt to create mockTextureManager * fix tests * mockSprite & mockText * yes but not really * yes but not really * fix tutorial callback * reached mode title * added achievement tests * fix test achievements with current state of mock * correct sequence loading for BattleScene with mockLoader ! * deep dive into next step * working wait until starter selection screen * added newGame method into wrapper * expect to save_slot * trying to manage pokemon sprite for getAll without success yet * added test for egg output * fixed egg test for June * fix tests + locate next issue to fix * we are in battle baby * added new game in one-line * export is working but export only what's in the fetch * fix start game as guest * refactored how we start a battle + cleanup * overrided mewtwo but issue with currentBattle * refactor: rename InitAchievements to initAchievements * added missing mock method * override level and pokemon forms working as intended * bringToTop Obj * remove launch battle in achivement test * fix getIndex when same pokemon * can run all tests * first attack, faint, and shop modifiers, MockClock * on method for container * added doAttack one-liner * one-line export data * removed throw error * feat: Make `scenes` property of `GameWrapper` class public The `scenes` property of the `GameWrapper` class was changed from private to public. This change allows external access to the `scenes` map, which is used to store Phaser scenes. This modification was made to enable easier manipulation and interaction with the scenes in the game. * correction * removed CanvasRenderer * added a param to remove console.log and added a param to preven scene create call * fix encounter wave 30 when it's a trainer * test double-battle * test fight without KO * test double fight no ko * fix crashing texture + added Text wrapper to log fight * fix tests on boss - trainer - rival * chore: Refactor BattleScene initialization and add new phases Refactor the BattleScene initialization code to remove unnecessary delay and improve performance. Also, add new phases for the title and unavailable states to enhance the game experience. * rework of Game tests * skipFn is working * added onNextPrompt and restore Og Start * better newGame * added skipFN in remove * not yet working test but updated interceptors * do attack work but not on PostSummonPhase phase when there is mention of silcoon and wurmple * error located, it's just a double fight, i was not there yet * single OHKO & double no OHKO * added expirationFn into next prompt * all tests are passing * working test on non damaging move from opponent * cleaned a bit * removed phaser initialisation on every tests * renamed test file * added load system data * added some ability support * added onKill & onSummon abilities test * removed useless test + cleanup * removed useless test + cleanup * fixed tests after merge main * added itemHeld endTurn trigger test (toxic orb) * added runFrom..To * added mustRun to assert currentPhase * added no-miss move to test things * cleaner restore mock * fix test * fix moxie test + game speed * improve test speed * added onOurself and onOpponent mvoe test * added onDamage test for tackle * removed timeout in intervals to run tests faster * cleanup * added never crit override + separate file per test + remove randomness in randBattleSeedInt * move folders * better org * renamed itemHeld folder to items * fix deploy.yml * cleanup * simplified the gameManager start battle and allow single pokemon in party * remove the need of mode development * added input handler to test inputs + remove time from phaser into inputController * added keyboard support * added fakeMobile support * added details * removed a console.log + added logUp * move test to folder * fixed canvas issue * added starter select tests * added some more test on starter-select * added battle-order tests * added battle-order tests * fixing Phaser RNG * ordering stats for better reading * fix tests for main * adapt battle-order test to be more readable * fix merge * fix some errors and silent all errors from gameWrapper since it's not possible to avoid them * fix mocks to manage childs & stuffs * added some docs * fix achievement test * removed an unused file * separate misc tests to clean battle.test file * added a basic french lokalization test * added i18n where it needs to be used only * revers extracted method * removed unused method * removed handler fetch since we do not test anything server related * fix test with handlers removed * added intrepid sword test * fix enum exp party --------- Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt>
2024-06-07 23:33:45 +01:00
initAchievements();
2024-05-27 18:47:15 +01:00
initStatsKeys();
initPokemonPrevolutions();
initBiomes();
initEggMoves();
initPokemonForms();
initTrainerTypeDialogue();
initSpecies();
initMoves();
initAbilities();
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
initChallenges();
initMysteryEncounterDialogue();
initMysteryEncounters();
}
loadLoadingScreen() {
2024-04-19 13:45:21 +01:00
const mobile = isMobile();
2024-04-15 18:10:09 +01:00
const loadingGraphics: any[] = [];
const bg = this.add.image(0, 0, "");
bg.setOrigin(0, 0);
bg.setScale(6);
bg.setVisible(false);
const graphics = this.add.graphics();
graphics.lineStyle(4, 0xff00ff, 1).setDepth(10);
const progressBar = this.add.graphics();
const progressBox = this.add.graphics();
progressBox.lineStyle(5, 0xff00ff, 1.0);
progressBox.fillStyle(0x222222, 0.8);
const width = this.cameras.main.width;
const height = this.cameras.main.height;
2024-06-05 02:41:36 +01:00
const midWidth = width / 2;
const midHeight = height / 2;
const logo = this.add.image(midWidth, 240, "");
logo.setVisible(false);
logo.setOrigin(0.5, 0.5);
logo.setScale(4);
const percentText = this.make.text({
2024-06-05 02:41:36 +01:00
x: midWidth,
y: midHeight - 24,
text: "0%",
style: {
font: "72px emerald",
color: "#ffffff",
},
});
percentText.setOrigin(0.5, 0.5);
const assetText = this.make.text({
2024-06-05 02:41:36 +01:00
x: midWidth,
y: midHeight + 48,
text: "",
style: {
font: "48px emerald",
color: "#ffffff",
},
});
assetText.setOrigin(0.5, 0.5);
2024-06-05 02:41:36 +01:00
const disclaimerText = this.make.text({
x: midWidth,
y: assetText.y + 152,
text: i18next.t("menu:disclaimer"),
style: {
font: "72px emerald",
color: "#DA3838",
},
});
disclaimerText.setOrigin(0.5, 0.5);
const disclaimerDescriptionText = this.make.text({
x: midWidth,
y: disclaimerText.y + 120,
text: i18next.t("menu:disclaimerDescription"),
style: {
font: "48px emerald",
color: "#ffffff",
align: "center"
},
});
disclaimerDescriptionText.setOrigin(0.5, 0.5);
loadingGraphics.push(bg, graphics, progressBar, progressBox, logo, percentText, assetText, disclaimerText, disclaimerDescriptionText);
if (!mobile) {
loadingGraphics.map(g => g.setVisible(false));
}
2024-06-05 02:41:36 +01:00
2024-04-15 18:10:09 +01:00
const intro = this.add.video(0, 0);
intro.on(Phaser.GameObjects.Events.VIDEO_COMPLETE, (video: Phaser.GameObjects.Video) => {
this.tweens.add({
targets: intro,
duration: 500,
alpha: 0,
ease: "Sine.easeIn",
onComplete: () => video.destroy(),
});
loadingGraphics.forEach(g => g.setVisible(true));
});
2024-04-15 18:10:09 +01:00
intro.setOrigin(0, 0);
intro.setScale(3);
this.load.once(this.LOAD_EVENTS.START, () => {
// videos do not need to be preloaded
intro.loadURL("images/intro_dark.mp4", true);
if (mobile) {
intro.video.setAttribute("webkit-playsinline", "webkit-playsinline");
intro.video.setAttribute("playsinline", "playsinline");
}
intro.play();
});
this.load.on(this.LOAD_EVENTS.PROGRESS , (progress: number) => {
percentText.setText(`${Math.floor(progress * 100)}%`);
progressBar.clear();
progressBar.fillStyle(0xffffff, 0.8);
progressBar.fillRect(midWidth - 320, 360, 640 * progress, 64);
});
2024-05-24 00:45:04 +01:00
this.load.on(this.LOAD_EVENTS.FILE_COMPLETE, (key: string) => {
assetText.setText(i18next.t("menu:loadingAsset", { assetName: key }));
switch (key) {
case "loading_bg":
bg.setTexture("loading_bg");
if (mobile) {
bg.setVisible(true);
}
break;
case "logo":
logo.setTexture("logo");
if (mobile) {
logo.setVisible(true);
}
break;
}
});
this.load.on(this.LOAD_EVENTS.COMPLETE, () => loadingGraphics.forEach(go => go.destroy()));
}
get gameHeight() {
return this.game.config.height as number;
}
get gameWidth() {
return this.game.config.width as number;
}
async create() {
this.scene.start("battle");
}
}