mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-19 14:52:19 +02:00
Merge pull request #8 from emdeann/inverse-daily
Add inverse challenge to daily run for event
This commit is contained in:
commit
cacd025e3e
@ -68,6 +68,19 @@ export class GameMode implements GameModeConfig {
|
|||||||
this.battleConfig = battleConfig || {};
|
this.battleConfig = battleConfig || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables challenges if they are disabled and sets the specified challenge's value
|
||||||
|
* @param challenge The challenge to set
|
||||||
|
* @param value The value to give the challenge. Impact depends on the specific challenge
|
||||||
|
*/
|
||||||
|
setChallengeValue(challenge: Challenges, value: number) {
|
||||||
|
if (!this.isChallenge) {
|
||||||
|
this.isChallenge = true;
|
||||||
|
this.challenges = allChallenges.map(c => copyChallenge(c));
|
||||||
|
}
|
||||||
|
this.challenges.filter((chal: Challenge) => chal.id === challenge).map((chal: Challenge) => (chal.value = value));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to see if a GameMode has a specific challenge type
|
* Helper function to see if a GameMode has a specific challenge type
|
||||||
* @param challenge the Challenges it looks for
|
* @param challenge the Challenges it looks for
|
||||||
|
@ -212,6 +212,8 @@ export class TitlePhase extends Phase {
|
|||||||
|
|
||||||
const generateDaily = (seed: string) => {
|
const generateDaily = (seed: string) => {
|
||||||
globalScene.gameMode = getGameMode(GameModes.DAILY);
|
globalScene.gameMode = getGameMode(GameModes.DAILY);
|
||||||
|
// Daily runs don't support all challenges yet (starter select restrictions aren't considered)
|
||||||
|
globalScene.eventManager.startEventChallenges();
|
||||||
|
|
||||||
globalScene.setSeed(seed);
|
globalScene.setSeed(seed);
|
||||||
globalScene.resetSeed(0);
|
globalScene.resetSeed(0);
|
||||||
|
@ -9,6 +9,7 @@ import { WeatherType } from "#enums/weather-type";
|
|||||||
import { CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER } from "./data/balance/starters";
|
import { CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER } from "./data/balance/starters";
|
||||||
import { MysteryEncounterType } from "./enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "./enums/mystery-encounter-type";
|
||||||
import { MysteryEncounterTier } from "./enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "./enums/mystery-encounter-tier";
|
||||||
|
import { Challenges } from "#enums/challenges";
|
||||||
|
|
||||||
export enum EventType {
|
export enum EventType {
|
||||||
SHINY,
|
SHINY,
|
||||||
@ -43,6 +44,11 @@ interface EventWaveReward {
|
|||||||
|
|
||||||
type EventMusicReplacement = [string, string];
|
type EventMusicReplacement = [string, string];
|
||||||
|
|
||||||
|
interface EventChallenge {
|
||||||
|
challenge: Challenges;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
interface TimedEvent extends EventBanner {
|
interface TimedEvent extends EventBanner {
|
||||||
name: string;
|
name: string;
|
||||||
eventType: EventType;
|
eventType: EventType;
|
||||||
@ -61,6 +67,7 @@ interface TimedEvent extends EventBanner {
|
|||||||
classicWaveRewards?: EventWaveReward[]; // Rival battle rewards
|
classicWaveRewards?: EventWaveReward[]; // Rival battle rewards
|
||||||
trainerShinyChance?: number; // Odds over 65536 of trainer mon generating as shiny
|
trainerShinyChance?: number; // Odds over 65536 of trainer mon generating as shiny
|
||||||
music?: EventMusicReplacement[];
|
music?: EventMusicReplacement[];
|
||||||
|
dailyRunChallenges?: EventChallenge[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const timedEvents: TimedEvent[] = [
|
const timedEvents: TimedEvent[] = [
|
||||||
@ -296,6 +303,12 @@ const timedEvents: TimedEvent[] = [
|
|||||||
["title", "title_afd"],
|
["title", "title_afd"],
|
||||||
["battle_rival_3", "battle_rival_3_afd"],
|
["battle_rival_3", "battle_rival_3_afd"],
|
||||||
],
|
],
|
||||||
|
dailyRunChallenges: [
|
||||||
|
{
|
||||||
|
challenge: Challenges.INVERSE_BATTLE,
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -510,6 +523,16 @@ export class TimedEventManager {
|
|||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activates any challenges on {@linkcode globalScene.gameMode} for the currently active event
|
||||||
|
*/
|
||||||
|
startEventChallenges(): void {
|
||||||
|
const challenges = this.activeEvent()?.dailyRunChallenges;
|
||||||
|
challenges?.forEach((eventChal: EventChallenge) =>
|
||||||
|
globalScene.gameMode.setChallengeValue(eventChal.challenge, eventChal.value),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TimedEventDisplay extends Phaser.GameObjects.Container {
|
export class TimedEventDisplay extends Phaser.GameObjects.Container {
|
||||||
|
Loading…
Reference in New Issue
Block a user