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; berryModifier.consumed = false;
this.scene.updateModifiers(this.player); this.scene.updateModifiers(this.player);
} }
super.start(); return super.start();
return;
} }
this.end(); this.end();

View File

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

View File

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

View File

@ -330,7 +330,7 @@ export class EggHatchPhase extends BattlePhase {
if (speciesOverride) { if (speciesOverride) {
this.scene.executeWithSeedOffset(() => { this.scene.executeWithSeedOffset(() => {
const pokemonSpecies = getPokemonSpecies(speciesOverride); 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()); }, this.egg.id, EGG_SEED.toString());
} else { } else {
let minStarterValue: integer; let minStarterValue: integer;
@ -399,7 +399,7 @@ export class EggHatchPhase extends BattlePhase {
const pokemonSpecies = getPokemonSpecies(species); 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()); }, 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 this.abilityIndex = abilityIndex !== undefined
? abilityIndex ? abilityIndex
: (species.abilityHidden && hasHiddenAbility ? species.ability2 ? 2 : 1 : species.ability2 ? randAbilityIndex : 0); : (species.abilityHidden && hasHiddenAbility ? species.ability2 ? 2 : 1 : species.ability2 ? randAbilityIndex : 0);
this.formIndex = formIndex || 0; if (formIndex !== undefined)
this.formIndex = formIndex;
if (gender !== undefined) if (gender !== undefined)
this.gender = gender; this.gender = gender;
if (shiny !== undefined) 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) if (this.shiny === undefined)
this.trySetShiny(); 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.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.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; this.fusionShiny = this.shiny;
if (this.fusionSpecies.malePercent === null) if (this.fusionSpecies.malePercent === null)
@ -761,6 +764,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.fusionGender = Gender.FEMALE; this.fusionGender = Gender.FEMALE;
} }
this.fusionFormIndex = this.scene.getSpeciesFormIndex(this.fusionSpecies, this.fusionGender, true);
this.generateName(); this.generateName();
} }
@ -1861,7 +1866,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.getSpeciesFormIndex(species), super(scene, 236, 84, species, level, dataSource?.abilityIndex, dataSource?.formIndex,
dataSource?.gender, dataSource ? dataSource.shiny : false, null, dataSource); dataSource?.gender, dataSource ? dataSource.shiny : false, null, dataSource);
this.trainer = trainer; this.trainer = trainer;