Commit 8b3e0b2d authored by feihuaduo's avatar feihuaduo

非效果怪兽卡查规则优化

卡查主字段可搜索到子字段(例:英雄——元素英雄)
parent 7b7cc6b8
...@@ -130,64 +130,54 @@ class CardSearchInfo { ...@@ -130,64 +130,54 @@ class CardSearchInfo {
if (types.length > 0) { if (types.length > 0) {
boolean st = false; boolean st = false;
for (long cardType : types) { for (long cardType : types) {
// if (cardType == CardType.Spell.value() || cardType == CardType.Trap.value()) { if (cardType == CardType.Spell.value() || cardType == CardType.Trap.value()) {
// st = true; st = true;
// break; break;
// } }
//非效果怪兽 }
if (cardType == CardType.Non_Effect.value()) {
//如果不是融合/仪式/同调/超量/连接 for (long type : types) {
if ((card.Type & CardType.Fusion.value()) != CardType.Fusion.value() if (type > 0) {
&& (card.Type & CardType.Ritual.value()) != CardType.Ritual.value() if (st) {
&& (card.Type & CardType.Synchro.value()) != CardType.Synchro.value() //魔法
&& (card.Type & CardType.Xyz.value()) != CardType.Xyz.value() if (type == CardType.Normal.value()) {
&& (card.Type & CardType.Link.value()) != CardType.Link.value() //通常
) if (card.isType(CardType.Normal)) {
//带通常的魔法陷阱
if (card.Type != (CardType.Spell.value() | CardType.Normal.value())
&& card.Type != (CardType.Trap.value() | CardType.Normal.value())) {
return false;
}
} else {
//只有魔法/陷阱
if (card.Type != CardType.Spell.value() && card.Type != CardType.Trap.value())
return false;
}
continue;
}
}
//如果是效果怪兽
if (type == CardType.Effect.value()) {
if ((card.Type & CardType.Effect.value()) == CardType.Effect.value()) {
//如果是融合/仪式/同调/超量/连接
if ((card.Type & CardType.Fusion.value()) == CardType.Fusion.value()
|| (card.Type & CardType.Ritual.value()) == CardType.Ritual.value()
|| (card.Type & CardType.Synchro.value()) == CardType.Synchro.value()
|| (card.Type & CardType.Xyz.value()) == CardType.Xyz.value()
|| (card.Type & CardType.Link.value()) == CardType.Link.value()
)
return false;
}
}else if (type == CardType.Non_Effect.value()) {
//非效果怪兽
if ((card.Type & CardType.Effect.value()) == CardType.Effect.value())
return false;
}else if ((card.Type & type) != type) {
return false; return false;
} else if ((card.Type & cardType) != cardType) { }
return false;
} }
} }
//
// for (long type : types) {
// if (type > 0) {
// if (st) {
// //魔法
// if (type == CardType.Normal.value()) {
// //通常
// if (card.isType(CardType.Normal)) {
// //带通常的魔法陷阱
// if (card.Type != (CardType.Spell.value() | CardType.Normal.value())
// && card.Type != (CardType.Trap.value() | CardType.Normal.value())) {
// return false;
// }
// } else {
// //只有魔法/陷阱
// if (card.Type != CardType.Spell.value() && card.Type != CardType.Trap.value())
// return false;
// }
// continue;
// }
// }
// if ((card.Type & type) != type) {
// return false;
// }
// //如果是效果怪兽
// if (type == CardType.Effect.value()) {
// if ((card.Type & CardType.Effect.value()) == CardType.Effect.value()) {
// //如果是融合/仪式/同调/超量/连接
// if ((card.Type & CardType.Fusion.value()) == CardType.Fusion.value()
// || (card.Type & CardType.Ritual.value()) == CardType.Ritual.value()
// || (card.Type & CardType.Synchro.value()) == CardType.Synchro.value()
// || (card.Type & CardType.Xyz.value()) == CardType.Xyz.value()
// || (card.Type & CardType.Link.value()) == CardType.Link.value()
// )
// return false;
// }
// }
//
// }
// }
} }
//TODO setcode //TODO setcode
if (setcode > 0) { if (setcode > 0) {
......
...@@ -103,7 +103,11 @@ public class Card extends CardData implements Parcelable { ...@@ -103,7 +103,11 @@ public class Card extends CardData implements Parcelable {
public boolean isSetCode(long _setcode) { public boolean isSetCode(long _setcode) {
long[] setcodes = getSetCode(); long[] setcodes = getSetCode();
for (long setcode : setcodes) { for (long setcode : setcodes) {
if (setcode == _setcode) { String setcode16=Long.toHexString(setcode);
if (setcode16.length()==4){
if (setcode16.endsWith(Long.toHexString(_setcode)))
return true;
}else if (setcode == _setcode) {
return true; return true;
} }
} }
......
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