mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-30 02:36: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)];
|
return !tierPool.length ? TrainerType.BREEDER : tierPool[Utils.randSeedInt(tierPool.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormIndex(species: PokemonSpecies) {
|
getSpeciesFormIndex(species: PokemonSpecies): integer {
|
||||||
if (!species.canChangeForm && species.forms?.length)
|
|
||||||
return Utils.randSeedInt(species.forms.length);
|
|
||||||
switch (species.speciesId) {
|
switch (species.speciesId) {
|
||||||
case Species.BURMY:
|
case Species.BURMY:
|
||||||
case Species.WORMADAM:
|
case Species.WORMADAM:
|
||||||
@ -131,6 +129,7 @@ export class Arena {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ import PokeballTray from './ui/pokeball-tray';
|
|||||||
import { Setting, settingOptions } from './system/settings';
|
import { Setting, settingOptions } from './system/settings';
|
||||||
import SettingsUiHandler from './ui/settings-ui-handler';
|
import SettingsUiHandler from './ui/settings-ui-handler';
|
||||||
import MessageUiHandler from './ui/message-ui-handler';
|
import MessageUiHandler from './ui/message-ui-handler';
|
||||||
|
import { Species } from './data/species';
|
||||||
|
|
||||||
const enableAuto = true;
|
const enableAuto = true;
|
||||||
const quickStart = false;
|
const quickStart = false;
|
||||||
@ -733,6 +734,20 @@ export default class BattleScene extends Phaser.Scene {
|
|||||||
return this.arena;
|
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 {
|
trySpreadPokerus(): void {
|
||||||
const party = this.getParty();
|
const party = this.getParty();
|
||||||
const infectedIndexes: integer[] = [];
|
const infectedIndexes: integer[] = [];
|
||||||
@ -953,7 +968,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pauseBgm(): boolean {
|
pauseBgm(): boolean {
|
||||||
if (this.bgm && this.bgm.isPlaying) {
|
if (this.bgm && !this.bgm.pendingRemove && this.bgm.isPlaying) {
|
||||||
this.bgm.pause();
|
this.bgm.pause();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -961,7 +976,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resumeBgm(): boolean {
|
resumeBgm(): boolean {
|
||||||
if (this.bgm && this.bgm.isPaused) {
|
if (this.bgm && !this.bgm.pendingRemove && this.bgm.isPaused) {
|
||||||
this.bgm.resume();
|
this.bgm.resume();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -735,7 +735,7 @@ export const trainerConfigs: TrainerConfigs = {
|
|||||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ]))
|
.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))
|
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450))
|
||||||
.setSpeciesFilter(species => species.baseTotal >= 540)
|
.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)
|
[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(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 ]))
|
.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;
|
public aiType: AiType;
|
||||||
|
|
||||||
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, trainer: boolean, dataSource?: PokemonData) {
|
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);
|
dataSource?.gender, dataSource?.shiny, dataSource);
|
||||||
|
|
||||||
this.trainer = trainer;
|
this.trainer = trainer;
|
||||||
|
Loading…
Reference in New Issue
Block a user