Rework moveset generation logic and fix window selection crash
This commit is contained in:
1 parent
b2f79c5756
commit
321c3f3e90
3 files changed
+16
-6
No files matched your search
@@ -767,9 +767,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
for (let e = 0; e < evolutionChain.length; e++) {
|
||||
// TODO: Might need to pass specific form index in simulated evolution chain
|
||||
const speciesLevelMoves = getPokemonSpeciesForm(evolutionChain[e][0] as Species, this.formIndex).getLevelMoves();
|
||||
levelMoves.push(...speciesLevelMoves.filter(lm => (includeEvolutionMoves && !lm[0]) || (lm[0] >= evolutionChain[e][1] && (e === evolutionChain.length - 1 || lm[0] <= evolutionChain[e + 1][1]))));
|
||||
levelMoves.push(...speciesLevelMoves.filter(lm => (includeEvolutionMoves && !lm[0]) || ((!e || lm[0] > 1) && (e === evolutionChain.length - 1 || lm[0] <= evolutionChain[e + 1][1]))));
|
||||
}
|
||||
const uniqueMoves: Moves[] = [];
|
||||
levelMoves.sort((lma: [integer, integer], lmb: [integer, integer]) => lma[0] < lmb[0] ? 1 : -1);
|
||||
const uniqueMoves: Moves[] = [];``
|
||||
levelMoves = levelMoves.filter(lm => {
|
||||
if (uniqueMoves.find(m => m === lm[1]))
|
||||
return false;
|
||||
@@ -926,15 +927,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
});
|
||||
|
||||
if (attackMovePool.length) {
|
||||
const randomAttackMove = Utils.randSeedWeightedItem(attackMovePool.reverse());
|
||||
const randomAttackMove = Utils.randSeedEasedWeightedItem(attackMovePool);
|
||||
this.moveset.push(new PokemonMove(randomAttackMove, 0, 0));
|
||||
movePool.splice(movePool.findIndex(m => m === randomAttackMove), 1);
|
||||
}
|
||||
|
||||
while (movePool.length && this.moveset.length < 4) {
|
||||
const randomMove = Utils.randSeedWeightedItem(movePool.reverse());
|
||||
const randomMove = Utils.randSeedEasedWeightedItem(movePool);
|
||||
this.moveset.push(new PokemonMove(randomMove, 0, 0));
|
||||
console.log(allMoves[randomMove]);
|
||||
movePool.splice(movePool.indexOf(randomMove), 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user