diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 73f844668..59d5979ac 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -635,7 +635,7 @@ export class SummonPhase extends PartyMemberPokemonPhase { this.scene.field.add(pokemon); if (!this.player) { const playerPokemon = this.scene.getPlayerPokemon() as Pokemon; - if (playerPokemon.visible) + if (playerPokemon?.visible) this.scene.field.moveBelow(pokemon, playerPokemon); this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id); this.scene.updateModifiers(false); diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 76b636194..017fd90a7 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -813,8 +813,8 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod let i = 0; pool[t].reduce((total: integer, modifierType: WeightedModifierType) => { const weightedModifierType = modifierType as WeightedModifierType; - const existingModifier = party[0].scene.findModifier(m => (m.type.generatorId || m.type.id) === weightedModifierType.modifierType.id); - const weight = !existingModifier || existingModifier.stackCount < existingModifier.getMaxStackCount() + const existingModifiers = party[0].scene.findModifiers(m => (m.type.generatorId || m.type.id) === weightedModifierType.modifierType.id, player); + const weight = !existingModifiers.length || existingModifiers.filter(m => m.stackCount < m.getMaxStackCount()) ? weightedModifierType.weight instanceof Function ? (weightedModifierType.weight as Function)(party) : weightedModifierType.weight as integer