Commit e9be2905 authored by Chunchi Che's avatar Chunchi Che

fix fts

parent 888bd8b5
Pipeline #23173 passed with stages
in 10 minutes and 47 seconds
...@@ -51,26 +51,28 @@ function getFtsCondtions(conditions: FtsConditions): string { ...@@ -51,26 +51,28 @@ function getFtsCondtions(conditions: FtsConditions): string {
const assertMonster = `(type & ${TYPE_MONSTER}) > 0`; const assertMonster = `(type & ${TYPE_MONSTER}) > 0`;
const typesCondition = types const typesCondition = types
?.map((type) => `(type & ${type}) > 0`) .map((type) => `(type & ${type}) > 0`)
.join(" OR "); .join(" OR ");
const levelsCondition = levels const levelsCondition = levels
?.map((level) => `level = ${level}`) .map((level) => `level = ${level}`)
.join(" OR "); .join(" OR ");
const atkCondition = atk const atkCondition =
? `atk BETWEEN ${handleFinite(atk.min, "min")} AND ${handleFinite( atk.min !== null || atk.max !== null
atk.max, ? `atk BETWEEN ${handleFinite(atk.min, "min")} AND ${handleFinite(
"max", atk.max,
)} AND ${assertMonster}` "max",
: undefined; )} AND ${assertMonster}`
const defCondition = def : undefined;
? `def BETWEEN ${handleFinite(def.min, "min")} AND ${handleFinite( const defCondition =
def.max, def.min !== null || def.max !== null
"max", ? `def BETWEEN ${handleFinite(def.min, "min")} AND ${handleFinite(
)} AND ${assertMonster}` def.max,
: undefined; "max",
const raceCondition = races?.map((race) => `race = ${race}`).join(" OR "); )} AND ${assertMonster}`
: undefined;
const raceCondition = races.map((race) => `race = ${race}`).join(" OR ");
const attributeCondition = attributes const attributeCondition = attributes
?.map((attribute) => `attribute = ${attribute}`) .map((attribute) => `attribute = ${attribute}`)
.join(" OR "); .join(" OR ");
const merged = [ const merged = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment