Revert "[Feature] Add possibility to override whole user party (#1643)" (#1796)

This reverts commit ef8b6aa4f9.
This commit is contained in:
Tempoanon 2024-06-04 11:39:02 -04:00 committed by GitHub
parent ef8b6aa4f9
commit 1c73b3b084
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 40 additions and 123 deletions

View File

@ -686,8 +686,8 @@ export default class BattleScene extends SceneBase {
return findInParty(this.getParty()) || findInParty(this.getEnemyParty());
}
addPlayerPokemon(species: PokemonSpecies, level: integer, abilityIndex: integer, formIndex: integer, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: integer[], nature?: Nature, dataSource?: Pokemon | PokemonData, postProcess?: (playerPokemon: PlayerPokemon) => void, indexInParty?: number): PlayerPokemon {
const pokemon = new PlayerPokemon(this, species, level, abilityIndex, formIndex, gender, shiny, variant, ivs, nature, dataSource, indexInParty);
addPlayerPokemon(species: PokemonSpecies, level: integer, abilityIndex: integer, formIndex: integer, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: integer[], nature?: Nature, dataSource?: Pokemon | PokemonData, postProcess?: (playerPokemon: PlayerPokemon) => void): PlayerPokemon {
const pokemon = new PlayerPokemon(this, species, level, abilityIndex, formIndex, gender, shiny, variant, ivs, nature, dataSource);
if (postProcess) {
postProcess(pokemon);
}

View File

@ -61,7 +61,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 pokemon = new PlayerPokemon(scene, starterSpecies, startingLevel, undefined, formIndex, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
const pokemon = new PlayerPokemon(scene, starterSpecies, startingLevel, undefined, formIndex, undefined, undefined, undefined, undefined, undefined, undefined);
const starter: Starter = {
species: starterSpecies,
dexAttr: pokemon.getDexAttr(),

View File

@ -98,7 +98,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
public battleData: PokemonBattleData;
public battleSummonData: PokemonBattleSummonData;
public turnData: PokemonTurnData;
public indexInParty: number;
public fieldPosition: FieldPosition;
@ -107,7 +106,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
private shinySparkle: Phaser.GameObjects.Sprite;
constructor(scene: BattleScene, x: number, y: number, species: PokemonSpecies, level: integer, abilityIndex?: integer, formIndex?: integer, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: integer[], nature?: Nature, dataSource?: Pokemon | PokemonData, indexInParty?: number) {
constructor(scene: BattleScene, x: number, y: number, species: PokemonSpecies, level: integer, abilityIndex?: integer, formIndex?: integer, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: integer[], nature?: Nature, dataSource?: Pokemon | PokemonData) {
super(scene, x, y);
if (!species.isObtainable() && this.isPlayer()) {
@ -140,9 +139,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (variant !== undefined) {
this.variant = variant;
}
if (indexInParty !== undefined) {
this.indexInParty = indexInParty;
}
this.exp = dataSource?.exp || getLevelTotalExp(this.level, species.growthRate);
this.levelExp = dataSource?.levelExp || 0;
if (dataSource) {
@ -820,7 +816,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
: this.moveset;
// Overrides moveset based on arrays specified in overrides.ts
const overrideArray: Array<Moves> = this.isPlayer() ? Overrides.STARTER_OVERRIDE[this.indexInParty]?.moveset : Overrides.OPP_MOVESET_OVERRIDE;
const overrideArray: Array<Moves> = this.isPlayer() ? Overrides.MOVESET_OVERRIDE : Overrides.OPP_MOVESET_OVERRIDE;
if (overrideArray.length > 0) {
overrideArray.forEach((move: Moves, index: number) => {
const ppUsed = this.moveset[index]?.ppUsed || 0;
@ -905,6 +901,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (!ignoreOverride && this.summonData?.ability) {
return allAbilities[this.summonData.ability];
}
if (Overrides.ABILITY_OVERRIDE && this.isPlayer()) {
return allAbilities[Overrides.ABILITY_OVERRIDE];
}
if (Overrides.OPP_ABILITY_OVERRIDE && !this.isPlayer()) {
return allAbilities[Overrides.OPP_ABILITY_OVERRIDE];
}
@ -912,10 +911,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return allAbilities[this.getFusionSpeciesForm(ignoreOverride).getAbility(this.fusionAbilityIndex)];
}
let abilityId = this.getSpeciesForm(ignoreOverride).getAbility(this.abilityIndex);
if (Overrides.STARTER_OVERRIDE[this.indexInParty]?.ability) {
abilityId = Overrides.STARTER_OVERRIDE[this.indexInParty].ability;
}
if (abilityId === Abilities.NONE) {
abilityId = this.species.ability1;
}
@ -930,8 +925,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @returns {Ability} The passive ability of the pokemon
*/
getPassiveAbility(): Ability {
if (Overrides.STARTER_OVERRIDE[this.indexInParty]?.passiveAbility && this.isPlayer()) {
return allAbilities[Overrides.STARTER_OVERRIDE[this.indexInParty].passiveAbility];
if (Overrides.PASSIVE_ABILITY_OVERRIDE && this.isPlayer()) {
return allAbilities[Overrides.PASSIVE_ABILITY_OVERRIDE];
}
if (Overrides.OPP_PASSIVE_ABILITY_OVERRIDE && !this.isPlayer()) {
return allAbilities[Overrides.OPP_PASSIVE_ABILITY_OVERRIDE];
@ -953,7 +948,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
*/
hasPassive(): boolean {
// returns override if valid for current case
if ((Overrides.STARTER_OVERRIDE[this.indexInParty]?.passiveAbility !== Abilities.NONE && this.isPlayer()) ||
if ((Overrides.PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && this.isPlayer()) ||
(Overrides.OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && !this.isPlayer())) {
return true;
}
@ -2827,21 +2822,19 @@ export default interface Pokemon {
export class PlayerPokemon extends Pokemon {
public compatibleTms: Moves[];
public indexInParty: number;
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, abilityIndex: integer, formIndex: integer, gender: Gender, shiny: boolean, variant: Variant, ivs: integer[], nature: Nature, dataSource: Pokemon | PokemonData, indexInParty: number) {
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, abilityIndex: integer, formIndex: integer, gender: Gender, shiny: boolean, variant: Variant, ivs: integer[], nature: Nature, dataSource: Pokemon | PokemonData) {
super(scene, 106, 148, species, level, abilityIndex, formIndex, gender, shiny, variant, ivs, nature, dataSource);
if (Overrides.STARTER_OVERRIDE[indexInParty]?.status) {
this.status = new Status(Overrides.STARTER_OVERRIDE[indexInParty].status);
if (Overrides.STATUS_OVERRIDE) {
this.status = new Status(Overrides.STATUS_OVERRIDE);
}
this.indexInParty = indexInParty;
if (Overrides.STARTER_OVERRIDE[this.indexInParty]?.shiny) {
if (Overrides.SHINY_OVERRIDE) {
this.shiny = true;
this.initShinySparkle();
if (Overrides.STARTER_OVERRIDE[this.indexInParty]?.shinyVariant) {
this.variant = Overrides.STARTER_OVERRIDE[this.indexInParty].shinyVariant;
if (Overrides.VARIANT_OVERRIDE) {
this.variant = Overrides.VARIANT_OVERRIDE;
}
}

View File

@ -52,95 +52,24 @@ export const POKEBALL_OVERRIDE: { active: boolean, pokeballs: PokeballCounts } =
* PLAYER OVERRIDES
*/
// forms can be found in pokemon-species.ts
export const STARTER_FORM_OVERRIDE: integer = 0;
// default 5 or 20 for Daily
export const STARTING_LEVEL_OVERRIDE: integer = 0;
interface StarterOverride {
/**
/**
* SPECIES OVERRIDE
* will apply to each starter in your party
* will only apply to the first starter in your party or each enemy pokemon
* default is 0 to not override
* @example STARTER_OVERRIDE.species = Species.Bulbasaur;
* @example SPECIES_OVERRIDE = Species.Bulbasaur;
*/
species: Species | integer;
// forms can be found in pokemon-species.ts
form: integer;
ability: Abilities;
passiveAbility: Abilities;
status: StatusEffect;
gender: Gender;
moveset: Moves[];
shiny: boolean;
shinyVariant: Variant;
}
export const STARTER_OVERRIDE: StarterOverride[] = [
{
species: 0,
form: 0,
ability: Abilities.NONE,
passiveAbility: Abilities.NONE,
status: StatusEffect.NONE,
gender: null,
moveset: [],
shiny: false,
shinyVariant: 0,
},
{
species: 0,
form: 0,
ability: Abilities.NONE,
passiveAbility: Abilities.NONE,
status: StatusEffect.NONE,
gender: null,
moveset: [],
shiny: false,
shinyVariant: 0,
},
{
species: 0,
form: 0,
ability: Abilities.NONE,
passiveAbility: Abilities.NONE,
status: StatusEffect.NONE,
gender: null,
moveset: [],
shiny: false,
shinyVariant: 0,
},
{
species: 0,
form: 0,
ability: Abilities.NONE,
passiveAbility: Abilities.NONE,
status: StatusEffect.NONE,
gender: null,
moveset: [],
shiny: false,
shinyVariant: 0,
},
{
species: 0,
form: 0,
ability: Abilities.NONE,
passiveAbility: Abilities.NONE,
status: StatusEffect.NONE,
gender: null,
moveset: [],
shiny: false,
shinyVariant: 0,
},
{
species: 0,
form: 0,
ability: Abilities.NONE,
passiveAbility: Abilities.NONE,
status: StatusEffect.NONE,
gender: null,
moveset: [],
shiny: false,
shinyVariant: 0,
}
];
export const STARTER_SPECIES_OVERRIDE: Species | integer = 0;
export const ABILITY_OVERRIDE: Abilities = Abilities.NONE;
export const PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
export const STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
export const GENDER_OVERRIDE: Gender = null;
export const MOVESET_OVERRIDE: Array<Moves> = [];
export const SHINY_OVERRIDE: boolean = false;
export const VARIANT_OVERRIDE: Variant = 0;
/**
* OPPONENT / ENEMY OVERRIDES

View File

@ -529,27 +529,22 @@ export class SelectStarterPhase extends Phase {
const party = this.scene.getParty();
const loadPokemonAssets: Promise<void>[] = [];
starters.forEach((starter: Starter, i: integer) => {
if (Overrides.STARTER_OVERRIDE[i]?.species) {
starter.species = getPokemonSpecies(Overrides.STARTER_OVERRIDE[i].species as Species);
if (!i && Overrides.STARTER_SPECIES_OVERRIDE) {
starter.species = getPokemonSpecies(Overrides.STARTER_SPECIES_OVERRIDE as Species);
}
const starterProps = this.scene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr);
let starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0));
if (Overrides.STARTER_OVERRIDE[i]?.form) {
starterFormIndex = Overrides.STARTER_OVERRIDE[i].form;
const availableForms = starter.species.forms.length;
// prevent use forms which does not exist for species
if (Overrides.STARTER_OVERRIDE[i].form >= availableForms) {
starterFormIndex = 0;
}
if (!i && Overrides.STARTER_SPECIES_OVERRIDE) {
starterFormIndex = Overrides.STARTER_FORM_OVERRIDE;
}
let starterGender = starter.species.malePercent !== null
? !starterProps.female ? Gender.MALE : Gender.FEMALE
: Gender.GENDERLESS;
if (Overrides.STARTER_OVERRIDE[i]?.gender !== null) {
starterGender = Overrides.STARTER_OVERRIDE[i].gender;
if (Overrides.GENDER_OVERRIDE !== null) {
starterGender = Overrides.GENDER_OVERRIDE;
}
const starterIvs = this.scene.gameData.dexData[starter.species.speciesId].ivs.slice(0);
const starterPokemon = this.scene.addPlayerPokemon(starter.species, this.scene.gameMode.getStartingLevel(), starter.abilityIndex, starterFormIndex, starterGender, starterProps.shiny, starterProps.variant, starterIvs, starter.nature, null, null, i);
const starterPokemon = this.scene.addPlayerPokemon(starter.species, this.scene.gameMode.getStartingLevel(), starter.abilityIndex, starterFormIndex, starterGender, starterProps.shiny, starterProps.variant, starterIvs, starter.nature);
starterPokemon.tryPopulateMoveset(starter.moveset);
if (starter.passive) {
starterPokemon.passive = true;