mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 23:32:19 +02:00
Remove various unnecessary ?
This commit is contained in:
parent
909db9802f
commit
5020e6fc10
@ -179,7 +179,7 @@ class TimeOfDayEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
class MoveEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
public move: Moves;
|
||||
constructor(move: Moves) {
|
||||
super(p => p.moveset.filter(m => m?.moveId === move).length > 0);
|
||||
super(p => p.moveset.filter(m => m.moveId === move).length > 0);
|
||||
this.move = move;
|
||||
const moveKey = Moves[this.move].split("_").filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join("");
|
||||
this.description = i18next.t("pokemonEvolutions:move", { move: i18next.t(`move:${moveKey}.name`) });
|
||||
@ -282,7 +282,7 @@ class TyrogueEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
public move: Moves;
|
||||
constructor(move: Moves) {
|
||||
super(p =>
|
||||
p.getMoveset(true).find(m => m && [ Moves.LOW_SWEEP, Moves.MACH_PUNCH, Moves.RAPID_SPIN ].includes(m?.moveId))?.moveId === move);
|
||||
p.getMoveset(true).find(m => m && [ Moves.LOW_SWEEP, Moves.MACH_PUNCH, Moves.RAPID_SPIN ].includes(m.moveId))?.moveId === move);
|
||||
this.move = move;
|
||||
const moveKey = Moves[this.move].split("_").filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join("");
|
||||
this.description = i18next.t("pokemonEvolutions:move", { move: i18next.t(`move:${moveKey}.name`) });
|
||||
@ -303,11 +303,11 @@ class MoveTimeOfDayEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
public timesOfDay: TimeOfDay[];
|
||||
constructor(move: Moves, tod: "day" | "night") {
|
||||
if (tod === "day") {
|
||||
super(p => p.moveset.filter(m => m?.moveId === move).length > 0 && (globalScene.arena.getTimeOfDay() === TimeOfDay.DAWN || globalScene.arena.getTimeOfDay() === TimeOfDay.DAY));
|
||||
super(p => p.moveset.filter(m => m.moveId === move).length > 0 && (globalScene.arena.getTimeOfDay() === TimeOfDay.DAWN || globalScene.arena.getTimeOfDay() === TimeOfDay.DAY));
|
||||
this.move = move;
|
||||
this.timesOfDay = [ TimeOfDay.DAWN, TimeOfDay.DAY ];
|
||||
} else if (tod === "night") {
|
||||
super(p => p.moveset.filter(m => m?.moveId === move).length > 0 && (globalScene.arena.getTimeOfDay() === TimeOfDay.DUSK || globalScene.arena.getTimeOfDay() === TimeOfDay.NIGHT));
|
||||
super(p => p.moveset.filter(m => m.moveId === move).length > 0 && (globalScene.arena.getTimeOfDay() === TimeOfDay.DUSK || globalScene.arena.getTimeOfDay() === TimeOfDay.NIGHT));
|
||||
this.move = move;
|
||||
this.timesOfDay = [ TimeOfDay.DUSK, TimeOfDay.NIGHT ];
|
||||
} else {
|
||||
@ -332,7 +332,7 @@ class DunsparceEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
constructor() {
|
||||
super(p => {
|
||||
let ret = false;
|
||||
if (p.moveset.filter(m => m?.moveId === Moves.HYPER_DRILL).length > 0) {
|
||||
if (p.moveset.filter(m => m.moveId === Moves.HYPER_DRILL).length > 0) {
|
||||
globalScene.executeWithSeedOffset(() => ret = !Utils.randSeedInt(4), p.id);
|
||||
}
|
||||
return ret;
|
||||
|
@ -4267,8 +4267,8 @@ export class LastMoveDoublePowerAttr extends VariablePowerAttr {
|
||||
|
||||
for (const p of pokemonActed) {
|
||||
const [ lastMove ] = p.getLastXMoves(1);
|
||||
if (lastMove?.result !== MoveResult.FAIL) {
|
||||
if ((lastMove?.result === MoveResult.SUCCESS) && (lastMove?.move === this.move)) {
|
||||
if (lastMove.result !== MoveResult.FAIL) {
|
||||
if ((lastMove.result === MoveResult.SUCCESS) && (lastMove.move === this.move)) {
|
||||
power.value *= 2;
|
||||
return true;
|
||||
} else {
|
||||
@ -7093,7 +7093,7 @@ export class RepeatMoveAttr extends MoveEffectAttr {
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
// get the last move used (excluding status based failures) as well as the corresponding moveset slot
|
||||
const lastMove = target.getLastXMoves(-1).find(m => m.move !== Moves.NONE)!;
|
||||
const movesetMove = target.getMoveset().find(m => m?.moveId === lastMove.move)!;
|
||||
const movesetMove = target.getMoveset().find(m => m.moveId === lastMove.move)!;
|
||||
// If the last move used can hit more than one target or has variable targets,
|
||||
// re-compute the targets for the attack
|
||||
// (mainly for alternating double/single battle shenanigans)
|
||||
@ -7127,7 +7127,7 @@ export class RepeatMoveAttr extends MoveEffectAttr {
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (user, target, move) => {
|
||||
const lastMove = target.getLastXMoves(-1).find(m => m.move !== Moves.NONE);
|
||||
const movesetMove = target.getMoveset().find(m => m?.moveId === lastMove?.move);
|
||||
const movesetMove = target.getMoveset().find(m => m.moveId === lastMove?.move);
|
||||
const uninstructableMoves = [
|
||||
// Locking/Continually Executed moves
|
||||
Moves.OUTRAGE,
|
||||
|
@ -732,11 +732,11 @@ async function addEggMoveToNewPokemonMoveset(newPokemon: PlayerPokemon, speciesR
|
||||
* @param newPokemonGeneratedMoveset
|
||||
* @param newEggMoveIndex
|
||||
*/
|
||||
function addFavoredMoveToNewPokemonMoveset(newPokemon: PlayerPokemon, newPokemonGeneratedMoveset: (PokemonMove | null)[], newEggMoveIndex: number | null) {
|
||||
function addFavoredMoveToNewPokemonMoveset(newPokemon: PlayerPokemon, newPokemonGeneratedMoveset: (PokemonMove)[], newEggMoveIndex: number | null) {
|
||||
let favoredMove: PokemonMove | null = null;
|
||||
for (const move of newPokemonGeneratedMoveset) {
|
||||
// Needs to match first type, second type will be replaced
|
||||
if (move?.getMove().type === newPokemon.getTypes()[0] && !newPokemon.moveset.some(m => m.moveId === move?.moveId)) {
|
||||
if (move?.getMove().type === newPokemon.getTypes()[0] && !newPokemon.moveset.some(m => m.moveId === move.moveId)) {
|
||||
favoredMove = move;
|
||||
break;
|
||||
}
|
||||
@ -746,7 +746,7 @@ function addFavoredMoveToNewPokemonMoveset(newPokemon: PlayerPokemon, newPokemon
|
||||
if (!favoredMove) {
|
||||
for (const move of newPokemonGeneratedMoveset) {
|
||||
// Needs to match first type, second type will be replaced
|
||||
if (!newPokemon.moveset.some(m => m.moveId === move?.moveId)) {
|
||||
if (!newPokemon.moveset.some(m => m.moveId === move.moveId)) {
|
||||
favoredMove = move;
|
||||
break;
|
||||
}
|
||||
|
@ -549,17 +549,17 @@ export class MoveRequirement extends EncounterPokemonRequirement {
|
||||
// get the Pokemon with at least one move in the required moves list
|
||||
return partyPokemon.filter((pokemon) =>
|
||||
(!this.excludeDisallowedPokemon || pokemon.isAllowedInBattle())
|
||||
&& pokemon.moveset.some((move) => move?.moveId && this.requiredMoves.includes(move.moveId)));
|
||||
&& pokemon.moveset.some((move) => move.moveId && this.requiredMoves.includes(move.moveId)));
|
||||
} else {
|
||||
// for an inverted query, we only want to get the pokemon that don't have ANY of the listed moves
|
||||
return partyPokemon.filter((pokemon) =>
|
||||
(!this.excludeDisallowedPokemon || pokemon.isAllowedInBattle())
|
||||
&& !pokemon.moveset.some((move) => move?.moveId && this.requiredMoves.includes(move.moveId)));
|
||||
&& !pokemon.moveset.some((move) => move.moveId && this.requiredMoves.includes(move.moveId)));
|
||||
}
|
||||
}
|
||||
|
||||
override getDialogueToken(pokemon?: PlayerPokemon): [string, string] {
|
||||
const includedMoves = pokemon?.moveset.filter((move) => move?.moveId && this.requiredMoves.includes(move.moveId));
|
||||
const includedMoves = pokemon?.moveset.filter((move) => move.moveId && this.requiredMoves.includes(move.moveId));
|
||||
if (includedMoves && includedMoves.length > 0 && includedMoves[0]) {
|
||||
return [ "move", includedMoves[0].getName() ];
|
||||
}
|
||||
|
@ -2320,12 +2320,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
// Sqrt the weight of any damaging moves with overlapping types. This is about a 0.05 - 0.1 multiplier.
|
||||
// Other damaging moves 2x weight if 0-1 damaging moves, 0.5x if 2, 0.125x if 3. These weights double if STAB.
|
||||
// Status moves remain unchanged on weight, this encourages 1-2
|
||||
movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo?.moveId)).map((m) => {
|
||||
movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo.moveId)).map((m) => {
|
||||
let ret: number;
|
||||
if (this.moveset.some(mo => mo?.getMove().category !== MoveCategory.STATUS && mo?.getMove().type === allMoves[m[0]].type)) {
|
||||
ret = Math.ceil(Math.sqrt(m[1]));
|
||||
} else if (allMoves[m[0]].category !== MoveCategory.STATUS) {
|
||||
ret = Math.ceil(m[1] / Math.max(Math.pow(4, this.moveset.filter(mo => (mo?.getMove().power ?? 0) > 1).length) / 8, 0.5) * (this.isOfType(allMoves[m[0]].type) ? 2 : 1));
|
||||
ret = Math.ceil(m[1] / Math.max(Math.pow(4, this.moveset.filter(mo => (mo.getMove().power ?? 0) > 1).length) / 8, 0.5) * (this.isOfType(allMoves[m[0]].type) ? 2 : 1));
|
||||
} else {
|
||||
ret = m[1];
|
||||
}
|
||||
@ -2333,7 +2333,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
});
|
||||
} else {
|
||||
// Non-trainer pokemon just use normal weights
|
||||
movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo?.moveId));
|
||||
movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo.moveId));
|
||||
}
|
||||
const totalWeight = movePool.reduce((v, m) => v + m[1], 0);
|
||||
let rand = Utils.randSeedInt(totalWeight);
|
||||
|
Loading…
Reference in New Issue
Block a user