mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-21 06:49:35 +02:00
Remove some bangs/etc
This commit is contained in:
parent
8496255a04
commit
a48db1cedd
@ -2453,15 +2453,19 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
||||
pokemon.setStatStage(s, target.getStatStage(s));
|
||||
}
|
||||
|
||||
pokemon.summonData.moveset = target.getMoveset().map(m => {
|
||||
const pp = m?.getMove().pp ?? 0;
|
||||
// If PP value is less than 5, do nothing. If greater, we need to reduce the value to 5.
|
||||
return new PokemonMove(m?.moveId!, 0, 0, false, Math.min(pp, 5));
|
||||
pokemon.summonData.moveset = target.getMoveset().map((m) => {
|
||||
if (m) {
|
||||
// If PP value is less than 5, do nothing. If greater, we need to reduce the value to 5.
|
||||
return new PokemonMove(m.moveId, 0, 0, false, Math.min(m.getMove().pp, 5));
|
||||
} else {
|
||||
console.warn(`Imposter: somehow iterating over a ${m} value when copying moveset!`);
|
||||
return new PokemonMove(Moves.NONE);
|
||||
}
|
||||
});
|
||||
pokemon.summonData.types = target.getTypes();
|
||||
promises.push(pokemon.updateInfo());
|
||||
|
||||
pokemon.scene.queueMessage(i18next.t("abilityTriggers:postSummonTransform", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), targetName: target!.name, }));
|
||||
pokemon.scene.queueMessage(i18next.t("abilityTriggers:postSummonTransform", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), targetName: target.name, }));
|
||||
pokemon.scene.playSound("battle_anims/PRSFX- Transform");
|
||||
promises.push(pokemon.loadAssets(false).then(() => {
|
||||
pokemon.playAnim();
|
||||
|
@ -6668,10 +6668,14 @@ export class TransformAttr extends MoveEffectAttr {
|
||||
user.setStatStage(s, target.getStatStage(s));
|
||||
}
|
||||
|
||||
user.summonData.moveset = target.getMoveset().map(m => {
|
||||
const pp = m?.getMove().pp ?? 0;
|
||||
// If PP value is less than 5, do nothing. If greater, we need to reduce the value to 5.
|
||||
return new PokemonMove(m?.moveId!, 0, 0, false, Math.min(pp, 5));
|
||||
user.summonData.moveset = target.getMoveset().map((m) => {
|
||||
if (m) {
|
||||
// If PP value is less than 5, do nothing. If greater, we need to reduce the value to 5.
|
||||
return new PokemonMove(m.moveId, 0, 0, false, Math.min(m.getMove().pp, 5));
|
||||
} else {
|
||||
console.warn(`Transform: somehow iterating over a ${m} value when copying moveset!`);
|
||||
return new PokemonMove(Moves.NONE);
|
||||
}
|
||||
});
|
||||
user.summonData.types = target.getTypes();
|
||||
promises.push(user.updateInfo());
|
||||
|
@ -4431,7 +4431,7 @@ export class PlayerPokemon extends Pokemon {
|
||||
this.scene.removePartyMemberModifiers(fusedPartyMemberIndex);
|
||||
this.scene.getParty().splice(fusedPartyMemberIndex, 1)[0];
|
||||
const newPartyMemberIndex = this.scene.getParty().indexOf(this);
|
||||
pokemon.getMoveset(true).map(m => this.scene.unshiftPhase(new LearnMovePhase(this.scene, newPartyMemberIndex, m!.getMove().id))); // TODO: is the bang correct?
|
||||
pokemon.getMoveset(true).map((m: PokemonMove) => this.scene.unshiftPhase(new LearnMovePhase(this.scene, newPartyMemberIndex, m.getMove().id)));
|
||||
pokemon.destroy();
|
||||
this.updateFusionPalette();
|
||||
resolve();
|
||||
@ -4452,8 +4452,12 @@ export class PlayerPokemon extends Pokemon {
|
||||
/** Returns a deep copy of this Pokemon's moveset array */
|
||||
copyMoveset(): PokemonMove[] {
|
||||
const newMoveset : PokemonMove[] = [];
|
||||
this.moveset.forEach(move =>
|
||||
newMoveset.push(new PokemonMove(move!.moveId, 0, move!.ppUp, move!.virtual, move!.maxPpOverride))); // TODO: are those bangs correct?
|
||||
this.moveset.forEach((move) => {
|
||||
// TODO: refactor `moveset` to not accept `null`s
|
||||
if (move) {
|
||||
newMoveset.push(new PokemonMove(move.moveId, 0, move.ppUp, move.virtual, move.maxPpOverride));
|
||||
}
|
||||
});
|
||||
|
||||
return newMoveset;
|
||||
}
|
||||
@ -5190,11 +5194,11 @@ export class PokemonMove {
|
||||
*/
|
||||
public maxPpOverride?: number;
|
||||
|
||||
constructor(moveId: Moves, ppUsed?: number, ppUp?: number, virtual?: boolean, maxPpOverride?: number) {
|
||||
constructor(moveId: Moves, ppUsed: number = 0, ppUp: number = 0, virtual: boolean = false, maxPpOverride?: number) {
|
||||
this.moveId = moveId;
|
||||
this.ppUsed = ppUsed || 0;
|
||||
this.ppUp = ppUp || 0;
|
||||
this.virtual = !!virtual;
|
||||
this.ppUsed = ppUsed;
|
||||
this.ppUp = ppUp;
|
||||
this.virtual = virtual;
|
||||
this.maxPpOverride = maxPpOverride;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user