Commit 902453b5 authored by fallenstardust's avatar fallenstardust

fix字段查询结果

parent 4077c7c7
...@@ -8,6 +8,17 @@ import ocgcore.enums.CardType; ...@@ -8,6 +8,17 @@ import ocgcore.enums.CardType;
public class Card extends CardData implements Parcelable { public class Card extends CardData implements Parcelable {
public static final int SETCODE_MAX = 4; public static final int SETCODE_MAX = 4;
public static final Creator<Card> CREATOR = new Creator<Card>() {
@Override
public Card createFromParcel(Parcel source) {
return new Card(source);
}
@Override
public Card[] newArray(int size) {
return new Card[size];
}
};
public String Name; public String Name;
public String Desc; public String Desc;
...@@ -26,11 +37,6 @@ public class Card extends CardData implements Parcelable { ...@@ -26,11 +37,6 @@ public class Card extends CardData implements Parcelable {
super(code); super(code);
} }
public Card type(long type) {
this.Type = type;
return this;
}
public Card(CardData cardData) { public Card(CardData cardData) {
super(); super();
if (cardData != null) { if (cardData != null) {
...@@ -49,22 +55,16 @@ public class Card extends CardData implements Parcelable { ...@@ -49,22 +55,16 @@ public class Card extends CardData implements Parcelable {
} }
} }
public int getStar() { protected Card(Parcel in) {
return (Level & 0xff); super(in);
this.Name = in.readString();
this.Desc = in.readString();
} }
public static boolean isType(long Type, CardType type) { public static boolean isType(long Type, CardType type) {
return ((Type & type.value()) != 0); return ((Type & type.value()) != 0);
} }
public boolean isType(CardType type) {
return ((Type & type.value()) != 0);
}
public boolean onlyType(CardType type) {
return (Type == type.value());
}
public static boolean isSpellTrap(long Type) { public static boolean isSpellTrap(long Type) {
return (isType(Type, CardType.Spell) || isType(Type, CardType.Trap)); return (isType(Type, CardType.Spell) || isType(Type, CardType.Trap));
} }
...@@ -73,6 +73,23 @@ public class Card extends CardData implements Parcelable { ...@@ -73,6 +73,23 @@ public class Card extends CardData implements Parcelable {
return (isType(Type, CardType.Fusion) || isType(Type, CardType.Synchro) || isType(Type, CardType.Xyz) || isType(Type, CardType.Link)); return (isType(Type, CardType.Fusion) || isType(Type, CardType.Synchro) || isType(Type, CardType.Xyz) || isType(Type, CardType.Link));
} }
public Card type(long type) {
this.Type = type;
return this;
}
public int getStar() {
return (Level & 0xff);
}
public boolean isType(CardType type) {
return ((Type & type.value()) != 0);
}
public boolean onlyType(CardType type) {
return (Type == type.value());
}
public boolean isSpellTrap() { public boolean isSpellTrap() {
return isSpellTrap(Type); return isSpellTrap(Type);
} }
...@@ -101,15 +118,12 @@ public class Card extends CardData implements Parcelable { ...@@ -101,15 +118,12 @@ public class Card extends CardData implements Parcelable {
} }
public boolean isSetCode(long _setcode) { public boolean isSetCode(long _setcode) {
int settype = (int) _setcode & 0xfff;
int setsubtype = (int) _setcode & 0xf000;
long[] setcodes = getSetCode(); long[] setcodes = getSetCode();
for (long setcode : setcodes) { for (long setcode : setcodes) {
String setcode16=Long.toHexString(setcode); if (((int) setcode & 0xfff) == settype && ((int) setcode & 0xf000 & setsubtype) == setsubtype)
if (setcode16.length()==4){
if (setcode16.endsWith(Long.toHexString(_setcode)))
return true;
}else if (setcode == _setcode) {
return true; return true;
}
} }
return false; return false;
} }
...@@ -133,7 +147,6 @@ public class Card extends CardData implements Parcelable { ...@@ -133,7 +147,6 @@ public class Card extends CardData implements Parcelable {
'}'; '}';
} }
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;
...@@ -145,22 +158,4 @@ public class Card extends CardData implements Parcelable { ...@@ -145,22 +158,4 @@ public class Card extends CardData implements Parcelable {
dest.writeString(this.Name); dest.writeString(this.Name);
dest.writeString(this.Desc); dest.writeString(this.Desc);
} }
protected Card(Parcel in) {
super(in);
this.Name = in.readString();
this.Desc = in.readString();
}
public static final Creator<Card> CREATOR = new Creator<Card>() {
@Override
public Card createFromParcel(Parcel source) {
return new Card(source);
}
@Override
public Card[] newArray(int size) {
return new Card[size];
}
};
} }
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