mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-26 06:35:45 +00:00
add Mirrored Tablet
Co-authored-by: sithrebel15 <anthonycorrado2@gmail.com>
This commit is contained in:
co-authored by
sithrebel15
parent
cf321af2eb
commit
2beef00db8
@@ -52,6 +52,7 @@ const parsers: Array<ParserFn | { virtual: VirtualParserFn }> = [
|
||||
parseHeistBlueprint,
|
||||
parseAreaLevel,
|
||||
parseAtzoatlRooms,
|
||||
parseMirroredTablet,
|
||||
parseMirrored,
|
||||
parseSentinelCharge,
|
||||
parseLogbookArea,
|
||||
@@ -784,7 +785,8 @@ function parseAreaLevelNested (section: string[], item: ParsedItem) {
|
||||
function parseAreaLevel (section: string[], item: ParsedItem) {
|
||||
if (
|
||||
item.info.refName !== 'Chronicle of Atzoatl' &&
|
||||
item.info.refName !== 'Expedition Logbook'
|
||||
item.info.refName !== 'Expedition Logbook' &&
|
||||
item.info.refName !== 'Mirrored Tablet'
|
||||
) return 'PARSER_SKIPPED'
|
||||
|
||||
parseAreaLevelNested(section, item)
|
||||
@@ -830,6 +832,28 @@ function parseAtzoatlRooms (section: string[], item: ParsedItem) {
|
||||
return 'SECTION_PARSED'
|
||||
}
|
||||
|
||||
function parseMirroredTablet (section: string[], item: ParsedItem) {
|
||||
if (item.info.refName !== 'Mirrored Tablet') return 'PARSER_SKIPPED'
|
||||
if (section.length < 8) return 'SECTION_SKIPPED'
|
||||
|
||||
for (const line of section) {
|
||||
const found = tryParseTranslation({ string: line, unscalable: true }, ModifierType.Pseudo)
|
||||
if (found) {
|
||||
item.newMods.push({
|
||||
info: { tags: [], type: ModifierType.Pseudo },
|
||||
stats: [found]
|
||||
})
|
||||
} else {
|
||||
item.unknownModifiers.push({
|
||||
text: line,
|
||||
type: ModifierType.Pseudo
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return 'SECTION_PARSED'
|
||||
}
|
||||
|
||||
function markupConditionParser (text: string) {
|
||||
// ignores state set by <<set:__>>
|
||||
// always evaluates first condition to true <if:__>{...}
|
||||
|
||||
@@ -63,15 +63,19 @@ export function sumStatsByModType (mods: readonly ParsedModifier[]): StatCalcula
|
||||
}
|
||||
|
||||
export function statSourcesTotal (
|
||||
sources: StatSource[]
|
||||
sources: StatSource[],
|
||||
mode: 'sum' | 'max' = 'sum'
|
||||
): StatRoll | undefined {
|
||||
const fn = (mode === 'sum')
|
||||
? ((a: number, b: number) => a + b)
|
||||
: ((a: number, b: number) => Math.max(a, b))
|
||||
return (sources.length === 1)
|
||||
? (sources[0].contributes)
|
||||
: (sources.reduce((sum, { contributes }) => {
|
||||
contributes = contributes ?? { value: 1, min: 1, max: 1 }
|
||||
sum.value += contributes.value
|
||||
sum.min += contributes.min
|
||||
sum.max += contributes.max
|
||||
sum.value = fn(sum.value, contributes.value)
|
||||
sum.min = fn(sum.min, contributes.min)
|
||||
sum.max = fn(sum.max, contributes.max)
|
||||
return sum
|
||||
}, { value: 0, min: 0, max: 0 }))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user