mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Merge branch 'master' into 'master'
Memory Leaks, Unused code, compiler warnings, etc. See merge request core-developers/forge!423
This commit is contained in:
@@ -40,6 +40,7 @@ import forge.game.zone.ZoneType;
|
||||
import forge.util.TextUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -215,7 +216,7 @@ public final class GameActionUtil {
|
||||
|
||||
// reset static abilities
|
||||
if (lkicheck) {
|
||||
game.getAction().checkStaticAbilities(false, Sets.newHashSet(), CardCollection.EMPTY);
|
||||
game.getAction().checkStaticAbilities(false, new HashSet<Card>(), CardCollection.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ import forge.item.PaperCard;
|
||||
import forge.util.FileSection;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.storage.StorageBase;
|
||||
import forge.util.storage.StorageReaderFileSections;
|
||||
import forge.util.storage.StorageReaderFolder;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -47,6 +47,10 @@ import forge.util.TextUtil;
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Cost implements Serializable {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private boolean isAbility = true;
|
||||
private final List<CostPart> costParts = Lists.newArrayList();
|
||||
private boolean isMandatory = false;
|
||||
|
||||
@@ -32,6 +32,11 @@ import forge.game.spellability.SpellAbility;
|
||||
* The Class CostAddMana.
|
||||
*/
|
||||
public class CostAddMana extends CostPart {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* CostCostAddMana.
|
||||
* @param amount
|
||||
|
||||
@@ -25,6 +25,11 @@ import forge.game.spellability.SpellAbility;
|
||||
*/
|
||||
public class CostChooseCreatureType extends CostPart {
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost mill.
|
||||
*
|
||||
|
||||
@@ -27,6 +27,11 @@ import forge.game.spellability.SpellAbility;
|
||||
*/
|
||||
public class CostDamage extends CostPart {
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CostDamage(final String amount) {
|
||||
this.setAmount(amount);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,11 @@ public class CostDiscard extends CostPartWithList {
|
||||
|
||||
// Inputs
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost discard.
|
||||
*
|
||||
|
||||
@@ -28,6 +28,11 @@ import java.util.List;
|
||||
* The Class CostPayLife.
|
||||
*/
|
||||
public class CostDraw extends CostPart {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* CostDraw.
|
||||
* @param amount
|
||||
|
||||
@@ -29,6 +29,11 @@ import forge.game.zone.ZoneType;
|
||||
*/
|
||||
public class CostExert extends CostPartWithList {
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost Exert.
|
||||
*
|
||||
|
||||
@@ -38,6 +38,10 @@ public class CostExile extends CostPartWithList {
|
||||
// ExileFromTop<Num/Type{/TypeDescription}> (of library)
|
||||
// ExileSameGrave<Num/Type{/TypeDescription}>
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public final ZoneType from;
|
||||
public final boolean sameZone;
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@ public class CostExileFromStack extends CostPart {
|
||||
// ExileFromStack<Num/Type{/TypeDescription}>
|
||||
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost exile.
|
||||
*
|
||||
|
||||
@@ -29,6 +29,11 @@ import forge.game.zone.ZoneType;
|
||||
* This is for the "ExiledMoveToGrave" Cost.
|
||||
*/
|
||||
public class CostExiledMoveToGrave extends CostPartWithList {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ExiledMoveToGrave<Num/Type{/TypeDescription}>
|
||||
public CostExiledMoveToGrave(final String amount, final String type, final String description) {
|
||||
super(amount, type, description);
|
||||
|
||||
@@ -27,6 +27,11 @@ import forge.game.spellability.SpellAbility;
|
||||
*/
|
||||
public class CostFlipCoin extends CostPartWithList {
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost FlipCoin.
|
||||
*
|
||||
|
||||
@@ -31,6 +31,11 @@ import forge.game.zone.ZoneType;
|
||||
public class CostGainControl extends CostPartWithList {
|
||||
// GainControl<Num/Type{/TypeDescription}>
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost return.
|
||||
*
|
||||
|
||||
@@ -28,6 +28,10 @@ import java.util.List;
|
||||
* The Class CostGainLife.
|
||||
*/
|
||||
public class CostGainLife extends CostPart {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final int cntPlayers; // MAX_VALUE means ALL/EACH PLAYERS
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,11 @@ import forge.game.zone.ZoneType;
|
||||
*/
|
||||
public class CostMill extends CostPartWithList {
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost mill.
|
||||
*
|
||||
|
||||
@@ -31,6 +31,10 @@ import java.io.Serializable;
|
||||
* The Class CostPart.
|
||||
*/
|
||||
public abstract class CostPart implements Comparable<CostPart>, Cloneable, Serializable {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String originalAmount;
|
||||
private String amount;
|
||||
private final String originalType, originalTypeDescription;
|
||||
|
||||
@@ -22,12 +22,14 @@ import forge.card.mana.ManaCostShard;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The mana component of any spell or ability cost
|
||||
*/
|
||||
public class CostPartMana extends CostPart {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
// "Leftover"
|
||||
private final ManaCost cost;
|
||||
private boolean xCantBe0 = false;
|
||||
|
||||
@@ -28,6 +28,10 @@ import forge.game.spellability.SpellAbility;
|
||||
* The Class CostPartWithList.
|
||||
*/
|
||||
public abstract class CostPartWithList extends CostPart {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** The lists: one for LKI, one for the actual cards. */
|
||||
private final CardCollection lkiList = new CardCollection();
|
||||
protected final CardCollection cardList = new CardCollection();
|
||||
|
||||
@@ -27,6 +27,11 @@ import forge.game.spellability.SpellAbility;
|
||||
|
||||
|
||||
public class CostPayEnergy extends CostPart {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
int paidAmount = 0;
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,10 @@ import forge.game.spellability.SpellAbility;
|
||||
* The Class CostPayLife.
|
||||
*/
|
||||
public class CostPayLife extends CostPart {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
int paidAmount = 0;
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,10 @@ public class CostPutCardToLib extends CostPartWithList {
|
||||
// PutCardToLibFromSameGrave<Num/LibPos/Type{/TypeDescription}>
|
||||
// PutCardToLibFromGrave<Num/LibPos/Type{/TypeDescription}>
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public final ZoneType from;
|
||||
public final boolean sameZone;
|
||||
private String libPosition = "0";
|
||||
|
||||
@@ -32,7 +32,11 @@ import java.util.List;
|
||||
* The Class CostPutCounter.
|
||||
*/
|
||||
public class CostPutCounter extends CostPartWithList {
|
||||
// Put Counter doesn't really have a "Valid" portion of the cost
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
// Put Counter doesn't really have a "Valid" portion of the cost
|
||||
private final CounterType counter;
|
||||
private int lastPaidAmount = 0;
|
||||
|
||||
|
||||
@@ -30,6 +30,10 @@ import java.util.Map;
|
||||
* The Class CostRemoveAnyCounter.
|
||||
*/
|
||||
public class CostRemoveAnyCounter extends CostPartWithList {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
// RemoveAnyCounter<Num/Type/{TypeDescription}>
|
||||
// Power Conduit and Chisei, Heart of Oceans
|
||||
// Both cards have "Remove a counter from a permanent you control"
|
||||
|
||||
@@ -40,6 +40,10 @@ public class CostRemoveCounter extends CostPartWithList {
|
||||
// Quillspike, Rift Elemental, Sage of Fables, Spike Rogue
|
||||
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public final CounterType counter;
|
||||
public final ZoneType zone;
|
||||
private int cntRemoved;
|
||||
|
||||
@@ -30,6 +30,12 @@ import forge.game.zone.ZoneType;
|
||||
public class CostReturn extends CostPartWithList {
|
||||
// Return<Num/Type{/TypeDescription}>
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new cost return.
|
||||
*
|
||||
|
||||
@@ -33,6 +33,11 @@ import forge.game.zone.ZoneType;
|
||||
public class CostReveal extends CostPartWithList {
|
||||
// Reveal<Num/Type/TypeDescription>
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CostReveal(final String amount, final String type, final String description) {
|
||||
super(amount, type, description);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,11 @@ import forge.game.zone.ZoneType;
|
||||
*/
|
||||
public class CostSacrifice extends CostPartWithList {
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost sacrifice.
|
||||
*
|
||||
|
||||
@@ -26,6 +26,11 @@ import forge.game.spellability.SpellAbility;
|
||||
*/
|
||||
public class CostTap extends CostPart {
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost tap.
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,10 @@ import forge.util.TextUtil;
|
||||
*/
|
||||
public class CostTapType extends CostPartWithList {
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public final boolean canTapSource;
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,6 +32,12 @@ public class CostUnattach extends CostPartWithList {
|
||||
// Unattach<CARDNAME> if ability is on the Equipment
|
||||
// Unattach<Card.Attached+namedHeartseeker/Equipped Heartseeker> if equipped creature has the ability
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new cost unattach.
|
||||
*/
|
||||
|
||||
@@ -26,6 +26,11 @@ import forge.game.spellability.SpellAbility;
|
||||
*/
|
||||
public class CostUntap extends CostPart {
|
||||
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Instantiates a new cost untap.
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,10 @@ import forge.game.zone.ZoneType;
|
||||
* The Class CostUntapType.
|
||||
*/
|
||||
public class CostUntapType extends CostPartWithList {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public final boolean canUntapSource;
|
||||
|
||||
public CostUntapType(final String amount, final String type, final String description, boolean hasUntapInPrice) {
|
||||
|
||||
@@ -20,8 +20,6 @@ package forge.game.mana;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.card.mana.IParserManaCost;
|
||||
|
||||
@@ -5,6 +5,10 @@ import forge.game.cost.Cost;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class OptionalCostValue implements Serializable {
|
||||
/**
|
||||
* Serializables need a version ID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private OptionalCost type;
|
||||
private Cost cost;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user