Fix issue with generating enemy modifiers
This commit is contained in:
parent
de126dc35c
commit
970d014bfd
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue