[refactor] removed generic parameter from Cost

This commit is contained in:
North 2014-06-02 22:30:01 +03:00
parent a6f1bc7f00
commit e2c7fdf121
103 changed files with 105 additions and 118 deletions

View file

@ -3,7 +3,7 @@ package mage.abilities.costs;
import mage.abilities.Ability;
import mage.game.Game;
public class AlternativeCostImpl<T extends AlternativeCostImpl<T>> extends CostsImpl<Cost> implements AlternativeCost {
public class AlternativeCostImpl extends CostsImpl implements AlternativeCost {
protected String name;

View file

@ -33,16 +33,13 @@ import mage.target.Targets;
import java.util.UUID;
public abstract class CostImpl<T extends CostImpl<T>> implements Cost {
public abstract class CostImpl implements Cost {
protected UUID id;
protected String text;
protected boolean paid;
protected Targets targets;
@Override
public abstract T copy();
public CostImpl() {
id = UUID.randomUUID();
paid = false;

View file

@ -35,7 +35,7 @@ package mage.abilities.costs;
*/
public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl<T>> extends CostsImpl<Cost> implements OptionalAdditionalCost{
public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl> extends CostsImpl<Cost> implements OptionalAdditionalCost{
protected String name;

View file

@ -38,10 +38,9 @@ import mage.target.Targets;
/**
*
* @author LevelX2
* @param <T> variable cost type
*/
public abstract class VariableCostImpl<T extends VariableCostImpl<T>> implements Cost, VariableCost {
public abstract class VariableCostImpl implements Cost, VariableCost {
protected UUID id;
protected String text;
@ -51,9 +50,6 @@ public abstract class VariableCostImpl<T extends VariableCostImpl<T>> implements
protected String xText;
protected String actionText;
@Override
public abstract T copy();
public VariableCostImpl(String actionText) {
this("X", actionText);
}

View file

@ -7,7 +7,7 @@ import mage.game.Game;
import java.util.UUID;
public class ControlPermanentCost extends CostImpl<ControlPermanentCost> {
public class ControlPermanentCost extends CostImpl {
private FilterControlledPermanent filter;
public ControlPermanentCost(FilterControlledPermanent filter) {

View file

@ -40,7 +40,7 @@ import mage.players.Player;
* @author LevelX2
*/
public class DiscardHandCost extends CostImpl<DiscardHandCost> {
public class DiscardHandCost extends CostImpl {
public DiscardHandCost() {

View file

@ -39,7 +39,7 @@ import mage.players.Player;
*
* @author BetaSteward_at_googlemail.com
*/
public class DiscardSourceCost extends CostImpl<DiscardSourceCost> {
public class DiscardSourceCost extends CostImpl {
public DiscardSourceCost() {}

View file

@ -43,7 +43,7 @@ import mage.target.common.TargetCardInHand;
*
* @author BetaSteward_at_googlemail.com
*/
public class DiscardTargetCost extends CostImpl<DiscardTargetCost> {
public class DiscardTargetCost extends CostImpl {
List<Card> cards = new ArrayList<>();
protected boolean randomDiscard;

View file

@ -41,7 +41,7 @@ import mage.target.common.TargetCardInHand;
* @author LevelX2
*/
public class DiscardXTargetCost extends VariableCostImpl<DiscardXTargetCost> {
public class DiscardXTargetCost extends VariableCostImpl {
protected FilterCard filter;

View file

@ -44,7 +44,7 @@ import mage.util.CardUtil;
*
* @author nantuko
*/
public class ExileFromGraveCost extends CostImpl<ExileFromGraveCost> {
public class ExileFromGraveCost extends CostImpl {
public ExileFromGraveCost(TargetCardInYourGraveyard target) {
this.addTarget(target);

View file

@ -45,7 +45,7 @@ import mage.target.common.TargetCardInHand;
*
* @author LevelX2
*/
public class ExileFromHandCost extends CostImpl<ExileFromHandCost> {
public class ExileFromHandCost extends CostImpl {
List<Card> cards = new ArrayList<Card>();

View file

@ -42,7 +42,7 @@ import mage.target.TargetSpell;
*
* @author LevelX2
*/
public class ExileFromStackCost extends CostImpl<ExileFromStackCost> {
public class ExileFromStackCost extends CostImpl {
public ExileFromStackCost(TargetSpell target) {
this.addTarget(target);

View file

@ -39,7 +39,7 @@ import mage.game.permanent.Permanent;
*
* @author BetaSteward_at_googlemail.com
*/
public class ExileSourceCost extends CostImpl<ExileSourceCost> {
public class ExileSourceCost extends CostImpl {
public ExileSourceCost() {
this.text = "Exile {this}";

View file

@ -39,7 +39,7 @@ import java.util.UUID;
*
* @author magenoxx_at_gmail.com
*/
public class ExileSourceFromGraveCost extends CostImpl<ExileSourceFromGraveCost> {
public class ExileSourceFromGraveCost extends CostImpl {
public ExileSourceFromGraveCost() {
this.text = "Exile this card from your graveyard";

View file

@ -41,7 +41,7 @@ import mage.target.common.TargetCardInYourGraveyard;
* @author LevelX2
*/
public class ExileXFromYourGraveCost extends VariableCostImpl<ExileXFromYourGraveCost> {
public class ExileXFromYourGraveCost extends VariableCostImpl {
protected FilterCard filter;

View file

@ -22,7 +22,7 @@ import mage.target.TargetPlayer;
*
* @author LevelX2
*/
public class GainLifeOpponentCost extends CostImpl<GainLifeOpponentCost> {
public class GainLifeOpponentCost extends CostImpl {
private static final FilterPlayer filter = new FilterPlayer("opponent that can gain life");

View file

@ -38,7 +38,7 @@ import mage.players.Player;
*
* @author LevelX2
*/
public class GainLifePlayersCost extends CostImpl<GainLifePlayersCost> {
public class GainLifePlayersCost extends CostImpl {
private final int amount;

View file

@ -40,7 +40,7 @@ import mage.game.Game;
*
* @author BetaSteward_at_googlemail.com
*/
public class MetalcraftCost extends CostImpl<MetalcraftCost> {
public class MetalcraftCost extends CostImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact");

View file

@ -37,7 +37,7 @@ import mage.game.Game;
*
* @author BetaSteward_at_googlemail.com
*/
public class OnlyDuringUpkeepCost extends CostImpl<OnlyDuringUpkeepCost> {
public class OnlyDuringUpkeepCost extends CostImpl {
public OnlyDuringUpkeepCost() {
text = "Activate this ability only during your upkeep";

View file

@ -38,7 +38,7 @@ import java.util.UUID;
*
* @author BetaSteward_at_googlemail.com
*/
public class PayLifeCost extends CostImpl<PayLifeCost> {
public class PayLifeCost extends CostImpl {
private final int amount;

View file

@ -40,7 +40,7 @@ import mage.game.permanent.Permanent;
*
* @author BetaSteward_at_googlemail.com
*/
public class PayLoyaltyCost extends CostImpl<PayLoyaltyCost> {
public class PayLoyaltyCost extends CostImpl {
private final int amount;

View file

@ -39,7 +39,7 @@ import mage.players.Player;
* @author LevelX2
*/
public class PayVariableLifeCost extends VariableCostImpl<PayVariableLifeCost> {
public class PayVariableLifeCost extends VariableCostImpl {
public PayVariableLifeCost() {
this(false);

View file

@ -40,7 +40,7 @@ import mage.game.permanent.Permanent;
*
* @author BetaSteward_at_googlemail.com
*/
public class PayVariableLoyaltyCost extends VariableCostImpl<PayVariableLoyaltyCost> {
public class PayVariableLoyaltyCost extends VariableCostImpl {
public PayVariableLoyaltyCost() {
super("loyality counters to remove");

View file

@ -40,7 +40,7 @@ import mage.util.CardUtil;
*
* @author jeffwadsworth
*/
public class PutCountersSourceCost extends CostImpl<PutCountersSourceCost> {
public class PutCountersSourceCost extends CostImpl {
private int amount;
private String name;

View file

@ -43,7 +43,7 @@ import mage.util.CardUtil;
*/
public class PutTopCardOfYourLibraryToGraveyardCost extends CostImpl<PutTopCardOfYourLibraryToGraveyardCost> {
public class PutTopCardOfYourLibraryToGraveyardCost extends CostImpl {
int numberOfCards;

View file

@ -49,7 +49,7 @@ import mage.util.CardUtil;
*
* @author LevelX
*/
public class RemoveCounterCost extends CostImpl<RemoveCounterCost> {
public class RemoveCounterCost extends CostImpl {
private TargetPermanent target;
private String name;

View file

@ -40,7 +40,7 @@ import mage.util.CardUtil;
*
* @author BetaSteward_at_googlemail.com
*/
public class RemoveCountersSourceCost extends CostImpl<RemoveCountersSourceCost> {
public class RemoveCountersSourceCost extends CostImpl {
private int amount;
private String name;

View file

@ -39,7 +39,7 @@ import mage.game.permanent.Permanent;
*
* @author LevelX2
*/
public class RemoveVariableCountersSourceCost extends VariableCostImpl<RemoveVariableCountersSourceCost> {
public class RemoveVariableCountersSourceCost extends VariableCostImpl {
protected int minimalCountersToPay = 0;
private String counterName;

View file

@ -43,7 +43,7 @@ import mage.target.TargetPermanent;
*
* @author LevelX
*/
public class RemoveVariableCountersTargetCost extends VariableCostImpl<RemoveVariableCountersTargetCost> {
public class RemoveVariableCountersTargetCost extends VariableCostImpl {
protected FilterPermanent filter;
protected CounterType counterTypeToRemove;

View file

@ -39,7 +39,7 @@ import mage.game.permanent.Permanent;
/**
* @author Loki
*/
public class ReturnToHandSourceCost extends CostImpl<ReturnToHandSourceCost> {
public class ReturnToHandSourceCost extends CostImpl {
public ReturnToHandSourceCost() {
this.text = "return {this} to it's owner's hand";

View file

@ -42,7 +42,7 @@ import mage.target.common.TargetControlledPermanent;
*
* @author BetaSteward_at_googlemail.com
*/
public class ReturnToHandTargetCost extends CostImpl<ReturnToHandTargetCost> {
public class ReturnToHandTargetCost extends CostImpl {
public ReturnToHandTargetCost(TargetControlledPermanent target) {
this.addTarget(target);

View file

@ -45,7 +45,7 @@ import mage.players.Player;
*
*/
public class RevealSourceFromYourHandCost extends CostImpl<RevealSourceFromYourHandCost> {
public class RevealSourceFromYourHandCost extends CostImpl {
public RevealSourceFromYourHandCost() {
this.text = "reveal {this} from your hand";
}

View file

@ -42,7 +42,7 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
public class RevealTargetFromHandCost extends CostImpl<RevealTargetFromHandCost> {
public class RevealTargetFromHandCost extends CostImpl {
public int convertedManaCosts = 0;
protected int numberCardsRevealed = 0;

View file

@ -41,7 +41,7 @@ import mage.target.common.TargetControlledPermanent;
*
* @author LevelX2
*/
public class SacrificeAllCost extends CostImpl<SacrificeAllCost> {
public class SacrificeAllCost extends CostImpl {
private FilterPermanent filter;
private List<Permanent> permanents = new ArrayList<Permanent>();

View file

@ -39,7 +39,7 @@ import java.util.UUID;
*
* @author BetaSteward_at_googlemail.com
*/
public class SacrificeSourceCost extends CostImpl<SacrificeSourceCost> {
public class SacrificeSourceCost extends CostImpl {
public SacrificeSourceCost() {
this.text = "Sacrifice {this}";

View file

@ -43,7 +43,7 @@ import java.util.UUID;
*
* @author BetaSteward_at_googlemail.com
*/
public class SacrificeTargetCost extends CostImpl<SacrificeTargetCost> {
public class SacrificeTargetCost extends CostImpl {
List<Permanent> permanents = new ArrayList<>();

View file

@ -39,7 +39,7 @@ import mage.target.common.TargetControlledPermanent;
*
* @author LevelX2
*/
public class SacrificeXTargetCost extends VariableCostImpl<SacrificeXTargetCost> {
public class SacrificeXTargetCost extends VariableCostImpl {
protected FilterControlledPermanent filter;

View file

@ -41,7 +41,7 @@ import mage.game.permanent.Permanent;
*
* @author BetaSteward_at_googlemail.com
*/
public class TapSourceCost extends CostImpl<TapSourceCost> {
public class TapSourceCost extends CostImpl {
public TapSourceCost() {
this.text = "{T}";

View file

@ -42,7 +42,7 @@ import mage.util.CardUtil;
*
* @author BetaSteward_at_googlemail.com
*/
public class TapTargetCost extends CostImpl<TapTargetCost> {
public class TapTargetCost extends CostImpl {
TargetControlledPermanent target;

View file

@ -39,7 +39,7 @@ import mage.target.common.TargetControlledPermanent;
*
* @author BetaSteward_at_googlemail.com
*/
public class TapVariableTargetCost extends VariableCostImpl<TapVariableTargetCost> {
public class TapVariableTargetCost extends VariableCostImpl {
protected FilterControlledPermanent filter;

View file

@ -38,7 +38,7 @@ import mage.game.permanent.Permanent;
*
* @author Plopman
*/
public class UntapSourceCost extends CostImpl<UntapSourceCost> {
public class UntapSourceCost extends CostImpl {
public UntapSourceCost() {
this.text = "{Q}";

View file

@ -42,7 +42,7 @@ import java.util.UUID;
*
* @author jeffwadsworth
*/
public class UntapTargetCost extends CostImpl<UntapTargetCost> {
public class UntapTargetCost extends CostImpl {
TargetControlledPermanent target;

View file

@ -34,7 +34,7 @@ import mage.constants.ColoredManaSymbol;
import mage.game.Game;
import mage.players.ManaPool;
public class ColoredManaCost extends ManaCostImpl<ColoredManaCost> {
public class ColoredManaCost extends ManaCostImpl {
protected ColoredManaSymbol mana;

View file

@ -34,7 +34,7 @@ import mage.constants.ColoredManaSymbol;
import mage.game.Game;
import mage.players.ManaPool;
public class GenericManaCost extends ManaCostImpl<GenericManaCost> {
public class GenericManaCost extends ManaCostImpl {
protected int mana;

View file

@ -33,7 +33,7 @@ import mage.constants.ColoredManaSymbol;
import mage.game.Game;
import mage.players.ManaPool;
public class HybridManaCost extends ManaCostImpl<HybridManaCost> {
public class HybridManaCost extends ManaCostImpl {
private final ColoredManaSymbol mana1;
private final ColoredManaSymbol mana2;

View file

@ -41,16 +41,13 @@ import mage.players.ManaPool;
import mage.players.Player;
public abstract class ManaCostImpl<T extends ManaCostImpl<T>> extends CostImpl<T> implements ManaCost {
public abstract class ManaCostImpl extends CostImpl implements ManaCost {
protected Mana payment;
protected Mana cost;
protected ManaOptions options;
protected Filter sourceFilter;
@Override
public abstract T copy();
public ManaCostImpl() {
payment = new Mana();
options = new ManaOptions();
@ -204,10 +201,7 @@ public abstract class ManaCostImpl<T extends ManaCostImpl<T>> extends CostImpl<T
}
protected boolean isColorlessPaid(int mana) {
if (this.payment.count() >= mana) {
return true;
}
return false;
return this.payment.count() >= mana;
}
@Override

View file

@ -33,7 +33,7 @@ import mage.constants.ColoredManaSymbol;
import mage.game.Game;
import mage.players.ManaPool;
public class MonoHybridManaCost extends ManaCostImpl<MonoHybridManaCost> {
public class MonoHybridManaCost extends ManaCostImpl {
private final ColoredManaSymbol mana;
private int mana2 = 2;

View file

@ -41,7 +41,7 @@ import mage.players.ManaPool;
*
* @author BetaSteward_at_googlemail.com
*/
public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements VariableCost {
public class VariableManaCost extends ManaCostImpl implements VariableCost {
protected int multiplier;
protected FilterMana filter;

View file

@ -133,7 +133,7 @@ public class ChampionAbility extends StaticAbility {
}
}
class ChampionExileCost extends CostImpl<ChampionExileCost> {
class ChampionExileCost extends CostImpl {
private String exileZone = null;

View file

@ -144,7 +144,7 @@ class NinjutsuEffect extends OneShotEffect {
}
}
class ReturnAttackerToHandTargetCost extends CostImpl<ReturnAttackerToHandTargetCost> {
class ReturnAttackerToHandTargetCost extends CostImpl {
private UUID defendingPlayerId;
@ -188,7 +188,7 @@ class ReturnAttackerToHandTargetCost extends CostImpl<ReturnAttackerToHandTarget
}
}
class RevealNinjutsuCardCost extends CostImpl<RevealNinjutsuCardCost> {
class RevealNinjutsuCardCost extends CostImpl {
public RevealNinjutsuCardCost() {
this.text = "reveal ninjutsu card";