Fixed loading filtered properties in contexts where iterators don't have .filter

This commit is contained in:
Thaum Rystra
2024-10-30 10:07:08 +02:00
parent 87325df9fb
commit 2a5a97f04a
2 changed files with 7 additions and 9 deletions

View File

@@ -211,7 +211,7 @@ describe('Apply Damage Properties', function () {
}]);
});
it.only('Applies effects when doing damage', async function () {
it('Applies effects when doing damage', async function () {
const action = await runActionById(damageWithEffectsId, [targetCreatureId]);
assert.exists(action);
assert.deepEqual(allMutations(action), [{

View File

@@ -84,10 +84,9 @@ export function getProperties(creatureId: string): CreatureProperty[] {
export function getPropertiesOfType(creatureId, propType) {
const creature = loadedCreatures.get(creatureId);
if (creature) {
const props = Array.from(
creature.properties.values()
.filter(prop => !prop.removed && prop.type === propType)
).sort((a, b) => a.left - b.left);
const props = Array.from(creature.properties.values())
.filter(prop => !prop.removed && prop.type === propType)
.sort((a, b) => a.left - b.left);
return EJSON.clone(props);
}
// console.time(`Cache miss on creature properties: ${creatureId}`)
@@ -111,10 +110,9 @@ export function getPropertiesOfType(creatureId, propType) {
export function getPropertiesByFilter(creatureId, filterFn: (any) => boolean, mongoFilter: Mongo.Selector<object>) {
const creature = loadedCreatures.get(creatureId);
if (creature) {
const props: CreatureProperty[] = Array.from(
creature.properties.values()
.filter(filterFn)
).sort((a, b) => a.left - b.left);
const props: CreatureProperty[] = Array.from(creature.properties.values())
.filter(filterFn)
.sort((a, b) => a.left - b.left);
return EJSON.clone(props);
}
// console.time(`Cache miss on creature properties: ${creatureId}`)