Fix redundant item update for each transferred item when fusing
parent
702ac190da
commit
0011f6033b
|
@ -1583,7 +1583,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
tryTransferHeldItemModifier(itemModifier: PokemonHeldItemModifier, target: Pokemon, transferStack: boolean, playSound: boolean, instant?: boolean): Promise<boolean> {
|
tryTransferHeldItemModifier(itemModifier: PokemonHeldItemModifier, target: Pokemon, transferStack: boolean, playSound: boolean, instant?: boolean, ignoreUpdate?: boolean): Promise<boolean> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const source = itemModifier.getPokemon(target.scene);
|
const source = itemModifier.getPokemon(target.scene);
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
const cancelled = new Utils.BooleanHolder(false);
|
||||||
|
@ -1611,13 +1611,13 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
const addModifier = () => {
|
const addModifier = () => {
|
||||||
if (!matchingModifier || this.removeModifier(matchingModifier, !target.isPlayer())) {
|
if (!matchingModifier || this.removeModifier(matchingModifier, !target.isPlayer())) {
|
||||||
if (target.isPlayer())
|
if (target.isPlayer())
|
||||||
this.addModifier(newItemModifier, false, playSound, false, instant).then(() => resolve(true));
|
this.addModifier(newItemModifier, ignoreUpdate, playSound, false, instant).then(() => resolve(true));
|
||||||
else
|
else
|
||||||
this.addEnemyModifier(newItemModifier, false, instant).then(() => resolve(true));
|
this.addEnemyModifier(newItemModifier, ignoreUpdate, instant).then(() => resolve(true));
|
||||||
} else
|
} else
|
||||||
resolve(false);
|
resolve(false);
|
||||||
};
|
};
|
||||||
if (source.isPlayer() !== target.isPlayer())
|
if (source.isPlayer() !== target.isPlayer() && !ignoreUpdate)
|
||||||
this.updateModifiers(source.isPlayer(), instant).then(() => addModifier());
|
this.updateModifiers(source.isPlayer(), instant).then(() => addModifier());
|
||||||
else
|
else
|
||||||
addModifier();
|
addModifier();
|
||||||
|
|
|
@ -3826,7 +3826,7 @@ export function initMoves() {
|
||||||
.attr(StatChangeAttr, BattleStat.DEF, -1),
|
.attr(StatChangeAttr, BattleStat.DEF, -1),
|
||||||
new AttackMove(Moves.PRISMATIC_LASER, "Prismatic Laser", Type.PSYCHIC, MoveCategory.SPECIAL, 160, 100, 10, -1, "The user shoots powerful lasers using the power of a prism. The user can't move on the next turn.", -1, 0, 7)
|
new AttackMove(Moves.PRISMATIC_LASER, "Prismatic Laser", Type.PSYCHIC, MoveCategory.SPECIAL, 160, 100, 10, -1, "The user shoots powerful lasers using the power of a prism. The user can't move on the next turn.", -1, 0, 7)
|
||||||
.attr(RechargeAttr),
|
.attr(RechargeAttr),
|
||||||
new AttackMove(Moves.SPECTRAL_THIEF, "Spectral Thief (NP)", Type.GHOST, MoveCategory.PHYSICAL, 90, 100, 10, -1, "The user hides in the target's shadow, steals the target's stat boosts, and then attacks.", -1, 0, 7),
|
new AttackMove(Moves.SPECTRAL_THIEF, "Spectral Thief (P)", Type.GHOST, MoveCategory.PHYSICAL, 90, 100, 10, -1, "The user hides in the target's shadow, steals the target's stat boosts, and then attacks.", -1, 0, 7),
|
||||||
new AttackMove(Moves.SUNSTEEL_STRIKE, "Sunsteel Strike (P)", Type.STEEL, MoveCategory.PHYSICAL, 100, 100, 5, -1, "The user slams into the target with the force of a meteor. This move can be used on the target regardless of its Abilities.", -1, 0, 7),
|
new AttackMove(Moves.SUNSTEEL_STRIKE, "Sunsteel Strike (P)", Type.STEEL, MoveCategory.PHYSICAL, 100, 100, 5, -1, "The user slams into the target with the force of a meteor. This move can be used on the target regardless of its Abilities.", -1, 0, 7),
|
||||||
new AttackMove(Moves.MOONGEIST_BEAM, "Moongeist Beam (P)", Type.GHOST, MoveCategory.SPECIAL, 100, 100, 5, -1, "The user emits a sinister ray to attack the target. This move can be used on the target regardless of its Abilities.", -1, 0, 7),
|
new AttackMove(Moves.MOONGEIST_BEAM, "Moongeist Beam (P)", Type.GHOST, MoveCategory.SPECIAL, 100, 100, 5, -1, "The user emits a sinister ray to attack the target. This move can be used on the target regardless of its Abilities.", -1, 0, 7),
|
||||||
new StatusMove(Moves.TEARFUL_LOOK, "Tearful Look", Type.NORMAL, -1, 20, -1, "The user gets teary eyed to make the target lose its combative spirit. This lowers the target's Attack and Sp. Atk stats.", 100, 0, 7)
|
new StatusMove(Moves.TEARFUL_LOOK, "Tearful Look", Type.NORMAL, -1, 20, -1, "The user gets teary eyed to make the target lose its combative spirit. This lowers the target's Attack and Sp. Atk stats.", 100, 0, 7)
|
||||||
|
|
|
@ -2083,8 +2083,9 @@ export class PlayerPokemon extends Pokemon {
|
||||||
&& (m as PokemonHeldItemModifier).pokemonId === pokemon.id, true) as PokemonHeldItemModifier[];
|
&& (m as PokemonHeldItemModifier).pokemonId === pokemon.id, true) as PokemonHeldItemModifier[];
|
||||||
const transferModifiers: Promise<boolean>[] = [];
|
const transferModifiers: Promise<boolean>[] = [];
|
||||||
for (let modifier of fusedPartyMemberHeldModifiers)
|
for (let modifier of fusedPartyMemberHeldModifiers)
|
||||||
transferModifiers.push(this.scene.tryTransferHeldItemModifier(modifier, this, true, false));
|
transferModifiers.push(this.scene.tryTransferHeldItemModifier(modifier, this, true, false, true, true));
|
||||||
Promise.allSettled(transferModifiers).then(() => {
|
Promise.allSettled(transferModifiers).then(() => {
|
||||||
|
this.scene.updateModifiers(true, true).then(() => {
|
||||||
this.scene.removePartyMemberModifiers(fusedPartyMemberIndex);
|
this.scene.removePartyMemberModifiers(fusedPartyMemberIndex);
|
||||||
this.scene.getParty().splice(fusedPartyMemberIndex, 1)[0];
|
this.scene.getParty().splice(fusedPartyMemberIndex, 1)[0];
|
||||||
pokemon.destroy();
|
pokemon.destroy();
|
||||||
|
@ -2093,6 +2094,7 @@ export class PlayerPokemon extends Pokemon {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
unfuse(): Promise<void> {
|
unfuse(): Promise<void> {
|
||||||
|
|
Loading…
Reference in New Issue