Fix issue with generating enemy modifiers

pull/2/head
Flashfyre 2023-10-27 16:20:51 -04:00
parent de126dc35c
commit 970d014bfd
2 changed files with 3 additions and 3 deletions

View File

@ -635,7 +635,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
this.scene.field.add(pokemon); this.scene.field.add(pokemon);
if (!this.player) { if (!this.player) {
const playerPokemon = this.scene.getPlayerPokemon() as Pokemon; const playerPokemon = this.scene.getPlayerPokemon() as Pokemon;
if (playerPokemon.visible) if (playerPokemon?.visible)
this.scene.field.moveBelow(pokemon, playerPokemon); this.scene.field.moveBelow(pokemon, playerPokemon);
this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id); this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
this.scene.updateModifiers(false); this.scene.updateModifiers(false);

View File

@ -813,8 +813,8 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
let i = 0; let i = 0;
pool[t].reduce((total: integer, modifierType: WeightedModifierType) => { pool[t].reduce((total: integer, modifierType: WeightedModifierType) => {
const weightedModifierType = modifierType as WeightedModifierType; const weightedModifierType = modifierType as WeightedModifierType;
const existingModifier = party[0].scene.findModifier(m => (m.type.generatorId || m.type.id) === weightedModifierType.modifierType.id); const existingModifiers = party[0].scene.findModifiers(m => (m.type.generatorId || m.type.id) === weightedModifierType.modifierType.id, player);
const weight = !existingModifier || existingModifier.stackCount < existingModifier.getMaxStackCount() const weight = !existingModifiers.length || existingModifiers.filter(m => m.stackCount < m.getMaxStackCount())
? weightedModifierType.weight instanceof Function ? weightedModifierType.weight instanceof Function
? (weightedModifierType.weight as Function)(party) ? (weightedModifierType.weight as Function)(party)
: weightedModifierType.weight as integer : weightedModifierType.weight as integer