diff --git a/package-lock.json b/package-lock.json index da89f87b0bd..02a5d375588 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pokemon-rogue-battle", - "version": "1.9.2", + "version": "1.9.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pokemon-rogue-battle", - "version": "1.9.2", + "version": "1.9.3", "hasInstallScript": true, "dependencies": { "@material/material-color-utilities": "^0.2.7", diff --git a/package.json b/package.json index d5eb1138776..715deefbe32 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pokemon-rogue-battle", "private": true, - "version": "1.9.2", + "version": "1.9.3", "type": "module", "scripts": { "start": "vite", diff --git a/public/locales b/public/locales index f4b8b7b737e..ee6bb371afe 160000 --- a/public/locales +++ b/public/locales @@ -1 +1 @@ -Subproject commit f4b8b7b737e47eaf7e7231855d0b59f8c7c7c0f8 +Subproject commit ee6bb371afefe4c6d872cc7765f0e0d26e630d4e diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 39bd1dd64cf..5835ee08af5 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1045,7 +1045,7 @@ export default class BattleScene extends SceneBase { y: number, originX = 0.5, originY = 0.5, - ignoreOverride = false, + ignoreOverride = true, useIllusion = false, ): Phaser.GameObjects.Container { const container = this.add.container(x, y); @@ -1053,9 +1053,9 @@ export default class BattleScene extends SceneBase { const icon = this.add.sprite(0, 0, pokemon.getIconAtlasKey(ignoreOverride, useIllusion)); icon.setName(`sprite-${pokemon.name}-icon`); - icon.setFrame(pokemon.getIconId(true, useIllusion)); + icon.setFrame(pokemon.getIconId(ignoreOverride, useIllusion)); // Temporary fix to show pokemon's default icon if variant icon doesn't exist - if (icon.frame.name !== pokemon.getIconId(true, useIllusion)) { + if (icon.frame.name !== pokemon.getIconId(ignoreOverride, useIllusion)) { console.log(`${pokemon.name}'s variant icon does not exist. Replacing with default.`); const temp = pokemon.shiny; pokemon.shiny = false; @@ -1071,7 +1071,7 @@ export default class BattleScene extends SceneBase { const fusionIcon = this.add.sprite(0, 0, pokemon.getFusionIconAtlasKey(ignoreOverride, useIllusion)); fusionIcon.setName("sprite-fusion-icon"); fusionIcon.setOrigin(0.5, 0); - fusionIcon.setFrame(pokemon.getFusionIconId(true, useIllusion)); + fusionIcon.setFrame(pokemon.getFusionIconId(ignoreOverride, useIllusion)); const originalWidth = icon.width; const originalHeight = icon.height; @@ -2921,7 +2921,10 @@ export default class BattleScene extends SceneBase { instant?: boolean, cost?: number, ): boolean { - if (!modifier) { + // We check against modifier.type to stop a bug related to loading in a pokemon that has a form change item, which prior to some patch + // that changed form change modifiers worked, had previously set the `type` field to null. + // TODO: This is not the right place to check for this; it should ideally go in a session migrator. + if (!modifier || !modifier.type) { return false; } let success = false; diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 6a05bea4c6d..eec20beb01c 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -909,19 +909,22 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const originalWarn = console.warn; // Ignore warnings for missing frames, because there will be a lot console.warn = () => {}; - const battleFrameNames = globalScene.anims.generateFrameNames(this.getBattleSpriteKey(), { + const battleSpriteKey = this.getBattleSpriteKey(this.isPlayer(), ignoreOverride); + const battleFrameNames = globalScene.anims.generateFrameNames(battleSpriteKey, { zeroPad: 4, suffix: ".png", start: 1, end: 400, }); console.warn = originalWarn; - globalScene.anims.create({ - key: this.getBattleSpriteKey(), - frames: battleFrameNames, - frameRate: 10, - repeat: -1, - }); + if (!globalScene.anims.exists(battleSpriteKey)) { + globalScene.anims.create({ + key: battleSpriteKey, + frames: battleFrameNames, + frameRate: 10, + repeat: -1, + }); + } } // With everything loaded, now begin playing the animation. this.playAnim(); @@ -7862,7 +7865,7 @@ export class PokemonSummonData { } if (key === "moveset") { - this.moveset = value.map((m: any) => PokemonMove.loadMove(m)); + this.moveset = value?.map((m: any) => PokemonMove.loadMove(m)); continue; } diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index c65e8e15271..d067807486d 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -206,11 +206,13 @@ export class MoveEffectPhase extends PokemonPhase { * @throws Error if there was an unexpected hit check result */ private applyToTargets(user: Pokemon, targets: Pokemon[]): void { + let firstHit = true; for (const [i, target] of targets.entries()) { const [hitCheckResult, effectiveness] = this.hitChecks[i]; switch (hitCheckResult) { case HitCheckResult.HIT: - this.applyMoveEffects(target, effectiveness); + this.applyMoveEffects(target, effectiveness, firstHit); + firstHit = false; if (isFieldTargeted(this.move)) { // Stop processing other targets if the move is a field move return; @@ -763,15 +765,12 @@ export class MoveEffectPhase extends PokemonPhase { * - Invoking {@linkcode applyOnTargetEffects} if the move does not hit a substitute * - Triggering form changes and emergency exit / wimp out if this is the last hit * - * @param target the {@linkcode Pokemon} hit by this phase's move. - * @param effectiveness the effectiveness of the move (as previously evaluated in {@linkcode hitCheck}) + * @param target - the {@linkcode Pokemon} hit by this phase's move. + * @param effectiveness - The effectiveness of the move (as previously evaluated in {@linkcode hitCheck}) + * @param firstTarget - Whether this is the first target successfully struck by the move */ - protected applyMoveEffects(target: Pokemon, effectiveness: TypeDamageMultiplier): void { + protected applyMoveEffects(target: Pokemon, effectiveness: TypeDamageMultiplier, firstTarget: boolean): void { const user = this.getUserPokemon(); - - /** The first target hit by the move */ - const firstTarget = target === this.getTargets().find((_, i) => this.hitChecks[i][1] > 0); - if (isNullOrUndefined(user)) { return; } @@ -905,6 +904,14 @@ export class MoveEffectPhase extends PokemonPhase { target.destroySubstitute(); target.lapseTag(BattlerTagType.COMMANDED); + + // Force `lastHit` to be true if this is a multi hit move with hits left + // `hitsLeft` must be left as-is in order for the message displaying the number of hits + // to display the proper number. + // Note: When Dragon Darts' smart targeting is implemented, this logic may need to be adjusted. + if (!this.lastHit && user.turnData.hitsLeft > 1) { + this.lastHit = true; + } } /** diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 51e488210be..0c5e0b349ed 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -1110,7 +1110,7 @@ export class GameData { for (const p of sessionData.party) { const pokemon = p.toPokemon() as PlayerPokemon; pokemon.setVisible(false); - loadPokemonAssets.push(pokemon.loadAssets()); + loadPokemonAssets.push(pokemon.loadAssets(false)); party.push(pokemon); } diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index 8d4fd7c05df..00169678ed0 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -188,7 +188,7 @@ export default class PokemonData { // when loading from saved session, recover summonData.speciesFrom and form index species object // used to stay transformed on reload session if (this.summonData.speciesForm) { - this.summonData.speciesForm = getPokemonSpeciesForm( + ret.summonData.speciesForm = getPokemonSpeciesForm( this.summonData.speciesForm.speciesId, this.summonDataSpeciesFormIndex, );