mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 16:56:11 +00:00
Fix some bugs
This commit is contained in:
parent
2ac0a3645f
commit
032e26728b
@ -29,7 +29,7 @@ export class Arena {
|
|||||||
}
|
}
|
||||||
|
|
||||||
randomSpecies(waveIndex: integer, level: integer, attempt?: integer): PokemonSpecies {
|
randomSpecies(waveIndex: integer, level: integer, attempt?: integer): PokemonSpecies {
|
||||||
const isBoss = (waveIndex >= 100 || waveIndex % 10 === 0) && !!this.pokemonPool[BiomePoolTier.BOSS].length;
|
const isBoss = (level >= 100 || waveIndex % 10 === 0) && !!this.pokemonPool[BiomePoolTier.BOSS].length;
|
||||||
const tierValue = Utils.randInt(!isBoss ? 512 : 64);
|
const tierValue = Utils.randInt(!isBoss ? 512 : 64);
|
||||||
let tier = !isBoss
|
let tier = !isBoss
|
||||||
? tierValue >= 156 ? BiomePoolTier.COMMON : tierValue >= 32 ? BiomePoolTier.UNCOMMON : tierValue >= 6 ? BiomePoolTier.RARE : tierValue >= 1 ? BiomePoolTier.SUPER_RARE : BiomePoolTier.ULTRA_RARE
|
? tierValue >= 156 ? BiomePoolTier.COMMON : tierValue >= 32 ? BiomePoolTier.UNCOMMON : tierValue >= 6 ? BiomePoolTier.RARE : tierValue >= 1 ? BiomePoolTier.SUPER_RARE : BiomePoolTier.ULTRA_RARE
|
||||||
|
@ -42,7 +42,7 @@ export class SelectStarterPhase extends BattlePhase {
|
|||||||
const starterGender = starter.species.malePercent !== null
|
const starterGender = starter.species.malePercent !== null
|
||||||
? !starter.female ? Gender.MALE : Gender.FEMALE
|
? !starter.female ? Gender.MALE : Gender.FEMALE
|
||||||
: Gender.GENDERLESS;
|
: Gender.GENDERLESS;
|
||||||
const starterPokemon = new PlayerPokemon(this.scene, starter.species, startingLevel, starter.formIndex, starterGender, starter.shiny);
|
const starterPokemon = new PlayerPokemon(this.scene, starter.species, startingLevel, 0, starter.formIndex, starterGender, starter.shiny);
|
||||||
starterPokemon.setVisible(false);
|
starterPokemon.setVisible(false);
|
||||||
party.push(starterPokemon);
|
party.push(starterPokemon);
|
||||||
loadPokemonAssets.push(starterPokemon.loadAssets());
|
loadPokemonAssets.push(starterPokemon.loadAssets());
|
||||||
@ -1642,7 +1642,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
if (!this.skipAnim && this.getPokemon().getHpRatio() < 1)
|
if (!this.skipAnim && this.getPokemon().hp && this.getPokemon().getHpRatio() < 1)
|
||||||
super.start();
|
super.start();
|
||||||
else
|
else
|
||||||
this.end();
|
this.end();
|
||||||
@ -1651,6 +1651,11 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||||||
end() {
|
end() {
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
|
if (!this.getPokemon().hp) {
|
||||||
|
super.end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const fullHp = pokemon.getHpRatio() >= 1;
|
const fullHp = pokemon.getHpRatio() >= 1;
|
||||||
|
|
||||||
if (!fullHp) {
|
if (!fullHp) {
|
||||||
|
@ -334,7 +334,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||||||
if (this.quickStart) {
|
if (this.quickStart) {
|
||||||
for (let s = 0; s < 3; s++) {
|
for (let s = 0; s < 3; s++) {
|
||||||
const playerSpecies = getPokemonSpecies((getPokemonSpecies(s === 0 ? Species.TORCHIC : s === 1 ? Species.TREECKO : Species.MUDKIP)).getSpeciesForLevel(startingLevel, true));
|
const playerSpecies = getPokemonSpecies((getPokemonSpecies(s === 0 ? Species.TORCHIC : s === 1 ? Species.TREECKO : Species.MUDKIP)).getSpeciesForLevel(startingLevel, true));
|
||||||
const playerPokemon = new PlayerPokemon(this, playerSpecies, startingLevel, 0);
|
const playerPokemon = new PlayerPokemon(this, playerSpecies, startingLevel, 0, 0);
|
||||||
playerPokemon.setVisible(false);
|
playerPokemon.setVisible(false);
|
||||||
loadPokemonAssets.push(playerPokemon.loadAssets());
|
loadPokemonAssets.push(playerPokemon.loadAssets());
|
||||||
|
|
||||||
@ -744,7 +744,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const waveIndex = this.currentBattle.waveIndex;
|
const waveIndex = this.currentBattle.waveIndex;
|
||||||
const chances = Math.ceil(waveIndex / 10);
|
const chances = Math.ceil(waveIndex / 10);
|
||||||
const isBoss = waveIndex >= 100 || !(waveIndex % 10);
|
const isBoss = this.getEnemyPokemon().level >= 100 || !(waveIndex % 10);
|
||||||
let count = 0;
|
let count = 0;
|
||||||
for (let c = 0; c < chances; c++) {
|
for (let c = 0; c < chances; c++) {
|
||||||
if (!Utils.randInt(!isBoss ? 12 : 4))
|
if (!Utils.randInt(!isBoss ? 12 : 4))
|
||||||
|
@ -630,7 +630,7 @@ const enemyModifierPool = {
|
|||||||
new WeightedModifierType(modifierTypes.LUCKY_EGG, 2),
|
new WeightedModifierType(modifierTypes.LUCKY_EGG, 2),
|
||||||
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
|
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
|
||||||
[ModifierTier.MASTER]: [
|
[ModifierTier.MASTER]: [
|
||||||
modifierTypes.SHELL_BELL
|
new WeightedModifierType(modifierTypes.SHELL_BELL, 1)
|
||||||
].map(m => { m.setTier(ModifierTier.MASTER); return m; })
|
].map(m => { m.setTier(ModifierTier.MASTER); return m; })
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
public name: string;
|
public name: string;
|
||||||
public species: PokemonSpecies;
|
public species: PokemonSpecies;
|
||||||
public formIndex: integer;
|
public formIndex: integer;
|
||||||
|
public abilityIndex: integer;
|
||||||
public shiny: boolean;
|
public shiny: boolean;
|
||||||
public pokeball: PokeballType;
|
public pokeball: PokeballType;
|
||||||
protected battleInfo: BattleInfo;
|
protected battleInfo: BattleInfo;
|
||||||
@ -51,7 +52,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
private shinySparkle: Phaser.GameObjects.Sprite;
|
private shinySparkle: Phaser.GameObjects.Sprite;
|
||||||
|
|
||||||
constructor(scene: BattleScene, x: number, y: number, species: PokemonSpecies, level: integer, formIndex?: integer, gender?: Gender, shiny?: boolean, dataSource?: Pokemon) {
|
constructor(scene: BattleScene, x: number, y: number, species: PokemonSpecies, level: integer, abilityIndex?: integer, formIndex?: integer, gender?: Gender, shiny?: boolean, dataSource?: Pokemon) {
|
||||||
super(scene, x, y);
|
super(scene, x, y);
|
||||||
this.name = Utils.toPokemonUpperCase(species.name);
|
this.name = Utils.toPokemonUpperCase(species.name);
|
||||||
this.species = species;
|
this.species = species;
|
||||||
@ -60,6 +61,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
: new EnemyBattleInfo(scene);
|
: new EnemyBattleInfo(scene);
|
||||||
this.pokeball = dataSource?.pokeball || PokeballType.POKEBALL;
|
this.pokeball = dataSource?.pokeball || PokeballType.POKEBALL;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
|
this.abilityIndex = abilityIndex || (species.ability2 ? Utils.randInt(2) : 0);
|
||||||
this.formIndex = formIndex || 0;
|
this.formIndex = formIndex || 0;
|
||||||
if (gender !== undefined)
|
if (gender !== undefined)
|
||||||
this.gender = gender;
|
this.gender = gender;
|
||||||
@ -110,7 +112,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
if (this.shiny === undefined) {
|
if (this.shiny === undefined) {
|
||||||
let shinyThreshold = new Utils.IntegerHolder(32);
|
let shinyThreshold = new Utils.IntegerHolder(32);
|
||||||
this.scene.applyModifiers(ShinyRateBoosterModifier, this.isPlayer(), shinyThreshold);
|
this.scene.applyModifiers(ShinyRateBoosterModifier, true, shinyThreshold);
|
||||||
console.log(shinyThreshold.value);
|
console.log(shinyThreshold.value);
|
||||||
|
|
||||||
this.shiny = (E ^ F) < shinyThreshold.value;
|
this.shiny = (E ^ F) < shinyThreshold.value;
|
||||||
@ -829,8 +831,8 @@ export default interface Pokemon {
|
|||||||
export class PlayerPokemon extends Pokemon {
|
export class PlayerPokemon extends Pokemon {
|
||||||
public compatibleTms: Moves[];
|
public compatibleTms: Moves[];
|
||||||
|
|
||||||
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, formIndex: integer, gender?: Gender, shiny?: boolean, dataSource?: Pokemon) {
|
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, abilityIndex: integer, formIndex: integer, gender?: Gender, shiny?: boolean, dataSource?: Pokemon) {
|
||||||
super(scene, 106, 148, species, level, formIndex, gender, shiny, dataSource);
|
super(scene, 106, 148, species, level, abilityIndex, formIndex, gender, shiny, dataSource);
|
||||||
|
|
||||||
this.generateCompatibleTms();
|
this.generateCompatibleTms();
|
||||||
}
|
}
|
||||||
@ -880,7 +882,7 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
if (this.species.speciesId === Species.NINCADA && evolution.speciesId === Species.NINJASK) {
|
if (this.species.speciesId === Species.NINCADA && evolution.speciesId === Species.NINJASK) {
|
||||||
const newEvolution = pokemonEvolutions[this.species.speciesId][1];
|
const newEvolution = pokemonEvolutions[this.species.speciesId][1];
|
||||||
if (newEvolution.condition.predicate(this)) {
|
if (newEvolution.condition.predicate(this)) {
|
||||||
const newPokemon = new PlayerPokemon(this.scene, this.species, this.level, this.formIndex, this.gender, this.shiny);
|
const newPokemon = new PlayerPokemon(this.scene, this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny);
|
||||||
this.scene.getParty().push(newPokemon);
|
this.scene.getParty().push(newPokemon);
|
||||||
newPokemon.evolve(newEvolution);
|
newPokemon.evolve(newEvolution);
|
||||||
}
|
}
|
||||||
@ -1004,7 +1006,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
let ret: PlayerPokemon = null;
|
let ret: PlayerPokemon = null;
|
||||||
|
|
||||||
if (party.length < 6) {
|
if (party.length < 6) {
|
||||||
const newPokemon = new PlayerPokemon(this.scene, this.species, this.level, this.formIndex, this.gender, this.shiny, this);
|
const newPokemon = new PlayerPokemon(this.scene, this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this);
|
||||||
party.push(newPokemon);
|
party.push(newPokemon);
|
||||||
ret = newPokemon;
|
ret = newPokemon;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user