small bug fixes with latest sync from main

This commit is contained in:
ImperialSympathizer 2024-07-28 18:33:56 -04:00
parent 5f3dc8a747
commit aa76399894
8 changed files with 3951 additions and 3910 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -301,6 +301,7 @@ export const AbsoluteAvariceEncounter: IMysteryEncounter =
}
});
transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
leaveEncounterWithoutBattle(scene, true);
})
.build()
@ -331,6 +332,7 @@ export const AbsoluteAvariceEncounter: IMysteryEncounter =
greedent.moveset = [new PokemonMove(Moves.THRASH), new PokemonMove(Moves.BODY_PRESS), new PokemonMove(Moves.STUFF_CHEEKS), new PokemonMove(Moves.SLACK_OFF)];
greedent.passive = true;
transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
await catchPokemon(scene, greedent, null, PokeballType.POKEBALL, false);
leaveEncounterWithoutBattle(scene, true);
})

View File

@ -4,7 +4,7 @@ import BattleScene from "#app/battle-scene";
import IMysteryEncounter, { MysteryEncounterBuilder } from "../mystery-encounter";
import MysteryEncounterOption, { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
import { TrainerSlot } from "#app/data/trainer-config";
import { ScanIvsPhase, SummonPhase, VictoryPhase } from "#app/phases";
import { ScanIvsPhase, SummonPhase } from "#app/phases";
import { HiddenAbilityRateBoosterModifier, IvScannerModifier } from "#app/modifier/modifier";
import { EnemyPokemon } from "#app/field/pokemon";
import { PokeballType } from "#app/data/pokeball";
@ -136,7 +136,6 @@ const safariZoneGameOptions: MysteryEncounterOption[] = [
if (catchResult) {
// You caught pokemon
scene.unshiftPhase(new VictoryPhase(scene, 0));
// Check how many safari pokemon left
if (scene.currentBattle.mysteryEncounter.misc.safariPokemonRemaining > 0) {
await summonSafariPokemon(scene);

View File

@ -605,7 +605,13 @@ export function leaveEncounterWithoutBattle(scene: BattleScene, addHealPhase: bo
handleMysteryEncounterVictory(scene, addHealPhase);
}
export function handleMysteryEncounterVictory(scene: BattleScene, addHealPhase: boolean = false) {
/**
*
* @param scene
* @param addHealPhase - Adds an empty shop phase to allow player to purchase healing items
* @param doNotContinue - default `false`. If set to true, will not end the battle and continue to next wave
*/
export function handleMysteryEncounterVictory(scene: BattleScene, addHealPhase: boolean = false, doNotContinue: boolean = false) {
const allowedPkm = scene.getParty().filter((pkm) => pkm.isAllowedInBattle());
if (allowedPkm.length === 0) {
@ -616,7 +622,7 @@ export function handleMysteryEncounterVictory(scene: BattleScene, addHealPhase:
// If in repeated encounter variant, do nothing
// Variant must eventually be swapped in order to handle "true" end of the encounter
if (scene.currentBattle.mysteryEncounter.encounterMode === MysteryEncounterMode.CONTINUOUS_ENCOUNTER) {
if (scene.currentBattle.mysteryEncounter.encounterMode === MysteryEncounterMode.CONTINUOUS_ENCOUNTER || doNotContinue) {
return;
} else if (scene.currentBattle.mysteryEncounter.encounterMode === MysteryEncounterMode.NO_BATTLE) {
scene.pushPhase(new EggLapsePhase(scene));

View File

@ -437,8 +437,17 @@ function failCatch(scene: BattleScene, pokemon: EnemyPokemon, originalY: number,
});
}
/**
*
* @param scene
* @param pokemon
* @param pokeball
* @param pokeballType
* @param showCatchObtainMessage
* @param isObtain
*/
export async function catchPokemon(scene: BattleScene, pokemon: EnemyPokemon, pokeball: Phaser.GameObjects.Sprite, pokeballType: PokeballType, showCatchObtainMessage: boolean = true, isObtain: boolean = false): Promise<void> {
scene.unshiftPhase(new VictoryPhase(scene, BattlerIndex.ENEMY));
scene.unshiftPhase(new VictoryPhase(scene, BattlerIndex.ENEMY, true));
const speciesForm = !pokemon.fusionSpecies ? pokemon.getSpeciesForm() : pokemon.getFusionSpeciesForm();

View File

@ -10,7 +10,6 @@ import { VariantTier } from "#enums/variant-tiers";
import { WeatherType } from "#enums/weather-type";
import { type PokeballCounts } from "./battle-scene";
import { Gender } from "./data/gender";
import { allSpecies } from "./data/pokemon-species"; // eslint-disable-line @typescript-eslint/no-unused-vars
import { Variant } from "./data/variant";
import { type ModifierOverride, type ModifierTypeKeys } from "./modifier/modifier-type";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";

View File

@ -1787,9 +1787,9 @@ export class SwitchSummonPhase extends SummonPhase {
}
// TODO: maybe remove this? Not sure if still necessary
if (!pokemon.isActive() || !pokemon.isOnField()) {
this.switchAndSummon();
}
// if (!pokemon.isActive() || !pokemon.isOnField()) {
// this.switchAndSummon();
// }
this.scene.ui.showText(this.player ?
i18next.t("battle:playerComeBack", { pokemonName: getPokemonNameWithAffix(pokemon) }) :
@ -4081,8 +4081,13 @@ export class FaintPhase extends PokemonPhase {
}
export class VictoryPhase extends PokemonPhase {
constructor(scene: BattleScene, battlerIndex: BattlerIndex) {
/** If true, indicates that the phase is intended for EXP purposes only, and not to continue a battle to next phase */
isExpOnly: boolean;
constructor(scene: BattleScene, battlerIndex: BattlerIndex, isExpOnly: boolean = false) {
super(scene, battlerIndex);
this.isExpOnly = isExpOnly;
}
start() {
@ -4176,7 +4181,7 @@ export class VictoryPhase extends PokemonPhase {
}
if (this.scene.currentBattle.battleType === BattleType.MYSTERY_ENCOUNTER) {
handleMysteryEncounterVictory(this.scene);
handleMysteryEncounterVictory(this.scene, false, this.isExpOnly);
this.end();
return;
}