mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 15:22:19 +02:00
Removed unnecessary else statement
This commit is contained in:
parent
2c360b30c9
commit
e05082167e
@ -1 +1 @@
|
|||||||
Subproject commit 6b3f37cb351552721232f4dabefa17bddb5b9004
|
Subproject commit b4534f03ba8eb8709486ee967257b6f3725702dd
|
@ -285,11 +285,7 @@ export abstract class Challenge {
|
|||||||
* @param _dexAttr {@link DexAttrProps} The dex attributes of the pokemon.
|
* @param _dexAttr {@link DexAttrProps} The dex attributes of the pokemon.
|
||||||
* @returns {@link boolean} Whether this function did anything.
|
* @returns {@link boolean} Whether this function did anything.
|
||||||
*/
|
*/
|
||||||
applyStarterChoice(
|
applyStarterChoice(_pokemon: PokemonSpecies, _valid: Utils.BooleanHolder, _dexAttr: DexAttrProps): boolean {
|
||||||
_pokemon: PokemonSpecies,
|
|
||||||
_valid: Utils.BooleanHolder,
|
|
||||||
_dexAttr: DexAttrProps,
|
|
||||||
): boolean {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,10 +437,7 @@ export class SingleGenerationChallenge extends Challenge {
|
|||||||
super(Challenges.SINGLE_GENERATION, 9);
|
super(Challenges.SINGLE_GENERATION, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyStarterChoice(
|
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean {
|
||||||
pokemon: PokemonSpecies,
|
|
||||||
valid: Utils.BooleanHolder,
|
|
||||||
): boolean {
|
|
||||||
if (pokemon.generation !== this.value) {
|
if (pokemon.generation !== this.value) {
|
||||||
valid.value = false;
|
valid.value = false;
|
||||||
return true;
|
return true;
|
||||||
@ -725,11 +718,7 @@ export class SingleTypeChallenge extends Challenge {
|
|||||||
super(Challenges.SINGLE_TYPE, 18);
|
super(Challenges.SINGLE_TYPE, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
override applyStarterChoice(
|
override applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps): boolean {
|
||||||
pokemon: PokemonSpecies,
|
|
||||||
valid: Utils.BooleanHolder,
|
|
||||||
dexAttr: DexAttrProps,
|
|
||||||
): boolean {
|
|
||||||
const speciesForm = getPokemonSpeciesForm(pokemon.speciesId, dexAttr.formIndex);
|
const speciesForm = getPokemonSpeciesForm(pokemon.speciesId, dexAttr.formIndex);
|
||||||
const types = [speciesForm.type1, speciesForm.type2];
|
const types = [speciesForm.type1, speciesForm.type2];
|
||||||
if (!types.includes(this.value - 1)) {
|
if (!types.includes(this.value - 1)) {
|
||||||
|
@ -1569,10 +1569,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
Challenge.ChallengeType.STARTER_CHOICE,
|
Challenge.ChallengeType.STARTER_CHOICE,
|
||||||
species,
|
species,
|
||||||
isValidForChallenge,
|
isValidForChallenge,
|
||||||
props
|
props,
|
||||||
);
|
);
|
||||||
return isValidForChallenge.value;
|
return isValidForChallenge.value;
|
||||||
} else {
|
}
|
||||||
// We check the validity of every evolution and battle form separately,
|
// We check the validity of every evolution and battle form separately,
|
||||||
// and require that at least one is valid
|
// and require that at least one is valid
|
||||||
const allValidities: boolean[] = [];
|
const allValidities: boolean[] = [];
|
||||||
@ -1586,7 +1586,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
Challenge.ChallengeType.STARTER_CHOICE,
|
Challenge.ChallengeType.STARTER_CHOICE,
|
||||||
checkingSpecies,
|
checkingSpecies,
|
||||||
isEvoValidForChallenge,
|
isEvoValidForChallenge,
|
||||||
props // This might be wrong, in principle we need to pass the right formIndex
|
props, // This might be wrong, in principle we need to pass the right formIndex
|
||||||
);
|
);
|
||||||
allValidities.push(isEvoValidForChallenge.value);
|
allValidities.push(isEvoValidForChallenge.value);
|
||||||
if (checking && pokemonEvolutions.hasOwnProperty(checking)) {
|
if (checking && pokemonEvolutions.hasOwnProperty(checking)) {
|
||||||
@ -1606,7 +1606,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
Challenge.ChallengeType.STARTER_CHOICE,
|
Challenge.ChallengeType.STARTER_CHOICE,
|
||||||
checkingSpecies,
|
checkingSpecies,
|
||||||
isFormValidForChallenge,
|
isFormValidForChallenge,
|
||||||
formProps
|
formProps,
|
||||||
);
|
);
|
||||||
allValidities.push(isFormValidForChallenge.value);
|
allValidities.push(isFormValidForChallenge.value);
|
||||||
}
|
}
|
||||||
@ -1616,7 +1616,6 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
return allValidities.filter(v => v).length > 0;
|
return allValidities.filter(v => v).length > 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
processInput(button: Button): boolean {
|
processInput(button: Button): boolean {
|
||||||
if (this.blockInput) {
|
if (this.blockInput) {
|
||||||
@ -1831,10 +1830,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
);
|
);
|
||||||
const isCaught = globalScene.gameData.dexData[species.speciesId].caughtAttr;
|
const isCaught = globalScene.gameData.dexData[species.speciesId].caughtAttr;
|
||||||
return (
|
return (
|
||||||
!isDupe &&
|
!isDupe && isValidForChallenge && currentPartyValue + starterCost <= this.getValueLimit() && isCaught
|
||||||
isValidForChallenge &&
|
|
||||||
currentPartyValue + starterCost <= this.getValueLimit() &&
|
|
||||||
isCaught
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (validStarters.length === 0) {
|
if (validStarters.length === 0) {
|
||||||
@ -1926,7 +1922,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
const isPartyValid = this.isPartyValid();
|
const isPartyValid = this.isPartyValid();
|
||||||
const isValidForChallenge = this.checkValidForChallenge(
|
const isValidForChallenge = this.checkValidForChallenge(
|
||||||
this.lastSpecies,
|
this.lastSpecies,
|
||||||
globalScene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.getCurrentDexProps(this.lastSpecies.speciesId)),
|
globalScene.gameData.getSpeciesDexAttrProps(
|
||||||
|
this.lastSpecies,
|
||||||
|
this.getCurrentDexProps(this.lastSpecies.speciesId),
|
||||||
|
),
|
||||||
isPartyValid,
|
isPartyValid,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -3046,11 +3045,22 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
* Since some pokemon rely on forms to be valid (i.e. blaze tauros for fire challenges), we make a fake form and dex props to use in the challenge
|
* Since some pokemon rely on forms to be valid (i.e. blaze tauros for fire challenges), we make a fake form and dex props to use in the challenge
|
||||||
*/
|
*/
|
||||||
const tempFormProps = BigInt(Math.pow(2, i)) * DexAttr.DEFAULT_FORM;
|
const tempFormProps = BigInt(Math.pow(2, i)) * DexAttr.DEFAULT_FORM;
|
||||||
const isValidForChallenge = this.checkValidForChallenge(container.species, globalScene.gameData.getSpeciesDexAttrProps(species, tempFormProps), true);
|
const isValidForChallenge = this.checkValidForChallenge(
|
||||||
|
container.species,
|
||||||
|
globalScene.gameData.getSpeciesDexAttrProps(species, tempFormProps),
|
||||||
|
true,
|
||||||
|
);
|
||||||
allFormsValid = allFormsValid || isValidForChallenge;
|
allFormsValid = allFormsValid || isValidForChallenge;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const isValidForChallenge = this.checkValidForChallenge(container.species, globalScene.gameData.getSpeciesDexAttrProps(species, globalScene.gameData.getSpeciesDefaultDexAttr(container.species, false, true)), true);
|
const isValidForChallenge = this.checkValidForChallenge(
|
||||||
|
container.species,
|
||||||
|
globalScene.gameData.getSpeciesDexAttrProps(
|
||||||
|
species,
|
||||||
|
globalScene.gameData.getSpeciesDefaultDexAttr(container.species, false, true),
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
allFormsValid = isValidForChallenge;
|
allFormsValid = isValidForChallenge;
|
||||||
}
|
}
|
||||||
if (allFormsValid) {
|
if (allFormsValid) {
|
||||||
@ -3884,7 +3894,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
this.pokemonSprite.setVisible(!this.statsMode);
|
this.pokemonSprite.setVisible(!this.statsMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentFilteredContainer = this.filteredStarterContainers.find(p => p.species.speciesId === species.speciesId);
|
const currentFilteredContainer = this.filteredStarterContainers.find(
|
||||||
|
p => p.species.speciesId === species.speciesId,
|
||||||
|
);
|
||||||
if (currentFilteredContainer) {
|
if (currentFilteredContainer) {
|
||||||
const starterSprite = currentFilteredContainer.icon as Phaser.GameObjects.Sprite;
|
const starterSprite = currentFilteredContainer.icon as Phaser.GameObjects.Sprite;
|
||||||
starterSprite.setTexture(
|
starterSprite.setTexture(
|
||||||
@ -4259,7 +4271,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
if (addingToParty) {
|
if (addingToParty) {
|
||||||
// this does a check to see if the pokemon being added is valid; if so, it will update the isPartyValid boolean
|
// this does a check to see if the pokemon being added is valid; if so, it will update the isPartyValid boolean
|
||||||
const species = this.filteredStarterContainers[this.cursor].species;
|
const species = this.filteredStarterContainers[this.cursor].species;
|
||||||
const isNewPokemonValid = this.checkValidForChallenge(species, globalScene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)), false);
|
const isNewPokemonValid = this.checkValidForChallenge(
|
||||||
|
species,
|
||||||
|
globalScene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)),
|
||||||
|
false,
|
||||||
|
);
|
||||||
isPartyValid = isPartyValid || isNewPokemonValid;
|
isPartyValid = isPartyValid || isNewPokemonValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4284,7 +4300,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
* If speciesStarterDexEntry?.caughtAttr is true, this species registered in stater.
|
* If speciesStarterDexEntry?.caughtAttr is true, this species registered in stater.
|
||||||
* we change to can AddParty value to true since the user has enough cost to choose this pokemon and this pokemon registered too.
|
* we change to can AddParty value to true since the user has enough cost to choose this pokemon and this pokemon registered too.
|
||||||
*/
|
*/
|
||||||
const isValidForChallenge = this.checkValidForChallenge(this.allSpecies[s], globalScene.gameData.getSpeciesDexAttrProps(this.allSpecies[s], this.getCurrentDexProps(this.allSpecies[s].speciesId)), isPartyValid);
|
const isValidForChallenge = this.checkValidForChallenge(
|
||||||
|
this.allSpecies[s],
|
||||||
|
globalScene.gameData.getSpeciesDexAttrProps(
|
||||||
|
this.allSpecies[s],
|
||||||
|
this.getCurrentDexProps(this.allSpecies[s].speciesId),
|
||||||
|
),
|
||||||
|
isPartyValid,
|
||||||
|
);
|
||||||
|
|
||||||
const canBeChosen = remainValue >= speciesStarterValue && isValidForChallenge;
|
const canBeChosen = remainValue >= speciesStarterValue && isValidForChallenge;
|
||||||
|
|
||||||
@ -4421,7 +4444,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
let canStart = false;
|
let canStart = false;
|
||||||
for (let s = 0; s < this.starterSpecies.length; s++) {
|
for (let s = 0; s < this.starterSpecies.length; s++) {
|
||||||
const species = this.starterSpecies[s];
|
const species = this.starterSpecies[s];
|
||||||
const isValidForChallenge = this.checkValidForChallenge(species, globalScene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)), false);
|
const isValidForChallenge = this.checkValidForChallenge(
|
||||||
|
species,
|
||||||
|
globalScene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)),
|
||||||
|
false,
|
||||||
|
);
|
||||||
canStart = canStart || isValidForChallenge;
|
canStart = canStart || isValidForChallenge;
|
||||||
}
|
}
|
||||||
return canStart;
|
return canStart;
|
||||||
|
@ -96,8 +96,7 @@ describe("Abilities - Lightningrod", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should redirect moves changed to electric type via ability", async () => {
|
it("should redirect moves changed to electric type via ability", async () => {
|
||||||
game.override.ability(Abilities.GALVANIZE)
|
game.override.ability(Abilities.GALVANIZE).moveset(Moves.TACKLE);
|
||||||
.moveset(Moves.TACKLE);
|
|
||||||
await game.classicMode.startBattle([Species.FEEBAS, Species.MAGIKARP]);
|
await game.classicMode.startBattle([Species.FEEBAS, Species.MAGIKARP]);
|
||||||
|
|
||||||
const enemy1 = game.scene.getEnemyField()[0];
|
const enemy1 = game.scene.getEnemyField()[0];
|
||||||
|
@ -158,10 +158,7 @@ describe("Abilities - Neutralizing Gas", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should not activate abilities of pokemon no longer on the field", async () => {
|
it("should not activate abilities of pokemon no longer on the field", async () => {
|
||||||
game.override
|
game.override.battleType("single").ability(Abilities.NEUTRALIZING_GAS).enemyAbility(Abilities.DELTA_STREAM);
|
||||||
.battleType("single")
|
|
||||||
.ability(Abilities.NEUTRALIZING_GAS)
|
|
||||||
.enemyAbility(Abilities.DELTA_STREAM);
|
|
||||||
await game.classicMode.startBattle([Species.MAGIKARP]);
|
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||||
|
|
||||||
const enemy = game.scene.getEnemyPokemon()!;
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
|
@ -96,8 +96,7 @@ describe("Abilities - Storm Drain", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should redirect moves changed to water type via ability", async () => {
|
it("should redirect moves changed to water type via ability", async () => {
|
||||||
game.override.ability(Abilities.LIQUID_VOICE)
|
game.override.ability(Abilities.LIQUID_VOICE).moveset(Moves.PSYCHIC_NOISE);
|
||||||
.moveset(Moves.PSYCHIC_NOISE);
|
|
||||||
await game.classicMode.startBattle([Species.FEEBAS, Species.MAGIKARP]);
|
await game.classicMode.startBattle([Species.FEEBAS, Species.MAGIKARP]);
|
||||||
|
|
||||||
const enemy1 = game.scene.getEnemyField()[0];
|
const enemy1 = game.scene.getEnemyField()[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user