mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 16:56:11 +00:00
Ignore erroring modifiers when loading session
This commit is contained in:
parent
eae0d907c5
commit
2d1fabdc03
@ -32,18 +32,23 @@ export default class ModifierData {
|
|||||||
if (!typeFunc)
|
if (!typeFunc)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
let type = typeFunc();
|
try {
|
||||||
type.id = this.typeId;
|
let type = typeFunc();
|
||||||
type.generatorId = this.typeGeneratorId;
|
type.id = this.typeId;
|
||||||
|
type.generatorId = this.typeGeneratorId;
|
||||||
|
|
||||||
if (type instanceof ModifierTypeGenerator)
|
if (type instanceof ModifierTypeGenerator)
|
||||||
type = (type as ModifierTypeGenerator).generateType(this.player ? scene.getParty() : scene.getEnemyField(), this.typePregenArgs);
|
type = (type as ModifierTypeGenerator).generateType(this.player ? scene.getParty() : scene.getEnemyField(), this.typePregenArgs);
|
||||||
|
|
||||||
const ret = Reflect.construct(constructor, ([ type ] as any[]).concat(this.args).concat(this.stackCount)) as PersistentModifier;
|
const ret = Reflect.construct(constructor, ([ type ] as any[]).concat(this.args).concat(this.stackCount)) as PersistentModifier;
|
||||||
|
|
||||||
if (ret.stackCount > ret.getMaxStackCount(scene))
|
if (ret.stackCount > ret.getMaxStackCount(scene))
|
||||||
ret.stackCount = ret.getMaxStackCount(scene);
|
ret.stackCount = ret.getMaxStackCount(scene);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user