'Breeders in Space' cheevo unlocks for normal and expert breeders
This commit is contained in:
parent
33d8db73ef
commit
15824cbe73
|
@ -3008,7 +3008,8 @@ export default class BattleScene extends SceneBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
validateAchv(achv: Achv, args?: unknown[]): boolean {
|
validateAchv(achv: Achv, args?: unknown[]): boolean {
|
||||||
if (!this.gameData.achvUnlocks.hasOwnProperty(achv.id) && achv.validate(this, args)) {
|
if ((!this.gameData.achvUnlocks.hasOwnProperty(achv.id) || Overrides.ACHIEVEMENTS_REUNLOCK_OVERRIDE)
|
||||||
|
&& achv.validate(this, args)) {
|
||||||
this.gameData.achvUnlocks[achv.id] = new Date().getTime();
|
this.gameData.achvUnlocks[achv.id] = new Date().getTime();
|
||||||
this.ui.achvBar.showAchv(achv);
|
this.ui.achvBar.showAchv(achv);
|
||||||
if (vouchers.hasOwnProperty(achv.id)) {
|
if (vouchers.hasOwnProperty(achv.id)) {
|
||||||
|
|
|
@ -21,7 +21,6 @@ import { EggSourceType } from "#enums/egg-source-types";
|
||||||
import { EggTier } from "#enums/egg-type";
|
import { EggTier } from "#enums/egg-type";
|
||||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { achvs } from "#app/system/achv";
|
|
||||||
import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||||
import { Type } from "#enums/type";
|
import { Type } from "#enums/type";
|
||||||
import { getPokeballTintColor } from "#app/data/pokeball";
|
import { getPokeballTintColor } from "#app/data/pokeball";
|
||||||
|
@ -520,12 +519,6 @@ function removePokemonFromPartyAndStoreHeldItems(scene: BattleScene, encounter:
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAchievement(scene: BattleScene) {
|
|
||||||
if (scene.arena.biomeType === Biome.SPACE) {
|
|
||||||
scene.validateAchv(achvs.BREEDERS_IN_SPACE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function restorePartyAndHeldItems(scene: BattleScene) {
|
function restorePartyAndHeldItems(scene: BattleScene) {
|
||||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||||
// Restore original party
|
// Restore original party
|
||||||
|
@ -617,8 +610,6 @@ function onGameOver(scene: BattleScene) {
|
||||||
function doPostEncounterCleanup(scene: BattleScene) {
|
function doPostEncounterCleanup(scene: BattleScene) {
|
||||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||||
if (!encounter.misc.encounterFailed) {
|
if (!encounter.misc.encounterFailed) {
|
||||||
// Give achievement if in Space biome
|
|
||||||
checkAchievement(scene);
|
|
||||||
// Give 20 friendship to the chosen pokemon
|
// Give 20 friendship to the chosen pokemon
|
||||||
encounter.misc.chosenPokemon.addFriendship(FRIENDSHIP_ADDED);
|
encounter.misc.chosenPokemon.addFriendship(FRIENDSHIP_ADDED);
|
||||||
restorePartyAndHeldItems(scene);
|
restorePartyAndHeldItems(scene);
|
||||||
|
|
|
@ -86,6 +86,8 @@ class DefaultOverrides {
|
||||||
readonly ITEM_UNLOCK_OVERRIDE: Unlockables[] = [];
|
readonly ITEM_UNLOCK_OVERRIDE: Unlockables[] = [];
|
||||||
/** Set to `true` to show all tutorials */
|
/** Set to `true` to show all tutorials */
|
||||||
readonly BYPASS_TUTORIAL_SKIP_OVERRIDE: boolean = false;
|
readonly BYPASS_TUTORIAL_SKIP_OVERRIDE: boolean = false;
|
||||||
|
/** Set to `true` to be able to re-earn already unlocked achievements */
|
||||||
|
readonly ACHIEVEMENTS_REUNLOCK_OVERRIDE: boolean = false;
|
||||||
/** Set to `true` to force Paralysis and Freeze to always activate, or `false` to force them to not activate */
|
/** Set to `true` to force Paralysis and Freeze to always activate, or `false` to force them to not activate */
|
||||||
readonly STATUS_ACTIVATION_OVERRIDE: boolean | null = null;
|
readonly STATUS_ACTIVATION_OVERRIDE: boolean | null = null;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ import { BattlePhase } from "./battle-phase";
|
||||||
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
||||||
import { MoneyRewardPhase } from "./money-reward-phase";
|
import { MoneyRewardPhase } from "./money-reward-phase";
|
||||||
import { TrainerSlot } from "#app/data/trainer-config";
|
import { TrainerSlot } from "#app/data/trainer-config";
|
||||||
|
import { Biome } from "#app/enums/biome";
|
||||||
|
import { achvs } from "#app/system/achv";
|
||||||
|
|
||||||
export class TrainerVictoryPhase extends BattlePhase {
|
export class TrainerVictoryPhase extends BattlePhase {
|
||||||
constructor(scene: BattleScene) {
|
constructor(scene: BattleScene) {
|
||||||
|
@ -34,11 +36,17 @@ export class TrainerVictoryPhase extends BattlePhase {
|
||||||
}
|
}
|
||||||
|
|
||||||
const trainerType = this.scene.currentBattle.trainer?.config.trainerType!; // TODO: is this bang correct?
|
const trainerType = this.scene.currentBattle.trainer?.config.trainerType!; // TODO: is this bang correct?
|
||||||
|
// Validate Voucher for boss trainers
|
||||||
if (vouchers.hasOwnProperty(TrainerType[trainerType])) {
|
if (vouchers.hasOwnProperty(TrainerType[trainerType])) {
|
||||||
if (!this.scene.validateVoucher(vouchers[TrainerType[trainerType]]) && this.scene.currentBattle.trainer?.config.isBoss) {
|
if (!this.scene.validateVoucher(vouchers[TrainerType[trainerType]]) && this.scene.currentBattle.trainer?.config.isBoss) {
|
||||||
this.scene.unshiftPhase(new ModifierRewardPhase(this.scene, [ modifierTypes.VOUCHER, modifierTypes.VOUCHER, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM ][vouchers[TrainerType[trainerType]].voucherType]));
|
this.scene.unshiftPhase(new ModifierRewardPhase(this.scene, [ modifierTypes.VOUCHER, modifierTypes.VOUCHER, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM ][vouchers[TrainerType[trainerType]].voucherType]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Breeders in Space achievement
|
||||||
|
if (this.scene.arena.biomeType === Biome.SPACE
|
||||||
|
&& (trainerType === TrainerType.BREEDER || trainerType === TrainerType.EXPERT_POKEMON_BREEDER)) {
|
||||||
|
this.scene.validateAchv(achvs.BREEDERS_IN_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
this.scene.ui.showText(i18next.t("battle:trainerDefeated", { trainerName: this.scene.currentBattle.trainer?.getName(TrainerSlot.NONE, true) }), null, () => {
|
this.scene.ui.showText(i18next.t("battle:trainerDefeated", { trainerName: this.scene.currentBattle.trainer?.getName(TrainerSlot.NONE, true) }), null, () => {
|
||||||
const victoryMessages = this.scene.currentBattle.trainer?.getVictoryMessages()!; // TODO: is this bang correct?
|
const victoryMessages = this.scene.currentBattle.trainer?.getVictoryMessages()!; // TODO: is this bang correct?
|
||||||
|
|
Loading…
Reference in New Issue