From b9805ceabf41d35b62579f7efe5248184b649f7b Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sun, 24 Mar 2024 18:57:24 -0400 Subject: [PATCH] Update moveset generation logic --- src/field/pokemon.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index f5da67d0b30..2b292735ceb 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -932,17 +932,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { }); if (attackMovePool.length) { - const moveIndex = Utils.randSeedInt(attackMovePool.length); - this.moveset.push(new PokemonMove(attackMovePool[moveIndex], 0, 0)); - console.log(allMoves[attackMovePool[moveIndex]]); - movePool.splice(movePool.findIndex(m => m === attackMovePool[moveIndex]), 1); + const randomAttackMove = Utils.randSeedWeightedItem(attackMovePool.reverse()); + this.moveset.push(new PokemonMove(randomAttackMove, 0, 0)); + movePool.splice(movePool.findIndex(m => m === randomAttackMove), 1); } while (movePool.length && this.moveset.length < 4) { - const moveIndex = Utils.randSeedInt(movePool.length); - this.moveset.push(new PokemonMove(movePool[moveIndex], 0, 0)); - console.log(allMoves[movePool[moveIndex]]); - movePool.splice(moveIndex, 1); + const randomMove = Utils.randSeedWeightedItem(movePool.reverse()); + this.moveset.push(new PokemonMove(randomMove, 0, 0)); + console.log(allMoves[randomMove]); + movePool.splice(movePool.indexOf(randomMove), 1); } this.scene.triggerPokemonFormChange(this, SpeciesFormChangeMoveLearnedTrigger);