mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-29 18:59:28 +02:00
smeargle mode real
This commit is contained in:
parent
3ed2c74f38
commit
944b2a4516
@ -653,6 +653,8 @@ export default class BattleScene extends SceneBase {
|
||||
}
|
||||
});
|
||||
|
||||
console.log(this);
|
||||
|
||||
this.updateBiomeWaveText();
|
||||
this.updateMoneyText();
|
||||
this.updateScoreText();
|
||||
|
@ -772,6 +772,38 @@ export class LowerStarterPointsChallenge extends Challenge {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements a mono generation challenge.
|
||||
*/
|
||||
export class SmeargleChallenge extends Challenge {
|
||||
constructor() {
|
||||
super(Challenges.SMEARGLE, 1);
|
||||
}
|
||||
|
||||
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean {
|
||||
if (pokemon.speciesId !== Species.SMEARGLE) {
|
||||
valid.value = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
applyPokemonInBattle(pokemon: Pokemon, valid: Utils.BooleanHolder): boolean {
|
||||
if (pokemon.species.speciesId !== Species.SMEARGLE || pokemon.isFusion()) {
|
||||
valid.value = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static loadChallenge(source: SmeargleChallenge | any): SmeargleChallenge {
|
||||
const newChallenge = new SmeargleChallenge();
|
||||
newChallenge.value = source.value;
|
||||
newChallenge.severity = source.severity;
|
||||
return newChallenge;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply all challenges that modify starter choice.
|
||||
* @param gameMode {@link GameMode} The current gameMode
|
||||
@ -961,6 +993,8 @@ export function copyChallenge(source: Challenge | any): Challenge {
|
||||
return FreshStartChallenge.loadChallenge(source);
|
||||
case Challenges.INVERSE_BATTLE:
|
||||
return InverseBattleChallenge.loadChallenge(source);
|
||||
case Challenges.SMEARGLE:
|
||||
return SmeargleChallenge.loadChallenge(source);
|
||||
}
|
||||
throw new Error("Unknown challenge copied");
|
||||
}
|
||||
@ -973,5 +1007,6 @@ export function initChallenges() {
|
||||
new SingleTypeChallenge(),
|
||||
new FreshStartChallenge(),
|
||||
new InverseBattleChallenge(),
|
||||
new SmeargleChallenge()
|
||||
);
|
||||
}
|
||||
|
@ -5,4 +5,5 @@ export enum Challenges {
|
||||
LOWER_STARTER_POINTS,
|
||||
FRESH_START,
|
||||
INVERSE_BATTLE,
|
||||
SMEARGLE
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import BattleScene from "#app/battle-scene";
|
||||
import { BattleType } from "#app/battle";
|
||||
import { getDailyRunStarters, fetchDailyRunSeed } from "#app/data/daily-run";
|
||||
import { Gender } from "#app/data/gender";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { getBiomeKey } from "#app/field/arena";
|
||||
import { GameModes, GameMode, getGameMode } from "#app/game-mode";
|
||||
import { regenerateModifierPoolThresholds, ModifierPoolType, modifierTypes, getDailyRunStarterModifiers } from "#app/modifier/modifier-type";
|
||||
@ -21,7 +22,9 @@ import { EncounterPhase } from "./encounter-phase";
|
||||
import { SelectChallengePhase } from "./select-challenge-phase";
|
||||
import { SelectStarterPhase } from "./select-starter-phase";
|
||||
import { SummonPhase } from "./summon-phase";
|
||||
|
||||
import { Species } from "#app/enums/species";
|
||||
import { Moves } from "#app/enums/moves";
|
||||
import { Challenges } from "#app/enums/challenges";
|
||||
|
||||
export class TitlePhase extends Phase {
|
||||
private loaded: boolean;
|
||||
@ -149,6 +152,15 @@ export class TitlePhase extends Phase {
|
||||
},
|
||||
keepOpen: true
|
||||
},
|
||||
{
|
||||
label: "Smeargle",
|
||||
handler: () => {
|
||||
this.gameMode = GameModes.CHALLENGE;
|
||||
this.initSmeargle();
|
||||
return true;
|
||||
},
|
||||
keepOpen: true
|
||||
},
|
||||
{
|
||||
label: i18next.t("menu:settings"),
|
||||
handler: () => {
|
||||
@ -182,6 +194,51 @@ export class TitlePhase extends Phase {
|
||||
});
|
||||
}
|
||||
|
||||
initSmeargle(): void {
|
||||
this.scene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: integer) => {
|
||||
this.scene.clearPhaseQueue();
|
||||
if (slotId === -1) {
|
||||
this.scene.pushPhase(new TitlePhase(this.scene));
|
||||
return super.end();
|
||||
}
|
||||
this.scene.sessionSlotId = slotId;
|
||||
|
||||
|
||||
const generateSmeargles = () => {
|
||||
this.scene.money = 2500;
|
||||
const startingLevel = 5;
|
||||
|
||||
const party = this.scene.getParty();
|
||||
const loadPokemonAssets: Promise<void>[] = [];
|
||||
|
||||
for (let i = 0; i < 6; i++) {
|
||||
const smeargle = this.scene.addPlayerPokemon(getPokemonSpecies(Species.SMEARGLE), startingLevel);
|
||||
smeargle.setVisible(false);
|
||||
party.push(smeargle);
|
||||
loadPokemonAssets.push(smeargle.loadAssets());
|
||||
}
|
||||
|
||||
Promise.all(loadPokemonAssets).then(() => {
|
||||
this.scene.sessionPlayTime = 0;
|
||||
this.scene.lastSavePlayTime = 0;
|
||||
party.forEach((p, i) => {
|
||||
for (let m = 0; m < 4; m++) {
|
||||
if (i === 0 && m === 0) {
|
||||
p.setMove(m, Moves.TACKLE);
|
||||
} else {
|
||||
p.setMove(m, Moves.SKETCH);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.end(true);
|
||||
});
|
||||
};
|
||||
generateSmeargles();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
initDailyRun(): void {
|
||||
this.scene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: integer) => {
|
||||
this.scene.clearPhaseQueue();
|
||||
@ -257,12 +314,22 @@ export class TitlePhase extends Phase {
|
||||
});
|
||||
}
|
||||
|
||||
end(): void {
|
||||
end(smeargle = false): void {
|
||||
if (!this.loaded && !this.scene.gameMode.isDaily) {
|
||||
this.scene.arena.preloadBgm();
|
||||
this.scene.gameMode = getGameMode(this.gameMode);
|
||||
if (this.gameMode === GameModes.CHALLENGE) {
|
||||
if (this.gameMode === GameModes.CHALLENGE && !smeargle) {
|
||||
this.scene.pushPhase(new SelectChallengePhase(this.scene));
|
||||
} else if (this.gameMode === GameModes.CHALLENGE && smeargle) {
|
||||
this.scene.gameMode = getGameMode(GameModes.CHALLENGE);
|
||||
this.scene.gameMode.challenges.forEach(c => {
|
||||
if (c.id === Challenges.SMEARGLE) {
|
||||
c.value = 1;
|
||||
}
|
||||
});
|
||||
this.scene.newArena(this.scene.gameMode.getStartingBiome(this.scene));
|
||||
this.scene.newBattle();
|
||||
this.scene.arena.init();
|
||||
} else {
|
||||
this.scene.pushPhase(new SelectStarterPhase(this.scene));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user