Fix some bugs

This commit is contained in:
Flashfyre 2023-04-23 01:03:09 -04:00
parent 2ac0a3645f
commit 032e26728b
5 changed files with 19 additions and 12 deletions

View File

@ -29,7 +29,7 @@ export class Arena {
}
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);
let tier = !isBoss
? tierValue >= 156 ? BiomePoolTier.COMMON : tierValue >= 32 ? BiomePoolTier.UNCOMMON : tierValue >= 6 ? BiomePoolTier.RARE : tierValue >= 1 ? BiomePoolTier.SUPER_RARE : BiomePoolTier.ULTRA_RARE

View File

@ -42,7 +42,7 @@ export class SelectStarterPhase extends BattlePhase {
const starterGender = starter.species.malePercent !== null
? !starter.female ? Gender.MALE : Gender.FEMALE
: 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);
party.push(starterPokemon);
loadPokemonAssets.push(starterPokemon.loadAssets());
@ -1642,7 +1642,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
}
start() {
if (!this.skipAnim && this.getPokemon().getHpRatio() < 1)
if (!this.skipAnim && this.getPokemon().hp && this.getPokemon().getHpRatio() < 1)
super.start();
else
this.end();
@ -1651,6 +1651,11 @@ export class PokemonHealPhase extends CommonAnimPhase {
end() {
const pokemon = this.getPokemon();
if (!this.getPokemon().hp) {
super.end();
return;
}
const fullHp = pokemon.getHpRatio() >= 1;
if (!fullHp) {

View File

@ -334,7 +334,7 @@ export default class BattleScene extends Phaser.Scene {
if (this.quickStart) {
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 playerPokemon = new PlayerPokemon(this, playerSpecies, startingLevel, 0);
const playerPokemon = new PlayerPokemon(this, playerSpecies, startingLevel, 0, 0);
playerPokemon.setVisible(false);
loadPokemonAssets.push(playerPokemon.loadAssets());
@ -744,7 +744,7 @@ export default class BattleScene extends Phaser.Scene {
return new Promise(resolve => {
const waveIndex = this.currentBattle.waveIndex;
const chances = Math.ceil(waveIndex / 10);
const isBoss = waveIndex >= 100 || !(waveIndex % 10);
const isBoss = this.getEnemyPokemon().level >= 100 || !(waveIndex % 10);
let count = 0;
for (let c = 0; c < chances; c++) {
if (!Utils.randInt(!isBoss ? 12 : 4))

View File

@ -630,7 +630,7 @@ const enemyModifierPool = {
new WeightedModifierType(modifierTypes.LUCKY_EGG, 2),
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
[ModifierTier.MASTER]: [
modifierTypes.SHELL_BELL
new WeightedModifierType(modifierTypes.SHELL_BELL, 1)
].map(m => { m.setTier(ModifierTier.MASTER); return m; })
};

View File

@ -28,6 +28,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
public name: string;
public species: PokemonSpecies;
public formIndex: integer;
public abilityIndex: integer;
public shiny: boolean;
public pokeball: PokeballType;
protected battleInfo: BattleInfo;
@ -51,7 +52,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
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);
this.name = Utils.toPokemonUpperCase(species.name);
this.species = species;
@ -60,6 +61,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
: new EnemyBattleInfo(scene);
this.pokeball = dataSource?.pokeball || PokeballType.POKEBALL;
this.level = level;
this.abilityIndex = abilityIndex || (species.ability2 ? Utils.randInt(2) : 0);
this.formIndex = formIndex || 0;
if (gender !== undefined)
this.gender = gender;
@ -110,7 +112,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (this.shiny === undefined) {
let shinyThreshold = new Utils.IntegerHolder(32);
this.scene.applyModifiers(ShinyRateBoosterModifier, this.isPlayer(), shinyThreshold);
this.scene.applyModifiers(ShinyRateBoosterModifier, true, shinyThreshold);
console.log(shinyThreshold.value);
this.shiny = (E ^ F) < shinyThreshold.value;
@ -829,8 +831,8 @@ export default interface Pokemon {
export class PlayerPokemon extends Pokemon {
public compatibleTms: Moves[];
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, formIndex: integer, gender?: Gender, shiny?: boolean, dataSource?: Pokemon) {
super(scene, 106, 148, species, level, formIndex, gender, shiny, dataSource);
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, abilityIndex: integer, formIndex: integer, gender?: Gender, shiny?: boolean, dataSource?: Pokemon) {
super(scene, 106, 148, species, level, abilityIndex, formIndex, gender, shiny, dataSource);
this.generateCompatibleTms();
}
@ -880,7 +882,7 @@ export class PlayerPokemon extends Pokemon {
if (this.species.speciesId === Species.NINCADA && evolution.speciesId === Species.NINJASK) {
const newEvolution = pokemonEvolutions[this.species.speciesId][1];
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);
newPokemon.evolve(newEvolution);
}
@ -1004,7 +1006,7 @@ export class EnemyPokemon extends Pokemon {
let ret: PlayerPokemon = null;
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);
ret = newPokemon;
}