mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-22 00:21:31 +00:00
Add utility for getting requirement that's met when a conversion can convert
This commit is contained in:
parent
d7a2049ca2
commit
d3a74da5ab
1 changed files with 17 additions and 0 deletions
|
@ -292,3 +292,20 @@ export function setupPassiveGeneration(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates requirement that is met when the conversion hits a specified gain amount
|
||||||
|
* @param conversion The conversion to check the gain amount of
|
||||||
|
* @param minGainAmount The minimum gain amount that must be met for the requirement to be met
|
||||||
|
*/
|
||||||
|
export function createCanConvertRequirement(
|
||||||
|
conversion: GenericConversion,
|
||||||
|
minGainAmount: Computable<DecimalSource> = 1,
|
||||||
|
display?: CoercableComponent
|
||||||
|
) {
|
||||||
|
const computedMinGainAmount = convertComputable(minGainAmount);
|
||||||
|
return createBooleanRequirement(
|
||||||
|
() => Decimal.gte(unref(conversion.actualGain), unref(computedMinGainAmount)),
|
||||||
|
display
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue