mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 16:56:11 +00:00
Fix issue with generating enemy forms
This commit is contained in:
parent
afc1f81e30
commit
7d75bffab4
@ -117,9 +117,7 @@ export class Arena {
|
||||
return !tierPool.length ? TrainerType.BREEDER : tierPool[Utils.randSeedInt(tierPool.length)];
|
||||
}
|
||||
|
||||
getFormIndex(species: PokemonSpecies) {
|
||||
if (!species.canChangeForm && species.forms?.length)
|
||||
return Utils.randSeedInt(species.forms.length);
|
||||
getSpeciesFormIndex(species: PokemonSpecies): integer {
|
||||
switch (species.speciesId) {
|
||||
case Species.BURMY:
|
||||
case Species.WORMADAM:
|
||||
@ -131,6 +129,7 @@ export class Arena {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ import PokeballTray from './ui/pokeball-tray';
|
||||
import { Setting, settingOptions } from './system/settings';
|
||||
import SettingsUiHandler from './ui/settings-ui-handler';
|
||||
import MessageUiHandler from './ui/message-ui-handler';
|
||||
import { Species } from './data/species';
|
||||
|
||||
const enableAuto = true;
|
||||
const quickStart = false;
|
||||
@ -733,6 +734,20 @@ export default class BattleScene extends Phaser.Scene {
|
||||
return this.arena;
|
||||
}
|
||||
|
||||
getSpeciesFormIndex(species: PokemonSpecies): integer {
|
||||
if (!species.forms?.length)
|
||||
return 0;
|
||||
|
||||
switch (species.speciesId) {
|
||||
case Species.UNOWN:
|
||||
case Species.DEERLING:
|
||||
case Species.SAWSBUCK:
|
||||
return Utils.randSeedInt(species.forms.length);
|
||||
}
|
||||
|
||||
return this.arena.getSpeciesFormIndex(species);
|
||||
}
|
||||
|
||||
trySpreadPokerus(): void {
|
||||
const party = this.getParty();
|
||||
const infectedIndexes: integer[] = [];
|
||||
@ -953,7 +968,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||
}
|
||||
|
||||
pauseBgm(): boolean {
|
||||
if (this.bgm && this.bgm.isPlaying) {
|
||||
if (this.bgm && !this.bgm.pendingRemove && this.bgm.isPlaying) {
|
||||
this.bgm.pause();
|
||||
return true;
|
||||
}
|
||||
@ -961,7 +976,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||
}
|
||||
|
||||
resumeBgm(): boolean {
|
||||
if (this.bgm && this.bgm.isPaused) {
|
||||
if (this.bgm && !this.bgm.pendingRemove && this.bgm.isPaused) {
|
||||
this.bgm.resume();
|
||||
return true;
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ export const trainerConfigs: TrainerConfigs = {
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ]))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450))
|
||||
.setSpeciesFilter(species => species.baseTotal >= 540)
|
||||
.setPartyMemberFunc(5, getRandomPartyMemberFunc([ Species.RAYQUAZA ], p => p.formIndex = 0)),
|
||||
.setPartyMemberFunc(5, getRandomPartyMemberFunc([ Species.RAYQUAZA ])),
|
||||
[TrainerType.RIVAL_6]: new TrainerConfig(++t).setBoss().setStaticParty().setEncounterBgm('final').setBattleBgm('battle_rival_3').setPartyTemplates(trainerPartyTemplates.RIVAL_6)
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT ]))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ]))
|
||||
|
@ -1205,7 +1205,7 @@ export class EnemyPokemon extends Pokemon {
|
||||
public aiType: AiType;
|
||||
|
||||
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, trainer: boolean, dataSource?: PokemonData) {
|
||||
super(scene, 236, 84, species, level, dataSource?.abilityIndex, dataSource ? dataSource.formIndex : scene.arena.getFormIndex(species),
|
||||
super(scene, 236, 84, species, level, dataSource?.abilityIndex, dataSource ? dataSource.formIndex : scene.getSpeciesFormIndex(species),
|
||||
dataSource?.gender, dataSource?.shiny, dataSource);
|
||||
|
||||
this.trainer = trainer;
|
||||
|
Loading…
Reference in New Issue
Block a user