mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 16:26:25 +00:00
Initially lock Mini Black Hole item
This commit is contained in:
parent
16fbe971f6
commit
842ea5af40
@ -4,6 +4,7 @@
|
|||||||
"module": "ES2020",
|
"module": "ES2020",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true,
|
||||||
|
"strictNullChecks": false
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,6 +26,7 @@ import { Weather, WeatherType, getRandomWeatherType, getWeatherDamageMessage, ge
|
|||||||
import { TempBattleStat } from "./data/temp-battle-stat";
|
import { TempBattleStat } from "./data/temp-battle-stat";
|
||||||
import { ArenaTrapTag, TrickRoomTag } from "./data/arena-tag";
|
import { ArenaTrapTag, TrickRoomTag } from "./data/arena-tag";
|
||||||
import { PostWeatherLapseAbAttr, PreWeatherDamageAbAttr, ProtectStatAttr, SuppressWeatherEffectAbAttr, applyPostWeatherLapseAbAttrs, applyPreStatChangeAbAttrs, applyPreWeatherEffectAbAttrs } from "./data/ability";
|
import { PostWeatherLapseAbAttr, PreWeatherDamageAbAttr, ProtectStatAttr, SuppressWeatherEffectAbAttr, applyPostWeatherLapseAbAttrs, applyPreStatChangeAbAttrs, applyPreWeatherEffectAbAttrs } from "./data/ability";
|
||||||
|
import { Unlockables, getUnlockableName } from "./system/unlockables";
|
||||||
|
|
||||||
export class CheckLoadPhase extends BattlePhase {
|
export class CheckLoadPhase extends BattlePhase {
|
||||||
private loaded: boolean;
|
private loaded: boolean;
|
||||||
@ -1602,6 +1603,39 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end(): void {
|
||||||
|
if (!this.scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE])
|
||||||
|
this.scene.unshiftPhase(new UnlockPhase(this.scene, Unlockables.MINI_BLACK_HOLE));
|
||||||
|
|
||||||
|
super.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UnlockPhase extends BattlePhase {
|
||||||
|
private unlockable: Unlockables;
|
||||||
|
|
||||||
|
constructor(scene: BattleScene, unlockable: Unlockables) {
|
||||||
|
super(scene);
|
||||||
|
|
||||||
|
this.unlockable = unlockable;
|
||||||
|
}
|
||||||
|
|
||||||
|
start(): void {
|
||||||
|
this.scene.time.delayedCall(2000, () => {
|
||||||
|
this.scene.gameData.unlocks[this.unlockable] = true;
|
||||||
|
this.scene.gameData.saveSystem();
|
||||||
|
this.scene.sound.play('level_up_fanfare');
|
||||||
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
|
this.scene.arenaBg.setVisible(false);
|
||||||
|
this.scene.ui.fadeIn(250).then(() => {
|
||||||
|
this.scene.ui.showText(`${getUnlockableName(this.unlockable)}\nhas been unlocked.`, null, () => {
|
||||||
|
this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true));
|
||||||
|
this.end();
|
||||||
|
}, null, true, 1500);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SwitchPhase extends BattlePhase {
|
export class SwitchPhase extends BattlePhase {
|
||||||
|
@ -17,7 +17,7 @@ const expLevels = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export function getLevelTotalExp(level: integer, growthRate: integer) {
|
export function getLevelTotalExp(level: integer, growthRate: integer) {
|
||||||
return expLevels[growthRate][Math.min(level, 100) - 1];
|
return expLevels[growthRate][level - 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getLevelRelExp(level: integer, growthRate: integer) {
|
export function getLevelRelExp(level: integer, growthRate: integer) {
|
||||||
|
@ -168,7 +168,7 @@ export class EvolutionPhase extends BattlePhase {
|
|||||||
this.scene.time.delayedCall(1250, () => {
|
this.scene.time.delayedCall(1250, () => {
|
||||||
this.scene.sound.play('evolution_fanfare');
|
this.scene.sound.play('evolution_fanfare');
|
||||||
this.scene.ui.showText(`Congratulations! Your ${preName}\nevolved into ${pokemon.name}!`, null, () => this.end(), null, true, 3000);
|
this.scene.ui.showText(`Congratulations! Your ${preName}\nevolved into ${pokemon.name}!`, null, () => this.end(), null, true, 3000);
|
||||||
this.scene.time.delayedCall(4250, () => this.scene.playBgm());
|
this.scene.time.delayedCall(new Utils.FixedInt(4250) as unknown as integer, () => this.scene.playBgm());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import PartyUiHandler, { PokemonMoveSelectFilter, PokemonSelectFilter } from '..
|
|||||||
import * as Utils from '../utils';
|
import * as Utils from '../utils';
|
||||||
import { TempBattleStat, getTempBattleStatBoosterItemName, getTempBattleStatName } from '../data/temp-battle-stat';
|
import { TempBattleStat, getTempBattleStatBoosterItemName, getTempBattleStatName } from '../data/temp-battle-stat';
|
||||||
import { BerryType, getBerryEffectDescription, getBerryName } from '../data/berry';
|
import { BerryType, getBerryEffectDescription, getBerryName } from '../data/berry';
|
||||||
|
import { Unlockables } from '../system/unlockables';
|
||||||
|
|
||||||
type Modifier = Modifiers.Modifier;
|
type Modifier = Modifiers.Modifier;
|
||||||
|
|
||||||
@ -702,7 +703,7 @@ const modifierPool = {
|
|||||||
[ModifierTier.MASTER]: [
|
[ModifierTier.MASTER]: [
|
||||||
new WeightedModifierType(modifierTypes.MASTER_BALL, 3),
|
new WeightedModifierType(modifierTypes.MASTER_BALL, 3),
|
||||||
new WeightedModifierType(modifierTypes.SHINY_CHARM, 2),
|
new WeightedModifierType(modifierTypes.SHINY_CHARM, 2),
|
||||||
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, 1)
|
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE] ? 1 : 0)
|
||||||
].map(m => { m.setTier(ModifierTier.MASTER); return m; }),
|
].map(m => { m.setTier(ModifierTier.MASTER); return m; }),
|
||||||
[ModifierTier.LUXURY]: [
|
[ModifierTier.LUXURY]: [
|
||||||
new WeightedModifierType(modifierTypes.GOLDEN_EXP_CHARM, (party: Pokemon[]) => party.filter(p => p.level < 100).length ? 1 : 0),
|
new WeightedModifierType(modifierTypes.GOLDEN_EXP_CHARM, (party: Pokemon[]) => party.filter(p => p.level < 100).length ? 1 : 0),
|
||||||
|
@ -1010,10 +1010,12 @@ export class HeldItemTransferModifier extends PokemonHeldItemModifier {
|
|||||||
apply(args: any[]): boolean {
|
apply(args: any[]): boolean {
|
||||||
const pokemon = args[0] as Pokemon;
|
const pokemon = args[0] as Pokemon;
|
||||||
const targetPokemon = pokemon.isPlayer() ? pokemon.scene.getEnemyPokemon() : pokemon.scene.getPlayerPokemon();
|
const targetPokemon = pokemon.isPlayer() ? pokemon.scene.getEnemyPokemon() : pokemon.scene.getPlayerPokemon();
|
||||||
|
if (!targetPokemon)
|
||||||
|
return false;
|
||||||
|
|
||||||
const transferredModifierTypes: ModifierTypes.ModifierType[] = [];
|
const transferredModifierTypes: ModifierTypes.ModifierType[] = [];
|
||||||
const itemModifiers = pokemon.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
const itemModifiers = pokemon.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||||
&& (m as PokemonHeldItemModifier).pokemonId === targetPokemon.id, targetPokemon.isPlayer()) as PokemonHeldItemModifier[];
|
&& (m as PokemonHeldItemModifier).pokemonId === targetPokemon.id && !m.matchType(this), targetPokemon.isPlayer()) as PokemonHeldItemModifier[];
|
||||||
|
|
||||||
for (let i = 0; i < this.getStackCount(); i++) {
|
for (let i = 0; i < this.getStackCount(); i++) {
|
||||||
if (!itemModifiers.length)
|
if (!itemModifiers.length)
|
||||||
|
@ -402,6 +402,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
console.log(this.species.speciesId, 'ERROR')
|
console.log(this.species.speciesId, 'ERROR')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let m = 0; m < allLevelMoves.length; m++) {
|
for (let m = 0; m < allLevelMoves.length; m++) {
|
||||||
const levelMove = allLevelMoves[m];
|
const levelMove = allLevelMoves[m];
|
||||||
if (this.level < levelMove[0])
|
if (this.level < levelMove[0])
|
||||||
@ -974,6 +975,22 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
this.aiType = AiType.SMART_RANDOM;
|
this.aiType = AiType.SMART_RANDOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateAndPopulateMoveset(): void {
|
||||||
|
switch (true) {
|
||||||
|
case (this.species.speciesId === Species.ETERNATUS):
|
||||||
|
this.moveset = [
|
||||||
|
new PokemonMove(Moves.DYNAMAX_CANNON),
|
||||||
|
new PokemonMove(Moves.CROSS_POISON),
|
||||||
|
new PokemonMove(Moves.DRAGON_DANCE),
|
||||||
|
new PokemonMove(Moves.RECOVER)
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
super.generateAndPopulateMoveset();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getNextMove(): PokemonMove {
|
getNextMove(): PokemonMove {
|
||||||
const queuedMove = this.getMoveQueue().length
|
const queuedMove = this.getMoveQueue().length
|
||||||
? this.moveset.find(m => m.moveId === this.getMoveQueue()[0].move)
|
? this.moveset.find(m => m.moveId === this.getMoveQueue()[0].move)
|
||||||
@ -1116,7 +1133,7 @@ export enum AiType {
|
|||||||
RANDOM,
|
RANDOM,
|
||||||
SMART_RANDOM,
|
SMART_RANDOM,
|
||||||
SMART
|
SMART
|
||||||
};
|
}
|
||||||
|
|
||||||
export enum MoveResult {
|
export enum MoveResult {
|
||||||
EFFECTIVE = 1,
|
EFFECTIVE = 1,
|
||||||
@ -1127,7 +1144,7 @@ export enum MoveResult {
|
|||||||
FAILED,
|
FAILED,
|
||||||
MISSED,
|
MISSED,
|
||||||
OTHER
|
OTHER
|
||||||
};
|
}
|
||||||
|
|
||||||
export type DamageResult = MoveResult.EFFECTIVE | MoveResult.SUPER_EFFECTIVE | MoveResult.NOT_VERY_EFFECTIVE | MoveResult.OTHER;
|
export type DamageResult = MoveResult.EFFECTIVE | MoveResult.SUPER_EFFECTIVE | MoveResult.NOT_VERY_EFFECTIVE | MoveResult.OTHER;
|
||||||
|
|
||||||
|
@ -6,17 +6,16 @@ import PokemonSpecies, { allSpecies, getPokemonSpecies } from "../data/pokemon-s
|
|||||||
import { Species } from "../data/species";
|
import { Species } from "../data/species";
|
||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
import PokemonData from "./pokemon-data";
|
import PokemonData from "./pokemon-data";
|
||||||
import { Weather } from "../data/weather";
|
|
||||||
import PersistentModifierData from "./modifier-data";
|
import PersistentModifierData from "./modifier-data";
|
||||||
import { Biome } from "../data/biome";
|
|
||||||
import { PokemonHeldItemModifier } from "../modifier/modifier";
|
import { PokemonHeldItemModifier } from "../modifier/modifier";
|
||||||
import { ArenaTag } from "../data/arena-tag";
|
|
||||||
import ArenaData from "./arena-data";
|
import ArenaData from "./arena-data";
|
||||||
|
import { Unlockables } from "./unlockables";
|
||||||
|
|
||||||
interface SystemSaveData {
|
interface SystemSaveData {
|
||||||
trainerId: integer;
|
trainerId: integer;
|
||||||
secretId: integer;
|
secretId: integer;
|
||||||
dexData: DexData;
|
dexData: DexData;
|
||||||
|
unlocks: Unlocks;
|
||||||
timestamp: integer;
|
timestamp: integer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +30,10 @@ interface SessionSaveData {
|
|||||||
timestamp: integer;
|
timestamp: integer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Unlocks {
|
||||||
|
[key: integer]: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface DexData {
|
export interface DexData {
|
||||||
[key: integer]: DexData | DexEntry
|
[key: integer]: DexData | DexEntry
|
||||||
}
|
}
|
||||||
@ -65,15 +68,20 @@ export class GameData {
|
|||||||
|
|
||||||
public dexData: DexData;
|
public dexData: DexData;
|
||||||
|
|
||||||
|
public unlocks: Unlocks;
|
||||||
|
|
||||||
constructor(scene: BattleScene) {
|
constructor(scene: BattleScene) {
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
this.trainerId = Utils.randInt(65536);
|
this.trainerId = Utils.randInt(65536);
|
||||||
this.secretId = Utils.randInt(65536);
|
this.secretId = Utils.randInt(65536);
|
||||||
|
this.unlocks = {
|
||||||
|
[Unlockables.MINI_BLACK_HOLE]: false
|
||||||
|
};
|
||||||
this.initDexData();
|
this.initDexData();
|
||||||
this.loadSystem();
|
this.loadSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
private saveSystem(): boolean {
|
public saveSystem(): boolean {
|
||||||
if (this.scene.quickStart)
|
if (this.scene.quickStart)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -81,6 +89,7 @@ export class GameData {
|
|||||||
trainerId: this.trainerId,
|
trainerId: this.trainerId,
|
||||||
secretId: this.secretId,
|
secretId: this.secretId,
|
||||||
dexData: this.dexData,
|
dexData: this.dexData,
|
||||||
|
unlocks: this.unlocks,
|
||||||
timestamp: new Date().getTime()
|
timestamp: new Date().getTime()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -99,6 +108,13 @@ export class GameData {
|
|||||||
this.trainerId = data.trainerId;
|
this.trainerId = data.trainerId;
|
||||||
this.secretId = data.secretId;
|
this.secretId = data.secretId;
|
||||||
|
|
||||||
|
if (data.unlocks) {
|
||||||
|
for (let key of Object.keys(data.unlocks)) {
|
||||||
|
if (this.unlocks.hasOwnProperty(key))
|
||||||
|
this.unlocks[key] = data.unlocks[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data.timestamp === undefined)
|
if (data.timestamp === undefined)
|
||||||
this.convertDexData(data.dexData);
|
this.convertDexData(data.dexData);
|
||||||
|
|
||||||
|
10
src/system/unlockables.ts
Normal file
10
src/system/unlockables.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export enum Unlockables {
|
||||||
|
MINI_BLACK_HOLE
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUnlockableName(unlockable: Unlockables) {
|
||||||
|
switch (unlockable) {
|
||||||
|
case Unlockables.MINI_BLACK_HOLE:
|
||||||
|
return 'MINI BLACK HOLE';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user