Merge branch 'pagefaultgames:main' into main

pull/728/head
Zedarflight 2024-05-10 18:41:09 -07:00 committed by GitHub
commit 8abd7e2a1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 102 additions and 80 deletions

View File

@ -1978,7 +1978,7 @@
}, },
{ {
"frameIndex": 0, "frameIndex": 0,
"resourceName": "PRAS- Sketch and Lick", "resourceName": "PRAS- Sketch + Lick",
"bgX": 0, "bgX": 0,
"bgY": 0, "bgY": 0,
"opacity": 0, "opacity": 0,

View File

@ -759,6 +759,8 @@ export default class BattleScene extends SceneBase {
this.newArena(Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN); this.newArena(Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN);
this.field.setVisible(true);
this.arenaBgTransition.setPosition(0, 0); this.arenaBgTransition.setPosition(0, 0);
this.arenaPlayer.setPosition(300, 0); this.arenaPlayer.setPosition(300, 0);
this.arenaPlayerTransition.setPosition(0, 0); this.arenaPlayerTransition.setPosition(0, 0);

View File

@ -1,6 +1,6 @@
import { Moves } from "./enums/moves"; import { Moves } from "./enums/moves";
import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims"; import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims";
import { BattleEndPhase, MovePhase, NewBattlePhase, PartyEffectPhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase } from "../phases"; import { BattleEndPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase } from "../phases";
import { BattleStat, getBattleStatName } from "./battle-stat"; import { BattleStat, getBattleStatName } from "./battle-stat";
import { EncoreTag } from "./battler-tags"; import { EncoreTag } from "./battler-tags";
import { BattlerTagType } from "./enums/battler-tag-type"; import { BattlerTagType } from "./enums/battler-tag-type";

View File

@ -3181,9 +3181,9 @@ export function getStarterValueFriendshipCap(value: integer): integer {
} }
export const starterPassiveAbilities = { export const starterPassiveAbilities = {
[Species.BULBASAUR]: Abilities.SOLAR_POWER, [Species.BULBASAUR]: Abilities.GRASSY_SURGE,
[Species.CHARMANDER]: Abilities.INTIMIDATE, [Species.CHARMANDER]: Abilities.SHEER_FORCE,
[Species.SQUIRTLE]: Abilities.DAUNTLESS_SHIELD, [Species.SQUIRTLE]: Abilities.STURDY,
[Species.CATERPIE]: Abilities.MAGICIAN, [Species.CATERPIE]: Abilities.MAGICIAN,
[Species.WEEDLE]: Abilities.TECHNICIAN, [Species.WEEDLE]: Abilities.TECHNICIAN,
[Species.PIDGEY]: Abilities.GALE_WINGS, [Species.PIDGEY]: Abilities.GALE_WINGS,
@ -3238,7 +3238,7 @@ export const starterPassiveAbilities = {
[Species.MAGIKARP]: Abilities.MULTISCALE, [Species.MAGIKARP]: Abilities.MULTISCALE,
[Species.LAPRAS]: Abilities.LIQUID_VOICE, [Species.LAPRAS]: Abilities.LIQUID_VOICE,
[Species.DITTO]: Abilities.GOOEY, [Species.DITTO]: Abilities.GOOEY,
[Species.EEVEE]: Abilities.PROTEAN, [Species.EEVEE]: Abilities.SIMPLE,
[Species.PORYGON]: Abilities.QUARK_DRIVE, [Species.PORYGON]: Abilities.QUARK_DRIVE,
[Species.OMANYTE]: Abilities.ANGER_SHELL, [Species.OMANYTE]: Abilities.ANGER_SHELL,
[Species.KABUTO]: Abilities.SHARPNESS, [Species.KABUTO]: Abilities.SHARPNESS,
@ -3246,18 +3246,18 @@ export const starterPassiveAbilities = {
[Species.ARTICUNO]: Abilities.SNOW_WARNING, [Species.ARTICUNO]: Abilities.SNOW_WARNING,
[Species.ZAPDOS]: Abilities.DRIZZLE, [Species.ZAPDOS]: Abilities.DRIZZLE,
[Species.MOLTRES]: Abilities.DROUGHT, [Species.MOLTRES]: Abilities.DROUGHT,
[Species.DRATINI]: Abilities.DELTA_STREAM, [Species.DRATINI]: Abilities.AERILATE,
[Species.MEWTWO]: Abilities.NEUROFORCE, [Species.MEWTWO]: Abilities.NEUROFORCE,
[Species.MEW]: Abilities.PROTEAN, [Species.MEW]: Abilities.PROTEAN,
[Species.CHIKORITA]: Abilities.THICK_FAT, [Species.CHIKORITA]: Abilities.THICK_FAT,
[Species.CYNDAQUIL]: Abilities.TURBOBLAZE, [Species.CYNDAQUIL]: Abilities.DROUGHT,
[Species.TOTODILE]: Abilities.TOUGH_CLAWS, [Species.TOTODILE]: Abilities.TOUGH_CLAWS,
[Species.SENTRET]: Abilities.FLUFFY, [Species.SENTRET]: Abilities.FLUFFY,
[Species.HOOTHOOT]: Abilities.CURSED_BODY, [Species.HOOTHOOT]: Abilities.CURSED_BODY,
[Species.LEDYBA]: Abilities.PRANKSTER, [Species.LEDYBA]: Abilities.PRANKSTER,
[Species.SPINARAK]: Abilities.PRANKSTER, [Species.SPINARAK]: Abilities.PRANKSTER,
[Species.CHINCHOU]: Abilities.REGENERATOR, [Species.CHINCHOU]: Abilities.REGENERATOR,
[Species.PICHU]: Abilities.TRANSISTOR, [Species.PICHU]: Abilities.ELECTRIC_SURGE,
[Species.CLEFFA]: Abilities.MAGIC_BOUNCE, [Species.CLEFFA]: Abilities.MAGIC_BOUNCE,
[Species.IGGLYBUFF]: Abilities.SERENE_GRACE, [Species.IGGLYBUFF]: Abilities.SERENE_GRACE,
[Species.TOGEPI]: Abilities.OPPORTUNIST, [Species.TOGEPI]: Abilities.OPPORTUNIST,
@ -3299,7 +3299,7 @@ export const starterPassiveAbilities = {
[Species.RAIKOU]: Abilities.TRANSISTOR, [Species.RAIKOU]: Abilities.TRANSISTOR,
[Species.ENTEI]: Abilities.MOXIE, [Species.ENTEI]: Abilities.MOXIE,
[Species.SUICUNE]: Abilities.UNAWARE, [Species.SUICUNE]: Abilities.UNAWARE,
[Species.LARVITAR]: Abilities.SAND_FORCE, [Species.LARVITAR]: Abilities.SAND_RUSH,
[Species.LUGIA]: Abilities.DELTA_STREAM, [Species.LUGIA]: Abilities.DELTA_STREAM,
[Species.HO_OH]: Abilities.MAGIC_GUARD, [Species.HO_OH]: Abilities.MAGIC_GUARD,
[Species.CELEBI]: Abilities.GRASSY_SURGE, [Species.CELEBI]: Abilities.GRASSY_SURGE,
@ -3364,8 +3364,8 @@ export const starterPassiveAbilities = {
[Species.CLAMPERL]: Abilities.SIMPLE, [Species.CLAMPERL]: Abilities.SIMPLE,
[Species.RELICANTH]: Abilities.SOLID_ROCK, [Species.RELICANTH]: Abilities.SOLID_ROCK,
[Species.LUVDISC]: Abilities.PICKUP, [Species.LUVDISC]: Abilities.PICKUP,
[Species.BAGON]: Abilities.GALE_WINGS, [Species.BAGON]: Abilities.ADAPTABILITY,
[Species.BELDUM]: Abilities.IRON_FIST, [Species.BELDUM]: Abilities.LEVITATE,
[Species.REGIROCK]: Abilities.SAND_STREAM, [Species.REGIROCK]: Abilities.SAND_STREAM,
[Species.REGICE]: Abilities.SNOW_WARNING, [Species.REGICE]: Abilities.SNOW_WARNING,
[Species.REGISTEEL]: Abilities.FILTER, [Species.REGISTEEL]: Abilities.FILTER,
@ -3376,9 +3376,9 @@ export const starterPassiveAbilities = {
[Species.RAYQUAZA]: Abilities.UNNERVE, [Species.RAYQUAZA]: Abilities.UNNERVE,
[Species.JIRACHI]: Abilities.COMATOSE, [Species.JIRACHI]: Abilities.COMATOSE,
[Species.DEOXYS]: Abilities.PROTEAN, [Species.DEOXYS]: Abilities.PROTEAN,
[Species.TURTWIG]: Abilities.HARVEST, [Species.TURTWIG]: Abilities.THICK_FAT,
[Species.CHIMCHAR]: Abilities.DEFIANT, [Species.CHIMCHAR]: Abilities.MOXIE,
[Species.PIPLUP]: Abilities.SLUSH_RUSH, [Species.PIPLUP]: Abilities.LIGHTNING_ROD,
[Species.STARLY]: Abilities.ROCK_HEAD, [Species.STARLY]: Abilities.ROCK_HEAD,
[Species.BIDOOF]: Abilities.NEUROFORCE, [Species.BIDOOF]: Abilities.NEUROFORCE,
[Species.KRICKETOT]: Abilities.SOUNDPROOF, [Species.KRICKETOT]: Abilities.SOUNDPROOF,
@ -3431,7 +3431,7 @@ export const starterPassiveAbilities = {
[Species.VICTINI]: Abilities.SUPER_LUCK, [Species.VICTINI]: Abilities.SUPER_LUCK,
[Species.SNIVY]: Abilities.MULTISCALE, [Species.SNIVY]: Abilities.MULTISCALE,
[Species.TEPIG]: Abilities.ROCK_HEAD, [Species.TEPIG]: Abilities.ROCK_HEAD,
[Species.OSHAWOTT]: Abilities.QUICK_DRAW, [Species.OSHAWOTT]: Abilities.INTREPID_SWORD,
[Species.PATRAT]: Abilities.STAKEOUT, [Species.PATRAT]: Abilities.STAKEOUT,
[Species.LILLIPUP]: Abilities.BALL_FETCH, [Species.LILLIPUP]: Abilities.BALL_FETCH,
[Species.PURRLOIN]: Abilities.DEFIANT, [Species.PURRLOIN]: Abilities.DEFIANT,
@ -3496,7 +3496,7 @@ export const starterPassiveAbilities = {
[Species.VULLABY]: Abilities.THICK_FAT, [Species.VULLABY]: Abilities.THICK_FAT,
[Species.HEATMOR]: Abilities.CONTRARY, [Species.HEATMOR]: Abilities.CONTRARY,
[Species.DURANT]: Abilities.TOUGH_CLAWS, [Species.DURANT]: Abilities.TOUGH_CLAWS,
[Species.DEINO]: Abilities.BERSERK, [Species.DEINO]: Abilities.PARENTAL_BOND,
[Species.LARVESTA]: Abilities.DROUGHT, [Species.LARVESTA]: Abilities.DROUGHT,
[Species.COBALION]: Abilities.INTREPID_SWORD, [Species.COBALION]: Abilities.INTREPID_SWORD,
[Species.TERRAKION]: Abilities.ROCKY_PAYLOAD, [Species.TERRAKION]: Abilities.ROCKY_PAYLOAD,
@ -3510,8 +3510,8 @@ export const starterPassiveAbilities = {
[Species.KELDEO]: Abilities.GRIM_NEIGH, [Species.KELDEO]: Abilities.GRIM_NEIGH,
[Species.MELOETTA]: Abilities.MINDS_EYE, [Species.MELOETTA]: Abilities.MINDS_EYE,
[Species.GENESECT]: Abilities.REGENERATOR, [Species.GENESECT]: Abilities.REGENERATOR,
[Species.CHESPIN]: Abilities.IRON_BARBS, [Species.CHESPIN]: Abilities.DAUNTLESS_SHIELD,
[Species.FENNEKIN]: Abilities.MAGIC_BOUNCE, [Species.FENNEKIN]: Abilities.PSYCHIC_SURGE,
[Species.FROAKIE]: Abilities.ADAPTABILITY, [Species.FROAKIE]: Abilities.ADAPTABILITY,
[Species.BUNNELBY]: Abilities.GUTS, [Species.BUNNELBY]: Abilities.GUTS,
[Species.FLETCHLING]: Abilities.RECKLESS, [Species.FLETCHLING]: Abilities.RECKLESS,
@ -3548,7 +3548,7 @@ export const starterPassiveAbilities = {
[Species.HOOPA]: Abilities.OPPORTUNIST, [Species.HOOPA]: Abilities.OPPORTUNIST,
[Species.VOLCANION]: Abilities.FILTER, [Species.VOLCANION]: Abilities.FILTER,
[Species.ROWLET]: Abilities.SNIPER, [Species.ROWLET]: Abilities.SNIPER,
[Species.LITTEN]: Abilities.FLAME_BODY, [Species.LITTEN]: Abilities.FUR_COAT,
[Species.POPPLIO]: Abilities.PUNK_ROCK, [Species.POPPLIO]: Abilities.PUNK_ROCK,
[Species.PIKIPEK]: Abilities.ANGER_POINT, [Species.PIKIPEK]: Abilities.ANGER_POINT,
[Species.YUNGOOS]: Abilities.HUGE_POWER, [Species.YUNGOOS]: Abilities.HUGE_POWER,
@ -3581,7 +3581,7 @@ export const starterPassiveAbilities = {
[Species.BRUXISH]: Abilities.MULTISCALE, [Species.BRUXISH]: Abilities.MULTISCALE,
[Species.DRAMPA]: Abilities.FLASH_FIRE, [Species.DRAMPA]: Abilities.FLASH_FIRE,
[Species.DHELMISE]: Abilities.INFILTRATOR, [Species.DHELMISE]: Abilities.INFILTRATOR,
[Species.JANGMO_O]: Abilities.DANCER, [Species.JANGMO_O]: Abilities.PUNK_ROCK,
[Species.TAPU_KOKO]: Abilities.TRANSISTOR, [Species.TAPU_KOKO]: Abilities.TRANSISTOR,
[Species.TAPU_LELE]: Abilities.SHEER_FORCE, [Species.TAPU_LELE]: Abilities.SHEER_FORCE,
[Species.TAPU_BULU]: Abilities.GRASS_PELT, [Species.TAPU_BULU]: Abilities.GRASS_PELT,
@ -3603,7 +3603,7 @@ export const starterPassiveAbilities = {
[Species.ZERAORA]: Abilities.TOUGH_CLAWS, [Species.ZERAORA]: Abilities.TOUGH_CLAWS,
[Species.MELTAN]: Abilities.STEELY_SPIRIT, [Species.MELTAN]: Abilities.STEELY_SPIRIT,
[Species.GROOKEY]: Abilities.GRASS_PELT, [Species.GROOKEY]: Abilities.GRASS_PELT,
[Species.SCORBUNNY]: Abilities.RECKLESS, [Species.SCORBUNNY]: Abilities.VICTORY_STAR,
[Species.SOBBLE]: Abilities.SUPER_LUCK, [Species.SOBBLE]: Abilities.SUPER_LUCK,
[Species.SKWOVET]: Abilities.HONEY_GATHER, [Species.SKWOVET]: Abilities.HONEY_GATHER,
[Species.ROOKIDEE]: Abilities.IRON_BARBS, [Species.ROOKIDEE]: Abilities.IRON_BARBS,
@ -3637,7 +3637,7 @@ export const starterPassiveAbilities = {
[Species.ARCTOZOLT]: Abilities.SAND_RUSH, [Species.ARCTOZOLT]: Abilities.SAND_RUSH,
[Species.DRACOVISH]: Abilities.HUSTLE, [Species.DRACOVISH]: Abilities.HUSTLE,
[Species.ARCTOVISH]: Abilities.STRONG_JAW, [Species.ARCTOVISH]: Abilities.STRONG_JAW,
[Species.DURALUDON]: Abilities.MEGA_LAUNCHER, [Species.DURALUDON]: Abilities.DOWNLOAD,
[Species.DREEPY]: Abilities.PARENTAL_BOND, [Species.DREEPY]: Abilities.PARENTAL_BOND,
[Species.ZACIAN]: Abilities.UNNERVE, [Species.ZACIAN]: Abilities.UNNERVE,
[Species.ZAMAZENTA]: Abilities.STAMINA, [Species.ZAMAZENTA]: Abilities.STAMINA,
@ -3651,8 +3651,8 @@ export const starterPassiveAbilities = {
[Species.CALYREX]: Abilities.HARVEST, [Species.CALYREX]: Abilities.HARVEST,
[Species.ENAMORUS]: Abilities.FAIRY_AURA, [Species.ENAMORUS]: Abilities.FAIRY_AURA,
[Species.SPRIGATITO]: Abilities.MAGICIAN, [Species.SPRIGATITO]: Abilities.MAGICIAN,
[Species.FUECOCO]: Abilities.EARTH_EATER, [Species.FUECOCO]: Abilities.PUNK_ROCK,
[Species.QUAXLY]: Abilities.DANCER, [Species.QUAXLY]: Abilities.DEFIANT,
[Species.LECHONK]: Abilities.SIMPLE, [Species.LECHONK]: Abilities.SIMPLE,
[Species.TAROUNTULA]: Abilities.PICKUP, [Species.TAROUNTULA]: Abilities.PICKUP,
[Species.NYMBLE]: Abilities.TECHNICIAN, [Species.NYMBLE]: Abilities.TECHNICIAN,
@ -3699,7 +3699,7 @@ export const starterPassiveAbilities = {
[Species.IRON_JUGULIS]: Abilities.AERILATE, [Species.IRON_JUGULIS]: Abilities.AERILATE,
[Species.IRON_MOTH]: Abilities.LEVITATE, [Species.IRON_MOTH]: Abilities.LEVITATE,
[Species.IRON_THORNS]: Abilities.SAND_STREAM, [Species.IRON_THORNS]: Abilities.SAND_STREAM,
[Species.FRIGIBAX]: Abilities.THICK_FAT, [Species.FRIGIBAX]: Abilities.SNOW_WARNING,
[Species.GIMMIGHOUL]: Abilities.SUPER_LUCK, [Species.GIMMIGHOUL]: Abilities.SUPER_LUCK,
[Species.WO_CHIEN]: Abilities.GRASSY_SURGE, [Species.WO_CHIEN]: Abilities.GRASSY_SURGE,
[Species.CHIEN_PAO]: Abilities.INTREPID_SWORD, [Species.CHIEN_PAO]: Abilities.INTREPID_SWORD,

View File

@ -2,7 +2,7 @@ import BattleScene, { AnySound, 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";
import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, DelayedAttackAttr, RechargeAttr, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, BypassRedirectAttr ,FixedDamageAttr, PostVictoryStatChangeAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr } from "./data/move"; import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, DelayedAttackAttr, RechargeAttr, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, BypassRedirectAttr, FixedDamageAttr, PostVictoryStatChangeAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr } from "./data/move";
import { Mode } from './ui/ui'; import { Mode } from './ui/ui';
import { Command } from "./ui/command-ui-handler"; import { Command } from "./ui/command-ui-handler";
import { Stat } from "./data/pokemon-stat"; import { Stat } from "./data/pokemon-stat";
@ -3484,19 +3484,14 @@ export class GameOverModifierRewardPhase extends ModifierRewardPhase {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
const newModifier = this.modifierType.newModifier(); const newModifier = this.modifierType.newModifier();
this.scene.addModifier(newModifier).then(() => { this.scene.addModifier(newModifier).then(() => {
this.scene.gameData.saveSystem().then(success => { this.scene.playSound('level_up_fanfare');
if (success) { this.scene.ui.setMode(Mode.MESSAGE);
this.scene.playSound('level_up_fanfare'); this.scene.arenaBg.setVisible(false);
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.fadeIn(250).then(() => {
this.scene.arenaBg.setVisible(false); this.scene.ui.showText(`You received\n${newModifier.type.name}!`, null, () => {
this.scene.ui.fadeIn(250).then(() => { this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true));
this.scene.ui.showText(`You received\n${newModifier.type.name}!`, null, () => { resolve();
this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true)); }, null, true, 1500);
resolve();
}, null, true, 1500);
});
} else
this.scene.reset(true);
}); });
}); });
}) })
@ -3516,18 +3511,13 @@ export class RibbonModifierRewardPhase extends ModifierRewardPhase {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
const newModifier = this.modifierType.newModifier(); const newModifier = this.modifierType.newModifier();
this.scene.addModifier(newModifier).then(() => { this.scene.addModifier(newModifier).then(() => {
this.scene.gameData.saveSystem().then(success => { this.scene.playSound('level_up_fanfare');
if (success) { this.scene.ui.setMode(Mode.MESSAGE);
this.scene.playSound('level_up_fanfare'); this.scene.arenaBg.setVisible(false);
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.fadeIn(250).then(() => {
this.scene.arenaBg.setVisible(false); this.scene.ui.showText(`${this.species.name} beat ${this.scene.gameMode.getName()} Mode for the first time!\nYou received ${newModifier.type.name}!`, null, () => {
this.scene.ui.fadeIn(250).then(() => { resolve();
this.scene.ui.showText(`${this.species.name} beat ${this.scene.gameMode.getName()} Mode for the first time!\nYou received ${newModifier.type.name}!`, null, () => { }, null, true, 1500);
resolve();
}, null, true, 1500);
});
} else
this.scene.reset(true);
}); });
}); });
}) })
@ -3548,7 +3538,7 @@ export class GameOverPhase extends BattlePhase {
super.start(); super.start();
if (this.victory || !this.scene.enableRetries) if (this.victory || !this.scene.enableRetries)
this.handleClearSession(); this.handleGameOver();
else { else {
this.scene.ui.showText(`Would you like to retry from the start of the battle?`, null, () => { this.scene.ui.showText(`Would you like to retry from the start of the battle?`, null, () => {
this.scene.ui.setMode(Mode.CONFIRM, () => { this.scene.ui.setMode(Mode.CONFIRM, () => {
@ -3573,18 +3563,16 @@ export class GameOverPhase extends BattlePhase {
this.end(); this.end();
}); });
}); });
}, () => this.handleClearSession(), false, 0, 0, 1000); }, () => this.handleGameOver(), false, 0, 0, 1000);
}); });
} }
} }
handleClearSession(): void { handleGameOver(): void {
this.scene.gameData.tryClearSession(this.scene, this.scene.sessionSlotId).then((success: boolean | [boolean, boolean]) => { const doGameOver = (newClear: boolean) => {
if (!success[0])
return this.scene.reset(true);
this.scene.time.delayedCall(1000, () => { this.scene.time.delayedCall(1000, () => {
let firstClear = false; let firstClear = false;
if (this.victory && success[1]) { if (this.victory && newClear) {
if (this.scene.gameMode.isClassic) { if (this.scene.gameMode.isClassic) {
firstClear = this.scene.validateAchv(achvs.CLASSIC_VICTORY); firstClear = this.scene.validateAchv(achvs.CLASSIC_VICTORY);
this.scene.gameData.gameStats.sessionsWon++; this.scene.gameData.gameStats.sessionsWon++;
@ -3595,29 +3583,37 @@ export class GameOverPhase extends BattlePhase {
this.awardRibbon(pokemon, true); this.awardRibbon(pokemon, true);
} }
} }
} else if (this.scene.gameMode.isDaily && success[1]) } else if (this.scene.gameMode.isDaily && newClear)
this.scene.gameData.gameStats.dailyRunSessionsWon++; this.scene.gameData.gameStats.dailyRunSessionsWon++;
} }
this.scene.gameData.saveSystem();
const fadeDuration = this.victory ? 10000 : 5000; const fadeDuration = this.victory ? 10000 : 5000;
this.scene.fadeOutBgm(fadeDuration, true); this.scene.fadeOutBgm(fadeDuration, true);
const activeBattlers = this.scene.getField().filter(p => p?.isActive(true));
activeBattlers.map(p => p.hideInfo());
this.scene.ui.fadeOut(fadeDuration).then(() => { this.scene.ui.fadeOut(fadeDuration).then(() => {
[ this.scene.field, ...activeBattlers ].map(a => a.setVisible(false));
this.scene.setFieldScale(1, true); this.scene.setFieldScale(1, true);
this.scene.clearPhaseQueue(); this.scene.clearPhaseQueue();
this.scene.ui.clearText(); this.scene.ui.clearText();
this.handleUnlocks(); if (newClear)
if (this.victory && success[1]) { this.handleUnlocks();
if (this.victory && newClear) {
for (let species of this.firstRibbons) for (let species of this.firstRibbons)
this.scene.unshiftPhase(new RibbonModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PLUS, species)); this.scene.unshiftPhase(new RibbonModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PLUS, species));
if (!firstClear) if (!firstClear)
this.scene.unshiftPhase(new GameOverModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PREMIUM)); this.scene.unshiftPhase(new GameOverModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PREMIUM));
} }
this.scene.reset(); this.scene.pushPhase(new PostGameOverPhase(this.scene));
this.scene.unshiftPhase(new TitlePhase(this.scene));
this.end(); this.end();
}); });
}); });
}); };
if (this.victory) {
Utils.apiFetch(`savedata/newclear?slot=${this.scene.sessionSlotId}`, true)
.then(response => response.json())
.then(newClear => doGameOver(newClear));
} else
doGameOver(false);
} }
handleUnlocks(): void { handleUnlocks(): void {
@ -3653,19 +3649,36 @@ export class UnlockPhase extends Phase {
start(): void { start(): void {
this.scene.time.delayedCall(2000, () => { this.scene.time.delayedCall(2000, () => {
this.scene.gameData.unlocks[this.unlockable] = true; this.scene.gameData.unlocks[this.unlockable] = true;
this.scene.gameData.saveSystem().then(success => { this.scene.playSound('level_up_fanfare');
if (success) { this.scene.ui.setMode(Mode.MESSAGE);
this.scene.playSound('level_up_fanfare'); this.scene.arenaBg.setVisible(false);
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.fadeIn(250).then(() => {
this.scene.arenaBg.setVisible(false); this.scene.ui.showText(`${getUnlockableName(this.unlockable)}\nhas been unlocked.`, null, () => {
this.scene.ui.fadeIn(250).then(() => { this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true));
this.scene.ui.showText(`${getUnlockableName(this.unlockable)}\nhas been unlocked.`, null, () => { this.end();
this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true)); }, null, true, 1500);
this.end(); });
}, null, true, 1500); });
}); }
} else }
this.scene.reset(true);
export class PostGameOverPhase extends Phase {
constructor(scene: BattleScene) {
super(scene);
}
start() {
super.start();
this.scene.gameData.saveSystem().then(success => {
if (!success)
return this.scene.reset(true);
this.scene.gameData.tryClearSession(this.scene, this.scene.sessionSlotId).then((success: boolean | [boolean, boolean]) => {
if (!success[0])
return this.scene.reset(true);
this.scene.reset();
this.scene.unshiftPhase(new TitlePhase(this.scene));
this.end();
}); });
}); });
} }

View File

@ -190,11 +190,14 @@ const systemShortKeys = {
natureAttr: '$na', natureAttr: '$na',
seenCount: '$s' , seenCount: '$s' ,
caughtCount: '$c', caughtCount: '$c',
hatchedCount: '$hc',
ivs: '$i', ivs: '$i',
moveset: '$m', moveset: '$m',
eggMoves: '$em', eggMoves: '$em',
candyCount: '$x', candyCount: '$x',
passive: '$p', friendship: '$f',
abilityAttr: '$a',
passiveAttr: '$pa',
valueReduction: '$vr', valueReduction: '$vr',
classicWinCount: '$wc' classicWinCount: '$wc'
}; };
@ -454,6 +457,10 @@ export class GameData {
} }
private convertSystemDataStr(dataStr: string, shorten: boolean = false): string { private convertSystemDataStr(dataStr: string, shorten: boolean = false): string {
if (!shorten) {
// Account for past key oversight
dataStr = dataStr.replace(/\$pAttr/g, '$pa');
}
const fromKeys = shorten ? Object.keys(systemShortKeys) : Object.values(systemShortKeys); const fromKeys = shorten ? Object.keys(systemShortKeys) : Object.values(systemShortKeys);
const toKeys = shorten ? Object.values(systemShortKeys) : Object.keys(systemShortKeys); const toKeys = shorten ? Object.values(systemShortKeys) : Object.keys(systemShortKeys);
for (let k in fromKeys) for (let k in fromKeys)