Commit 2fbf92b5 authored by Chunchi Che's avatar Chunchi Che

修复组卡页过滤器(灵摆怪兽条件下选择特定星级无法搜出卡)

parent cda9dcde
...@@ -48,14 +48,17 @@ export function invokeFts(db: Database, params: FtsParams): CardMeta[] { ...@@ -48,14 +48,17 @@ export function invokeFts(db: Database, params: FtsParams): CardMeta[] {
} }
function getFtsCondtions(conditions: FtsConditions): string { function getFtsCondtions(conditions: FtsConditions): string {
const { types, levels, atk, def, races, attributes } = conditions; const { types, levels, lscales, atk, def, races, attributes } = conditions;
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 & 0xff) = ${level}`)
.join(" OR ");
const lscalesCondition = lscales
.map((lscale) => `((level >> 0x18) & 0xff) = ${lscale}`)
.join(" OR "); .join(" OR ");
const atkCondition = const atkCondition =
atk.min !== null || atk.max !== null atk.min !== null || atk.max !== null
...@@ -79,6 +82,7 @@ function getFtsCondtions(conditions: FtsConditions): string { ...@@ -79,6 +82,7 @@ function getFtsCondtions(conditions: FtsConditions): string {
const merged = [ const merged = [
typesCondition, typesCondition,
levelsCondition, levelsCondition,
lscalesCondition,
atkCondition, atkCondition,
defCondition, defCondition,
raceCondition, raceCondition,
......
...@@ -115,7 +115,6 @@ export const Filter: React.FC<{ ...@@ -115,7 +115,6 @@ export const Filter: React.FC<{
type="primary" type="primary"
onClick={() => { onClick={() => {
onConfirm(newConditions); onConfirm(newConditions);
console.log(newConditions);
}} }}
> >
确定 确定
......
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