Hide substitute sprite during catch attempts

This commit is contained in:
innerthunder 2024-09-03 03:06:18 -07:00
parent 21e61054b7
commit 7d25580b95

View File

@ -1,20 +1,21 @@
import BattleScene from "#app/battle-scene.js"; import BattleScene from "#app/battle-scene";
import { BattlerIndex } from "#app/battle.js"; import { BattlerIndex } from "#app/battle";
import { getPokeballCatchMultiplier, getPokeballAtlasKey, getPokeballTintColor, doPokeballBounceAnim } from "#app/data/pokeball.js"; import { getPokeballCatchMultiplier, getPokeballAtlasKey, getPokeballTintColor, doPokeballBounceAnim } from "#app/data/pokeball";
import { getStatusEffectCatchRateMultiplier } from "#app/data/status-effect.js"; import { getStatusEffectCatchRateMultiplier } from "#app/data/status-effect";
import { PokeballType } from "#app/enums/pokeball.js"; import { PokeballType } from "#app/enums/pokeball";
import { StatusEffect } from "#app/enums/status-effect.js"; import { StatusEffect } from "#app/enums/status-effect";
import { addPokeballOpenParticles, addPokeballCaptureStars } from "#app/field/anims.js"; import { addPokeballOpenParticles, addPokeballCaptureStars } from "#app/field/anims";
import { EnemyPokemon } from "#app/field/pokemon.js"; import { EnemyPokemon } from "#app/field/pokemon";
import { getPokemonNameWithAffix } from "#app/messages.js"; import { getPokemonNameWithAffix } from "#app/messages";
import { PokemonHeldItemModifier } from "#app/modifier/modifier.js"; import { PokemonHeldItemModifier } from "#app/modifier/modifier";
import { achvs } from "#app/system/achv.js"; import { achvs } from "#app/system/achv";
import { PartyUiMode, PartyOption } from "#app/ui/party-ui-handler.js"; import { PartyUiMode, PartyOption } from "#app/ui/party-ui-handler";
import { SummaryUiMode } from "#app/ui/summary-ui-handler.js"; import { SummaryUiMode } from "#app/ui/summary-ui-handler";
import { Mode } from "#app/ui/ui.js"; import { Mode } from "#app/ui/ui";
import i18next from "i18next"; import i18next from "i18next";
import { PokemonPhase } from "./pokemon-phase"; import { PokemonPhase } from "./pokemon-phase";
import { VictoryPhase } from "./victory-phase"; import { VictoryPhase } from "./victory-phase";
import { SubstituteTag } from "#app/data/battler-tags";
export class AttemptCapturePhase extends PokemonPhase { export class AttemptCapturePhase extends PokemonPhase {
private pokeballType: PokeballType; private pokeballType: PokeballType;
@ -36,6 +37,11 @@ export class AttemptCapturePhase extends PokemonPhase {
return this.end(); return this.end();
} }
const substitute = pokemon.getTag(SubstituteTag);
if (substitute) {
substitute.sprite.setVisible(false);
}
this.scene.pokeballCounts[this.pokeballType]--; this.scene.pokeballCounts[this.pokeballType]--;
this.originalY = pokemon.y; this.originalY = pokemon.y;
@ -165,6 +171,11 @@ export class AttemptCapturePhase extends PokemonPhase {
pokemon.setVisible(true); pokemon.setVisible(true);
pokemon.untint(250, "Sine.easeOut"); pokemon.untint(250, "Sine.easeOut");
const substitute = pokemon.getTag(SubstituteTag);
if (substitute) {
substitute.sprite.setVisible(true);
}
const pokeballAtlasKey = getPokeballAtlasKey(this.pokeballType); const pokeballAtlasKey = getPokeballAtlasKey(this.pokeballType);
this.pokeball.setTexture("pb", `${pokeballAtlasKey}_opening`); this.pokeball.setTexture("pb", `${pokeballAtlasKey}_opening`);
this.scene.time.delayedCall(17, () => this.pokeball.setTexture("pb", `${pokeballAtlasKey}_open`)); this.scene.time.delayedCall(17, () => this.pokeball.setTexture("pb", `${pokeballAtlasKey}_open`));