mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-27 10:42:25 +02:00
formIndex set to protected
This commit is contained in:
parent
1c6ecf6252
commit
03819dd36e
@ -2752,15 +2752,15 @@ export default class BattleScene extends SceneBase {
|
||||
const keys: string[] = [];
|
||||
const playerParty = this.getParty();
|
||||
playerParty.forEach(p => {
|
||||
keys.push("pkmn__" + p.species.getSpriteId(p.gender === Gender.FEMALE, p.species.formIndex, p.shiny, p.variant));
|
||||
keys.push("pkmn__" + p.species.getSpriteId(p.gender === Gender.FEMALE, p.species.formIndex, p.shiny, p.variant, true));
|
||||
keys.push("cry/" + p.species.getCryKey(p.species.formIndex));
|
||||
keys.push("pkmn__" + p.species.getSpriteId(p.gender === Gender.FEMALE, p.species.getFormIndex(), p.shiny, p.variant));
|
||||
keys.push("pkmn__" + p.species.getSpriteId(p.gender === Gender.FEMALE, p.species.getFormIndex(), p.shiny, p.variant, true));
|
||||
keys.push("cry/" + p.species.getCryKey(p.species.getFormIndex()));
|
||||
});
|
||||
// enemyParty has to be operated on separately from playerParty because playerPokemon =/= enemyPokemon
|
||||
const enemyParty = this.getEnemyParty();
|
||||
enemyParty.forEach(p => {
|
||||
keys.push(p.species.getSpriteKey(p.gender === Gender.FEMALE, p.species.formIndex, p.shiny, p.variant));
|
||||
keys.push("cry/" + p.species.getCryKey(p.species.formIndex));
|
||||
keys.push(p.species.getSpriteKey(p.gender === Gender.FEMALE, p.species.getFormIndex(), p.shiny, p.variant));
|
||||
keys.push("cry/" + p.species.getCryKey(p.species.getFormIndex()));
|
||||
});
|
||||
return keys;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ export function getDailyRunStarters(scene: BattleScene, seed: string): Starter[]
|
||||
|
||||
function getDailyRunStarter(scene: BattleScene, starterSpeciesForm: PokemonSpeciesForm, startingLevel: integer): Starter {
|
||||
const starterSpecies = starterSpeciesForm instanceof PokemonSpecies ? starterSpeciesForm : getPokemonSpecies(starterSpeciesForm.speciesId);
|
||||
const formIndex = starterSpeciesForm instanceof PokemonSpecies ? undefined : starterSpeciesForm.formIndex;
|
||||
const formIndex = starterSpeciesForm instanceof PokemonSpecies ? undefined : starterSpeciesForm.getFormIndex();
|
||||
const pokemon = new PlayerPokemon(scene, starterSpecies, startingLevel, undefined, formIndex, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
const starter: Starter = {
|
||||
species: starterSpecies,
|
||||
|
@ -3896,7 +3896,7 @@ export class FormChangeItemTypeAttr extends VariableMoveTypeAttr {
|
||||
}
|
||||
|
||||
if ([user.species.speciesId, user.fusionSpecies?.speciesId].includes(Species.ARCEUS) || [user.species.speciesId, user.fusionSpecies?.speciesId].includes(Species.SILVALLY)) {
|
||||
const form = user.species.speciesId === Species.ARCEUS || user.species.speciesId === Species.SILVALLY ? user.formIndex : user.fusionSpecies?.formIndex!; // TODO: is this bang correct?
|
||||
const form = user.species.speciesId === Species.ARCEUS || user.species.speciesId === Species.SILVALLY ? user.formIndex : user.fusionSpecies?.getFormIndex()!;
|
||||
|
||||
moveType.value = Type[Type[form]];
|
||||
return true;
|
||||
@ -3914,7 +3914,7 @@ export class TechnoBlastTypeAttr extends VariableMoveTypeAttr {
|
||||
}
|
||||
|
||||
if ([user.species.speciesId, user.fusionSpecies?.speciesId].includes(Species.GENESECT)) {
|
||||
const form = user.species.speciesId === Species.GENESECT ? user.formIndex : user.fusionSpecies?.formIndex;
|
||||
const form = user.species.speciesId === Species.GENESECT ? user.formIndex : user.fusionSpecies?.getFormIndex();
|
||||
|
||||
switch (form) {
|
||||
case 1: // Shock Drive
|
||||
@ -3948,7 +3948,7 @@ export class AuraWheelTypeAttr extends VariableMoveTypeAttr {
|
||||
}
|
||||
|
||||
if ([user.species.speciesId, user.fusionSpecies?.speciesId].includes(Species.MORPEKO)) {
|
||||
const form = user.species.speciesId === Species.MORPEKO ? user.formIndex : user.fusionSpecies?.formIndex;
|
||||
const form = user.species.speciesId === Species.MORPEKO ? user.formIndex : user.fusionSpecies?.getFormIndex();
|
||||
|
||||
switch (form) {
|
||||
case 1: // Hangry Mode
|
||||
@ -3973,7 +3973,7 @@ export class RagingBullTypeAttr extends VariableMoveTypeAttr {
|
||||
}
|
||||
|
||||
if ([user.species.speciesId, user.fusionSpecies?.speciesId].includes(Species.PALDEA_TAUROS)) {
|
||||
const form = user.species.speciesId === Species.PALDEA_TAUROS ? user.formIndex : user.fusionSpecies?.formIndex;
|
||||
const form = user.species.speciesId === Species.PALDEA_TAUROS ? user.formIndex : user.fusionSpecies?.getFormIndex();
|
||||
|
||||
switch (form) {
|
||||
case 1: // Blaze breed
|
||||
@ -4001,7 +4001,7 @@ export class IvyCudgelTypeAttr extends VariableMoveTypeAttr {
|
||||
}
|
||||
|
||||
if ([user.species.speciesId, user.fusionSpecies?.speciesId].includes(Species.OGERPON)) {
|
||||
const form = user.species.speciesId === Species.OGERPON ? user.formIndex : user.fusionSpecies?.formIndex;
|
||||
const form = user.species.speciesId === Species.OGERPON ? user.formIndex : user.fusionSpecies?.getFormIndex();
|
||||
|
||||
switch (form) {
|
||||
case 1: // Wellspring Mask
|
||||
|
@ -127,7 +127,7 @@ export type PokemonSpeciesFilter = (species: PokemonSpecies) => boolean;
|
||||
|
||||
export abstract class PokemonSpeciesForm {
|
||||
public speciesId: Species;
|
||||
public formIndex: number;
|
||||
protected formIndex: number;
|
||||
protected generation: number;
|
||||
readonly type1: Type;
|
||||
readonly type2: Type | null;
|
||||
@ -194,6 +194,22 @@ export abstract class PokemonSpeciesForm {
|
||||
this.generation = generation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to retrieve the form index of a Pokemon species
|
||||
* @returns the form index
|
||||
*/
|
||||
getFormIndex(): number {
|
||||
return this.formIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the form index of a specific Pokemon species
|
||||
* @param the form index
|
||||
*/
|
||||
setFormIndex(formIndex: number) {
|
||||
this.formIndex = formIndex;
|
||||
}
|
||||
|
||||
isOfType(type: number): boolean {
|
||||
return this.type1 === type || (this.type2 !== null && this.type2 === type);
|
||||
}
|
||||
@ -629,7 +645,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
||||
|
||||
forms.forEach((form, f) => {
|
||||
form.speciesId = id;
|
||||
form.formIndex = f;
|
||||
form.setFormIndex(f);
|
||||
form.setGeneration(generation);
|
||||
});
|
||||
}
|
||||
|
@ -3191,10 +3191,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
const speciesForm = this.getSpeciesForm(ignoreOveride);
|
||||
const fusionSpeciesForm = this.getFusionSpeciesForm(ignoreOveride);
|
||||
|
||||
const spriteKey = speciesForm.getSpriteKey(this.getGender(ignoreOveride) === Gender.FEMALE, speciesForm.formIndex, this.shiny, this.variant);
|
||||
const backSpriteKey = speciesForm.getSpriteKey(this.getGender(ignoreOveride) === Gender.FEMALE, speciesForm.formIndex, this.shiny, this.variant).replace("pkmn__", "pkmn__back__");
|
||||
const fusionSpriteKey = fusionSpeciesForm.getSpriteKey(this.getFusionGender(ignoreOveride) === Gender.FEMALE, fusionSpeciesForm.formIndex, this.fusionShiny, this.fusionVariant);
|
||||
const fusionBackSpriteKey = fusionSpeciesForm.getSpriteKey(this.getFusionGender(ignoreOveride) === Gender.FEMALE, fusionSpeciesForm.formIndex, this.fusionShiny, this.fusionVariant).replace("pkmn__", "pkmn__back__");
|
||||
const spriteKey = speciesForm.getSpriteKey(this.getGender(ignoreOveride) === Gender.FEMALE, speciesForm.getFormIndex(), this.shiny, this.variant);
|
||||
const backSpriteKey = speciesForm.getSpriteKey(this.getGender(ignoreOveride) === Gender.FEMALE, speciesForm.getFormIndex(), this.shiny, this.variant).replace("pkmn__", "pkmn__back__");
|
||||
const fusionSpriteKey = fusionSpeciesForm.getSpriteKey(this.getFusionGender(ignoreOveride) === Gender.FEMALE, fusionSpeciesForm.getFormIndex(), this.fusionShiny, this.fusionVariant);
|
||||
const fusionBackSpriteKey = fusionSpeciesForm.getSpriteKey(this.getFusionGender(ignoreOveride) === Gender.FEMALE, fusionSpeciesForm.getFormIndex(), this.fusionShiny, this.fusionVariant).replace("pkmn__", "pkmn__back__");
|
||||
|
||||
const sourceTexture = this.scene.textures.get(spriteKey);
|
||||
const sourceBackTexture = this.scene.textures.get(backSpriteKey);
|
||||
|
Loading…
Reference in New Issue
Block a user