Attempt fixing issue with gender-specific types

pull/14/head
Flashfyre 2023-12-26 01:29:05 -05:00
parent 7688a4aaa6
commit 40439817ac
5 changed files with 29 additions and 12 deletions

View File

@ -2784,8 +2784,7 @@ export class BerryPhase extends CommonAnimPhase {
berryModifier.consumed = false;
this.scene.updateModifiers(this.player);
}
super.start();
return;
return super.start();
}
this.end();

View File

@ -37,6 +37,7 @@ import InvertPostFX from './pipelines/invert';
import { Achv, ModifierAchv, achvs } from './system/achv';
import { GachaType } from './data/egg';
import { Voucher, vouchers } from './system/voucher';
import { Gender } from './data/gender';
const enableAuto = true;
const quickStart = false;
@ -781,7 +782,7 @@ export default class BattleScene extends Phaser.Scene {
return this.arena;
}
getSpeciesFormIndex(species: PokemonSpecies, ignoreArena?: boolean): integer {
getSpeciesFormIndex(species: PokemonSpecies, gender?: Gender, ignoreArena?: boolean): integer {
if (!species.forms?.length)
return 0;
@ -791,11 +792,23 @@ export default class BattleScene extends Phaser.Scene {
case Species.SAWSBUCK:
case Species.ORICORIO:
return Utils.randSeedInt(species.forms.length);
case Species.MEOWSTIC:
case Species.INDEEDEE:
return gender === Gender.FEMALE ? 1 : 0;
}
return !ignoreArena
? this.arena.getSpeciesFormIndex(species)
: 0;
if (ignoreArena) {
switch (species.speciesId) {
case Species.BURMY:
case Species.WORMADAM:
case Species.LYCANROC:
case Species.CALYREX:
return Utils.randSeedInt(species.forms.length);
}
return 0;
}
return this.arena.getSpeciesFormIndex(species);
}
trySpreadPokerus(): void {

View File

@ -104,7 +104,7 @@ export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timesta
}
export function getTypeGachaTypeForTimestamp(scene: BattleScene, timestamp: integer): Type {
const types = Utils.getEnumValues(Type);
const types = Utils.getEnumValues(Type).slice(1);
let ret: Type;
scene.executeWithSeedOffset(() => {

View File

@ -330,7 +330,7 @@ export class EggHatchPhase extends BattlePhase {
if (speciesOverride) {
this.scene.executeWithSeedOffset(() => {
const pokemonSpecies = getPokemonSpecies(speciesOverride);
ret = new PlayerPokemon(this.scene, pokemonSpecies, 5, undefined, this.scene.getSpeciesFormIndex(pokemonSpecies, true), undefined, false);
ret = new PlayerPokemon(this.scene, pokemonSpecies, 5, undefined, undefined, undefined, false);
}, this.egg.id, EGG_SEED.toString());
} else {
let minStarterValue: integer;
@ -399,7 +399,7 @@ export class EggHatchPhase extends BattlePhase {
const pokemonSpecies = getPokemonSpecies(species);
ret = new PlayerPokemon(this.scene, pokemonSpecies, 5, undefined, this.scene.getSpeciesFormIndex(pokemonSpecies, true), undefined, false);
ret = new PlayerPokemon(this.scene, pokemonSpecies, 5, undefined, undefined, undefined, false);
}, this.egg.id, EGG_SEED.toString());
}

View File

@ -108,7 +108,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.abilityIndex = abilityIndex !== undefined
? abilityIndex
: (species.abilityHidden && hasHiddenAbility ? species.ability2 ? 2 : 1 : species.ability2 ? randAbilityIndex : 0);
this.formIndex = formIndex || 0;
if (formIndex !== undefined)
this.formIndex = formIndex;
if (gender !== undefined)
this.gender = gender;
if (shiny !== undefined)
@ -155,6 +156,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
}
if (this.formIndex === undefined)
this.formIndex = this.scene.getSpeciesFormIndex(species, this.gender, this.isPlayer());
if (this.shiny === undefined)
this.trySetShiny();
@ -748,7 +752,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.fusionSpecies = this.scene.randomSpecies(this.scene.currentBattle?.waveIndex || 0, this.level, false, filter, true);
this.fusionAbilityIndex = (this.fusionSpecies.abilityHidden && hasHiddenAbility ? this.fusionSpecies.ability2 ? 2 : 1 : this.fusionSpecies.ability2 ? randAbilityIndex : 0);
this.fusionFormIndex = this.scene.getSpeciesFormIndex(this.fusionSpecies);
this.fusionShiny = this.shiny;
if (this.fusionSpecies.malePercent === null)
@ -761,6 +764,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.fusionGender = Gender.FEMALE;
}
this.fusionFormIndex = this.scene.getSpeciesFormIndex(this.fusionSpecies, this.fusionGender, true);
this.generateName();
}
@ -1861,7 +1866,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.getSpeciesFormIndex(species),
super(scene, 236, 84, species, level, dataSource?.abilityIndex, dataSource?.formIndex,
dataSource?.gender, dataSource ? dataSource.shiny : false, null, dataSource);
this.trainer = trainer;