Merge branch 'main' into syrup

This commit is contained in:
lucfd 2024-04-25 01:02:09 -04:00 committed by GitHub
commit 7f03da583d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
47 changed files with 8391 additions and 579 deletions

View File

@ -28,11 +28,6 @@ jobs:
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Deploy build on server
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
run: rsync -vrm dist/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.DESTINATION_DIR }}
- name: Purge Cloudflare Cache
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
id: purge-cache
uses: NathanVaughn/actions-cloudflare-purge@v3.1.0
with:
cf_auth: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cf_zone: ${{ secrets.CLOUDFLARE_ZONE_ID }}
run: |
rsync --del --no-times --checksum -vrm dist/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.DESTINATION_DIR }}
ssh -t ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "~/prmanifest --inpath ${{ secrets.DESTINATION_DIR }} --outpath ${{ secrets.DESTINATION_DIR }}/manifest.json"

View File

@ -1069,8 +1069,6 @@
"971",
"972",
"972",
"973",
"973",
"974",
"974",
"975",
@ -2203,8 +2201,6 @@
"971b",
"972b",
"972b",
"973b",
"973b",
"974b",
"974b",
"975b",
@ -3335,8 +3331,6 @@
"971sb",
"972sb",
"972sb",
"973sb",
"973sb",
"974sb",
"974sb",
"975sb",
@ -4474,8 +4468,6 @@
"971s",
"972s",
"972s",
"973s",
"973s",
"974s",
"974s",
"975s",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 31 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -0,0 +1,13 @@
{
"1": {
"ad947b": "bd9171",
"e6d69c": "fff5d1",
"5a3a31": "70323f",
"3a3129": "3a3129",
"bd844a": "dba0ac",
"8c5a31": "c46269",
"101010": "101010",
"423a31": "3e3040",
"63523a": "824561"
}
}

View File

@ -0,0 +1,16 @@
{
"1": {
"423110": "423110",
"9c6331": "d46378",
"c58c42": "e5a5bb",
"634a31": "70323f",
"101010": "101010",
"cebd84": "eba978",
"ffefbd": "fff5d1",
"ffffff": "ffffff",
"5a4229": "824561",
"ef5a4a": "ffa488",
"cec5c5": "b7b9d0",
"848484": "848484"
}
}

View File

@ -0,0 +1,16 @@
{
"1": {
"5a3a31": "5a3a31",
"bd844a": "dba0ac",
"101010": "101010",
"8c5a31": "c46269",
"e6d69c": "fff5d1",
"ad947b": "bd9171",
"c5c5b5": "b7b9d0",
"ffffff": "ffffff",
"3a3129": "3a3129",
"63523a": "824561",
"de4a4a": "ffa488",
"423a31": "3e3040"
}
}

View File

@ -21,6 +21,7 @@ import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesF
import AbilityBar from './ui/ability-bar';
import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, IncrementMovePriorityAbAttr, applyAbAttrs, initAbilities } from './data/ability';
import { Abilities } from "./data/enums/abilities";
import { allAbilities } from "./data/ability";
import Battle, { BattleType, FixedBattleConfig, fixedBattles } from './battle';
import { GameMode, GameModes, gameModes } from './game-mode';
import FieldSpritePipeline from './pipelines/field-sprite';
@ -271,7 +272,7 @@ export default class BattleScene extends SceneBase {
populateAnims();
await fetch('./images/pokemon/variant/_masterlist.json').then(res => res.json()).then(v => Object.keys(v).forEach(k => variantData[k] = v[k]));
await this.cachedFetch('./images/pokemon/variant/_masterlist.json').then(res => res.json()).then(v => Object.keys(v).forEach(k => variantData[k] = v[k]));
}
create() {
@ -468,8 +469,8 @@ export default class BattleScene extends SceneBase {
Promise.all([
Promise.all(loadPokemonAssets),
initCommonAnims().then(() => loadCommonAnimAssets(this, true)),
Promise.all([ Moves.TACKLE, Moves.TAIL_WHIP, Moves.FOCUS_ENERGY, Moves.STRUGGLE ].map(m => initMoveAnim(m))).then(() => loadMoveAnimAssets(this, defaultMoves, true)),
initCommonAnims(this).then(() => loadCommonAnimAssets(this, true)),
Promise.all([ Moves.TACKLE, Moves.TAIL_WHIP, Moves.FOCUS_ENERGY, Moves.STRUGGLE ].map(m => initMoveAnim(this, m))).then(() => loadMoveAnimAssets(this, defaultMoves, true)),
this.initStarterColors()
]).then(() => {
this.pushPhase(new LoginPhase(this));
@ -505,19 +506,29 @@ export default class BattleScene extends SceneBase {
async initExpSprites(): Promise<void> {
if (expSpriteKeys.length)
return;
fetch('./exp-sprites.json').then(res => res.json()).then(keys => {
this.cachedFetch('./exp-sprites.json').then(res => res.json()).then(keys => {
if (Array.isArray(keys))
expSpriteKeys.push(...keys);
Promise.resolve();
});
}
cachedFetch(url: string, init?: RequestInit): Promise<Response> {
const manifest = this.game['manifest'];
if (manifest) {
const timestamp = manifest[`/${url.replace('./', '')}`];
if (timestamp)
url += `?t=${timestamp}`;
}
return fetch(url, init);
}
initStarterColors(): Promise<void> {
return new Promise(resolve => {
if (starterColors)
return resolve();
fetch('./starter-colors.json').then(res => res.json()).then(sc => {
this.cachedFetch('./starter-colors.json').then(res => res.json()).then(sc => {
starterColors = {};
Object.keys(sc).forEach(key => {
starterColors[key] = sc[key];
@ -798,6 +809,7 @@ export default class BattleScene extends SceneBase {
const localizable: Localizable[] = [
...allSpecies,
...allMoves,
...allAbilities,
...Utils.getEnumValues(ModifierPoolType).map(mpt => getModifierPoolForType(mpt)).map(mp => Object.values(mp).flat().map(mt => mt.modifierType).filter(mt => 'localize' in mt).map(lpb => lpb as unknown as Localizable)).flat()
];
for (let item of localizable)

File diff suppressed because it is too large Load Diff

View File

@ -424,14 +424,14 @@ export const moveAnims = new Map<Moves, AnimConfig | [AnimConfig, AnimConfig]>()
export const chargeAnims = new Map<ChargeAnim, AnimConfig | [AnimConfig, AnimConfig]>();
export const commonAnims = new Map<CommonAnim, AnimConfig>();
export function initCommonAnims(): Promise<void> {
export function initCommonAnims(scene: BattleScene): Promise<void> {
return new Promise(resolve => {
const commonAnimNames = Utils.getEnumKeys(CommonAnim);
const commonAnimIds = Utils.getEnumValues(CommonAnim);
const commonAnimFetches = [];
for (let ca = 0; ca < commonAnimIds.length; ca++) {
const commonAnimId = commonAnimIds[ca];
commonAnimFetches.push(fetch(`./battle-anims/common-${commonAnimNames[ca].toLowerCase().replace(/\_/g, '-')}.json`)
commonAnimFetches.push(scene.cachedFetch(`./battle-anims/common-${commonAnimNames[ca].toLowerCase().replace(/\_/g, '-')}.json`)
.then(response => response.json())
.then(cas => commonAnims.set(commonAnimId, new AnimConfig(cas))));
}
@ -439,7 +439,7 @@ export function initCommonAnims(): Promise<void> {
});
}
export function initMoveAnim(move: Moves): Promise<void> {
export function initMoveAnim(scene: BattleScene, move: Moves): Promise<void> {
return new Promise(resolve => {
if (moveAnims.has(move)) {
if (moveAnims.get(move) !== null)
@ -460,7 +460,7 @@ export function initMoveAnim(move: Moves): Promise<void> {
const defaultMoveAnim = allMoves[move] instanceof AttackMove ? Moves.TACKLE : allMoves[move] instanceof SelfStatusMove ? Moves.FOCUS_ENERGY : Moves.TAIL_WHIP;
const moveName = Moves[move].toLowerCase().replace(/\_/g, '-');
const fetchAnimAndResolve = (move: Moves) => {
fetch(`./battle-anims/${moveName}.json`)
scene.cachedFetch(`./battle-anims/${moveName}.json`)
.then(response => {
if (!response.ok) {
console.error(`Could not load animation file for move '${moveName}'`, response.status, response.statusText);
@ -477,7 +477,7 @@ export function initMoveAnim(move: Moves): Promise<void> {
populateMoveAnim(move, ba);
const chargeAttr = allMoves[move].getAttrs(ChargeAttr).find(() => true) as ChargeAttr || allMoves[move].getAttrs(DelayedAttackAttr).find(() => true) as DelayedAttackAttr;
if (chargeAttr)
initMoveChargeAnim(chargeAttr.chargeAnim).then(() => resolve());
initMoveChargeAnim(scene, chargeAttr.chargeAnim).then(() => resolve());
else
resolve();
});
@ -487,7 +487,7 @@ export function initMoveAnim(move: Moves): Promise<void> {
});
}
export function initMoveChargeAnim(chargeAnim: ChargeAnim): Promise<void> {
export function initMoveChargeAnim(scene: BattleScene, chargeAnim: ChargeAnim): Promise<void> {
return new Promise(resolve => {
if (chargeAnims.has(chargeAnim)) {
if (chargeAnims.get(chargeAnim) !== null)
@ -502,7 +502,7 @@ export function initMoveChargeAnim(chargeAnim: ChargeAnim): Promise<void> {
}
} else {
chargeAnims.set(chargeAnim, null);
fetch(`./battle-anims/${ChargeAnim[chargeAnim].toLowerCase().replace(/\_/g, '-')}.json`)
scene.cachedFetch(`./battle-anims/${ChargeAnim[chargeAnim].toLowerCase().replace(/\_/g, '-')}.json`)
.then(response => response.json())
.then(ca => {
if (Array.isArray(ca)) {

View File

@ -1844,7 +1844,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.BRAWLY, TrainerType.KORRINA, TrainerType.BEA, TrainerType.MAYLENE ],
[BiomePoolTier.BOSS]: [ TrainerType.BRAWLY, TrainerType.MAYLENE, TrainerType.KORRINA, TrainerType.BEA ],
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []

View File

@ -2301,6 +2301,14 @@ export class WaterSuperEffectTypeMultiplierAttr extends VariableMoveTypeMultipli
}
}
export class FlyingTypeMultiplierAttr extends VariableMoveTypeMultiplierAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const multiplier = args[0] as Utils.NumberHolder;
multiplier.value *= target.getAttackTypeEffectiveness(Type.FLYING);
return true;
}
}
export class OneHitKOAccuracyAttr extends VariableAccuracyAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const accuracy = args[0] as Utils.NumberHolder;
@ -3096,7 +3104,7 @@ export class RandomMoveAttr extends OverrideMoveEffectAttr {
: [ moveTargets.targets[user.randSeedInt(moveTargets.targets.length)] ];
user.getMoveQueue().push({ move: moveId, targets: targets, ignorePP: true });
user.scene.unshiftPhase(new MovePhase(user.scene, user, targets, new PokemonMove(moveId, 0, 0, true), true));
initMoveAnim(moveId).then(() => {
initMoveAnim(user.scene, moveId).then(() => {
loadMoveAnimAssets(user.scene, [ moveId ], true)
.then(() => resolve(true));
});
@ -3239,7 +3247,7 @@ export class NaturePowerAttr extends OverrideMoveEffectAttr {
user.getMoveQueue().push({ move: moveId, targets: [target.getBattlerIndex()], ignorePP: true });
user.scene.unshiftPhase(new MovePhase(user.scene, user, [target.getBattlerIndex()], new PokemonMove(moveId, 0, 0, true), true));
initMoveAnim(moveId).then(() => {
initMoveAnim(user.scene, moveId).then(() => {
loadMoveAnimAssets(user.scene, [ moveId ], true)
.then(() => resolve(true));
});
@ -5204,7 +5212,8 @@ export function initMoves() {
.makesContact(false)
.partial(),
new AttackMove(Moves.FLYING_PRESS, Type.FIGHTING, MoveCategory.PHYSICAL, 100, 95, 10, -1, 0, 6)
.partial(),
.attr(FlyingTypeMultiplierAttr)
.condition(failOnGravityCondition),
new StatusMove(Moves.MAT_BLOCK, Type.FIGHTING, -1, 10, -1, 0, 6)
.unimplemented(),
new AttackMove(Moves.BELCH, Type.POISON, MoveCategory.SPECIAL, 120, 90, 10, -1, 0, 6)
@ -5653,7 +5662,8 @@ export function initMoves() {
new AttackMove(Moves.PIKA_PAPOW, Type.ELECTRIC, MoveCategory.SPECIAL, -1, -1, 20, -1, 0, 7)
.attr(FriendshipPowerAttr),
new AttackMove(Moves.BOUNCY_BUBBLE, Type.WATER, MoveCategory.SPECIAL, 60, 100, 20, -1, 0, 7)
.attr(HitHealAttr),
.attr(HitHealAttr)
.triageMove(),
new AttackMove(Moves.BUZZY_BUZZ, Type.ELECTRIC, MoveCategory.SPECIAL, 60, 100, 20, 100, 0, 7)
.attr(StatusEffectAttr, StatusEffect.PARALYSIS),
new AttackMove(Moves.SIZZLY_SLIDE, Type.FIRE, MoveCategory.PHYSICAL, 60, 100, 20, 100, 0, 7)

View File

@ -625,6 +625,9 @@ export const pokemonEvolutions: PokemonEvolutions = {
[Species.FINNEON]: [
new SpeciesEvolution(Species.LUMINEON, 31, null, null)
],
[Species.MANTYKE]: [
new SpeciesEvolution(Species.MANTINE, 32, null, new SpeciesEvolutionCondition(p => !!p.scene.gameData.dexData[Species.REMORAID].caughtAttr), SpeciesWildEvolutionDelay.MEDIUM)
],
[Species.SNOVER]: [
new SpeciesEvolution(Species.ABOMASNOW, 40, null, null)
],
@ -1341,9 +1344,6 @@ export const pokemonEvolutions: PokemonEvolutions = {
new SpeciesEvolution(Species.GALAR_MR_MIME, 1, null, new SpeciesEvolutionCondition(p => p.moveset.filter(m => m.moveId === Moves.MIMIC).length > 0 && (p.scene.arena.biomeType === Biome.ICE_CAVE || p.scene.arena.biomeType === Biome.SNOWY_FOREST)), SpeciesWildEvolutionDelay.MEDIUM),
new SpeciesEvolution(Species.MR_MIME, 1, null, new SpeciesEvolutionCondition(p => p.moveset.filter(m => m.moveId === Moves.MIMIC).length > 0), SpeciesWildEvolutionDelay.MEDIUM)
],
[Species.MANTYKE]: [
new SpeciesEvolution(Species.MANTINE, 1, null, new SpeciesEvolutionCondition(p => !!p.scene.getParty().find(p => p.species.speciesId === Species.REMORAID)), SpeciesWildEvolutionDelay.MEDIUM)
],
[Species.PANSAGE]: [
new SpeciesEvolution(Species.SIMISAGE, 1, EvolutionItem.LEAF_STONE, null, SpeciesWildEvolutionDelay.LONG)
],

View File

@ -581,6 +581,23 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 1, Moves.METEOR_MASH ],
[ 1, Moves.MOONBLAST ],
[ 1, Moves.LIFE_DEW ],
[ 1, Moves.POUND ],
[ 1, Moves.GROWL ],
[ 1, Moves.SING ],
[ 1, Moves.DEFENSE_CURL ],
[ 1, Moves.SPLASH ],
[ 1, Moves.SWEET_KISS ],
[ 1, Moves.CHARM ],
[ 1, Moves.ENCORE ],
[ 1, Moves.MOONLIGHT ],
[ 1, Moves.FOLLOW_ME ],
[ 1, Moves.COSMIC_POWER ],
[ 1, Moves.GRAVITY ],
[ 1, Moves.HEALING_WISH ],
[ 1, Moves.COPYCAT ],
[ 1, Moves.AFTER_YOU ],
[ 1, Moves.STORED_POWER ],
[ 1, Moves.DISARMING_VOICE ],
],
[Species.VULPIX]: [
[ 1, Moves.TAIL_WHIP ],
@ -600,9 +617,22 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 52, Moves.FIRE_BLAST ],
],
[Species.NINETALES]: [
[ 1, Moves.TAIL_WHIP ],
[ 1, Moves.FLAMETHROWER ],
[ 1, Moves.TAIL_WHIP ],
[ 1, Moves.QUICK_ATTACK ],
[ 1, Moves.DISABLE ],
[ 1, Moves.EMBER ],
[ 1, Moves.FIRE_SPIN ],
[ 1, Moves.CONFUSE_RAY ],
[ 1, Moves.FIRE_BLAST ],
[ 1, Moves.SPITE ],
[ 1, Moves.SAFEGUARD ],
[ 1, Moves.WILL_O_WISP ],
[ 1, Moves.IMPRISON ],
[ 1, Moves.EXTRASENSORY ],
[ 1, Moves.NASTY_PLOT ],
[ 1, Moves.INCINERATE ],
[ 1, Moves.INFERNO ],
],
[Species.JIGGLYPUFF]: [
[ 1, Moves.POUND ],
@ -995,9 +1025,18 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.POLIWRATH]: [
[ 0, Moves.DYNAMIC_PUNCH ],
[ 1, Moves.BODY_SLAM ],
[ 1, Moves.BUBBLE_BEAM ],
[ 1, Moves.BODY_SLAM ],
[ 1, Moves.HYPNOSIS ],
[ 1, Moves.POUND ],
[ 1, Moves.DOUBLE_EDGE ],
[ 1, Moves.WATER_GUN ],
[ 1, Moves.HYDRO_PUMP ],
[ 1, Moves.BELLY_DRUM ],
[ 1, Moves.RAIN_DANCE ],
[ 1, Moves.MUD_SHOT ],
[ 1, Moves.EARTH_POWER ],
[ 1, Moves.CIRCLE_THROW ],
],
[Species.ABRA]: [
[ 1, Moves.TELEPORT ],
@ -1121,9 +1160,14 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[Species.VICTREEBEL]: [
[ 0, Moves.LEAF_STORM ],
[ 1, Moves.VINE_WHIP ],
[ 1, Moves.RAZOR_LEAF ],
[ 1, Moves.SLEEP_POWDER ],
[ 1, Moves.SWEET_SCENT ],
[ 1, Moves.RAZOR_LEAF ],
[ 1, Moves.STOCKPILE ],
[ 1, Moves.SWALLOW ],
[ 1, Moves.SPIT_UP ],
[ 1, Moves.GASTRO_ACID ],
[ 1, Moves.POWER_WHIP ],
[ 44, Moves.LEAF_BLADE ],
],
[Species.TENTACOOL]: [
@ -1671,23 +1715,24 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.EXEGGUTOR]: [
[ 0, Moves.STOMP ],
[ 1, Moves.ABSORB ],
[ 1, Moves.SEED_BOMB ],
[ 1, Moves.PSYSHOCK ],
[ 1, Moves.WOOD_HAMMER ],
[ 1, Moves.LEAF_STORM ],
[ 1, Moves.MEGA_DRAIN ],
[ 1, Moves.LEECH_SEED ],
[ 1, Moves.SOLAR_BEAM ],
[ 1, Moves.CONFUSION ],
[ 1, Moves.SYNTHESIS ],
[ 1, Moves.BULLET_SEED ],
[ 1, Moves.GIGA_DRAIN ],
[ 1, Moves.EXTRASENSORY ],
[ 1, Moves.UPROAR ],
[ 1, Moves.WORRY_SEED ],
[ 1, Moves.SOLAR_BEAM ],
[ 1, Moves.ABSORB ],
[ 1, Moves.HYPNOSIS ],
[ 1, Moves.REFLECT ],
[ 1, Moves.GIGA_DRAIN ],
[ 1, Moves.SYNTHESIS ],
[ 1, Moves.UPROAR ],
[ 1, Moves.EXTRASENSORY ],
[ 1, Moves.BULLET_SEED ],
[ 1, Moves.WORRY_SEED ],
[ 1, Moves.SEED_BOMB ],
[ 1, Moves.LEAF_STORM ],
[ 1, Moves.WOOD_HAMMER ],
[ 1, Moves.PSYSHOCK ],
[ 1, Moves.LEECH_SEED ],
[ 1, Moves.GROWTH ],
],
[Species.CUBONE]: [
[ 1, Moves.GROWL ],
@ -3107,10 +3152,20 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.POLITOED]: [
[ 0, Moves.BOUNCE ],
[ 1, Moves.POUND ],
[ 1, Moves.RAIN_DANCE ],
[ 1, Moves.HYDRO_PUMP ],
[ 1, Moves.BELLY_DRUM ],
[ 1, Moves.RAIN_DANCE ],
[ 1, Moves.POUND ],
[ 1, Moves.BODY_SLAM ],
[ 1, Moves.DOUBLE_EDGE ],
[ 1, Moves.WATER_GUN ],
[ 1, Moves.BUBBLE_BEAM ],
[ 1, Moves.HYPNOSIS ],
[ 1, Moves.PERISH_SONG ],
[ 1, Moves.SWAGGER ],
[ 1, Moves.HYPER_VOICE ],
[ 1, Moves.MUD_SHOT ],
[ 1, Moves.EARTH_POWER ],
],
[Species.HOPPIP]: [
[ 1, Moves.TACKLE ],
@ -3336,13 +3391,15 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 60, Moves.QUASH ],
],
[Species.SLOWKING]: [
[ 1, Moves.TACKLE ],
[ 1, Moves.GROWL ],
[ 1, Moves.WATER_GUN ],
[ 1, Moves.CURSE ],
[ 1, Moves.SWAGGER ],
[ 1, Moves.POWER_GEM ],
[ 1, Moves.NASTY_PLOT ],
[ 1, Moves.SWAGGER ],
[ 1, Moves.TACKLE ],
[ 1, Moves.CURSE ],
[ 1, Moves.GROWL ],
[ 1, Moves.WATER_GUN ],
[ 1, Moves.FUTURE_SIGHT ],
[ 1, Moves.CHILLY_RECEPTION ],
[ 9, Moves.YAWN ],
[ 12, Moves.CONFUSION ],
[ 15, Moves.DISABLE ],
@ -4559,9 +4616,22 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 64, Moves.HYDRO_PUMP ],
],
[Species.LUDICOLO]: [
[ 1, Moves.FAKE_OUT ],
[ 1, Moves.BUBBLE_BEAM ],
[ 1, Moves.RAIN_DANCE ],
[ 1, Moves.FAKE_OUT ],
[ 1, Moves.GROWL ],
[ 1, Moves.MIST ],
[ 1, Moves.WATER_GUN ],
[ 1, Moves.HYDRO_PUMP ],
[ 1, Moves.ABSORB ],
[ 1, Moves.MEGA_DRAIN ],
[ 1, Moves.FURY_SWIPES ],
[ 1, Moves.FLAIL ],
[ 1, Moves.KNOCK_OFF ],
[ 1, Moves.TEETER_DANCE ],
[ 1, Moves.ASTONISH ],
[ 1, Moves.ENERGY_BALL ],
[ 1, Moves.ZEN_HEADBUTT ],
],
[Species.SEEDOT]: [
[ 1, Moves.TACKLE ],
@ -4601,10 +4671,27 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.SHIFTRY]: [
[ 0, Moves.LEAF_BLADE ],
[ 1, Moves.SUNNY_DAY ],
[ 1, Moves.AIR_CUTTER ],
[ 1, Moves.PAYBACK ],
[ 1, Moves.HURRICANE ],
[ 1, Moves.PAYBACK ],
[ 1, Moves.SUNNY_DAY ],
[ 1, Moves.WHIRLWIND ],
[ 1, Moves.TACKLE ],
[ 1, Moves.ABSORB ],
[ 1, Moves.MEGA_DRAIN ],
[ 1, Moves.GROWTH ],
[ 1, Moves.RAZOR_LEAF ],
[ 1, Moves.HARDEN ],
[ 1, Moves.EXPLOSION ],
[ 1, Moves.ROLLOUT ],
[ 1, Moves.SWAGGER ],
[ 1, Moves.SYNTHESIS ],
[ 1, Moves.BEAT_UP ],
[ 1, Moves.FAKE_OUT ],
[ 1, Moves.TORMENT ],
[ 1, Moves.ASTONISH ],
[ 1, Moves.EXTRASENSORY ],
[ 1, Moves.SUCKER_PUNCH ],
],
[Species.TAILLOW]: [
[ 1, Moves.GROWL ],
@ -9594,21 +9681,21 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 48, Moves.LAST_RESORT ],
],
[Species.CINCCINO]: [
[ 0, Moves.TAIL_SLAP ],
[ 1, Moves.BULLET_SEED ],
[ 1, Moves.SING ],
[ 1, Moves.CHARM ],
[ 1, Moves.POUND ],
[ 1, Moves.SLAM ],
[ 1, Moves.SING ],
[ 1, Moves.SWIFT ],
[ 1, Moves.CHARM ],
[ 1, Moves.ENCORE ],
[ 1, Moves.HELPING_HAND ],
[ 1, Moves.HYPER_VOICE ],
[ 1, Moves.TICKLE ],
[ 1, Moves.BULLET_SEED ],
[ 1, Moves.ROCK_BLAST ],
[ 1, Moves.LAST_RESORT ],
[ 1, Moves.AFTER_YOU ],
[ 1, Moves.ECHOED_VOICE ],
[ 1, Moves.TAIL_SLAP ],
[ 1, Moves.BABY_DOLL_EYES ],
],
[Species.GOTHITA]: [
@ -12401,10 +12488,16 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.VIKAVOLT]: [
[ 0, Moves.THUNDERBOLT ],
[ 1, Moves.STRING_SHOT ],
[ 1, Moves.CRUNCH ],
[ 1, Moves.CHARGE ],
[ 1, Moves.CRUNCH ],
[ 1, Moves.DISCHARGE ],
[ 1, Moves.STRING_SHOT ],
[ 1, Moves.VISE_GRIP ],
[ 1, Moves.DIG ],
[ 1, Moves.MUD_SLAP ],
[ 1, Moves.IRON_DEFENSE ],
[ 1, Moves.X_SCISSOR ],
[ 1, Moves.BUG_BITE ],
[ 15, Moves.BITE ],
[ 23, Moves.SPARK ],
[ 29, Moves.STICKY_WEB ],
@ -15579,9 +15672,13 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.CERULEDGE]: [
[ 0, Moves.SHADOW_CLAW ],
[ 1, Moves.LEER ],
[ 1, Moves.EMBER ],
[ 1, Moves.LEER ],
[ 1, Moves.ASTONISH ],
[ 1, Moves.NIGHT_SLASH ],
[ 1, Moves.SHADOW_SNEAK ],
[ 1, Moves.QUICK_GUARD ],
[ 1, Moves.SOLAR_BLADE ],
[ 8, Moves.CLEAR_SMOG ],
[ 12, Moves.FIRE_SPIN ],
[ 16, Moves.WILL_O_WISP ],
@ -16859,6 +16956,7 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 1, Moves.SWEET_SCENT ],
[ 1, Moves.RECYCLE ],
[ 1, Moves.ASTONISH ],
[ 1, Moves.INFESTATION ],
[ 4, Moves.DRAGON_TAIL ],
[ 8, Moves.GROWTH ],
[ 12, Moves.DRAGON_BREATH ],
@ -16985,6 +17083,9 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 1, Moves.SWEET_SCENT ],
[ 1, Moves.RECYCLE ],
[ 1, Moves.ASTONISH ],
[ 1, Moves.YAWN ],
[ 1, Moves.DOUBLE_HIT ],
[ 1, Moves.INFESTATION ],
[ 4, Moves.DRAGON_TAIL ],
[ 8, Moves.GROWTH ],
[ 12, Moves.DRAGON_BREATH ],
@ -17178,10 +17279,25 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.ALOLA_SANDSLASH]: [
[ 0, Moves.ICICLE_SPEAR ],
[ 1, Moves.SWORDS_DANCE ],
[ 1, Moves.SLASH ],
[ 1, Moves.METAL_CLAW ],
[ 1, Moves.ICICLE_CRASH ],
[ 1, Moves.METAL_CLAW ],
[ 1, Moves.SLASH ],
[ 1, Moves.SWORDS_DANCE ],
[ 1, Moves.SCRATCH ],
[ 1, Moves.MIST ],
[ 1, Moves.BLIZZARD ],
[ 1, Moves.DEFENSE_CURL ],
[ 1, Moves.SWIFT ],
[ 1, Moves.FURY_SWIPES ],
[ 1, Moves.POWDER_SNOW ],
[ 1, Moves.ROLLOUT ],
[ 1, Moves.FURY_CUTTER ],
[ 1, Moves.RAPID_SPIN ],
[ 1, Moves.IRON_DEFENSE ],
[ 1, Moves.GYRO_BALL ],
[ 1, Moves.METAL_BURST ],
[ 1, Moves.IRON_HEAD ],
[ 1, Moves.SNOWSCAPE ],
],
[Species.ALOLA_VULPIX]: [
[ 1, Moves.TAIL_WHIP ],
@ -17202,10 +17318,22 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.ALOLA_NINETALES]: [
[ 0, Moves.DAZZLING_GLEAM ],
[ 1, Moves.TAIL_WHIP ],
[ 1, Moves.BLIZZARD ],
[ 1, Moves.ICY_WIND ],
[ 1, Moves.IMPRISON ],
[ 1, Moves.BLIZZARD ],
[ 1, Moves.TAIL_WHIP ],
[ 1, Moves.DISABLE ],
[ 1, Moves.MIST ],
[ 1, Moves.ICE_BEAM ],
[ 1, Moves.AURORA_BEAM ],
[ 1, Moves.CONFUSE_RAY ],
[ 1, Moves.SPITE ],
[ 1, Moves.POWDER_SNOW ],
[ 1, Moves.EXTRASENSORY ],
[ 1, Moves.NASTY_PLOT ],
[ 1, Moves.ICE_SHARD ],
[ 1, Moves.FREEZE_DRY ],
[ 1, Moves.AURORA_VEIL ],
],
[Species.ALOLA_DIGLETT]: [
[ 1, Moves.SAND_ATTACK ],
@ -17365,23 +17493,24 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.ALOLA_EXEGGUTOR]: [
[ 0, Moves.DRAGON_HAMMER ],
[ 1, Moves.ABSORB ],
[ 1, Moves.SEED_BOMB ],
[ 1, Moves.PSYSHOCK ],
[ 1, Moves.WOOD_HAMMER ],
[ 1, Moves.LEAF_STORM ],
[ 1, Moves.MEGA_DRAIN ],
[ 1, Moves.LEECH_SEED ],
[ 1, Moves.SOLAR_BEAM ],
[ 1, Moves.CONFUSION ],
[ 1, Moves.SYNTHESIS ],
[ 1, Moves.BULLET_SEED ],
[ 1, Moves.GIGA_DRAIN ],
[ 1, Moves.EXTRASENSORY ],
[ 1, Moves.UPROAR ],
[ 1, Moves.WORRY_SEED ],
[ 1, Moves.SOLAR_BEAM ],
[ 1, Moves.ABSORB ],
[ 1, Moves.HYPNOSIS ],
[ 1, Moves.REFLECT ],
[ 1, Moves.GIGA_DRAIN ],
[ 1, Moves.SYNTHESIS ],
[ 1, Moves.UPROAR ],
[ 1, Moves.EXTRASENSORY ],
[ 1, Moves.BULLET_SEED ],
[ 1, Moves.WORRY_SEED ],
[ 1, Moves.SEED_BOMB ],
[ 1, Moves.LEAF_STORM ],
[ 1, Moves.WOOD_HAMMER ],
[ 1, Moves.PSYSHOCK ],
[ 1, Moves.LEECH_SEED ],
[ 1, Moves.GROWTH ],
],
[Species.ALOLA_MAROWAK]: [
[ 0, Moves.SHADOW_BONE ],
@ -17634,13 +17763,16 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
],
[Species.GALAR_SLOWKING]: [
[ 0, Moves.EERIE_SPELL ],
[ 1, Moves.TACKLE ],
[ 1, Moves.GROWL ],
[ 1, Moves.ACID ],
[ 1, Moves.CURSE ],
[ 1, Moves.SWAGGER ],
[ 1, Moves.POWER_GEM ],
[ 1, Moves.NASTY_PLOT ],
[ 1, Moves.SWAGGER ],
[ 1, Moves.TACKLE ],
[ 1, Moves.CURSE ],
[ 1, Moves.GROWL ],
[ 1, Moves.ACID ],
[ 1, Moves.TOXIC ],
[ 1, Moves.FUTURE_SIGHT ],
[ 1, Moves.CHILLY_RECEPTION ],
[ 9, Moves.YAWN ],
[ 12, Moves.CONFUSION ],
[ 15, Moves.DISABLE ],
@ -18111,10 +18243,11 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 40, Moves.EARTHQUAKE ],
],
[Species.BLOODMOON_URSALUNA]: [
[ 1, Moves.HEADLONG_RUSH ],
[ 1, Moves.SCRATCH ],
[ 1, Moves.LEER ],
[ 1, Moves.LICK ],
[ 1, Moves.HEADLONG_RUSH ],
[ 1, Moves.MOONLIGHT ],
[ 8, Moves.FURY_SWIPES ],
[ 13, Moves.PAYBACK ],
[ 17, Moves.HARDEN ],

View File

@ -394,7 +394,7 @@ export abstract class PokemonSpeciesForm {
return new Promise(resolve => {
if (variantColorCache.hasOwnProperty(key))
return resolve();
fetch(`./images/pokemon/variant/${spritePath}.json`).then(res => res.json()).then(c => {
scene.cachedFetch(`./images/pokemon/variant/${spritePath}.json`).then(res => res.json()).then(c => {
variantColorCache[key] = c;
resolve();
});

View File

@ -1,3 +1,5 @@
import i18next from '../plugins/i18n';
export enum Stat {
HP = 0,
ATK,
@ -11,22 +13,22 @@ export function getStatName(stat: Stat, shorten: boolean = false) {
let ret: string;
switch (stat) {
case Stat.HP:
ret = !shorten ? 'Max. HP' : 'MaxHP';
ret = !shorten ? i18next.t('pokemonStat:HP') : i18next.t('pokemonStat:HPshortened');
break;
case Stat.ATK:
ret = !shorten ? 'Attack' : 'Atk';
ret = !shorten ? i18next.t('pokemonStat:ATK') : i18next.t('pokemonStat:ATKshortened');
break;
case Stat.DEF:
ret = !shorten ? 'Defense' : 'Def';
ret = !shorten ? i18next.t('pokemonStat:DEF') : i18next.t('pokemonStat:DEFshortened');
break;
case Stat.SPATK:
ret = !shorten ? 'Sp. Atk' : 'SpAtk';
ret = !shorten ? i18next.t('pokemonStat:SPATK') : i18next.t('pokemonStat:SPATKshortened');
break;
case Stat.SPDEF:
ret = !shorten ? 'Sp. Def' : 'SpDef';
ret = !shorten ? i18next.t('pokemonStat:SPDEF') : i18next.t('pokemonStat:SPDEFshortened');
break;
case Stat.SPD:
ret = !shorten ? 'Speed' : 'Spd';
ret = !shorten ? i18next.t('pokemonStat:SPD') : i18next.t('pokemonStat:SPDshortened');
break;
}
return ret;

View File

@ -275,7 +275,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
loadAssets(ignoreOverride: boolean = true): Promise<void> {
return new Promise(resolve => {
const moveIds = this.getMoveset().map(m => m.getMove().id);
Promise.allSettled(moveIds.map(m => initMoveAnim(m)))
Promise.allSettled(moveIds.map(m => initMoveAnim(this.scene, m)))
.then(() => {
loadMoveAnimAssets(this.scene, moveIds);
this.getSpeciesForm().loadAssets(this.scene, this.getGender() === Gender.FEMALE, this.formIndex, this.shiny, this.variant);
@ -317,7 +317,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (variantSet && variantSet[this.variant] === 1) {
if (variantColorCache.hasOwnProperty(key))
return resolve();
fetch(`./images/pokemon/variant/${battleSpritePath}.json`).then(res => res.json()).then(c => {
this.scene.cachedFetch(`./images/pokemon/variant/${battleSpritePath}.json`).then(res => res.json()).then(c => {
variantColorCache[key] = c;
resolve();
});

View File

@ -19,12 +19,7 @@ export class LoadingScene extends SceneBase {
}
preload() {
const indexFile = Array.from(document.querySelectorAll('script')).map(s => s.src).find(s => /\/index/.test(s));
if (indexFile) {
const buildIdMatch = /index\-(.*?)\.js$/.exec(indexFile);
if (buildIdMatch)
this.load['cacheBuster'] = buildIdMatch[1];
}
this.load['manifest'] = this.game['manifest'];
if (!isMobile())
this.load.video('intro_dark', 'images/intro_dark.mp4', true);

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const commandUiHandler: SimpleTranslationEntries = {
"fight": "Fight",
"ball": "Ball",
"pokemon": "Pokémon",
"run": "Run",
"actionMessage": "What will\n{{pokemonName}} do?",
} as const;

View File

@ -0,0 +1,16 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const pokemonStat: SimpleTranslationEntries = {
"HP": "Max. HP",
"HPshortened": "MaxHP",
"ATK": "Attack",
"ATKshortened": "Atk",
"DEF": "Defense",
"DEFshortened": "Def",
"SPATK": "Sp. Atk",
"SPATKshortened": "SpAtk",
"SPDEF": "Sp. Def",
"SPDEFshortened": "SpDef",
"SPD": "Speed",
"SPDshortened": "Spd"
} as const;

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const commandUiHandler: SimpleTranslationEntries = {
"fight": "Fight",
"ball": "Ball",
"pokemon": "Pokémon",
"run": "Run",
"actionMessage": "What will\n{{pokemonName}} do?",
} as const;

View File

@ -0,0 +1,16 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const pokemonStat: SimpleTranslationEntries = {
"HP": "Max. HP",
"HPshortened": "MaxHP",
"ATK": "Attack",
"ATKshortened": "Atk",
"DEF": "Defense",
"DEFshortened": "Def",
"SPATK": "Sp. Atk",
"SPATKshortened": "SpAtk",
"SPDEF": "Sp. Def",
"SPDEFshortened": "SpDef",
"SPD": "Speed",
"SPDshortened": "Spd"
} as const;

1086
src/locales/es/pokemon.ts Normal file

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const commandUiHandler: SimpleTranslationEntries = {
"fight": "Attaque",
"ball": "Ball",
"pokemon": "Pokémon",
"run": "Fuite",
"actionMessage": "Que doit faire\n{{pokemonName}} ?",
} as const;

View File

@ -14,7 +14,7 @@ export const menu: SimpleTranslationEntries = {
"register": "S'inscrire",
"emptyUsername": "Le nom d'utilisateur est manquant",
"invalidLoginUsername": "Le nom d'utilisateur n'est pas valide",
"invalidRegisterUsername": "Le nom d'utilisateur ne doit contenir que \ndes lettres, chiffres ou traits bas",
"invalidRegisterUsername": "Le nom d'utilisateur ne doit contenir que\ndes lettres, chiffres ou traits bas",
"invalidLoginPassword": "Le mot de passe n'est pas valide",
"invalidRegisterPassword": "Le mot de passe doit contenir 6 caractères ou plus",
"usernameAlreadyUsed": "Le nom d'utilisateur est déjà utilisé",
@ -30,11 +30,11 @@ export const menu: SimpleTranslationEntries = {
"boyOrGirl": "Es-tu un garçon ou une fille ?",
"boy": "Garçon",
"girl": "Fille",
"bossAppeared": "Un {{bossName}} est apparaît.",
"bossAppeared": "Un {{bossName}} apparaît.",
"trainerAppeared": "Un combat est lancé\npar {{trainerName}} !",
"singleWildAppeared": "Un {{pokemonName}} sauvage apparaît!",
"singleWildAppeared": "Un {{pokemonName}} sauvage apparaît !",
"multiWildAppeared": "Un {{pokemonName1}} et un {{pokemonName2}}\nsauvages apparaissent !",
"playerComeBack": "{{pokemonName}}, on change!\nReviens !",
"playerComeBack": "{{pokemonName}}, on change !\nReviens !",
"trainerComeBack": "{{trainerName}} retire {{pokemonName}} !",
"playerGo": "{{pokemonName}} ! Go !",
"trainerGo": "{{pokemonName}} est envoyé par\n{{trainerName}} !",
@ -43,7 +43,7 @@ export const menu: SimpleTranslationEntries = {
"sendOutPokemon": "{{pokemonName}} ! Go !",
"levelCapUp": "La limite de niveau\na été augmentée à {{levelCap}} !",
"moveNotImplemented": "{{moveName}} n'est pas encore implémenté et ne peut pas être sélectionné.",
"moveDisabled": "{{moveName}} est désactivé !",
"moveDisabled": "{{moveName}} est sous entrave !",
"noPokeballForce": "Une force mystérieuse\nempêche l'utilisation des Poké Balls.",
"noPokeballTrainer": "Le Dresseur détourne la Ball\nVoler, c'est mal !",
"noPokeballMulti": "Impossible ! On ne peut pas viser\nquand il y a deux Pokémon!",
@ -53,5 +53,5 @@ export const menu: SimpleTranslationEntries = {
"noEscapePokemon": "{{moveName}} de {{pokemonName}}\nempêche {{escapeVerb}} !",
"escapeVerbSwitch": "le changement",
"escapeVerbFlee": "la fuite",
"notDisabled": "{{moveName}} n'est plus désactivé !",
"notDisabled": "{{moveName}} n'est plus sous entrave !",
} as const;

View File

@ -0,0 +1,16 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const pokemonStat: SimpleTranslationEntries = {
"HP": "PV",
"HPshortened": "PV",
"ATK": "Attaque",
"ATKshortened": "Atq",
"DEF": "Défense",
"DEFshortened": "Déf",
"SPATK": "Atq. Spé",
"SPATKshortened": "AtqSp",
"SPDEF": "Déf. Spé",
"SPDEFshortened": "DéfSp",
"SPD": "Vitesse",
"SPDshortened": "Vit"
} as const;

View File

@ -0,0 +1,16 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const pokemonStat: SimpleTranslationEntries = {
"HP": "Max. HP",
"HPshortened": "MaxHP",
"ATK": "Attack",
"ATKshortened": "Atk",
"DEF": "Defense",
"DEFshortened": "Def",
"SPATK": "Sp. Atk",
"SPATKshortened": "SpAtk",
"SPDEF": "Sp. Def",
"SPDEFshortened": "SpDef",
"SPD": "Speed",
"SPDshortened": "Spd"
} as const;

View File

@ -76,7 +76,21 @@ Phaser.GameObjects.Rectangle.prototype.setPositionRelative = setPositionRelative
document.fonts.load('16px emerald').then(() => document.fonts.load('10px pkmnems'));
const game = new Phaser.Game(config);
game.sound.pauseOnBlur = false;
let game;
const startGame = () => {
game = new Phaser.Game(config);
game.sound.pauseOnBlur = false;
};
fetch('/manifest.json')
.then(res => res.json())
.then(jsonResponse => {
startGame();
game['manifest'] = jsonResponse.manifest;
}).catch(() => {
// Manifest not found (likely local build)
startGame();
});
export default game;

View File

@ -190,7 +190,7 @@ export class PokemonHpRestoreModifierType extends PokemonModifierType {
protected healStatus: boolean;
constructor(name: string, restorePoints: integer, restorePercent: integer, healStatus: boolean = false, newModifierFunc?: NewModifierFunc, selectFilter?: PokemonSelectFilter, iconImage?: string, group?: string) {
super(name, restorePoints ? `Restore ${restorePoints} HP or ${restorePercent}% HP for one Pokémon, whichever is higher` : `Fully restores HP for one Pokémon${healStatus ? ' and heals any status ailment ' : ''}`,
super(name, restorePoints ? `Restores ${restorePoints} HP or ${restorePercent}% HP for one Pokémon, whichever is higher` : `Fully restores HP for one Pokémon${healStatus ? ' and heals any status ailment' : ''}`,
newModifierFunc || ((_type, args) => new Modifiers.PokemonHpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints, this.restorePercent, this.healStatus, false)),
selectFilter || ((pokemon: PlayerPokemon) => {
if (!pokemon.hp || (pokemon.hp >= pokemon.getMaxHp() && (!this.healStatus || !pokemon.status)))
@ -213,7 +213,7 @@ export class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
return null;
}), iconImage, 'revive');
this.description = `Revive one Pokémon and restore ${restorePercent}% HP`;
this.description = `Revives one Pokémon and restores ${restorePercent}% HP`;
this.selectFilter = (pokemon: PlayerPokemon) => {
if (pokemon.hp)
return PartyUiHandler.NoEffectMessage;
@ -224,7 +224,7 @@ export class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
export class PokemonStatusHealModifierType extends PokemonModifierType {
constructor(name: string) {
super(name, `Heal any status ailment for one Pokémon`,
super(name, `Heals any status ailment for one Pokémon`,
((_type, args) => new Modifiers.PokemonStatusHealModifier(this, (args[0] as PlayerPokemon).id)),
((pokemon: PlayerPokemon) => {
if (!pokemon.hp || !pokemon.status)
@ -249,7 +249,7 @@ export class PokemonPpRestoreModifierType extends PokemonMoveModifierType {
protected restorePoints: integer;
constructor(name: string, restorePoints: integer, iconImage?: string) {
super(name, `Restore ${restorePoints > -1 ? restorePoints : 'all'} PP for one Pokémon move`, (_type, args) => new Modifiers.PokemonPpRestoreModifier(this, (args[0] as PlayerPokemon).id, (args[1] as integer), this.restorePoints),
super(name, `Restores ${restorePoints > -1 ? restorePoints : 'all'} PP for one Pokémon move`, (_type, args) => new Modifiers.PokemonPpRestoreModifier(this, (args[0] as PlayerPokemon).id, (args[1] as integer), this.restorePoints),
(_pokemon: PlayerPokemon) => {
return null;
}, (pokemonMove: PokemonMove) => {
@ -266,7 +266,7 @@ export class PokemonAllMovePpRestoreModifierType extends PokemonModifierType {
protected restorePoints: integer;
constructor(name: string, restorePoints: integer, iconImage?: string) {
super(name, `Restore ${restorePoints > -1 ? restorePoints : 'all'} PP for all of one Pokémon's moves`, (_type, args) => new Modifiers.PokemonAllMovePpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints),
super(name, `Restores ${restorePoints > -1 ? restorePoints : 'all'} PP for all of one Pokémon's moves`, (_type, args) => new Modifiers.PokemonAllMovePpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints),
(pokemon: PlayerPokemon) => {
if (!pokemon.getMoveset().filter(m => m.ppUsed).length)
return PartyUiHandler.NoEffectMessage;
@ -281,7 +281,7 @@ export class PokemonPpUpModifierType extends PokemonMoveModifierType {
protected upPoints: integer;
constructor(name: string, upPoints: integer, iconImage?: string) {
super(name, `Permanently increase PP for one Pokémon move by ${upPoints} for every 5 maximum PP (maximum 3)`, (_type, args) => new Modifiers.PokemonPpUpModifier(this, (args[0] as PlayerPokemon).id, (args[1] as integer), this.upPoints),
super(name, `Permanently increases PP for one Pokémon move by ${upPoints} for every 5 maximum PP (maximum 3)`, (_type, args) => new Modifiers.PokemonPpUpModifier(this, (args[0] as PlayerPokemon).id, (args[1] as integer), this.upPoints),
(_pokemon: PlayerPokemon) => {
return null;
}, (pokemonMove: PokemonMove) => {
@ -425,14 +425,14 @@ export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType i
export class PokemonLevelIncrementModifierType extends PokemonModifierType {
constructor(name: string, iconImage?: string) {
super(name, `Increase a Pokémon\'s level by 1`, (_type, args) => new Modifiers.PokemonLevelIncrementModifier(this, (args[0] as PlayerPokemon).id),
super(name, `Increases a Pokémon\'s level by 1`, (_type, args) => new Modifiers.PokemonLevelIncrementModifier(this, (args[0] as PlayerPokemon).id),
(_pokemon: PlayerPokemon) => null, iconImage);
}
}
export class AllPokemonLevelIncrementModifierType extends ModifierType {
constructor(name: string, iconImage?: string) {
super(name, `Increase all party members' level by 1`, (_type, _args) => new Modifiers.PokemonLevelIncrementModifier(this, -1), iconImage);
super(name, `Increases all party members' level by 1`, (_type, _args) => new Modifiers.PokemonLevelIncrementModifier(this, -1), iconImage);
}
}
@ -469,7 +469,7 @@ export class PokemonBaseStatBoosterModifierType extends PokemonHeldItemModifierT
class AllPokemonFullHpRestoreModifierType extends ModifierType {
constructor(name: string, description?: string, newModifierFunc?: NewModifierFunc, iconImage?: string) {
super(name, description || `Restore 100% HP for all Pokémon`, newModifierFunc || ((_type, _args) => new Modifiers.PokemonHpRestoreModifier(this, -1, 0, 100, false)), iconImage);
super(name, description || `Restores 100% HP for all Pokémon`, newModifierFunc || ((_type, _args) => new Modifiers.PokemonHpRestoreModifier(this, -1, 0, 100, false)), iconImage);
}
}
@ -514,13 +514,13 @@ export class PokemonFriendshipBoosterModifierType extends PokemonHeldItemModifie
export class PokemonMoveAccuracyBoosterModifierType extends PokemonHeldItemModifierType {
constructor(name: string, amount: integer, iconImage?: string, group?: string, soundName?: string) {
super(name, `Increases move accuracy by ${amount} (up to 100)`, (_type, args) => new Modifiers.PokemonMoveAccuracyBoosterModifier(this, (args[0] as Pokemon).id, amount), iconImage, group, soundName);
super(name, `Increases move accuracy by ${amount} (maximum 100)`, (_type, args) => new Modifiers.PokemonMoveAccuracyBoosterModifier(this, (args[0] as Pokemon).id, amount), iconImage, group, soundName);
}
}
export class PokemonMultiHitModifierType extends PokemonHeldItemModifierType {
constructor(name: string, iconImage?: string) {
super(name, `Attacks hit one additional time at the cost of a 60/75/82.5% power reduction per stack respectively`, (type, args) => new Modifiers.PokemonMultiHitModifier(type as PokemonMultiHitModifierType, (args[0] as Pokemon).id), iconImage);
super(name, `Attacks hit one additional time at the cost of a 60/75/82.5% power reduction per stack respectively.`, (type, args) => new Modifiers.PokemonMultiHitModifier(type as PokemonMultiHitModifierType, (args[0] as Pokemon).id), iconImage);
}
}
@ -586,7 +586,7 @@ export class FormChangeItemModifierType extends PokemonModifierType implements G
export class FusePokemonModifierType extends PokemonModifierType {
constructor(name: string, iconImage?: string) {
super(name, 'Combines two Pokémon (transfers ability, splits base stats and types, shares move pool)', (_type, args) => new Modifiers.FusePokemonModifier(this, (args[0] as PlayerPokemon).id, (args[1] as PlayerPokemon).id),
super(name, 'Combines two Pokémon (transfers Ability, splits base stats and types, shares move pool)', (_type, args) => new Modifiers.FusePokemonModifier(this, (args[0] as PlayerPokemon).id, (args[1] as PlayerPokemon).id),
(pokemon: PlayerPokemon) => {
if (pokemon.isFusion())
return PartyUiHandler.NoEffectMessage;
@ -716,13 +716,13 @@ export class TerastallizeModifierType extends PokemonHeldItemModifierType implem
export class ContactHeldItemTransferChanceModifierType extends PokemonHeldItemModifierType {
constructor(name: string, chancePercent: integer, iconImage?: string, group?: string, soundName?: string) {
super(name, `Upon attacking, there is a ${chancePercent}% chance the foe's held item will be stolen`, (type, args) => new Modifiers.ContactHeldItemTransferChanceModifier(type, (args[0] as Pokemon).id, chancePercent), iconImage, group, soundName);
super(name, `Upon attacking, there is a ${chancePercent}% chance the foe's held item will be stolen.`, (type, args) => new Modifiers.ContactHeldItemTransferChanceModifier(type, (args[0] as Pokemon).id, chancePercent), iconImage, group, soundName);
}
}
export class TurnHeldItemTransferModifierType extends PokemonHeldItemModifierType {
constructor(name: string, iconImage?: string, group?: string, soundName?: string) {
super(name, 'Every turn, the holder acquires one held item from the foe', (type, args) => new Modifiers.TurnHeldItemTransferModifier(type, (args[0] as Pokemon).id), iconImage, group, soundName);
super(name, 'Every turn, the holder acquires one held item from the foe.', (type, args) => new Modifiers.TurnHeldItemTransferModifier(type, (args[0] as Pokemon).id), iconImage, group, soundName);
}
}
@ -772,9 +772,9 @@ export const modifierTypes = {
RARE_EVOLUTION_ITEM: () => new EvolutionItemModifierTypeGenerator(true),
FORM_CHANGE_ITEM: () => new FormChangeItemModifierTypeGenerator(),
MEGA_BRACELET: () => new ModifierType('Mega Bracelet', 'Mega stones become available', (type, _args) => new Modifiers.MegaEvolutionAccessModifier(type)),
DYNAMAX_BAND: () => new ModifierType('Dynamax Band', 'Max Mushrooms become available', (type, _args) => new Modifiers.GigantamaxAccessModifier(type)),
TERA_ORB: () => new ModifierType('Tera Orb', 'Tera Shards become available', (type, _args) => new Modifiers.TerastallizeAccessModifier(type)),
MEGA_BRACELET: () => new ModifierType('Mega Bracelet', 'Mega Stones become available.', (type, _args) => new Modifiers.MegaEvolutionAccessModifier(type)),
DYNAMAX_BAND: () => new ModifierType('Dynamax Band', 'Max Mushrooms become available.', (type, _args) => new Modifiers.GigantamaxAccessModifier(type)),
TERA_ORB: () => new ModifierType('Tera Orb', 'Tera Shards become available.', (type, _args) => new Modifiers.TerastallizeAccessModifier(type)),
MAP: () => new ModifierType('Map', 'Allows you to choose your destination at a crossroads', (type, _args) => new Modifiers.MapModifier(type)),
@ -873,12 +873,12 @@ export const modifierTypes = {
MEMORY_MUSHROOM: () => new RememberMoveModifierType('Memory Mushroom', 'Recall one Pokémon\'s forgotten move', 'big_mushroom'),
EXP_SHARE: () => new ModifierType('EXP. All', 'Non-participants receive 20% of a single participant\'s EXP. Points',
EXP_SHARE: () => new ModifierType('EXP. All', 'Non-participants receive 20% of a single participant\'s EXP. Points.',
(type, _args) => new Modifiers.ExpShareModifier(type), 'exp_share'),
EXP_BALANCE: () => new ModifierType('EXP. Balance', 'Weighs EXP. Points received from battles towards lower leveled party members',
EXP_BALANCE: () => new ModifierType('EXP. Balance', 'Weighs EXP. Points received from battles towards lower-leveled party members',
(type, _args) => new Modifiers.ExpBalanceModifier(type)),
OVAL_CHARM: () => new ModifierType('Oval Charm', 'When multiple Pokémon participate in a battle, each gets an extra 10% of the total EXP',
OVAL_CHARM: () => new ModifierType('Oval Charm', 'When multiple Pokémon participate in a battle, each gets an extra 10% of the total EXP.',
(type, _args) => new Modifiers.MultipleParticipantExpBonusModifier(type)),
EXP_CHARM: () => new ExpBoosterModifierType('EXP. Charm', 25),
@ -898,7 +898,7 @@ export const modifierTypes = {
AMULET_COIN: () => new ModifierType('Amulet Coin', 'Increases money rewards by 20%', (type, _args) => new Modifiers.MoneyMultiplierModifier(type)),
GOLDEN_PUNCH: () => new PokemonHeldItemModifierType('Golden Punch', 'Grants 50% of damage inflicted as money', (type, args) => new Modifiers.DamageMoneyRewardModifier(type, (args[0] as Pokemon).id)),
COIN_CASE: () => new ModifierType('Coin Case', 'After every 10th battle, receive 10% of your money in interest', (type, _args) => new Modifiers.MoneyInterestModifier(type)),
COIN_CASE: () => new ModifierType('Coin Case', 'After every 10th battle, receive 10% of your money in interest.', (type, _args) => new Modifiers.MoneyInterestModifier(type)),
LOCK_CAPSULE: () => new ModifierType('Lock Capsule', 'Allows you to lock item rarities when rerolling items', (type, _args) => new Modifiers.LockModifierTiersModifier(type), 'lock_capsule'),
@ -907,7 +907,7 @@ export const modifierTypes = {
MULTI_LENS: () => new PokemonMultiHitModifierType('Multi Lens', 'zoom_lens'),
HEALING_CHARM: () => new ModifierType('Healing Charm', 'Increases the effectiveness of HP restoring moves and items by 10% (excludes revives)',
HEALING_CHARM: () => new ModifierType('Healing Charm', 'Increases the effectiveness of HP restoring moves and items by 10% (excludes Revives)',
(type, _args) => new Modifiers.HealingBoosterModifier(type, 1.1), 'healing_charm'),
CANDY_JAR: () => new ModifierType('Candy Jar', 'Increases the number of levels added by Rare Candy items by 1', (type, _args) => new Modifiers.LevelIncrementBoosterModifier(type)),
@ -928,8 +928,8 @@ export const modifierTypes = {
BATON: () => new PokemonHeldItemModifierType('Baton', 'Allows passing along effects when switching Pokémon, which also bypasses traps',
(type, args) => new Modifiers.SwitchEffectTransferModifier(type, (args[0] as Pokemon).id), 'stick'),
SHINY_CHARM: () => new ModifierType('Shiny Charm', 'Dramatically increases the chance of a wild Pokémon being shiny', (type, _args) => new Modifiers.ShinyRateBoosterModifier(type)),
ABILITY_CHARM: () => new ModifierType('Ability Charm', 'Dramatically increases the chance of a wild Pokémon having a hidden ability', (type, _args) => new Modifiers.HiddenAbilityRateBoosterModifier(type)),
SHINY_CHARM: () => new ModifierType('Shiny Charm', 'Dramatically increases the chance of a wild Pokémon being Shiny', (type, _args) => new Modifiers.ShinyRateBoosterModifier(type)),
ABILITY_CHARM: () => new ModifierType('Ability Charm', 'Dramatically increases the chance of a wild Pokémon having a Hidden Ability', (type, _args) => new Modifiers.HiddenAbilityRateBoosterModifier(type)),
IV_SCANNER: () => new ModifierType('IV Scanner', 'Allows scanning the IVs of wild Pokémon. 2 IVs are revealed per stack. The best IVs are shown first.', (type, _args) => new Modifiers.IvScannerModifier(type), 'scanner'),

View File

@ -1185,7 +1185,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
}
if (this.player) {
this.scene.ui.showText(`Go! ${this.getPokemon().name}!`);
this.scene.ui.showText(i18next.t('menu:playerGo', {pokemonName: this.getPokemon().name}));
if (this.player)
this.scene.pbTray.hide();
this.scene.trainer.setTexture(`trainer_${this.scene.gameData.gender === PlayerGender.FEMALE ? 'f' : 'm'}_back_pb`);
@ -2613,7 +2613,7 @@ export class MoveAnimTestPhase extends BattlePhase {
} else if (player)
console.log(Moves[moveId]);
initMoveAnim(moveId).then(() => {
initMoveAnim(this.scene, moveId).then(() => {
loadMoveAnimAssets(this.scene, [ moveId ], true)
.then(() => {
new MoveAnim(moveId, player ? this.scene.getPlayerPokemon() : this.scene.getEnemyPokemon(), (player !== (allMoves[moveId] instanceof SelfStatusMove) ? this.scene.getEnemyPokemon() : this.scene.getPlayerPokemon()).getBattlerIndex()).play(this.scene, () => {
@ -2665,11 +2665,20 @@ export class StatChangePhase extends PokemonPhase {
start() {
const pokemon = this.getPokemon();
let random = false;
const allStats = Utils.getEnumValues(BattleStat);
if (this.stats.length === 1 && this.stats[0] === BattleStat.RAND) {
this.stats[0] = this.getRandomStat();
random = true;
}
this.aggregateStatChanges(random);
if (!pokemon.isActive(true))
return this.end();
const allStats = Utils.getEnumValues(BattleStat);
const filteredStats = this.stats.map(s => s !== BattleStat.RAND ? s : allStats[pokemon.randSeedInt(BattleStat.SPD + 1)]).filter(stat => {
const filteredStats = this.stats.map(s => s !== BattleStat.RAND ? s : this.getRandomStat()).filter(stat => {
const cancelled = new Utils.BooleanHolder(false);
if (!this.selfTarget && this.levels < 0)
@ -2750,11 +2759,62 @@ export class StatChangePhase extends PokemonPhase {
end();
}
getRandomStat(): BattleStat {
const allStats = Utils.getEnumValues(BattleStat);
return allStats[this.getPokemon().randSeedInt(BattleStat.SPD + 1)];
}
aggregateStatChanges(random: boolean = false): void {
const isAccEva = [ BattleStat.ACC, BattleStat.EVA ].some(s => this.stats.includes(s));
let existingPhase: StatChangePhase;
if (this.stats.length === 1) {
while ((existingPhase = (this.scene.findPhase(p => p instanceof StatChangePhase && p.battlerIndex === this.battlerIndex && p.stats.length === 1
&& (p.stats[0] === this.stats[0] || (random && p.stats[0] === BattleStat.RAND))
&& p.selfTarget === this.selfTarget && p.showMessage === this.showMessage && p.ignoreAbilities === this.ignoreAbilities) as StatChangePhase))) {
if (existingPhase.stats[0] === BattleStat.RAND) {
existingPhase.stats[0] = this.getRandomStat();
if (existingPhase.stats[0] !== this.stats[0])
continue;
}
this.levels += existingPhase.levels;
if (!this.scene.tryRemovePhase(p => p === existingPhase))
break;
}
}
while ((existingPhase = (this.scene.findPhase(p => p instanceof StatChangePhase && p.battlerIndex === this.battlerIndex && p.selfTarget === this.selfTarget
&& ([ BattleStat.ACC, BattleStat.EVA ].some(s => p.stats.includes(s)) === isAccEva)
&& p.levels === this.levels && p.showMessage === this.showMessage && p.ignoreAbilities === this.ignoreAbilities) as StatChangePhase))) {
this.stats.push(...existingPhase.stats);
if (!this.scene.tryRemovePhase(p => p === existingPhase))
break;
}
}
getStatChangeMessages(stats: BattleStat[], levels: integer, relLevels: integer[]): string[] {
const messages: string[] = [];
for (let s = 0; s < stats.length; s++)
messages.push(getPokemonMessage(this.getPokemon(), `'s ${getBattleStatName(stats[s])} ${getBattleStatLevelChangeDescription(Math.abs(relLevels[s]), levels >= 1)}!`));
const relLevelStatIndexes = {};
for (let rl = 0; rl < relLevels.length; rl++) {
const relLevel = relLevels[rl];
if (!relLevelStatIndexes[relLevel])
relLevelStatIndexes[relLevel] = [];
relLevelStatIndexes[relLevel].push(rl);
}
Object.keys(relLevelStatIndexes).forEach(rl => {
const relLevelStats = stats.filter((_, i) => relLevelStatIndexes[rl].includes(i));
let statsFragment = '';
if (relLevelStats.length > 1) {
statsFragment = relLevelStats.length >= 5
? 'stats'
: `${relLevelStats.slice(0, -1).map(s => getBattleStatName(s)).join(', ')}, and ${getBattleStatName(relLevelStats[relLevelStats.length - 1])}`;
} else
statsFragment = getBattleStatName(relLevelStats[0]);
messages.push(getPokemonMessage(this.getPokemon(), `'s ${statsFragment} ${getBattleStatLevelChangeDescription(Math.abs(parseInt(rl)), levels >= 1)}!`));
});
return messages;
}
}
@ -3675,7 +3735,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
if (emptyMoveIndex > -1) {
pokemon.setMove(emptyMoveIndex, this.moveId);
initMoveAnim(this.moveId).then(() => {
initMoveAnim(this.scene, this.moveId).then(() => {
loadMoveAnimAssets(this.scene, [ this.moveId ], true)
.then(() => {
this.scene.ui.setMode(messageMode).then(() => {

View File

@ -1,26 +1,29 @@
let cacheBuster = '';
const ignoredFiles = [ 'intro_dark' ];
let manifest: object;
export default class CacheBustedLoaderPlugin extends Phaser.Loader.LoaderPlugin {
constructor(scene: Phaser.Scene) {
super(scene)
}
get cacheBuster() {
return cacheBuster
get manifest() {
return manifest;
}
set cacheBuster(version) {
cacheBuster = version
set manifest(manifestObj: object) {
manifest = manifestObj;
}
addFile(file): void {
if (!Array.isArray(file))
file = [ file ];
if (!ignoredFiles.includes(file?.key) && cacheBuster)
file.forEach(item => item.url += '?v=' + cacheBuster);
file.forEach(item => {
if (manifest) {
const timestamp = manifest[`/${item.url.replace(/\/\//g, '/')}` ];
if (timestamp)
item.url += `?t=${timestamp}`;
}
});
super.addFile(file);
}

View File

@ -8,17 +8,32 @@ import { move as enMove } from '../locales/en/move';
import { move as esMove } from '../locales/es/move';
import { move as frMove } from '../locales/fr/move';
import { ability as enAbility } from '../locales/en/ability';
import { ability as esAbility } from '../locales/es/ability';
import { ability as frAbility } from '../locales/fr/ability';
import { pokeball as enPokeball } from '../locales/en/pokeball';
import { pokeball as esPokeball } from '../locales/es/pokeball';
import { pokeball as frPokeball } from '../locales/fr/pokeball';
import { pokemon as enPokemon } from '../locales/en/pokemon';
import { pokemon as esPokemon } from '../locales/es/pokemon';
import { pokemon as frPokemon } from '../locales/fr/pokemon';
import { pokemonStat as enPokemonStat } from '../locales/en/pokemon-stat';
import { pokemonStat as esPokemonStat } from '../locales/es/pokemon-stat';
import { pokemonStat as frPokemonStat } from '../locales/fr/pokemon-stat';
import { pokemonStat as itPokemonStat } from '../locales/it/pokemon-stat';
import { commandUiHandler as enCommandUiHandler } from '../locales/en/command-ui-handler';
import { commandUiHandler as esCommandUiHandler } from '../locales/es/command-ui-handler';
import { commandUiHandler as frCommandUiHandler } from '../locales/fr/command-ui-handler';
export interface SimpleTranslationEntries {
[key: string]: string
}
export interface MoveTranslationEntry {
name: string,
effect: string
@ -28,6 +43,15 @@ export interface MoveTranslationEntries {
[key: string]: MoveTranslationEntry
}
export interface AbilityTranslationEntry {
name: string,
description: string
}
export interface AbilityTranslationEntries {
[key: string]: AbilityTranslationEntry
}
export interface Localizable {
localize(): void;
}
@ -63,23 +87,34 @@ export function initI18n(): void {
en: {
menu: enMenu,
move: enMove,
ability: enAbility,
pokeball: enPokeball,
pokemon: enPokemon,
pokemonStat: enPokemonStat,
commandUiHandler: enCommandUiHandler,
},
es: {
menu: esMenu,
move: esMove,
ability: esAbility,
pokeball: esPokeball,
},
it: {
menu: itMenu,
pokemon: esPokemon,
pokemonStat: esPokemonStat,
commandUiHandler: esCommandUiHandler,
},
fr: {
menu: frMenu,
move: frMove,
ability: frAbility,
pokeball: frPokeball,
pokemon: frPokemon,
}
pokemonStat: frPokemonStat,
commandUiHandler: frCommandUiHandler,
},
it: {
menu: itMenu,
pokemonStat: itPokemonStat,
},
},
});
}
@ -90,8 +125,11 @@ declare module 'i18next' {
resources: {
menu: typeof enMenu;
move: typeof enMove;
ability: typeof enAbility;
pokeball: typeof enPokeball;
pokemon: typeof enPokemon;
pokemonStat: typeof enPokemonStat;
commandUiHandler: typeof enCommandUiHandler;
};
}
}

View File

@ -5,25 +5,35 @@ export class SceneBase extends Phaser.Scene {
super(config);
}
getCachedUrl(url: string): string {
const manifest = this.game['manifest'];
if (manifest) {
const timestamp = manifest[`/${url}`];
if (timestamp)
url += `?t=${timestamp}`;
}
return url;
}
loadImage(key: string, folder: string, filename?: string) {
if (!filename)
filename = `${key}.png`;
this.load.image(key, `images/${folder}/${filename}`);
this.load.image(key, this.getCachedUrl(`images/${folder}/${filename}`));
if (folder.startsWith('ui')) {
legacyCompatibleImages.push(key);
folder = folder.replace('ui', 'ui/legacy');
this.load.image(`${key}_legacy`, `images/${folder}/${filename}`);
this.load.image(`${key}_legacy`, this.getCachedUrl(`images/${folder}/${filename}`));
}
}
loadSpritesheet(key: string, folder: string, size: integer, filename?: string) {
if (!filename)
filename = `${key}.png`;
this.load.spritesheet(key, `images/${folder}/${filename}`, { frameWidth: size, frameHeight: size });
this.load.spritesheet(key, this.getCachedUrl(`images/${folder}/${filename}`), { frameWidth: size, frameHeight: size });
if (folder.startsWith('ui')) {
legacyCompatibleImages.push(key);
folder = folder.replace('ui', 'ui/legacy');
this.load.spritesheet(`${key}_legacy`, `images/${folder}/${filename}`, { frameWidth: size, frameHeight: size });
this.load.spritesheet(`${key}_legacy`, this.getCachedUrl(`images/${folder}/${filename}`), { frameWidth: size, frameHeight: size });
}
}
@ -32,11 +42,11 @@ export class SceneBase extends Phaser.Scene {
filenameRoot = key;
if (folder)
folder += '/';
this.load.atlas(key, `images/${folder}${filenameRoot}.png`, `images/${folder}/${filenameRoot}.json`);
this.load.atlas(key, this.getCachedUrl(`images/${folder}${filenameRoot}.png`), this.getCachedUrl(`images/${folder}/${filenameRoot}.json`));
if (folder.startsWith('ui')) {
legacyCompatibleImages.push(key);
folder = folder.replace('ui', 'ui/legacy');
this.load.atlas(`${key}_legacy`, `images/${folder}${filenameRoot}.png`, `images/${folder}/${filenameRoot}.json`);
this.load.atlas(`${key}_legacy`, this.getCachedUrl(`images/${folder}${filenameRoot}.png`), this.getCachedUrl(`images/${folder}/${filenameRoot}.json`));
}
}
@ -49,14 +59,13 @@ export class SceneBase extends Phaser.Scene {
folder += '/';
if (!Array.isArray(filenames))
filenames = [ filenames ];
for (let f of filenames as string[]) {
this.load.audio(key, `audio/se/${folder}${f}`);
}
for (let f of filenames as string[])
this.load.audio(key, this.getCachedUrl(`audio/se/${folder}${f}`));
}
loadBgm(key: string, filename?: string) {
if (!filename)
filename = `${key}.mp3`;
this.load.audio(key, `audio/bgm/${filename}`);
this.load.audio(key, this.getCachedUrl(`audio/bgm/${filename}`));
}
}

View File

@ -272,7 +272,7 @@ export class GameData {
const systemData = JSON.stringify(data, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v);
if (!bypassLogin) {
Utils.apiPost(`savedata/update?datatype=${GameDataType.SYSTEM}`, systemData)
Utils.apiPost(`savedata/update?datatype=${GameDataType.SYSTEM}`, systemData, undefined, true)
.then(response => response.text())
.then(error => {
this.scene.ui.savingIcon.hide();
@ -347,7 +347,8 @@ export class GameData {
} else {
if ([ '1.0.0', '1.0.1' ].includes(systemData.gameVersion))
this.migrateStarterAbilities(systemData);
this.fixVariantData(systemData);
//this.fixVariantData(systemData);
this.fixStarterData(systemData);
// Migrate ability starter data if empty for caught species
Object.keys(systemData.starterData).forEach(sd => {
if (systemData.dexData[sd].caughtAttr && !systemData.starterData[sd].abilityAttr)
@ -550,7 +551,7 @@ export class GameData {
const sessionData = this.getSessionSaveData(scene);
if (!bypassLogin) {
Utils.apiPost(`savedata/update?datatype=${GameDataType.SESSION}&slot=${scene.sessionSlotId}`, JSON.stringify(sessionData))
Utils.apiPost(`savedata/update?datatype=${GameDataType.SESSION}&slot=${scene.sessionSlotId}`, JSON.stringify(sessionData), undefined, true)
.then(response => response.text())
.then(error => {
if (error) {
@ -751,7 +752,7 @@ export class GameData {
if (success !== null && !success)
return resolve([false, false]);
const sessionData = this.getSessionSaveData(scene);
Utils.apiPost(`savedata/clear?slot=${slotId}`, JSON.stringify(sessionData)).then(response => {
Utils.apiPost(`savedata/clear?slot=${slotId}`, JSON.stringify(sessionData), undefined, true).then(response => {
if (response.ok)
loggedInUser.lastSessionSlot = -1;
return response.json();
@ -911,7 +912,7 @@ export class GameData {
updateUserInfo().then(success => {
if (!success)
return displayError(`Could not contact the server. Your ${dataName} data could not be imported.`);
Utils.apiPost(`savedata/update?datatype=${dataType}${dataType === GameDataType.SESSION ? `&slot=${slotId}` : ''}`, dataStr)
Utils.apiPost(`savedata/update?datatype=${dataType}${dataType === GameDataType.SESSION ? `&slot=${slotId}` : ''}`, dataStr, undefined, true)
.then(response => response.text())
.then(error => {
if (error) {
@ -984,7 +985,7 @@ export class GameData {
moveset: null,
eggMoves: 0,
candyCount: 0,
abilityAttr: 0,
abilityAttr: defaultStarterSpecies.includes(speciesId) ? AbilityAttr.ABILITY_1 : 0,
passiveAttr: 0,
valueReduction: 0
};
@ -1291,4 +1292,9 @@ export class GameData {
}
}
}
fixStarterData(systemData: SystemSaveData): void {
for (let starterId of defaultStarterSpecies)
systemData.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
}
}

View File

@ -4,6 +4,7 @@ import { addTextObject, TextStyle } from "./text";
import PartyUiHandler, { PartyUiMode } from "./party-ui-handler";
import { Mode } from "./ui";
import UiHandler from "./ui-handler";
import i18next from '../plugins/i18n';
export enum Command {
FIGHT = 0,
@ -25,7 +26,12 @@ export default class CommandUiHandler extends UiHandler {
setup() {
const ui = this.getUi();
const commands = [ 'Fight', 'Ball', 'Pokémon', 'Run' ];
const commands = [
i18next.t('commandUiHandler:fight'),
i18next.t('commandUiHandler:ball'),
i18next.t('commandUiHandler:pokemon'),
i18next.t('commandUiHandler:run')
];
this.commandsContainer = this.scene.add.container(216, -38.7);
this.commandsContainer.setVisible(false);
@ -55,7 +61,7 @@ export default class CommandUiHandler extends UiHandler {
messageHandler.commandWindow.setVisible(true);
messageHandler.movesWindowContainer.setVisible(false);
messageHandler.message.setWordWrapWidth(1110);
messageHandler.showText(`What will\n${commandPhase.getPokemon().name} do?`, 0);
messageHandler.showText(i18next.t('commandUiHandler:actionMessage', {pokemonName: commandPhase.getPokemon().name}), 0);
this.setCursor(this.getCursor());
return true;

View File

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

View File

@ -5,6 +5,7 @@ import { TextStyle, addTextInputObject, addTextObject } from "./text";
import { WindowVariant, addWindow } from "./ui-theme";
import InputText from "phaser3-rex-plugins/plugins/inputtext";
import * as Utils from "../utils";
import i18next from '../plugins/i18n';
export interface FormModalConfig extends ModalConfig {
errorMessage?: string;
@ -55,7 +56,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
const inputBg = addWindow(this.scene, 0, 0, 80, 16, false, false, 0, 0, WindowVariant.XTHIN);
const isPassword = field.includes('Password');
const isPassword = field.includes(i18next.t("menu:password")) || field.includes(i18next.t("menu:confirmPassword"));
const input = addTextInputObject(this.scene, 4, -2, 440, 116, TextStyle.TOOLTIP_CONTENT, { type: isPassword ? 'password' : 'text', maxLength: isPassword ? 64 : 16 });
input.setOrigin(0, 0);

View File

@ -59,11 +59,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
};
if (!this.inputs[0].text)
return onFail(i18next.t('menu:emptyUsername'));
const contentType = 'application/x-www-form-urlencoded';
const headers = {
'Content-Type': contentType,
};
fetch(`${Utils.apiUrl}/account/login`, { method: 'POST', headers: headers, body: `username=${encodeURIComponent(this.inputs[0].text)}&password=${encodeURIComponent(this.inputs[1].text)}` })
Utils.apiPost(`account/login`, `username=${encodeURIComponent(this.inputs[0].text)}&password=${encodeURIComponent(this.inputs[1].text)}`, 'application/x-www-form-urlencoded')
.then(response => {
if (!response.ok)
return response.text();

View File

@ -307,7 +307,7 @@ export default class MenuUiHandler extends MessageUiHandler {
case MenuOptions.LOG_OUT:
success = true;
const doLogout = () => {
Utils.apiPost('account/logout').then(res => {
Utils.apiPost('account/logout', undefined, undefined, true).then(res => {
if (!res.ok)
console.error(`Log out failed (${res.status}: ${res.statusText})`);
Utils.setCookie(Utils.sessionIdKey, '');

View File

@ -285,13 +285,13 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
ui.showText(options[this.cursor].modifierTypeOption.type.getDescription(this.scene));
} else if (!cursor) {
this.cursorObj.setPosition(6, this.lockRarityButtonContainer.visible ? -72 : -60);
ui.showText('Spend money to reroll your item options');
ui.showText('Spend money to reroll your item options.');
} else if (cursor === 1) {
this.cursorObj.setPosition((this.scene.game.canvas.width / 6) - 50, -60);
ui.showText('Transfer a held item from one Pokémon to another');
ui.showText('Transfer a held item from one Pokémon to another.');
} else {
this.cursorObj.setPosition(6, -60);
ui.showText('Lock item rarities on reroll (affects reroll cost)');
ui.showText('Lock item rarities on reroll (affects reroll cost).');
}
return ret;

View File

@ -74,15 +74,11 @@ export default class RegistrationFormUiHandler extends FormModalUiHandler {
return onFail(this.getReadableErrorMessage('invalid password'));
if (this.inputs[1].text !== this.inputs[2].text)
return onFail(i18next.t('menu:passwordNotMatchingConfirmPassword'));
const contentType = 'application/x-www-form-urlencoded';
const headers = {
'Content-Type': contentType,
};
fetch(`${Utils.apiUrl}/account/register`, { method: 'POST', headers: headers, body: `username=${encodeURIComponent(this.inputs[0].text)}&password=${encodeURIComponent(this.inputs[1].text)}` })
Utils.apiPost(`account/register`, `username=${encodeURIComponent(this.inputs[0].text)}&password=${encodeURIComponent(this.inputs[1].text)}`, 'application/x-www-form-urlencoded')
.then(response => response.text())
.then(response => {
if (!response) {
fetch(`${Utils.apiUrl}/account/login`, { method: 'POST', headers: headers, body: `username=${encodeURIComponent(this.inputs[0].text)}&password=${encodeURIComponent(this.inputs[1].text)}` })
Utils.apiPost(`account/login`, `username=${encodeURIComponent(this.inputs[0].text)}&password=${encodeURIComponent(this.inputs[1].text)}`, 'application/x-www-form-urlencoded')
.then(response => {
if (!response.ok)
return response.text();

View File

@ -7,10 +7,9 @@ import { addWindow } from "./ui-theme";
import * as Utils from "../utils";
import PokemonData from "../system/pokemon-data";
import { PokemonHeldItemModifier } from "../modifier/modifier";
import { TitlePhase } from "../phases";
import MessageUiHandler from "./message-ui-handler";
const sessionSlotCount = 3;
const sessionSlotCount = 5;
export enum SaveSlotUiMode {
LOAD,
@ -30,8 +29,12 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
private uiMode: SaveSlotUiMode;
private saveSlotSelectCallback: SaveSlotSelectCallback;
private scrollCursor: integer = 0;
private cursorObj: Phaser.GameObjects.NineSlice;
private sessionSlotsContainerInitialY: number;
constructor(scene: BattleScene) {
super(scene, Mode.SAVE_SLOT);
}
@ -47,7 +50,9 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
loadSessionBg.setOrigin(0, 0);
this.saveSlotSelectContainer.add(loadSessionBg);
this.sessionSlotsContainer = this.scene.add.container(8, -this.scene.game.canvas.height / 6 + 8);
this.sessionSlotsContainerInitialY = -this.scene.game.canvas.height / 6 + 8;
this.sessionSlotsContainer = this.scene.add.container(8, this.sessionSlotsContainerInitialY);
this.saveSlotSelectContainer.add(this.sessionSlotsContainer);
this.saveSlotSelectMessageBoxContainer = this.scene.add.container(0, 0);
@ -76,6 +81,7 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
this.saveSlotSelectContainer.setVisible(true);
this.populateSessionSlots();
this.setScrollCursor(0);
this.setCursor(0);
return true;
@ -90,13 +96,14 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
if (button === Button.ACTION || button === Button.CANCEL) {
const originalCallback = this.saveSlotSelectCallback;
if (button === Button.ACTION) {
if (this.uiMode === SaveSlotUiMode.LOAD && !this.sessionSlots[this.cursor].hasData)
const cursor = this.cursor + this.scrollCursor;
if (this.uiMode === SaveSlotUiMode.LOAD && !this.sessionSlots[cursor].hasData)
error = true;
else {
switch (this.uiMode) {
case SaveSlotUiMode.LOAD:
this.saveSlotSelectCallback = null;
originalCallback(this.cursor);
originalCallback(cursor);
break;
case SaveSlotUiMode.SAVE:
const saveAndCallback = () => {
@ -105,16 +112,16 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
ui.revertMode();
ui.showText(null, 0);
ui.setMode(Mode.MESSAGE);
originalCallback(this.cursor);
originalCallback(cursor);
};
if (this.sessionSlots[this.cursor].hasData) {
if (this.sessionSlots[cursor].hasData) {
ui.showText('Overwrite the data in the selected slot?', null, () => {
ui.setOverlayMode(Mode.CONFIRM, () => saveAndCallback(), () => {
ui.revertMode();
ui.showText(null, 0);
}, false, 0, 19, 2000);
});
} else if (this.sessionSlots[this.cursor].hasData === false)
} else if (this.sessionSlots[cursor].hasData === false)
saveAndCallback();
else
return false;
@ -130,10 +137,16 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
} else {
switch (button) {
case Button.UP:
success = this.setCursor(this.cursor ? this.cursor - 1 : 0);
if (this.cursor)
success = this.setCursor(this.cursor - 1);
else if (this.scrollCursor)
success = this.setScrollCursor(this.scrollCursor - 1);
break;
case Button.DOWN:
success = this.setCursor(this.cursor < sessionSlotCount - 1 ? this.cursor + 1 : 2);
if (this.cursor < 2)
success = this.setCursor(this.cursor + 1);
else if (this.scrollCursor < sessionSlotCount - 3)
success = this.setScrollCursor(this.scrollCursor + 1);
break;
}
}
@ -178,7 +191,24 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
this.cursorObj.setOrigin(0, 0);
this.sessionSlotsContainer.add(this.cursorObj);
}
this.cursorObj.setPosition(4, 4 + cursor * 56);
this.cursorObj.setPosition(4, 4 + (cursor + this.scrollCursor) * 56);
return changed;
}
setScrollCursor(scrollCursor: integer): boolean {
let changed = scrollCursor !== this.scrollCursor;
if (changed) {
this.scrollCursor = scrollCursor;
this.setCursor(this.cursor);
this.scene.tweens.add({
targets: this.sessionSlotsContainer,
y: this.sessionSlotsContainerInitialY - 56 * scrollCursor,
duration: Utils.fixedInt(325),
ease: 'Sine.easeInOut'
});
}
return changed;
}

View File

@ -212,7 +212,8 @@ export function executeIf<T>(condition: boolean, promiseFunc: () => Promise<T>):
export const sessionIdKey = 'pokerogue_sessionId';
export const isLocal = window.location.hostname === 'localhost';
export const serverUrl = isLocal ? 'http://localhost:8001' : '';
export const apiUrl = isLocal ? serverUrl : 'api';
export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.net';
export const fallbackApiUrl = isLocal ? serverUrl : 'api';
export function setCookie(cName: string, cValue: string): void {
const expiration = new Date();
@ -233,7 +234,7 @@ export function getCookie(cName: string): string {
return '';
}
export function apiFetch(path: string, authed: boolean = false): Promise<Response> {
export function apiFetch(path: string, authed: boolean = false, fallback: boolean = false): Promise<Response> {
return new Promise((resolve, reject) => {
const request = {};
if (authed) {
@ -241,24 +242,40 @@ export function apiFetch(path: string, authed: boolean = false): Promise<Respons
if (sId)
request['headers'] = { 'Authorization': sId };
}
fetch(`${apiUrl}/${path}`, request)
.then(response => resolve(response))
.catch(err => reject(err));
fetch(`${!fallback ? apiUrl : fallbackApiUrl}/${path}`, request)
.then(response => {
if (!response.ok && response.status === 404 && !fallback)
return apiFetch(path, authed, true).then(res => resolve(res));
resolve(response);
})
.catch(err => {
if (fallback)
reject(err);
else
apiFetch(path, authed, true).then(res => resolve(res));
});
});
}
export function apiPost(path: string, data?: any, contentType: string = 'application/json'): Promise<Response> {
export function apiPost(path: string, data?: any, contentType: string = 'application/json', authed: boolean = false, fallback: boolean = false): Promise<Response> {
return new Promise((resolve, reject) => {
const headers = {
'Accept': contentType,
'Content-Type': contentType,
};
const sId = getCookie(sessionIdKey);
if (sId)
headers['Authorization'] = sId;
fetch(`${apiUrl}/${path}`, { method: 'POST', headers: headers, body: data })
if (authed) {
const sId = getCookie(sessionIdKey);
if (sId)
headers['Authorization'] = sId;
}
fetch(`${!fallback ? apiUrl : fallbackApiUrl}/${path}`, { method: 'POST', headers: headers, body: data })
.then(response => resolve(response))
.catch(err => reject(err));
.catch(err => {
if (fallback)
reject(err);
else
apiPost(path, data, contentType, authed, true).then(res => resolve(res));
});
});
}