feat(scanner): validate elevated live automation
This commit is contained in:
@@ -276,14 +276,15 @@ function findMainValue(text: string, mainStat: string, slot: string, level: numb
|
||||
}
|
||||
|
||||
function extractPercentValue(text: string) {
|
||||
const percentPattern = /([0-9]{1,3}(?:\s*[.,:\u00B7]\s*[0-9])?)\s*%/;
|
||||
const lineMatches = text
|
||||
.split("\n")
|
||||
.map((line) => line.match(/([0-9]{1,3}(?:[.,:\u00B7][0-9])?)\s*%/))
|
||||
.map((line) => line.match(percentPattern))
|
||||
.filter((match): match is RegExpMatchArray => Boolean(match));
|
||||
|
||||
const preferred = lineMatches[0] ?? text.match(/([0-9]{1,3}(?:[.,:\u00B7][0-9])?)\s*%/);
|
||||
const preferred = lineMatches[0] ?? text.match(percentPattern);
|
||||
if (!preferred?.[1]) return "";
|
||||
return `${preferred[1].replace(/[:,\u00B7]/g, ".")}%`;
|
||||
return `${normalizeMainValue(preferred[1])}%`;
|
||||
}
|
||||
|
||||
function inferMainStat(slot: string, text: string): ParsedField {
|
||||
@@ -302,7 +303,7 @@ function inferMainStat(slot: string, text: string): ParsedField {
|
||||
|
||||
function findDirectMainStat(text: string) {
|
||||
const compact = simplifyForMatch(text);
|
||||
const hasPercentValue = /[0-9]{1,3}(?:\.[0-9])?\s*%/.test(text);
|
||||
const hasPercentValue = /[0-9]{1,3}(?:\s*[.,:\u00B7]\s*[0-9])?\s*%/.test(text);
|
||||
const priority = [
|
||||
"Physical DMG Bonus",
|
||||
"Elemental Mastery",
|
||||
@@ -481,7 +482,7 @@ function isPercentMainStat(stat: string) {
|
||||
}
|
||||
|
||||
function promotePercentVariant(stat: string, text: string) {
|
||||
if (["ATK", "HP", "DEF"].includes(stat) && /[0-9]{1,3}(?:\.[0-9])?\s*%/.test(text)) return `${stat}%`;
|
||||
if (["ATK", "HP", "DEF"].includes(stat) && /[0-9]{1,3}(?:\s*[.,:\u00B7]\s*[0-9])?\s*%/.test(text)) return `${stat}%`;
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user