[Bug] Some fresh start fixes (#3420)

* Fix some fresh start bugs

* Forgot a !

* Add fresh start check on eviolite too

* Remove part about cost being 3

* Update src/game-mode.ts

Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>

* Rename isFreshStart helper function

---------

Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
This commit is contained in:
Tempoanon 2024-08-12 01:34:53 -04:00 committed by GitHub
parent c078e5d612
commit 63b5195b14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 5 deletions

View File

@ -630,8 +630,8 @@ export class FreshStartChallenge extends Challenge {
}
applyStarterCost(species: Species, cost: Utils.NumberHolder): boolean {
if (defaultStarterSpecies.includes(species) && cost.value !== 3) {
cost.value = 3;
if (defaultStarterSpecies.includes(species)) {
cost.value = speciesStarters[species];
return true;
}
return false;

View File

@ -8,6 +8,7 @@ import Overrides from "#app/overrides";
import * as Utils from "./utils";
import { Biome } from "#enums/biome";
import { Species } from "#enums/species";
import { Challenges } from "./enums/challenges";
export enum GameModes {
CLASSIC,
@ -55,6 +56,23 @@ export class GameMode implements GameModeConfig {
this.battleConfig = battleConfig || {};
}
/**
* Helper function to see if a GameMode has a specific challenge type
* @param challenge the Challenges it looks for
* @returns true if the game mode has that challenge
*/
hasChallenge(challenge: Challenges): boolean {
return this.challenges.some(c => c.id === challenge);
}
/**
* Helper function to see if the game mode is using fresh start
* @returns true if a fresh start challenge is being applied
*/
isFreshStartChallenge(): boolean {
return this.hasChallenge(Challenges.FRESH_START);
}
/**
* @returns either:
* - override from overrides.ts

View File

@ -1545,7 +1545,7 @@ const modifierPool: ModifierPool = {
new WeightedModifierType(modifierTypes.RARE_EVOLUTION_ITEM, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 15) * 4, 32), 32),
new WeightedModifierType(modifierTypes.AMULET_COIN, skipInLastClassicWaveOrDefault(3)),
new WeightedModifierType(modifierTypes.EVIOLITE, (party: Pokemon[]) => {
if (party[0].scene.gameData.unlocks[Unlockables.EVIOLITE]) {
if (!party[0].scene.gameMode.isFreshStartChallenge() && party[0].scene.gameData.unlocks[Unlockables.EVIOLITE]) {
return party.some(p => ((p.getSpeciesForm(true).speciesId in pokemonEvolutions) || (p.isFusion() && (p.getFusionSpeciesForm(true).speciesId in pokemonEvolutions))) && !p.getHeldItems().some(i => i instanceof Modifiers.EvolutionStatBoosterModifier)) ? 10 : 0;
}
return 0;
@ -1623,7 +1623,7 @@ const modifierPool: ModifierPool = {
new WeightedModifierType(modifierTypes.MULTI_LENS, 18),
new WeightedModifierType(modifierTypes.VOUCHER_PREMIUM, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily && !party[0].scene.gameMode.isEndless && !party[0].scene.gameMode.isSplicedOnly ? Math.max(5 - rerollCount * 2, 0) : 0, 5),
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => !party[0].scene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24),
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE] ? 1 : 0, 1),
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => (!party[0].scene.gameMode.isFreshStartChallenge() && party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE]) ? 1 : 0, 1),
].map(m => {
m.setTier(ModifierTier.MASTER); return m;
})

View File

@ -2031,7 +2031,7 @@ export class CommandPhase extends FieldPhase {
}
break;
case Command.BALL:
if (this.scene.arena.biomeType === Biome.END && (!this.scene.gameMode.isClassic || (this.scene.getEnemyField().filter(p => p.isActive(true)).some(p => !p.scene.gameData.dexData[p.species.speciesId].caughtAttr) && this.scene.gameData.getStarterCount(d => !!d.caughtAttr) < Object.keys(speciesStarters).length - 1))) {
if (!this.scene.gameMode.isFreshStartChallenge() && this.scene.arena.biomeType === Biome.END && (!this.scene.gameMode.isClassic || (this.scene.getEnemyField().filter(p => p.isActive(true)).some(p => !p.scene.gameData.dexData[p.species.speciesId].caughtAttr) && this.scene.gameData.getStarterCount(d => !!d.caughtAttr) < Object.keys(speciesStarters).length - 1))) {
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
this.scene.ui.setMode(Mode.MESSAGE);
this.scene.ui.showText(i18next.t("battle:noPokeballForce"), null, () => {