mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Revert serializability of Keywords as this would require serializability
of Card - Until this is fixed in some way, use a Multiset of Strings for the collection of keywords in PlayerView
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
*/
|
||||
package forge.game.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostParser;
|
||||
import forge.game.CardTraitBase;
|
||||
@@ -27,12 +32,6 @@ import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.TextUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Cost class.
|
||||
@@ -41,9 +40,7 @@ import com.google.common.collect.Lists;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Cost implements Serializable {
|
||||
private static final long serialVersionUID = -8483455045558996502L;
|
||||
|
||||
public class Cost {
|
||||
private boolean isAbility = true;
|
||||
private final List<CostPart> costParts = new ArrayList<CostPart>();
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package forge.game.keyword;
|
||||
|
||||
public class Cycling extends KeywordWithCost {
|
||||
private static final long serialVersionUID = 8536162621947386491L;
|
||||
|
||||
private String type;
|
||||
|
||||
public Cycling() {
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package forge.game.keyword;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public abstract class KeywordInstance<T extends KeywordInstance<?>> implements Serializable {
|
||||
private static final long serialVersionUID = -8515507185693606389L;
|
||||
|
||||
public abstract class KeywordInstance<T extends KeywordInstance<?>> {
|
||||
private Keyword keyword;
|
||||
|
||||
public Keyword getKeyword() {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package forge.game.keyword;
|
||||
|
||||
public class KeywordWithAmount extends KeywordInstance<KeywordWithAmount> {
|
||||
private static final long serialVersionUID = -6408982505204494940L;
|
||||
|
||||
private int amount;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,8 +3,6 @@ package forge.game.keyword;
|
||||
import forge.game.cost.Cost;
|
||||
|
||||
public class KeywordWithCost extends KeywordInstance<KeywordWithCost> {
|
||||
private static final long serialVersionUID = -7098601166417743182L;
|
||||
|
||||
private Cost cost;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,8 +3,6 @@ package forge.game.keyword;
|
||||
import forge.game.cost.Cost;
|
||||
|
||||
public class KeywordWithCostAndAmount extends KeywordInstance<KeywordWithCostAndAmount> {
|
||||
private static final long serialVersionUID = 1905194735777019844L;
|
||||
|
||||
private Cost cost;
|
||||
private int amount;
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ package forge.game.keyword;
|
||||
import forge.game.cost.Cost;
|
||||
|
||||
public class KeywordWithCostAndType extends KeywordInstance<KeywordWithCostAndType> {
|
||||
private static final long serialVersionUID = -5457093564089570731L;
|
||||
|
||||
private Cost cost;
|
||||
private String type;
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package forge.game.keyword;
|
||||
|
||||
public class KeywordWithType extends KeywordInstance<KeywordWithType> {
|
||||
private static final long serialVersionUID = 4959671775512932812L;
|
||||
|
||||
private String type;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package forge.game.keyword;
|
||||
|
||||
public class Protection extends KeywordInstance<Protection> {
|
||||
private static final long serialVersionUID = 1369152260269203025L;
|
||||
|
||||
private String fromWhat;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package forge.game.keyword;
|
||||
|
||||
public class SimpleKeyword extends KeywordInstance<SimpleKeyword> {
|
||||
private static final long serialVersionUID = -4662161707875676173L;
|
||||
|
||||
@Override
|
||||
protected void parse(String details) {
|
||||
//don't need to merge details for simple keywords
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package forge.game.keyword;
|
||||
|
||||
public class UndefinedKeyword extends KeywordInstance<UndefinedKeyword> {
|
||||
private static final long serialVersionUID = 1016294080901302718L;
|
||||
|
||||
private String keyword;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.Map.Entry;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableMultiset;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -18,7 +19,6 @@ import forge.card.MagicColor;
|
||||
import forge.game.GameEntityView;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardView;
|
||||
import forge.game.keyword.KeywordCollection.KeywordCollectionView;
|
||||
import forge.game.zone.PlayerZone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.trackable.TrackableCollection;
|
||||
@@ -184,24 +184,23 @@ public class PlayerView extends GameEntityView {
|
||||
set(TrackableProperty.NumDrawnThisTurn, p.getNumDrawnThisTurn());
|
||||
}
|
||||
|
||||
public KeywordCollectionView getKeywords() {
|
||||
public ImmutableMultiset<String> getKeywords() {
|
||||
return get(TrackableProperty.Keywords);
|
||||
}
|
||||
public List<String> getDisplayableKeywords() {
|
||||
final List<String> allKws;
|
||||
final KeywordCollectionView kws = getKeywords();
|
||||
final ImmutableMultiset<String> kws = getKeywords();
|
||||
synchronized (kws) {
|
||||
allKws = Lists.newArrayList(kws);
|
||||
}
|
||||
while (allKws.remove("CanSeeOpponentsFaceDownCards")) {
|
||||
allKws = Lists.newArrayList(kws.elementSet());
|
||||
}
|
||||
allKws.remove("CanSeeOpponentsFaceDownCards");
|
||||
return allKws;
|
||||
}
|
||||
public boolean hasKeyword(String keyword) {
|
||||
return getKeywords().contains(keyword);
|
||||
}
|
||||
void updateKeywords(Player p) {
|
||||
set(TrackableProperty.Keywords, p.getKeywords());
|
||||
set(TrackableProperty.Keywords, ImmutableMultiset.copyOf(p.getKeywords()));
|
||||
}
|
||||
|
||||
public CardView getCommander() {
|
||||
|
||||
Reference in New Issue
Block a user